]> xenbits.xensource.com Git - qemu-xen-unstable.git/commitdiff
hw: Move sun4v hypervisor RTC from hw/timer/ to hw/rtc/ subdirectory
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Thu, 3 Oct 2019 23:03:56 +0000 (01:03 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Thu, 24 Oct 2019 18:23:15 +0000 (20:23 +0200)
Move RTC devices under the hw/rtc/ subdirectory.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
Message-Id: <20191003230404.19384-7-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
12 files changed:
MAINTAINERS
hw/rtc/Kconfig
hw/rtc/Makefile.objs
hw/rtc/sun4v-rtc.c [new file with mode: 0644]
hw/rtc/trace-events
hw/sparc64/niagara.c
hw/timer/Kconfig
hw/timer/Makefile.objs
hw/timer/sun4v-rtc.c [deleted file]
hw/timer/trace-events
include/hw/rtc/sun4v-rtc.h [new file with mode: 0644]
include/hw/timer/sun4v-rtc.h [deleted file]

index ba0d1906aae962e5fe6694af12eea3986e68c37d..a7de5e2d12534702f86baac722a505de2f726390 100644 (file)
@@ -1163,8 +1163,8 @@ Sun4v
 M: Artyom Tarasenko <atar4qemu@gmail.com>
 S: Maintained
 F: hw/sparc64/niagara.c
-F: hw/timer/sun4v-rtc.c
-F: include/hw/timer/sun4v-rtc.h
+F: hw/rtc/sun4v-rtc.c
+F: include/hw/rtc/sun4v-rtc.h
 
 Leon3
 M: Fabien Chouteau <chouteau@adacore.com>
index 434b20b2b1bda350c99152bffb6b716bff40acf7..cc7fead764f40fef2e4f3cc989b2e145ce139111 100644 (file)
@@ -10,3 +10,6 @@ config PL031
 
 config MC146818RTC
     bool
+
+config SUN4V_RTC
+    bool
index 89e8e48c640942a2ae468bd64e7a008ddc35bf8b..4621b37bc2f611f26e090b9cd7427e0b88974af5 100644 (file)
@@ -5,3 +5,4 @@ common-obj-$(CONFIG_M48T59) += m48t59-isa.o
 endif
 common-obj-$(CONFIG_PL031) += pl031.o
 obj-$(CONFIG_MC146818RTC) += mc146818rtc.o
+common-obj-$(CONFIG_SUN4V_RTC) += sun4v-rtc.o
diff --git a/hw/rtc/sun4v-rtc.c b/hw/rtc/sun4v-rtc.c
new file mode 100644 (file)
index 0000000..ada01b5
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * QEMU sun4v Real Time Clock device
+ *
+ * The sun4v_rtc device (sun4v tod clock)
+ *
+ * Copyright (c) 2016 Artyom Tarasenko
+ *
+ * This code is licensed under the GNU GPL v3 or (at your option) any later
+ * version.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/sysbus.h"
+#include "qemu/module.h"
+#include "qemu/timer.h"
+#include "hw/rtc/sun4v-rtc.h"
+#include "trace.h"
+
+
+#define TYPE_SUN4V_RTC "sun4v_rtc"
+#define SUN4V_RTC(obj) OBJECT_CHECK(Sun4vRtc, (obj), TYPE_SUN4V_RTC)
+
+typedef struct Sun4vRtc {
+    SysBusDevice parent_obj;
+
+    MemoryRegion iomem;
+} Sun4vRtc;
+
+static uint64_t sun4v_rtc_read(void *opaque, hwaddr addr,
+                                unsigned size)
+{
+    uint64_t val = get_clock_realtime() / NANOSECONDS_PER_SECOND;
+    if (!(addr & 4ULL)) {
+        /* accessing the high 32 bits */
+        val >>= 32;
+    }
+    trace_sun4v_rtc_read(addr, val);
+    return val;
+}
+
+static void sun4v_rtc_write(void *opaque, hwaddr addr,
+                             uint64_t val, unsigned size)
+{
+    trace_sun4v_rtc_write(addr, val);
+}
+
+static const MemoryRegionOps sun4v_rtc_ops = {
+    .read = sun4v_rtc_read,
+    .write = sun4v_rtc_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
+};
+
+void sun4v_rtc_init(hwaddr addr)
+{
+    DeviceState *dev;
+    SysBusDevice *s;
+
+    dev = qdev_create(NULL, TYPE_SUN4V_RTC);
+    s = SYS_BUS_DEVICE(dev);
+
+    qdev_init_nofail(dev);
+
+    sysbus_mmio_map(s, 0, addr);
+}
+
+static void sun4v_rtc_realize(DeviceState *dev, Error **errp)
+{
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+    Sun4vRtc *s = SUN4V_RTC(dev);
+
+    memory_region_init_io(&s->iomem, OBJECT(s), &sun4v_rtc_ops, s,
+                          "sun4v-rtc", 0x08ULL);
+    sysbus_init_mmio(sbd, &s->iomem);
+}
+
+static void sun4v_rtc_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->realize = sun4v_rtc_realize;
+}
+
+static const TypeInfo sun4v_rtc_info = {
+    .name          = TYPE_SUN4V_RTC,
+    .parent        = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(Sun4vRtc),
+    .class_init    = sun4v_rtc_class_init,
+};
+
+static void sun4v_rtc_register_types(void)
+{
+    type_register_static(&sun4v_rtc_info);
+}
+
+type_init(sun4v_rtc_register_types)
index 54c94ac557b21bca510f3e263f1904223cb623d0..ac9e0e0fba32343dc440e5f14d4fb40275ee611a 100644 (file)
@@ -1,5 +1,9 @@
 # See docs/devel/tracing.txt for syntax documentation.
 
