diff options
| author | Jaeyoon Choi <jaeyoon@FreeBSD.org> | 2025-12-01 04:39:35 +0000 |
|---|---|---|
| committer | Jaeyoon Choi <jaeyoon@FreeBSD.org> | 2025-12-01 04:40:52 +0000 |
| commit | 8c35de4982d855950a900483513f341643f6158f (patch) | |
| tree | 5c86b60cf379154d213597d826ecb26967d38a32 | |
| parent | 5e0d065b5b90d4f4264d8248f39f199f1a2576dc (diff) | |
cam/scsi: Add power condition support to START STOP UNIT
This patch adds a power_condition parameter to the
scsi_start_stop() function and sets the power condition via SSU.
Reviewed by: imp (mentor)
Sponsored by: Samsung Electronic
Differential Revision: https://reviews.freebsd.org/D53922
| -rw-r--r-- | sbin/camcontrol/camcontrol.c | 1 | ||||
| -rw-r--r-- | sys/cam/cam_periph.c | 1 | ||||
| -rw-r--r-- | sys/cam/scsi/scsi_all.c | 4 | ||||
| -rw-r--r-- | sys/cam/scsi/scsi_all.h | 3 | ||||
| -rw-r--r-- | sys/cam/scsi/scsi_cd.c | 2 | ||||
| -rw-r--r-- | sys/dev/mpr/mpr_sas_lsi.c | 1 | ||||
| -rw-r--r-- | sys/dev/mps/mps_sas_lsi.c | 1 |
7 files changed, 11 insertions, 2 deletions
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 15a5d42a2ba5..8da0c97b02a9 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -1024,6 +1024,7 @@ scsistart(struct cam_device *device, int startstop, int loadeject, /* start/stop */ startstop, /* load_eject */ loadeject, /* immediate */ 0, + /* power_condition */ SSS_PC_START_VALID, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 120000); diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 730656684e2a..e485ecff8736 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -1791,6 +1791,7 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **orig, /*start*/TRUE, /*load/eject*/le, /*immediate*/FALSE, + /*power_condition*/SSS_PC_START_VALID, SSD_FULL_SIZE, /*timeout*/50000); break; diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index fd128e69f1f1..168cd17d3965 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -8984,7 +8984,8 @@ void scsi_start_stop(struct ccb_scsiio *csio, uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, int start, int load_eject, - int immediate, uint8_t sense_len, uint32_t timeout) + int immediate, uint8_t power_condition, uint8_t sense_len, + uint32_t timeout) { struct scsi_start_stop_unit *scsi_cmd; int extra_flags = 0; @@ -8999,6 +9000,7 @@ scsi_start_stop(struct ccb_scsiio *csio, uint32_t retries, } if (load_eject != 0) scsi_cmd->how |= SSS_LOEJ; + scsi_cmd->how |= power_condition; if (immediate != 0) scsi_cmd->byte2 |= SSS_IMMED; diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index e50974edac86..fb3ed8ee4458 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -4326,7 +4326,8 @@ void scsi_unmap(struct ccb_scsiio *csio, uint32_t retries, void scsi_start_stop(struct ccb_scsiio *csio, uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, int start, int load_eject, - int immediate, uint8_t sense_len, uint32_t timeout); + int immediate, uint8_t power_condition, uint8_t sense_len, + uint32_t timeout); void scsi_read_attribute(struct ccb_scsiio *csio, uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, uint8_t service_action, diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index e622a96ec77e..bc4634562dc6 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -3406,6 +3406,7 @@ cdstartunit(struct cam_periph *periph, int load) /* start */ TRUE, /* load_eject */ load, /* immediate */ FALSE, + /* power_condition */ SSS_PC_START_VALID, /* sense_len */ SSD_FULL_SIZE, /* timeout */ 50000); @@ -3434,6 +3435,7 @@ cdstopunit(struct cam_periph *periph, uint32_t eject) /* start */ FALSE, /* load_eject */ eject, /* immediate */ FALSE, + /* power_condition */ SSS_PC_START_VALID, /* sense_len */ SSD_FULL_SIZE, /* timeout */ 50000); diff --git a/sys/dev/mpr/mpr_sas_lsi.c b/sys/dev/mpr/mpr_sas_lsi.c index d9744b1054c2..9ba776e49e7a 100644 --- a/sys/dev/mpr/mpr_sas_lsi.c +++ b/sys/dev/mpr/mpr_sas_lsi.c @@ -1517,6 +1517,7 @@ mprsas_SSU_to_SATA_devices(struct mpr_softc *sc, int howto) /*start*/FALSE, /*load/eject*/0, /*immediate*/FALSE, + /*power_condition*/SSS_PC_START_VALID, MPR_SENSE_LEN, /*timeout*/10000); xpt_action(ccb); diff --git a/sys/dev/mps/mps_sas_lsi.c b/sys/dev/mps/mps_sas_lsi.c index e2d1ef2b013a..42119b5c0a43 100644 --- a/sys/dev/mps/mps_sas_lsi.c +++ b/sys/dev/mps/mps_sas_lsi.c @@ -1153,6 +1153,7 @@ mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto) /*start*/FALSE, /*load/eject*/0, /*immediate*/FALSE, + /*power_condition*/SSS_PC_START_VALID, MPS_SENSE_LEN, /*timeout*/10000); xpt_action(ccb); |
