diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c --- a/usr.sbin/bhyve/pci_lpc.c +++ b/usr.sbin/bhyve/pci_lpc.c @@ -461,10 +461,22 @@ memset(sel, 0, sizeof(*sel)); for (uint8_t slot = 0; slot <= PCI_SLOTMAX; ++slot) { + uint8_t max_func = 0; + sel->pc_dev = slot; - if ((read_config(sel, PCIR_CLASS, 1) == PCIC_BRIDGE) && - (read_config(sel, PCIR_SUBCLASS, 1) == PCIS_BRIDGE_ISA)) { - return (0); + sel->pc_func = 0; + + if (read_config(sel, PCIR_HDRTYPE, 1) & PCIM_MFDEV) + max_func = PCI_FUNCMAX; + + for (uint8_t func = 0; func <= max_func; ++func) { + sel->pc_func = func; + + if ((read_config(sel, PCIR_CLASS, 1) == PCIC_BRIDGE) && + (read_config(sel, PCIR_SUBCLASS, 1) == + PCIS_BRIDGE_ISA)) { + return (0); + } } }