diff options
author | Markus Armbruster <armbru@redhat.com> | 2009-08-21 10:31:34 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-08-27 20:35:24 -0500 |
commit | 09aaa1602f9381c0e0fb539390b1793e51bdfc7b (patch) | |
tree | abb82ec81e3f501e46d1104ab8e1af8fdfecd58e /hw/wdt_ib700.c | |
parent | 9d472d51ea26af6f3006e50a9b5088efcb95e7ce (diff) |
qdev: convert watchdogs
-watchdog NAME is now equivalent to -device NAME, except it treats
option argument '?' specially, and supports only one watchdog.
A side effect is that a device created with -watchdog may now receive
a different PCI address.
i6300esb is now available on any machine with a PCI bus, not just PCs.
ib700 is still PC only, but that could be changed easily.
The only remaining use of struct WatchdogTimerModel and
watchdog_add_model() is supporting '-watchdog ?'. Should be replaced
by searching device_info_list for watchdog devices when we can
identify them there.
Also fixes ib700 not to use vm_clock before it is initialized: in
wdt_ib700_init(), called from register_watchdogs(), which runs before
init_timers(). The bug made ib700_write_enable_reg() crash in
qemu_del_timer().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/wdt_ib700.c')
-rw-r--r-- | hw/wdt_ib700.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c index 7b54bde708..5fc3d83e0d 100644 --- a/hw/wdt_ib700.c +++ b/hw/wdt_ib700.c @@ -88,11 +88,10 @@ static int ib700_load(QEMUFile *f, void *vp, int version) return 0; } -/* Create and initialize a virtual IB700 during PC creation. */ -static void ib700_pc_init(PCIBus *unused) +static void wdt_ib700_init(ISADevice *dev) { + timer = qemu_new_timer(vm_clock, ib700_timer_expired, NULL); register_savevm("ib700_wdt", -1, 0, ib700_save, ib700_load, NULL); - register_ioport_write(0x441, 2, 1, ib700_write_disable_reg, NULL); register_ioport_write(0x443, 2, 1, ib700_write_enable_reg, NULL); } @@ -100,11 +99,18 @@ static void ib700_pc_init(PCIBus *unused) static WatchdogTimerModel model = { .wdt_name = "ib700", .wdt_description = "iBASE 700", - .wdt_pc_init = ib700_pc_init, }; -void wdt_ib700_init(void) +static ISADeviceInfo wdt_ib700_info = { + .qdev.name = "ib700", + .qdev.size = sizeof(ISADevice), + .init = wdt_ib700_init, +}; + +static void wdt_ib700_register_devices(void) { watchdog_add_model(&model); - timer = qemu_new_timer(vm_clock, ib700_timer_expired, NULL); + isa_qdev_register(&wdt_ib700_info); } + +device_init(wdt_ib700_register_devices); |