]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c
Use PCD for PMM size and EndOpromShadowAddress to remove hard code value in CSM module.
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / LegacyBiosDxe / LegacyBios.c
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