From 57c661c48d746f0e090645ce6704d261764685c2 Mon Sep 17 00:00:00 2001 From: Peter Fang Date: Mon, 24 Dec 2018 21:44:35 -0800 Subject: [PATCH] dm: vrtc: add RTC to ACPI DSDT Clear Linux complains about not finding RTC as a PNP device: platform rtc_cmos: registered platform RTC device (no PNP device found) This is a port of Bhyve vRTC's user-space logic. Tracked-On: #2176 Signed-off-by: Peter Fang Reviewed-by: Eddie Dong Reviewed-by: Victor Sun --- devicemodel/hw/platform/rtc.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/devicemodel/hw/platform/rtc.c b/devicemodel/hw/platform/rtc.c index 3376f6ec2..bbb218975 100644 --- a/devicemodel/hw/platform/rtc.c +++ b/devicemodel/hw/platform/rtc.c @@ -39,6 +39,8 @@ #include "rtc.h" #include "mevent.h" #include "timer.h" +#include "acpi.h" +#include "lpc.h" /* #define DEBUG_RTC */ #ifdef DEBUG_RTC @@ -1178,3 +1180,27 @@ vrtc_deinit(struct vmctx *ctx) free(vrtc); ctx->vrtc = NULL; } + +static void +rtc_dsdt(void) +{ + dsdt_line(""); + dsdt_line("Device (RTC)"); + dsdt_line("{"); + dsdt_line(" Name (_HID, EisaId (\"PNP0B00\"))"); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_indent(2); + dsdt_fixed_ioport(IO_RTC, 2); + dsdt_fixed_irq(8); + dsdt_unindent(2); + dsdt_line(" })"); + dsdt_line("}"); +} +LPC_DSDT(rtc_dsdt); + +/* + * Reserve the extended RTC I/O ports although they are not emulated at this + * time. + */ +SYSRES_IO(0x72, 6);