summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Acpi
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-03-19 17:19:48 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2017-03-21 07:10:39 +0000
commit09da11081915dea25d2d1bba87cdf460102e52bb (patch)
tree6d1e0e2b902ea489860e7f0e04c8fb6bef3f7fc4 /MdeModulePkg/Universal/Acpi
parentf859c6796f4064e2142d4bfaae55dbd3aaf70c55 (diff)
downloadedk2-platforms-09da11081915dea25d2d1bba87cdf460102e52bb.tar.xz
MdeModulePkg/BootGraphicsResourceTableDxe: don't allocate below 4 GB
The BGRT table has an 8 byte field for the memory address of the image data, and yet the driver explicitly allocates below 4 GB. This results in an ASSERT() on systems that do not have any memory below 4 GB to begin with. Since neither the PI, the UEFI or the ACPI spec contain any mention of why this data should reside below 4 GB, replace the allocation call with an ordinary AllocatePages() call. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/Acpi')
-rw-r--r--MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
index 804ffa5a6b..6a7165a954 100644
--- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
+++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
@@ -227,43 +227,6 @@ BgrtAcpiTableChecksum (
}
/**
- Allocate EfiBootServicesData below 4G memory address.
-
- This function allocates EfiBootServicesData below 4G memory address.
-
- @param[in] Size Size of memory to allocate.
-
- @return Allocated address for output.
-
-**/
-VOID *
-BgrtAllocateBsDataMemoryBelow4G (
- IN UINTN Size
- )
-{
- UINTN Pages;
- EFI_PHYSICAL_ADDRESS Address;
- EFI_STATUS Status;
- VOID *Buffer;
-
- Pages = EFI_SIZE_TO_PAGES (Size);
- Address = 0xffffffff;
-
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiBootServicesData,
- Pages,
- &Address
- );
- ASSERT_EFI_ERROR (Status);
-
- Buffer = (VOID *) (UINTN) Address;
- ZeroMem (Buffer, Size);
-
- return Buffer;
-}
-
-/**
Install Boot Graphics Resource Table to ACPI table.
@return Status code.
@@ -358,11 +321,13 @@ InstallBootGraphicsResourceTable (
// The image should be stored in EfiBootServicesData, allowing the system to reclaim the memory
//
BmpSize = (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP_IMAGE_HEADER);
- ImageBuffer = BgrtAllocateBsDataMemoryBelow4G (BmpSize);
+ ImageBuffer = AllocatePages (EFI_SIZE_TO_PAGES (BmpSize));
if (ImageBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+ ZeroMem (ImageBuffer, BmpSize);
+
mBmpImageHeaderTemplate.Size = (UINT32) BmpSize;
mBmpImageHeaderTemplate.ImageSize = (UINT32) BmpSize - sizeof (BMP_IMAGE_HEADER);
mBmpImageHeaderTemplate.PixelWidth = (UINT32) mLogoWidth;