From 177aabe660ae3ce78faa3789709619a98017f0a4 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Mon, 15 Oct 2007 11:15:39 +0000 Subject: 1) add gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported and gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv to replace the MACRO definitions. 2) Fix a bug in Pei dispatcher to suppoprt PEI Apriori file git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4116 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 14 +++++++------- MdeModulePkg/Core/Pei/FwVol/FwVol.c | 2 +- MdeModulePkg/Core/Pei/PeiMain.h | 14 ++++++-------- MdeModulePkg/Core/Pei/PeiMain.inf | 4 ++++ MdeModulePkg/MdeModulePkg.dec | 3 +++ MdeModulePkg/MdeModulePkg.dsc | 4 ++++ 6 files changed, 25 insertions(+), 16 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c index 7294d85..6923181 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -55,15 +55,15 @@ Returns: { EFI_STATUS Status; EFI_PEI_FV_HANDLE FileHandle; - EFI_PEI_FV_HANDLE AprioriFileHandle; + EFI_PEI_FILE_HANDLE AprioriFileHandle; EFI_GUID *Apriori; UINTN Index; UINTN Index2; UINTN PeimIndex; UINTN PeimCount; EFI_GUID *Guid; - EFI_PEI_FV_HANDLE TempFileHandles[PEI_CORE_MAX_PEIM_PER_FV]; - EFI_GUID FileGuid[PEI_CORE_MAX_PEIM_PER_FV]; + EFI_PEI_FV_HANDLE TempFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)]; + EFI_GUID FileGuid[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)]; // // Walk the FV and find all the PEIMs and the Apriori file. @@ -84,7 +84,7 @@ Returns: // // Go ahead to scan this Fv, and cache FileHandles within it. // - for (PeimCount = 0; PeimCount < PEI_CORE_MAX_PEIM_PER_FV; PeimCount++) { + for (PeimCount = 0; PeimCount < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv); PeimCount++) { Status = PeiFindFileEx ( VolumeHandle, NULL, @@ -104,7 +104,7 @@ Returns: // // Read the Apriori file // - Status = PeiServicesFfsFindSectionData (EFI_SECTION_RAW, &AprioriFileHandle, (VOID **) &Apriori); + Status = PeiServicesFfsFindSectionData (EFI_SECTION_RAW, AprioriFileHandle, (VOID **) &Apriori); if (!EFI_ERROR (Status)) { // // Calculate the number of PEIMs in the A Priori list @@ -249,7 +249,7 @@ Returns: SaveCurrentFileHandle = Private->CurrentFileHandle; for (Index1 = 0; Index1 <= SaveCurrentFvCount; Index1++) { - for (Index2 = 0; (Index2 < PEI_CORE_MAX_PEIM_PER_FV) && (Private->Fv[Index1].FvFileHandles[Index2] != NULL); Index2++) { + for (Index2 = 0; (Index2 < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->Fv[Index1].FvFileHandles[Index2] != NULL); Index2++) { if (Private->Fv[Index1].PeimState[Index2] == PEIM_STATE_REGISITER_FOR_SHADOW) { PeimFileHandle = Private->Fv[Index1].FvFileHandles[Index2]; Status = PeiLoadImage ( @@ -318,7 +318,7 @@ Returns: // Start to dispatch all modules within the current Fv. // for (PeimCount = Private->CurrentPeimCount; - (PeimCount < PEI_CORE_MAX_PEIM_PER_FV) && (Private->CurrentFvFileHandles[PeimCount] != NULL); + (PeimCount < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->CurrentFvFileHandles[PeimCount] != NULL); PeimCount++) { Private->CurrentPeimCount = PeimCount; PeimFileHandle = Private->CurrentFileHandle = Private->CurrentFvFileHandles[PeimCount]; diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index cd1de1b..181cfa0 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -366,7 +366,7 @@ Returns: PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); - if (PrivateData->FvCount >= PEI_CORE_MAX_FV_SUPPORTED) { + if (PrivateData->FvCount >= FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) { ASSERT (FALSE); } diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h index 0f87305..8c133d2 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.h +++ b/MdeModulePkg/Core/Pei/PeiMain.h @@ -49,6 +49,7 @@ Revision History #include #include #include +#include #include #include #include @@ -80,9 +81,6 @@ typedef struct { } PEI_PPI_DATABASE; -#define PEI_CORE_MAX_FV_SUPPORTED 6 -#define PEI_CORE_MAX_PEIM_PER_FV 32 - // // PEI_CORE_FV_HANDE.PeimState // Do not change these values as there is code doing math to change states. @@ -95,8 +93,8 @@ typedef struct { typedef struct { EFI_FIRMWARE_VOLUME_HEADER *FvHeader; - UINT8 PeimState[PEI_CORE_MAX_PEIM_PER_FV]; - EFI_PEI_FILE_HANDLE FvFileHandles[PEI_CORE_MAX_PEIM_PER_FV]; + UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)]; + EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)]; BOOLEAN ScanFv; } PEI_CORE_FV_HANDLE; @@ -111,14 +109,14 @@ typedef struct{ EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow PEI_PPI_DATABASE PpiData; UINTN FvCount; - PEI_CORE_FV_HANDLE Fv[PEI_CORE_MAX_FV_SUPPORTED]; - EFI_PEI_FILE_HANDLE CurrentFvFileHandles[PEI_CORE_MAX_PEIM_PER_FV]; + PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)]; + EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)]; UINTN AprioriCount; UINTN CurrentPeimFvCount; UINTN CurrentPeimCount; EFI_PEI_FILE_HANDLE CurrentFileHandle; UINTN AllFvCount; - EFI_PEI_FV_HANDLE AllFv[PEI_CORE_MAX_FV_SUPPORTED]; + EFI_PEI_FV_HANDLE AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)]; EFI_PEI_HOB_POINTERS HobList; BOOLEAN SwitchStackSignal; BOOLEAN PeiMemoryInstalled; diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf b/MdeModulePkg/Core/Pei/PeiMain.inf index 647e709..a954cad 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.inf +++ b/MdeModulePkg/Core/Pei/PeiMain.inf @@ -97,6 +97,10 @@ gEfiPeiLoadFilePpiGuid gEfiPeiSecurity2PpiGuid +[FixedPcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv + [BuildOptions.common] MSFT:DEBUG_*_IA32_CC_FLAGS = /FAcs diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 746d149..342af87 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -122,6 +122,8 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0|UINT32|0x0001001e gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0|UINT32|0x0001001f gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|28|UINT8|0x0001002f + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6|UINT32|0x00010030 + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32|UINT32|0x00010031 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0|UINT32|0x30000002 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0|UINT32|0x30000013 @@ -142,6 +144,7 @@ gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInputError|0x01020007|UINT32|0x30001000b gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseReset|0x01020001|UINT32|0x30001000c + [PcdsDynamic.common] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0|UINT32|0x30000002 diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 752aa85..c35a849 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -343,6 +343,10 @@ gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|0 gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10 + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6 + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32 + + [PcdsFixedAtBuild.IPF] gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf|0x0ffffc000000 -- cgit v1.1