diff options
author | David Woodhouse <dwmw@amazon.co.uk> | 2023-10-23 09:37:39 +0100 |
---|---|---|
committer | David Woodhouse <dwmw@amazon.co.uk> | 2024-02-02 16:23:47 +0000 |
commit | 707a42e2db20e61c6bfb575e9b6c2b2fdd24a247 (patch) | |
tree | 026ce29ff54f5bfebf9537ec9a87e971d77673cf /hw | |
parent | 27c0235f72141e05bb4a815526bcdb777fa9f5bb (diff) | |
download | qemu-707a42e2db20e61c6bfb575e9b6c2b2fdd24a247.zip qemu-707a42e2db20e61c6bfb575e9b6c2b2fdd24a247.tar.gz qemu-707a42e2db20e61c6bfb575e9b6c2b2fdd24a247.tar.bz2 |
hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases
Also update the test to specify which device to attach the test socket
to, and remove the comment lamenting the fact that we can't do so.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/arm/npcm7xx.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index e3243a5..bdc609b 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -656,8 +656,9 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) /* * EMC Modules. Cannot fail. - * The mapping of the device to its netdev backend works as follows: - * emc[i] = nd_table[i] + * Use the available NIC configurations in order, allowing 'emc0' and + * 'emc1' to by used as aliases for the model= parameter to override. + * * This works around the inability to specify the netdev property for the * emc device: it's not pluggable and thus the -device option can't be * used. @@ -665,12 +666,13 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_emc_addr) != ARRAY_SIZE(s->emc)); QEMU_BUILD_BUG_ON(ARRAY_SIZE(s->emc) != 2); for (i = 0; i < ARRAY_SIZE(s->emc); i++) { - s->emc[i].emc_num = i; SysBusDevice *sbd = SYS_BUS_DEVICE(&s->emc[i]); - if (nd_table[i].used) { - qemu_check_nic_model(&nd_table[i], TYPE_NPCM7XX_EMC); - qdev_set_nic_properties(DEVICE(sbd), &nd_table[i]); - } + char alias[6]; + + s->emc[i].emc_num = i; + snprintf(alias, sizeof(alias), "emc%u", i); + qemu_configure_nic_device(DEVICE(sbd), true, alias); + /* * The device exists regardless of whether it's connected to a QEMU * netdev backend. So always instantiate it even if there is no |