diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2009-10-24 19:22:56 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-10-24 19:22:56 +0000 |
commit | 285e468d649e5349e066c7a387a6956f2571e1ea (patch) | |
tree | 98267ff89042c765535221b2787594699a490a11 /hw/m48t59.c | |
parent | 0e0bfeea68e44a575708090bc6c6281c44c37425 (diff) |
m48t59: convert to vmstate reset
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/m48t59.c')
-rw-r--r-- | hw/m48t59.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/hw/m48t59.c b/hw/m48t59.c index d5a91aa5d1..bb58419d2a 100644 --- a/hw/m48t59.c +++ b/hw/m48t59.c @@ -618,10 +618,8 @@ static int m48t59_load(QEMUFile *f, void *opaque, int version_id) return 0; } -static void m48t59_reset(void *opaque) +static void m48t59_reset_common(m48t59_t *NVRAM) { - m48t59_t *NVRAM = opaque; - NVRAM->addr = 0; NVRAM->lock = 0; if (NVRAM->alrm_timer != NULL) @@ -631,6 +629,22 @@ static void m48t59_reset(void *opaque) qemu_del_timer(NVRAM->wd_timer); } +static void m48t59_reset_isa(DeviceState *d) +{ + M48t59ISAState *isa = container_of(d, M48t59ISAState, busdev.qdev); + m48t59_t *NVRAM = &isa->state; + + m48t59_reset_common(NVRAM); +} + +static void m48t59_reset_sysbus(DeviceState *d) +{ + M48t59SysBusState *sys = container_of(d, M48t59SysBusState, busdev.qdev); + m48t59_t *NVRAM = &sys->state; + + m48t59_reset_common(NVRAM); +} + /* Initialisation routine */ m48t59_t *m48t59_init (qemu_irq IRQ, target_phys_addr_t mem_base, uint32_t io_base, uint16_t size, @@ -691,7 +705,6 @@ static void m48t59_init_common(m48t59_t *s) } qemu_get_timedate(&s->alarm, 0); - qemu_register_reset(m48t59_reset, s); register_savevm("m48t59", -1, 1, m48t59_save, m48t59_load, s); } @@ -725,6 +738,7 @@ static ISADeviceInfo m48t59_isa_info = { .init = m48t59_init_isa1, .qdev.name = "m48t59_isa", .qdev.size = sizeof(M48t59ISAState), + .qdev.reset = m48t59_reset_isa, .qdev.no_user = 1, .qdev.props = (Property[]) { DEFINE_PROP_UINT32("size", M48t59ISAState, state.size, -1), @@ -738,6 +752,7 @@ static SysBusDeviceInfo m48t59_info = { .init = m48t59_init1, .qdev.name = "m48t59", .qdev.size = sizeof(M48t59SysBusState), + .qdev.reset = m48t59_reset_sysbus, .qdev.props = (Property[]) { DEFINE_PROP_UINT32("size", M48t59SysBusState, state.size, -1), DEFINE_PROP_UINT32("type", M48t59SysBusState, state.type, -1), |