From 1785ae69ea262dbcfbd2d59d25ee5e7501701460 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 20 Oct 2023 01:05:31 +0100 Subject: hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot() The loop over nd_table[] to add PCI NICs is repeated in quite a few places. Add a helper function to do it. Some platforms also try to instantiate a specific model in a specific slot, to match the real hardware. Add pci_init_nic_in_slot() for that purpose. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- include/hw/pci/pci.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index fa6313aabc..6ff0b95a02 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -317,7 +317,9 @@ void pci_device_reset(PCIDevice *dev); PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, const char *default_model, const char *default_devaddr); - +void pci_init_nic_devices(PCIBus *bus, const char *default_model); +bool pci_init_nic_in_slot(PCIBus *rootbus, const char *default_model, + const char *alias, const char *devaddr); PCIDevice *pci_vga_init(PCIBus *bus); static inline PCIBus *pci_get_bus(const PCIDevice *dev) -- cgit 1.4.1