diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -412,12 +412,15 @@ process. .El .Ss Host Bridge Settings -.Bl -column "vendor" "integer" "Default" +.Bl -column "pcireg.*" "integer" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va pcireg.* Ta integer Ta Ta +Values of PCI register. +.Bl -column "device" "Default" +.It Sy Name Ta Sy Default .It Va vendor Ta integer Ta 0x1275 Ta -PCI vendor ID. -.It Va devid Ta integer Ta 0x1275 Ta -PCI device ID. +.It Va device Ta integer Ta 0x1275 Ta +.El .El .Ss AHCI Controller Settings AHCI controller devices contain zero or more ports each of which diff --git a/usr.sbin/bhyve/pci_hostbridge.c b/usr.sbin/bhyve/pci_hostbridge.c --- a/usr.sbin/bhyve/pci_hostbridge.c +++ b/usr.sbin/bhyve/pci_hostbridge.c @@ -31,6 +31,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include "config.h" @@ -48,9 +49,13 @@ value = get_config_value_node(nvl, "vendor"); if (value != NULL) vendor = strtol(value, NULL, 0); + else + vendor = pci_config_read_reg(NULL, nvl, PCIR_VENDOR, 2, vendor); value = get_config_value_node(nvl, "devid"); if (value != NULL) device = strtol(value, NULL, 0); + else + device = pci_config_read_reg(NULL, nvl, PCIR_DEVICE, 2, device); /* config space */ pci_set_cfgdata16(pi, PCIR_VENDOR, vendor); @@ -67,8 +72,16 @@ static int pci_amd_hostbridge_legacy_config(nvlist_t *nvl, const char *opts __unused) { - set_config_value_node(nvl, "vendor", "0x1022"); /* AMD */ - set_config_value_node(nvl, "devid", "0x7432"); /* made up */ + nvlist_t *pci_regs; + + pci_regs = create_relative_config_node(nvl, "pcireg"); + if (pci_regs == NULL) { + warnx("amd_hostbridge: failed to create pciregs node"); + return (-1); + } + + set_config_value_node(pci_regs, "vendor", "0x1022"); /* AMD */ + set_config_value_node(pci_regs, "device", "0x7432"); /* made up */ return (0); }