Sparc64/x86: remove unneeded calls to device reset

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Blue Swirl 2009-11-07 10:05:03 +00:00
parent e43941318d
commit 44a9935465
5 changed files with 9 additions and 14 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}