aboutsummaryrefslogtreecommitdiff
path: root/hw/watchdog/wdt_i6300esb.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/watchdog/wdt_i6300esb.c')
-rw-r--r--hw/watchdog/wdt_i6300esb.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index 7b59469888..8bce0509cd 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -21,11 +21,12 @@
#include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/module.h"
#include "qemu/timer.h"
#include "sysemu/watchdog.h"
-#include "hw/hw.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
+#include "migration/vmstate.h"
+#include "qom/object.h"
/*#define I6300ESB_DEBUG 1*/
@@ -101,11 +102,9 @@ struct I6300State {
*/
};
-typedef struct I6300State I6300State;
#define TYPE_WATCHDOG_I6300ESB_DEVICE "i6300esb"
-#define WATCHDOG_I6300ESB_DEVICE(obj) \
- OBJECT_CHECK(I6300State, (obj), TYPE_WATCHDOG_I6300ESB_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(I6300State, WATCHDOG_I6300ESB_DEVICE)
/* This function is called when the watchdog has either been enabled
* (hence it starts counting down) or has been keep-alived.
@@ -200,7 +199,7 @@ static void i6300esb_timer_expired(void *vp)
if (d->reboot_enabled) {
d->previous_reboot_flag = 1;
watchdog_perform_action(); /* This reboots, exits, etc */
- i6300esb_reset(&d->dev.qdev);
+ i6300esb_reset(DEVICE(d));
}
/* In "free running mode" we start stage 1 again. */
@@ -419,7 +418,7 @@ static const VMStateDescription vmstate_i6300esb = {
*/
.version_id = 10000,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_PCI_DEVICE(dev, I6300State),
VMSTATE_INT32(reboot_enabled, I6300State),
VMSTATE_INT32(clock_scale, I6300State),
@@ -449,22 +448,15 @@ static void i6300esb_realize(PCIDevice *dev, Error **errp)
memory_region_init_io(&d->io_mem, OBJECT(d), &i6300esb_ops, d,
"i6300esb", 0x10);
pci_register_bar(&d->dev, 0, 0, &d->io_mem);
- /* qemu_register_coalesced_mmio (addr, 0x10); ? */
}
static void i6300esb_exit(PCIDevice *dev)
{
I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev);
- timer_del(d->timer);
timer_free(d->timer);
}
-static WatchdogTimerModel model = {
- .wdt_name = "i6300esb",
- .wdt_description = "Intel 6300ESB",
-};
-
static void i6300esb_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -479,7 +471,8 @@ static void i6300esb_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_SYSTEM_OTHER;
dc->reset = i6300esb_reset;
dc->vmsd = &vmstate_i6300esb;
- set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+ set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
+ dc->desc = "Intel 6300ESB";
}
static const TypeInfo i6300esb_info = {
@@ -495,7 +488,6 @@ static const TypeInfo i6300esb_info = {
static void i6300esb_register_types(void)
{
- watchdog_add_model(&model);
type_register_static(&i6300esb_info);
}