mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
[SCSI] add support for variable length extended commands
Add support for variable-length, extended, and vendor specific CDBs to scsi-ml. It is now possible for initiators and ULD's to issue these types of commands. LLDs need not change much. All they need is to raise the .max_cmd_len to the longest command they support (see iscsi patch). - clean-up some code paths that did not expect commands to be larger than 16, and change cmd_len members' type to short as char is not enough. Signed-off-by: Boaz Harrosh <[email protected]> Signed-off-by: Benny Halevy <[email protected]> Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
parent
64a87b244b
commit
db4742dd8f
7 changed files with 47 additions and 35 deletions
|
|
@ -28,7 +28,6 @@
|
|||
#define SERVICE_ACTION_OUT_12 0xa9
|
||||
#define SERVICE_ACTION_IN_16 0x9e
|
||||
#define SERVICE_ACTION_OUT_16 0x9f
|
||||
#define VARIABLE_LENGTH_CMD 0x7f
|
||||
|
||||
|
||||
|
||||
|
|
@ -210,7 +209,7 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len)
|
|||
cdb0 = cdbp[0];
|
||||
switch(cdb0) {
|
||||
case VARIABLE_LENGTH_CMD:
|
||||
len = cdbp[7] + 8;
|
||||
len = scsi_varlen_cdb_length(cdbp);
|
||||
if (len < 10) {
|
||||
printk("short variable length command, "
|
||||
"len=%d ext_len=%d", len, cdb_len);
|
||||
|
|
@ -300,7 +299,7 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len)
|
|||
cdb0 = cdbp[0];
|
||||
switch(cdb0) {
|
||||
case VARIABLE_LENGTH_CMD:
|
||||
len = cdbp[7] + 8;
|
||||
len = scsi_varlen_cdb_length(cdbp);
|
||||
if (len < 10) {
|
||||
printk("short opcode=0x%x command, len=%d "
|
||||
"ext_len=%d", cdb0, len, cdb_len);
|
||||
|
|
@ -335,10 +334,7 @@ void __scsi_print_command(unsigned char *cdb)
|
|||
int k, len;
|
||||
|
||||
print_opcode_name(cdb, 0);
|
||||
if (VARIABLE_LENGTH_CMD == cdb[0])
|
||||
len = cdb[7] + 8;
|
||||
else
|
||||
len = COMMAND_SIZE(cdb[0]);
|
||||
len = scsi_command_size(cdb);
|
||||
/* print out all bytes in cdb */
|
||||
for (k = 0; k < len; ++k)
|
||||
printk(" %02x", cdb[k]);
|
||||
|
|
|
|||
|
|
@ -78,15 +78,6 @@ static void scsi_done(struct scsi_cmnd *cmd);
|
|||
/* Do not call reset on error if we just did a reset within 15 sec. */
|
||||
#define MIN_RESET_PERIOD (15*HZ)
|
||||
|
||||
/*
|
||||
* Macro to determine the size of SCSI command. This macro takes vendor
|
||||
* unique commands into account. SCSI commands in groups 6 and 7 are
|
||||
* vendor unique and we will depend upon the command length being
|
||||
* supplied correctly in cmd_len.
|
||||
*/
|
||||
#define CDB_SIZE(cmd) (((((cmd)->cmnd[0] >> 5) & 7) < 6) ? \
|
||||
COMMAND_SIZE((cmd)->cmnd[0]) : (cmd)->cmd_len)
|
||||
|
||||
/*
|
||||
* Note - the initial logging level can be set here to log events at boot time.
|
||||
* After the system is up, you may enable logging via the /proc interface.
|
||||
|
|
@ -709,9 +700,11 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
|
|||
* Before we queue this command, check if the command
|
||||
* length exceeds what the host adapter can handle.
|
||||
*/
|
||||
if (CDB_SIZE(cmd) > cmd->device->host->max_cmd_len) {
|
||||
if (cmd->cmd_len > cmd->device->host->max_cmd_len) {
|
||||
SCSI_LOG_MLQUEUE(3,
|
||||
printk("queuecommand : command too long.\n"));
|
||||
printk("queuecommand : command too long. "
|
||||
"cdb_size=%d host->max_cmd_len=%d\n",
|
||||
cmd->cmd_len, cmd->device->host->max_cmd_len));
|
||||
cmd->result = (DID_ABORT << 16);
|
||||
|
||||
scsi_done(cmd);
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ static void scsi_init_cmd_errh(struct scsi_cmnd *cmd)
|
|||
scsi_set_resid(cmd, 0);
|
||||
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
|
||||
if (cmd->cmd_len == 0)
|
||||
cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]);
|
||||
cmd->cmd_len = scsi_command_size(cmd->cmnd);
|
||||
}
|
||||
|
||||
void scsi_device_unbusy(struct scsi_device *sdev)
|
||||
|
|
|
|||
Loading…
Reference in a new issue