diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-08-17 10:46:34 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-08-17 10:46:34 +0000 |
commit | 1941d19c657a8084603e88d7860786baa40c0e80 (patch) | |
tree | e40f3b80ebfe96c335e594678218ae8b0eb726bc /hw/ne2000.c | |
parent | 89b6b508929d63b2a3dda18692fcb724afb43336 (diff) |
PCI save/restore changes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2115 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ne2000.c')
-rw-r--r-- | hw/ne2000.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/hw/ne2000.c b/hw/ne2000.c index e23c6df069..14d48ee95b 100644 --- a/hw/ne2000.c +++ b/hw/ne2000.c @@ -648,6 +648,9 @@ static void ne2000_save(QEMUFile* f,void* opaque) { NE2000State* s=(NE2000State*)opaque; + if (s->pci_dev) + pci_device_save(s->pci_dev, f); + qemu_put_8s(f, &s->rxcr); qemu_put_8s(f, &s->cmd); @@ -673,13 +676,21 @@ static void ne2000_save(QEMUFile* f,void* opaque) static int ne2000_load(QEMUFile* f,void* opaque,int version_id) { NE2000State* s=(NE2000State*)opaque; + int ret; + + if (version_id > 3) + return -EINVAL; + + if (s->pci_dev && version_id >= 3) { + ret = pci_device_load(s->pci_dev, f); + if (ret < 0) + return ret; + } - if (version_id == 2) { + if (version_id >= 2) { qemu_get_8s(f, &s->rxcr); - } else if (version_id == 1) { - s->rxcr = 0x0c; } else { - return -EINVAL; + s->rxcr = 0x0c; } qemu_get_8s(f, &s->cmd); @@ -810,7 +821,5 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd) s->macaddr[5]); /* XXX: instance number ? */ - register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s); - register_savevm("ne2000_pci", 0, 1, generic_pci_save, generic_pci_load, - &d->dev); + register_savevm("ne2000", 0, 3, ne2000_save, ne2000_load, s); } |