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
This commit is contained in:
ths 2007-01-10 16:17:21 +00:00
parent f158755072
commit abcebc7e80
10 changed files with 20 additions and 20 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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);
}
}

View File

@ -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 */

View File

@ -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);

View File

@ -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) {

8
vl.h
View File

@ -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);