DynamicTablesPkg: Add OEM Info
authorSami Mujawar <sami.mujawar@arm.com>
Thu, 14 Feb 2019 11:01:20 +0000 (11:01 +0000)
committerSami Mujawar <sami.mujawar@arm.com>
Wed, 20 Mar 2019 11:00:44 +0000 (11:00 +0000)
This patch originally merged in edk2 master at
c788bdaba47536447ae37518a96d92e0da54aad7. However, this was
later reverted at bdbbedea949eb4b10d24110c0e559b03c7a6bce4
as it was merged during the Soft Feature Freeze for
edk2-stable201903.

Resubmitting this patch as the edk2 merge window is now open.

Added option for OEMs to provide OEM Table ID and
OEM Revision for ACPI tables.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Alexei Fedorov <alexei.fedorov@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <alexei.fedorov@arm.com>
DynamicTablesPkg/Include/Library/TableHelperLib.h
DynamicTablesPkg/Include/StandardNameSpaceObjects.h
DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c

index 3c4e1d2..0f872bc 100644 (file)
@@ -45,7 +45,7 @@ GetCgfMgrInfo (
   @param [in]     Generator      Pointer to the ACPI table Generator.\r
   @param [in,out] AcpiHeader     Pointer to the ACPI table header to be\r
                                  updated.\r
-  @param [in]     Revision       Revision of the ACPI table.\r
+  @param [in]     AcpiTableInfo  Pointer to the ACPI table info structure.\r
   @param [in]     Length         Length of the ACPI table.\r
 \r
   @retval EFI_SUCCESS           The ACPI table is updated successfully.\r
@@ -61,7 +61,7 @@ AddAcpiHeader (
   IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,\r
   IN      CONST ACPI_TABLE_GENERATOR                  * CONST Generator,\r
   IN OUT  EFI_ACPI_DESCRIPTION_HEADER                 * CONST AcpiHeader,\r
-  IN      CONST UINT32                                        Revision,\r
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,\r
   IN      CONST UINT32                                        Length\r
   );\r
 \r
index 4377ee8..5850385 100644 (file)
@@ -93,6 +93,24 @@ typedef struct CmAStdObjAcpiTableInfo {
   /// Optional pointer to the ACPI table data\r
   EFI_ACPI_DESCRIPTION_HEADER  * AcpiTableData;\r
 \r
+  /// An OEM-supplied string that the OEM uses to identify the particular\r
+  /// data table. This field is particularly useful when defining a definition\r
+  /// block to distinguish definition block functions. The OEM assigns each\r
+  /// dissimilar table a new OEM Table ID.\r
+  /// This field could be constructed using the SIGNATURE_64() macro.\r
+  ///   e.g. SIGNATURE_64 ('A','R','M','H','G','T','D','T')\r
+  /// Note: If this field is not populated (has value of Zero), then the\r
+  /// Generators shall populate this information using part of the\r
+  /// CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.OemId field and the\r
+  /// ACPI table signature.\r
+  UINT64                         OemTableId;\r
+\r
+  /// An OEM-supplied revision number. Larger numbers are assumed to be\r
+  /// newer revisions.\r
+  /// Note: If this field is not populated (has value of Zero), then the\r
+  /// Generators shall populate this information using the revision of the\r
+  /// Configuration Manager (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.Revision).\r
+  UINT32                         OemRevision;\r
 } CM_STD_OBJ_ACPI_TABLE_INFO;\r
 \r
 /** A structure used to describe the SMBIOS table generators to be invoked.\r
index e21e2b6..697cfc4 100644 (file)
@@ -342,7 +342,7 @@ BuildDbg2Table (
              CfgMgrProtocol,\r
              This,\r
              (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2,\r
-             AcpiTableInfo->AcpiTableRevision,\r
+             AcpiTableInfo,\r
              sizeof (DBG2_TABLE)\r
              );\r
   if (EFI_ERROR (Status)) {\r
index 62927b5..6699901 100644 (file)
@@ -537,7 +537,7 @@ BuildFadtTable (
              CfgMgrProtocol,\r
              This,\r
              (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt,\r
-             AcpiTableInfo->AcpiTableRevision,\r
+             AcpiTableInfo,\r
              sizeof (EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE)\r
              );\r
   if (EFI_ERROR (Status)) {\r
index 70f5250..d58794e 100644 (file)
@@ -518,7 +518,7 @@ BuildGtdtTable (
              CfgMgrProtocol,\r
              This,\r
              &Gtdt->Header,\r
-             AcpiTableInfo->AcpiTableRevision,\r
+             AcpiTableInfo,\r
              TableSize\r
              );\r
   if (EFI_ERROR (Status)) {\r
index b53c4bb..2bac7a5 100644 (file)
@@ -1798,7 +1798,7 @@ BuildIortTable (
              CfgMgrProtocol,\r
              This,\r
              &Iort->Header,\r
-             AcpiTableInfo->AcpiTableRevision,\r
+             AcpiTableInfo,\r
              TableSize\r
              );\r
   if (EFI_ERROR (Status)) {\r
index 0679475..1ee0b9e 100644 (file)
@@ -569,7 +569,7 @@ BuildMadtTable (
              CfgMgrProtocol,\r
              This,\r
              &Madt->Header,\r
-             AcpiTableInfo->AcpiTableRevision,\r
+             AcpiTableInfo,\r
              TableSize\r
              );\r
   if (EFI_ERROR (Status)) {\r
index 29eb72b..2131683 100644 (file)
@@ -220,7 +220,7 @@ BuildMcfgTable (
              CfgMgrProtocol,\r
              This,\r
              &Mcfg->Header,\r
-             AcpiTableInfo->AcpiTableRevision,\r
+             AcpiTableInfo,\r
              TableSize\r
              );\r
   if (EFI_ERROR (Status)) {\r
index a4654ac..6778d76 100644 (file)
@@ -211,7 +211,7 @@ BuildSpcrTable (
              CfgMgrProtocol,\r
              This,\r
              (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr,\r
-             AcpiTableInfo->AcpiTableRevision,\r
+             AcpiTableInfo,\r
              sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE)\r
              );\r
   if (EFI_ERROR (Status)) {\r
index 02860dd..203207b 100644 (file)
@@ -100,7 +100,7 @@ GetCgfMgrInfo (
   @param [in]     Generator      Pointer to the ACPI table Generator.\r
   @param [in,out] AcpiHeader     Pointer to the ACPI table header to be\r
                                  updated.\r
-  @param [in]     Revision       Revision of the ACPI table.\r
+  @param [in]     AcpiTableInfo  Pointer to the ACPI table info structure.\r
   @param [in]     Length         Length of the ACPI table.\r
 \r
   @retval EFI_SUCCESS           The ACPI table is updated successfully.\r
@@ -116,7 +116,7 @@ AddAcpiHeader (
   IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,\r
   IN      CONST ACPI_TABLE_GENERATOR                  * CONST Generator,\r
   IN OUT  EFI_ACPI_DESCRIPTION_HEADER                 * CONST AcpiHeader,\r
-  IN      CONST UINT32                                        Revision,\r
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,\r
   IN      CONST UINT32                                        Length\r
   )\r
 {\r
@@ -151,7 +151,7 @@ AddAcpiHeader (
   // UINT32  Length\r
   AcpiHeader->Length = Length;\r
   // UINT8   Revision\r
-  AcpiHeader->Revision = Revision;\r
+  AcpiHeader->Revision = AcpiTableInfo->AcpiTableRevision;\r
   // UINT8   Checksum\r
   AcpiHeader->Checksum = 0;\r
 \r
@@ -159,12 +159,24 @@ AddAcpiHeader (
   CopyMem (AcpiHeader->OemId, CfgMfrInfo->OemId, sizeof (AcpiHeader->OemId));\r
 \r
   // UINT64  OemTableId\r
-  AcpiHeader->OemTableId = Generator->CreatorId;\r
-  AcpiHeader->OemTableId <<= 32;\r
-  AcpiHeader->OemTableId |= Generator->AcpiTableSignature;\r
+  if (AcpiTableInfo->OemTableId != 0) {\r
+    AcpiHeader->OemTableId = AcpiTableInfo->OemTableId;\r
+  } else {\r
+    AcpiHeader->OemTableId = SIGNATURE_32 (\r
+                               CfgMfrInfo->OemId[0],\r
+                               CfgMfrInfo->OemId[1],\r
+                               CfgMfrInfo->OemId[2],\r
+                               CfgMfrInfo->OemId[3]\r
+                               ) |\r
+                             ((UINT64)Generator->AcpiTableSignature << 32);\r
+  }\r
 \r
   // UINT32  OemRevision\r
-  AcpiHeader->OemRevision = CfgMfrInfo->Revision;\r
+  if (AcpiTableInfo->OemRevision != 0) {\r
+    AcpiHeader->OemRevision = AcpiTableInfo->OemRevision;\r
+  } else {\r
+    AcpiHeader->OemRevision = CfgMfrInfo->Revision;\r
+  }\r
 \r
   // UINT32  CreatorId\r
   AcpiHeader->CreatorId = Generator->CreatorId;\r