TianoCore EDK2 master
Loading...
Searching...
No Matches
BaseResetShutdown.c
Go to the documentation of this file.
1
9#include <Base.h> // BIT13
10
11#include <Library/BaseLib.h> // CpuDeadLoop()
12#include <Library/DebugLib.h> // ASSERT()
13#include <Library/IoLib.h> // IoOr16()
14#include <Library/PciLib.h> // PciRead16()
15#include <Library/ResetSystemLib.h> // ResetShutdown()
16#include <OvmfPlatforms.h> // OVMF_HOSTBRIDGE_DID
17
25VOID
26EFIAPI
28 VOID
29 )
30{
31 UINT16 AcpiPmBaseAddress;
32 UINT16 HostBridgeDevId;
33
34 AcpiPmBaseAddress = 0;
35 HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
36 switch (HostBridgeDevId) {
37 case INTEL_82441_DEVICE_ID:
38 AcpiPmBaseAddress = PIIX4_PMBA_VALUE;
39 break;
40 case INTEL_Q35_MCH_DEVICE_ID:
41 AcpiPmBaseAddress = ICH9_PMBASE_VALUE;
42 break;
43 case CLOUDHV_DEVICE_ID:
44 IoWrite8 (CLOUDHV_ACPI_SHUTDOWN_IO_ADDRESS, 5 << 2 | 1 << 5);
45 CpuDeadLoop ();
46 default:
47 ASSERT (FALSE);
48 CpuDeadLoop ();
49 }
50
51 IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, 0);
52 IoOr16 (AcpiPmBaseAddress + 4, BIT13);
53 CpuDeadLoop ();
54}
VOID EFIAPI CpuDeadLoop(VOID)
Definition: CpuDeadLoop.c:25
VOID EFIAPI ResetShutdown(VOID)
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
Definition: IoLibArmVirt.c:200
UINT16 EFIAPI IoOr16(IN UINTN Port, IN UINT16 OrData)
Definition: IoHighLevel.c:325
UINT16 EFIAPI IoBitFieldWrite16(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
Definition: IoHighLevel.c:453
#define FALSE
Definition: Base.h:307
UINT16 EFIAPI PciRead16(IN UINTN Address)
Definition: PciLib.c:396