Skip to content

Commit

Permalink
ide: move IDE{FLOPPY,TAPE}_WAIT_CMD defines to <linux/ide.h>
Browse files Browse the repository at this point in the history
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: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Oct 10, 2008
1 parent de699ad commit d6e2955
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
13 changes: 4 additions & 9 deletions drivers/ide/ide-floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@
#define debug_log(fmt, args...) do {} while (0)
#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
* the packet command IDEFLOPPY_MAX_PC_RETRIES times.
Expand Down Expand Up @@ -226,7 +222,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
idefloppy_floppy_t *floppy = drive->driver_data;

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);
}

Expand All @@ -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);

/* 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
* packet, we schedule the packet transfer to occur about 2-3 ticks later in
Expand All @@ -272,7 +267,7 @@ static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive)
timeout = floppy->ticks;
expiry = &idefloppy_transfer_pc;
} else {
timeout = IDEFLOPPY_WAIT_CMD;
timeout = WAIT_FLOPPY_CMD;
expiry = NULL;
}

Expand Down Expand Up @@ -322,7 +317,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
pc->retries++;

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)
Expand Down
13 changes: 3 additions & 10 deletions drivers/ide/ide-tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ enum {
*/
#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
* in which we will start to refill the buffer. Decreasing the following
Expand Down Expand Up @@ -663,7 +656,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
{
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,
ide_tape_handle_dsc, ide_tape_io_buffers);
}
Expand Down Expand Up @@ -709,7 +702,7 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
idetape_tape_t *tape = drive->driver_data;

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,
Expand Down Expand Up @@ -758,7 +751,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
pc->retries++;

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. */
Expand Down
28 changes: 22 additions & 6 deletions include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,28 @@ struct ide_io_ports {
/*
* Timeouts for various operations:
*/
#define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */
#define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */
#define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */
#define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */
#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */
enum {
/* spec allows up to 20ms */
WAIT_DRQ = HZ / 10, /* 100ms */
/* some laptops are very slow */
WAIT_READY = 5 * HZ, /* 5s */
/* 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().
Expand Down

0 comments on commit d6e2955

Please sign in to comment.