VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c

Last change on this file was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1/** @file
2 Base Reset System Library Shutdown API implementation for OVMF.
3
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
7**/
8
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
18/**
19 Calling this function causes the system to enter a power state equivalent
20 to the ACPI G2/S5 or G3 states.
21
22 System shutdown should not return, if it returns, it means the system does
23 not support shut down reset.
24**/
25VOID
26EFIAPI
27ResetShutdown (
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}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette