[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 21/47] hw/arm/allwinner: use qemu_configure_nic_device()
From: |
David Woodhouse |
Subject: |
[PATCH v4 21/47] hw/arm/allwinner: use qemu_configure_nic_device() |
Date: |
Fri, 26 Jan 2024 17:24:58 +0000 |
From: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
hw/arm/allwinner-a10.c | 6 +-----
hw/arm/allwinner-h3.c | 6 +-----
hw/arm/allwinner-r40.c | 27 ++-------------------------
3 files changed, 4 insertions(+), 35 deletions(-)
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index b0ea3f7f66..57f52871ec 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -142,11 +142,7 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
sysbus_realize(SYS_BUS_DEVICE(&s->dramc), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 0, AW_A10_DRAMC_BASE);
- /* FIXME use qdev NIC properties instead of nd_table[] */
- if (nd_table[0].used) {
- qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC);
- qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
- }
+ qemu_configure_nic_device(DEVICE(&s->emac), true, NULL);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->emac), errp)) {
return;
}
diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c
index f05afddf7e..4f102ad082 100644
--- a/hw/arm/allwinner-h3.c
+++ b/hw/arm/allwinner-h3.c
@@ -369,11 +369,7 @@ static void allwinner_h3_realize(DeviceState *dev, Error
**errp)
"sd-bus");
/* EMAC */
- /* FIXME use qdev NIC properties instead of nd_table[] */
- if (nd_table[0].used) {
- qemu_check_nic_model(&nd_table[0], TYPE_AW_SUN8I_EMAC);
- qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
- }
+ qemu_configure_nic_device(DEVICE(&s->emac), true, NULL);
object_property_set_link(OBJECT(&s->emac), "dma-memory",
OBJECT(get_system_memory()), &error_fatal);
sysbus_realize(SYS_BUS_DEVICE(&s->emac), &error_fatal);
diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c
index a0d367c60d..4d5661b014 100644
--- a/hw/arm/allwinner-r40.c
+++ b/hw/arm/allwinner-r40.c
@@ -294,7 +294,6 @@ static void allwinner_r40_init(Object *obj)
static void allwinner_r40_realize(DeviceState *dev, Error **errp)
{
- const char *r40_nic_models[] = { "gmac", "emac", NULL };
AwR40State *s = AW_R40(dev);
/* CPUs */
@@ -454,31 +453,8 @@ static void allwinner_r40_realize(DeviceState *dev, Error
**errp)
sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 2,
s->memmap[AW_R40_DEV_DRAMPHY]);
- /* nic support gmac and emac */
- for (int i = 0; i < ARRAY_SIZE(r40_nic_models) - 1; i++) {
- NICInfo *nic = &nd_table[i];
-
- if (!nic->used) {
- continue;
- }
- if (qemu_show_nic_models(nic->model, r40_nic_models)) {
- exit(0);
- }
-
- switch (qemu_find_nic_model(nic, r40_nic_models, r40_nic_models[0])) {
- case 0: /* gmac */
- qdev_set_nic_properties(DEVICE(&s->gmac), nic);
- break;
- case 1: /* emac */
- qdev_set_nic_properties(DEVICE(&s->emac), nic);
- break;
- default:
- exit(1);
- break;
- }
- }
-
/* GMAC */
+ qemu_configure_nic_device(DEVICE(&s->gmac), true, "gmac");
object_property_set_link(OBJECT(&s->gmac), "dma-memory",
OBJECT(get_system_memory()),
&error_fatal);
sysbus_realize(SYS_BUS_DEVICE(&s->gmac), &error_fatal);
@@ -487,6 +463,7 @@ static void allwinner_r40_realize(DeviceState *dev, Error
**errp)
qdev_get_gpio_in(DEVICE(&s->gic), AW_R40_GIC_SPI_GMAC));
/* EMAC */
+ qemu_configure_nic_device(DEVICE(&s->emac), true, "emac");
sysbus_realize(SYS_BUS_DEVICE(&s->emac), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(&s->emac), 0, s->memmap[AW_R40_DEV_EMAC]);
sysbus_connect_irq(SYS_BUS_DEVICE(&s->emac), 0,
--
2.43.0
- [PATCH v4 06/47] hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs, (continued)
- [PATCH v4 06/47] hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs, David Woodhouse, 2024/01/26
- [PATCH v4 23/47] hw/arm/exynos4: use qemu_create_nic_device(), David Woodhouse, 2024/01/26
- [PATCH v4 28/47] hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases, David Woodhouse, 2024/01/26
- [PATCH v4 11/47] hw/loongarch: use pci_init_nic_devices(), David Woodhouse, 2024/01/26
- [PATCH v4 27/47] hw/arm/highbank: use qemu_create_nic_device(), David Woodhouse, 2024/01/26
- [PATCH v4 18/47] hw/sh4/r2d: use pci_init_nic_devices(), David Woodhouse, 2024/01/26
- [PATCH v4 34/47] hw/microblaze: use qemu_configure_nic_device(), David Woodhouse, 2024/01/26
- [PATCH v4 19/47] hw/sparc64/sun4u: use pci_init_nic_devices(), David Woodhouse, 2024/01/26
- [PATCH v4 03/47] net: add qemu_create_nic_bus_devices(), David Woodhouse, 2024/01/26
- [PATCH v4 05/47] hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices(), David Woodhouse, 2024/01/26
- [PATCH v4 21/47] hw/arm/allwinner: use qemu_configure_nic_device(),
David Woodhouse <=
- [PATCH v4 04/47] hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot(), David Woodhouse, 2024/01/26
- [PATCH v4 25/47] hw/net/smc91c111: use qemu_configure_nic_device(), David Woodhouse, 2024/01/26
- [PATCH v4 37/47] hw/net/lasi_i82596: Re-enable build, David Woodhouse, 2024/01/26
- [PATCH v4 35/47] hw/mips/mipssim: use qemu_create_nic_device(), David Woodhouse, 2024/01/26
- [PATCH v4 38/47] hw/net/lasi_i82596: use qemu_create_nic_device(), David Woodhouse, 2024/01/26
- [PATCH v4 39/47] hw/openrisc/openrisc_sim: use qemu_create_nic_device(), David Woodhouse, 2024/01/26
- [PATCH v4 14/47] hw/mips/loongson3_virt: use pci_init_nic_devices(), David Woodhouse, 2024/01/26
- [PATCH v4 26/47] hw/net/lan9118: use qemu_configure_nic_device(), David Woodhouse, 2024/01/26
- [PATCH v4 17/47] hw/ppc: use pci_init_nic_devices(), David Woodhouse, 2024/01/26
- [PATCH v4 20/47] hw/xtensa/virt: use pci_init_nic_devices(), David Woodhouse, 2024/01/26