From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smic.int.bsdio.com (smic.int.bsdio.com [65.103.231.193]) by mx.groups.io with SMTP id smtpd.web10.847.1586992446172024070 for ; Wed, 15 Apr 2020 16:14:06 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: smic.int.bsdio.com, ip: 65.103.231.193, mailfrom: bcran@smic.int.bsdio.com) Received: from smic.int.bsdio.com (localhost [127.0.0.1]) by smic.int.bsdio.com (8.15.2/8.15.2) with ESMTPS id 03FNA4RI050874 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 15 Apr 2020 17:10:04 -0600 (MDT) (envelope-from bcran@smic.int.bsdio.com) Received: (from bcran@localhost) by smic.int.bsdio.com (8.15.2/8.15.2/Submit) id 03FNA4xY047463; Wed, 15 Apr 2020 17:10:04 -0600 (MDT) (envelope-from bcran) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Rebecca Cran Subject: [PATCH 02/13] OvmfPkg: support powering off bhyve guests Date: Wed, 15 Apr 2020 17:09:28 -0600 Message-Id: X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Update ResetSystemLib to support powering off bhyve guests instead of having them enter the CpuDeadLoop. On bhyve, the Power Management 1 Control Register is located at 0x404; a write with SLP_TYP set to 5 will power off the guest. Signed-off-by: Rebecca Cran --- OvmfPkg/Include/IndustryStandard/Bhyve.h | 4 ++++ OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/OvmfPkg/Include/IndustryStandard/Bhyve.h b/OvmfPkg/Include/Ind= ustryStandard/Bhyve.h index 950f87048b..ceabc54d59 100644 --- a/OvmfPkg/Include/IndustryStandard/Bhyve.h +++ b/OvmfPkg/Include/IndustryStandard/Bhyve.h @@ -18,4 +18,8 @@ =0D #define BHYVE_ACPI_TIMER_IO_ADDR 0x408=0D =0D +#define BHYVE_PMBASE_VALUE 0x400=0D +=0D +#define BHYVE_PCI_DEVICE_ID 0x1275 // NetApp vendor ID=0D +=0D #endif // __BHYVE_H__=0D diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Libr= ary/ResetSystemLib/ResetSystemLib.c index 2f2e1293a3..8d9b9dfcf5 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -28,6 +28,12 @@ AcpiPmControl ( AcpiPmBaseAddress =3D 0;=0D HostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID);=0D switch (HostBridgeDevId) {=0D + case BHYVE_PCI_DEVICE_ID:=0D + AcpiPmBaseAddress =3D BHYVE_PMBASE_VALUE;=0D + // Bhyve needs a value of 5 to enter S5 (power off)=0D + if (SuspendType =3D=3D 0)=0D + SuspendType =3D 5;=0D + break;=0D case INTEL_82441_DEVICE_ID:=0D AcpiPmBaseAddress =3D PIIX4_PMBA_VALUE;=0D break;=0D --=20 2.26.1