]> git.proxmox.com Git - qemu.git/commitdiff
hw: move watchdogs to hw/watchdog, configure via default-configs/
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 5 Feb 2013 11:27:44 +0000 (12:27 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 8 Apr 2013 16:13:13 +0000 (18:13 +0200)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
default-configs/i386-softmmu.mak
default-configs/pci.mak
default-configs/x86_64-softmmu.mak
hw/i386/Makefile.objs
hw/watchdog/Makefile.objs
hw/watchdog/wdt_ib700.c [new file with mode: 0644]
hw/wdt_ib700.c [deleted file]

index e041a6387df67c0aa5101723bc53db7a4640c4a1..7dd066989339cb1e9a0cb7d43eb6aac427afff35 100644 (file)
@@ -29,3 +29,4 @@ CONFIG_PFLASH_CFI01=y
 CONFIG_TPM_TIS=y
 CONFIG_TPM_PASSTHROUGH=y
 CONFIG_PCI_HOTPLUG=y
+CONFIG_WDT_IB700=y
index ce56d580558114f612b29d479f304b345c708343..f5f100ecb0d5361ef11c6a9aea5cd666aa8dcdff 100644 (file)
@@ -23,3 +23,4 @@ CONFIG_ESP_PCI=y
 CONFIG_SERIAL=y
 CONFIG_SERIAL_PCI=y
 CONFIG_IPACK=y
+CONFIG_WDT_IB6300ESB=y
index 5ba1116719d9c2ab1b725ab43bdbb91c94aec881..0e5ab554e5b0de094704be053f6ae7e554408daf 100644 (file)
@@ -29,3 +29,4 @@ CONFIG_PFLASH_CFI01=y
 CONFIG_TPM_TIS=y
 CONFIG_TPM_PASSTHROUGH=y
 CONFIG_PCI_HOTPLUG=y
+CONFIG_WDT_IB700=y
index c813b1ef78676a219b1c2bc624af886f1a9a5257..5559a8ba5c70d597f414c65d7732d95f5f4b4b13 100644 (file)
@@ -2,7 +2,6 @@ obj-y += mc146818rtc.o
 obj-y += apic_common.o apic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
-obj-y += wdt_ib700.o
 obj-y += debugcon.o debugexit.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o
index f57133b72905897f969521ef9fda23ed44d3b0f5..4b0374a555dc574e7f1a562e69d6f2b8e515a815 100644 (file)
@@ -1,2 +1,3 @@
 common-obj-y += watchdog.o
-common-obj-$(CONFIG_PCI) += wdt_i6300esb.o
+common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
+common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c
new file mode 100644 (file)
index 0000000..b8c4be8
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Virtual hardware watchdog.
+ *
+ * Copyright (C) 2009 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * By Richard W.M. Jones (rjones@redhat.com).
+ */
+
+#include "qemu-common.h"
+#include "qemu/timer.h"
+#include "sysemu/watchdog.h"
+#include "hw/hw.h"
+#include "hw/isa/isa.h"
+#include "hw/i386/pc.h"
+
+/*#define IB700_DEBUG 1*/
+
+#ifdef IB700_DEBUG
+#define ib700_debug(fs,...)                                    \
+    fprintf(stderr,"ib700: %s: "fs,__func__,##__VA_ARGS__)
+#else
+#define ib700_debug(fs,...)
+#endif
+
+typedef struct IB700state {
+    ISADevice dev;
+    QEMUTimer *timer;
+} IB700State;
+
+/* This is the timer.  We use a global here because the watchdog
+ * code ensures there is only one watchdog (it is located at a fixed,
+ * unchangeable IO port, so there could only ever be one anyway).
+ */
+
+/* A write to this register enables the timer. */
+static void ib700_write_enable_reg(void *vp, uint32_t addr, uint32_t data)
+{
+    IB700State *s = vp;
+    static int time_map[] = {
+        30, 28, 26, 24, 22, 20, 18, 16,
+        14, 12, 10,  8,  6,  4,  2,  0
+    };
+    int64_t timeout;
+
+    ib700_debug("addr = %x, data = %x\n", addr, data);
+
+    timeout = (int64_t) time_map[data & 0xF] * get_ticks_per_sec();
+    qemu_mod_timer(s->timer, qemu_get_clock_ns (vm_clock) + timeout);
+}
+
+/* A write (of any value) to this register disables the timer. */
+static void ib700_write_disable_reg(void *vp, uint32_t addr, uint32_t data)
+{
+    IB700State *s = vp;
+
+    ib700_debug("addr = %x, data = %x\n", addr, data);
+
+    qemu_del_timer(s->timer);
+}
+
+/* This is called when the watchdog expires. */
+static void ib700_timer_expired(void *vp)
+{
+    IB700State *s = vp;
+
+    ib700_debug("watchdog expired\n");
+
+    watchdog_perform_action();
+    qemu_del_timer(s->timer);
+}
+
+static const VMStateDescription vmstate_ib700 = {
+    .name = "ib700_wdt",
+    .version_id = 0,
+    .minimum_version_id = 0,
+    .minimum_version_id_old = 0,
+    .fields      = (VMStateField []) {
+        VMSTATE_TIMER(timer, IB700State),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+static int wdt_ib700_init(ISADevice *dev)
+{
+    IB700State *s = DO_UPCAST(IB700State, dev, dev);
+
+    ib700_debug("watchdog init\n");
+
+    s->timer = qemu_new_timer_ns(vm_clock, ib700_timer_expired, s);
+    register_ioport_write(0x441, 2, 1, ib700_write_disable_reg, s);
+    register_ioport_write(0x443, 2, 1, ib700_write_enable_reg, s);
+
+    return 0;
+}
+
+static void wdt_ib700_reset(DeviceState *dev)
+{
+    IB700State *s = DO_UPCAST(IB700State, dev.qdev, dev);
+
+    ib700_debug("watchdog reset\n");
+
+    qemu_del_timer(s->timer);
+}
+
+static WatchdogTimerModel model = {
+    .wdt_name = "ib700",
+    .wdt_description = "iBASE 700",
+};
+
+static void wdt_ib700_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+    ic->init = wdt_ib700_init;
+    dc->reset = wdt_ib700_reset;
+    dc->vmsd = &vmstate_ib700;
+}
+
+static const TypeInfo wdt_ib700_info = {
+    .name          = "ib700",
+    .parent        = TYPE_ISA_DEVICE,
+    .instance_size = sizeof(IB700State),
+    .class_init    = wdt_ib700_class_init,
+};
+
+static void wdt_ib700_register_types(void)
+{
+    watchdog_add_model(&model);
+    type_register_static(&wdt_ib700_info);
+}
+
+type_init(wdt_ib700_register_types)
diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c
deleted file mode 100644 (file)
index b8c4be8..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Virtual hardware watchdog.
- *
- * Copyright (C) 2009 Red Hat Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * By Richard W.M. Jones (rjones@redhat.com).
- */
-
-#include "qemu-common.h"
-#include "qemu/timer.h"
-#include "sysemu/watchdog.h"
-#include "hw/hw.h"
-#include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
-
-/*#define IB700_DEBUG 1*/
-
-#ifdef IB700_DEBUG
-#define ib700_debug(fs,...)                                    \
-    fprintf(stderr,"ib700: %s: "fs,__func__,##__VA_ARGS__)
-#else
-#define ib700_debug(fs,...)
-#endif
-
-typedef struct IB700state {
-    ISADevice dev;
-    QEMUTimer *timer;
-} IB700State;
-
-/* This is the timer.  We use a global here because the watchdog
- * code ensures there is only one watchdog (it is located at a fixed,
- * unchangeable IO port, so there could only ever be one anyway).
- */
-
-/* A write to this register enables the timer. */
-static void ib700_write_enable_reg(void *vp, uint32_t addr, uint32_t data)
-{
-    IB700State *s = vp;
-    static int time_map[] = {
-        30, 28, 26, 24, 22, 20, 18, 16,
-        14, 12, 10,  8,  6,  4,  2,  0
-    };
-    int64_t timeout;
-
-    ib700_debug("addr = %x, data = %x\n", addr, data);
-
-    timeout = (int64_t) time_map[data & 0xF] * get_ticks_per_sec();
-    qemu_mod_timer(s->timer, qemu_get_clock_ns (vm_clock) + timeout);
-}
-
-/* A write (of any value) to this register disables the timer. */
-static void ib700_write_disable_reg(void *vp, uint32_t addr, uint32_t data)
-{
-    IB700State *s = vp;
-
-    ib700_debug("addr = %x, data = %x\n", addr, data);
-
-    qemu_del_timer(s->timer);
-}
-
-/* This is called when the watchdog expires. */
-static void ib700_timer_expired(void *vp)
-{
-    IB700State *s = vp;
-
-    ib700_debug("watchdog expired\n");
-
-    watchdog_perform_action();
-    qemu_del_timer(s->timer);
-}
-
-static const VMStateDescription vmstate_ib700 = {
-    .name = "ib700_wdt",
-    .version_id = 0,
-    .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
-        VMSTATE_TIMER(timer, IB700State),
-        VMSTATE_END_OF_LIST()
-    }
-};
-
-static int wdt_ib700_init(ISADevice *dev)
-{
-    IB700State *s = DO_UPCAST(IB700State, dev, dev);
-
-    ib700_debug("watchdog init\n");
-
-    s->timer = qemu_new_timer_ns(vm_clock, ib700_timer_expired, s);
-    register_ioport_write(0x441, 2, 1, ib700_write_disable_reg, s);
-    register_ioport_write(0x443, 2, 1, ib700_write_enable_reg, s);
-
-    return 0;
-}
-
-static void wdt_ib700_reset(DeviceState *dev)
-{
-    IB700State *s = DO_UPCAST(IB700State, dev.qdev, dev);
-
-    ib700_debug("watchdog reset\n");
-
-    qemu_del_timer(s->timer);
-}
-
-static WatchdogTimerModel model = {
-    .wdt_name = "ib700",
-    .wdt_description = "iBASE 700",
-};
-
-static void wdt_ib700_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-    ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
-    ic->init = wdt_ib700_init;
-    dc->reset = wdt_ib700_reset;
-    dc->vmsd = &vmstate_ib700;
-}
-
-static const TypeInfo wdt_ib700_info = {
-    .name          = "ib700",
-    .parent        = TYPE_ISA_DEVICE,
-    .instance_size = sizeof(IB700State),
-    .class_init    = wdt_ib700_class_init,
-};
-
-static void wdt_ib700_register_types(void)
-{
-    watchdog_add_model(&model);
-    type_register_static(&wdt_ib700_info);
-}
-
-type_init(wdt_ib700_register_types)