public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 (add signed-off-by)] OvmfPkg: Add bhyve support into AcpiTimerLib
@ 2020-03-25 20:16 Rebecca Cran
  2020-03-27 19:01 ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Rebecca Cran @ 2020-03-25 20:16 UTC (permalink / raw)
  To: devel; +Cc: Jordan Justen, Laszlo Ersek, Ard Biesheuvel, Rebecca Cran

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 OvmfPkg/Include/OvmfPlatforms.h                    | 7 +++++++
 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c    | 3 +++
 OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c | 4 ++++
 OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c     | 3 +++
 4 files changed, 17 insertions(+)

diff --git a/OvmfPkg/Include/OvmfPlatforms.h b/OvmfPkg/Include/OvmfPlatforms.h
index 59459231e8..3d1a8fd8fa 100644
--- a/OvmfPkg/Include/OvmfPlatforms.h
+++ b/OvmfPkg/Include/OvmfPlatforms.h
@@ -37,4 +37,11 @@
 //
 #define ACPI_TIMER_OFFSET 0x8
 
+//
+// bhyve definitions
+//
+#define BHYVE_PCI_DEVICE_ID 0x1275 // NetApp vendor ID
+
+#define BHYVE_ACPI_TIMER_IO_ADDR 0x408
+
 #endif
diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
index aa2b5faf1c..e32260b134 100644
--- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
@@ -41,6 +41,9 @@ AcpiTimerLibConstructor (
   //
   HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
   switch (HostBridgeDevId) {
+    case BHYVE_PCI_DEVICE_ID:
+      mAcpiTimerIoAddr = BHYVE_ACPI_TIMER_IO_ADDR;
+      return RETURN_SUCCESS;
     case INTEL_82441_DEVICE_ID:
       Pmba       = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
       PmbaAndVal = ~(UINT32)PIIX4_PMBA_MASK;
diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
index dd022aceed..2fec105dea 100644
--- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
@@ -39,6 +39,8 @@ AcpiTimerLibConstructor (
   //
   HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
   switch (HostBridgeDevId) {
+    case BHYVE_PCI_DEVICE_ID:
+      return RETURN_SUCCESS;
     case INTEL_82441_DEVICE_ID:
       Pmba       = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
       PmbaAndVal = ~(UINT32)PIIX4_PMBA_MASK;
@@ -101,6 +103,8 @@ InternalAcpiGetTimerTick (
   //
   HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
   switch (HostBridgeDevId) {
+    case BHYVE_PCI_DEVICE_ID:
+      return IoRead32(BHYVE_ACPI_TIMER_IO_ADDR);
     case INTEL_82441_DEVICE_ID:
       Pmba = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
       break;
diff --git a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
index ae976cbe9e..10c41ff7ed 100644
--- a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
@@ -44,6 +44,9 @@ AcpiTimerLibConstructor (
   //
   HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId);
   switch (HostBridgeDevId) {
+    case BHYVE_PCI_DEVICE_ID:
+      mAcpiTimerIoAddr = BHYVE_ACPI_TIMER_IO_ADDR;
+      return RETURN_SUCCESS;
     case INTEL_82441_DEVICE_ID:
       Pmba = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
       break;
-- 
2.25.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-09  6:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-25 20:16 [PATCH v2 (add signed-off-by)] OvmfPkg: Add bhyve support into AcpiTimerLib Rebecca Cran
2020-03-27 19:01 ` Laszlo Ersek
2020-04-09  5:26   ` Rebecca Cran
2020-04-09  6:40     ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox