diff options
author | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-10 01:43:13 +0000 |
---|---|---|
committer | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-10 01:43:13 +0000 |
commit | befbc4f3fbfd3d5825fdc72fcadd4bbc85a8f8a0 (patch) | |
tree | b0ea1b1aa613b1c300a31dd55a1f7eeb9ed9cffe /IntelFrameworkModulePkg/Csm | |
parent | c4042207d6dc10b786506db0b1fa897e723123f1 (diff) | |
download | edk2-platforms-befbc4f3fbfd3d5825fdc72fcadd4bbc85a8f8a0.tar.xz |
Use PCD for PMM size and EndOpromShadowAddress to remove hard code value in CSM module.
Signed-off-by: li-elvin
Reviewed-by: jyao1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12519 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Csm')
4 files changed, 16 insertions, 38 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;
}
|