diff options
-rw-r--r-- | drivers/ide/ide-atapi.c | 48 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 7 | ||||
-rw-r--r-- | include/linux/ide.h | 3 |
4 files changed, 23 insertions, 39 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index c6e03485a63..972c522516f 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -80,34 +80,6 @@ void ide_init_pc(struct ide_atapi_pc *pc) | |||
80 | EXPORT_SYMBOL_GPL(ide_init_pc); | 80 | EXPORT_SYMBOL_GPL(ide_init_pc); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Generate a new packet command request in front of the request queue, before | ||
84 | * the current request, so that it will be processed immediately, on the next | ||
85 | * pass through the driver. | ||
86 | */ | ||
87 | static void ide_queue_pc_head(ide_drive_t *drive, struct gendisk *disk, | ||
88 | struct ide_atapi_pc *pc, struct request *rq) | ||
89 | { | ||
90 | blk_rq_init(NULL, rq); | ||
91 | rq->cmd_type = REQ_TYPE_SPECIAL; | ||
92 | rq->cmd_flags |= REQ_PREEMPT; | ||
93 | rq->special = (char *)pc; | ||
94 | rq->rq_disk = disk; | ||
95 | |||
96 | if (pc->req_xfer) { | ||
97 | rq->data = pc->buf; | ||
98 | rq->data_len = pc->req_xfer; | ||
99 | } | ||
100 | |||
101 | memcpy(rq->cmd, pc->c, 12); | ||
102 | if (drive->media == ide_tape) | ||
103 | rq->cmd[13] = REQ_IDETAPE_PC1; | ||
104 | |||
105 | drive->hwif->rq = NULL; | ||
106 | |||
107 | elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Add a special packet command request to the tail of the request queue, | 83 | * Add a special packet command request to the tail of the request queue, |
112 | * and wait for it to be serviced. | 84 | * and wait for it to be serviced. |
113 | */ | 85 | */ |
@@ -254,18 +226,26 @@ EXPORT_SYMBOL_GPL(ide_queue_sense_rq); | |||
254 | 226 | ||
255 | /* | 227 | /* |
256 | * Called when an error was detected during the last packet command. | 228 | * Called when an error was detected during the last packet command. |
257 | * We queue a request sense packet command in the head of the request list. | 229 | * We queue a request sense packet command at the head of the request |
230 | * queue. | ||
258 | */ | 231 | */ |
259 | void ide_retry_pc(ide_drive_t *drive, struct gendisk *disk) | 232 | void ide_retry_pc(ide_drive_t *drive) |
260 | { | 233 | { |
261 | struct request *rq = &drive->request_sense_rq; | 234 | struct request *sense_rq = &drive->sense_rq; |
262 | struct ide_atapi_pc *pc = &drive->request_sense_pc; | 235 | struct ide_atapi_pc *pc = &drive->request_sense_pc; |
263 | 236 | ||
264 | (void)ide_read_error(drive); | 237 | (void)ide_read_error(drive); |
265 | ide_create_request_sense_cmd(drive, pc); | 238 | |
239 | /* init pc from sense_rq */ | ||
240 | ide_init_pc(pc); | ||
241 | memcpy(pc->c, sense_rq->cmd, 12); | ||
242 | pc->buf = sense_rq->data; | ||
243 | pc->req_xfer = sense_rq->data_len; | ||
244 | |||
266 | if (drive->media == ide_tape) | 245 | if (drive->media == ide_tape) |
267 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); | 246 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); |
268 | ide_queue_pc_head(drive, disk, pc, rq); | 247 | |
248 | ide_queue_sense_rq(drive, pc); | ||
269 | } | 249 | } |
270 | EXPORT_SYMBOL_GPL(ide_retry_pc); | 250 | EXPORT_SYMBOL_GPL(ide_retry_pc); |
271 | 251 | ||
@@ -404,7 +384,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
404 | debug_log("[cmd %x]: check condition\n", rq->cmd[0]); | 384 | debug_log("[cmd %x]: check condition\n", rq->cmd[0]); |
405 | 385 | ||
406 | /* Retry operation */ | 386 | /* Retry operation */ |
407 | ide_retry_pc(drive, rq->rq_disk); | 387 | ide_retry_pc(drive); |
408 | 388 | ||
409 | /* queued, but not started */ | 389 | /* queued, but not started */ |
410 | return ide_stopped; | 390 | return ide_stopped; |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 94600331a27..d3302cc891e 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -263,7 +263,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
263 | } | 263 | } |
264 | pc = &floppy->queued_pc; | 264 | pc = &floppy->queued_pc; |
265 | idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); | 265 | idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); |
266 | } else if (blk_special_request(rq)) { | 266 | } else if (blk_special_request(rq) || blk_sense_request(rq)) { |
267 | pc = (struct ide_atapi_pc *)rq->special; | 267 | pc = (struct ide_atapi_pc *)rq->special; |
268 | } else if (blk_pc_request(rq)) { | 268 | } else if (blk_pc_request(rq)) { |
269 | pc = &floppy->queued_pc; | 269 | pc = &floppy->queued_pc; |
@@ -273,6 +273,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
273 | goto out_end; | 273 | goto out_end; |
274 | } | 274 | } |
275 | 275 | ||
276 | ide_prep_sense(drive, rq); | ||
277 | |||
276 | memset(&cmd, 0, sizeof(cmd)); | 278 | memset(&cmd, 0, sizeof(cmd)); |
277 | 279 | ||
278 | if (rq_data_dir(rq)) | 280 | if (rq_data_dir(rq)) |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index aadf53cfac6..8324dfa78a3 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -695,7 +695,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) | |||
695 | printk(KERN_ERR "ide-tape: %s: I/O error, ", | 695 | printk(KERN_ERR "ide-tape: %s: I/O error, ", |
696 | tape->name); | 696 | tape->name); |
697 | /* Retry operation */ | 697 | /* Retry operation */ |
698 | ide_retry_pc(drive, tape->disk); | 698 | ide_retry_pc(drive); |
699 | return ide_stopped; | 699 | return ide_stopped; |
700 | } | 700 | } |
701 | pc->error = 0; | 701 | pc->error = 0; |
@@ -752,7 +752,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
752 | (unsigned long long)rq->sector, rq->nr_sectors, | 752 | (unsigned long long)rq->sector, rq->nr_sectors, |
753 | rq->current_nr_sectors); | 753 | rq->current_nr_sectors); |
754 | 754 | ||
755 | if (!blk_special_request(rq)) { | 755 | if (!(blk_special_request(rq) || blk_sense_request(rq))) { |
756 | /* We do not support buffer cache originated requests. */ | 756 | /* We do not support buffer cache originated requests. */ |
757 | printk(KERN_NOTICE "ide-tape: %s: Unsupported request in " | 757 | printk(KERN_NOTICE "ide-tape: %s: Unsupported request in " |
758 | "request queue (%d)\n", drive->name, rq->cmd_type); | 758 | "request queue (%d)\n", drive->name, rq->cmd_type); |
@@ -840,6 +840,9 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
840 | BUG(); | 840 | BUG(); |
841 | 841 | ||
842 | out: | 842 | out: |
843 | /* prepare sense request for this command */ | ||
844 | ide_prep_sense(drive, rq); | ||
845 | |||
843 | memset(&cmd, 0, sizeof(cmd)); | 846 | memset(&cmd, 0, sizeof(cmd)); |
844 | 847 | ||
845 | if (rq_data_dir(rq)) | 848 | if (rq_data_dir(rq)) |
diff --git a/include/linux/ide.h b/include/linux/ide.h index a69ccac5641..9e67ccac3c1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -604,7 +604,6 @@ struct ide_drive_s { | |||
604 | unsigned long atapi_flags; | 604 | unsigned long atapi_flags; |
605 | 605 | ||
606 | struct ide_atapi_pc request_sense_pc; | 606 | struct ide_atapi_pc request_sense_pc; |
607 | struct request request_sense_rq; | ||
608 | 607 | ||
609 | /* current sense rq and buffer */ | 608 | /* current sense rq and buffer */ |
610 | bool sense_rq_armed; | 609 | bool sense_rq_armed; |
@@ -1181,7 +1180,7 @@ int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); | |||
1181 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); | 1180 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); |
1182 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); | 1181 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); |
1183 | void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); | 1182 | void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); |
1184 | void ide_retry_pc(ide_drive_t *, struct gendisk *); | 1183 | void ide_retry_pc(ide_drive_t *drive); |
1185 | 1184 | ||
1186 | void ide_prep_sense(ide_drive_t *drive, struct request *rq); | 1185 | void ide_prep_sense(ide_drive_t *drive, struct request *rq); |
1187 | void ide_queue_sense_rq(ide_drive_t *drive, void *special); | 1186 | void ide_queue_sense_rq(ide_drive_t *drive, void *special); |