Skip to content

Commit

Permalink
Merge tag 'pull-nic-config-2-20240202' of git://git.infradead.org/use…
Browse files Browse the repository at this point in the history
…rs/dwmw2/qemu into staging

Rework matching of network devices to -nic options (v2)

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEMUsIrNDeSBEzpfKGm+mA/QrAFUQFAmW9F9oSHGR3bXdAYW1h
# em9uLmNvLnVrAAoJEJvpgP0KwBVEVwsQAIIDTYb3R/vxpf6w9n+n6FWCbFt/ihPC
# RbQ/Zrnoj6K3dCj6U3zJDpa5qpJ27/AiFfVv/gU13d+ELf72uHKE50GkQa2r/Fl8
# cPoW1LRinGFGxQS+WY5OnRYJ2mBaVx6THUd5DCgb5wpkBgVe21XsZLr6pfAapNCG
# c22HBaIb8sHPeIV2wf1xZKEswNGlkXuylBnS4wayncRKa2vOYPAAO7P4PvwNuMnb
# j0pLyLfD6Zx+6D53ema4zpcDh7d1Qn5eDGHQmy55Ml5AleC05gsDzrCEeiT4vU9T
# 9fj6w8NlyLkPYLqTodAEeaUpUCFhMO312VPSM163iYOUDtjqz10bBZncgbRrsR5I
# 30bKqQvEQ8PAQZWILNhfyHrYw4/O2Y88sUf/lE8lGmHvVYda+yqq5lgEyPFHbJwh
# ZCEJQalc6tRATIWUqI/Lw+X7hqnJ29c14hkEVG8L0KW0fIB/cqXUStzcUt87VkA2
# wwQI4aAGWZE1pvFvhmeM2rTDXfg1uD8SoFDTj4ORJl/7PEemf1yraKUYb8YdRE0z
# dQWfLmSnl1JkTa0yVF5MtnoTJUP8PX+hhJROfdwvfd1sU5s98O5pivYf7arUybVl
# j4g4qwm8IUBiAznZzbhdp38Q91RFvBKjjLsx/+Ts9avZTL0xCUcCvt21wzqWhbkc
# X7KdrU/XxVry
# =4PuR
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 02 Feb 2024 16:27:06 GMT
# gpg:                using RSA key 314B08ACD0DE481133A5F2869BE980FD0AC01544
# gpg:                issuer "dwmw@amazon.co.uk"
# gpg: Good signature from "David Woodhouse <dwmw@amazon.co.uk>" [unknown]
# gpg:                 aka "David Woodhouse <dwmw@amazon.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 314B 08AC D0DE 4811 33A5  F286 9BE9 80FD 0AC0 1544

* tag 'pull-nic-config-2-20240202' of git://git.infradead.org/users/dwmw2/qemu: (47 commits)
  net: make nb_nics and nd_table[] static in net/net.c
  net: remove qemu_show_nic_models(), qemu_find_nic_model()
  hw/pci: remove pci_nic_init_nofail()
  net: remove qemu_check_nic_model()
  hw/xtensa/xtfpga: use qemu_create_nic_device()
  hw/sparc/sun4m: use qemu_find_nic_info()
  hw/s390x/s390-virtio-ccw: use qemu_create_nic_device()
  hw/riscv: use qemu_configure_nic_device()
  hw/openrisc/openrisc_sim: use qemu_create_nic_device()
  hw/net/lasi_i82596: use qemu_create_nic_device()
  hw/net/lasi_i82596: Re-enable build
  hw/mips/jazz: use qemu_find_nic_info()
  hw/mips/mipssim: use qemu_create_nic_device()
  hw/microblaze: use qemu_configure_nic_device()
  hw/m68k/q800: use qemu_find_nic_info()
  hw/m68k/mcf5208: use qemu_create_nic_device()
  hw/net/etraxfs-eth: use qemu_configure_nic_device()
  hw/arm: use qemu_configure_nic_device()
  hw/arm/stellaris: use qemu_find_nic_info()
  hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Feb 2, 2024
2 parents c3709fd + e8c5c45 commit 29b0089
Show file tree
Hide file tree
Showing 81 changed files with 547 additions and 560 deletions.
4 changes: 1 addition & 3 deletions hw/alpha/dp264.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ static void clipper_init(MachineState *machine)
pci_vga_init(pci_bus);

/* Network setup. e1000 is good enough, failing Tulip support. */
for (i = 0; i < nb_nics; i++) {
pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL);
}
pci_init_nic_devices(pci_bus, mc->default_nic);

/* Super I/O */
isa_create_simple(isa_bus, TYPE_SMC37C669_SUPERIO);
Expand Down
6 changes: 1 addition & 5 deletions hw/arm/allwinner-a10.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,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;
}
Expand Down
6 changes: 1 addition & 5 deletions hw/arm/allwinner-h3.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,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);
Expand Down
27 changes: 2 additions & 25 deletions hw/arm/allwinner-r40.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,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 */
Expand Down Expand Up @@ -512,31 +511,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);
Expand All @@ -545,6 +521,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,
Expand Down
9 changes: 4 additions & 5 deletions hw/arm/aspeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ static void aspeed_machine_init(MachineState *machine)
AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(machine);
AspeedSoCClass *sc;
int i;
NICInfo *nd = &nd_table[0];

bmc->soc = ASPEED_SOC(object_new(amc->soc_name));
object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc));
Expand All @@ -371,10 +370,10 @@ static void aspeed_machine_init(MachineState *machine)
&error_fatal);

for (i = 0; i < sc->macs_num; i++) {
if ((amc->macs_mask & (1 << i)) && nd->used) {
qemu_check_nic_model(nd, TYPE_FTGMAC100);
qdev_set_nic_properties(DEVICE(&bmc->soc->ftgmac100[i]), nd);
nd++;
if ((amc->macs_mask & (1 << i)) &&
!qemu_configure_nic_device(DEVICE(&bmc->soc->ftgmac100[i]),
true, NULL)) {
break; /* No configs left; stop asking */
}
}

Expand Down
6 changes: 2 additions & 4 deletions hw/arm/exynos4_boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@ static void lan9215_init(uint32_t base, qemu_irq irq)
SysBusDevice *s;

/* This should be a 9215 but the 9118 is close enough */
if (nd_table[0].used) {
qemu_check_nic_model(&nd_table[0], "lan9118");
dev = qdev_new(TYPE_LAN9118);
qdev_set_nic_properties(dev, &nd_table[0]);
dev = qemu_create_nic_device(TYPE_LAN9118, true, NULL);
if (dev) {
qdev_prop_set_uint32(dev, "mode_16bit", 1);
s = SYS_BUS_DEVICE(dev);
sysbus_realize_and_unref(s, &error_fatal);
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/fsl-imx25.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)

object_property_set_uint(OBJECT(&s->fec), "phy-num", s->phy_num,
&error_abort);
qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]);
qemu_configure_nic_device(DEVICE(&s->fec), true, NULL);

if (!sysbus_realize(SYS_BUS_DEVICE(&s->fec), errp)) {
return;
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/fsl-imx6.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)

object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num,
&error_abort);
qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]);
qemu_configure_nic_device(DEVICE(&s->eth), true, NULL);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->eth), errp)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/fsl-imx6ul.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
s->phy_num[i], &error_abort);
object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num",
FSL_IMX6UL_ETH_NUM_TX_RINGS, &error_abort);
qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]);
qemu_configure_nic_device(DEVICE(&s->eth[i]), true, NULL);
sysbus_realize(SYS_BUS_DEVICE(&s->eth[i]), &error_abort);

sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth[i]), 0,
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/fsl-imx7.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
s->phy_num[i], &error_abort);
object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num",
FSL_IMX7_ETH_NUM_TX_RINGS, &error_abort);
qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]);
qemu_configure_nic_device(DEVICE(&s->eth[i]), true, NULL);
sysbus_realize(SYS_BUS_DEVICE(&s->eth[i]), &error_abort);

sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth[i]), 0, FSL_IMX7_ENETn_ADDR[i]);
Expand Down
6 changes: 2 additions & 4 deletions hw/arm/gumstix.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ static void connex_init(MachineState *machine)
FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0);

/* Interrupt line of NIC is connected to GPIO line 36 */
smc91c111_init(&nd_table[0], 0x04000300,
qdev_get_gpio_in(cpu->gpio, 36));
smc91c111_init(0x04000300, qdev_get_gpio_in(cpu->gpio, 36));
}

static void verdex_init(MachineState *machine)
Expand All @@ -97,8 +96,7 @@ static void verdex_init(MachineState *machine)
FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0);

/* Interrupt line of NIC is connected to GPIO line 99 */
smc91c111_init(&nd_table[0], 0x04000300,
qdev_get_gpio_in(cpu->gpio, 99));
smc91c111_init(0x04000300, qdev_get_gpio_in(cpu->gpio, 99));
}

static void connex_class_init(ObjectClass *oc, void *data)
Expand Down
12 changes: 5 additions & 7 deletions hw/arm/highbank.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,17 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)

sysbus_create_simple(TYPE_SYSBUS_AHCI, 0xffe08000, pic[83]);

if (nd_table[0].used) {
qemu_check_nic_model(&nd_table[0], "xgmac");
dev = qdev_new("xgmac");
qdev_set_nic_properties(dev, &nd_table[0]);
dev = qemu_create_nic_device("xgmac", true, NULL);
if (dev) {
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff50000);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[77]);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, pic[78]);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 2, pic[79]);
}

qemu_check_nic_model(&nd_table[1], "xgmac");
dev = qdev_new("xgmac");
qdev_set_nic_properties(dev, &nd_table[1]);
dev = qemu_create_nic_device("xgmac", true, NULL);
if (dev) {
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff51000);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[80]);
Expand Down
5 changes: 3 additions & 2 deletions hw/arm/integratorcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,9 @@ static void integratorcp_init(MachineState *machine)
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x1d000000);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[25]);

if (nd_table[0].used)
smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
if (qemu_find_nic_info("smc91c111", true, NULL)) {
smc91c111_init(0xc8000000, pic[27]);
}

sysbus_create_simple("pl110", 0xc0000000, pic[22]);

Expand Down
4 changes: 2 additions & 2 deletions hw/arm/kzm.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ static void kzm_init(MachineState *machine)
alias_offset += ram[i].size;
}

if (nd_table[0].used) {
lan9118_init(&nd_table[0], KZM_LAN9118_ADDR,
if (qemu_find_nic_info("lan9118", true, NULL)) {
lan9118_init(KZM_LAN9118_ADDR,
qdev_get_gpio_in(DEVICE(&s->soc.avic), 52));
}

Expand Down
3 changes: 1 addition & 2 deletions hw/arm/mainstone.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ static void mainstone_common_init(MachineState *machine,
qdev_get_gpio_in(mst_irq, S1_IRQ),
qdev_get_gpio_in(mst_irq, S1_CD_IRQ));

smc91c111_init(&nd_table[0], MST_ETH_PHYS,
qdev_get_gpio_in(mst_irq, ETHERNET_IRQ));
smc91c111_init(MST_ETH_PHYS, qdev_get_gpio_in(mst_irq, ETHERNET_IRQ));

mainstone_binfo.board_id = arm_id;
arm_load_kernel(mpu->cpu, machine, &mainstone_binfo);
Expand Down
8 changes: 2 additions & 6 deletions hw/arm/mps2-tz.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,12 @@ static MemoryRegion *make_eth_dev(MPS2TZMachineState *mms, void *opaque,
const PPCExtraData *extradata)
{
SysBusDevice *s;
NICInfo *nd = &nd_table[0];

/* In hardware this is a LAN9220; the LAN9118 is software compatible
* except that it doesn't support the checksum-offload feature.
*/
qemu_check_nic_model(nd, "lan9118");
mms->lan9118 = qdev_new(TYPE_LAN9118);
qdev_set_nic_properties(mms->lan9118, nd);
qemu_configure_nic_device(mms->lan9118, true, NULL);

s = SYS_BUS_DEVICE(mms->lan9118);
sysbus_realize_and_unref(s, &error_fatal);
Expand All @@ -528,7 +526,6 @@ static MemoryRegion *make_eth_usb(MPS2TZMachineState *mms, void *opaque,
* irqs[] is the ethernet IRQ.
*/
SysBusDevice *s;
NICInfo *nd = &nd_table[0];

memory_region_init(&mms->eth_usb_container, OBJECT(mms),
"mps2-tz-eth-usb-container", 0x200000);
Expand All @@ -537,9 +534,8 @@ static MemoryRegion *make_eth_usb(MPS2TZMachineState *mms, void *opaque,
* In hardware this is a LAN9220; the LAN9118 is software compatible
* except that it doesn't support the checksum-offload feature.
*/
qemu_check_nic_model(nd, "lan9118");
mms->lan9118 = qdev_new(TYPE_LAN9118);
qdev_set_nic_properties(mms->lan9118, nd);
qemu_configure_nic_device(mms->lan9118, true, NULL);

s = SYS_BUS_DEVICE(mms->lan9118);
sysbus_realize_and_unref(s, &error_fatal);
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/mps2.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ static void mps2_common_init(MachineState *machine)
/* In hardware this is a LAN9220; the LAN9118 is software compatible
* 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,
mmc->fpga_type == FPGA_AN511 ? 47 : 13));

Expand Down
6 changes: 1 addition & 5 deletions hw/arm/msf2-soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,8 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)
g_free(bus_name);
}

/* FIXME use qdev NIC properties instead of nd_table[] */
if (nd_table[0].used) {
qemu_check_nic_model(&nd_table[0], TYPE_MSS_EMAC);
qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
}
dev = DEVICE(&s->emac);
qemu_configure_nic_device(dev, true, NULL);
object_property_set_link(OBJECT(&s->emac), "ahb-bus",
OBJECT(get_system_memory()), &error_abort);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->emac), errp)) {
Expand Down
3 changes: 1 addition & 2 deletions hw/arm/musicpal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,9 +1277,8 @@ static void musicpal_init(MachineState *machine)
}
sysbus_create_simple(TYPE_MV88W8618_FLASHCFG, MP_FLASHCFG_BASE, NULL);

qemu_check_nic_model(&nd_table[0], "mv88w8618");
dev = qdev_new(TYPE_MV88W8618_ETH);
qdev_set_nic_properties(dev, &nd_table[0]);
qemu_configure_nic_device(dev, true, "mv88w8618");
object_property_set_link(OBJECT(dev), "dma-memory",
OBJECT(get_system_memory()), &error_fatal);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
Expand Down
16 changes: 9 additions & 7 deletions hw/arm/npcm7xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,21 +656,23 @@ 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.
*/
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
Expand Down
25 changes: 9 additions & 16 deletions hw/arm/realview.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@ static void realview_init(MachineState *machine,
SysBusDevice *busdev;
qemu_irq pic[64];
PCIBus *pci_bus = NULL;
NICInfo *nd;
DriveInfo *dinfo;
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;
Expand Down Expand Up @@ -296,24 +294,19 @@ 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;

if (qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL)) {
if (is_pb) {
lan9118_init(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);
Expand Down
4 changes: 1 addition & 3 deletions hw/arm/sbsa-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,7 @@ static void create_pcie(SBSAMachineState *sms)

pci = PCI_HOST_BRIDGE(dev);
if (pci->bus) {
for (i = 0; i < nb_nics; i++) {
pci_nic_init_nofail(&nd_table[i], pci->bus, mc->default_nic, NULL);
}
pci_init_nic_devices(pci->bus, mc->default_nic);
}

pci_create_simple(pci->bus, -1, "bochs-display");
Expand Down

0 comments on commit 29b0089

Please sign in to comment.