nic: zap obsolote romloading bits from ne2k + pcnet
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 8 Feb 2012 15:02:11 +0000 (16:02 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 24 Feb 2012 19:36:05 +0000 (13:36 -0600)
These days one just needs to specify the romfile in PCiDeviceInfo and
everything magically works.  It also allows to disable pxe rom loading
via "romfile=<emptystring>" like it is possible for all other nics.

[ v2: rebased & adapted to qom changes ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/ne2000.c
hw/pcnet-pci.c

index bb84fd1f9365834fe22c0bbda19aa8323da7e1c3..71452e1f2ebca34689d20dd30671cf9655e487c1 100644 (file)
@@ -763,14 +763,6 @@ static int pci_ne2000_init(PCIDevice *pci_dev)
                           object_get_typename(OBJECT(pci_dev)), pci_dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->c.macaddr.a);
 
-    if (!pci_dev->qdev.hotplugged) {
-        static int loaded = 0;
-        if (!loaded) {
-            rom_add_option("pxe-ne2k_pci.rom", -1);
-            loaded = 1;
-        }
-    }
-
     add_boot_device_path(s->c.bootindex, &pci_dev->qdev, "/ethernet-phy@0");
 
     return 0;
@@ -798,6 +790,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data)
 
     k->init = pci_ne2000_init;
     k->exit = pci_ne2000_exit;
+    k->romfile = "pxe-ne2k_pci.rom",
     k->vendor_id = PCI_VENDOR_ID_REALTEK;
     k->device_id = PCI_DEVICE_ID_REALTEK_8029;
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
index 368260959f5858303ce9a4e7b99df7a3ba411503..34d73aaea10e15f93089425f3ae7cab0e2f63039 100644 (file)
@@ -330,14 +330,6 @@ static int pci_pcnet_init(PCIDevice *pci_dev)
     s->phys_mem_write = pci_physical_memory_write;
     s->dma_opaque = pci_dev;
 
-    if (!pci_dev->qdev.hotplugged) {
-        static int loaded = 0;
-        if (!loaded) {
-            rom_add_option("pxe-pcnet.rom", -1);
-            loaded = 1;
-        }
-    }
-
     return pcnet_common_init(&pci_dev->qdev, s, &net_pci_pcnet_info);
 }
 
@@ -360,6 +352,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data)
 
     k->init = pci_pcnet_init;
     k->exit = pci_pcnet_uninit;
+    k->romfile = "pxe-pcnet.rom",
     k->vendor_id = PCI_VENDOR_ID_AMD;
     k->device_id = PCI_DEVICE_ID_AMD_LANCE;
     k->revision = 0x10;