]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
Create PCDs in MdeModulePkg for ACPI table OEM_ID/OEM_TABLE_ID/OEM_REVISION/CREATOR_I...
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / BootGraphicsResourceTableDxe / BootGraphicsResourceTableDxe.c
index 207abf7809e591b9ab93644a7d1746af33d0b7b4..804ffa5a6bb68c97993b24dc7acdba3107093adf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This module install ACPI Boot Graphics Resource Table (BGRT).\r
 \r
-  Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DebugLib.h>\r
-\r
-//\r
-// ACPI table information used to initialize tables.\r
-//\r
-#define EFI_ACPI_OEM_ID           "INTEL"\r
-#define EFI_ACPI_OEM_TABLE_ID     0x2020204F4E414954ULL // "TIANO   "\r
-#define EFI_ACPI_OEM_REVISION     0x00000001\r
-#define EFI_ACPI_CREATOR_ID       0x5446534D            // TBD "MSFT"\r
-#define EFI_ACPI_CREATOR_REVISION 0x01000013            // TBD\r
+#include <Library/PcdLib.h>\r
 \r
 //\r
 // Module globals.\r
@@ -81,13 +73,13 @@ EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
     EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_REVISION,     // Revision\r
     0x00,  // Checksum will be updated at runtime\r
     //\r
-    // It is expected that these values will be updated at runtime.\r
+    // It is expected that these values will be updated at EntryPoint.\r
     //\r
-    EFI_ACPI_OEM_ID,            // OEMID is a 6 bytes long field\r
-    EFI_ACPI_OEM_TABLE_ID,      // OEM table identification(8 bytes long)\r
-    EFI_ACPI_OEM_REVISION,      // OEM revision number\r
-    EFI_ACPI_CREATOR_ID,        // ASL compiler vendor ID\r
-    EFI_ACPI_CREATOR_REVISION,  // ASL compiler revision number\r
+    {0x00},     // OEM ID is a 6 bytes long field\r
+    0x00,       // OEM Table ID(8 bytes long)\r
+    0x00,       // OEM Revision\r
+    0x00,       // Creator ID\r
+    0x00,       // Creator Revision\r
   },\r
   EFI_ACPI_5_0_BGRT_VERSION,         // Version\r
   EFI_ACPI_5_0_BGRT_STATUS_VALID,    // Status\r
@@ -235,9 +227,9 @@ BgrtAcpiTableChecksum (
 }\r
 \r
 /**\r
-  Allocate EfiReservedMemoryType below 4G memory address.\r
+  Allocate EfiBootServicesData below 4G memory address.\r
 \r
-  This function allocates EfiReservedMemoryType below 4G memory address.\r
+  This function allocates EfiBootServicesData below 4G memory address.\r
 \r
   @param[in]  Size   Size of memory to allocate.\r
 \r
@@ -245,7 +237,7 @@ BgrtAcpiTableChecksum (
 \r
 **/\r
 VOID *\r
-BgrtAllocateReservedMemoryBelow4G (\r
+BgrtAllocateBsDataMemoryBelow4G (\r
   IN UINTN       Size\r
   )\r
 {\r
@@ -259,7 +251,7 @@ BgrtAllocateReservedMemoryBelow4G (
 \r
   Status = gBS->AllocatePages (\r
                   AllocateMaxAddress,\r
-                  EfiReservedMemoryType,\r
+                  EfiBootServicesData,\r
                   Pages,\r
                   &Address\r
                   );\r
@@ -361,9 +353,12 @@ InstallBootGraphicsResourceTable (
     if (mLogoHeight > (((UINT32) ~0) - sizeof (BMP_IMAGE_HEADER)) / (mLogoWidth * 3 + PaddingSize)) {\r
       return EFI_UNSUPPORTED;\r
     }\r
-    \r
+\r
+    //\r
+    // The image should be stored in EfiBootServicesData, allowing the system to reclaim the memory\r
+    //\r
     BmpSize = (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP_IMAGE_HEADER);\r
-    ImageBuffer = BgrtAllocateReservedMemoryBelow4G (BmpSize);\r
+    ImageBuffer = BgrtAllocateBsDataMemoryBelow4G (BmpSize);\r
     if (ImageBuffer == NULL) {\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
@@ -464,6 +459,18 @@ BootGraphicsDxeEntryPoint (
   )\r
 {\r
   EFI_STATUS  Status;\r
+  UINT64      OemTableId;\r
+\r
+  CopyMem (\r
+    mBootGraphicsResourceTableTemplate.Header.OemId,\r
+    PcdGetPtr (PcdAcpiDefaultOemId),\r
+    sizeof (mBootGraphicsResourceTableTemplate.Header.OemId)\r
+    );\r
+  OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);\r
+  CopyMem (&mBootGraphicsResourceTableTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));\r
+  mBootGraphicsResourceTableTemplate.Header.OemRevision      = PcdGet32 (PcdAcpiDefaultOemRevision);\r
+  mBootGraphicsResourceTableTemplate.Header.CreatorId        = PcdGet32 (PcdAcpiDefaultCreatorId);\r
+  mBootGraphicsResourceTableTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);\r
 \r
   //\r
   // Install Boot Logo protocol.\r