VOID AcpiPmControl ( UINTN SuspendType ) { UINT16 AcpiPmBaseAddress; UINT16 HostBridgeDevId; ASSERT (SuspendType < 6); AcpiPmBaseAddress = 0; HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID); switch (HostBridgeDevId) { case INTEL_82441_DEVICE_ID: AcpiPmBaseAddress = PIIX4_PMBA_VALUE; break; case INTEL_Q35_MCH_DEVICE_ID: AcpiPmBaseAddress = ICH9_PMBASE_VALUE; break; default: ASSERT (FALSE); CpuDeadLoop (); } IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, (UINT16) SuspendType); IoOr16 (AcpiPmBaseAddress + 4, BIT13); CpuDeadLoop (); }
VOID AcpiInitialization ( VOID ) { // // Set ACPI SCI_EN bit in PMCNTRL // IoOr16 ((PciRead32 (PCI_LIB_ADDRESS (0, 1, 3, 0x40)) & ~BIT0) + 4, BIT0); }
VOID AcpiPmControl ( UINTN SuspendType ) { ASSERT (SuspendType < 6); IoAndThenOr16 (0x404, (UINT16) ~0x3c00, (UINT16) (SuspendType << 10)); IoOr16 (0x404, BIT13); CpuDeadLoop (); }
/** Notification function of EVT_GROUP_READY_TO_BOOT event group. This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group. When the Boot Manager is about to load and execute a boot option, it reclaims variable storage if free size is below the threshold. @param Event Event whose notification function is being invoked. @param Context Pointer to the notification function's context. **/ VOID OnReadyToBoot ( EFI_EVENT Event, VOID *Context ) { // // Enable SCI // IoOr16 (mPmCtrlReg, BIT0); DEBUG ((EFI_D_ERROR, "Enable SCI bit at 0x%x before boot\n", mPmCtrlReg)); }
VOID AcpiPmControl ( UINTN SuspendType ) { EFI_HOB_GUID_TYPE *GuidHob; ACPI_BOARD_INFO *pAcpiBoardInfo; UINTN PmCtrlReg = 0; ASSERT (SuspendType <= 7); // // Find the acpi board information guid hob // GuidHob = GetFirstGuidHob (&gUefiAcpiBoardInfoGuid); ASSERT (GuidHob != NULL); pAcpiBoardInfo = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob); PmCtrlReg = (UINTN)pAcpiBoardInfo->PmCtrlRegBase; IoAndThenOr16 (PmCtrlReg, (UINT16) ~0x3c00, (UINT16) (SuspendType << 10)); IoOr16 (PmCtrlReg, BIT13); CpuDeadLoop (); }
/** Clear APM SMI Status Bit; Set the EOS bit. **/ VOID EFIAPI ClearSmi ( VOID ) { UINT16 GPE0BLK_Base; // // Get GpeBase // GPE0BLK_Base = (UINT16)(LpcPciCfg32 (R_QNC_LPC_GPE0BLK) & 0xFFFF); // // Clear the APM SMI Status Bit // IoOr16 (GPE0BLK_Base + R_QNC_GPE0BLK_SMIS, B_QNC_GPE0BLK_SMIS_APM); // // Set the EOS Bit // IoOr32 (GPE0BLK_Base + R_QNC_GPE0BLK_SMIS, B_QNC_GPE0BLK_SMIS_EOS); }