Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/mpr/mpr_sas.c
Show First 20 Lines • Show All 722 Lines • ▼ Show 20 Lines | mprsas_register_events(struct mpr_softc *sc) | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
mpr_attach_sas(struct mpr_softc *sc) | mpr_attach_sas(struct mpr_softc *sc) | ||||
{ | { | ||||
struct mprsas_softc *sassc; | struct mprsas_softc *sassc; | ||||
cam_status status; | cam_status status; | ||||
int unit, error = 0; | int unit, error = 0, reqs; | ||||
MPR_FUNCTRACE(sc); | MPR_FUNCTRACE(sc); | ||||
mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); | mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); | ||||
sassc = malloc(sizeof(struct mprsas_softc), M_MPR, M_WAITOK|M_ZERO); | sassc = malloc(sizeof(struct mprsas_softc), M_MPR, M_WAITOK|M_ZERO); | ||||
if (!sassc) { | if (!sassc) { | ||||
mpr_dprint(sc, MPR_INIT|MPR_ERROR, | mpr_dprint(sc, MPR_INIT|MPR_ERROR, | ||||
"Cannot allocate SAS subsystem memory\n"); | "Cannot allocate SAS subsystem memory\n"); | ||||
Show All 13 Lines | if (!sassc->targets) { | ||||
mpr_dprint(sc, MPR_INIT|MPR_ERROR, | mpr_dprint(sc, MPR_INIT|MPR_ERROR, | ||||
"Cannot allocate SAS target memory\n"); | "Cannot allocate SAS target memory\n"); | ||||
free(sassc, M_MPR); | free(sassc, M_MPR); | ||||
return (ENOMEM); | return (ENOMEM); | ||||
} | } | ||||
sc->sassc = sassc; | sc->sassc = sassc; | ||||
sassc->sc = sc; | sassc->sc = sc; | ||||
if ((sassc->devq = cam_simq_alloc(sc->num_reqs)) == NULL) { | reqs = sc->num_reqs - sc->num_prireqs - 1; | ||||
if ((sassc->devq = cam_simq_alloc(reqs)) == NULL) { | |||||
mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIMQ\n"); | mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIMQ\n"); | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto out; | goto out; | ||||
} | } | ||||
unit = device_get_unit(sc->mpr_dev); | unit = device_get_unit(sc->mpr_dev); | ||||
sassc->sim = cam_sim_alloc(mprsas_action, mprsas_poll, "mpr", sassc, | sassc->sim = cam_sim_alloc(mprsas_action, mprsas_poll, "mpr", sassc, | ||||
unit, &sc->mpr_mtx, sc->num_reqs, sc->num_reqs, sassc->devq); | unit, &sc->mpr_mtx, reqs, reqs, sassc->devq); | ||||
if (sassc->sim == NULL) { | if (sassc->sim == NULL) { | ||||
mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIM\n"); | mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIM\n"); | ||||
error = EINVAL; | error = EINVAL; | ||||
goto out; | goto out; | ||||
} | } | ||||
TAILQ_INIT(&sassc->ev_queue); | TAILQ_INIT(&sassc->ev_queue); | ||||
▲ Show 20 Lines • Show All 3,115 Lines • Show Last 20 Lines |