Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/mpr/mpr.c
Show First 20 Lines • Show All 514 Lines • ▼ Show 20 Lines | mpr_iocfacts_allocate(struct mpr_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) { | ||||
mpr_iocfacts_free(sc); | mpr_iocfacts_free(sc); | ||||
mprsas_realloc_targets(sc, saved_facts.MaxTargets); | mprsas_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 1,126 Lines • ▼ Show 20 Lines | mpr_attach(struct mpr_softc *sc) | ||||
int error; | int error; | ||||
mpr_get_tunables(sc); | mpr_get_tunables(sc); | ||||
MPR_FUNCTRACE(sc); | MPR_FUNCTRACE(sc); | ||||
mtx_init(&sc->mpr_mtx, "MPR lock", NULL, MTX_DEF); | mtx_init(&sc->mpr_mtx, "MPR lock", NULL, MTX_DEF); | ||||
callout_init_mtx(&sc->periodic, &sc->mpr_mtx, 0); | callout_init_mtx(&sc->periodic, &sc->mpr_mtx, 0); | ||||
callout_init_mtx(&sc->device_check_callout, &sc->mpr_mtx, 0); | |||||
TAILQ_INIT(&sc->event_list); | TAILQ_INIT(&sc->event_list); | ||||
timevalclear(&sc->lastfail); | timevalclear(&sc->lastfail); | ||||
if ((error = mpr_transition_ready(sc)) != 0) { | if ((error = mpr_transition_ready(sc)) != 0) { | ||||
mpr_printf(sc, "%s failed to transition ready\n", __func__); | mpr_printf(sc, "%s failed to transition ready\n", __func__); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | mpr_free(struct mpr_softc *sc) | ||||
int error; | int error; | ||||
/* Turn off the watchdog */ | /* Turn off the watchdog */ | ||||
mpr_lock(sc); | mpr_lock(sc); | ||||
sc->mpr_flags |= MPR_FLAGS_SHUTDOWN; | sc->mpr_flags |= MPR_FLAGS_SHUTDOWN; | ||||
mpr_unlock(sc); | mpr_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 = mpr_detach_log(sc)) != 0) || | if (((error = mpr_detach_log(sc)) != 0) || | ||||
((error = mpr_detach_sas(sc)) != 0)) | ((error = mpr_detach_sas(sc)) != 0)) | ||||
return (error); | return (error); | ||||
mpr_detach_user(sc); | mpr_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,649 Lines • Show Last 20 Lines |