From nobody Mon Feb 9 11:44:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57438+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57438+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1586992282; cv=none; d=zohomail.com; s=zohoarc; b=ZrTmiFfrAqrT/XTK15uQPpnGNb6MPZYiVbGjk6N+RoXb46+l02ZU5TQH1PTd/y40mng8VaBFwAomzS4drqNwy6ZqkwNyTJsYkWSn/7w3XMovEGoQWdy5ZAZjkHBMSLDHZ9Z0oDcRxm2pY2nVp/6g1LNJMTofMpOP/I3FSlskFzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586992282; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=TaBxEJrmTr7/SYi6fnaz2Zjoz84XYjLZAu3QGfI9khg=; b=OIXZNZAN3n8vJHE721NUzU59swQ3OMuzulCDF6X4aHqVPwl38dinEFwpZoMe3tBvaxcsMdBxSGaKnMrqaLJXOmR5VZKzm5AVdIvbR/XUf3uAlM8+gsIX1p81MkOFXlJzFxqHYY6eQ3uEDcknz2E+R97ctKVmAvOjdrsUyp/oeIU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57438+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1586992282754751.4668397970255; Wed, 15 Apr 2020 16:11:22 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id KovHYY1788612xhWxglu5wtV; Wed, 15 Apr 2020 16:11:22 -0700 X-Received: from smic.int.bsdio.com (smic.int.bsdio.com [65.103.231.193]) by mx.groups.io with SMTP id smtpd.web11.795.1586992281924117491 for ; Wed, 15 Apr 2020 16:11:22 -0700 X-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 03FNA3Ax046055 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 15 Apr 2020 17:10:03 -0600 (MDT) (envelope-from bcran@smic.int.bsdio.com) X-Received: (from bcran@localhost) by smic.int.bsdio.com (8.15.2/8.15.2/Submit) id 03FNA3fb045291; Wed, 15 Apr 2020 17:10:03 -0600 (MDT) (envelope-from bcran) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Rebecca Cran Subject: [edk2-devel] [PATCH 01/13] OvmfPkg: Add bhyve support into AcpiTimerLib Date: Wed, 15 Apr 2020 17:09:27 -0600 Message-Id: <0b1d5644e175225839828e9a919152aff89491ba.1586991816.git.rebecca@bsdio.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rebecca@bsdio.com X-Gm-Message-State: JyW8hpwmHroykuFiRL0vAFmyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1586992282; bh=yqgUWO1wAZvrB3mdNr3U4+KNYLQom2y1/NAGHH3h2aA=; h=Cc:Date:From:Reply-To:Subject:To; b=o6RWU4NKgEv/P7uSWYP8ECLGJyIquaQ+95/j7S9fIZgknqcf5VLF9J3uY269eup0SfK p3PMNiFQ4h5vhff9LTf/iTqcgEVe4ll4EIY7BT1xntxcz/g2zBytMpUnU6hBmuEhuyNRC LZsppAVxaOgg4ld7dvZ7/xRoNSnhMlYZQh4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" On bhyve, the ACPI timer is located at a fixed IO address; it need not be programmed into, nor fetched from, the PMBA -- power management base address -- register of the PCI host bridge. Signed-off-by: Rebecca Cran Reviewed-by: Laszlo Ersek --- OvmfPkg/Include/IndustryStandard/Bhyve.h | 21 ++++++++++++ OvmfPkg/Include/OvmfPlatforms.h | 1 + .../AcpiTimerLib/BaseAcpiTimerLibBhyve.c | 33 +++++++++++++++++++ .../AcpiTimerLib/BaseAcpiTimerLibBhyve.inf | 29 ++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 OvmfPkg/Include/IndustryStandard/Bhyve.h create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf diff --git a/OvmfPkg/Include/IndustryStandard/Bhyve.h b/OvmfPkg/Include/Ind= ustryStandard/Bhyve.h new file mode 100644 index 0000000000..950f87048b --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/Bhyve.h @@ -0,0 +1,21 @@ +/** @file + Various register numbers and value bits based on FreeBSD's bhyve + at r359530. + - https://svnweb.freebsd.org/base?view=3Drevision&revision=3D359530 + + Copyright (C) 2020, Rebecca Cran + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef __BHYVE_H__ +#define __BHYVE_H__ + +#include +#include +#include +#include + +#define BHYVE_ACPI_TIMER_IO_ADDR 0x408 + +#endif // __BHYVE_H__ diff --git a/OvmfPkg/Include/OvmfPlatforms.h b/OvmfPkg/Include/OvmfPlatform= s.h index 59459231e8..77dd818e30 100644 --- a/OvmfPkg/Include/OvmfPlatforms.h +++ b/OvmfPkg/Include/OvmfPlatforms.h @@ -14,6 +14,7 @@ #include #include #include +#include =20 // // OVMF Host Bridge DID Address diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c b/OvmfPkg= /Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c new file mode 100644 index 0000000000..58ebffac86 --- /dev/null +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c @@ -0,0 +1,33 @@ +/** @file + Provide InternalAcpiGetTimerTick for the bhyve instance of the + Base ACPI Timer Library + + Copyright (C) 2020, Rebecca Cran + Copyright (C) 2014, Gabriel L. Somlo + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include + +/** + Internal function to read the current tick counter of ACPI. + + Read the current ACPI tick counter using the counter address cached + by this instance's constructor. + + @return The tick counter read. + +**/ +UINT32 +InternalAcpiGetTimerTick ( + VOID + ) +{ + // + // Return the current ACPI timer value. + // + return IoRead32 (BHYVE_ACPI_TIMER_IO_ADDR); +} diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf b/OvmfP= kg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf new file mode 100644 index 0000000000..1e48718f3d --- /dev/null +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf @@ -0,0 +1,29 @@ +## @file +# Base ACPI Timer Library Instance for Bhyve. +# +# Copyright (C) 2020, Rebecca Cran +# Copyright (C) 2014, Gabriel L. Somlo +# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BaseAcpiTimerLibBhyve + FILE_GUID =3D A5E3B247-7302-11EA-9C04-3CECEF0C1C08 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D TimerLib + +[Sources] + AcpiTimerLib.c + BaseAcpiTimerLibBhyve.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + IoLib --=20 2.26.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#57438): https://edk2.groups.io/g/devel/message/57438 Mute This Topic: https://groups.io/mt/73045133/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-