]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/ResetSystemLib/BaseResetShutdownBhyve.c
OvmfPkg: Add BaseResetSystemLibBhyve
[mirror_edk2.git] / OvmfPkg / Library / ResetSystemLib / BaseResetShutdownBhyve.c
1 /** @file
2 Base Reset System Library Shutdown API implementation for bhyve.
3
4 Copyright (C) 2020, Rebecca Cran <rebecca@bsdio.com>
5 Copyright (C) 2020, Red Hat, Inc.
6 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9 **/
10
11 #include <Base.h> // BIT13
12
13 #include <IndustryStandard/Bhyve.h> // BHYVE_PM_REG
14 #include <Library/BaseLib.h> // CpuDeadLoop()
15 #include <Library/IoLib.h> // IoOr16()
16 #include <Library/ResetSystemLib.h> // ResetShutdown()
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 **/
25 VOID
26 EFIAPI
27 ResetShutdown (
28 VOID
29 )
30 {
31 IoBitFieldWrite16 (BHYVE_PM_REG, 10, 13, 5);
32 IoOr16 (BHYVE_PM_REG, BIT13);
33 CpuDeadLoop ();
34 }