summaryrefslogtreecommitdiffstats
path: root/sys/dev/mps/mps_sas.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mps/mps_sas.c')
-rw-r--r--sys/dev/mps/mps_sas.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
index 7015f2a..af2e396 100644
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -733,7 +733,7 @@ mps_attach_sas(struct mps_softc *sc)
* of MaxTargets here so that we don't get into trouble later. This
* should move into the reinit logic.
*/
- sassc->maxtargets = sc->facts->MaxTargets;
+ sassc->maxtargets = sc->facts->MaxTargets + sc->facts->MaxVolumes;
sassc->targets = malloc(sizeof(struct mpssas_target) *
sassc->maxtargets, M_MPT2, M_WAITOK|M_ZERO);
if(!sassc->targets) {
@@ -910,6 +910,25 @@ mpssas_discovery_end(struct mpssas_softc *sassc)
if (sassc->flags & MPSSAS_DISCOVERY_TIMEOUT_PENDING)
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) {
+ mps_dprint(sc, MPS_XINFO | MPS_MAPPING, "Discovery has "
+ "completed. Check for missing devices in the mapping "
+ "table.\n");
+ callout_reset(&sc->device_check_callout,
+ MPS_MISSING_CHECK_DELAY * hz, mps_mapping_check_devices,
+ sc);
+ }
}
static void
@@ -942,7 +961,12 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
cpi->hba_eng_cnt = 0;
cpi->max_target = sassc->maxtargets - 1;
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->hba_vid, "Avago Tech", HBA_IDLEN);
strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
OpenPOWER on IntegriCloud