Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/pci/pci_pci.c
Show First 20 Lines • Show All 1,067 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
pcib_hotplug_present(struct pcib_softc *sc) | pcib_hotplug_present(struct pcib_softc *sc) | ||||
{ | { | ||||
/* Card must be inserted. */ | /* Card must be inserted. */ | ||||
if (!pcib_hotplug_inserted(sc)) | if (!pcib_hotplug_inserted(sc)) | ||||
return (0); | return (0); | ||||
/* | |||||
* Require the Electromechanical Interlock to be engaged if | |||||
* present. | |||||
*/ | |||||
if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP && | |||||
(sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) == 0) | |||||
return (0); | |||||
/* Require the Data Link Layer to be active. */ | /* Require the Data Link Layer to be active. */ | ||||
if (!(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE)) | if (!(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE)) | ||||
return (0); | return (0); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | if (rid < 0 && pci_msi_count(dev) > 0) { | ||||
if (error == 0) | if (error == 0) | ||||
rid = 1; | rid = 1; | ||||
} | } | ||||
if (rid < 0) | if (rid < 0) | ||||
rid = 0; | rid = 0; | ||||
sc->pcie_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, | sc->pcie_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, | ||||
RF_ACTIVE); | RF_ACTIVE | RF_SHAREABLE); | ||||
if (sc->pcie_irq == NULL) { | if (sc->pcie_irq == NULL) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"Failed to allocate interrupt for PCI-e events\n"); | "Failed to allocate interrupt for PCI-e events\n"); | ||||
if (rid > 0) | if (rid > 0) | ||||
pci_release_msi(dev); | pci_release_msi(dev); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,604 Lines • Show Last 20 Lines |