Changed the scsi mode command to use 10 bytes scsi commands instead

of the 6 byte ones.  This helps with using a IDE cdrom behind a USB
interface.

PR: kern/43885
This commit is contained in:
Jim Pirzyk 2002-10-17 23:37:03 +00:00
parent 505b28166c
commit c463814756
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105363

View file

@ -2632,7 +2632,7 @@ cdreadsubchannel(struct cam_periph *periph, u_int32_t mode,
static int static int
cdgetmode(struct cam_periph *periph, struct cd_mode_data *data, u_int32_t page) cdgetmode(struct cam_periph *periph, struct cd_mode_data *data, u_int32_t page)
{ {
struct scsi_mode_sense_6 *scsi_cmd; struct scsi_mode_sense_10 *scsi_cmd;
struct ccb_scsiio *csio; struct ccb_scsiio *csio;
union ccb *ccb; union ccb *ccb;
int error; int error;
@ -2650,15 +2650,16 @@ cdgetmode(struct cam_periph *periph, struct cd_mode_data *data, u_int32_t page)
/* data_ptr */ (u_int8_t *)data, /* data_ptr */ (u_int8_t *)data,
/* dxfer_len */ sizeof(*data), /* dxfer_len */ sizeof(*data),
/* sense_len */ SSD_FULL_SIZE, /* sense_len */ SSD_FULL_SIZE,
sizeof(struct scsi_mode_sense_6), sizeof(struct scsi_mode_sense_10),
/* timeout */ 50000); /* timeout */ 50000);
scsi_cmd = (struct scsi_mode_sense_6 *)&csio->cdb_io.cdb_bytes; scsi_cmd = (struct scsi_mode_sense_10 *)&csio->cdb_io.cdb_bytes;
bzero (scsi_cmd, sizeof(*scsi_cmd)); bzero (scsi_cmd, sizeof(*scsi_cmd));
scsi_cmd->page = page; scsi_cmd->page = page;
scsi_cmd->length = sizeof(*data) & 0xff; scsi_cmd->length[0] = (sizeof(*data)) >> 8;
scsi_cmd->opcode = MODE_SENSE; scsi_cmd->length[1] = (sizeof(*data)) & 0xff;
scsi_cmd->opcode = MODE_SENSE_10;
error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO,
/*sense_flags*/SF_RETRY_UA); /*sense_flags*/SF_RETRY_UA);
@ -2671,7 +2672,7 @@ cdgetmode(struct cam_periph *periph, struct cd_mode_data *data, u_int32_t page)
static int static int
cdsetmode(struct cam_periph *periph, struct cd_mode_data *data) cdsetmode(struct cam_periph *periph, struct cd_mode_data *data)
{ {
struct scsi_mode_select_6 *scsi_cmd; struct scsi_mode_select_10 *scsi_cmd;
struct ccb_scsiio *csio; struct ccb_scsiio *csio;
union ccb *ccb; union ccb *ccb;
int error; int error;
@ -2690,15 +2691,16 @@ cdsetmode(struct cam_periph *periph, struct cd_mode_data *data)
/* data_ptr */ (u_int8_t *)data, /* data_ptr */ (u_int8_t *)data,
/* dxfer_len */ sizeof(*data), /* dxfer_len */ sizeof(*data),
/* sense_len */ SSD_FULL_SIZE, /* sense_len */ SSD_FULL_SIZE,
sizeof(struct scsi_mode_select_6), sizeof(struct scsi_mode_select_10),
/* timeout */ 50000); /* timeout */ 50000);
scsi_cmd = (struct scsi_mode_select_6 *)&csio->cdb_io.cdb_bytes; scsi_cmd = (struct scsi_mode_select_10 *)&csio->cdb_io.cdb_bytes;
bzero(scsi_cmd, sizeof(*scsi_cmd)); bzero(scsi_cmd, sizeof(*scsi_cmd));
scsi_cmd->opcode = MODE_SELECT; scsi_cmd->opcode = MODE_SELECT;
scsi_cmd->byte2 |= SMS_PF; scsi_cmd->byte2 |= SMS_PF;
scsi_cmd->length = sizeof(*data) & 0xff; scsi_cmd->length[0] = (sizeof(*data)) >> 8;
scsi_cmd->length[1] = (sizeof(*data)) & 0xff;
data->header.data_length = 0; data->header.data_length = 0;
/* /*
* SONY drives do not allow a mode select with a medium_type * SONY drives do not allow a mode select with a medium_type