From 0c2b5da80e9551286cd02a92d91090290ae2d816 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Tue, 4 Sep 2007 06:12:48 +0000 Subject: Merge the PI enabling works from the branch First round of PI enabling work: 1) PiPeiCis changes (CONST, EFI_PEI_FILE_HANDLE.. etc) 2) Make use of FirmwareVolume 2 protocol. 3) Verified for Nt32Pkg and real platform for S3. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3773 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Pei/BootMode/BootMode.c | 8 ++-- MdeModulePkg/Core/Pei/FwVol/FwVol.c | 30 +++++++++----- MdeModulePkg/Core/Pei/Hob/Hob.c | 4 +- MdeModulePkg/Core/Pei/Memory/MemoryServices.c | 6 +-- MdeModulePkg/Core/Pei/PeiMain.h | 56 +++++++++++++-------------- MdeModulePkg/Core/Pei/Ppi/Ppi.c | 40 +++++++++---------- MdeModulePkg/Core/Pei/StatusCode/StatusCode.c | 12 +++--- 7 files changed, 83 insertions(+), 73 deletions(-) (limited to 'MdeModulePkg/Core/Pei') diff --git a/MdeModulePkg/Core/Pei/BootMode/BootMode.c b/MdeModulePkg/Core/Pei/BootMode/BootMode.c index bec0304113..fbfd02f84c 100644 --- a/MdeModulePkg/Core/Pei/BootMode/BootMode.c +++ b/MdeModulePkg/Core/Pei/BootMode/BootMode.c @@ -28,8 +28,8 @@ Revision History EFI_STATUS EFIAPI PeiGetBootMode ( - IN EFI_PEI_SERVICES **PeiServices, - OUT EFI_BOOT_MODE *BootMode + IN CONST EFI_PEI_SERVICES **PeiServices, + OUT EFI_BOOT_MODE *BootMode ) /*++ @@ -71,8 +71,8 @@ Returns: EFI_STATUS EFIAPI PeiSetBootMode ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_BOOT_MODE BootMode + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_BOOT_MODE BootMode ) /*++ diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index d144fb85ec..a5065632c3 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -251,9 +251,9 @@ Returns: EFI_STATUS EFIAPI PeiFfsFindSectionData ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_SECTION_TYPE SectionType, - IN EFI_FFS_FILE_HEADER *FfsFileHeader, + IN EFI_PEI_FILE_HANDLE FileHandle, IN OUT VOID **SectionData ) /*++ @@ -279,8 +279,10 @@ Returns: EFI_COMMON_SECTION_HEADER *Section; UINT32 SectionLength; UINT32 ParsedLength; - + EFI_FFS_FILE_HEADER *FfsFileHeader; + FfsFileHeader = (EFI_FFS_FILE_HEADER *) FileHandle; + // // Size is 24 bits wide so mask upper 8 bits. // Does not include FfsFileHeader header size @@ -355,10 +357,10 @@ Returns: EFI_STATUS EFIAPI PeiFfsFindNextFile ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_FV_FILETYPE SearchType, - IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader, - IN OUT EFI_FFS_FILE_HEADER **FileHeader + IN CONST EFI_PEI_SERVICES **PeiServices, + IN UINT8 SearchType, + IN EFI_PEI_FV_HANDLE VolumeHandle, + IN OUT EFI_PEI_FILE_HANDLE *FileHandle ) /*++ @@ -385,6 +387,12 @@ Returns: --*/ { + EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader; + EFI_FFS_FILE_HEADER **FileHeader; + + FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)VolumeHandle; + FileHeader = (EFI_FFS_FILE_HEADER **) FileHandle; + return PeiFfsFindNextFileEx ( SearchType, FwVolHeader, @@ -396,9 +404,9 @@ Returns: EFI_STATUS EFIAPI PeiFvFindNextVolume ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Instance, - IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader + IN OUT EFI_PEI_FV_HANDLE *VolumeHandle ) /*++ @@ -429,7 +437,9 @@ Returns: EFI_STATUS Status; EFI_PEI_FIND_FV_PPI *FindFvPpi; UINT8 LocalInstance; + EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader; + FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER **) VolumeHandle; LocalInstance = (UINT8) Instance; @@ -463,7 +473,7 @@ Returns: } else { Status = FindFvPpi->FindFv ( FindFvPpi, - PeiServices, + (EFI_PEI_SERVICES **)PeiServices, &LocalInstance, FwVolHeader ); diff --git a/MdeModulePkg/Core/Pei/Hob/Hob.c b/MdeModulePkg/Core/Pei/Hob/Hob.c index 9ac672b24d..803a4e05de 100644 --- a/MdeModulePkg/Core/Pei/Hob/Hob.c +++ b/MdeModulePkg/Core/Pei/Hob/Hob.c @@ -24,7 +24,7 @@ Abstract: EFI_STATUS EFIAPI PeiGetHobList ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT VOID **HobList ) /*++ @@ -71,7 +71,7 @@ Returns: EFI_STATUS EFIAPI PeiCreateHob ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINT16 Type, IN UINT16 Length, IN OUT VOID **Hob diff --git a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c index e623c01099..431084f83b 100644 --- a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c +++ b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c @@ -100,7 +100,7 @@ Returns: EFI_STATUS EFIAPI PeiInstallPeiMemory ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS MemoryBegin, IN UINT64 MemoryLength ) @@ -182,7 +182,7 @@ Returns: EFI_STATUS EFIAPI PeiAllocatePages ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory @@ -275,7 +275,7 @@ Returns: EFI_STATUS EFIAPI PeiAllocatePool ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Size, OUT VOID **Buffer ) diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h index e71ae78b04..9e0d7a8530 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.h +++ b/MdeModulePkg/Core/Pei/PeiMain.h @@ -462,7 +462,7 @@ Returns: VOID ConvertPpiPointers ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_HOB_HANDOFF_INFO_TABLE *OldHandOffHob, IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob ) @@ -486,8 +486,8 @@ Returns: EFI_STATUS EFIAPI PeiInstallPpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_PPI_DESCRIPTOR *PpiList + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList ) /*++ @@ -513,9 +513,9 @@ Returns: EFI_STATUS EFIAPI PeiReInstallPpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_PPI_DESCRIPTOR *OldPpi, - IN EFI_PEI_PPI_DESCRIPTOR *NewPpi + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi, + IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi ) /*++ @@ -542,8 +542,8 @@ Returns: EFI_STATUS EFIAPI PeiLocatePpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_GUID *Guid, + 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 @@ -573,8 +573,8 @@ Returns: EFI_STATUS EFIAPI PeiNotifyPpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList ) /*++ @@ -617,7 +617,7 @@ Returns: VOID DispatchNotify ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN NotifyType, IN INTN InstallStartIndex, IN INTN InstallStopIndex, @@ -650,7 +650,7 @@ Returns: None EFI_STATUS EFIAPI PeiGetBootMode ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT EFI_BOOT_MODE *BootMode ) /*++ @@ -675,7 +675,7 @@ Returns: EFI_STATUS EFIAPI PeiSetBootMode ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_BOOT_MODE BootMode ) /*++ @@ -772,7 +772,7 @@ Returns: EFI_STATUS EFIAPI PeiGetHobList ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT VOID **HobList ) /*++ @@ -798,7 +798,7 @@ Returns: EFI_STATUS EFIAPI PeiCreateHob ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINT16 Type, IN UINT16 Length, IN OUT VOID **Hob @@ -858,10 +858,10 @@ Returns: EFI_STATUS EFIAPI PeiFfsFindNextFile ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINT8 SearchType, - IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader, - IN OUT EFI_FFS_FILE_HEADER **FileHeader + IN EFI_PEI_FV_HANDLE FwVolHeader, + IN OUT EFI_PEI_FILE_HANDLE *FileHeader ) /*++ @@ -892,9 +892,9 @@ Returns: EFI_STATUS EFIAPI PeiFfsFindSectionData ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_SECTION_TYPE SectionType, - IN EFI_FFS_FILE_HEADER *FfsFileHeader, + IN EFI_PEI_FILE_HANDLE FfsFileHeader, IN OUT VOID **SectionData ) /*++ @@ -920,9 +920,9 @@ Returns: EFI_STATUS EFIAPI PeiFvFindNextVolume ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Instance, - IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader + IN OUT EFI_PEI_FV_HANDLE *FwVolHeader ) /*++ @@ -982,7 +982,7 @@ Returns: EFI_STATUS EFIAPI PeiInstallPeiMemory ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS MemoryBegin, IN UINT64 MemoryLength ) @@ -1009,7 +1009,7 @@ Returns: EFI_STATUS EFIAPI PeiAllocatePages ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory @@ -1043,7 +1043,7 @@ Returns: EFI_STATUS EFIAPI PeiAllocatePool ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Size, OUT VOID **Buffer ) @@ -1101,12 +1101,12 @@ Returns: EFI_STATUS EFIAPI PeiReportStatusCode ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, - IN EFI_GUID *CallerId, - IN EFI_STATUS_CODE_DATA *Data OPTIONAL + IN CONST EFI_GUID *CallerId, + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL ) /*++ diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c index c8bea851a5..e429b665a2 100644 --- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c +++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c @@ -60,7 +60,7 @@ Returns: VOID ConvertPpiPointers ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_HOB_HANDOFF_INFO_TABLE *OldHandOffHob, IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob ) @@ -139,8 +139,8 @@ Returns: EFI_STATUS EFIAPI PeiInstallPpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_PPI_DESCRIPTOR *PpiList + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList ) /*++ @@ -202,7 +202,7 @@ Returns: } DEBUG((EFI_D_INFO, "Install PPI: %g\n", PpiList->Guid)); - PrivateData->PpiData.PpiListPtrs[Index].Ppi = PpiList; + PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR*) PpiList; PrivateData->PpiData.PpiListEnd++; // @@ -220,7 +220,7 @@ Returns: // Dispatch any callback level notifies for newly installed PPIs. // DispatchNotify ( - PeiServices, + (CONST EFI_PEI_SERVICES **) PeiServices, EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, LastCallbackInstall, PrivateData->PpiData.PpiListEnd, @@ -236,9 +236,9 @@ Returns: EFI_STATUS EFIAPI PeiReInstallPpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_PPI_DESCRIPTOR *OldPpi, - IN EFI_PEI_PPI_DESCRIPTOR *NewPpi + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi, + IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi ) /*++ @@ -292,13 +292,13 @@ Returns: // Remove the old PPI from the database, add the new one. // DEBUG((EFI_D_INFO, "Reinstall PPI: %g\n", NewPpi->Guid)); - PrivateData->PpiData.PpiListPtrs[Index].Ppi = NewPpi; + PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *) NewPpi; // // Dispatch any callback level notifies for the newly installed PPI. // DispatchNotify ( - PeiServices, + (CONST EFI_PEI_SERVICES **) PeiServices, EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, Index, Index+1, @@ -314,8 +314,8 @@ Returns: EFI_STATUS EFIAPI PeiLocatePpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_GUID *Guid, + 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 @@ -389,8 +389,8 @@ Returns: EFI_STATUS EFIAPI PeiNotifyPpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList ) /*++ @@ -458,7 +458,7 @@ Returns: NotifyDispatchCount ++; } - PrivateData->PpiData.PpiListPtrs[Index].Notify = NotifyList; + PrivateData->PpiData.PpiListPtrs[Index].Notify = (EFI_PEI_NOTIFY_DESCRIPTOR *) NotifyList; PrivateData->PpiData.NotifyListEnd--; DEBUG((EFI_D_INFO, "Register PPI Notify: %g\n", NotifyList->Guid)); @@ -496,7 +496,7 @@ Returns: // Dispatch any callback level notifies for all previously installed PPIs. // DispatchNotify ( - PeiServices, + (CONST EFI_PEI_SERVICES **) PeiServices, EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, 0, PrivateData->PpiData.PpiListEnd, @@ -545,7 +545,7 @@ Returns: while (PrivateData->PpiData.LastDispatchedNotify != PrivateData->PpiData.DispatchListEnd) { TempValue = PrivateData->PpiData.DispatchListEnd; DispatchNotify ( - PeiServices, + (CONST EFI_PEI_SERVICES **) PeiServices, EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH, 0, PrivateData->PpiData.LastDispatchedInstall, @@ -566,7 +566,7 @@ Returns: while (PrivateData->PpiData.LastDispatchedInstall != PrivateData->PpiData.PpiListEnd) { TempValue = PrivateData->PpiData.PpiListEnd; DispatchNotify ( - PeiServices, + (CONST EFI_PEI_SERVICES **) PeiServices, EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH, PrivateData->PpiData.LastDispatchedInstall, PrivateData->PpiData.PpiListEnd, @@ -585,7 +585,7 @@ Returns: VOID DispatchNotify ( - IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN NotifyType, IN INTN InstallStartIndex, IN INTN InstallStopIndex, @@ -645,7 +645,7 @@ Returns: None NotifyDescriptor->Notify )); NotifyDescriptor->Notify ( - PeiServices, + (EFI_PEI_SERVICES **)PeiServices, NotifyDescriptor, (PrivateData->PpiData.PpiListPtrs[Index2].Ppi)->Ppi ); diff --git a/MdeModulePkg/Core/Pei/StatusCode/StatusCode.c b/MdeModulePkg/Core/Pei/StatusCode/StatusCode.c index b9316b6e9e..04a4519844 100644 --- a/MdeModulePkg/Core/Pei/StatusCode/StatusCode.c +++ b/MdeModulePkg/Core/Pei/StatusCode/StatusCode.c @@ -26,12 +26,12 @@ Revision History EFI_STATUS EFIAPI PeiReportStatusCode ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_STATUS_CODE_TYPE CodeType, - IN EFI_STATUS_CODE_VALUE Value, - IN UINT32 Instance, - IN EFI_GUID *CallerId, - IN EFI_STATUS_CODE_DATA *Data OPTIONAL + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN CONST EFI_GUID *CallerId, + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL ) /*++ -- cgit v1.2.3