]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/ResetSystemLib/BaseResetShutdownBhyve.c
OvmfPkg: Add BaseResetSystemLibBhyve
[mirror_edk2.git] / OvmfPkg / Library / ResetSystemLib / BaseResetShutdownBhyve.c
CommitLineData
f159102a
RC
1/** @file\r
2 Base Reset System Library Shutdown API implementation for bhyve.\r
3\r
4 Copyright (C) 2020, Rebecca Cran <rebecca@bsdio.com>\r
5 Copyright (C) 2020, Red Hat, Inc.\r
6 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
7\r
8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9**/\r
10\r
11#include <Base.h> // BIT13\r
12\r
13#include <IndustryStandard/Bhyve.h> // BHYVE_PM_REG\r
14#include <Library/BaseLib.h> // CpuDeadLoop()\r
15#include <Library/IoLib.h> // IoOr16()\r
16#include <Library/ResetSystemLib.h> // ResetShutdown()\r
17\r
18/**\r
19 Calling this function causes the system to enter a power state equivalent\r
20 to the ACPI G2/S5 or G3 states.\r
21\r
22 System shutdown should not return, if it returns, it means the system does\r
23 not support shut down reset.\r
24**/\r
25VOID\r
26EFIAPI\r
27ResetShutdown (\r
28 VOID\r
29 )\r
30{\r
31 IoBitFieldWrite16 (BHYVE_PM_REG, 10, 13, 5);\r
32 IoOr16 (BHYVE_PM_REG, BIT13);\r
33 CpuDeadLoop ();\r
34}\r