aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorvin Köhne <corvink@FreeBSD.org>2023-03-29 08:07:10 +0000
committerCorvin Köhne <corvink@FreeBSD.org>2023-04-11 06:39:21 +0000
commit0d29d750b9a7188c435d3701b2183f4df15ac98b (patch)
tree6b8196ea94adfa791b32a6403471928f197536f6
parent61605e0ae5d8f34b89b8e71e393f3006f511e86a (diff)
downloadsrc-0d29d750b9a7188c435d3701b2183f4df15ac98b.tar.gz
src-0d29d750b9a7188c435d3701b2183f4df15ac98b.zip
bhyve: do not exit if LPC finds no host selector
The host selector is only required when the user likes to use the same LPC device IDs as the physical LPC device. This is an uncommon use case. For that reason, it makes no sense to exit when we don't find the host selector. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D39311
-rw-r--r--usr.sbin/bhyve/pci_lpc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c
index 02105ef01bdf..8213f32985ef 100644
--- a/usr.sbin/bhyve/pci_lpc.c
+++ b/usr.sbin/bhyve/pci_lpc.c
@@ -480,6 +480,8 @@ pci_lpc_get_sel(struct pcisel *const sel)
}
}
+ warnx("%s: Unable to find host selector of LPC bridge.", __func__);
+
return (-1);
}
@@ -487,6 +489,7 @@ static int
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 @@ pci_lpc_init(struct pci_devinst *pi, nvlist_t *nvl)
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 */