X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FPei%2FPpi%2FPpi.c;h=6feab63412f44d8d4c932145abe81e65618b0834;hp=fa60d82a5be0857160a9bd4e537c26f74d8486de;hb=2fead09fae17666cf82bcfeb38425af3adcbe646;hpb=b1f6a7c636fca9eda65a3045302de577c00e438d diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c index fa60d82a5b..6feab63412 100644 --- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c +++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c @@ -12,13 +12,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "PeiMain.h" /** Initialize PPI services. - @param PrivateData Pointer to the PEI Core data. @param OldCoreData Pointer to old PEI Core data. NULL if being run in non-permament memory mode. @@ -41,28 +40,25 @@ InitializePpiServices ( Migrate the Hob list from the CAR stack to PEI installed memory. - @param PeiServices The PEI core services table. - @param OldCheckingBottom The old checking bottom. - @param OldCheckingTop The old checking top. - @param NewHandOffHob The new handoff HOB list. + @param PrivateData Pointer to PeiCore's private data structure. + @param OldCheckingBottom Bottom of temporary memory range. All Ppi in this range + will be fixup for PpiData and PpiDescriptor pointer. + @param OldCheckingTop Top of temporary memory range. All Ppi in this range + will be fixup for PpiData and PpiDescriptor. + @param Fixup The address difference between + the new Hob list and old Hob list. **/ VOID ConvertPpiPointers ( - IN CONST EFI_PEI_SERVICES **PeiServices, - IN UINTN OldCheckingBottom, - IN UINTN OldCheckingTop, - IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob + IN PEI_CORE_INSTANCE *PrivateData, + IN UINTN OldCheckingBottom, + IN UINTN OldCheckingTop, + IN INTN Fixup ) { - PEI_CORE_INSTANCE *PrivateData; UINT8 Index; PEI_PPI_LIST_POINTERS *PpiPointer; - UINTN Fixup; - - PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices); - - Fixup = (UINTN)NewHandOffHob - OldCheckingBottom; for (Index = 0; Index < FixedPcdGet32 (PcdPeiCoreMaxPpiSupported); Index++) { if (Index < PrivateData->PpiData.PpiListEnd || @@ -111,15 +107,17 @@ ConvertPpiPointers ( /** - Install PPI services. + This function installs an interface in the PEI PPI database by GUID. + The purpose of the service is to publish an interface that other parties + can use to call additional PEIMs. - @param PeiServices - Pointer to the PEI Service Table - @param PpiList - Pointer to a list of PEI PPI Descriptors. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param PpiList Pointer to a list of PEI PPI Descriptors. - @retval EFI_SUCCESS - if all PPIs in PpiList are successfully installed. - @retval EFI_INVALID_PARAMETER - if PpiList is NULL pointer - @retval EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid - @retval EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI + @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed. + @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer + if any PPI in PpiList is not valid + @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI **/ EFI_STATUS @@ -151,7 +149,7 @@ PeiInstallPpi ( for (;;) { // - // Since PpiData is used for NotifyList and InstallList, max resource + // Since PpiData is used for NotifyList and PpiList, max resource // is reached if the Install reaches the NotifyList // if (Index == PrivateData->PpiData.NotifyListEnd + 1) { @@ -164,7 +162,7 @@ PeiInstallPpi ( // if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) == 0) { PrivateData->PpiData.PpiListEnd = LastCallbackInstall; - DEBUG((EFI_D_ERROR, "ERROR -> InstallPpi: %g %x\n", PpiList->Guid, PpiList->Ppi)); + DEBUG((EFI_D_ERROR, "ERROR -> InstallPpi: %g %p\n", PpiList->Guid, PpiList->Ppi)); return EFI_INVALID_PARAMETER; } @@ -201,16 +199,19 @@ PeiInstallPpi ( /** - Re-Install PPI services. + This function reinstalls an interface in the PEI PPI database by GUID. + The purpose of the service is to publish an interface that other parties can + use to replace an interface of the same name in the protocol database with a + different interface. - @param PeiServices - Pointer to the PEI Service Table - @param OldPpi - Pointer to the old PEI PPI Descriptors. - @param NewPpi - Pointer to the new PEI PPI Descriptors. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param OldPpi Pointer to the old PEI PPI Descriptors. + @param NewPpi Pointer to the new PEI PPI Descriptors. - @retval EFI_SUCCESS - if the operation was successful - @retval EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL - @retval EFI_INVALID_PARAMETER - if NewPpi is not valid - @retval EFI_NOT_FOUND - if the PPI was not in the database + @retval EFI_SUCCESS if the operation was successful + @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL + @retval EFI_INVALID_PARAMETER if NewPpi is not valid + @retval EFI_NOT_FOUND if the PPI was not in the database **/ EFI_STATUS @@ -252,6 +253,7 @@ PeiReInstallPpi ( // Remove the old PPI from the database, add the new one. // DEBUG((EFI_D_INFO, "Reinstall PPI: %g\n", NewPpi->Guid)); + ASSERT (Index < FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)); PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *) NewPpi; // @@ -275,12 +277,12 @@ PeiReInstallPpi ( Locate a given named PPI. - @param PeiServices - Pointer to the PEI Service Table - @param Guid - Pointer to GUID of the PPI. - @param Instance - Instance Number to discover. - @param PpiDescriptor - Pointer to reference the found descriptor. If not NULL, - returns a pointer to the descriptor (includes flags, etc) - @param Ppi - Pointer to reference the found PPI + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param Guid Pointer to GUID of the PPI. + @param Instance Instance Number to discover. + @param PpiDescriptor Pointer to reference the found descriptor. If not NULL, + returns a pointer to the descriptor (includes flags, etc) + @param Ppi Pointer to reference the found PPI @retval EFI_SUCCESS if the PPI is in the database @retval EFI_NOT_FOUND if the PPI is not in the database @@ -291,9 +293,9 @@ EFIAPI PeiLocatePpi ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_GUID *Guid, - IN UINTN Instance, - IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, - IN OUT VOID **Ppi + IN UINTN Instance, + IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, + IN OUT VOID **Ppi ) { PEI_CORE_INSTANCE *PrivateData; @@ -342,11 +344,12 @@ PeiLocatePpi ( /** - Install a notification for a given PPI. + This function installs a notification service to be called back when a given + interface is installed or reinstalled. The purpose of the service is to publish + an interface that other parties can use to call additional PPIs that may materialize later. - - @param PeiServices - Pointer to the PEI Service Table - @param NotifyList - Pointer to list of Descriptors to notify upon. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param NotifyList Pointer to list of Descriptors to notify upon. @retval EFI_SUCCESS if successful @retval EFI_OUT_OF_RESOURCES if no space in the database @@ -399,7 +402,7 @@ PeiNotifyPpi ( // if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) == 0) { PrivateData->PpiData.NotifyListEnd = LastCallbackNotify; - DEBUG((EFI_D_ERROR, "ERROR -> InstallNotify: %g %x\n", NotifyList->Guid, NotifyList->Notify)); + DEBUG((EFI_D_ERROR, "ERROR -> InstallNotify: %g %p\n", NotifyList->Guid, NotifyList->Notify)); return EFI_INVALID_PARAMETER; } @@ -453,7 +456,6 @@ PeiNotifyPpi ( PrivateData->PpiData.NotifyListEnd ); - return EFI_SUCCESS; } @@ -568,19 +570,17 @@ DispatchNotify ( (((INT32 *)SearchGuid)[1] == ((INT32 *)CheckGuid)[1]) && (((INT32 *)SearchGuid)[2] == ((INT32 *)CheckGuid)[2]) && (((INT32 *)SearchGuid)[3] == ((INT32 *)CheckGuid)[3])) { - DEBUG ((EFI_D_INFO, "Notify: PPI Guid: %g, Peim notify entry point: %x\n", + DEBUG ((EFI_D_INFO, "Notify: PPI Guid: %g, Peim notify entry point: %p\n", SearchGuid, NotifyDescriptor->Notify )); NotifyDescriptor->Notify ( - GetPeiServicesTablePointer (), + (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (), NotifyDescriptor, (PrivateData->PpiData.PpiListPtrs[Index2].Ppi)->Ppi ); } } } - - return; }