NewMaxTableNumber * sizeof (UINT32);\r
}\r
\r
- //\r
- // Allocate memory in the lower 32 bit of address range for\r
- // compatibility with ACPI 1.0 OS.\r
- //\r
- // This is done because ACPI 1.0 pointers are 32 bit values.\r
- // ACPI 2.0 OS and all 64 bit OS must use the 64 bit ACPI table addresses.\r
- // There is no architectural reason these should be below 4GB, it is purely\r
- // for convenience of implementation that we force memory below 4GB.\r
- //\r
- PageAddress = 0xFFFFFFFF;\r
- Status = gBS->AllocatePages (\r
- mAcpiTableAllocType,\r
- EfiACPIReclaimMemory,\r
- EFI_SIZE_TO_PAGES (TotalSize),\r
- &PageAddress\r
- );\r
+ if (mAcpiTableAllocType != AllocateAnyPages) {\r
+ //\r
+ // Allocate memory in the lower 32 bit of address range for\r
+ // compatibility with ACPI 1.0 OS.\r
+ //\r
+ // This is done because ACPI 1.0 pointers are 32 bit values.\r
+ // ACPI 2.0 OS and all 64 bit OS must use the 64 bit ACPI table addresses.\r
+ // There is no architectural reason these should be below 4GB, it is purely\r
+ // for convenience of implementation that we force memory below 4GB.\r
+ //\r
+ PageAddress = 0xFFFFFFFF;\r
+ Status = gBS->AllocatePages (\r
+ mAcpiTableAllocType,\r
+ EfiACPIReclaimMemory,\r
+ EFI_SIZE_TO_PAGES (TotalSize),\r
+ &PageAddress\r
+ );\r
+ } else {\r
+ Status = gBS->AllocatePool (\r
+ EfiACPIReclaimMemory,\r
+ TotalSize,\r
+ (VOID **)&Pointer\r
+ );\r
+ }\r
\r
if (EFI_ERROR (Status)) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- Pointer = (UINT8 *) (UINTN) PageAddress;\r
+ if (mAcpiTableAllocType != AllocateAnyPages) {\r
+ Pointer = (UINT8 *)(UINTN)PageAddress;\r
+ }\r
+\r
ZeroMem (Pointer, TotalSize);\r
\r
AcpiTableInstance->Rsdt1 = (EFI_ACPI_DESCRIPTION_HEADER *) Pointer;\r
}\r
CopyMem (AcpiTableInstance->Xsdt, TempPrivateData.Xsdt, (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + mEfiAcpiMaxNumTables * sizeof (UINT64)));\r
\r
- //\r
- // Calculate orignal ACPI table buffer size\r
- //\r
- TotalSize = sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 XSDT\r
- mEfiAcpiMaxNumTables * sizeof (UINT64);\r
+ if (mAcpiTableAllocType != AllocateAnyPages) {\r
+ //\r
+ // Calculate orignal ACPI table buffer size\r
+ //\r
+ TotalSize = sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 XSDT\r
+ mEfiAcpiMaxNumTables * sizeof (UINT64);\r
+\r
+ if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {\r
+ TotalSize += sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 1.0 RSDT\r
+ mEfiAcpiMaxNumTables * sizeof (UINT32) +\r
+ sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 RSDT\r
+ mEfiAcpiMaxNumTables * sizeof (UINT32);\r
+ }\r
\r
- if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {\r
- TotalSize += sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 1.0 RSDT\r
- mEfiAcpiMaxNumTables * sizeof (UINT32) +\r
- sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 RSDT\r
- mEfiAcpiMaxNumTables * sizeof (UINT32);\r
+ gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)TempPrivateData.Rsdt1,\r
+ EFI_SIZE_TO_PAGES (TotalSize));\r
+ } else {\r
+ gBS->FreePool (TempPrivateData.Rsdt1);\r
}\r
\r
- gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)TempPrivateData.Rsdt1, EFI_SIZE_TO_PAGES (TotalSize));\r
-\r
//\r
// Update the Max ACPI table number\r
//\r
mEfiAcpiMaxNumTables * sizeof (UINT32);\r
}\r
\r
- //\r
- // Allocate memory in the lower 32 bit of address range for\r
- // compatibility with ACPI 1.0 OS.\r
- //\r
- // This is done because ACPI 1.0 pointers are 32 bit values.\r
- // ACPI 2.0 OS and all 64 bit OS must use the 64 bit ACPI table addresses.\r
- // There is no architectural reason these should be below 4GB, it is purely\r
- // for convenience of implementation that we force memory below 4GB.\r
- //\r
- PageAddress = 0xFFFFFFFF;\r
- Status = gBS->AllocatePages (\r
- mAcpiTableAllocType,\r
- EfiACPIReclaimMemory,\r
- EFI_SIZE_TO_PAGES (TotalSize),\r
- &PageAddress\r
- );\r
+ if (mAcpiTableAllocType != AllocateAnyPages) {\r
+ //\r
+ // Allocate memory in the lower 32 bit of address range for\r
+ // compatibility with ACPI 1.0 OS.\r
+ //\r
+ // This is done because ACPI 1.0 pointers are 32 bit values.\r
+ // ACPI 2.0 OS and all 64 bit OS must use the 64 bit ACPI table addresses.\r
+ // There is no architectural reason these should be below 4GB, it is purely\r
+ // for convenience of implementation that we force memory below 4GB.\r
+ //\r
+ PageAddress = 0xFFFFFFFF;\r
+ Status = gBS->AllocatePages (\r
+ mAcpiTableAllocType,\r
+ EfiACPIReclaimMemory,\r
+ EFI_SIZE_TO_PAGES (TotalSize),\r
+ &PageAddress\r
+ );\r
+ } else {\r
+ Status = gBS->AllocatePool (\r
+ EfiACPIReclaimMemory,\r
+ TotalSize,\r
+ (VOID **)&Pointer\r
+ );\r
+ }\r
\r
if (EFI_ERROR (Status)) {\r
gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)AcpiTableInstance->Rsdp1, EFI_SIZE_TO_PAGES (RsdpTableSize));\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- Pointer = (UINT8 *) (UINTN) PageAddress;\r
+ if (mAcpiTableAllocType != AllocateAnyPages) {\r
+ Pointer = (UINT8 *)(UINTN)PageAddress;\r
+ }\r
ZeroMem (Pointer, TotalSize);\r
\r
AcpiTableInstance->Rsdt1 = (EFI_ACPI_DESCRIPTION_HEADER *) Pointer;\r