qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] devfn number for network PCI cards


From: Aurelien Jarno
Subject: [Qemu-devel] [PATCH] devfn number for network PCI cards
Date: Tue, 9 Jan 2007 16:42:59 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

This patch adds a way to specify a devfn number for the network PCI 
cards, as the Malta platform rely on this number to setup the IRQ.
Passing the value -1 makes the devfn automatically assigned, as 
before.

diff -Nurd qemu/hw/ne2000.c qemu/hw/ne2000.c
--- qemu/hw/ne2000.c    2006-12-07 19:28:42.000000000 +0100
+++ qemu/hw/ne2000.c    2006-12-26 12:31:58.000000000 +0100
@@ -781,7 +781,7 @@
     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 @@
     
     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 -Nurd qemu/hw/pc.c qemu/hw/pc.c
--- qemu/hw/pc.c        2006-12-22 17:34:12.000000000 +0100
+++ qemu/hw/pc.c        2006-12-26 15:28:42.000000000 +0100
@@ -651,7 +651,7 @@
         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 -Nurd qemu/hw/pci.c qemu/hw/pci.c
--- qemu/hw/pci.c       2006-12-11 00:20:45.000000000 +0100
+++ qemu/hw/pci.c       2006-12-26 12:31:58.000000000 +0100
@@ -544,14 +544,14 @@
 }
 
 /* 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 -Nurd qemu/hw/pcnet.c qemu/hw/pcnet.c
--- qemu/hw/pcnet.c     2006-09-03 21:48:17.000000000 +0200
+++ qemu/hw/pcnet.c     2006-12-26 12:31:58.000000000 +0100
@@ -1889,7 +1889,7 @@
     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 @@
 #endif
 
     d = (PCNetState *)pci_register_device(bus, "PCNet", sizeof(PCNetState),
-                                          -1, NULL, NULL);
+                                          devfn, NULL, NULL);
                                           
     pci_conf = d->dev.config;
     
diff -Nurd qemu/hw/ppc_chrp.c qemu/hw/ppc_chrp.c
--- qemu/hw/ppc_chrp.c  2006-09-18 03:15:29.000000000 +0200
+++ qemu/hw/ppc_chrp.c  2006-12-26 12:31:58.000000000 +0100
@@ -436,7 +436,7 @@
         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 @@
         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 -Nurd qemu/hw/realview.c qemu/hw/realview.c
--- qemu/hw/realview.c  2006-09-23 19:40:58.000000000 +0200
+++ qemu/hw/realview.c  2006-12-26 12:31:58.000000000 +0100
@@ -71,7 +71,7 @@
         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 -Nurd qemu/hw/rtl8139.c qemu/hw/rtl8139.c
--- qemu/hw/rtl8139.c   2006-08-17 12:46:34.000000000 +0200
+++ qemu/hw/rtl8139.c   2006-12-26 12:31:58.000000000 +0100
@@ -3409,7 +3409,7 @@
 }
 #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 @@
     
     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 -Nurd qemu/hw/sun4u.c qemu/hw/sun4u.c
--- qemu/hw/sun4u.c     2006-06-18 21:41:28.000000000 +0200
+++ qemu/hw/sun4u.c     2006-12-26 12:31:58.000000000 +0100
@@ -344,7 +344,7 @@
     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 -Nurd qemu/hw/versatilepb.c qemu/hw/versatilepb.c
--- qemu/hw/versatilepb.c       2006-09-23 19:40:58.000000000 +0200
+++ qemu/hw/versatilepb.c       2006-12-26 12:31:58.000000000 +0100
@@ -188,7 +188,7 @@
         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 -Nurd qemu/vl.h qemu/vl.h
--- qemu/vl.h   2006-12-24 18:12:43.000000000 +0100
+++ qemu/vl.h   2006-12-26 12:31:58.000000000 +0100
@@ -762,7 +762,7 @@
 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);
@@ -925,15 +925,15 @@
 /* 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);
 


-- 
  .''`.  Aurelien Jarno             | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   address@hidden         | address@hidden
   `-    people.debian.org/~aurel32 | www.aurel32.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]