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
This commit is contained in:
Jaeyoon Choi
2025-12-01 04:39:35 +00:00
parent 5e0d065b5b
commit 8c35de4982
7 changed files with 11 additions and 2 deletions
+1
View File
@@ -1024,6 +1024,7 @@ scsistart(struct cam_device *device, int startstop, int loadeject,
/* start/stop */ startstop, /* start/stop */ startstop,
/* load_eject */ loadeject, /* load_eject */ loadeject,
/* immediate */ 0, /* immediate */ 0,
/* power_condition */ SSS_PC_START_VALID,
/* sense_len */ SSD_FULL_SIZE, /* sense_len */ SSD_FULL_SIZE,
/* timeout */ timeout ? timeout : 120000); /* timeout */ timeout ? timeout : 120000);
+1
View File
@@ -1791,6 +1791,7 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **orig,
/*start*/TRUE, /*start*/TRUE,
/*load/eject*/le, /*load/eject*/le,
/*immediate*/FALSE, /*immediate*/FALSE,
/*power_condition*/SSS_PC_START_VALID,
SSD_FULL_SIZE, SSD_FULL_SIZE,
/*timeout*/50000); /*timeout*/50000);
break; break;
+3 -1
View File
@@ -8984,7 +8984,8 @@ void
scsi_start_stop(struct ccb_scsiio *csio, uint32_t retries, scsi_start_stop(struct ccb_scsiio *csio, uint32_t retries,
void (*cbfcnp)(struct cam_periph *, union ccb *), void (*cbfcnp)(struct cam_periph *, union ccb *),
uint8_t tag_action, int start, int load_eject, 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; struct scsi_start_stop_unit *scsi_cmd;
int extra_flags = 0; int extra_flags = 0;
@@ -8999,6 +9000,7 @@ scsi_start_stop(struct ccb_scsiio *csio, uint32_t retries,
} }
if (load_eject != 0) if (load_eject != 0)
scsi_cmd->how |= SSS_LOEJ; scsi_cmd->how |= SSS_LOEJ;
scsi_cmd->how |= power_condition;
if (immediate != 0) if (immediate != 0)
scsi_cmd->byte2 |= SSS_IMMED; scsi_cmd->byte2 |= SSS_IMMED;
+2 -1
View File
@@ -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 scsi_start_stop(struct ccb_scsiio *csio, uint32_t retries,
void (*cbfcnp)(struct cam_periph *, union ccb *), void (*cbfcnp)(struct cam_periph *, union ccb *),
uint8_t tag_action, int start, int load_eject, 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 scsi_read_attribute(struct ccb_scsiio *csio, uint32_t retries,
void (*cbfcnp)(struct cam_periph *, union ccb *), void (*cbfcnp)(struct cam_periph *, union ccb *),
uint8_t tag_action, uint8_t service_action, uint8_t tag_action, uint8_t service_action,
+2
View File
@@ -3406,6 +3406,7 @@ cdstartunit(struct cam_periph *periph, int load)
/* start */ TRUE, /* start */ TRUE,
/* load_eject */ load, /* load_eject */ load,
/* immediate */ FALSE, /* immediate */ FALSE,
/* power_condition */ SSS_PC_START_VALID,
/* sense_len */ SSD_FULL_SIZE, /* sense_len */ SSD_FULL_SIZE,
/* timeout */ 50000); /* timeout */ 50000);
@@ -3434,6 +3435,7 @@ cdstopunit(struct cam_periph *periph, uint32_t eject)
/* start */ FALSE, /* start */ FALSE,
/* load_eject */ eject, /* load_eject */ eject,
/* immediate */ FALSE, /* immediate */ FALSE,
/* power_condition */ SSS_PC_START_VALID,
/* sense_len */ SSD_FULL_SIZE, /* sense_len */ SSD_FULL_SIZE,
/* timeout */ 50000); /* timeout */ 50000);
+1
View File
@@ -1517,6 +1517,7 @@ mprsas_SSU_to_SATA_devices(struct mpr_softc *sc, int howto)
/*start*/FALSE, /*start*/FALSE,
/*load/eject*/0, /*load/eject*/0,
/*immediate*/FALSE, /*immediate*/FALSE,
/*power_condition*/SSS_PC_START_VALID,
MPR_SENSE_LEN, MPR_SENSE_LEN,
/*timeout*/10000); /*timeout*/10000);
xpt_action(ccb); xpt_action(ccb);
+1
View File
@@ -1153,6 +1153,7 @@ mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto)
/*start*/FALSE, /*start*/FALSE,
/*load/eject*/0, /*load/eject*/0,
/*immediate*/FALSE, /*immediate*/FALSE,
/*power_condition*/SSS_PC_START_VALID,
MPS_SENSE_LEN, MPS_SENSE_LEN,
/*timeout*/10000); /*timeout*/10000);
xpt_action(ccb); xpt_action(ccb);