mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-28 09:20:18 +00:00
Put CDB control byte parsing in one place
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5246 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -6687,7 +6687,7 @@ static int get_cdb_info_write_same16(struct scst_cmd *cmd,
|
||||
}
|
||||
|
||||
/**
|
||||
* scst_get_cdb_info_apt() - Parse ATA PASS-THROUGH CDB.
|
||||
* get_cdb_info_apt() - Parse ATA PASS-THROUGH CDB.
|
||||
*
|
||||
* Parse ATA PASS-THROUGH(12) and ATA PASS-THROUGH(16). See also SAT-3 for a
|
||||
* detailed description of these commands.
|
||||
@@ -6825,6 +6825,7 @@ int scst_get_cdb_info(struct scst_cmd *cmd)
|
||||
int dev_type = cmd->dev->type;
|
||||
int i, res = 0;
|
||||
uint8_t op;
|
||||
uint8_t control;
|
||||
const struct scst_sdbops *ptr = NULL;
|
||||
|
||||
TRACE_ENTRY();
|
||||
@@ -6870,6 +6871,7 @@ int scst_get_cdb_info(struct scst_cmd *cmd)
|
||||
}
|
||||
|
||||
cmd->cdb_len = SCST_GET_CDB_LEN(op);
|
||||
control = cmd->cdb[cmd->cdb_len - 1];
|
||||
cmd->op_name = ptr->info_op_name;
|
||||
cmd->data_direction = ptr->info_data_direction;
|
||||
cmd->op_flags = ptr->info_op_flags | SCST_INFO_VALID;
|
||||
@@ -6879,6 +6881,24 @@ int scst_get_cdb_info(struct scst_cmd *cmd)
|
||||
cmd->len_len = ptr->info_len_len;
|
||||
res = (*ptr->get_cdb_info)(cmd, ptr);
|
||||
|
||||
if (unlikely(control & CONTROL_BYTE_NACA_BIT)) {
|
||||
PRINT_ERROR("NACA bit in control byte CDB is not supported "
|
||||
"(opcode 0x%02x)", cmd->cdb[0]);
|
||||
scst_set_cmd_error(cmd,
|
||||
SCST_LOAD_SENSE(scst_sense_invalid_message));
|
||||
res = 1; /* command invalid */
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (unlikely(control & CONTROL_BYTE_LINK_BIT)) {
|
||||
PRINT_ERROR("Linked commands are not supported "
|
||||
"(opcode 0x%02x)", cmd->cdb[0]);
|
||||
scst_set_invalid_field_in_cdb(cmd, cmd->cdb_len-1,
|
||||
SCST_INVAL_FIELD_BIT_OFFS_VALID | 0);
|
||||
res = 1; /* command invalid */
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
TRACE_EXIT_RES(res);
|
||||
return res;
|
||||
|
||||
@@ -744,22 +744,6 @@ static int scst_parse_cmd(struct scst_cmd *cmd)
|
||||
cmd->op_flags &= ~SCST_UNKNOWN_LENGTH;
|
||||
}
|
||||
|
||||
if (unlikely(cmd->cdb[cmd->cdb_len - 1] & CONTROL_BYTE_NACA_BIT)) {
|
||||
PRINT_ERROR("NACA bit in control byte CDB is not supported "
|
||||
"(opcode 0x%02x)", cmd->cdb[0]);
|
||||
scst_set_cmd_error(cmd,
|
||||
SCST_LOAD_SENSE(scst_sense_invalid_message));
|
||||
goto out_done;
|
||||
}
|
||||
|
||||
if (unlikely(cmd->cdb[cmd->cdb_len-1] & CONTROL_BYTE_LINK_BIT)) {
|
||||
PRINT_ERROR("Linked commands are not supported "
|
||||
"(opcode 0x%02x)", cmd->cdb[0]);
|
||||
scst_set_invalid_field_in_cdb(cmd, cmd->cdb_len-1,
|
||||
SCST_INVAL_FIELD_BIT_OFFS_VALID | 0);
|
||||
goto out_done;
|
||||
}
|
||||
|
||||
if (cmd->dh_data_buf_alloced &&
|
||||
unlikely((orig_bufflen > cmd->bufflen))) {
|
||||
PRINT_ERROR("Dev handler supplied data buffer (size %d), "
|
||||
|
||||
Reference in New Issue
Block a user