**/\r
#include "CbSupportDxe.h"\r
\r
-UINTN mPmCtrlReg = 0;\r
/**\r
Reserve MMIO/IO resource in GCD\r
\r
return Status;\r
}\r
\r
-/**\r
- Notification function of EVT_GROUP_READY_TO_BOOT event group.\r
-\r
- This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group.\r
- When the Boot Manager is about to load and execute a boot option, it reclaims variable\r
- storage if free size is below the threshold.\r
-\r
- @param Event Event whose notification function is being invoked.\r
- @param Context Pointer to the notification function's context.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-OnReadyToBoot (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-{\r
- //\r
- // Enable SCI\r
- //\r
- IoOr16 (mPmCtrlReg, BIT0);\r
-\r
- DEBUG ((EFI_D_ERROR, "Enable SCI bit at 0x%lx before boot\n", (UINT64)mPmCtrlReg));\r
-}\r
\r
/**\r
Main entry for the Coreboot Support DXE module.\r
)\r
{\r
EFI_STATUS Status;\r
- EFI_EVENT ReadyToBootEvent;\r
EFI_HOB_GUID_TYPE *GuidHob;\r
SYSTEM_TABLE_INFO *pSystemTableInfo;\r
- ACPI_BOARD_INFO *pAcpiBoardInfo;\r
FRAME_BUFFER_INFO *FbInfo;\r
\r
Status = EFI_SUCCESS;\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r
- //\r
- // Find the acpi board information guid hob\r
- //\r
- GuidHob = GetFirstGuidHob (&gUefiAcpiBoardInfoGuid);\r
- ASSERT (GuidHob != NULL);\r
- pAcpiBoardInfo = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob);\r
-\r
- mPmCtrlReg = (UINTN)pAcpiBoardInfo->PmCtrlRegBase;\r
- DEBUG ((EFI_D_ERROR, "PmCtrlReg at 0x%lx\n", (UINT64)mPmCtrlReg));\r
-\r
//\r
// Find the frame buffer information and update PCDs\r
//\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r
- //\r
- // Register callback on the ready to boot event\r
- // in order to enable SCI\r
- //\r
- ReadyToBootEvent = NULL;\r
- Status = EfiCreateEventReadyToBootEx (\r
- TPL_CALLBACK,\r
- OnReadyToBoot,\r
- NULL,\r
- &ReadyToBootEvent\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
return EFI_SUCCESS;\r
}\r
\r
#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
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