+# sun4v-rtc.c
+sun4v_rtc_read(uint64_t addr, uint64_t value) "read: addr 0x%" PRIx64 " value 0x%" PRIx64
+sun4v_rtc_write(uint64_t addr, uint64_t value) "write: addr 0x%" PRIx64 " value 0x%" PRIx64
+
 # pl031.c
 pl031_irq_state(int level) "irq state %d"
 pl031_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
index 5987693659ed1cfc6852f0a646948b3fd077ba50..5eb2d097b904cedfff9c03bacdc8df7ef0db24c6 100644 (file)
@@ -30,7 +30,7 @@
 #include "hw/misc/unimp.h"
 #include "hw/loader.h"
 #include "hw/sparc/sparc64.h"
-#include "hw/timer/sun4v-rtc.h"
+#include "hw/rtc/sun4v-rtc.h"
 #include "exec/address-spaces.h"
 #include "sysemu/block-backend.h"
 #include "qemu/error-report.h"
index a6b668b2559b2a4e05d5f9baefc9edd4b1efec38..b04c928136c2f7d5b241c00e83b55fb217242400 100644 (file)
@@ -35,9 +35,6 @@ config ALLWINNER_A10_PIT
 config STM32F2XX_TIMER
     bool
 
-config SUN4V_RTC
-    bool
-
 config CMSDK_APB_TIMER
     bool
     select PTIMER
index 2fb12162a623bf5c37d459b35191f1bb7a564904..034bd30255c0b1e1ba0d7f3c972507e13e06a770 100644 (file)
@@ -35,7 +35,6 @@ common-obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o
 common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o
 common-obj-$(CONFIG_ASPEED_SOC) += aspeed_timer.o aspeed_rtc.o
 
-common-obj-$(CONFIG_SUN4V_RTC) += sun4v-rtc.o
 common-obj-$(CONFIG_CMSDK_APB_TIMER) += cmsdk-apb-timer.o
 common-obj-$(CONFIG_CMSDK_APB_DUALTIMER) += cmsdk-apb-dualtimer.o
 common-obj-$(CONFIG_MSF2) += mss-timer.o
