diff options
5 files changed, 27 insertions, 39 deletions
diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c index 37f009af58..194fee647b 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c @@ -29,11 +29,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. //
LEGACY_BIOS_INSTANCE mPrivateData;
-//
-// The end of OPROM shadow address
-//
-UINTN mEndOpromShadowAddress = 0;
-
/**
Do an AllocatePages () of type AllocateMaxAddress for EfiBootServicesCode
memory.
@@ -388,23 +383,6 @@ ShadowAndStartLegacy16 ( Table->EfiSystemTable = (UINT32) (UINTN) gST;
//
- // Get the end of OPROM shadow address
- //
- Status = Private->LegacyBiosPlatform->GetPlatformInfo (
- Private->LegacyBiosPlatform,
- EfiGetPlatformEndOpromShadowAddr,
- NULL,
- NULL,
- &mEndOpromShadowAddress,
- NULL,
- 0,
- 0
- );
- if (EFI_ERROR (Status)) {
- mEndOpromShadowAddress = 0xDFFFF;
- }
-
- //
// IPF CSM integration -Bug
//
// Construct the Legacy16 boot memory map. This sets up number of
@@ -905,17 +883,19 @@ LegacyBiosInstall ( }
//
- // Allocate a 64k area (16 4k pages) for 16-bit code for scratch pad and zero it out
+ // Allocate low PMM memory and zero it out
//
+ MemorySize = PcdGet32 (PcdLowPmmMemorySize);
+ ASSERT ((MemorySize & 0xFFF) == 0);
Status = AllocateLegacyMemory (
AllocateMaxAddress,
CONVENTIONAL_MEMORY_TOP,
- 16,
+ EFI_SIZE_TO_PAGES (MemorySize),
&MemoryAddressUnder1MB
);
ASSERT_EFI_ERROR (Status);
- ZeroMem ((VOID *) ((UINTN) MemoryAddressUnder1MB), 0x10000);
+ ZeroMem ((VOID *) ((UINTN) MemoryAddressUnder1MB), MemorySize);
//
// Allocate space for thunker and Init Thunker
@@ -940,20 +920,22 @@ LegacyBiosInstall ( //
EfiToLegacy16InitTable->BiosLessThan1MB = (UINT32) MemoryAddressUnder1MB;
EfiToLegacy16InitTable->LowPmmMemory = (UINT32) MemoryAddressUnder1MB;
- EfiToLegacy16InitTable->LowPmmMemorySizeInBytes = 0x10000;
+ EfiToLegacy16InitTable->LowPmmMemorySizeInBytes = MemorySize;
//
- // Allocate 4 MB of PMM Memory under 16 MB
+ // Allocate high PMM Memory under 16 MB
//
+ MemorySize = PcdGet32 (PcdHighPmmMemorySize);
+ ASSERT ((MemorySize & 0xFFF) == 0);
Status = AllocateLegacyMemory (
AllocateMaxAddress,
0x1000000,
- 0x400,
+ EFI_SIZE_TO_PAGES (MemorySize),
&MemoryAddress
);
if (!EFI_ERROR (Status)) {
EfiToLegacy16InitTable->HiPmmMemory = (UINT32) (EFI_PHYSICAL_ADDRESS) (UINTN) MemoryAddress;
- EfiToLegacy16InitTable->HiPmmMemorySizeInBytes = PMM_MEMORY_SIZE;
+ EfiToLegacy16InitTable->HiPmmMemorySizeInBytes = MemorySize;
}
//
diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf index d8806a84ec..4b6635e6bf 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf @@ -137,6 +137,9 @@ [Pcd]
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLegacyBiosCacheLegacyRegion
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdEbdaReservedMemorySize
+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdEndOpromShadowAddress
+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLowPmmMemorySize
+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHighPmmMemorySize
[Depex]
gEfiLegacyRegion2ProtocolGuid AND gEfiLegacyInterruptProtocolGuid AND gEfiLegacyBiosPlatformProtocolGuid AND gEfiLegacy8259ProtocolGuid AND gEfiGenericMemTestProtocolGuid AND gEfiCpuArchProtocolGuid AND gEfiTimerArchProtocolGuid
diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h index 8ab26fe326..71522a0ba4 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h @@ -158,11 +158,6 @@ typedef struct { #endif
-//
-// Miscellaneous numbers
-//
-#define PMM_MEMORY_SIZE 0x400000 // 4 MB
-
#pragma pack(1)
//
@@ -494,8 +489,6 @@ extern BBS_TABLE *mBbsTable; extern EFI_GENERIC_MEMORY_TEST_PROTOCOL *gGenMemoryTest;
-extern UINTN mEndOpromShadowAddress;
-
#define PORT_70 0x70
#define PORT_71 0x71
diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c index 7f0ba2d18d..daff975518 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c @@ -2301,7 +2301,7 @@ LegacyBiosInstallRom ( // then test if there is enough space for its RT code
//
RuntimeAddress = Private->OptionRom;
- if (RuntimeAddress + *RuntimeImageLength > mEndOpromShadowAddress) {
+ if (RuntimeAddress + *RuntimeImageLength > PcdGet32 (PcdEndOpromShadowAddress)) {
DEBUG ((EFI_D_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", __LINE__));
gBS->FreePages (PhysicalAddress, EFI_SIZE_TO_PAGES (ImageSize));
return EFI_OUT_OF_RESOURCES;
@@ -2312,7 +2312,7 @@ LegacyBiosInstallRom ( // test if there is enough space for its INIT code
//
InitAddress = PCI_START_ADDRESS (Private->OptionRom);
- if (InitAddress + ImageSize > mEndOpromShadowAddress) {
+ if (InitAddress + ImageSize > PcdGet32 (PcdEndOpromShadowAddress)) {
DEBUG ((EFI_D_ERROR, "return LegacyBiosInstallRom(%d): EFI_OUT_OF_RESOURCES (no more space for OpROM)\n", __LINE__));
return EFI_OUT_OF_RESOURCES;
}
diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec index d7f91d0b34..709b2bd33b 100644 --- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec +++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec @@ -181,4 +181,14 @@ # make sure the memory size is large enough to meet boot script executor requiremnt in S3 phase.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize|0x8000|UINT32|0x30000007
-
+ ## The PCD is used to specify the end of address below 1MB for the OPROM.
+ # The last shadowed OpROM should not exceed this address.
+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdEndOpromShadowAddress|0xdffff|UINT32|0x30000008
+
+ ## The PCD is used to specify the low PMM (Post Memory Manager) size with bytes below 1MB.
+ # The value should be a multiple of 4KB.
+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLowPmmMemorySize|0x10000|UINT32|0x30000009
+
+ ## The PCD is used to specify the high PMM (Post Memory Manager) size with bytes above 1MB.
+ # The value should be a multiple of 4KB.
+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHighPmmMemorySize|0x400000|UINT32|0x3000000a
|