2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2011-2015 LSI Corp.
5 * Copyright (c) 2013-2015 Avago Technologies
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD
32 #include <sys/cdefs.h>
33 __FBSDID("$FreeBSD$");
35 /* Communications core for Avago Technologies (LSI) MPT2 */
37 /* TODO Move headers to mpsvar */
38 #include <sys/types.h>
39 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/kernel.h>
42 #include <sys/selinfo.h>
43 #include <sys/module.h>
47 #include <sys/malloc.h>
49 #include <sys/sysctl.h>
50 #include <sys/endian.h>
52 #include <sys/queue.h>
53 #include <sys/kthread.h>
54 #include <sys/taskqueue.h>
56 #include <sys/reboot.h>
58 #include <machine/bus.h>
59 #include <machine/resource.h>
62 #include <machine/stdarg.h>
65 #include <cam/cam_ccb.h>
66 #include <cam/cam_debug.h>
67 #include <cam/cam_sim.h>
68 #include <cam/cam_xpt_sim.h>
69 #include <cam/cam_xpt_periph.h>
70 #include <cam/cam_periph.h>
71 #include <cam/scsi/scsi_all.h>
72 #include <cam/scsi/scsi_message.h>
74 #include <dev/mps/mpi/mpi2_type.h>
75 #include <dev/mps/mpi/mpi2.h>
76 #include <dev/mps/mpi/mpi2_ioc.h>
77 #include <dev/mps/mpi/mpi2_sas.h>
78 #include <dev/mps/mpi/mpi2_cnfg.h>
79 #include <dev/mps/mpi/mpi2_init.h>
80 #include <dev/mps/mpi/mpi2_raid.h>
81 #include <dev/mps/mpi/mpi2_tool.h>
82 #include <dev/mps/mps_ioctl.h>
83 #include <dev/mps/mpsvar.h>
84 #include <dev/mps/mps_table.h>
85 #include <dev/mps/mps_sas.h>
87 /* For Hashed SAS Address creation for SATA Drives */
88 #define MPT2SAS_SN_LEN 20
89 #define MPT2SAS_MN_LEN 40
91 struct mps_fw_event_work {
94 TAILQ_ENTRY(mps_fw_event_work) ev_link;
97 union _sata_sas_address {
106 * define the IDENTIFY DEVICE structure
108 struct _ata_identify_device_data {
109 u16 reserved1[10]; /* 0-9 */
110 u16 serial_number[10]; /* 10-19 */
111 u16 reserved2[7]; /* 20-26 */
112 u16 model_number[20]; /* 27-46*/
113 u16 reserved3[170]; /* 47-216 */
114 u16 rotational_speed; /* 217 */
115 u16 reserved4[38]; /* 218-255 */
117 static u32 event_count;
118 static void mpssas_fw_work(struct mps_softc *sc,
119 struct mps_fw_event_work *fw_event);
120 static void mpssas_fw_event_free(struct mps_softc *,
121 struct mps_fw_event_work *);
122 static int mpssas_add_device(struct mps_softc *sc, u16 handle, u8 linkrate);
123 static int mpssas_get_sata_identify(struct mps_softc *sc, u16 handle,
124 Mpi2SataPassthroughReply_t *mpi_reply, char *id_buffer, int sz,
126 static void mpssas_ata_id_complete(struct mps_softc *, struct mps_command *);
127 static void mpssas_ata_id_timeout(struct mps_softc *, struct mps_command *);
128 int mpssas_get_sas_address_for_sata_disk(struct mps_softc *sc,
129 u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD);
130 static int mpssas_volume_add(struct mps_softc *sc,
132 static void mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto);
133 static void mpssas_stop_unit_done(struct cam_periph *periph,
134 union ccb *done_ccb);
137 mpssas_evt_handler(struct mps_softc *sc, uintptr_t data,
138 MPI2_EVENT_NOTIFICATION_REPLY *event)
140 struct mps_fw_event_work *fw_event;
143 mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
144 MPS_DPRINT_EVENT(sc, sas, event);
145 mpssas_record_event(sc, event);
147 fw_event = malloc(sizeof(struct mps_fw_event_work), M_MPT2,
150 printf("%s: allocate failed for fw_event\n", __func__);
153 sz = le16toh(event->EventDataLength) * 4;
154 fw_event->event_data = malloc(sz, M_MPT2, M_ZERO|M_NOWAIT);
155 if (!fw_event->event_data) {
156 printf("%s: allocate failed for event_data\n", __func__);
157 free(fw_event, M_MPT2);
161 bcopy(event->EventData, fw_event->event_data, sz);
162 fw_event->event = event->Event;
163 if ((event->Event == MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST ||
164 event->Event == MPI2_EVENT_SAS_ENCL_DEVICE_STATUS_CHANGE ||
165 event->Event == MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST) &&
166 sc->track_mapping_events)
167 sc->pending_map_events++;
170 * When wait_for_port_enable flag is set, make sure that all the events
171 * are processed. Increment the startup_refcount and decrement it after
172 * events are processed.
174 if ((event->Event == MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST ||
175 event->Event == MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST) &&
176 sc->wait_for_port_enable)
177 mpssas_startup_increment(sc->sassc);
179 TAILQ_INSERT_TAIL(&sc->sassc->ev_queue, fw_event, ev_link);
180 taskqueue_enqueue(sc->sassc->ev_tq, &sc->sassc->ev_task);
185 mpssas_fw_event_free(struct mps_softc *sc, struct mps_fw_event_work *fw_event)
188 free(fw_event->event_data, M_MPT2);
189 free(fw_event, M_MPT2);
193 * _mps_fw_work - delayed task for processing firmware events
194 * @sc: per adapter object
195 * @fw_event: The fw_event_work object
201 mpssas_fw_work(struct mps_softc *sc, struct mps_fw_event_work *fw_event)
203 struct mpssas_softc *sassc;
206 mps_dprint(sc, MPS_EVENT, "(%d)->(%s) Working on Event: [%x]\n",
207 event_count++,__func__,fw_event->event);
208 switch (fw_event->event) {
209 case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST:
211 MPI2_EVENT_DATA_SAS_TOPOLOGY_CHANGE_LIST *data;
212 MPI2_EVENT_SAS_TOPO_PHY_ENTRY *phy;
215 data = (MPI2_EVENT_DATA_SAS_TOPOLOGY_CHANGE_LIST *)
216 fw_event->event_data;
218 mps_mapping_topology_change_event(sc, fw_event->event_data);
220 for (i = 0; i < data->NumEntries; i++) {
222 switch (phy->PhyStatus & MPI2_EVENT_SAS_TOPO_RC_MASK) {
223 case MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED:
224 if (mpssas_add_device(sc,
225 le16toh(phy->AttachedDevHandle),
227 mps_dprint(sc, MPS_ERROR, "%s: "
228 "failed to add device with handle "
230 le16toh(phy->AttachedDevHandle));
231 mpssas_prepare_remove(sassc, le16toh(
232 phy->AttachedDevHandle));
235 case MPI2_EVENT_SAS_TOPO_RC_TARG_NOT_RESPONDING:
236 mpssas_prepare_remove(sassc,le16toh(
237 phy->AttachedDevHandle));
239 case MPI2_EVENT_SAS_TOPO_RC_PHY_CHANGED:
240 case MPI2_EVENT_SAS_TOPO_RC_NO_CHANGE:
241 case MPI2_EVENT_SAS_TOPO_RC_DELAY_NOT_RESPONDING:
247 * refcount was incremented for this event in
248 * mpssas_evt_handler. Decrement it here because the event has
251 mpssas_startup_decrement(sassc);
254 case MPI2_EVENT_SAS_DISCOVERY:
256 MPI2_EVENT_DATA_SAS_DISCOVERY *data;
258 data = (MPI2_EVENT_DATA_SAS_DISCOVERY *)fw_event->event_data;
260 if (data->ReasonCode & MPI2_EVENT_SAS_DISC_RC_STARTED)
261 mps_dprint(sc, MPS_TRACE,"SAS discovery start event\n");
262 if (data->ReasonCode & MPI2_EVENT_SAS_DISC_RC_COMPLETED) {
263 mps_dprint(sc, MPS_TRACE,"SAS discovery stop event\n");
264 sassc->flags &= ~MPSSAS_IN_DISCOVERY;
265 mpssas_discovery_end(sassc);
269 case MPI2_EVENT_SAS_ENCL_DEVICE_STATUS_CHANGE:
271 Mpi2EventDataSasEnclDevStatusChange_t *data;
272 data = (Mpi2EventDataSasEnclDevStatusChange_t *)
273 fw_event->event_data;
274 mps_mapping_enclosure_dev_status_change_event(sc,
275 fw_event->event_data);
278 case MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST:
280 Mpi2EventIrConfigElement_t *element;
283 Mpi2EventDataIrConfigChangeList_t *event_data;
284 struct mpssas_target *targ;
287 event_data = fw_event->event_data;
288 foreign_config = (le32toh(event_data->Flags) &
289 MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ? 1 : 0;
292 (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
293 id = mps_mapping_get_raid_tid_from_handle(sc,
294 element->VolDevHandle);
296 mps_mapping_ir_config_change_event(sc, event_data);
298 for (i = 0; i < event_data->NumElements; i++, element++) {
299 switch (element->ReasonCode) {
300 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED:
301 case MPI2_EVENT_IR_CHANGE_RC_ADDED:
302 if (!foreign_config) {
303 if (mpssas_volume_add(sc,
304 le16toh(element->VolDevHandle))){
305 printf("%s: failed to add RAID "
306 "volume with handle 0x%x\n",
307 __func__, le16toh(element->
312 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_DELETED:
313 case MPI2_EVENT_IR_CHANGE_RC_REMOVED:
315 * Rescan after volume is deleted or removed.
317 if (!foreign_config) {
318 if (id == MPS_MAP_BAD_ID) {
319 printf("%s: could not get ID "
320 "for volume with handle "
321 "0x%04x\n", __func__,
322 le16toh(element->VolDevHandle));
326 targ = &sassc->targets[id];
328 targ->encl_slot = 0x0;
329 targ->encl_handle = 0x0;
330 targ->exp_dev_handle = 0x0;
332 targ->linkrate = 0x0;
333 mpssas_rescan_target(sc, targ);
334 printf("RAID target id 0x%x removed\n",
338 case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED:
339 case MPI2_EVENT_IR_CHANGE_RC_HIDE:
341 * Phys Disk of a volume has been created. Hide
344 targ = mpssas_find_target_by_handle(sassc, 0,
345 element->PhysDiskDevHandle);
350 * Set raid component flags only if it is not
351 * WD. OR WrapDrive with
352 * WD_HIDE_ALWAYS/WD_HIDE_IF_VOLUME is set in
355 if((!sc->WD_available) ||
356 ((sc->WD_available &&
357 (sc->WD_hide_expose == MPS_WD_HIDE_ALWAYS)) ||
358 (sc->WD_valid_config && (sc->WD_hide_expose ==
359 MPS_WD_HIDE_IF_VOLUME)))) {
360 targ->flags |= MPS_TARGET_FLAGS_RAID_COMPONENT;
362 mpssas_rescan_target(sc, targ);
365 case MPI2_EVENT_IR_CHANGE_RC_PD_DELETED:
367 * Phys Disk of a volume has been deleted.
368 * Expose it to the OS.
370 if (mpssas_add_device(sc,
371 le16toh(element->PhysDiskDevHandle), 0)){
372 printf("%s: failed to add device with "
373 "handle 0x%x\n", __func__,
374 le16toh(element->PhysDiskDevHandle));
375 mpssas_prepare_remove(sassc, le16toh(element->
382 * refcount was incremented for this event in
383 * mpssas_evt_handler. Decrement it here because the event has
386 mpssas_startup_decrement(sassc);
389 case MPI2_EVENT_IR_VOLUME:
391 Mpi2EventDataIrVolume_t *event_data = fw_event->event_data;
394 * Informational only.
396 mps_dprint(sc, MPS_EVENT, "Received IR Volume event:\n");
397 switch (event_data->ReasonCode) {
398 case MPI2_EVENT_IR_VOLUME_RC_SETTINGS_CHANGED:
399 mps_dprint(sc, MPS_EVENT, " Volume Settings "
400 "changed from 0x%x to 0x%x for Volome with "
401 "handle 0x%x", le32toh(event_data->PreviousValue),
402 le32toh(event_data->NewValue),
403 le16toh(event_data->VolDevHandle));
405 case MPI2_EVENT_IR_VOLUME_RC_STATUS_FLAGS_CHANGED:
406 mps_dprint(sc, MPS_EVENT, " Volume Status "
407 "changed from 0x%x to 0x%x for Volome with "
408 "handle 0x%x", le32toh(event_data->PreviousValue),
409 le32toh(event_data->NewValue),
410 le16toh(event_data->VolDevHandle));
412 case MPI2_EVENT_IR_VOLUME_RC_STATE_CHANGED:
413 mps_dprint(sc, MPS_EVENT, " Volume State "
414 "changed from 0x%x to 0x%x for Volome with "
415 "handle 0x%x", le32toh(event_data->PreviousValue),
416 le32toh(event_data->NewValue),
417 le16toh(event_data->VolDevHandle));
419 struct mpssas_target *targ;
420 state = le32toh(event_data->NewValue);
422 case MPI2_RAID_VOL_STATE_MISSING:
423 case MPI2_RAID_VOL_STATE_FAILED:
424 mpssas_prepare_volume_remove(sassc, event_data->
428 case MPI2_RAID_VOL_STATE_ONLINE:
429 case MPI2_RAID_VOL_STATE_DEGRADED:
430 case MPI2_RAID_VOL_STATE_OPTIMAL:
431 targ = mpssas_find_target_by_handle(sassc, 0, event_data->VolDevHandle);
433 printf("%s %d: Volume handle 0x%x is already added \n",
434 __func__, __LINE__ , event_data->VolDevHandle);
437 if (mpssas_volume_add(sc, le16toh(event_data->VolDevHandle))) {
438 printf("%s: failed to add RAID "
439 "volume with handle 0x%x\n",
440 __func__, le16toh(event_data->
453 case MPI2_EVENT_IR_PHYSICAL_DISK:
455 Mpi2EventDataIrPhysicalDisk_t *event_data =
456 fw_event->event_data;
457 struct mpssas_target *targ;
460 * Informational only.
462 mps_dprint(sc, MPS_EVENT, "Received IR Phys Disk event:\n");
463 switch (event_data->ReasonCode) {
464 case MPI2_EVENT_IR_PHYSDISK_RC_SETTINGS_CHANGED:
465 mps_dprint(sc, MPS_EVENT, " Phys Disk Settings "
466 "changed from 0x%x to 0x%x for Phys Disk Number "
467 "%d and handle 0x%x at Enclosure handle 0x%x, Slot "
468 "%d", le32toh(event_data->PreviousValue),
469 le32toh(event_data->NewValue),
470 event_data->PhysDiskNum,
471 le16toh(event_data->PhysDiskDevHandle),
472 le16toh(event_data->EnclosureHandle), le16toh(event_data->Slot));
474 case MPI2_EVENT_IR_PHYSDISK_RC_STATUS_FLAGS_CHANGED:
475 mps_dprint(sc, MPS_EVENT, " Phys Disk Status changed "
476 "from 0x%x to 0x%x for Phys Disk Number %d and "
477 "handle 0x%x at Enclosure handle 0x%x, Slot %d",
478 le32toh(event_data->PreviousValue),
479 le32toh(event_data->NewValue), event_data->PhysDiskNum,
480 le16toh(event_data->PhysDiskDevHandle),
481 le16toh(event_data->EnclosureHandle), le16toh(event_data->Slot));
483 case MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED:
484 mps_dprint(sc, MPS_EVENT, " Phys Disk State changed "
485 "from 0x%x to 0x%x for Phys Disk Number %d and "
486 "handle 0x%x at Enclosure handle 0x%x, Slot %d",
487 le32toh(event_data->PreviousValue),
488 le32toh(event_data->NewValue), event_data->PhysDiskNum,
489 le16toh(event_data->PhysDiskDevHandle),
490 le16toh(event_data->EnclosureHandle), le16toh(event_data->Slot));
491 switch (event_data->NewValue) {
492 case MPI2_RAID_PD_STATE_ONLINE:
493 case MPI2_RAID_PD_STATE_DEGRADED:
494 case MPI2_RAID_PD_STATE_REBUILDING:
495 case MPI2_RAID_PD_STATE_OPTIMAL:
496 case MPI2_RAID_PD_STATE_HOT_SPARE:
497 targ = mpssas_find_target_by_handle(sassc, 0,
498 event_data->PhysDiskDevHandle);
500 if(!sc->WD_available) {
501 targ->flags |= MPS_TARGET_FLAGS_RAID_COMPONENT;
502 printf("%s %d: Found Target for handle 0x%x. \n",
503 __func__, __LINE__ , event_data->PhysDiskDevHandle);
504 } else if ((sc->WD_available &&
505 (sc->WD_hide_expose == MPS_WD_HIDE_ALWAYS)) ||
506 (sc->WD_valid_config && (sc->WD_hide_expose ==
507 MPS_WD_HIDE_IF_VOLUME))) {
508 targ->flags |= MPS_TARGET_FLAGS_RAID_COMPONENT;
509 printf("%s %d: WD: Found Target for handle 0x%x. \n",
510 __func__, __LINE__ , event_data->PhysDiskDevHandle);
514 case MPI2_RAID_PD_STATE_OFFLINE:
515 case MPI2_RAID_PD_STATE_NOT_CONFIGURED:
516 case MPI2_RAID_PD_STATE_NOT_COMPATIBLE:
518 targ = mpssas_find_target_by_handle(sassc, 0,
519 event_data->PhysDiskDevHandle);
521 targ->flags |= ~MPS_TARGET_FLAGS_RAID_COMPONENT;
522 printf("%s %d: Found Target for handle 0x%x. \n",
523 __func__, __LINE__ , event_data->PhysDiskDevHandle);
532 case MPI2_EVENT_IR_OPERATION_STATUS:
534 Mpi2EventDataIrOperationStatus_t *event_data =
535 fw_event->event_data;
538 * Informational only.
540 mps_dprint(sc, MPS_EVENT, "Received IR Op Status event:\n");
541 mps_dprint(sc, MPS_EVENT, " RAID Operation of %d is %d "
542 "percent complete for Volume with handle 0x%x",
543 event_data->RAIDOperation, event_data->PercentComplete,
544 le16toh(event_data->VolDevHandle));
547 case MPI2_EVENT_LOG_ENTRY_ADDED:
549 pMpi2EventDataLogEntryAdded_t logEntry;
550 uint16_t logQualifier;
553 logEntry = (pMpi2EventDataLogEntryAdded_t)fw_event->event_data;
554 logQualifier = logEntry->LogEntryQualifier;
556 if (logQualifier == MPI2_WD_LOG_ENTRY) {
557 logCode = logEntry->LogData[0];
560 case MPI2_WD_SSD_THROTTLING:
561 printf("WarpDrive Warning: IO Throttling has "
562 "occurred in the WarpDrive subsystem. "
563 "Check WarpDrive documentation for "
564 "additional details\n");
566 case MPI2_WD_DRIVE_LIFE_WARN:
567 printf("WarpDrive Warning: Program/Erase "
568 "Cycles for the WarpDrive subsystem in "
569 "degraded range. Check WarpDrive "
570 "documentation for additional details\n");
572 case MPI2_WD_DRIVE_LIFE_DEAD:
573 printf("WarpDrive Fatal Error: There are no "
574 "Program/Erase Cycles for the WarpDrive "
575 "subsystem. The storage device will be in "
576 "read-only mode. Check WarpDrive "
577 "documentation for additional details\n");
579 case MPI2_WD_RAIL_MON_FAIL:
580 printf("WarpDrive Fatal Error: The Backup Rail "
581 "Monitor has failed on the WarpDrive "
582 "subsystem. Check WarpDrive documentation "
583 "for additional details\n");
591 case MPI2_EVENT_SAS_DEVICE_STATUS_CHANGE:
592 case MPI2_EVENT_SAS_BROADCAST_PRIMITIVE:
594 mps_dprint(sc, MPS_TRACE,"Unhandled event 0x%0X\n",
598 mps_dprint(sc, MPS_EVENT, "(%d)->(%s) Event Free: [%x]\n",event_count,__func__, fw_event->event);
599 mpssas_fw_event_free(sc, fw_event);
603 mpssas_firmware_event_work(void *arg, int pending)
605 struct mps_fw_event_work *fw_event;
606 struct mps_softc *sc;
608 sc = (struct mps_softc *)arg;
610 while ((fw_event = TAILQ_FIRST(&sc->sassc->ev_queue)) != NULL) {
611 TAILQ_REMOVE(&sc->sassc->ev_queue, fw_event, ev_link);
612 mpssas_fw_work(sc, fw_event);
618 mpssas_add_device(struct mps_softc *sc, u16 handle, u8 linkrate){
620 struct mpssas_softc *sassc;
621 struct mpssas_target *targ;
622 Mpi2ConfigReply_t mpi_reply;
623 Mpi2SasDevicePage0_t config_page;
624 uint64_t sas_address;
625 uint64_t parent_sas_address = 0;
626 u32 device_info, parent_devinfo = 0;
628 int ret = 1, error = 0, i;
629 struct mpssas_lun *lun;
631 struct mps_command *cm;
634 mpssas_startup_increment(sassc);
635 if (mps_config_get_sas_device_pg0(sc, &mpi_reply, &config_page,
636 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle) != 0) {
637 mps_dprint(sc, MPS_INFO|MPS_MAPPING|MPS_FAULT,
638 "Error reading SAS device %#x page0, iocstatus= 0x%x\n",
639 handle, mpi_reply.IOCStatus);
644 device_info = le32toh(config_page.DeviceInfo);
646 if (((device_info & MPI2_SAS_DEVICE_INFO_SMP_TARGET) == 0)
647 && (le16toh(config_page.ParentDevHandle) != 0)) {
648 Mpi2ConfigReply_t tmp_mpi_reply;
649 Mpi2SasDevicePage0_t parent_config_page;
651 if (mps_config_get_sas_device_pg0(sc, &tmp_mpi_reply,
652 &parent_config_page, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
653 le16toh(config_page.ParentDevHandle)) != 0) {
654 mps_dprint(sc, MPS_MAPPING|MPS_FAULT,
655 "Error reading parent SAS device %#x page0, "
657 le16toh(config_page.ParentDevHandle),
658 tmp_mpi_reply.IOCStatus);
660 parent_sas_address = parent_config_page.SASAddress.High;
661 parent_sas_address = (parent_sas_address << 32) |
662 parent_config_page.SASAddress.Low;
663 parent_devinfo = le32toh(parent_config_page.DeviceInfo);
666 /* TODO Check proper endianness */
667 sas_address = config_page.SASAddress.High;
668 sas_address = (sas_address << 32) | config_page.SASAddress.Low;
669 mps_dprint(sc, MPS_MAPPING, "Handle 0x%04x SAS Address from SAS device "
670 "page0 = %jx\n", handle, sas_address);
673 * Always get SATA Identify information because this is used to
674 * determine if Start/Stop Unit should be sent to the drive when the
675 * system is shutdown.
677 if (device_info & MPI2_SAS_DEVICE_INFO_SATA_DEVICE) {
678 ret = mpssas_get_sas_address_for_sata_disk(sc, &sas_address,
679 handle, device_info, &is_SATA_SSD);
681 mps_dprint(sc, MPS_MAPPING|MPS_ERROR,
682 "%s: failed to get disk type (SSD or HDD) for SATA "
683 "device with handle 0x%04x\n",
686 mps_dprint(sc, MPS_MAPPING, "Handle 0x%04x SAS Address "
687 "from SATA device = %jx\n", handle, sas_address);
693 * 1 - use the PhyNum field as a fallback to the mapping logic
694 * 0 - never use the PhyNum field
695 * -1 - only use the PhyNum field
697 * Note that using the Phy number to map a device can cause device adds
698 * to fail if multiple enclosures/expanders are in the topology. For
699 * example, if two devices are in the same slot number in two different
700 * enclosures within the topology, only one of those devices will be
701 * added. PhyNum mapping should not be used if multiple enclosures are
705 if (sc->use_phynum != -1)
706 id = mps_mapping_get_tid(sc, sas_address, handle);
707 if (id == MPS_MAP_BAD_ID) {
708 if ((sc->use_phynum == 0)
709 || ((id = config_page.PhyNum) > sassc->maxtargets)) {
710 mps_dprint(sc, MPS_INFO, "failure at %s:%d/%s()! "
711 "Could not get ID for device with handle 0x%04x\n",
712 __FILE__, __LINE__, __func__, handle);
717 mps_dprint(sc, MPS_MAPPING, "%s: Target ID for added device is %d.\n",
721 * Only do the ID check and reuse check if the target is not from a
722 * RAID Component. For Physical Disks of a Volume, the ID will be reused
723 * when a volume is deleted because the mapping entry for the PD will
724 * still be in the mapping table. The ID check should not be done here
725 * either since this PD is already being used.
727 targ = &sassc->targets[id];
728 if (!(targ->flags & MPS_TARGET_FLAGS_RAID_COMPONENT)) {
729 if (mpssas_check_id(sassc, id) != 0) {
730 mps_dprint(sc, MPS_MAPPING|MPS_INFO,
731 "Excluding target id %d\n", id);
736 if (targ->handle != 0x0) {
737 mps_dprint(sc, MPS_MAPPING, "Attempting to reuse "
738 "target id %d handle 0x%04x\n", id, targ->handle);
744 targ->devinfo = device_info;
745 targ->devname = le32toh(config_page.DeviceName.High);
746 targ->devname = (targ->devname << 32) |
747 le32toh(config_page.DeviceName.Low);
748 targ->encl_handle = le16toh(config_page.EnclosureHandle);
749 targ->encl_slot = le16toh(config_page.Slot);
750 targ->handle = handle;
751 targ->parent_handle = le16toh(config_page.ParentDevHandle);
752 targ->sasaddr = mps_to_u64(&config_page.SASAddress);
753 targ->parent_sasaddr = le64toh(parent_sas_address);
754 targ->parent_devinfo = parent_devinfo;
756 targ->linkrate = (linkrate>>4);
759 targ->flags = MPS_TARGET_IS_SATA_SSD;
761 TAILQ_INIT(&targ->commands);
762 TAILQ_INIT(&targ->timedout_commands);
763 while(!SLIST_EMPTY(&targ->luns)) {
764 lun = SLIST_FIRST(&targ->luns);
765 SLIST_REMOVE_HEAD(&targ->luns, lun_link);
768 SLIST_INIT(&targ->luns);
770 mps_describe_devinfo(targ->devinfo, devstring, 80);
771 mps_dprint(sc, MPS_MAPPING, "Found device <%s> <%s> <0x%04x> <%d/%d>\n",
772 devstring, mps_describe_table(mps_linkrate_names, targ->linkrate),
773 targ->handle, targ->encl_handle, targ->encl_slot);
775 mpssas_rescan_target(sc, targ);
776 mps_dprint(sc, MPS_MAPPING, "Target id 0x%x added\n", targ->tid);
779 * Check all commands to see if the SATA_ID_TIMEOUT flag has been set.
780 * If so, send a Target Reset TM to the target that was just created.
781 * An Abort Task TM should be used instead of a Target Reset, but that
782 * would be much more difficult because targets have not been fully
783 * discovered yet, and LUN's haven't been setup. So, just reset the
784 * target instead of the LUN. The commands should complete once the
785 * target has been reset.
787 for (i = 1; i < sc->num_reqs; i++) {
788 cm = &sc->commands[i];
789 if (cm->cm_flags & MPS_CM_FLAGS_SATA_ID_TIMEOUT) {
791 cm->cm_flags |= MPS_CM_FLAGS_TIMEDOUT;
793 if ((targ->tm = mpssas_alloc_tm(sc)) != NULL) {
794 mps_dprint(sc, MPS_INFO, "%s: sending Target "
795 "Reset for stuck SATA identify command "
796 "(cm = %p)\n", __func__, cm);
797 targ->tm->cm_targ = targ;
798 mpssas_send_reset(sc, targ->tm,
799 MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET);
801 mps_dprint(sc, MPS_ERROR, "Failed to allocate "
802 "tm for Target Reset after SATA ID command "
803 "timed out (cm %p)\n", cm);
806 * No need to check for more since the target is
807 * already being reset.
813 mpssas_startup_decrement(sassc);
818 mpssas_get_sas_address_for_sata_disk(struct mps_softc *sc,
819 u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD)
821 Mpi2SataPassthroughReply_t mpi_reply;
822 int i, rc, try_count;
824 union _sata_sas_address hash_address;
825 struct _ata_identify_device_data ata_identify;
826 u8 buffer[MPT2SAS_MN_LEN + MPT2SAS_SN_LEN];
830 memset(&ata_identify, 0, sizeof(ata_identify));
833 rc = mpssas_get_sata_identify(sc, handle, &mpi_reply,
834 (char *)&ata_identify, sizeof(ata_identify), device_info);
836 ioc_status = le16toh(mpi_reply.IOCStatus)
837 & MPI2_IOCSTATUS_MASK;
838 sas_status = mpi_reply.SASStatus;
839 switch (ioc_status) {
840 case MPI2_IOCSTATUS_SUCCESS:
842 case MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR:
843 /* No sense sleeping. this error won't get better */
846 if (sc->spinup_wait_time > 0) {
847 mps_dprint(sc, MPS_INFO, "Sleeping %d seconds "
848 "after SATA ID error to wait for spinup\n",
849 sc->spinup_wait_time);
850 msleep(&sc->msleep_fake_chan, &sc->mps_mtx, 0,
851 "mpsid", sc->spinup_wait_time * hz);
854 } while (((rc && (rc != EWOULDBLOCK)) ||
856 (ioc_status != MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR))
857 || sas_status) && (try_count < 5));
859 if (rc == 0 && !ioc_status && !sas_status) {
860 mps_dprint(sc, MPS_MAPPING, "%s: got SATA identify "
861 "successfully for handle = 0x%x with try_count = %d\n",
862 __func__, handle, try_count);
864 mps_dprint(sc, MPS_MAPPING, "%s: handle = 0x%x failed\n",
868 /* Copy & byteswap the 40 byte model number to a buffer */
869 for (i = 0; i < MPT2SAS_MN_LEN; i += 2) {
870 buffer[i] = ((u8 *)ata_identify.model_number)[i + 1];
871 buffer[i + 1] = ((u8 *)ata_identify.model_number)[i];
873 /* Copy & byteswap the 20 byte serial number to a buffer */
874 for (i = 0; i < MPT2SAS_SN_LEN; i += 2) {
875 buffer[MPT2SAS_MN_LEN + i] =
876 ((u8 *)ata_identify.serial_number)[i + 1];
877 buffer[MPT2SAS_MN_LEN + i + 1] =
878 ((u8 *)ata_identify.serial_number)[i];
880 bufferptr = (u32 *)buffer;
881 /* There are 60 bytes to hash down to 8. 60 isn't divisible by 8,
882 * so loop through the first 56 bytes (7*8),
883 * and then add in the last dword.
885 hash_address.word.low = 0;
886 hash_address.word.high = 0;
887 for (i = 0; (i < ((MPT2SAS_MN_LEN+MPT2SAS_SN_LEN)/8)); i++) {
888 hash_address.word.low += *bufferptr;
890 hash_address.word.high += *bufferptr;
893 /* Add the last dword */
894 hash_address.word.low += *bufferptr;
895 /* Make sure the hash doesn't start with 5, because it could clash
896 * with a SAS address. Change 5 to a D.
898 if ((hash_address.word.high & 0x000000F0) == (0x00000050))
899 hash_address.word.high |= 0x00000080;
900 *sas_address = (u64)hash_address.wwid[0] << 56 |
901 (u64)hash_address.wwid[1] << 48 | (u64)hash_address.wwid[2] << 40 |
902 (u64)hash_address.wwid[3] << 32 | (u64)hash_address.wwid[4] << 24 |
903 (u64)hash_address.wwid[5] << 16 | (u64)hash_address.wwid[6] << 8 |
904 (u64)hash_address.wwid[7];
905 if (ata_identify.rotational_speed == 1) {
913 mpssas_get_sata_identify(struct mps_softc *sc, u16 handle,
914 Mpi2SataPassthroughReply_t *mpi_reply, char *id_buffer, int sz, u32 devinfo)
916 Mpi2SataPassthroughRequest_t *mpi_request;
917 Mpi2SataPassthroughReply_t *reply = NULL;
918 struct mps_command *cm;
922 buffer = malloc( sz, M_MPT2, M_NOWAIT | M_ZERO);
926 if ((cm = mps_alloc_command(sc)) == NULL) {
927 free(buffer, M_MPT2);
930 mpi_request = (MPI2_SATA_PASSTHROUGH_REQUEST *)cm->cm_req;
931 bzero(mpi_request,sizeof(MPI2_SATA_PASSTHROUGH_REQUEST));
932 mpi_request->Function = MPI2_FUNCTION_SATA_PASSTHROUGH;
933 mpi_request->VF_ID = 0;
934 mpi_request->DevHandle = htole16(handle);
935 mpi_request->PassthroughFlags = (MPI2_SATA_PT_REQ_PT_FLAGS_PIO |
936 MPI2_SATA_PT_REQ_PT_FLAGS_READ);
937 mpi_request->DataLength = htole32(sz);
938 mpi_request->CommandFIS[0] = 0x27;
939 mpi_request->CommandFIS[1] = 0x80;
940 mpi_request->CommandFIS[2] = (devinfo &
941 MPI2_SAS_DEVICE_INFO_ATAPI_DEVICE) ? 0xA1 : 0xEC;
942 cm->cm_sge = &mpi_request->SGL;
943 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION);
944 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN;
945 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
946 cm->cm_data = buffer;
947 cm->cm_length = htole32(sz);
950 * Use a custom handler to avoid reinit'ing the controller on timeout.
951 * This fixes a problem where the FW does not send a reply sometimes
952 * when a bad disk is in the topology. So, this is used to timeout the
953 * command so that processing can continue normally.
955 cm->cm_timeout_handler = mpssas_ata_id_timeout;
957 error = mps_wait_command(sc, &cm, MPS_ATA_ID_TIMEOUT, CAN_SLEEP);
959 /* mpssas_ata_id_timeout does not reset controller */
960 KASSERT(cm != NULL, ("%s: surprise command freed", __func__));
962 reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply;
963 if (error || (reply == NULL)) {
966 * If the request returns an error then we need to do a diag
969 mps_dprint(sc, MPS_INFO|MPS_FAULT|MPS_MAPPING,
970 "Request for SATA PASSTHROUGH page completed with error %d\n",
975 bcopy(buffer, id_buffer, sz);
976 bcopy(reply, mpi_reply, sizeof(Mpi2SataPassthroughReply_t));
977 if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) !=
978 MPI2_IOCSTATUS_SUCCESS) {
979 mps_dprint(sc, MPS_INFO|MPS_MAPPING|MPS_FAULT,
980 "Error reading device %#x SATA PASSTHRU; iocstatus= 0x%x\n",
981 handle, reply->IOCStatus);
987 * If the SATA_ID_TIMEOUT flag has been set for this command, don't free
988 * it. The command and buffer will be freed after we send a Target
989 * Reset TM and the command comes back from the controller.
991 if ((cm->cm_flags & MPS_CM_FLAGS_SATA_ID_TIMEOUT) == 0) {
992 mps_free_command(sc, cm);
993 free(buffer, M_MPT2);
999 * This is completion handler to make sure that commands and allocated
1000 * buffers get freed when timed out SATA ID commands finally complete after
1001 * we've reset the target. In the normal case, we wait for the command to
1005 mpssas_ata_id_complete(struct mps_softc *sc, struct mps_command *cm)
1007 mps_dprint(sc, MPS_INFO, "%s ATA ID completed late cm %p sc %p\n",
1010 free(cm->cm_data, M_MPT2);
1011 mps_free_command(sc, cm);
1016 mpssas_ata_id_timeout(struct mps_softc *sc, struct mps_command *cm)
1018 mps_dprint(sc, MPS_INFO, "%s ATA ID command timeout cm %p sc %p\n",
1022 * The Abort Task cannot be sent from here because the driver has not
1023 * completed setting up targets. Instead, the command is flagged so
1024 * that special handling will be used to send a target reset.
1026 cm->cm_flags |= MPS_CM_FLAGS_SATA_ID_TIMEOUT;
1029 * Since we will no longer be waiting for the command to complete,
1030 * set a completion handler to make sure we free all resources.
1032 cm->cm_complete = mpssas_ata_id_complete;
1036 mpssas_volume_add(struct mps_softc *sc, u16 handle)
1038 struct mpssas_softc *sassc;
1039 struct mpssas_target *targ;
1043 struct mpssas_lun *lun;
1046 mpssas_startup_increment(sassc);
1047 /* wwid is endian safe */
1048 mps_config_get_volume_wwid(sc, handle, &wwid);
1050 printf("%s: invalid WWID; cannot add volume to mapping table\n",
1056 id = mps_mapping_get_raid_tid(sc, wwid, handle);
1057 if (id == MPS_MAP_BAD_ID) {
1058 printf("%s: could not get ID for volume with handle 0x%04x and "
1059 "WWID 0x%016llx\n", __func__, handle,
1060 (unsigned long long)wwid);
1065 targ = &sassc->targets[id];
1067 targ->handle = handle;
1068 targ->devname = wwid;
1069 TAILQ_INIT(&targ->commands);
1070 TAILQ_INIT(&targ->timedout_commands);
1071 while(!SLIST_EMPTY(&targ->luns)) {
1072 lun = SLIST_FIRST(&targ->luns);
1073 SLIST_REMOVE_HEAD(&targ->luns, lun_link);
1076 SLIST_INIT(&targ->luns);
1077 mpssas_rescan_target(sc, targ);
1078 mps_dprint(sc, MPS_MAPPING, "RAID target id %d added (WWID = 0x%jx)\n",
1081 mpssas_startup_decrement(sassc);
1086 * mpssas_SSU_to_SATA_devices
1087 * @sc: per adapter object
1088 * @howto: mast of RB_* bits for how we're rebooting
1090 * Looks through the target list and issues a StartStopUnit SCSI command to each
1091 * SATA direct-access device. This helps to ensure that data corruption is
1092 * avoided when the system is being shut down. This must be called after the IR
1093 * System Shutdown RAID Action is sent if in IR mode.
1098 mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto)
1100 struct mpssas_softc *sassc = sc->sassc;
1102 path_id_t pathid = cam_sim_path(sassc->sim);
1103 target_id_t targetid;
1104 struct mpssas_target *target;
1109 * For each target, issue a StartStopUnit command to stop the device.
1111 sc->SSU_started = TRUE;
1112 sc->SSU_refcount = 0;
1113 for (targetid = 0; targetid < sc->max_devices; targetid++) {
1114 target = &sassc->targets[targetid];
1115 if (target->handle == 0x0) {
1119 ccb = xpt_alloc_ccb_nowait();
1121 mps_dprint(sc, MPS_FAULT, "Unable to alloc CCB to stop "
1127 * The stop_at_shutdown flag will be set if this device is
1128 * a SATA direct-access end device.
1130 if (target->stop_at_shutdown) {
1131 if (xpt_create_path(&ccb->ccb_h.path,
1132 xpt_periph, pathid, targetid,
1133 CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
1134 mps_dprint(sc, MPS_FAULT, "Unable to create "
1135 "LUN path to stop unit.\n");
1139 xpt_path_string(ccb->ccb_h.path, path_str,
1142 mps_dprint(sc, MPS_INFO, "Sending StopUnit: path %s "
1143 "handle %d\n", path_str, target->handle);
1146 * Issue a START STOP UNIT command for the target.
1147 * Increment the SSU counter to be used to count the
1148 * number of required replies.
1150 mps_dprint(sc, MPS_INFO, "Incrementing SSU count\n");
1152 ccb->ccb_h.target_id =
1153 xpt_path_target_id(ccb->ccb_h.path);
1154 ccb->ccb_h.ppriv_ptr1 = sassc;
1155 scsi_start_stop(&ccb->csio,
1157 mpssas_stop_unit_done,
1169 * Timeout after 60 seconds by default or 10 seconds if howto has
1170 * RB_NOSYNC set which indicates we're likely handling a panic.
1173 if (howto & RB_NOSYNC)
1177 * Wait until all of the SSU commands have completed or timeout has
1178 * expired. Pause for 100ms each time through. If any command
1179 * times out, the target will be reset in the SCSI command timeout
1182 while (sc->SSU_refcount > 0) {
1183 pause("mpswait", hz/10);
1184 if (SCHEDULER_STOPPED())
1185 xpt_sim_poll(sassc->sim);
1187 if (--timeout == 0) {
1188 mps_dprint(sc, MPS_FAULT, "Time has expired waiting "
1189 "for SSU commands to complete.\n");
1196 mpssas_stop_unit_done(struct cam_periph *periph, union ccb *done_ccb)
1198 struct mpssas_softc *sassc;
1201 if (done_ccb == NULL)
1204 sassc = (struct mpssas_softc *)done_ccb->ccb_h.ppriv_ptr1;
1206 xpt_path_string(done_ccb->ccb_h.path, path_str, sizeof(path_str));
1207 mps_dprint(sassc->sc, MPS_INFO, "Completing stop unit for %s\n",
1211 * Nothing more to do except free the CCB and path. If the command
1212 * timed out, an abort reset, then target reset will be issued during
1213 * the SCSI Command process.
1215 xpt_free_path(done_ccb->ccb_h.path);
1216 xpt_free_ccb(done_ccb);
1220 * mpssas_ir_shutdown - IR shutdown notification
1221 * @sc: per adapter object
1222 * @howto: mast of RB_* bits for how we're rebooting
1224 * Sending RAID Action to alert the Integrated RAID subsystem of the IOC that
1225 * the host system is shutting down.
1230 mpssas_ir_shutdown(struct mps_softc *sc, int howto)
1232 u16 volume_mapping_flags;
1233 u16 ioc_pg8_flags = le16toh(sc->ioc_pg8.Flags);
1234 struct dev_mapping_table *mt_entry;
1235 u32 start_idx, end_idx;
1236 unsigned int id, found_volume = 0;
1237 struct mps_command *cm;
1238 Mpi2RaidActionRequest_t *action;
1239 target_id_t targetid;
1240 struct mpssas_target *target;
1242 mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
1244 /* is IR firmware build loaded? */
1245 if (!sc->ir_firmware)
1248 /* are there any volumes? Look at IR target IDs. */
1249 // TODO-later, this should be looked up in the RAID config structure
1250 // when it is implemented.
1251 volume_mapping_flags = le16toh(sc->ioc_pg8.IRVolumeMappingFlags) &
1252 MPI2_IOCPAGE8_IRFLAGS_MASK_VOLUME_MAPPING_MODE;
1253 if (volume_mapping_flags == MPI2_IOCPAGE8_IRFLAGS_LOW_VOLUME_MAPPING) {
1255 if (ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_RESERVED_TARGETID_0)
1258 start_idx = sc->max_devices - sc->max_volumes;
1259 end_idx = start_idx + sc->max_volumes - 1;
1261 for (id = start_idx; id < end_idx; id++) {
1262 mt_entry = &sc->mapping_table[id];
1263 if ((mt_entry->physical_id != 0) &&
1264 (mt_entry->missing_count == 0)) {
1273 if ((cm = mps_alloc_command(sc)) == NULL) {
1274 printf("%s: command alloc failed\n", __func__);
1278 action = (MPI2_RAID_ACTION_REQUEST *)cm->cm_req;
1279 action->Function = MPI2_FUNCTION_RAID_ACTION;
1280 action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
1281 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
1283 mps_wait_command(sc, &cm, 5, CAN_SLEEP);
1287 * Don't check for reply, just leave.
1290 mps_free_command(sc, cm);
1294 * All of the targets must have the correct value set for
1295 * 'stop_at_shutdown' for the current 'enable_ssu' sysctl variable.
1297 * The possible values for the 'enable_ssu' variable are:
1298 * 0: disable to SSD and HDD
1299 * 1: disable only to HDD (default)
1300 * 2: disable only to SSD
1301 * 3: enable to SSD and HDD
1302 * anything else will default to 1.
1304 for (targetid = 0; targetid < sc->max_devices; targetid++) {
1305 target = &sc->sassc->targets[targetid];
1306 if (target->handle == 0x0) {
1310 if (target->supports_SSU) {
1311 switch (sc->enable_ssu) {
1312 case MPS_SSU_DISABLE_SSD_DISABLE_HDD:
1313 target->stop_at_shutdown = FALSE;
1315 case MPS_SSU_DISABLE_SSD_ENABLE_HDD:
1316 target->stop_at_shutdown = TRUE;
1317 if (target->flags & MPS_TARGET_IS_SATA_SSD) {
1318 target->stop_at_shutdown = FALSE;
1321 case MPS_SSU_ENABLE_SSD_ENABLE_HDD:
1322 target->stop_at_shutdown = TRUE;
1324 case MPS_SSU_ENABLE_SSD_DISABLE_HDD:
1326 target->stop_at_shutdown = TRUE;
1327 if ((target->flags &
1328 MPS_TARGET_IS_SATA_SSD) == 0) {
1329 target->stop_at_shutdown = FALSE;
1335 mpssas_SSU_to_SATA_devices(sc, howto);