ide: move IDE{FLOPPY,TAPE}_WAIT_CMD defines to <linux/ide.h>

While at it:

* IDE{FLOPPY,TAPE}_WAIT_CMD -> WAIT_{FLOPPY,TAPE}_CMD

* Use enum for WAIT_* defines.

There should be no functional changes caused by this patch.
Acked-by: default avatarBorislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent de699ad5
...@@ -61,10 +61,6 @@ ...@@ -61,10 +61,6 @@
#define debug_log(fmt, args...) do {} while (0) #define debug_log(fmt, args...) do {} while (0)
#endif #endif
/* Some drives require a longer irq timeout. */
#define IDEFLOPPY_WAIT_CMD (5 * WAIT_CMD)
/* /*
* After each failed packet command we issue a request sense command and retry * After each failed packet command we issue a request sense command and retry
* the packet command IDEFLOPPY_MAX_PC_RETRIES times. * the packet command IDEFLOPPY_MAX_PC_RETRIES times.
...@@ -226,7 +222,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) ...@@ -226,7 +222,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
return ide_pc_intr(drive, floppy->pc, idefloppy_pc_intr, return ide_pc_intr(drive, floppy->pc, idefloppy_pc_intr,
IDEFLOPPY_WAIT_CMD, NULL, idefloppy_update_buffers, WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers,
idefloppy_retry_pc, NULL, ide_io_buffers); idefloppy_retry_pc, NULL, ide_io_buffers);
} }
...@@ -244,10 +240,9 @@ static int idefloppy_transfer_pc(ide_drive_t *drive) ...@@ -244,10 +240,9 @@ static int idefloppy_transfer_pc(ide_drive_t *drive)
drive->hwif->tp_ops->output_data(drive, NULL, floppy->pc->c, 12); drive->hwif->tp_ops->output_data(drive, NULL, floppy->pc->c, 12);
/* Timeout for the packet command */ /* Timeout for the packet command */
return IDEFLOPPY_WAIT_CMD; return WAIT_FLOPPY_CMD;
} }
/* /*
* Called as an interrupt (or directly). When the device says it's ready for a * Called as an interrupt (or directly). When the device says it's ready for a
* packet, we schedule the packet transfer to occur about 2-3 ticks later in * packet, we schedule the packet transfer to occur about 2-3 ticks later in
...@@ -272,7 +267,7 @@ static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive) ...@@ -272,7 +267,7 @@ static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive)
timeout = floppy->ticks; timeout = floppy->ticks;
expiry = &idefloppy_transfer_pc; expiry = &idefloppy_transfer_pc;
} else { } else {
timeout = IDEFLOPPY_WAIT_CMD; timeout = WAIT_FLOPPY_CMD;
expiry = NULL; expiry = NULL;
} }
...@@ -322,7 +317,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, ...@@ -322,7 +317,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
pc->retries++; pc->retries++;
return ide_issue_pc(drive, pc, idefloppy_start_pc_transfer, return ide_issue_pc(drive, pc, idefloppy_start_pc_transfer,
IDEFLOPPY_WAIT_CMD, NULL); WAIT_FLOPPY_CMD, NULL);
} }
void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc)
......
...@@ -80,13 +80,6 @@ enum { ...@@ -80,13 +80,6 @@ enum {
*/ */
#define IDETAPE_MAX_PC_RETRIES 3 #define IDETAPE_MAX_PC_RETRIES 3
/*
* Some drives (for example, Seagate STT3401A Travan) require a very long
* timeout, because they don't return an interrupt or clear their busy bit
* until after the command completes (even retension commands).
*/
#define IDETAPE_WAIT_CMD (900*HZ)
/* /*
* The following parameter is used to select the point in the internal tape fifo * The following parameter is used to select the point in the internal tape fifo
* in which we will start to refill the buffer. Decreasing the following * in which we will start to refill the buffer. Decreasing the following
...@@ -663,7 +656,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) ...@@ -663,7 +656,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
{ {
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
return ide_pc_intr(drive, tape->pc, idetape_pc_intr, IDETAPE_WAIT_CMD, return ide_pc_intr(drive, tape->pc, idetape_pc_intr, WAIT_TAPE_CMD,
NULL, idetape_update_buffers, idetape_retry_pc, NULL, idetape_update_buffers, idetape_retry_pc,
ide_tape_handle_dsc, ide_tape_io_buffers); ide_tape_handle_dsc, ide_tape_io_buffers);
} }
...@@ -709,7 +702,7 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) ...@@ -709,7 +702,7 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
return ide_transfer_pc(drive, tape->pc, idetape_pc_intr, return ide_transfer_pc(drive, tape->pc, idetape_pc_intr,
IDETAPE_WAIT_CMD, NULL); WAIT_TAPE_CMD, NULL);
} }
static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
...@@ -758,7 +751,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, ...@@ -758,7 +751,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
pc->retries++; pc->retries++;
return ide_issue_pc(drive, pc, idetape_transfer_pc, return ide_issue_pc(drive, pc, idetape_transfer_pc,
IDETAPE_WAIT_CMD, NULL); WAIT_TAPE_CMD, NULL);
} }
/* A mode sense command is used to "sense" tape parameters. */ /* A mode sense command is used to "sense" tape parameters. */
......
...@@ -133,12 +133,28 @@ struct ide_io_ports { ...@@ -133,12 +133,28 @@ struct ide_io_ports {
/* /*
* Timeouts for various operations: * Timeouts for various operations:
*/ */
#define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */ enum {
#define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ /* spec allows up to 20ms */
#define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */ WAIT_DRQ = HZ / 10, /* 100ms */
#define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ /* some laptops are very slow */
#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ WAIT_READY = 5 * HZ, /* 5s */
#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ /* should be less than 3ms (?), if all ATAPI CD is closed at boot */
WAIT_PIDENTIFY = 10 * HZ, /* 10s */
/* worst case when spinning up */
WAIT_WORSTCASE = 30 * HZ, /* 30s */
/* maximum wait for an IRQ to happen */
WAIT_CMD = 10 * HZ, /* 10s */
/* Some drives require a longer IRQ timeout. */
WAIT_FLOPPY_CMD = 50 * HZ, /* 50s */
/*
* Some drives (for example, Seagate STT3401A Travan) require a very
* long timeout, because they don't return an interrupt or clear their
* BSY bit until after the command completes (even retension commands).
*/
WAIT_TAPE_CMD = 900 * HZ, /* 900s */
/* minimum sleep time */
WAIT_MIN_SLEEP = HZ / 50, /* 20ms */
};
/* /*
* Op codes for special requests to be handled by ide_special_rq(). * Op codes for special requests to be handled by ide_special_rq().
......
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