Fix bhyve PCIe capability emulation

PCIe devices starting with version 1.1 must set the Role-Based Error
Reporting bit.

And while we're in the neighborhood, generalize the code assigning the
device type.

Reviewed by:	imp, araujo, rgrimes
Approved by:	imp (mentor)
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D19580
This commit is contained in:
Chuck Tuffli 2019-03-15 02:11:28 +00:00
parent 7bb1073842
commit 2ba640758d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345171

View File

@ -953,7 +953,10 @@ pci_emul_add_pciecap(struct pci_devinst *pi, int type)
bzero(&pciecap, sizeof(pciecap));
pciecap.capid = PCIY_EXPRESS;
pciecap.pcie_capabilities = PCIECAP_VERSION | PCIEM_TYPE_ROOT_PORT;
pciecap.pcie_capabilities = PCIECAP_VERSION | type;
/* Devices starting with version 1.1 must set the RBER bit */
if (PCIECAP_VERSION >= 1)
pciecap.dev_capabilities = PCIEM_CAP_ROLE_ERR_RPT;
pciecap.link_capabilities = 0x411; /* gen1, x1 */
pciecap.link_status = 0x11; /* gen1, x1 */