/** @file\r
\r
-Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
)\r
{\r
UFS_PEIM_MEM_BLOCK *Block;\r
+ VOID *BufHost;\r
+ VOID *Mapping;\r
+ EFI_PHYSICAL_ADDRESS MappedAddr;\r
EFI_STATUS Status;\r
VOID *TempPtr;\r
- EFI_PHYSICAL_ADDRESS Address;\r
\r
TempPtr = NULL;\r
Block = NULL;\r
\r
Block->Bits = (UINT8*)(UINTN)TempPtr;\r
\r
- Status = PeiServicesAllocatePages (\r
- EfiBootServicesCode,\r
+ Status = IoMmuAllocateBuffer (\r
Pages,\r
- &Address\r
+ &BufHost,\r
+ &MappedAddr,\r
+ &Mapping\r
);\r
if (EFI_ERROR (Status)) {\r
return NULL;\r
}\r
\r
- ZeroMem ((VOID*)(UINTN)Address, EFI_PAGES_TO_SIZE (Pages));\r
+ ZeroMem ((VOID*)(UINTN)BufHost, EFI_PAGES_TO_SIZE (Pages));\r
\r
- Block->Buf = (UINT8*)((UINTN)Address);\r
- Block->Next = NULL;\r
+ Block->BufHost = (UINT8 *) (UINTN) BufHost;\r
+ Block->Buf = (UINT8 *) (UINTN) MappedAddr;\r
+ Block->Mapping = Mapping;\r
+ Block->Next = NULL;\r
\r
return Block;\r
}\r
)\r
{\r
ASSERT ((Pool != NULL) && (Block != NULL));\r
+\r
+ IoMmuFreeBuffer (EFI_SIZE_TO_PAGES (Block->BufLen), Block->BufHost, Block->Mapping);\r
}\r
\r
/**\r