Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/pci/pci_pci.c
Show First 20 Lines • Show All 2,539 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/* | /* | ||||
* PCIB interface. | * PCIB interface. | ||||
*/ | */ | ||||
int | int | ||||
pcib_maxslots(device_t dev) | 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); | return (PCI_SLOTMAX); | ||||
} | } | ||||
static int | static int | ||||
pcib_ari_maxslots(device_t dev) | pcib_ari_maxslots(device_t dev) | ||||
{ | { | ||||
struct pcib_softc *sc; | struct pcib_softc *sc; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
if (sc->flags & PCIB_ENABLE_ARI) | if (sc->flags & PCIB_ENABLE_ARI) | ||||
return (PCIE_ARI_SLOTMAX); | return (PCIE_ARI_SLOTMAX); | ||||
else | else | ||||
return (PCI_SLOTMAX); | return (pcib_maxslots(dev)); | ||||
} | } | ||||
static int | static int | ||||
pcib_ari_maxfuncs(device_t dev) | pcib_ari_maxfuncs(device_t dev) | ||||
{ | { | ||||
struct pcib_softc *sc; | struct pcib_softc *sc; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
▲ Show 20 Lines • Show All 325 Lines • Show Last 20 Lines |