git: 5e2782d26567 - stable/15 - cam/scsi: Restore scsi_start_stop() and add scsi_start_stop_pc()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 Oct 2026 07:50:54 UTC
The branch stable/15 has been updated by jaeyoon:
URL: https://cgit.FreeBSD.org/src/commit/?id=5e2782d26567a4d8d558ca05800855c7fc217e35
commit 5e2782d26567a4d8d558ca05800855c7fc217e35
Author: Jaeyoon Choi <jaeyoon@FreeBSD.org>
AuthorDate: 2026-01-26 06:29:28 +0000
Commit: Jaeyoon Choi <jaeyoon@FreeBSD.org>
CommitDate: 2026-10-06 06:27:51 +0000
cam/scsi: Restore scsi_start_stop() and add scsi_start_stop_pc()
Revert the argument change that broke libcam in 8c35de49 and move
power_condition support to scsi_start_stop_pc().
Reported by: imp
Reviewed By: #cam, imp (mentor)
Sponsored by: Samsung Electronics
Differential Revision: https://reviews.freebsd.org/D54822
(cherry picked from commit 8ef8c6abfadfc9eb0465ce57c6b09ca310415bdd)
---
sbin/camcontrol/camcontrol.c | 1 -
sys/cam/cam_periph.c | 1 -
sys/cam/scsi/scsi_all.c | 34 ++++++++++++++++++++++++++++++++++
sys/cam/scsi/scsi_all.h | 4 ++++
sys/cam/scsi/scsi_cd.c | 2 --
sys/dev/mpr/mpr_sas_lsi.c | 1 -
sys/dev/mps/mps_sas_lsi.c | 1 -
sys/dev/ufshci/ufshci_sim.c | 2 +-
8 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 73e5a523bd47..7ad177c3e4b6 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -1026,7 +1026,6 @@ 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 e485ecff8736..730656684e2a 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -1791,7 +1791,6 @@ 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 3b991fc248de..2acf091270a6 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -8982,6 +8982,40 @@ scsi_write_buffer(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)
+{
+ struct scsi_start_stop_unit *scsi_cmd;
+ int extra_flags = 0;
+
+ scsi_cmd = (struct scsi_start_stop_unit *)&csio->cdb_io.cdb_bytes;
+ bzero(scsi_cmd, sizeof(*scsi_cmd));
+ scsi_cmd->opcode = START_STOP_UNIT;
+ if (start != 0) {
+ scsi_cmd->how |= SSS_START;
+ /* it takes a lot of power to start a drive */
+ extra_flags |= CAM_HIGH_POWER;
+ }
+ if (load_eject != 0)
+ scsi_cmd->how |= SSS_LOEJ;
+ if (immediate != 0)
+ scsi_cmd->byte2 |= SSS_IMMED;
+
+ cam_fill_csio(csio,
+ retries,
+ cbfcnp,
+ /*flags*/CAM_DIR_NONE | extra_flags,
+ tag_action,
+ /*data_ptr*/NULL,
+ /*dxfer_len*/0,
+ sense_len,
+ sizeof(*scsi_cmd),
+ timeout);
+}
+
+void
+scsi_start_stop_pc(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 power_condition, uint8_t sense_len,
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h
index fb3ed8ee4458..0d4354538c2c 100644
--- a/sys/cam/scsi/scsi_all.h
+++ b/sys/cam/scsi/scsi_all.h
@@ -4324,6 +4324,10 @@ void scsi_unmap(struct ccb_scsiio *csio, uint32_t retries,
uint8_t sense_len, uint32_t timeout);
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);
+void scsi_start_stop_pc(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 power_condition, uint8_t sense_len,
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index be6f1c47512a..1e8dc98d53f4 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -3416,7 +3416,6 @@ 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);
@@ -3445,7 +3444,6 @@ 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 9ba776e49e7a..d9744b1054c2 100644
--- a/sys/dev/mpr/mpr_sas_lsi.c
+++ b/sys/dev/mpr/mpr_sas_lsi.c
@@ -1517,7 +1517,6 @@ 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 42119b5c0a43..e2d1ef2b013a 100644
--- a/sys/dev/mps/mps_sas_lsi.c
+++ b/sys/dev/mps/mps_sas_lsi.c
@@ -1153,7 +1153,6 @@ 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);
diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c
index bee1fff858ff..404f3e99d1e2 100644
--- a/sys/dev/ufshci/ufshci_sim.c
+++ b/sys/dev/ufshci/ufshci_sim.c
@@ -494,7 +494,7 @@ ufshci_sim_send_ssu(struct ufshci_controller *ctrlr, bool start,
return ENOMEM;
}
- scsi_start_stop(&ccb->csio,
+ scsi_start_stop_pc(&ccb->csio,
/*retries*/ 4,
/*cbfcnp*/ NULL,
/*tag_action*/ MSG_SIMPLE_Q_TAG,