bhyve: scan PCI device functions to find host LPC
At least on some AMD devices the host LPC bridge could be located as
seperate function of another PCI device.
Fixes: f4ceaff56d
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39310
This commit is contained in:
parent
134ced89c4
commit
d3e03d235e
@ -461,12 +461,24 @@ pci_lpc_get_sel(struct pcisel *const sel)
|
||||
memset(sel, 0, sizeof(*sel));
|
||||
|
||||
for (uint8_t slot = 0; slot <= PCI_SLOTMAX; ++slot) {
|
||||
uint8_t max_func = 0;
|
||||
|
||||
sel->pc_dev = slot;
|
||||
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)) {
|
||||
(read_config(sel, PCIR_SUBCLASS, 1) ==
|
||||
PCIS_BRIDGE_ISA)) {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user