aboutsummaryrefslogtreecommitdiff
path: root/vl.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 /vl.c
parent9d472d51ea26af6f3006e50a9b5088efcb95e7ce (diff)
downloadqemu-09aaa1602f9381c0e0fb539390b1793e51bdfc7b.zip
qemu-09aaa1602f9381c0e0fb539390b1793e51bdfc7b.tar.gz
qemu-09aaa1602f9381c0e0fb539390b1793e51bdfc7b.tar.bz2
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 'vl.c')
-rw-r--r--vl.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/vl.c b/vl.c
index e3412df..10d0c52 100644
--- a/vl.c
+++ b/vl.c
@@ -233,6 +233,7 @@ uint8_t irq0override = 1;
#ifndef _WIN32
int daemonize = 0;
#endif
+const char *watchdog;
const char *option_rom[MAX_OPTION_ROMS];
int nb_option_roms;
int semihosting_enabled = 0;
@@ -4948,8 +4949,6 @@ int main(int argc, char **argv, char **envp)
tb_size = 0;
autostart= 1;
- register_watchdogs();
-
optind = 1;
for(;;) {
if (optind >= argc)
@@ -5361,9 +5360,12 @@ int main(int argc, char **argv, char **envp)
serial_device_index++;
break;
case QEMU_OPTION_watchdog:
- i = select_watchdog(optarg);
- if (i > 0)
- exit (i == 1 ? 1 : 0);
+ if (watchdog) {
+ fprintf(stderr,
+ "qemu: only one watchdog option may be given\n");
+ return 1;
+ }
+ watchdog = optarg;
break;
case QEMU_OPTION_watchdog_action:
if (select_watchdog_action(optarg) == -1) {
@@ -5927,6 +5929,12 @@ int main(int argc, char **argv, char **envp)
module_call_init(MODULE_INIT_DEVICE);
+ if (watchdog) {
+ i = select_watchdog(watchdog);
+ if (i > 0)
+ exit (i == 1 ? 1 : 0);
+ }
+
if (machine->compat_props) {
qdev_prop_register_compat(machine->compat_props);
}