Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/mps/mps.c
Show First 20 Lines • Show All 499 Lines • ▼ Show 20 Lines | mps_iocfacts_allocate(struct mps_softc *sc, uint8_t attaching) | ||||
/* | /* | ||||
* If doing a Diag Reset and the FW is significantly different | * If doing a Diag Reset and the FW is significantly different | ||||
* (reallocating will be set above in IOC Facts comparison), then all | * (reallocating will be set above in IOC Facts comparison), then all | ||||
* buffers based on the IOC Facts will need to be freed before they are | * buffers based on the IOC Facts will need to be freed before they are | ||||
* reallocated. | * reallocated. | ||||
*/ | */ | ||||
if (reallocating) { | if (reallocating) { | ||||
mps_iocfacts_free(sc); | mps_iocfacts_free(sc); | ||||
mpssas_realloc_targets(sc, saved_facts.MaxTargets); | mpssas_realloc_targets(sc, saved_facts.MaxTargets + | ||||
saved_facts.MaxVolumes); | |||||
} | } | ||||
/* | /* | ||||
* Any deallocation has been completed. Now start reallocating | * Any deallocation has been completed. Now start reallocating | ||||
* if needed. Will only need to reallocate if attaching or if the new | * if needed. Will only need to reallocate if attaching or if the new | ||||
* IOC Facts are different from the previous IOC Facts after a Diag | * IOC Facts are different from the previous IOC Facts after a Diag | ||||
* Reset. Targets have already been allocated above if needed. | * Reset. Targets have already been allocated above if needed. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 996 Lines • ▼ Show 20 Lines | mps_attach(struct mps_softc *sc) | ||||
int error; | int error; | ||||
mps_get_tunables(sc); | mps_get_tunables(sc); | ||||
MPS_FUNCTRACE(sc); | MPS_FUNCTRACE(sc); | ||||
mtx_init(&sc->mps_mtx, "MPT2SAS lock", NULL, MTX_DEF); | mtx_init(&sc->mps_mtx, "MPT2SAS lock", NULL, MTX_DEF); | ||||
callout_init_mtx(&sc->periodic, &sc->mps_mtx, 0); | callout_init_mtx(&sc->periodic, &sc->mps_mtx, 0); | ||||
callout_init_mtx(&sc->device_check_callout, &sc->mps_mtx, 0); | |||||
TAILQ_INIT(&sc->event_list); | TAILQ_INIT(&sc->event_list); | ||||
timevalclear(&sc->lastfail); | timevalclear(&sc->lastfail); | ||||
if ((error = mps_transition_ready(sc)) != 0) { | if ((error = mps_transition_ready(sc)) != 0) { | ||||
mps_printf(sc, "%s failed to transition ready\n", __func__); | mps_printf(sc, "%s failed to transition ready\n", __func__); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | mps_free(struct mps_softc *sc) | ||||
int error; | int error; | ||||
/* Turn off the watchdog */ | /* Turn off the watchdog */ | ||||
mps_lock(sc); | mps_lock(sc); | ||||
sc->mps_flags |= MPS_FLAGS_SHUTDOWN; | sc->mps_flags |= MPS_FLAGS_SHUTDOWN; | ||||
mps_unlock(sc); | mps_unlock(sc); | ||||
/* Lock must not be held for this */ | /* Lock must not be held for this */ | ||||
callout_drain(&sc->periodic); | callout_drain(&sc->periodic); | ||||
callout_drain(&sc->device_check_callout); | |||||
if (((error = mps_detach_log(sc)) != 0) || | if (((error = mps_detach_log(sc)) != 0) || | ||||
((error = mps_detach_sas(sc)) != 0)) | ((error = mps_detach_sas(sc)) != 0)) | ||||
return (error); | return (error); | ||||
mps_detach_user(sc); | mps_detach_user(sc); | ||||
/* Put the IOC back in the READY state. */ | /* Put the IOC back in the READY state. */ | ||||
▲ Show 20 Lines • Show All 1,018 Lines • Show Last 20 Lines |