[edk2-devel] [PATCH] OvmfPkg: Add bhyve support into AcpiTimerLib

Rebecca Cran posted 1 patch 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20200325200500.81526-1-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(+)

[edk2-devel] [PATCH] OvmfPkg: Add bhyve support into AcpiTimerLib

Posted by Rebecca Cran 1 week ago
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56342): https://edk2.groups.io/g/devel/message/56342
Mute This Topic: https://groups.io/mt/72549822/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH] OvmfPkg: Add bhyve support into AcpiTimerLib

Posted by Rebecca Cran 1 week ago
On 3/25/20 2:05 PM, Rebecca Cran wrote:
> ---
>   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(+)

Sigh. Sorry please ignore this - I forgot to run PatchCheck.py and add 
Signed-Off-By.

I've sent a v2 patch.


-- 
Rebecca Cran




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56344): https://edk2.groups.io/g/devel/message/56344
Mute This Topic: https://groups.io/mt/72549822/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-