Commit b545d770 authored by Douglas Gilbert's avatar Douglas Gilbert Committed by James Bottomley

scsi_debug version 1.66

Attached is a small clean up of scsi_debug against
lk 2.5.50bk3

Module load time parameters still don't work so
I tweak this driver's _DEF defines and recompile
as required. [Evidentally Rusty has patches to
recognize module load time parameters but they haven't
made it through to the main tree yet.]
parent 9a815f1f
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#include "scsi_debug.h" #include "scsi_debug.h"
static const char * scsi_debug_version_str = "Version: 1.65 (20021119)"; static const char * scsi_debug_version_str = "Version: 1.66 (20021205)";
#ifndef SCSI_CMD_READ_16 #ifndef SCSI_CMD_READ_16
#define SCSI_CMD_READ_16 0x88 #define SCSI_CMD_READ_16 0x88
...@@ -397,7 +397,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) ...@@ -397,7 +397,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done)
if ((errsts = check_reset(SCpnt, devip))) if ((errsts = check_reset(SCpnt, devip)))
break; break;
mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x20, 0, 14); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x20, 0, 14);
errsts = (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); errsts = (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
break; break;
} }
return schedule_resp(SCpnt, devip, done, errsts, scsi_debug_delay); return schedule_resp(SCpnt, devip, done, errsts, scsi_debug_delay);
...@@ -417,7 +417,7 @@ static int check_reset(struct scsi_cmnd * SCpnt, struct sdebug_dev_info * devip) ...@@ -417,7 +417,7 @@ static int check_reset(struct scsi_cmnd * SCpnt, struct sdebug_dev_info * devip)
if (devip->reset) { if (devip->reset) {
devip->reset = 0; devip->reset = 0;
mk_sense_buffer(devip, UNIT_ATTENTION, 0x29, 0, 14); mk_sense_buffer(devip, UNIT_ATTENTION, 0x29, 0, 14);
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} }
return 0; return 0;
} }
...@@ -478,7 +478,7 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff, ...@@ -478,7 +478,7 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff,
arr[0] = pq_pdt; arr[0] = pq_pdt;
if (0x2 & cmd[1]) { /* CMDDT bit set */ if (0x2 & cmd[1]) { /* CMDDT bit set */
mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14);
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} else if (0x1 & cmd[1]) { /* EVPD bit set */ } else if (0x1 & cmd[1]) { /* EVPD bit set */
int dev_id_num, len; int dev_id_num, len;
char dev_id_str[6]; char dev_id_str[6];
...@@ -503,7 +503,7 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff, ...@@ -503,7 +503,7 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff,
} else { } else {
/* Illegal request, invalid field in cdb */ /* Illegal request, invalid field in cdb */
mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14);
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} }
memcpy(buff, arr, min_len); memcpy(buff, arr, min_len);
return 0; return 0;
...@@ -616,7 +616,7 @@ static int resp_mode_sense(unsigned char * cmd, int target, ...@@ -616,7 +616,7 @@ static int resp_mode_sense(unsigned char * cmd, int target,
memset(arr, 0, SDEBUG_MAX_MSENSE_SZ); memset(arr, 0, SDEBUG_MAX_MSENSE_SZ);
if (0x3 == pcontrol) { /* Saving values not supported */ if (0x3 == pcontrol) { /* Saving values not supported */
mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x39, 0, 14); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x39, 0, 14);
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} }
dev_spec = DEV_READONLY(target) ? 0x80 : 0x0; dev_spec = DEV_READONLY(target) ? 0x80 : 0x0;
if (msense_6) { if (msense_6) {
...@@ -659,7 +659,7 @@ static int resp_mode_sense(unsigned char * cmd, int target, ...@@ -659,7 +659,7 @@ static int resp_mode_sense(unsigned char * cmd, int target,
break; break;
default: default:
mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14);
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} }
if (msense_6) if (msense_6)
arr[0] = offset - 1; arr[0] = offset - 1;
...@@ -683,14 +683,14 @@ static int resp_read(struct scsi_cmnd * SCpnt, int upper_blk, int block, ...@@ -683,14 +683,14 @@ static int resp_read(struct scsi_cmnd * SCpnt, int upper_blk, int block,
if (upper_blk || (block + num > sdebug_capacity)) { if (upper_blk || (block + num > sdebug_capacity)) {
mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x21, 0, 14); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x21, 0, 14);
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} }
if ((SCSI_DEBUG_OPT_MEDIUM_ERR & scsi_debug_opts) && if ((SCSI_DEBUG_OPT_MEDIUM_ERR & scsi_debug_opts) &&
(block >= OPT_MEDIUM_ERR_ADDR) && (block >= OPT_MEDIUM_ERR_ADDR) &&
(block < (OPT_MEDIUM_ERR_ADDR + num))) { (block < (OPT_MEDIUM_ERR_ADDR + num))) {
mk_sense_buffer(devip, MEDIUM_ERROR, 0x11, 0, 14); mk_sense_buffer(devip, MEDIUM_ERROR, 0x11, 0, 14);
/* claim unrecoverable read error */ /* claim unrecoverable read error */
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} }
read_lock_irqsave(&atomic_rw, iflags); read_lock_irqsave(&atomic_rw, iflags);
sgcount = 0; sgcount = 0;
...@@ -732,7 +732,7 @@ static int resp_write(struct scsi_cmnd * SCpnt, int upper_blk, int block, ...@@ -732,7 +732,7 @@ static int resp_write(struct scsi_cmnd * SCpnt, int upper_blk, int block,
if (upper_blk || (block + num > sdebug_capacity)) { if (upper_blk || (block + num > sdebug_capacity)) {
mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x21, 0, 14); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x21, 0, 14);
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} }
write_lock_irqsave(&atomic_rw, iflags); write_lock_irqsave(&atomic_rw, iflags);
...@@ -773,7 +773,7 @@ static int resp_report_luns(unsigned char * cmd, unsigned char * buff, ...@@ -773,7 +773,7 @@ static int resp_report_luns(unsigned char * cmd, unsigned char * buff,
alloc_len = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24); alloc_len = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24);
if ((alloc_len < 16) || (select_report > 2)) { if ((alloc_len < 16) || (select_report > 2)) {
mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14);
return (COMMAND_COMPLETE << 8) | (CHECK_CONDITION << 1); return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
} }
if (bufflen > 3) { if (bufflen > 3) {
lun_cnt = min((int)(bufflen / sizeof(ScsiLun)), lun_cnt = min((int)(bufflen / sizeof(ScsiLun)),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment