]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CorebootModulePkg/Library/CbParseLib/CbParseLib.c
CorebootModulePkg/CbSupportDxe: Remove SCI_EN setting
[mirror_edk2.git] / CorebootModulePkg / Library / CbParseLib / CbParseLib.c
index 0909b0f492023b3a029065906006db6bafdcaf6e..da227dea5e275104efa92ce3fddb62344d32881e 100644 (file)
@@ -18,6 +18,7 @@
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/IoLib.h>\r
 #include <Library/CbParseLib.h>\r
 \r
 #include <IndustryStandard/Acpi.h>\r
@@ -477,6 +478,39 @@ CbParseFadtInfo (
         ASSERT(Fadt->Pm1aEvtBlk != 0);\r
         ASSERT(Fadt->Gpe0Blk != 0);\r
 \r
+        DEBUG_CODE_BEGIN ();\r
+          BOOLEAN    SciEnabled;\r
+\r
+          //\r
+          // Check the consistency of SCI enabling\r
+          //\r
+\r
+          //\r
+          // Get SCI_EN value\r
+          //\r
+          if (Fadt->Pm1CntLen == 4) {\r
+            SciEnabled = (IoRead32 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;\r
+          } else {\r
+            //\r
+            // if (Pm1CntLen == 2), use 16 bit IO read;\r
+            // if (Pm1CntLen != 2 && Pm1CntLen != 4), use 16 bit IO read as a fallback\r
+            //\r
+            SciEnabled = (IoRead16 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;\r
+          }\r
+\r
+          if (!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&\r
+              (Fadt->SmiCmd == 0) &&\r
+              !SciEnabled) {\r
+            //\r
+            // The ACPI enabling status is inconsistent: SCI is not enabled but ACPI\r
+            // table does not provide a means to enable it through FADT->SmiCmd\r
+            //\r
+            DEBUG ((DEBUG_ERROR, "ERROR: The ACPI enabling status is inconsistent: SCI is not"\r
+              " enabled but the ACPI table does not provide a means to enable it through FADT->SmiCmd."\r
+              " This may cause issues in OS.\n"));\r
+            ASSERT (FALSE);\r
+          }\r
+        DEBUG_CODE_END ();\r
         return RETURN_SUCCESS;\r
       }\r
     }\r