diff options
| author | David Woodhouse <dwmw@amazon.co.uk> | 2023-10-23 09:37:35 +0100 |
|---|---|---|
| committer | David Woodhouse <dwmw@amazon.co.uk> | 2024-02-02 16:23:47 +0000 |
| commit | cd53991de40a90399a8b56f0ad7b9320442ea5bb (patch) | |
| tree | dc3c2f27d3a2b85da77ce357999b8fa086328b82 /hw/arm/realview.c | |
| parent | 8cef839c2d2f3fc2430570fd040104e3ed61dcf8 (diff) | |
| download | focaccia-qemu-cd53991de40a90399a8b56f0ad7b9320442ea5bb.tar.gz focaccia-qemu-cd53991de40a90399a8b56f0ad7b9320442ea5bb.zip | |
hw/net/smc91c111: use qemu_configure_nic_device()
Some callers instantiate the device unconditionally, others will do so only if there is a NICInfo to go with it. This appears to be fairly random, but preserve the existing behaviour of each caller for now. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'hw/arm/realview.c')
| -rw-r--r-- | hw/arm/realview.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 566deff9ce..c6bd6e5961 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -90,7 +90,6 @@ static void realview_init(MachineState *machine, I2CBus *i2c; int n; unsigned int smp_cpus = machine->smp.cpus; - int done_nic = 0; qemu_irq cpu_irq[4]; int is_mpcore = 0; int is_pb = 0; @@ -296,24 +295,20 @@ static void realview_init(MachineState *machine, n--; } } - for(n = 0; n < nb_nics; n++) { - nd = &nd_table[n]; - - if (!done_nic && (!nd->model || - strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0)) { - if (is_pb) { - lan9118_init(nd, 0x4e000000, pic[28]); - } else { - smc91c111_init(nd, 0x4e000000, pic[28]); - } - done_nic = 1; + + nd = qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL); + if (nd) { + if (is_pb) { + lan9118_init(nd, 0x4e000000, pic[28]); } else { - if (pci_bus) { - pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL); - } + smc91c111_init(0x4e000000, pic[28]); } } + if (pci_bus) { + pci_init_nic_devices(pci_bus, "rtl8139"); + } + dev = sysbus_create_simple(TYPE_ARM_SBCON_I2C, 0x10002000, NULL); i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "ds1338", 0x68); |