]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
OvmfPkg: Add bhyve support into AcpiTimerLib
[mirror_edk2.git] / OvmfPkg / Library / AcpiTimerLib / BaseAcpiTimerLibBhyve.c
diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
new file mode 100644 (file)
index 0000000..f927e27
--- /dev/null
@@ -0,0 +1,32 @@
+/** @file\r
+  Provide InternalAcpiGetTimerTick for the bhyve instance of the\r
+  Base ACPI Timer Library\r
+\r
+  Copyright (C) 2020, Rebecca Cran <rebecca@bsdio.com>\r
+  Copyright (C) 2014, Gabriel L. Somlo <somlo@cmu.edu>\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#include <Library/IoLib.h>\r
+#include <OvmfPlatforms.h>\r
+\r
+/**\r
+  Internal function to read the current tick counter of ACPI.\r
+\r
+  Read the current ACPI tick counter using the counter address cached\r
+  by this instance's constructor.\r
+\r
+  @return The tick counter read.\r
+\r
+**/\r
+UINT32\r
+InternalAcpiGetTimerTick (\r
+  VOID\r
+  )\r
+{\r
+  //\r
+  // Return the current ACPI timer value.\r
+  //\r
+  return IoRead32 (BHYVE_ACPI_TIMER_IO_ADDR);\r
+}\r