Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/mpr/mpr_sas.c
Show First 20 Lines • Show All 739 Lines • ▼ Show 20 Lines | mpr_attach_sas(struct mpr_softc *sc) | ||||
} | } | ||||
/* | /* | ||||
* XXX MaxTargets could change during a reinit. Since we don't | * XXX MaxTargets could change during a reinit. Since we don't | ||||
* resize the targets[] array during such an event, cache the value | * resize the targets[] array during such an event, cache the value | ||||
* of MaxTargets here so that we don't get into trouble later. This | * of MaxTargets here so that we don't get into trouble later. This | ||||
* should move into the reinit logic. | * should move into the reinit logic. | ||||
*/ | */ | ||||
sassc->maxtargets = sc->facts->MaxTargets; | sassc->maxtargets = sc->facts->MaxTargets + sc->facts->MaxVolumes; | ||||
sassc->targets = malloc(sizeof(struct mprsas_target) * | sassc->targets = malloc(sizeof(struct mprsas_target) * | ||||
sassc->maxtargets, M_MPR, M_WAITOK|M_ZERO); | sassc->maxtargets, M_MPR, M_WAITOK|M_ZERO); | ||||
if (!sassc->targets) { | if (!sassc->targets) { | ||||
device_printf(sc->mpr_dev, "Cannot allocate memory %s %d\n", | device_printf(sc->mpr_dev, "Cannot allocate memory %s %d\n", | ||||
__func__, __LINE__); | __func__, __LINE__); | ||||
free(sassc, M_MPR); | free(sassc, M_MPR); | ||||
return (ENOMEM); | return (ENOMEM); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct mpr_softc *sc = sassc->sc; | struct mpr_softc *sc = sassc->sc; | ||||
MPR_FUNCTRACE(sc); | MPR_FUNCTRACE(sc); | ||||
if (sassc->flags & MPRSAS_DISCOVERY_TIMEOUT_PENDING) | if (sassc->flags & MPRSAS_DISCOVERY_TIMEOUT_PENDING) | ||||
callout_stop(&sassc->discovery_callout); | callout_stop(&sassc->discovery_callout); | ||||
/* | |||||
* After discovery has completed, check the mapping table for any | |||||
* missing devices and update their missing counts. Only do this once | |||||
* whenever the driver is initialized so that missing counts aren't | |||||
* updated unnecessarily. Note that just because discovery has | |||||
* completed doesn't mean that events have been processed yet. The | |||||
* check_devices function is a callout timer that checks if ALL devices | |||||
* are missing. If so, it will wait a little longer for events to | |||||
* complete and keep resetting itself until some device in the mapping | |||||
* table is not missing, meaning that event processing has started. | |||||
*/ | |||||
if (sc->track_mapping_events) { | |||||
mpr_dprint(sc, MPR_XINFO | MPR_MAPPING, "Discovery has " | |||||
"completed. Check for missing devices in the mapping " | |||||
"table.\n"); | |||||
callout_reset(&sc->device_check_callout, | |||||
MPR_MISSING_CHECK_DELAY * hz, mpr_mapping_check_devices, | |||||
sc); | |||||
} | } | ||||
} | |||||
static void | static void | ||||
mprsas_action(struct cam_sim *sim, union ccb *ccb) | mprsas_action(struct cam_sim *sim, union ccb *ccb) | ||||
{ | { | ||||
struct mprsas_softc *sassc; | struct mprsas_softc *sassc; | ||||
sassc = cam_sim_softc(sim); | sassc = cam_sim_softc(sim); | ||||
Show All 16 Lines | #if (__FreeBSD_version >= 1000039) || \ | ||||
((__FreeBSD_version < 1000000) && (__FreeBSD_version >= 902502)) | ((__FreeBSD_version < 1000000) && (__FreeBSD_version >= 902502)) | ||||
cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED | PIM_NOSCAN; | cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED | PIM_NOSCAN; | ||||
#else | #else | ||||
cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED; | cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED; | ||||
#endif | #endif | ||||
cpi->hba_eng_cnt = 0; | cpi->hba_eng_cnt = 0; | ||||
cpi->max_target = sassc->maxtargets - 1; | cpi->max_target = sassc->maxtargets - 1; | ||||
cpi->max_lun = 255; | cpi->max_lun = 255; | ||||
cpi->initiator_id = sassc->maxtargets - 1; | |||||
/* | |||||
* initiator_id is set here to an ID outside the set of valid | |||||
* target IDs (including volumes). | |||||
*/ | |||||
cpi->initiator_id = sassc->maxtargets; | |||||
strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); | strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); | ||||
strlcpy(cpi->hba_vid, "Avago Tech", HBA_IDLEN); | strlcpy(cpi->hba_vid, "Avago Tech", HBA_IDLEN); | ||||
strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); | strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); | ||||
cpi->unit_number = cam_sim_unit(sim); | cpi->unit_number = cam_sim_unit(sim); | ||||
cpi->bus_id = cam_sim_bus(sim); | cpi->bus_id = cam_sim_bus(sim); | ||||
/* | /* | ||||
* XXXSLM-I think this needs to change based on config page or | * XXXSLM-I think this needs to change based on config page or | ||||
* something instead of hardcoded to 150000. | * something instead of hardcoded to 150000. | ||||
▲ Show 20 Lines • Show All 2,978 Lines • Show Last 20 Lines |