]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Use PCD for PMM size and EndOpromShadowAddress to remove hard code value in CSM module.
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 10 Oct 2011 01:43:13 +0000 (01:43 +0000)
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 10 Oct 2011 01:43:13 +0000 (01:43 +0000)
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

IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c
IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h
IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec

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