/** @file\r
\r
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
&gEfiPeiVirtualBlockIo2PpiGuid,\r
NULL\r
},\r
+ { // EndOfPeiNotifyList\r
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+ &gEfiEndOfPeiSignalPpiGuid,\r
+ EmmcBlockIoPeimEndOfPei\r
+ },\r
{ // Slot\r
{\r
0,\r
return Status;\r
}\r
\r
+/**\r
+ One notified function to cleanup the allocated DMA buffers at the end of PEI.\r
+\r
+ @param[in] PeiServices Pointer to PEI Services Table.\r
+ @param[in] NotifyDescriptor Pointer to the descriptor for the Notification\r
+ event that caused this function to execute.\r
+ @param[in] Ppi Pointer to the PPI data associated with this function.\r
+\r
+ @retval EFI_SUCCESS The function completes successfully\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EmmcBlockIoPeimEndOfPei (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
+ IN VOID *Ppi\r
+ )\r
+{\r
+ EMMC_PEIM_HC_PRIVATE_DATA *Private;\r
+\r
+ Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY (NotifyDescriptor);\r
+\r
+ if ((Private->Pool != NULL) && (Private->Pool->Head != NULL)) {\r
+ EmmcPeimFreeMemPool (Private->Pool);\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
/**\r
The user code starts with this function.\r
\r
return EFI_DEVICE_ERROR;\r
}\r
\r
+ IoMmuInit ();\r
+\r
Controller = 0;\r
MmioBase = NULL;\r
while (TRUE) {\r
\r
if (!EFI_ERROR (Status)) {\r
PeiServicesInstallPpi (&Private->BlkIoPpiList);\r
+ PeiServicesNotifyPpi (&Private->EndOfPeiNotifyList);\r
+ } else {\r
+ if (Private->Pool->Head != NULL) {\r
+ EmmcPeimFreeMemPool (Private->Pool);\r
+ }\r
}\r
}\r
\r