]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/AcpiTableDxe: Not make FADT.{DSDT,X_DSDT} mutual exclusion
authorStar Zeng <star.zeng@intel.com>
Thu, 16 Mar 2017 07:26:03 +0000 (15:26 +0800)
committerStar Zeng <star.zeng@intel.com>
Fri, 17 Mar 2017 05:51:58 +0000 (13:51 +0800)
198a46d768fb90d2f9b16e26451b4814e7469eaf improved the DSDT and X_DSDT
fields mutual exclusion by checking FADT revision, but that breaks
some OS that has assumption to only consume X_DSDT field even the
DSDT address is < 4G.

To have better compatibility, this patch is to update the code to not
make FADT.{DSDT,X_DSDT} mutual exclusion, but always set both DSDT and
X_DSDT fields in the FADT when the DSDT address is < 4G.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Jeff Fan <jeff.fan@intel.com>
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

index 4bb848df5203f01e2ed92b39fc035a494fe65eb0..a4fd9aff845d654c4c0bb748500d1883aa76af28 100644 (file)
@@ -431,50 +431,6 @@ ReallocateAcpiTableBuffer (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Determine whether the FADT table passed in as parameter requires mutual\r
-  exclusion between the DSDT and X_DSDT fields. (That is, whether there exists\r
-  an explicit requirement that at most one of those fields is permitted to be\r
-  nonzero.)\r
-\r
-  @param[in] Fadt  The EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE object to\r
-                   check.\r
-\r
-  @retval TRUE     Fadt requires mutual exclusion between DSDT and X_DSDT.\r
-  @retval FALSE    Otherwise.\r
-**/\r
-BOOLEAN\r
-RequireDsdtXDsdtExclusion (\r
-  IN EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt\r
-  )\r
-{\r
-  //\r
-  // Mantis ticket #1393 was addressed in ACPI 5.1 Errata B. Unfortunately, we\r
-  // can't tell apart 5.1 Errata A and 5.1 Errata B just from looking at the\r
-  // FADT table. Therefore let's require exclusion for table versions >= 5.1.\r
-  //\r
-  // While this needlessly covers 5.1 and 5.1A too, it is safer to require\r
-  // DSDT<->X_DSDT exclusion for lax (5.1, 5.1A) versions of the spec than to\r
-  // permit DSDT<->X_DSDT duplication for strict (5.1B) versions of the spec.\r
-  //\r
-  // The same applies to 6.0 vs. 6.0A. While 6.0 does not require the\r
-  // exclusion, 6.0A and 6.1 do. Since we cannot distinguish 6.0 from 6.0A\r
-  // based on just the FADT, we lump 6.0 in with the rest of >= 5.1.\r
-  //\r
-  if ((Fadt->Header.Revision < 5) ||\r
-      ((Fadt->Header.Revision == 5) &&\r
-       (((EFI_ACPI_5_1_FIXED_ACPI_DESCRIPTION_TABLE *)Fadt)->MinorVersion == 0))) {\r
-    //\r
-    // version <= 5.0\r
-    //\r
-    return FALSE;\r
-  }\r
-  //\r
-  // version >= 5.1\r
-  //\r
-  return TRUE;\r
-}\r
-\r
 /**\r
   This function adds an ACPI table to the table list.  It will detect FACS and\r
   allocate the correct type of memory and properly align the table.\r
@@ -692,11 +648,23 @@ AddTableToList (
       }\r
       if ((UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) {\r
         AcpiTableInstance->Fadt3->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt3;\r
-        if (RequireDsdtXDsdtExclusion (AcpiTableInstance->Fadt3)) {\r
-          Buffer64 = 0;\r
-        } else {\r
-          Buffer64 = AcpiTableInstance->Fadt3->Dsdt;\r
-        }\r
+        //\r
+        // Comment block "the caller installs the tables in "DSDT, FADT" order"\r
+        // The below comments are also in "the caller installs the tables in "FADT, DSDT" order" comment block.\r
+        //\r
+        // The ACPI specification, up to and including revision 5.1 Errata A,\r
+        // allows the DSDT and X_DSDT fields to be both set in the FADT.\r
+        // (Obviously, this only makes sense if the DSDT address is representable in 4 bytes.)\r
+        // Starting with 5.1 Errata B, specifically for Mantis 1393 <https://mantis.uefi.org/mantis/view.php?id=1393>,\r
+        // the spec requires at most one of DSDT and X_DSDT fields to be set to a nonzero value,\r
+        // but strangely an exception is 6.0 that has no this requirement.\r
+        //\r
+        // Here we do not make the DSDT and X_DSDT fields mutual exclusion conditionally\r
+        // by checking FADT revision, but always set both DSDT and X_DSDT fields in the FADT\r
+        // to have better compatibility as some OS may have assumption to only consume X_DSDT\r
+        // field even the DSDT address is < 4G.\r
+        //\r
+        Buffer64 = AcpiTableInstance->Fadt3->Dsdt;\r
       } else {\r
         AcpiTableInstance->Fadt3->Dsdt = 0;\r
         Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Dsdt3;\r
@@ -896,11 +864,23 @@ AddTableToList (
       if (AcpiTableInstance->Fadt3 != NULL) {\r
         if ((UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) {\r
           AcpiTableInstance->Fadt3->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt3;\r
-          if (RequireDsdtXDsdtExclusion (AcpiTableInstance->Fadt3)) {\r
-            Buffer64 = 0;\r
-          } else {\r
-            Buffer64 = AcpiTableInstance->Fadt3->Dsdt;\r
-          }\r
+          //\r
+          // Comment block "the caller installs the tables in "FADT, DSDT" order"\r
+          // The below comments are also in "the caller installs the tables in "DSDT, FADT" order" comment block.\r
+          //\r
+          // The ACPI specification, up to and including revision 5.1 Errata A,\r
+          // allows the DSDT and X_DSDT fields to be both set in the FADT.\r
+          // (Obviously, this only makes sense if the DSDT address is representable in 4 bytes.)\r
+          // Starting with 5.1 Errata B, specifically for Mantis 1393 <https://mantis.uefi.org/mantis/view.php?id=1393>,\r
+          // the spec requires at most one of DSDT and X_DSDT fields to be set to a nonzero value,\r
+          // but strangely an exception is 6.0 that has no this requirement.\r
+          //\r
+          // Here we do not make the DSDT and X_DSDT fields mutual exclusion conditionally\r
+          // by checking FADT revision, but always set both DSDT and X_DSDT fields in the FADT\r
+          // to have better compatibility as some OS may have assumption to only consume X_DSDT\r
+          // field even the DSDT address is < 4G.\r
+          //\r
+          Buffer64 = AcpiTableInstance->Fadt3->Dsdt;\r
         } else {\r
           AcpiTableInstance->Fadt3->Dsdt = 0;\r
           Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Dsdt3;\r