summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve/pci_lpc.c
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2014-02-14 21:34:08 +0000
committerneel <neel@FreeBSD.org>2014-02-14 21:34:08 +0000
commit8a0a5bcf44e50e2c3c5fef807048cadba3341b87 (patch)
tree7f6d5a1c47ea97c9306f1e0bdf66b8b0356e7c40 /usr.sbin/bhyve/pci_lpc.c
parent122e2bdb6dd224edfe412da8538bc974ad6d1d14 (diff)
downloadFreeBSD-src-8a0a5bcf44e50e2c3c5fef807048cadba3341b87.zip
FreeBSD-src-8a0a5bcf44e50e2c3c5fef807048cadba3341b87.tar.gz
Allow PCI devices to be configured on all valid bus numbers from 0 to 255.
This is done by representing each bus as root PCI device in ACPI. The device implements the _BBN method to return the PCI bus number to the guest OS. Each PCI bus keeps track of the resources that is decodes for devices configured on the bus: i/o, mmio (32-bit) and mmio (64-bit). These windows are advertised to the guest via the _CRS object of the root device. Bus 0 is treated specially since it consumes the I/O ports to access the PCI config space [0xcf8-0xcff]. It also decodes the legacy I/O ports that are consumed by devices on the LPC bus. For this reason the LPC bridge can be configured only on bus 0. The bus number can be specified using the following command line option to bhyve(8): "-s <bus>:<slot>:<func>,<emul>[,<config>]" Discussed with: grehan@ Reviewed by: jhb@
Diffstat (limited to 'usr.sbin/bhyve/pci_lpc.c')
-rw-r--r--usr.sbin/bhyve/pci_lpc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c
index a1e750d..30b0401 100644
--- a/usr.sbin/bhyve/pci_lpc.c
+++ b/usr.sbin/bhyve/pci_lpc.c
@@ -277,8 +277,20 @@ pci_lpc_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
/*
* Do not allow more than one LPC bridge to be configured.
*/
- if (lpc_bridge != NULL)
+ if (lpc_bridge != NULL) {
+ fprintf(stderr, "Only one LPC bridge is allowed.\n");
return (-1);
+ }
+
+ /*
+ * Enforce that the LPC can only be configured on bus 0. This
+ * simplifies the ACPI DSDT because it can provide a decode for
+ * all legacy i/o ports behind bus 0.
+ */
+ if (pi->pi_bus != 0) {
+ fprintf(stderr, "LPC bridge can be present only on bus 0.\n");
+ return (-1);
+ }
if (lpc_init() != 0)
return (-1);
OpenPOWER on IntegriCloud