ia64/xen-unstable

changeset 14654:f06535a8ae9f

[HVM] Save/restore: Allow save/restore of multiple NICs
Signed-off-by: Tim Deegan <Tim.Deegan@xenource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Thu Mar 29 15:30:01 2007 +0000 (2007-03-29)
parents 8f5a947c0ea6
children 86a798a62cc5
files tools/ioemu/hw/ne2000.c tools/ioemu/hw/pcnet.c tools/ioemu/hw/rtl8139.c
line diff
     1.1 --- a/tools/ioemu/hw/ne2000.c	Thu Mar 29 15:29:15 2007 +0000
     1.2 +++ b/tools/ioemu/hw/ne2000.c	Thu Mar 29 15:30:01 2007 +0000
     1.3 @@ -770,7 +770,7 @@ void isa_ne2000_init(int base, int irq, 
     1.4               s->macaddr[4],
     1.5               s->macaddr[5]);
     1.6               
     1.7 -    register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s);
     1.8 +    register_savevm("ne2000", base, 2, ne2000_save, ne2000_load, s);
     1.9  }
    1.10  
    1.11  /***********************************************************/
    1.12 @@ -806,6 +806,7 @@ void pci_ne2000_init(PCIBus *bus, NICInf
    1.13      PCINE2000State *d;
    1.14      NE2000State *s;
    1.15      uint8_t *pci_conf;
    1.16 +    int instance;
    1.17      
    1.18      d = (PCINE2000State *)pci_register_device(bus,
    1.19                                                "NE2000", sizeof(PCINE2000State),
    1.20 @@ -840,8 +841,8 @@ void pci_ne2000_init(PCIBus *bus, NICInf
    1.21               s->macaddr[4],
    1.22               s->macaddr[5]);
    1.23               
    1.24 -    /* XXX: instance number ? */
    1.25 -    register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s);
    1.26 -    register_savevm("ne2000_pci", 0, 1, generic_pci_save, generic_pci_load, 
    1.27 -                    &d->dev);
    1.28 +    instance = pci_bus_num(bus) << 8 | s->pci_dev->devfn;
    1.29 +    register_savevm("ne2000", instance, 2, ne2000_save, ne2000_load, s);
    1.30 +    register_savevm("ne2000_pci", instance, 1, generic_pci_save, 
    1.31 +                    generic_pci_load, &d->dev);
    1.32  }
     2.1 --- a/tools/ioemu/hw/pcnet.c	Thu Mar 29 15:29:15 2007 +0000
     2.2 +++ b/tools/ioemu/hw/pcnet.c	Thu Mar 29 15:30:01 2007 +0000
     2.3 @@ -1783,6 +1783,7 @@ void pci_pcnet_init(PCIBus *bus, NICInfo
     2.4  {
     2.5      PCNetState *d;
     2.6      uint8_t *pci_conf;
     2.7 +    int instance;
     2.8  
     2.9  #if 0
    2.10      printf("sizeof(RMD)=%d, sizeof(TMD)=%d\n", 
    2.11 @@ -1828,9 +1829,10 @@ void pci_pcnet_init(PCIBus *bus, NICInfo
    2.12      d->vc = qemu_new_vlan_client(nd->vlan, pcnet_receive, 
    2.13                                   pcnet_can_receive, d);
    2.14  
    2.15 -    register_savevm("pcnet", 0, 1, pcnet_save, pcnet_load, d);
    2.16 -    register_savevm("pcnet_pci", 0, 1, generic_pci_save, generic_pci_load, 
    2.17 -                    &d->dev);
    2.18 +    instance = pci_bus_num(bus) << 8 | d->dev.devfn;
    2.19 +    register_savevm("pcnet", instance, 1, pcnet_save, pcnet_load, d);
    2.20 +    register_savevm("pcnet_pci", instance, 1, generic_pci_save,
    2.21 +                    generic_pci_load, &d->dev);
    2.22      
    2.23      snprintf(d->vc->info_str, sizeof(d->vc->info_str),
    2.24               "pcnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
     3.1 --- a/tools/ioemu/hw/rtl8139.c	Thu Mar 29 15:29:15 2007 +0000
     3.2 +++ b/tools/ioemu/hw/rtl8139.c	Thu Mar 29 15:30:01 2007 +0000
     3.3 @@ -3406,6 +3406,7 @@ void pci_rtl8139_init(PCIBus *bus, NICIn
     3.4      PCIRTL8139State *d;
     3.5      RTL8139State *s;
     3.6      uint8_t *pci_conf;
     3.7 +    int instance;
     3.8      
     3.9      d = (PCIRTL8139State *)pci_register_device(bus,
    3.10                                                "RTL8139", sizeof(PCIRTL8139State),
    3.11 @@ -3460,10 +3461,10 @@ void pci_rtl8139_init(PCIBus *bus, NICIn
    3.12      s->cplus_txbuffer_len = 0;
    3.13      s->cplus_txbuffer_offset = 0;
    3.14               
    3.15 -    /* XXX: instance number ? */
    3.16 -    register_savevm("rtl8139", 0, 2, rtl8139_save, rtl8139_load, s);
    3.17 -    register_savevm("rtl8139_pci", 0, 1, generic_pci_save, generic_pci_load, 
    3.18 -                    &d->dev);
    3.19 +    instance = pci_bus_num(bus) << 8 | s->pci_dev->devfn;
    3.20 +    register_savevm("rtl8139", instance, 2, rtl8139_save, rtl8139_load, s);
    3.21 +    register_savevm("rtl8139_pci", instance, 1, generic_pci_save, 
    3.22 +                    generic_pci_load, &d->dev);
    3.23  
    3.24  #if RTL8139_ONBOARD_TIMER
    3.25      s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s);