aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:31 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:31 -0400
commit67c56364df843fb9e3ed1af014b8fbe4b22ff25d (patch)
tree586a85b1535038dea95ef2b0bff9f7d6c9fa442e
parent844b9468523c8c2c45b90df4efcabcbe4926b5ab (diff)
ide: add request_sense_{pc,rq} to ide_drive_t
Add 'struct ide_atapi_pc request_sense_pc' and 'request request_sense_rq' to ide_drive_t and use them instead of fields in struct ide_{floppy,tape}_obj. There should be no functional changes caused by this patch. Cc: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-floppy.c4
-rw-r--r--drivers/ide/ide-floppy.h3
-rw-r--r--drivers/ide/ide-tape.c7
-rw-r--r--include/linux/ide.h134
4 files changed, 72 insertions, 76 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 49e702670b8e..6a1ade8ca9fe 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -208,8 +208,8 @@ void ide_floppy_create_request_sense_cmd(struct ide_atapi_pc *pc)
208static void idefloppy_retry_pc(ide_drive_t *drive) 208static void idefloppy_retry_pc(ide_drive_t *drive)
209{ 209{
210 struct ide_floppy_obj *floppy = drive->driver_data; 210 struct ide_floppy_obj *floppy = drive->driver_data;
211 struct request *rq = &floppy->request_sense_rq; 211 struct request *rq = &drive->request_sense_rq;
212 struct ide_atapi_pc *pc = &floppy->request_sense_pc; 212 struct ide_atapi_pc *pc = &drive->request_sense_pc;
213 213
214 (void)ide_read_error(drive); 214 (void)ide_read_error(drive);
215 ide_floppy_create_request_sense_cmd(pc); 215 ide_floppy_create_request_sense_cmd(pc);
diff --git a/drivers/ide/ide-floppy.h b/drivers/ide/ide-floppy.h
index 6eee8d3a7243..e9e14c30fed7 100644
--- a/drivers/ide/ide-floppy.h
+++ b/drivers/ide/ide-floppy.h
@@ -18,9 +18,6 @@ typedef struct ide_floppy_obj {
18 /* used for blk_{fs,pc}_request() requests */ 18 /* used for blk_{fs,pc}_request() requests */
19 struct ide_atapi_pc queued_pc; 19 struct ide_atapi_pc queued_pc;
20 20
21 struct ide_atapi_pc request_sense_pc;
22 struct request request_sense_rq;
23
24 /* Last error information */ 21 /* Last error information */
25 u8 sense_key, asc, ascq; 22 u8 sense_key, asc, ascq;
26 /* delay this long before sending packet command */ 23 /* delay this long before sending packet command */
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index fe8502afd2ea..72ecc5657db2 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -182,9 +182,6 @@ typedef struct ide_tape_obj {
182 /* used by REQ_IDETAPE_{READ,WRITE} requests */ 182 /* used by REQ_IDETAPE_{READ,WRITE} requests */
183 struct ide_atapi_pc queued_pc; 183 struct ide_atapi_pc queued_pc;
184 184
185 struct ide_atapi_pc request_sense_pc;
186 struct request request_sense_rq;
187
188 /* 185 /*
189 * DSC polling variables. 186 * DSC polling variables.
190 * 187 *
@@ -600,8 +597,8 @@ static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc)
600static void idetape_retry_pc(ide_drive_t *drive) 597static void idetape_retry_pc(ide_drive_t *drive)
601{ 598{
602 struct ide_tape_obj *tape = drive->driver_data; 599 struct ide_tape_obj *tape = drive->driver_data;
603 struct request *rq = &tape->request_sense_rq; 600 struct request *rq = &drive->request_sense_rq;
604 struct ide_atapi_pc *pc = &tape->request_sense_pc; 601 struct ide_atapi_pc *pc = &drive->request_sense_pc;
605 602
606 (void)ide_read_error(drive); 603 (void)ide_read_error(drive);
607 idetape_create_request_sense_cmd(pc); 604 idetape_create_request_sense_cmd(pc);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 3bf2bf0a56dc..908b4fc9772c 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -322,7 +322,71 @@ typedef enum {
322 ide_started, /* a drive operation was started, handler was set */ 322 ide_started, /* a drive operation was started, handler was set */
323} ide_startstop_t; 323} ide_startstop_t;
324 324
325struct ide_atapi_pc; 325/* ATAPI packet command flags */
326enum {
327 /* set when an error is considered normal - no retry (ide-tape) */
328 PC_FLAG_ABORT = (1 << 0),
329 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
330 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
331 PC_FLAG_DMA_OK = (1 << 3),
332 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
333 PC_FLAG_DMA_ERROR = (1 << 5),
334 PC_FLAG_WRITING = (1 << 6),
335 /* command timed out */
336 PC_FLAG_TIMEDOUT = (1 << 7),
337};
338
339/*
340 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
341 * This is used for several packet commands (not for READ/WRITE commands).
342 */
343#define IDE_PC_BUFFER_SIZE 256
344
345struct ide_atapi_pc {
346 /* actual packet bytes */
347 u8 c[12];
348 /* incremented on each retry */
349 int retries;
350 int error;
351
352 /* bytes to transfer */
353 int req_xfer;
354 /* bytes actually transferred */
355 int xferred;
356
357 /* data buffer */
358 u8 *buf;
359 /* current buffer position */
360 u8 *cur_pos;
361 int buf_size;
362 /* missing/available data on the current buffer */
363 int b_count;
364
365 /* the corresponding request */
366 struct request *rq;
367
368 unsigned long flags;
369
370 /*
371 * those are more or less driver-specific and some of them are subject
372 * to change/removal later.
373 */
374 u8 pc_buf[IDE_PC_BUFFER_SIZE];
375
376 /* idetape only */
377 struct idetape_bh *bh;
378 char *b_data;
379
380 /* idescsi only for now */
381 struct scatterlist *sg;
382 unsigned int sg_cnt;
383
384 struct scsi_cmnd *scsi_cmd;
385 void (*done) (struct scsi_cmnd *);
386
387 unsigned long timeout;
388};
389
326struct ide_devset; 390struct ide_devset;
327struct ide_driver_s; 391struct ide_driver_s;
328 392
@@ -492,6 +556,9 @@ struct ide_drive_s {
492 void (*pc_callback)(struct ide_drive_s *, int); 556 void (*pc_callback)(struct ide_drive_s *, int);
493 557
494 unsigned long atapi_flags; 558 unsigned long atapi_flags;
559
560 struct ide_atapi_pc request_sense_pc;
561 struct request request_sense_rq;
495}; 562};
496 563
497typedef struct ide_drive_s ide_drive_t; 564typedef struct ide_drive_s ide_drive_t;
@@ -768,71 +835,6 @@ ide_decl_devset(pio_mode);
768ide_decl_devset(unmaskirq); 835ide_decl_devset(unmaskirq);
769ide_decl_devset(using_dma); 836ide_decl_devset(using_dma);
770 837
771/* ATAPI packet command flags */
772enum {
773 /* set when an error is considered normal - no retry (ide-tape) */
774 PC_FLAG_ABORT = (1 << 0),
775 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
776 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
777 PC_FLAG_DMA_OK = (1 << 3),
778 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
779 PC_FLAG_DMA_ERROR = (1 << 5),
780 PC_FLAG_WRITING = (1 << 6),
781 /* command timed out */
782 PC_FLAG_TIMEDOUT = (1 << 7),
783};
784
785/*
786 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
787 * This is used for several packet commands (not for READ/WRITE commands).
788 */
789#define IDE_PC_BUFFER_SIZE 256
790
791struct ide_atapi_pc {
792 /* actual packet bytes */
793 u8 c[12];
794 /* incremented on each retry */
795 int retries;
796 int error;
797
798 /* bytes to transfer */
799 int req_xfer;
800 /* bytes actually transferred */
801 int xferred;
802
803 /* data buffer */
804 u8 *buf;
805 /* current buffer position */
806 u8 *cur_pos;
807 int buf_size;
808 /* missing/available data on the current buffer */
809 int b_count;
810
811 /* the corresponding request */
812 struct request *rq;
813
814 unsigned long flags;
815
816 /*
817 * those are more or less driver-specific and some of them are subject
818 * to change/removal later.
819 */
820 u8 pc_buf[IDE_PC_BUFFER_SIZE];
821
822 /* idetape only */
823 struct idetape_bh *bh;
824 char *b_data;
825
826 /* idescsi only for now */
827 struct scatterlist *sg;
828 unsigned int sg_cnt;
829
830 struct scsi_cmnd *scsi_cmd;
831 void (*done) (struct scsi_cmnd *);
832
833 unsigned long timeout;
834};
835
836#ifdef CONFIG_IDE_PROC_FS 838#ifdef CONFIG_IDE_PROC_FS
837/* 839/*
838 * /proc/ide interface 840 * /proc/ide interface