diff --git a/hw/ne2000.c b/hw/ne2000.c index 94700c17b9..a045a20430 100644 --- a/hw/ne2000.c +++ b/hw/ne2000.c @@ -781,7 +781,7 @@ static void ne2000_map(PCIDevice *pci_dev, int region_num, register_ioport_read(addr + 0x1f, 1, 1, ne2000_reset_ioport_read, s); } -void pci_ne2000_init(PCIBus *bus, NICInfo *nd) +void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) { PCINE2000State *d; NE2000State *s; @@ -789,7 +789,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd) d = (PCINE2000State *)pci_register_device(bus, "NE2000", sizeof(PCINE2000State), - -1, + devfn, NULL, NULL); pci_conf = d->dev.config; pci_conf[0x00] = 0xec; // Realtek 8029 diff --git a/hw/pc.c b/hw/pc.c index 1c141ae6af..408a9fb247 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -668,7 +668,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, if (strcmp(nd->model, "ne2k_isa") == 0) { pc_init_ne2k_isa(nd); } else if (pci_enabled) { - pci_nic_init(pci_bus, nd); + pci_nic_init(pci_bus, nd, -1); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model); exit(1); diff --git a/hw/pci.c b/hw/pci.c index d8fcd7be55..b895f98a09 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -544,14 +544,14 @@ void pci_info(void) } /* Initialize a PCI NIC. */ -void pci_nic_init(PCIBus *bus, NICInfo *nd) +void pci_nic_init(PCIBus *bus, NICInfo *nd, int devfn) { if (strcmp(nd->model, "ne2k_pci") == 0) { - pci_ne2000_init(bus, nd); + pci_ne2000_init(bus, nd, devfn); } else if (strcmp(nd->model, "rtl8139") == 0) { - pci_rtl8139_init(bus, nd); + pci_rtl8139_init(bus, nd, devfn); } else if (strcmp(nd->model, "pcnet") == 0) { - pci_pcnet_init(bus, nd); + pci_pcnet_init(bus, nd, devfn); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model); exit (1); diff --git a/hw/pcnet.c b/hw/pcnet.c index f242cd1e9a..3bdddeb38a 100644 --- a/hw/pcnet.c +++ b/hw/pcnet.c @@ -1889,7 +1889,7 @@ static void pci_physical_memory_read(void *dma_opaque, target_phys_addr_t addr, cpu_physical_memory_read(addr, buf, len); } -void pci_pcnet_init(PCIBus *bus, NICInfo *nd) +void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn) { PCNetState *d; uint8_t *pci_conf; @@ -1900,7 +1900,7 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd) #endif d = (PCNetState *)pci_register_device(bus, "PCNet", sizeof(PCNetState), - -1, NULL, NULL); + devfn, NULL, NULL); pci_conf = d->dev.config; diff --git a/hw/ppc_chrp.c b/hw/ppc_chrp.c index 7599eab915..1e0fd2e9da 100644 --- a/hw/ppc_chrp.c +++ b/hw/ppc_chrp.c @@ -436,7 +436,7 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device, for(i = 0; i < nb_nics; i++) { if (!nd_table[i].model) nd_table[i].model = "ne2k_pci"; - pci_nic_init(pci_bus, &nd_table[i]); + pci_nic_init(pci_bus, &nd_table[i], -1); } pci_cmd646_ide_init(pci_bus, &bs_table[0], 0); @@ -483,7 +483,7 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device, serial_init(&pic_set_irq_new, isa_pic, 0x3f8, 4, serial_hds[0]); for(i = 0; i < nb_nics; i++) { - pci_ne2000_init(pci_bus, &nd_table[i]); + pci_ne2000_init(pci_bus, &nd_table[i], -1); } #if 1 diff --git a/hw/realview.c b/hw/realview.c index 11b0916089..6d057cee0f 100644 --- a/hw/realview.c +++ b/hw/realview.c @@ -71,7 +71,7 @@ static void realview_init(int ram_size, int vga_ram_size, int boot_device, if (strcmp(nd->model, "smc91c111") == 0) { smc91c111_init(nd, 0x4e000000, pic, 28); } else { - pci_nic_init(pci_bus, nd); + pci_nic_init(pci_bus, nd, -1); } } diff --git a/hw/rtl8139.c b/hw/rtl8139.c index db6353a7e5..94fc2fca3b 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -3409,7 +3409,7 @@ static void rtl8139_timer(void *opaque) } #endif /* RTL8139_ONBOARD_TIMER */ -void pci_rtl8139_init(PCIBus *bus, NICInfo *nd) +void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) { PCIRTL8139State *d; RTL8139State *s; @@ -3417,7 +3417,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd) d = (PCIRTL8139State *)pci_register_device(bus, "RTL8139", sizeof(PCIRTL8139State), - -1, + devfn, NULL, NULL); pci_conf = d->dev.config; pci_conf[0x00] = 0xec; /* Realtek 8139 */ diff --git a/hw/sun4u.c b/hw/sun4u.c index 6d413691db..61069a6529 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -344,7 +344,7 @@ static void sun4u_init(int ram_size, int vga_ram_size, int boot_device, for(i = 0; i < nb_nics; i++) { if (!nd_table[i].model) nd_table[i].model = "ne2k_pci"; - pci_nic_init(pci_bus, &nd_table[i]); + pci_nic_init(pci_bus, &nd_table[i], -1); } pci_cmd646_ide_init(pci_bus, bs_table, 1); diff --git a/hw/versatilepb.c b/hw/versatilepb.c index 475cb4892c..12b73037e4 100644 --- a/hw/versatilepb.c +++ b/hw/versatilepb.c @@ -188,7 +188,7 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device, if (strcmp(nd->model, "smc91c111") == 0) { smc91c111_init(nd, 0x10010000, sic, 25); } else { - pci_nic_init(pci_bus, nd); + pci_nic_init(pci_bus, nd, -1); } } if (usb_enabled) { diff --git a/vl.h b/vl.h index ef1205cceb..8667ba8f33 100644 --- a/vl.h +++ b/vl.h @@ -793,7 +793,7 @@ typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num); PCIBus *pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, void *pic, int devfn_min, int nirq); -void pci_nic_init(PCIBus *bus, NICInfo *nd); +void pci_nic_init(PCIBus *bus, NICInfo *nd, int devfn); void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len); uint32_t pci_data_read(void *opaque, uint32_t addr, int len); int pci_bus_num(PCIBus *s); @@ -956,15 +956,15 @@ int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num); /* ne2000.c */ void isa_ne2000_init(int base, int irq, NICInfo *nd); -void pci_ne2000_init(PCIBus *bus, NICInfo *nd); +void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn); /* rtl8139.c */ -void pci_rtl8139_init(PCIBus *bus, NICInfo *nd); +void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn); /* pcnet.c */ -void pci_pcnet_init(PCIBus *bus, NICInfo *nd); +void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn); void pcnet_h_reset(void *opaque); void *lance_init(NICInfo *nd, uint32_t leaddr, void *dma_opaque);