diff --git a/hw/timer/sun4v-rtc.c b/hw/timer/sun4v-rtc.c
deleted file mode 100644 (file)
index 54272a8..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * QEMU sun4v Real Time Clock device
- *
- * The sun4v_rtc device (sun4v tod clock)
- *
- * Copyright (c) 2016 Artyom Tarasenko
- *
- * This code is licensed under the GNU GPL v3 or (at your option) any later
- * version.
- */
-
-#include "qemu/osdep.h"
-#include "hw/sysbus.h"
-#include "qemu/module.h"
-#include "qemu/timer.h"
-#include "hw/timer/sun4v-rtc.h"
-#include "trace.h"
-
-
-#define TYPE_SUN4V_RTC "sun4v_rtc"
-#define SUN4V_RTC(obj) OBJECT_CHECK(Sun4vRtc, (obj), TYPE_SUN4V_RTC)
-
-typedef struct Sun4vRtc {
-    SysBusDevice parent_obj;
-
-    MemoryRegion iomem;
-} Sun4vRtc;
-
-static uint64_t sun4v_rtc_read(void *opaque, hwaddr addr,
-                                unsigned size)
-{
-    uint64_t val = get_clock_realtime() / NANOSECONDS_PER_SECOND;
-    if (!(addr & 4ULL)) {
-        /* accessing the high 32 bits */
-        val >>= 32;
-    }
-    trace_sun4v_rtc_read(addr, val);
-    return val;
-}
-
-static void sun4v_rtc_write(void *opaque, hwaddr addr,
-                             uint64_t val, unsigned size)
-{
-    trace_sun4v_rtc_write(addr, val);
-}
-
-static const MemoryRegionOps sun4v_rtc_ops = {
-    .read = sun4v_rtc_read,
-    .write = sun4v_rtc_write,
-    .endianness = DEVICE_NATIVE_ENDIAN,
-};
-
-void sun4v_rtc_init(hwaddr addr)
-{
-    DeviceState *dev;
-    SysBusDevice *s;
-
-    dev = qdev_create(NULL, TYPE_SUN4V_RTC);
-    s = SYS_BUS_DEVICE(dev);
-
-    qdev_init_nofail(dev);
-
-    sysbus_mmio_map(s, 0, addr);
-}
-
-static void sun4v_rtc_realize(DeviceState *dev, Error **errp)
-{
-    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
-    Sun4vRtc *s = SUN4V_RTC(dev);
-
-    memory_region_init_io(&s->iomem, OBJECT(s), &sun4v_rtc_ops, s,
-                          "sun4v-rtc", 0x08ULL);
-    sysbus_init_mmio(sbd, &s->iomem);
-}
-
-static void sun4v_rtc_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-
-    dc->realize = sun4v_rtc_realize;
-}
-
-static const TypeInfo sun4v_rtc_info = {
-    .name          = TYPE_SUN4V_RTC,
-    .parent        = TYPE_SYS_BUS_DEVICE,
-    .instance_size = sizeof(Sun4vRtc),
-    .class_init    = sun4v_rtc_class_init,
-};
-
-static void sun4v_rtc_register_types(void)
-{
-    type_register_static(&sun4v_rtc_info);
-}
-
-type_init(sun4v_rtc_register_types)
index 6936fe8573e92be898de51b5890876b23dbc3189..ce34b967db9f1abcb893615fccec13c598a76d73 100644 (file)
@@ -70,10 +70,6 @@ cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset"
 aspeed_rtc_read(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64
 aspeed_rtc_write(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64
 
-# sun4v-rtc.c
-sun4v_rtc_read(uint64_t addr, uint64_t value) "read: addr 0x%" PRIx64 " value 0x%" PRIx64
-sun4v_rtc_write(uint64_t addr, uint64_t value) "write: addr 0x%" PRIx64 " value 0x%" PRIx64
-
 # xlnx-zynqmp-rtc.c
 xlnx_zynqmp_rtc_gettime(int year, int month, int day, int hour, int min, int sec) "Get time from host: %d-%d-%d %2d:%02d:%02d"
 
diff --git a/include/hw/rtc/sun4v-rtc.h b/include/hw/rtc/sun4v-rtc.h
new file mode 100644 (file)
index 0000000..fd868f6
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * QEMU sun4v Real Time Clock device
+ *
+ * The sun4v_rtc device (sun4v tod clock)
+ *
+ * Copyright (c) 2016 Artyom Tarasenko
+ *
+ * This code is licensed under the GNU GPL v3 or (at your option) any later
+ * version.
+ */
+
+#ifndef HW_RTC_SUN4V
+#define HW_RTC_SUN4V
+
+#include "exec/hwaddr.h"
+
+void sun4v_rtc_init(hwaddr addr);
+
+#endif
diff --git a/include/hw/timer/sun4v-rtc.h b/include/hw/timer/sun4v-rtc.h
deleted file mode 100644 (file)
index 407278f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-void sun4v_rtc_init(hwaddr addr);