0\r
}\r
},\r
+ { // EndOfPeiNotifyList\r
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+ &gEfiEndOfPeiSignalPpiGuid,\r
+ UfsEndOfPei\r
+ },\r
0, // UfsHcBase\r
0, // Capabilities\r
0, // TaskTag\r
0, // UtpTrlBase\r
0, // Nutrs\r
+ NULL, // TrlMapping\r
0, // UtpTmrlBase\r
0, // Nutmrs\r
+ NULL, // TmrlMapping\r
{ // Luns\r
{\r
UFS_LUN_0, // Ufs Common Lun 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
+UfsEndOfPei (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
+ IN VOID *Ppi\r
+ )\r
+{\r
+ UFS_PEIM_HC_PRIVATE_DATA *Private;\r
+\r
+ Private = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY (NotifyDescriptor);\r
+\r
+ if ((Private->Pool != NULL) && (Private->Pool->Head != NULL)) {\r
+ UfsPeimFreeMemPool (Private->Pool);\r
+ }\r
+\r
+ if (Private->UtpTmrlBase != NULL) {\r
+ IoMmuFreeBuffer (\r
+ EFI_SIZE_TO_PAGES (Private->Nutmrs * sizeof (UTP_TMRD)),\r
+ Private->UtpTmrlBase,\r
+ Private->TmrlMapping\r
+ );\r
+ }\r
+\r
+ if (Private->UtpTrlBase != NULL) {\r
+ IoMmuFreeBuffer (\r
+ EFI_SIZE_TO_PAGES (Private->Nutrs * sizeof (UTP_TRD)),\r
+ Private->UtpTrlBase,\r
+ Private->TrlMapping\r
+ );\r
+ }\r
+\r
+ UfsControllerStop (Private);\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 = 0;\r
while (TRUE) {\r
}\r
}\r
\r
- Status = PeiServicesInstallPpi (&Private->BlkIoPpiList);\r
+ PeiServicesInstallPpi (&Private->BlkIoPpiList);\r
+ PeiServicesNotifyPpi (&Private->EndOfPeiNotifyList);\r
Controller++;\r
}\r
\r