Restrict PCIe maxslots to 0, instead of PCI_SLOTMAX

Summary:
PCIe only permits 1 device on an endpoint, so some devices ignore the device
part of B:D:F probing.  Although ARI likely fixes this, not all platforms
support ARI completely or correctly, so some devices end up showing up 32
times on the bus.

This was found during bringup of POWER9/Talos, and has been tested on POWER9
and POWER8 hardware.

Reviewed by:	leitao
Differential Revision: https://reviews.freebsd.org/D15461
This commit is contained in:
Justin Hibbits 2018-05-30 02:41:47 +00:00
parent 549bb844cf
commit 8b92ad4371

View File

@ -2545,6 +2545,20 @@ pcib_enable_ari(struct pcib_softc *sc, uint32_t pcie_pos)
int
pcib_maxslots(device_t dev)
{
uint32_t pcie_pos;
uint16_t val;
/*
* If this is a PCIe rootport or downstream switch port, there's only
* one slot permitted.
*/
if (pci_find_cap(dev, PCIY_EXPRESS, &pcie_pos) == 0) {
val = pci_read_config(dev, pcie_pos + PCIER_FLAGS, 2);
val &= PCIEM_FLAGS_TYPE;
if (val == PCIEM_TYPE_ROOT_PORT ||
val == PCIEM_TYPE_DOWNSTREAM_PORT)
return (0);
}
return (PCI_SLOTMAX);
}
@ -2558,7 +2572,7 @@ pcib_ari_maxslots(device_t dev)
if (sc->flags & PCIB_ENABLE_ARI)
return (PCIE_ARI_SLOTMAX);
else
return (PCI_SLOTMAX);
return (pcib_maxslots(dev));
}
static int