mirror of https://gitlab.com/qemu-project/qemu
hw/net/lan9118: 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 preseve the existing behaviour for now. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
cd53991de4
commit
f138ed5e00
|
@ -113,8 +113,8 @@ static void kzm_init(MachineState *machine)
|
||||||
alias_offset += ram[i].size;
|
alias_offset += ram[i].size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nd_table[0].used) {
|
if (qemu_find_nic_info("lan9118", true, NULL)) {
|
||||||
lan9118_init(&nd_table[0], KZM_LAN9118_ADDR,
|
lan9118_init(KZM_LAN9118_ADDR,
|
||||||
qdev_get_gpio_in(DEVICE(&s->soc.avic), 52));
|
qdev_get_gpio_in(DEVICE(&s->soc.avic), 52));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -456,7 +456,7 @@ static void mps2_common_init(MachineState *machine)
|
||||||
/* In hardware this is a LAN9220; the LAN9118 is software compatible
|
/* In hardware this is a LAN9220; the LAN9118 is software compatible
|
||||||
* except that it doesn't support the checksum-offload feature.
|
* except that it doesn't support the checksum-offload feature.
|
||||||
*/
|
*/
|
||||||
lan9118_init(&nd_table[0], mmc->ethernet_base,
|
lan9118_init(mmc->ethernet_base,
|
||||||
qdev_get_gpio_in(armv7m,
|
qdev_get_gpio_in(armv7m,
|
||||||
mmc->fpga_type == FPGA_AN511 ? 47 : 13));
|
mmc->fpga_type == FPGA_AN511 ? 47 : 13));
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,6 @@ static void realview_init(MachineState *machine,
|
||||||
SysBusDevice *busdev;
|
SysBusDevice *busdev;
|
||||||
qemu_irq pic[64];
|
qemu_irq pic[64];
|
||||||
PCIBus *pci_bus = NULL;
|
PCIBus *pci_bus = NULL;
|
||||||
NICInfo *nd;
|
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
I2CBus *i2c;
|
I2CBus *i2c;
|
||||||
int n;
|
int n;
|
||||||
|
@ -296,10 +295,9 @@ static void realview_init(MachineState *machine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nd = qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL);
|
if (qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL)) {
|
||||||
if (nd) {
|
|
||||||
if (is_pb) {
|
if (is_pb) {
|
||||||
lan9118_init(nd, 0x4e000000, pic[28]);
|
lan9118_init(0x4e000000, pic[28]);
|
||||||
} else {
|
} else {
|
||||||
smc91c111_init(0x4e000000, pic[28]);
|
smc91c111_init(0x4e000000, pic[28]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -679,8 +679,8 @@ static void vexpress_common_init(MachineState *machine)
|
||||||
memory_region_add_subregion(sysmem, map[VE_VIDEORAM], &vms->vram);
|
memory_region_add_subregion(sysmem, map[VE_VIDEORAM], &vms->vram);
|
||||||
|
|
||||||
/* 0x4e000000 LAN9118 Ethernet */
|
/* 0x4e000000 LAN9118 Ethernet */
|
||||||
if (nd_table[0].used) {
|
if (qemu_find_nic_info("lan9118", true, NULL)) {
|
||||||
lan9118_init(&nd_table[0], map[VE_ETHERNET], pic[15]);
|
lan9118_init(map[VE_ETHERNET], pic[15]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VE_USB: not modelled */
|
/* VE_USB: not modelled */
|
||||||
|
|
|
@ -1408,14 +1408,13 @@ static void lan9118_register_types(void)
|
||||||
|
|
||||||
/* Legacy helper function. Should go away when machine config files are
|
/* Legacy helper function. Should go away when machine config files are
|
||||||
implemented. */
|
implemented. */
|
||||||
void lan9118_init(NICInfo *nd, uint32_t base, qemu_irq irq)
|
void lan9118_init(uint32_t base, qemu_irq irq)
|
||||||
{
|
{
|
||||||
DeviceState *dev;
|
DeviceState *dev;
|
||||||
SysBusDevice *s;
|
SysBusDevice *s;
|
||||||
|
|
||||||
qemu_check_nic_model(nd, "lan9118");
|
|
||||||
dev = qdev_new(TYPE_LAN9118);
|
dev = qdev_new(TYPE_LAN9118);
|
||||||
qdev_set_nic_properties(dev, nd);
|
qemu_configure_nic_device(dev, true, NULL);
|
||||||
s = SYS_BUS_DEVICE(dev);
|
s = SYS_BUS_DEVICE(dev);
|
||||||
sysbus_realize_and_unref(s, &error_fatal);
|
sysbus_realize_and_unref(s, &error_fatal);
|
||||||
sysbus_mmio_map(s, 0, base);
|
sysbus_mmio_map(s, 0, base);
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
|
|
||||||
#define TYPE_LAN9118 "lan9118"
|
#define TYPE_LAN9118 "lan9118"
|
||||||
|
|
||||||
void lan9118_init(NICInfo *, uint32_t, qemu_irq);
|
void lan9118_init(uint32_t, qemu_irq);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue