From 29b358f93a48a415853d11fc9b02f711b5ec8f76 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 6 Jun 2013 18:48:51 +1000 Subject: pci: Add root bus parameter to pci_nic_init() At present, pci_nic_init() and pci_nic_init_nofail() assume that they will only create a NIC under the primary PCI root. As we add support for multiple PCI roots, that may no longer be the case. This patch adds a root bus parameter to pci_nic_init() (and updates callers accordingly) to allow the machine init code using it to specify the right PCI root for NICs created by old-style -net nic parameters. NICs created new-style, with -device can of course be put anywhere. Signed-off-by: David Gibson Signed-off-by: Michael S. Tsirkin --- hw/sh4/r2d.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'hw/sh4') diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 3e4818e170..dd81d75330 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -236,6 +236,7 @@ static void r2d_init(QEMUMachineInitArgs *args) DeviceState *dev; SysBusDevice *busdev; MemoryRegion *address_space_mem = get_system_memory(); + PCIBus *pci_bus; if (cpu_model == NULL) { cpu_model = "SH7751R"; @@ -264,6 +265,7 @@ static void r2d_init(QEMUMachineInitArgs *args) dev = qdev_create(NULL, "sh_pci"); busdev = SYS_BUS_DEVICE(dev); qdev_init_nofail(dev); + pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); sysbus_mmio_map(busdev, 0, P4ADDR(0x1e200000)); sysbus_mmio_map(busdev, 1, A7ADDR(0x1e200000)); sysbus_connect_irq(busdev, 0, irq[PCI_INTA]); @@ -295,7 +297,8 @@ static void r2d_init(QEMUMachineInitArgs *args) /* NIC: rtl8139 on-board, and 2 slots. */ for (i = 0; i < nb_nics; i++) - pci_nic_init_nofail(&nd_table[i], "rtl8139", i==0 ? "2" : NULL); + pci_nic_init_nofail(&nd_table[i], pci_bus, + "rtl8139", i==0 ? "2" : NULL); /* USB keyboard */ usbdevice_create("keyboard"); -- cgit v1.2.1