Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/pci/pci_pci.c
Show First 20 Lines • Show All 1,051 Lines • ▼ Show 20 Lines | pcib_hotplug_present(struct pcib_softc *sc) | ||||
return (-1); | return (-1); | ||||
} | } | ||||
static void | static void | ||||
pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask, | pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask, | ||||
bool schedule_task) | bool schedule_task) | ||||
{ | { | ||||
bool card_inserted; | bool card_inserted, ei_engaged; | ||||
/* Clear DETACHING if Present Detect has cleared. */ | /* Clear DETACHING if Present Detect has cleared. */ | ||||
if ((sc->pcie_slot_sta & (PCIEM_SLOT_STA_PDC | PCIEM_SLOT_STA_PDS)) == | if ((sc->pcie_slot_sta & (PCIEM_SLOT_STA_PDC | PCIEM_SLOT_STA_PDS)) == | ||||
PCIEM_SLOT_STA_PDC) | PCIEM_SLOT_STA_PDC) | ||||
sc->flags &= ~PCIB_DETACHING; | sc->flags &= ~PCIB_DETACHING; | ||||
card_inserted = pcib_hotplug_inserted(sc); | card_inserted = pcib_hotplug_inserted(sc); | ||||
Show All 20 Lines | pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask, | ||||
/* | /* | ||||
* If a card is inserted, enable the Electromechanical | * If a card is inserted, enable the Electromechanical | ||||
* Interlock. If a card is not inserted (or we are in the | * Interlock. If a card is not inserted (or we are in the | ||||
* process of detaching), disable the Electromechanical | * process of detaching), disable the Electromechanical | ||||
* Interlock. | * Interlock. | ||||
*/ | */ | ||||
if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) { | if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) { | ||||
mask |= PCIEM_SLOT_CTL_EIC; | mask |= PCIEM_SLOT_CTL_EIC; | ||||
if (card_inserted != | ei_engaged = (sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) != 0; | ||||
!(sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS)) | if (card_inserted != ei_engaged) | ||||
val |= PCIEM_SLOT_CTL_EIC; | val |= PCIEM_SLOT_CTL_EIC; | ||||
} | } | ||||
/* | /* | ||||
* Start a timer to see if the Data Link Layer times out. | * Start a timer to see if the Data Link Layer times out. | ||||
* Note that we only start the timer if Presence Detect | * Note that we only start the timer if Presence Detect | ||||
* changed on this interrupt. Stop any scheduled timer if | * changed on this interrupt. Stop any scheduled timer if | ||||
* the Data Link Layer is active. | * the Data Link Layer is active. | ||||
Show All 10 Lines | if (card_inserted && | ||||
pcib_pcie_dll_timeout, sc); | pcib_pcie_dll_timeout, sc); | ||||
} else if (sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE) | } else if (sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE) | ||||
callout_stop(&sc->pcie_dll_timer); | callout_stop(&sc->pcie_dll_timer); | ||||
} | } | ||||
pcib_pcie_hotplug_command(sc, val, mask); | pcib_pcie_hotplug_command(sc, val, mask); | ||||
/* | /* | ||||
* During attach the child "pci" device is added sychronously; | * During attach the child "pci" device is added synchronously; | ||||
* otherwise, the task is scheduled to manage the child | * otherwise, the task is scheduled to manage the child | ||||
* device. | * device. | ||||
*/ | */ | ||||
if (schedule_task && | if (schedule_task && | ||||
(pcib_hotplug_present(sc) != 0) != (sc->child != NULL)) | (pcib_hotplug_present(sc) != 0) != (sc->child != NULL)) | ||||
taskqueue_enqueue(taskqueue_thread, &sc->pcie_hp_task); | taskqueue_enqueue(taskqueue_thread, &sc->pcie_hp_task); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,683 Lines • Show Last 20 Lines |