]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DynamicTablesPkg: Add support to specify FADT minor revision
authorSami Mujawar <sami.mujawar@arm.com>
Wed, 6 Jul 2022 11:40:09 +0000 (12:40 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 15 Jul 2022 18:07:49 +0000 (18:07 +0000)
The CM_STD_OBJ_ACPI_TABLE_INFO.AcpiTableRevision can be used to specify
the major revision number of the ACPI table that the generator must use.
Although most ACPI tables only have a major revision number, the FADT
table additionally has a minor revision number.

The FADT generator currently defaults to setting the latest supported
ACPI revision for the FADT table i.e. ACPI 6.4. This means that the minor
revision for the FADT table is always set to 4 and there is no provision
for a user to specify the minor revision to be selected.

Therefore, update CM_STD_OBJ_ACPI_TABLE_INFO to introduce a new field
MinorRevision which can be used to specify the minor revision for an
ACPI table. Also update the FADT generator to validate the supported
FADT revisions ans use the specified minor revision for the FADT table
if supported. If an unsupported minor revision is specified the FADT
generator defaults to the latest supported minor revision.

Since the CM_STD_OBJ_ACPI_TABLE_INFO.MinorRevision field is added to
the end of the structure, it should not break existing platform code.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: <pierre.gondois@arm.com>
Tested-by: Jagadeesh Ujja <Jagadeesh.Ujja@arm.com>
DynamicTablesPkg/Include/StandardNameSpaceObjects.h
DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c

index 8d0c7da15a73e4910f9099c68f6e5cc2f06c0ecb..8ec3238225abe4fc16a7337c29ecd655590b408f 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.\r
+  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -105,6 +105,14 @@ typedef struct CmAStdObjAcpiTableInfo {
   /// Generators shall populate this information using the revision of the\r
   /// Configuration Manager (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.Revision).\r
   UINT32    OemRevision;\r
+\r
+  /// The minor revision of an ACPI table if required by the table.\r
+  /// Note: If this field is not populated (has value of Zero), then the\r
+  /// Generators shall populate this information based on the latest minor\r
+  /// revision of the table that is supported by the generator.\r
+  /// e.g. This field can be used to specify the minor revision to be set\r
+  /// for the FADT table.\r
+  UINT8     MinorRevision;\r
 } CM_STD_OBJ_ACPI_TABLE_INFO;\r
 \r
 /** A structure used to describe the SMBIOS table generators to be invoked.\r
index 96295f539fb0505378e862edeef898be40257cdd..1d10ea55e2395c55291faa3c247e5c59e345650c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   FADT Table Generator\r
 \r
-  Copyright (c) 2017 - 2021, ARM Limited. All rights reserved.\r
+  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
   @par Reference(s):\r
@@ -167,7 +167,7 @@ EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE  AcpiFadt = {
   // UINT16     ArmBootArch\r
   EFI_ACPI_6_4_ARM_PSCI_COMPLIANT,  // {Template}: ARM Boot Architecture Flags\r
   // UINT8      MinorRevision\r
-  EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION,\r
+  EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION, // {Template}\r
   // UINT64     XFirmwareCtrl\r
   0,\r
   // UINT64     XDsdt\r
@@ -546,6 +546,31 @@ BuildFadtTable (
     goto error_handler;\r
   }\r
 \r
+  // Update the MinorRevision for the FADT table if it has been specified\r
+  // otherwise default to the latest FADT minor revision supported.\r
+  // Note:\r
+  // Bits 0-3 - The low order bits correspond to the minor version of the\r
+  //            specification version.\r
+  // Bits 4-7 - The high order bits correspond to the version of the ACPI\r
+  //            specification errata.\r
+  if (AcpiTableInfo->MinorRevision != 0) {\r
+    if (((AcpiTableInfo->MinorRevision & 0xF) >=\r
+         EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION) &&\r
+        ((AcpiTableInfo->MinorRevision & 0xF) <=\r
+         EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION))\r
+    {\r
+      AcpiFadt.MinorVersion = AcpiTableInfo->MinorRevision;\r
+    } else {\r
+      DEBUG ((\r
+        DEBUG_WARN,\r
+        "WARNING: FADT: Unsupported FADT Minor Revision 0x%x specified, " \\r
+        "defaulting to FADT Minor Revision 0x%x\n",\r
+        AcpiTableInfo->MinorRevision,\r
+        EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION\r
+        ));\r
+    }\r
+  }\r
+\r
   // Update PmProfile Info\r
   Status = FadtAddPmProfileInfo (CfgMgrProtocol);\r
   if (EFI_ERROR (Status)) {\r