ide-tape: remove struct idetape_request_sense_result_t
Bart: - remove unnecessary comment change - remove two needless "!!" Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
committed by
Bartlomiej Zolnierkiewicz
parent
c7ea8a1b36
commit
1b5db434f4
@@ -332,32 +332,6 @@ typedef struct idetape_stage_s {
|
|||||||
struct idetape_stage_s *next; /* Pointer to the next stage */
|
struct idetape_stage_s *next; /* Pointer to the next stage */
|
||||||
} idetape_stage_t;
|
} idetape_stage_t;
|
||||||
|
|
||||||
/*
|
|
||||||
* REQUEST SENSE packet command result - Data Format.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
unsigned error_code :7; /* Current of deferred errors */
|
|
||||||
unsigned valid :1; /* The information field conforms to QIC-157C */
|
|
||||||
__u8 reserved1 :8; /* Segment Number - Reserved */
|
|
||||||
unsigned sense_key :4; /* Sense Key */
|
|
||||||
unsigned reserved2_4 :1; /* Reserved */
|
|
||||||
unsigned ili :1; /* Incorrect Length Indicator */
|
|
||||||
unsigned eom :1; /* End Of Medium */
|
|
||||||
unsigned filemark :1; /* Filemark */
|
|
||||||
__u32 information __attribute__ ((packed));
|
|
||||||
__u8 asl; /* Additional sense length (n-7) */
|
|
||||||
__u32 command_specific; /* Additional command specific information */
|
|
||||||
__u8 asc; /* Additional Sense Code */
|
|
||||||
__u8 ascq; /* Additional Sense Code Qualifier */
|
|
||||||
__u8 replaceable_unit_code; /* Field Replaceable Unit Code */
|
|
||||||
unsigned sk_specific1 :7; /* Sense Key Specific */
|
|
||||||
unsigned sksv :1; /* Sense Key Specific information is valid */
|
|
||||||
__u8 sk_specific2; /* Sense Key Specific */
|
|
||||||
__u8 sk_specific3; /* Sense Key Specific */
|
|
||||||
__u8 pad[2]; /* Padding to 20 bytes */
|
|
||||||
} idetape_request_sense_result_t;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Most of our global data which we need to save even as we leave the
|
* Most of our global data which we need to save even as we leave the
|
||||||
* driver due to an interrupt or a timer event is stored in a variable
|
* driver due to an interrupt or a timer event is stored in a variable
|
||||||
@@ -512,9 +486,6 @@ typedef struct ide_tape_obj {
|
|||||||
int avg_size;
|
int avg_size;
|
||||||
int avg_speed;
|
int avg_speed;
|
||||||
|
|
||||||
/* last sense information */
|
|
||||||
idetape_request_sense_result_t sense;
|
|
||||||
|
|
||||||
char vendor_id[10];
|
char vendor_id[10];
|
||||||
char product_id[18];
|
char product_id[18];
|
||||||
char firmware_revision[6];
|
char firmware_revision[6];
|
||||||
@@ -1025,36 +996,34 @@ static void idetape_init_pc (idetape_pc_t *pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* idetape_analyze_error is called on each failed packet command retry
|
* called on each failed packet command retry to analyze the request sense. We
|
||||||
* to analyze the request sense. We currently do not utilize this
|
* currently do not utilize this information.
|
||||||
* information.
|
|
||||||
*/
|
*/
|
||||||
static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_result_t *result)
|
static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
|
||||||
{
|
{
|
||||||
idetape_tape_t *tape = drive->driver_data;
|
idetape_tape_t *tape = drive->driver_data;
|
||||||
idetape_pc_t *pc = tape->failed_pc;
|
idetape_pc_t *pc = tape->failed_pc;
|
||||||
|
|
||||||
tape->sense = *result;
|
tape->sense_key = sense[2] & 0xF;
|
||||||
tape->sense_key = result->sense_key;
|
tape->asc = sense[12];
|
||||||
tape->asc = result->asc;
|
tape->ascq = sense[13];
|
||||||
tape->ascq = result->ascq;
|
|
||||||
#if IDETAPE_DEBUG_LOG
|
#if IDETAPE_DEBUG_LOG
|
||||||
/*
|
/*
|
||||||
* Without debugging, we only log an error if we decided to
|
* Without debugging, we only log an error if we decided to give up
|
||||||
* give up retrying.
|
* retrying.
|
||||||
*/
|
*/
|
||||||
if (tape->debug_level >= 1)
|
if (tape->debug_level >= 1)
|
||||||
printk(KERN_INFO "ide-tape: pc = %x, sense key = %x, "
|
printk(KERN_INFO "ide-tape: pc = %x, sense key = %x, "
|
||||||
"asc = %x, ascq = %x\n",
|
"asc = %x, ascq = %x\n",
|
||||||
pc->c[0], result->sense_key,
|
pc->c[0], tape->sense_key,
|
||||||
result->asc, result->ascq);
|
tape->asc, tape->ascq);
|
||||||
#endif /* IDETAPE_DEBUG_LOG */
|
#endif /* IDETAPE_DEBUG_LOG */
|
||||||
|
|
||||||
/*
|
/* Correct pc->actually_transferred by asking the tape. */
|
||||||
* Correct pc->actually_transferred by asking the tape.
|
|
||||||
*/
|
|
||||||
if (test_bit(PC_DMA_ERROR, &pc->flags)) {
|
if (test_bit(PC_DMA_ERROR, &pc->flags)) {
|
||||||
pc->actually_transferred = pc->request_transfer - tape->tape_block_size * ntohl(get_unaligned(&result->information));
|
pc->actually_transferred = pc->request_transfer -
|
||||||
|
tape->tape_block_size *
|
||||||
|
ntohl(get_unaligned((u32 *)&sense[3]));
|
||||||
idetape_update_buffers(pc);
|
idetape_update_buffers(pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,28 +1033,28 @@ static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_res
|
|||||||
* (i.e. Seagate STT3401A Travan) don't support 0-length read/writes.
|
* (i.e. Seagate STT3401A Travan) don't support 0-length read/writes.
|
||||||
*/
|
*/
|
||||||
if ((pc->c[0] == IDETAPE_READ_CMD || pc->c[0] == IDETAPE_WRITE_CMD)
|
if ((pc->c[0] == IDETAPE_READ_CMD || pc->c[0] == IDETAPE_WRITE_CMD)
|
||||||
&& pc->c[4] == 0 && pc->c[3] == 0 && pc->c[2] == 0) { /* length==0 */
|
/* length == 0 */
|
||||||
if (result->sense_key == 5) {
|
&& pc->c[4] == 0 && pc->c[3] == 0 && pc->c[2] == 0) {
|
||||||
|
if (tape->sense_key == 5) {
|
||||||
/* don't report an error, everything's ok */
|
/* don't report an error, everything's ok */
|
||||||
pc->error = 0;
|
pc->error = 0;
|
||||||
/* don't retry read/write */
|
/* don't retry read/write */
|
||||||
set_bit(PC_ABORT, &pc->flags);
|
set_bit(PC_ABORT, &pc->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pc->c[0] == IDETAPE_READ_CMD && result->filemark) {
|
if (pc->c[0] == IDETAPE_READ_CMD && (sense[2] & 0x80)) {
|
||||||
pc->error = IDETAPE_ERROR_FILEMARK;
|
pc->error = IDETAPE_ERROR_FILEMARK;
|
||||||
set_bit(PC_ABORT, &pc->flags);
|
set_bit(PC_ABORT, &pc->flags);
|
||||||
}
|
}
|
||||||
if (pc->c[0] == IDETAPE_WRITE_CMD) {
|
if (pc->c[0] == IDETAPE_WRITE_CMD) {
|
||||||
if (result->eom ||
|
if ((sense[2] & 0x40) || (tape->sense_key == 0xd
|
||||||
(result->sense_key == 0xd && result->asc == 0x0 &&
|
&& tape->asc == 0x0 && tape->ascq == 0x2)) {
|
||||||
result->ascq == 0x2)) {
|
|
||||||
pc->error = IDETAPE_ERROR_EOD;
|
pc->error = IDETAPE_ERROR_EOD;
|
||||||
set_bit(PC_ABORT, &pc->flags);
|
set_bit(PC_ABORT, &pc->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pc->c[0] == IDETAPE_READ_CMD || pc->c[0] == IDETAPE_WRITE_CMD) {
|
if (pc->c[0] == IDETAPE_READ_CMD || pc->c[0] == IDETAPE_WRITE_CMD) {
|
||||||
if (result->sense_key == 8) {
|
if (tape->sense_key == 8) {
|
||||||
pc->error = IDETAPE_ERROR_EOD;
|
pc->error = IDETAPE_ERROR_EOD;
|
||||||
set_bit(PC_ABORT, &pc->flags);
|
set_bit(PC_ABORT, &pc->flags);
|
||||||
}
|
}
|
||||||
@@ -1327,7 +1296,7 @@ static ide_startstop_t idetape_request_sense_callback (ide_drive_t *drive)
|
|||||||
printk(KERN_INFO "ide-tape: Reached idetape_request_sense_callback\n");
|
printk(KERN_INFO "ide-tape: Reached idetape_request_sense_callback\n");
|
||||||
#endif /* IDETAPE_DEBUG_LOG */
|
#endif /* IDETAPE_DEBUG_LOG */
|
||||||
if (!tape->pc->error) {
|
if (!tape->pc->error) {
|
||||||
idetape_analyze_error(drive, (idetape_request_sense_result_t *) tape->pc->buffer);
|
idetape_analyze_error(drive, tape->pc->buffer);
|
||||||
idetape_end_request(drive, 1, 0);
|
idetape_end_request(drive, 1, 0);
|
||||||
} else {
|
} else {
|
||||||
printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - Aborting request!\n");
|
printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - Aborting request!\n");
|
||||||
|
Reference in New Issue
Block a user