git: c60b3057f7d1 - stable/15 - cam/scsi: Add power condition support to START STOP UNIT
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 Oct 2026 07:50:44 UTC
The branch stable/15 has been updated by jaeyoon:
URL: https://cgit.FreeBSD.org/src/commit/?id=c60b3057f7d10868d8ed0218ba2dd76deaa313ce
commit c60b3057f7d10868d8ed0218ba2dd76deaa313ce
Author: Jaeyoon Choi <jaeyoon@FreeBSD.org>
AuthorDate: 2025-12-01 04:39:35 +0000
Commit: Jaeyoon Choi <jaeyoon@FreeBSD.org>
CommitDate: 2026-10-06 06:27:47 +0000
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
(cherry picked from commit 8c35de4982d855950a900483513f341643f6158f)
---
sbin/camcontrol/camcontrol.c | 1 +
sys/cam/cam_periph.c | 1 +
sys/cam/scsi/scsi_all.c | 4 +++-
sys/cam/scsi/scsi_all.h | 3 ++-
sys/cam/scsi/scsi_cd.c | 2 ++
sys/dev/mpr/mpr_sas_lsi.c | 1 +
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 7ad177c3e4b6..73e5a523bd47 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -1026,6 +1026,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 b28ec2671d4a..3b991fc248de 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 1e8dc98d53f4..be6f1c47512a 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -3416,6 +3416,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);
@@ -3444,6 +3445,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);