summaryrefslogtreecommitdiff
path: root/hw/watchdog.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2009-08-21 10:31:34 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:35:24 -0500
commit09aaa1602f9381c0e0fb539390b1793e51bdfc7b (patch)
treeabb82ec81e3f501e46d1104ab8e1af8fdfecd58e /hw/watchdog.c
parent9d472d51ea26af6f3006e50a9b5088efcb95e7ce (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/watchdog.c')
-rw-r--r--hw/watchdog.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/hw/watchdog.c b/hw/watchdog.c
index 359c3185e..adba87253 100644
--- a/hw/watchdog.c
+++ b/hw/watchdog.c
@@ -20,6 +20,8 @@
*/
#include "qemu-common.h"
+#include "qemu-option.h"
+#include "qemu-config.h"
#include "sys-queue.h"
#include "sysemu.h"
#include "hw/watchdog.h"
@@ -32,7 +34,6 @@
#define WDT_DEBUG 5 /* Prints a message and continues running. */
#define WDT_NONE 6 /* Do nothing. */
-static WatchdogTimerModel *watchdog;
static int watchdog_action = WDT_RESET;
static LIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
@@ -49,12 +50,7 @@ void watchdog_add_model(WatchdogTimerModel *model)
int select_watchdog(const char *p)
{
WatchdogTimerModel *model;
-
- if (watchdog) {
- fprintf(stderr,
- "qemu: only one watchdog option may be given\n");
- return 1;
- }
+ QemuOpts *opts;
/* -watchdog ? lists available devices and exits cleanly. */
if (strcmp(p, "?") == 0) {
@@ -67,7 +63,9 @@ int select_watchdog(const char *p)
LIST_FOREACH(model, &watchdog_list, entry) {
if (strcasecmp(model->wdt_name, p) == 0) {
- watchdog = model;
+ /* add the device */
+ opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
+ qemu_opt_set(opts, "driver", p);
return 0;
}
}
@@ -130,15 +128,3 @@ void watchdog_perform_action(void)
break;
}
}
-
-void watchdog_pc_init(PCIBus *pci_bus)
-{
- if (watchdog)
- watchdog->wdt_pc_init(pci_bus);
-}
-
-void register_watchdogs(void)
-{
- wdt_ib700_init();
- wdt_i6300esb_init();
-}