2 DXE Reset System Library Shutdown API implementation for OVMF.
4 Copyright (C) 2020, Red Hat, Inc.
5 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include <Base.h> // BIT13
11 #include <Library/BaseLib.h> // CpuDeadLoop()
12 #include <Library/DebugLib.h> // ASSERT()
13 #include <Library/IoLib.h> // IoOr16()
14 #include <Library/PcdLib.h> // PcdGet16()
15 #include <Library/ResetSystemLib.h> // ResetShutdown()
16 #include <OvmfPlatforms.h> // PIIX4_PMBA_VALUE
18 STATIC UINT16 mAcpiPmBaseAddress
;
23 IN EFI_HANDLE ImageHandle
,
24 IN EFI_SYSTEM_TABLE
*SystemTable
27 UINT16 HostBridgeDevId
;
29 HostBridgeDevId
= PcdGet16 (PcdOvmfHostBridgePciDevId
);
30 switch (HostBridgeDevId
) {
31 case INTEL_82441_DEVICE_ID
:
32 mAcpiPmBaseAddress
= PIIX4_PMBA_VALUE
;
34 case INTEL_Q35_MCH_DEVICE_ID
:
35 mAcpiPmBaseAddress
= ICH9_PMBASE_VALUE
;
40 return EFI_UNSUPPORTED
;
47 Calling this function causes the system to enter a power state equivalent
48 to the ACPI G2/S5 or G3 states.
50 System shutdown should not return, if it returns, it means the system does
51 not support shut down reset.
59 IoBitFieldWrite16 (mAcpiPmBaseAddress
+ 4, 10, 13, 0);
60 IoOr16 (mAcpiPmBaseAddress
+ 4, BIT13
);