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
This commit is contained in:
qwang12 2007-10-15 11:15:39 +00:00
parent 96f6af14d6
commit 177aabe660
6 changed files with 25 additions and 16 deletions

View File

@ -55,15 +55,15 @@ Returns:
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PEI_FV_HANDLE FileHandle; EFI_PEI_FV_HANDLE FileHandle;
EFI_PEI_FV_HANDLE AprioriFileHandle; EFI_PEI_FILE_HANDLE AprioriFileHandle;
EFI_GUID *Apriori; EFI_GUID *Apriori;
UINTN Index; UINTN Index;
UINTN Index2; UINTN Index2;
UINTN PeimIndex; UINTN PeimIndex;
UINTN PeimCount; UINTN PeimCount;
EFI_GUID *Guid; EFI_GUID *Guid;
EFI_PEI_FV_HANDLE TempFileHandles[PEI_CORE_MAX_PEIM_PER_FV]; EFI_PEI_FV_HANDLE TempFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];
EFI_GUID FileGuid[PEI_CORE_MAX_PEIM_PER_FV]; EFI_GUID FileGuid[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];
// //
// Walk the FV and find all the PEIMs and the Apriori file. // 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. // 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 ( Status = PeiFindFileEx (
VolumeHandle, VolumeHandle,
NULL, NULL,
@ -104,7 +104,7 @@ Returns:
// //
// Read the Apriori file // Read the Apriori file
// //
Status = PeiServicesFfsFindSectionData (EFI_SECTION_RAW, &AprioriFileHandle, (VOID **) &Apriori); Status = PeiServicesFfsFindSectionData (EFI_SECTION_RAW, AprioriFileHandle, (VOID **) &Apriori);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
// //
// Calculate the number of PEIMs in the A Priori list // Calculate the number of PEIMs in the A Priori list
@ -249,7 +249,7 @@ Returns:
SaveCurrentFileHandle = Private->CurrentFileHandle; SaveCurrentFileHandle = Private->CurrentFileHandle;
for (Index1 = 0; Index1 <= SaveCurrentFvCount; Index1++) { 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) { if (Private->Fv[Index1].PeimState[Index2] == PEIM_STATE_REGISITER_FOR_SHADOW) {
PeimFileHandle = Private->Fv[Index1].FvFileHandles[Index2]; PeimFileHandle = Private->Fv[Index1].FvFileHandles[Index2];
Status = PeiLoadImage ( Status = PeiLoadImage (
@ -318,7 +318,7 @@ Returns:
// Start to dispatch all modules within the current Fv. // Start to dispatch all modules within the current Fv.
// //
for (PeimCount = Private->CurrentPeimCount; for (PeimCount = Private->CurrentPeimCount;
(PeimCount < PEI_CORE_MAX_PEIM_PER_FV) && (Private->CurrentFvFileHandles[PeimCount] != NULL); (PeimCount < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->CurrentFvFileHandles[PeimCount] != NULL);
PeimCount++) { PeimCount++) {
Private->CurrentPeimCount = PeimCount; Private->CurrentPeimCount = PeimCount;
PeimFileHandle = Private->CurrentFileHandle = Private->CurrentFvFileHandles[PeimCount]; PeimFileHandle = Private->CurrentFileHandle = Private->CurrentFvFileHandles[PeimCount];

View File

@ -366,7 +366,7 @@ Returns:
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
if (PrivateData->FvCount >= PEI_CORE_MAX_FV_SUPPORTED) { if (PrivateData->FvCount >= FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {
ASSERT (FALSE); ASSERT (FALSE);
} }

View File

@ -49,6 +49,7 @@ Revision History
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/CacheMaintenanceLib.h> #include <Library/CacheMaintenanceLib.h>
#include <Library/TimerLib.h> #include <Library/TimerLib.h>
#include <Library/PcdLib.h>
#include <IndustryStandard/PeImage.h> #include <IndustryStandard/PeImage.h>
#include <Library/PeiServicesTablePointerLib.h> #include <Library/PeiServicesTablePointerLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
@ -80,9 +81,6 @@ typedef struct {
} PEI_PPI_DATABASE; } PEI_PPI_DATABASE;
#define PEI_CORE_MAX_FV_SUPPORTED 6
#define PEI_CORE_MAX_PEIM_PER_FV 32
// //
// PEI_CORE_FV_HANDE.PeimState // PEI_CORE_FV_HANDE.PeimState
// Do not change these values as there is code doing math to change states. // Do not change these values as there is code doing math to change states.
@ -95,8 +93,8 @@ typedef struct {
typedef struct { typedef struct {
EFI_FIRMWARE_VOLUME_HEADER *FvHeader; EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
UINT8 PeimState[PEI_CORE_MAX_PEIM_PER_FV]; UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];
EFI_PEI_FILE_HANDLE FvFileHandles[PEI_CORE_MAX_PEIM_PER_FV]; EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];
BOOLEAN ScanFv; BOOLEAN ScanFv;
} PEI_CORE_FV_HANDLE; } PEI_CORE_FV_HANDLE;
@ -111,14 +109,14 @@ typedef struct{
EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow
PEI_PPI_DATABASE PpiData; PEI_PPI_DATABASE PpiData;
UINTN FvCount; UINTN FvCount;
PEI_CORE_FV_HANDLE Fv[PEI_CORE_MAX_FV_SUPPORTED]; PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];
EFI_PEI_FILE_HANDLE CurrentFvFileHandles[PEI_CORE_MAX_PEIM_PER_FV]; EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];
UINTN AprioriCount; UINTN AprioriCount;
UINTN CurrentPeimFvCount; UINTN CurrentPeimFvCount;
UINTN CurrentPeimCount; UINTN CurrentPeimCount;
EFI_PEI_FILE_HANDLE CurrentFileHandle; EFI_PEI_FILE_HANDLE CurrentFileHandle;
UINTN AllFvCount; UINTN AllFvCount;
EFI_PEI_FV_HANDLE AllFv[PEI_CORE_MAX_FV_SUPPORTED]; EFI_PEI_FV_HANDLE AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];
EFI_PEI_HOB_POINTERS HobList; EFI_PEI_HOB_POINTERS HobList;
BOOLEAN SwitchStackSignal; BOOLEAN SwitchStackSignal;
BOOLEAN PeiMemoryInstalled; BOOLEAN PeiMemoryInstalled;

View File

@ -97,6 +97,10 @@
gEfiPeiLoadFilePpiGuid gEfiPeiLoadFilePpiGuid
gEfiPeiSecurity2PpiGuid gEfiPeiSecurity2PpiGuid
[FixedPcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv
[BuildOptions.common] [BuildOptions.common]
MSFT:DEBUG_*_IA32_CC_FLAGS = /FAcs MSFT:DEBUG_*_IA32_CC_FLAGS = /FAcs

View File

@ -122,6 +122,8 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0|UINT32|0x0001001e gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0|UINT32|0x0001001e
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0|UINT32|0x0001001f gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0|UINT32|0x0001001f
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|28|UINT8|0x0001002f gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|28|UINT8|0x0001002f
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6|UINT32|0x00010030
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32|UINT32|0x00010031
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0|UINT32|0x30000002 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0|UINT32|0x30000002
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0|UINT32|0x30000013 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0|UINT32|0x30000013
@ -142,6 +144,7 @@
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInputError|0x01020007|UINT32|0x30001000b gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInputError|0x01020007|UINT32|0x30001000b
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseReset|0x01020001|UINT32|0x30001000c gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseReset|0x01020001|UINT32|0x30001000c
[PcdsDynamic.common] [PcdsDynamic.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0|UINT32|0x30000002 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0|UINT32|0x30000002

View File

@ -343,6 +343,10 @@
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|0 gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|0
gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10 gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
[PcdsFixedAtBuild.IPF] [PcdsFixedAtBuild.IPF]
gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf|0x0ffffc000000 gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf|0x0ffffc000000