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
This commit is contained in:
@@ -1024,7 +1024,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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -9007,6 +9007,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,
|
||||
|
||||
@@ -4348,6 +4348,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,
|
||||
|
||||
@@ -3406,7 +3406,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);
|
||||
|
||||
@@ -3435,7 +3434,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);
|
||||
|
||||
|
||||
@@ -1516,7 +1516,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);
|
||||
|
||||
@@ -1152,7 +1152,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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user