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 @@ -480,6 +480,8 @@ } } + warnx("%s: Unable to find host selector of LPC bridge.", __func__); + return (-1); } @@ -487,6 +489,7 @@ pci_lpc_init(struct pci_devinst *pi, nvlist_t *nvl) { struct pcisel sel = { 0 }; + struct pcisel *selp = NULL; uint16_t device, subdevice, subvendor, vendor; uint8_t revid; @@ -511,15 +514,15 @@ if (lpc_init(pi->pi_vmctx) != 0) return (-1); - if (pci_lpc_get_sel(&sel) != 0) - return (-1); + if (pci_lpc_get_sel(&sel) == 0) + selp = &sel; - vendor = pci_config_read_reg(&sel, nvl, PCIR_VENDOR, 2, LPC_VENDOR); - device = pci_config_read_reg(&sel, nvl, PCIR_DEVICE, 2, LPC_DEV); - revid = pci_config_read_reg(&sel, nvl, PCIR_REVID, 1, LPC_REVID); - subvendor = pci_config_read_reg(&sel, nvl, PCIR_SUBVEND_0, 2, + vendor = pci_config_read_reg(selp, nvl, PCIR_VENDOR, 2, LPC_VENDOR); + device = pci_config_read_reg(selp, nvl, PCIR_DEVICE, 2, LPC_DEV); + revid = pci_config_read_reg(selp, nvl, PCIR_REVID, 1, LPC_REVID); + subvendor = pci_config_read_reg(selp, nvl, PCIR_SUBVEND_0, 2, LPC_SUBVEND_0); - subdevice = pci_config_read_reg(&sel, nvl, PCIR_SUBDEV_0, 2, + subdevice = pci_config_read_reg(selp, nvl, PCIR_SUBDEV_0, 2, LPC_SUBDEV_0); /* initialize config space */