Commit abcebc7e803f243ef244e06349a4b911daa738f4
1 parent
f1587550
Devfn number for network PCI cards, by Aurelien Jarno.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2314 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
10 changed files
with
20 additions
and
20 deletions
hw/ne2000.c
... | ... | @@ -781,7 +781,7 @@ static void ne2000_map(PCIDevice *pci_dev, int region_num, |
781 | 781 | register_ioport_read(addr + 0x1f, 1, 1, ne2000_reset_ioport_read, s); |
782 | 782 | } |
783 | 783 | |
784 | -void pci_ne2000_init(PCIBus *bus, NICInfo *nd) | |
784 | +void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | |
785 | 785 | { |
786 | 786 | PCINE2000State *d; |
787 | 787 | NE2000State *s; |
... | ... | @@ -789,7 +789,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd) |
789 | 789 | |
790 | 790 | d = (PCINE2000State *)pci_register_device(bus, |
791 | 791 | "NE2000", sizeof(PCINE2000State), |
792 | - -1, | |
792 | + devfn, | |
793 | 793 | NULL, NULL); |
794 | 794 | pci_conf = d->dev.config; |
795 | 795 | pci_conf[0x00] = 0xec; // Realtek 8029 | ... | ... |
hw/pc.c
... | ... | @@ -668,7 +668,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, |
668 | 668 | if (strcmp(nd->model, "ne2k_isa") == 0) { |
669 | 669 | pc_init_ne2k_isa(nd); |
670 | 670 | } else if (pci_enabled) { |
671 | - pci_nic_init(pci_bus, nd); | |
671 | + pci_nic_init(pci_bus, nd, -1); | |
672 | 672 | } else { |
673 | 673 | fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model); |
674 | 674 | exit(1); | ... | ... |
hw/pci.c
... | ... | @@ -544,14 +544,14 @@ void pci_info(void) |
544 | 544 | } |
545 | 545 | |
546 | 546 | /* Initialize a PCI NIC. */ |
547 | -void pci_nic_init(PCIBus *bus, NICInfo *nd) | |
547 | +void pci_nic_init(PCIBus *bus, NICInfo *nd, int devfn) | |
548 | 548 | { |
549 | 549 | if (strcmp(nd->model, "ne2k_pci") == 0) { |
550 | - pci_ne2000_init(bus, nd); | |
550 | + pci_ne2000_init(bus, nd, devfn); | |
551 | 551 | } else if (strcmp(nd->model, "rtl8139") == 0) { |
552 | - pci_rtl8139_init(bus, nd); | |
552 | + pci_rtl8139_init(bus, nd, devfn); | |
553 | 553 | } else if (strcmp(nd->model, "pcnet") == 0) { |
554 | - pci_pcnet_init(bus, nd); | |
554 | + pci_pcnet_init(bus, nd, devfn); | |
555 | 555 | } else { |
556 | 556 | fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model); |
557 | 557 | exit (1); | ... | ... |
hw/pcnet.c
... | ... | @@ -1889,7 +1889,7 @@ static void pci_physical_memory_read(void *dma_opaque, target_phys_addr_t addr, |
1889 | 1889 | cpu_physical_memory_read(addr, buf, len); |
1890 | 1890 | } |
1891 | 1891 | |
1892 | -void pci_pcnet_init(PCIBus *bus, NICInfo *nd) | |
1892 | +void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn) | |
1893 | 1893 | { |
1894 | 1894 | PCNetState *d; |
1895 | 1895 | uint8_t *pci_conf; |
... | ... | @@ -1900,7 +1900,7 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd) |
1900 | 1900 | #endif |
1901 | 1901 | |
1902 | 1902 | d = (PCNetState *)pci_register_device(bus, "PCNet", sizeof(PCNetState), |
1903 | - -1, NULL, NULL); | |
1903 | + devfn, NULL, NULL); | |
1904 | 1904 | |
1905 | 1905 | pci_conf = d->dev.config; |
1906 | 1906 | ... | ... |
hw/ppc_chrp.c
... | ... | @@ -436,7 +436,7 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device, |
436 | 436 | for(i = 0; i < nb_nics; i++) { |
437 | 437 | if (!nd_table[i].model) |
438 | 438 | nd_table[i].model = "ne2k_pci"; |
439 | - pci_nic_init(pci_bus, &nd_table[i]); | |
439 | + pci_nic_init(pci_bus, &nd_table[i], -1); | |
440 | 440 | } |
441 | 441 | |
442 | 442 | 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, |
483 | 483 | serial_init(&pic_set_irq_new, isa_pic, 0x3f8, 4, serial_hds[0]); |
484 | 484 | |
485 | 485 | for(i = 0; i < nb_nics; i++) { |
486 | - pci_ne2000_init(pci_bus, &nd_table[i]); | |
486 | + pci_ne2000_init(pci_bus, &nd_table[i], -1); | |
487 | 487 | } |
488 | 488 | |
489 | 489 | #if 1 | ... | ... |
hw/realview.c
... | ... | @@ -71,7 +71,7 @@ static void realview_init(int ram_size, int vga_ram_size, int boot_device, |
71 | 71 | if (strcmp(nd->model, "smc91c111") == 0) { |
72 | 72 | smc91c111_init(nd, 0x4e000000, pic, 28); |
73 | 73 | } else { |
74 | - pci_nic_init(pci_bus, nd); | |
74 | + pci_nic_init(pci_bus, nd, -1); | |
75 | 75 | } |
76 | 76 | } |
77 | 77 | ... | ... |
hw/rtl8139.c
... | ... | @@ -3409,7 +3409,7 @@ static void rtl8139_timer(void *opaque) |
3409 | 3409 | } |
3410 | 3410 | #endif /* RTL8139_ONBOARD_TIMER */ |
3411 | 3411 | |
3412 | -void pci_rtl8139_init(PCIBus *bus, NICInfo *nd) | |
3412 | +void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) | |
3413 | 3413 | { |
3414 | 3414 | PCIRTL8139State *d; |
3415 | 3415 | RTL8139State *s; |
... | ... | @@ -3417,7 +3417,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd) |
3417 | 3417 | |
3418 | 3418 | d = (PCIRTL8139State *)pci_register_device(bus, |
3419 | 3419 | "RTL8139", sizeof(PCIRTL8139State), |
3420 | - -1, | |
3420 | + devfn, | |
3421 | 3421 | NULL, NULL); |
3422 | 3422 | pci_conf = d->dev.config; |
3423 | 3423 | pci_conf[0x00] = 0xec; /* Realtek 8139 */ | ... | ... |
hw/sun4u.c
... | ... | @@ -344,7 +344,7 @@ static void sun4u_init(int ram_size, int vga_ram_size, int boot_device, |
344 | 344 | for(i = 0; i < nb_nics; i++) { |
345 | 345 | if (!nd_table[i].model) |
346 | 346 | nd_table[i].model = "ne2k_pci"; |
347 | - pci_nic_init(pci_bus, &nd_table[i]); | |
347 | + pci_nic_init(pci_bus, &nd_table[i], -1); | |
348 | 348 | } |
349 | 349 | |
350 | 350 | pci_cmd646_ide_init(pci_bus, bs_table, 1); | ... | ... |
hw/versatilepb.c
... | ... | @@ -188,7 +188,7 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device, |
188 | 188 | if (strcmp(nd->model, "smc91c111") == 0) { |
189 | 189 | smc91c111_init(nd, 0x10010000, sic, 25); |
190 | 190 | } else { |
191 | - pci_nic_init(pci_bus, nd); | |
191 | + pci_nic_init(pci_bus, nd, -1); | |
192 | 192 | } |
193 | 193 | } |
194 | 194 | if (usb_enabled) { | ... | ... |
vl.h
... | ... | @@ -793,7 +793,7 @@ typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num); |
793 | 793 | PCIBus *pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, |
794 | 794 | void *pic, int devfn_min, int nirq); |
795 | 795 | |
796 | -void pci_nic_init(PCIBus *bus, NICInfo *nd); | |
796 | +void pci_nic_init(PCIBus *bus, NICInfo *nd, int devfn); | |
797 | 797 | void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len); |
798 | 798 | uint32_t pci_data_read(void *opaque, uint32_t addr, int len); |
799 | 799 | int pci_bus_num(PCIBus *s); |
... | ... | @@ -956,15 +956,15 @@ int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num); |
956 | 956 | /* ne2000.c */ |
957 | 957 | |
958 | 958 | void isa_ne2000_init(int base, int irq, NICInfo *nd); |
959 | -void pci_ne2000_init(PCIBus *bus, NICInfo *nd); | |
959 | +void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn); | |
960 | 960 | |
961 | 961 | /* rtl8139.c */ |
962 | 962 | |
963 | -void pci_rtl8139_init(PCIBus *bus, NICInfo *nd); | |
963 | +void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn); | |
964 | 964 | |
965 | 965 | /* pcnet.c */ |
966 | 966 | |
967 | -void pci_pcnet_init(PCIBus *bus, NICInfo *nd); | |
967 | +void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn); | |
968 | 968 | void pcnet_h_reset(void *opaque); |
969 | 969 | void *lance_init(NICInfo *nd, uint32_t leaddr, void *dma_opaque); |
970 | 970 | ... | ... |