diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index ea116fce71..45e2cdb9a5 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -235,7 +235,6 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev) vmstate_register(0, &vmstate_ide_pci, d); qemu_register_reset(cmd646_reset, d); - cmd646_reset(d); return 0; } diff --git a/hw/parallel.c b/hw/parallel.c index 79fa8f66b4..5ae8348da0 100644 --- a/hw/parallel.c +++ b/hw/parallel.c @@ -471,7 +471,6 @@ static int parallel_isa_initfn(ISADevice *dev) base = isa->iobase; isa_init_irq(dev, &s->irq, isa->isairq); - parallel_reset(s); qemu_register_reset(parallel_reset, s); if (qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_READ_STATUS, &dummy) == 0) { @@ -576,7 +575,6 @@ ParallelState *parallel_mm_init(target_phys_addr_t base, int it_shift, qemu_irq s->irq = irq; s->chr = chr; s->it_shift = it_shift; - parallel_reset(s); qemu_register_reset(parallel_reset, s); io_sw = cpu_register_io_memory(parallel_mm_read_sw, parallel_mm_write_sw, s); diff --git a/hw/pckbd.c b/hw/pckbd.c index c049047aea..a81b303dae 100644 --- a/hw/pckbd.c +++ b/hw/pckbd.c @@ -397,7 +397,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->irq_mouse = mouse_irq; s->mask = mask; - kbd_reset(s); vmstate_register(0, &vmstate_kbd, s); s_io_memory = cpu_register_io_memory(kbd_mm_read, kbd_mm_write, s); cpu_register_physical_memory(base, size, s_io_memory); @@ -422,7 +421,6 @@ static int i8042_initfn(ISADevice *dev) isa_init_irq(dev, &s->irq_kbd, 1); isa_init_irq(dev, &s->irq_mouse, 12); - kbd_reset(s); vmstate_register(0, &vmstate_kbd, s); register_ioport_read(0x60, 1, 1, kbd_read_data, s); register_ioport_write(0x60, 1, 1, kbd_write_data, s); diff --git a/hw/ps2.c b/hw/ps2.c index 0644e01c49..15a6650a6a 100644 --- a/hw/ps2.c +++ b/hw/ps2.c @@ -593,7 +593,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) s->common.update_irq = update_irq; s->common.update_arg = update_arg; s->scancode_set = 2; - ps2_kbd_reset(s); vmstate_register(0, &vmstate_ps2_keyboard, s); qemu_add_kbd_event_handler(ps2_put_keycode, s); qemu_register_reset(ps2_kbd_reset, s); @@ -606,7 +605,6 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) s->common.update_irq = update_irq; s->common.update_arg = update_arg; - ps2_mouse_reset(s); vmstate_register(0, &vmstate_ps2_mouse, s); qemu_add_mouse_event_handler(ps2_mouse_event, s, 0, "QEMU PS/2 Mouse"); qemu_register_reset(ps2_mouse_reset, s); diff --git a/hw/sun4u.c b/hw/sun4u.c index 0c7cea67d9..8f11442f08 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -268,13 +268,14 @@ static void cpu_set_irq(void *opaque, int irq, int level) typedef struct ResetData { CPUState *env; - uint64_t reset_addr; + uint64_t prom_addr; } ResetData; static void main_cpu_reset(void *opaque) { ResetData *s = (ResetData *)opaque; CPUState *env = s->env; + static unsigned int nr_resets; cpu_reset(env); env->tick_cmpr = TICK_INT_DIS | 0; @@ -289,7 +290,12 @@ static void main_cpu_reset(void *opaque) env->gregs[1] = 0; // Memory start env->gregs[2] = ram_size; // Memory size env->gregs[3] = 0; // Machine description XXX - env->pc = s->reset_addr; + if (nr_resets++ == 0) { + /* Power on reset */ + env->pc = s->prom_addr + 0x20ULL; + } else { + env->pc = s->prom_addr + 0x40ULL; + } env->npc = env->pc + 4; } @@ -544,12 +550,8 @@ static CPUState *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef) reset_info = qemu_mallocz(sizeof(ResetData)); reset_info->env = env; - reset_info->reset_addr = hwdef->prom_addr + 0x40ULL; + reset_info->prom_addr = hwdef->prom_addr; qemu_register_reset(main_cpu_reset, reset_info); - main_cpu_reset(reset_info); - // Override warm reset address with cold start address - env->pc = hwdef->prom_addr + 0x20ULL; - env->npc = env->pc + 4; return env; }