Remove some accumulated (unused) cruft from ide.h
Signed-off-by: Chris Wedgwood <[email protected]>
---
Bart, How does this look? I know a XXX comment has sneaked in, I
think it should stay for now but you can trim the patch if you
prfer...
===== include/linux/ide.h 1.155 vs edited =====
--- 1.155/include/linux/ide.h 2004-11-01 09:06:50 -08:00
+++ edited/include/linux/ide.h 2004-11-02 11:32:44 -08:00
@@ -39,7 +39,6 @@
*
* REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary
*/
-#define REALLY_FAST_IO /* define if ide ports are perfect */
#define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */
#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */
@@ -56,6 +55,7 @@
#define DISABLE_IRQ_NOSYNC 0
#endif
+/* XXX this needs to be killed */
/*
* Used to indicate "no IRQ", should be a value that cannot be an IRQ
* number.
@@ -64,18 +64,6 @@
#define IDE_NO_IRQ (-1)
/*
- * IDE_DRIVE_CMD is used to implement many features of the hdparm utility
- */
-#define IDE_DRIVE_CMD 99 /* (magic) undef to reduce kernel size*/
-
-#define IDE_DRIVE_TASK 98
-
-/*
- * IDE_DRIVE_TASKFILE is used to implement many features needed for raw tasks
- */
-#define IDE_DRIVE_TASKFILE 97
-
-/*
* "No user-serviceable parts" beyond this point :)
*****************************************************************************/
@@ -197,13 +185,8 @@ typedef unsigned char byte; /* used ever
/*
* Some more useful definitions
*/
-#define IDE_MAJOR_NAME "hd" /* the same for all i/f; see also genhd.c */
-#define MAJOR_NAME IDE_MAJOR_NAME
#define PARTN_BITS 6 /* number of minor dev bits for partitions */
-#define PARTN_MASK ((1<<PARTN_BITS)-1) /* a useful bit mask */
#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */
-#define SECTOR_SIZE 512
-#define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */
#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
/*
Bart, Chris's two patches are OK with me. If you agree, then please
merge them up into your ide-2.6 queue.
Chris, a useful follow-up patch (if Bart agrees) is a global
search-n-replace of WIN_xxx constants with ATA_CMD_xxx constants.
Depending on the size of the patch, it might even need to be split up
across several patches.
Jeff
On Thu, 04 Nov 2004 21:43:12 -0500, Jeff Garzik <[email protected]> wrote:
> Bart, Chris's two patches are OK with me. If you agree, then please
> merge them up into your ide-2.6 queue.
OK (but I will leave SECTOR_[SIZE, WORDS] for
now as this change depends on the other patch).
> Chris, a useful follow-up patch (if Bart agrees) is a global
> search-n-replace of WIN_xxx constants with ATA_CMD_xxx constants.
> Depending on the size of the patch, it might even need to be split up
> across several patches.
One ceveat here: hdreg.h and WIN_xxx are (ab)used by user-space
so for sure there will be complaints (not that we should care :)...
Bartlomiej
On Fri, Nov 05, 2004 at 02:16:05PM +0100, Bartlomiej Zolnierkiewicz wrote:
> On Thu, 04 Nov 2004 21:43:12 -0500, Jeff Garzik <[email protected]> wrote:
> > Chris, a useful follow-up patch (if Bart agrees) is a global
> > search-n-replace of WIN_xxx constants with ATA_CMD_xxx constants.
> > Depending on the size of the patch, it might even need to be split
> > up across several patches.
Following are three patches doing just thus. They are against bk TOT
with Bart's IDE tree pulled in.
> One ceveat here: hdreg.h and WIN_xxx are (ab)used by user-space so
> for sure there will be complaints (not that we should care :)...
They should fork the values they need then, they are not kernel
specific but come from some nightmarish specification :)
About the following patches:
The first patch adds missing ATA_CMD_* values which the legacy
code will need.
The second patch updates the legacy code (and a couple of
stragglers) to use the new ATA_CMD_* tokens.
The third patch removes the (then) redundant cruft from hdreg.h.
===== include/linux/ata.h 1.19 vs edited =====
--- 1.19/include/linux/ata.h 2004-11-02 11:32:44 -08:00
+++ edited/include/linux/ata.h 2004-11-05 19:04:41 -08:00
@@ -122,6 +122,27 @@
ATA_CMD_SET_FEATURES = 0xEF,
ATA_CMD_PACKET = 0xA0,
+ /* ATA devices commands (used by legacy IDE code) */
+ ATA_CMD_NOP = 0x00,
+ ATA_CMD_SRST = 0x08,
+ ATA_CMD_RESTORE = 0x10,
+ ATA_CMD_MULTREAD_EXT = 0x29,
+ ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
+ ATA_CMD_MULTWRITE_EXT = 0x39,
+ ATA_CMD_SPECIFY = 0x91, /* set geom */
+ ATA_CMD_SMART = 0xB0,
+ ATA_CMD_MULTREAD = 0xC4,
+ ATA_CMD_MULTWRITE = 0xC5,
+ ATA_CMD_MULTSET = 0xC6,
+ ATA_CMD_DOORLOCK = 0xDE,
+ ATA_CMD_DOORUNLOCK = 0xDF,
+ ATA_CMD_STANDBYNOW1 = 0xE0,
+ ATA_CMD_IDLEIMMEDIATE = 0xE1,
+ ATA_CMD_ID_ATA_DMA = 0xEE,
+ ATA_CMD_READ_NATIVE_MAX = 0xF8,
+ ATA_CMD_SET_MAX = 0xF9,
+ ATA_CMD_SET_MAX_EXT = 0x37,
+
/* SETFEATURES stuff */
SETFEATURES_XFER = 0x03,
XFER_UDMA_7 = 0x47,
ide/ide-cd.c | 6 ++--
ide/ide-disk.c | 68 +++++++++++++++++++++++++--------------------------
ide/ide-floppy.c | 4 +--
ide/ide-io.c | 14 +++++-----
ide/ide-iops.c | 10 +++----
ide/ide-probe.c | 30 +++++++++++-----------
ide/ide-tape.c | 4 +--
ide/ide-taskfile.c | 21 ++++++---------
ide/ide.c | 2 -
ide/legacy/hd.c | 11 +++-----
ide/ppc/pmac.c | 2 -
scsi/ide-scsi.c | 6 ++--
usb/storage/isd200.c | 10 +++----
13 files changed, 91 insertions(+), 97 deletions(-)
===== drivers/ide/ide-cd.c 1.96 vs edited =====
--- 1.96/drivers/ide/ide-cd.c 2004-10-25 13:06:46 -07:00
+++ edited/drivers/ide/ide-cd.c 2004-11-05 18:50:43 -08:00
@@ -585,7 +585,7 @@
}
if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
/* force an abort */
- HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_IDLEIMMEDIATE,IDE_COMMAND_REG);
if (rq->errors >= ERROR_MAX) {
DRIVER(drive)->end_request(drive, 0, 0);
} else {
@@ -887,11 +887,11 @@
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
/* packet command */
- ide_execute_command(drive, WIN_PACKETCMD, handler, ATAPI_WAIT_PC, cdrom_timer_expiry);
+ ide_execute_command(drive, ATA_CMD_PACKET, handler, ATAPI_WAIT_PC, cdrom_timer_expiry);
return ide_started;
} else {
/* packet command */
- HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return (*handler) (drive);
}
}
===== drivers/ide/ide-disk.c 1.108 vs edited =====
--- 1.108/drivers/ide/ide-disk.c 2004-10-29 09:34:09 -07:00
+++ edited/drivers/ide/ide-disk.c 2004-11-05 18:50:43 -08:00
@@ -126,7 +126,7 @@
ide_hwif_t *hwif = HWIF(drive);
unsigned int dma = drive->using_dma;
u8 lba48 = (drive->addressing == 1) ? 1 : 0;
- task_ioreg_t command = WIN_NOP;
+ task_ioreg_t command = ATA_CMD_NOP;
ata_nsector_t nsectors;
nsectors.all = (u16) rq->nr_sectors;
@@ -213,13 +213,13 @@
if (dma) {
if (!hwif->dma_setup(drive)) {
if (rq_data_dir(rq)) {
- command = lba48 ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
+ command = lba48 ? ATA_CMD_WRITE_EXT : ATA_CMD_WRITE;
if (drive->vdma)
- command = lba48 ? WIN_WRITE_EXT: WIN_WRITE;
+ command = lba48 ? ATA_CMD_PIO_WRITE_EXT: ATA_CMD_PIO_WRITE;
} else {
- command = lba48 ? WIN_READDMA_EXT : WIN_READDMA;
+ command = lba48 ? ATA_CMD_READ_EXT : ATA_CMD_READ;
if (drive->vdma)
- command = lba48 ? WIN_READ_EXT: WIN_READ;
+ command = lba48 ? ATA_CMD_PIO_READ_EXT: ATA_CMD_PIO_READ;
}
hwif->dma_exec_cmd(drive, command);
hwif->dma_start(drive);
@@ -233,10 +233,10 @@
if (drive->mult_count) {
hwif->data_phase = TASKFILE_MULTI_IN;
- command = lba48 ? WIN_MULTREAD_EXT : WIN_MULTREAD;
+ command = lba48 ? ATA_CMD_MULTREAD_EXT : ATA_CMD_MULTREAD;
} else {
hwif->data_phase = TASKFILE_IN;
- command = lba48 ? WIN_READ_EXT : WIN_READ;
+ command = lba48 ? ATA_CMD_PIO_READ_EXT : ATA_CMD_PIO_READ;
}
ide_execute_command(drive, command, &task_in_intr, WAIT_CMD, NULL);
@@ -244,10 +244,10 @@
} else {
if (drive->mult_count) {
hwif->data_phase = TASKFILE_MULTI_OUT;
- command = lba48 ? WIN_MULTWRITE_EXT : WIN_MULTWRITE;
+ command = lba48 ? ATA_CMD_MULTWRITE_EXT : ATA_CMD_MULTWRITE;
} else {
hwif->data_phase = TASKFILE_OUT;
- command = lba48 ? WIN_WRITE_EXT : WIN_WRITE;
+ command = lba48 ? ATA_CMD_PIO_WRITE_EXT : ATA_CMD_PIO_WRITE;
}
/* FIXME: ->OUTBSYNC ? */
@@ -416,8 +416,8 @@
/* err has different meaning on cdrom and tape */
if (err == ABRT_ERR) {
if (drive->select.b.lba &&
- /* some newer drives don't support WIN_SPECIFY */
- hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY)
+ /* some newer drives don't support ATA_CMD_SPECIFY */
+ hwif->INB(IDE_COMMAND_REG) == ATA_CMD_SPECIFY)
return ide_stopped;
} else if ((err & BAD_CRC) == BAD_CRC) {
/* UDMA crc error, just retry the operation */
@@ -434,7 +434,7 @@
try_to_flush_leftover_data(drive);
if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
/* force an abort */
- hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_IDLEIMMEDIATE,IDE_COMMAND_REG);
}
if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
DRIVER(drive)->end_request(drive, 0, 0);
@@ -482,7 +482,7 @@
/* Create IDE/ATA command request structure */
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_SELECT_OFFSET] = 0x40;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_READ_NATIVE_MAX;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
/* submit command request */
@@ -508,7 +508,7 @@
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_SELECT_OFFSET] = 0x40;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX_EXT;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_READ_NATIVE_MAX_EXT;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
/* submit command request */
@@ -544,7 +544,7 @@
args.tfRegister[IDE_LCYL_OFFSET] = ((addr_req >> 8) & 0xff);
args.tfRegister[IDE_HCYL_OFFSET] = ((addr_req >> 16) & 0xff);
args.tfRegister[IDE_SELECT_OFFSET] = ((addr_req >> 24) & 0x0f) | 0x40;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SET_MAX;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_MAX;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
/* submit command request */
@@ -572,7 +572,7 @@
args.tfRegister[IDE_LCYL_OFFSET] = ((addr_req >>= 8) & 0xff);
args.tfRegister[IDE_HCYL_OFFSET] = ((addr_req >>= 8) & 0xff);
args.tfRegister[IDE_SELECT_OFFSET] = 0x40;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SET_MAX_EXT;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_MAX_EXT;
args.hobRegister[IDE_SECTOR_OFFSET] = (addr_req >>= 8) & 0xff;
args.hobRegister[IDE_LCYL_OFFSET] = (addr_req >>= 8) & 0xff;
args.hobRegister[IDE_HCYL_OFFSET] = (addr_req >>= 8) & 0xff;
@@ -716,7 +716,7 @@
args.tfRegister[IDE_LCYL_OFFSET] = drive->cyl;
args.tfRegister[IDE_HCYL_OFFSET] = drive->cyl>>8;
args.tfRegister[IDE_SELECT_OFFSET] = ((drive->head-1)|drive->select.all)&0xBF;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SPECIFY;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SPECIFY;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &set_geometry_intr;
do_rw_taskfile(drive, &args);
@@ -727,7 +727,7 @@
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_NSECTOR_OFFSET] = drive->sect;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_RESTORE;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_RESTORE;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &recal_intr;
do_rw_taskfile(drive, &args);
@@ -740,7 +740,7 @@
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_NSECTOR_OFFSET] = drive->mult_req;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETMULT;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_MULTSET;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &set_multmode_intr;
do_rw_taskfile(drive, &args);
@@ -779,7 +779,7 @@
args.tfRegister[IDE_FEATURE_OFFSET] = SMART_ENABLE;
args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SMART;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
return ide_raw_taskfile(drive, &args, NULL);
@@ -794,7 +794,7 @@
args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SMART;
args.command_type = IDE_DRIVE_TASK_IN;
args.data_phase = TASKFILE_IN;
args.handler = &task_in_intr;
@@ -810,7 +810,7 @@
args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SMART;
args.command_type = IDE_DRIVE_TASK_IN;
args.data_phase = TASKFILE_IN;
args.handler = &task_in_intr;
@@ -900,9 +900,9 @@
if (ide_id_has_flush_cache_ext(drive->id) &&
(drive->capacity64 >= (1UL << 28)))
- rq->cmd[0] = WIN_FLUSH_CACHE_EXT;
+ rq->cmd[0] = ATA_CMD_FLUSH_EXT;
else
- rq->cmd[0] = WIN_FLUSH_CACHE;
+ rq->cmd[0] = ATA_CMD_FLUSH;
rq->flags |= REQ_DRIVE_TASK | REQ_SOFTBARRIER;
@@ -959,7 +959,7 @@
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ?
SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_FEATURES;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
@@ -977,9 +977,9 @@
memset(&args, 0, sizeof(ide_task_t));
if (ide_id_has_flush_cache_ext(drive->id))
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_FLUSH_EXT;
else
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_FLUSH;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
return ide_raw_taskfile(drive, &args, NULL);
@@ -993,7 +993,7 @@
args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ? SETFEATURES_EN_AAM :
SETFEATURES_DIS_AAM;
args.tfRegister[IDE_NSECTOR_OFFSET] = arg;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_FEATURES;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
ide_raw_taskfile(drive, &args, NULL);
@@ -1084,21 +1084,21 @@
return ide_stopped;
}
if (ide_id_has_flush_cache_ext(drive->id))
- args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT;
+ args->tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_FLUSH_EXT;
else
- args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE;
+ args->tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_FLUSH;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = &task_no_data_intr;
return do_rw_taskfile(drive, args);
case idedisk_pm_standby: /* Suspend step 2 (standby) */
- args->tfRegister[IDE_COMMAND_OFFSET] = WIN_STANDBYNOW1;
+ args->tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_STANDBYNOW1;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = &task_no_data_intr;
return do_rw_taskfile(drive, args);
case idedisk_pm_idle: /* Resume step 1 (idle) */
- args->tfRegister[IDE_COMMAND_OFFSET] = WIN_IDLEIMMEDIATE;
+ args->tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_IDLEIMMEDIATE;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = task_no_data_intr;
return do_rw_taskfile(drive, args);
@@ -1378,7 +1378,7 @@
if (drive->removable && drive->usage == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORLOCK;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_DOORLOCK;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
check_disk_change(inode->i_bdev);
@@ -1401,7 +1401,7 @@
if (drive->removable && drive->usage == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORUNLOCK;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_DOORUNLOCK;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL))
===== drivers/ide/ide-floppy.c 1.44 vs edited =====
--- 1.44/drivers/ide/ide-floppy.c 2004-10-20 01:37:15 -07:00
+++ edited/drivers/ide/ide-floppy.c 2004-11-05 17:49:35 -08:00
@@ -1092,14 +1092,14 @@
if (test_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) {
/* Issue the packet command */
- ide_execute_command(drive, WIN_PACKETCMD,
+ ide_execute_command(drive, ATA_CMD_PACKET,
pkt_xfer_routine,
IDEFLOPPY_WAIT_CMD,
NULL);
return ide_started;
} else {
/* Issue the packet command */
- HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return (*pkt_xfer_routine) (drive);
}
}
===== drivers/ide/ide-io.c 1.35 vs edited =====
--- 1.35/drivers/ide/ide-io.c 2004-11-01 09:06:49 -08:00
+++ edited/drivers/ide/ide-io.c 2004-11-05 18:50:43 -08:00
@@ -66,11 +66,11 @@
rq->flags |= REQ_DRIVE_TASK | REQ_STARTED;
rq->buffer = buf;
- rq->buffer[0] = WIN_FLUSH_CACHE;
+ rq->buffer[0] = ATA_CMD_FLUSH;
if (ide_id_has_flush_cache_ext(drive->id) &&
(drive->capacity64 >= (1UL << 28)))
- rq->buffer[0] = WIN_FLUSH_CACHE_EXT;
+ rq->buffer[0] = ATA_CMD_FLUSH_EXT;
}
/*
@@ -505,9 +505,9 @@
/* err has different meaning on cdrom and tape */
if (err == ABRT_ERR) {
if (drive->select.b.lba &&
- (hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY))
+ (hwif->INB(IDE_COMMAND_REG) == ATA_CMD_SPECIFY))
/* some newer drives don't
- * support WIN_SPECIFY
+ * support ATA_CMD_SPECIFY
*/
return ide_stopped;
} else if ((err & BAD_CRC) == BAD_CRC) {
@@ -527,7 +527,7 @@
}
if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
/* force an abort */
- hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_IDLEIMMEDIATE,IDE_COMMAND_REG);
}
if (rq->errors >= ERROR_MAX) {
DRIVER(drive)->end_request(drive, 0, 0);
@@ -644,7 +644,7 @@
* do_special - issue some special commands
* @drive: drive the command is for
*
- * do_special() is used to issue WIN_SPECIFY, WIN_RESTORE, and WIN_SETMULT
+ * do_special() is used to issue ATA_CMD_SPECIFY, ATA_CMD_RESTORE, and ATA_CMD_MULTSET
* commands to a drive. It used to do much more, but has been scaled
* back.
*/
@@ -770,7 +770,7 @@
printk("fr=0x%02x ", args[2]);
printk("xx=0x%02x\n", args[3]);
#endif
- if (args[0] == WIN_SMART) {
+ if (args[0] == ATA_CMD_SMART) {
hwif->OUTB(0x4f, IDE_LCYL_REG);
hwif->OUTB(0xc2, IDE_HCYL_REG);
hwif->OUTB(args[2],IDE_FEATURE_REG);
===== drivers/ide/ide-iops.c 1.31 vs edited =====
--- 1.31/drivers/ide/ide-iops.c 2004-11-01 09:06:50 -08:00
+++ edited/drivers/ide/ide-iops.c 2004-11-05 18:50:43 -08:00
@@ -650,7 +650,7 @@
int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
{
- if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) &&
+ if ((args->tfRegister[IDE_COMMAND_OFFSET] == ATA_CMD_SET_FEATURES) &&
(args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) &&
(args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) {
#ifndef CONFIG_IDEDMA_IVB
@@ -680,7 +680,7 @@
*/
int set_transfer (ide_drive_t *drive, ide_task_t *args)
{
- if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) &&
+ if ((args->tfRegister[IDE_COMMAND_OFFSET] == ATA_CMD_SET_FEATURES) &&
(args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) &&
(args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) &&
(drive->id->dma_ultra ||
@@ -752,7 +752,7 @@
if (IDE_CONTROL_REG)
hwif->OUTB(drive->ctl,IDE_CONTROL_REG);
msleep(50);
- hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_ID_ATA, IDE_COMMAND_REG);
timeout = jiffies + WAIT_WORSTCASE;
do {
if (time_after(jiffies, timeout)) {
@@ -842,7 +842,7 @@
hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
hwif->OUTB(speed, IDE_NSECTOR_REG);
hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
- hwif->OUTB(WIN_SETFEATURES, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_SET_FEATURES, IDE_COMMAND_REG);
if ((IDE_CONTROL_REG) && (drive->quirk_list == 2))
hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
udelay(1);
@@ -1168,7 +1168,7 @@
pre_reset(drive);
SELECT_DRIVE(drive);
udelay (20);
- hwif->OUTB(WIN_SRST, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_SRST, IDE_COMMAND_REG);
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
__ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL);
spin_unlock_irqrestore(&ide_lock, flags);
===== drivers/ide/ide-probe.c 1.88 vs edited =====
--- 1.88/drivers/ide/ide-probe.c 2004-11-05 15:30:38 -08:00
+++ edited/drivers/ide/ide-probe.c 2004-11-05 18:50:43 -08:00
@@ -151,10 +151,10 @@
#endif /* CONFIG_SCSI_EATA_DMA || CONFIG_SCSI_EATA_PIO */
/*
- * WIN_IDENTIFY returns little-endian info,
- * WIN_PIDENTIFY *usually* returns little-endian info.
+ * ATA_CMD_ID_ATA returns little-endian info,
+ * ATA_CMD_ID_ATAPI *usually* returns little-endian info.
*/
- if (cmd == WIN_PIDENTIFY) {
+ if (cmd == ATA_CMD_ID_ATAPI) {
if ((id->model[0] == 'N' && id->model[1] == 'E') /* NEC */
|| (id->model[0] == 'F' && id->model[1] == 'X') /* Mitsumi */
|| (id->model[0] == 'P' && id->model[1] == 'i'))/* Pioneer */
@@ -177,7 +177,7 @@
/*
* Check for an ATAPI device
*/
- if (cmd == WIN_PIDENTIFY) {
+ if (cmd == ATA_CMD_ID_ATAPI) {
u8 type = (id->config >> 8) & 0x1f;
printk("ATAPI ");
switch (type) {
@@ -287,14 +287,14 @@
/* set features register for atapi
* identify command to be sure of reply
*/
- if ((cmd == WIN_PIDENTIFY))
+ if ((cmd == ATA_CMD_ID_ATAPI))
/* disable dma & overlap */
hwif->OUTB(0, IDE_FEATURE_REG);
/* ask drive for ID */
hwif->OUTB(cmd, IDE_COMMAND_REG);
- timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
+ timeout = ((cmd == ATA_CMD_ID_ATA) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
timeout += jiffies;
do {
if (time_after(jiffies, timeout)) {
@@ -414,13 +414,13 @@
if (drive->present) {
/* avoid waiting for inappropriate probes */
- if ((drive->media != ide_disk) && (cmd == WIN_IDENTIFY))
+ if ((drive->media != ide_disk) && (cmd == ATA_CMD_ID_ATA))
return 4;
}
#ifdef DEBUG
printk("probing for %s: present=%d, media=%d, probetype=%s\n",
drive->name, drive->present, drive->media,
- (cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI");
+ (cmd == ATA_CMD_ID_ATA) ? "ATA" : "ATAPI");
#endif
/* needed for some systems
@@ -441,7 +441,7 @@
}
if (OK_STAT((hwif->INB(IDE_STATUS_REG)), READY_STAT, BUSY_STAT) ||
- drive->present || cmd == WIN_PIDENTIFY) {
+ drive->present || cmd == ATA_CMD_ID_ATAPI) {
/* send cmd and wait */
if ((rc = try_to_identify(drive, cmd))) {
/* failed: try again */
@@ -450,7 +450,7 @@
if (hwif->INB(IDE_STATUS_REG) == (BUSY_STAT|READY_STAT))
return 4;
- if ((rc == 1 && cmd == WIN_PIDENTIFY) &&
+ if ((rc == 1 && cmd == ATA_CMD_ID_ATAPI) &&
((drive->autotune == IDE_TUNE_DEFAULT) ||
(drive->autotune == IDE_TUNE_AUTO))) {
unsigned long timeout;
@@ -460,7 +460,7 @@
msleep(50);
hwif->OUTB(drive->select.all, IDE_SELECT_REG);
msleep(50);
- hwif->OUTB(WIN_SRST, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_SRST, IDE_COMMAND_REG);
timeout = jiffies;
while (((hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) &&
time_before(jiffies, timeout + WAIT_WORSTCASE))
@@ -516,9 +516,9 @@
}
/* if !(success||timed-out) */
- if (do_probe(drive, WIN_IDENTIFY) >= 2) {
+ if (do_probe(drive, ATA_CMD_ID_ATA) >= 2) {
/* look for ATAPI device */
- (void) do_probe(drive, WIN_PIDENTIFY);
+ (void) do_probe(drive, ATA_CMD_ID_ATAPI);
}
}
@@ -559,9 +559,9 @@
if (!drive->noprobe)
{
/* if !(success||timed-out) */
- if (do_probe(drive, WIN_IDENTIFY) >= 2) {
+ if (do_probe(drive, ATA_CMD_ID_ATA) >= 2) {
/* look for ATAPI device */
- (void) do_probe(drive, WIN_PIDENTIFY);
+ (void) do_probe(drive, ATA_CMD_ID_ATAPI);
}
if (strstr(drive->id->model, "E X A B Y T E N E S T"))
enable_nest(drive);
===== drivers/ide/ide-tape.c 1.47 vs edited =====
--- 1.47/drivers/ide/ide-tape.c 2004-10-20 01:37:15 -07:00
+++ edited/drivers/ide/ide-tape.c 2004-11-05 17:49:36 -08:00
@@ -2148,10 +2148,10 @@
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) {
ide_set_handler(drive, &idetape_transfer_pc, IDETAPE_WAIT_CMD, NULL);
- hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return ide_started;
} else {
- hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return idetape_transfer_pc(drive);
}
}
===== drivers/ide/ide-taskfile.c 1.72 vs edited =====
--- 1.72/drivers/ide/ide-taskfile.c 2004-11-01 09:06:50 -08:00
+++ edited/drivers/ide/ide-taskfile.c 2004-11-05 18:50:43 -08:00
@@ -87,9 +87,9 @@
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
if (drive->media == ide_disk)
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_IDENTIFY;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_ID_ATA;
else
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_PIDENTIFY;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_ID_ATAPI;
args.command_type = IDE_DRIVE_TASK_IN;
args.data_phase = TASKFILE_IN;
args.handler = &task_in_intr;
@@ -140,13 +140,10 @@
return ide_stopped;
switch (taskfile->command) {
- case WIN_WRITEDMA_ONCE:
- case WIN_WRITEDMA:
- case WIN_WRITEDMA_EXT:
- case WIN_READDMA_ONCE:
- case WIN_READDMA:
- case WIN_READDMA_EXT:
- case WIN_IDENTIFY_DMA:
+ case ATA_CMD_WRITE:
+ case ATA_CMD_WRITE_EXT:
+ case ATA_CMD_READ:
+ case ATA_CMD_READ_EXT:
if (!hwif->dma_setup(drive)) {
hwif->dma_exec_cmd(drive, taskfile->command);
hwif->dma_start(drive);
@@ -164,7 +161,7 @@
EXPORT_SYMBOL(do_rw_taskfile);
/*
- * set_multmode_intr() is invoked on completion of a WIN_SETMULT cmd.
+ * set_multmode_intr() is invoked on completion of a ATA_CMD_MULTSET cmd.
*/
ide_startstop_t set_multmode_intr (ide_drive_t *drive)
{
@@ -184,7 +181,7 @@
EXPORT_SYMBOL(set_multmode_intr);
/*
- * set_geometry_intr() is invoked on completion of a WIN_SPECIFY cmd.
+ * set_geometry_intr() is invoked on completion of a ATA_CMD_SPECIFY cmd.
*/
ide_startstop_t set_geometry_intr (ide_drive_t *drive)
{
@@ -210,7 +207,7 @@
EXPORT_SYMBOL(set_geometry_intr);
/*
- * recal_intr() is invoked on completion of a WIN_RESTORE (recalibrate) cmd.
+ * recal_intr() is invoked on completion of a ATA_CMD_RESTORE (recalibrate) cmd.
*/
ide_startstop_t recal_intr (ide_drive_t *drive)
{
===== drivers/ide/ide.c 1.169 vs edited =====
--- 1.169/drivers/ide/ide.c 2004-11-05 15:30:38 -08:00
+++ edited/drivers/ide/ide.c 2004-11-05 17:49:36 -08:00
@@ -1390,7 +1390,7 @@
static int set_xfer_rate (ide_drive_t *drive, int arg)
{
int err = ide_wait_cmd(drive,
- WIN_SETFEATURES, (u8) arg,
+ ATA_CMD_SET_FEATURES, (u8) arg,
SETFEATURES_XFER, 0, NULL);
if (!err && arg) {
===== drivers/ide/legacy/hd.c 1.24 vs edited =====
--- 1.24/drivers/ide/legacy/hd.c 2004-06-21 07:11:51 -07:00
+++ edited/drivers/ide/legacy/hd.c 2004-11-05 18:57:56 -08:00
@@ -65,9 +65,6 @@
#define HD_HCYL 0x1f5 /* high byte of starting cyl */
#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
#define HD_STATUS 0x1f7 /* see status-bits */
-#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
-#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
-#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
#define HD_CMD 0x3f6 /* used for resets */
#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
@@ -370,7 +367,7 @@
struct hd_i_struct *disk = &hd_info[i];
disk->special_op = disk->recalibrate = 1;
hd_out(disk,disk->sect,disk->sect,disk->head-1,
- disk->cyl,WIN_SPECIFY,&reset_hd);
+ disk->cyl,ATA_CMD_SPECIFY,&reset_hd);
if (reset)
goto repeat;
} else
@@ -555,7 +552,7 @@
{
if (disk->recalibrate) {
disk->recalibrate = 0;
- hd_out(disk,disk->sect,0,0,0,WIN_RESTORE,&recal_intr);
+ hd_out(disk,disk->sect,0,0,0,ATA_CMD_RESTORE,&recal_intr);
return reset;
}
if (disk->head > 16) {
@@ -627,12 +624,12 @@
if (req->flags & REQ_CMD) {
switch (rq_data_dir(req)) {
case READ:
- hd_out(disk,nsect,sec,head,cyl,WIN_READ,&read_intr);
+ hd_out(disk,nsect,sec,head,cyl,ATA_CMD_PIO_READ,&read_intr);
if (reset)
goto repeat;
break;
case WRITE:
- hd_out(disk,nsect,sec,head,cyl,WIN_WRITE,&write_intr);
+ hd_out(disk,nsect,sec,head,cyl,ATA_CMD_PIO_WRITE,&write_intr);
if (reset)
goto repeat;
if (wait_DRQ()) {
===== drivers/ide/ppc/pmac.c 1.43 vs edited =====
--- 1.43/drivers/ide/ppc/pmac.c 2004-11-01 09:06:50 -08:00
+++ edited/drivers/ide/ppc/pmac.c 2004-11-05 17:49:35 -08:00
@@ -594,7 +594,7 @@
hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
hwif->OUTB(command, IDE_NSECTOR_REG);
hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
- hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
+ hwif->OUTBSYNC(drive, ATA_CMD_SET_FEATURES, IDE_COMMAND_REG);
udelay(1);
/* Timeout bumped for some powerbooks */
result = wait_for_ready(drive, 2000);
===== drivers/scsi/ide-scsi.c 1.47 vs edited =====
--- 1.47/drivers/scsi/ide-scsi.c 2004-10-21 16:46:25 -07:00
+++ edited/drivers/scsi/ide-scsi.c 2004-11-05 18:51:29 -08:00
@@ -320,7 +320,7 @@
if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
/* force an abort */
- HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_IDLEIMMEDIATE,IDE_COMMAND_REG);
rq->errors++;
DRIVER(drive)->end_request(drive, 0, 0);
@@ -657,11 +657,11 @@
ide_set_handler(drive, &idescsi_transfer_pc,
get_timeout(pc), idescsi_expiry);
/* Issue the packet command */
- HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return ide_started;
} else {
/* Issue the packet command */
- HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return idescsi_transfer_pc(drive);
}
}
===== drivers/usb/storage/isd200.c 1.41 vs edited =====
--- 1.41/drivers/usb/storage/isd200.c 2004-10-06 14:35:10 -07:00
+++ edited/drivers/usb/storage/isd200.c 2004-11-05 18:51:42 -08:00
@@ -470,14 +470,14 @@
ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_5;
ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND;
ata.write.DeviceHeadByte = info->DeviceHead;
- ata.write.CommandByte = WIN_SRST;
+ ata.write.CommandByte = ATA_CMD_SRST;
srb->sc_data_direction = DMA_NONE;
break;
case ACTION_IDENTIFY:
US_DEBUGP(" isd200_action(IDENTIFY)\n");
ata.generic.RegisterSelect = REG_COMMAND;
- ata.write.CommandByte = WIN_IDENTIFY;
+ ata.write.CommandByte = ATA_CMD_ID_ATA;
srb->sc_data_direction = DMA_FROM_DEVICE;
srb->request_buffer = (void *) info->id;
srb->request_bufflen = sizeof(struct hd_driveid);
@@ -1242,7 +1242,7 @@
ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8);
ataCdb->write.CylinderLowByte = (unsigned char)cylinder;
ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD);
- ataCdb->write.CommandByte = WIN_READ;
+ ataCdb->write.CommandByte = ATA_CMD_PIO_READ;
break;
case WRITE_10:
@@ -1272,7 +1272,7 @@
ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8);
ataCdb->write.CylinderLowByte = (unsigned char)cylinder;
ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD);
- ataCdb->write.CommandByte = WIN_WRITE;
+ ataCdb->write.CommandByte = ATA_CMD_PIO_WRITE;
break;
case ALLOW_MEDIUM_REMOVAL:
@@ -1286,7 +1286,7 @@
ataCdb->generic.TransferBlockSize = 1;
ataCdb->generic.RegisterSelect = REG_COMMAND;
ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ?
- WIN_DOORLOCK : WIN_DOORUNLOCK;
+ ATA_CMD_DOORLOCK : ATA_CMD_DOORUNLOCK;
srb->request_bufflen = 0;
} else {
US_DEBUGP(" Not removeable media, just report okay\n");
===== include/linux/hdreg.h 1.28 vs edited =====
--- 1.28/include/linux/hdreg.h 2004-11-02 11:32:44 -08:00
+++ edited/include/linux/hdreg.h 2004-11-05 18:56:41 -08:00
@@ -21,12 +21,8 @@
#define HD_HCYL 0x1f5 /* high byte of starting cyl */
#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
#define HD_STATUS 0x1f7 /* see status-bits */
-#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
-#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
-#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
#define HD_CMD 0x3f6 /* used for resets */
-#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
@@ -180,154 +176,20 @@
#define TASKFILE_P_IN_DMAQ 0x2000
#define TASKFILE_P_OUT_DMAQ 0x4000
-/* ATA/ATAPI Commands pre T13 Spec */
-#define WIN_NOP 0x00
-/*
- * 0x01->0x02 Reserved
- */
-#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */
-/*
- * 0x04->0x07 Reserved
- */
-#define WIN_SRST 0x08 /* ATAPI soft reset command */
-#define WIN_DEVICE_RESET 0x08
-/*
- * 0x09->0x0F Reserved
- */
-#define WIN_RECAL 0x10
-#define WIN_RESTORE WIN_RECAL
-/*
- * 0x10->0x1F Reserved
- */
-#define WIN_READ 0x20 /* 28-Bit */
-#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */
-#define WIN_READ_LONG 0x22 /* 28-Bit */
-#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */
-#define WIN_READ_EXT 0x24 /* 48-Bit */
-#define WIN_READDMA_EXT 0x25 /* 48-Bit */
-#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */
-#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */
-/*
- * 0x28
- */
-#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */
-/*
- * 0x2A->0x2F Reserved
- */
-#define WIN_WRITE 0x30 /* 28-Bit */
-#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */
-#define WIN_WRITE_LONG 0x32 /* 28-Bit */
-#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */
-#define WIN_WRITE_EXT 0x34 /* 48-Bit */
-#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */
-#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */
-#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */
-#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */
-#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */
-/*
- * 0x3A->0x3B Reserved
- */
-#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */
-/*
- * 0x3D->0x3F Reserved
- */
-#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */
-#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */
-#define WIN_VERIFY_EXT 0x42 /* 48-Bit */
-/*
- * 0x43->0x4F Reserved
- */
-#define WIN_FORMAT 0x50
-/*
- * 0x51->0x5F Reserved
- */
-#define WIN_INIT 0x60
-/*
- * 0x61->0x5F Reserved
- */
-#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */
-
-#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */
-#define WIN_DIAGNOSE 0x90
-#define WIN_SPECIFY 0x91 /* set drive geometry translation */
-#define WIN_DOWNLOAD_MICROCODE 0x92
-#define WIN_STANDBYNOW2 0x94
-#define WIN_STANDBY2 0x96
-#define WIN_SETIDLE2 0x97
-#define WIN_CHECKPOWERMODE2 0x98
-#define WIN_SLEEPNOW2 0x99
-/*
- * 0x9A VENDOR
- */
-#define WIN_PACKETCMD 0xA0 /* Send a packet command. */
-#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
-#define WIN_QUEUED_SERVICE 0xA2
-#define WIN_SMART 0xB0 /* self-monitoring and reporting */
-#define CFA_ERASE_SECTORS 0xC0
-#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/
-#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
-#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
-#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
-#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
-#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */
-#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
-#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */
-#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
-#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */
-#define WIN_GETMEDIASTATUS 0xDA
-#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */
-#define WIN_POSTBOOT 0xDC
-#define WIN_PREBOOT 0xDD
-#define WIN_DOORLOCK 0xDE /* lock door on removable drives */
-#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
-#define WIN_STANDBYNOW1 0xE0
-#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
-#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */
-#define WIN_SETIDLE1 0xE3
-#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
-#define WIN_CHECKPOWERMODE1 0xE5
-#define WIN_SLEEPNOW1 0xE6
-#define WIN_FLUSH_CACHE 0xE7
-#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
-#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */
- /* SET_FEATURES 0x22 or 0xDD */
-#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */
-#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
-#define WIN_MEDIAEJECT 0xED
-#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
-#define WIN_SETFEATURES 0xEF /* set special drive features */
#define EXABYTE_ENABLE_NEST 0xF0
-#define WIN_SECURITY_SET_PASS 0xF1
-#define WIN_SECURITY_UNLOCK 0xF2
-#define WIN_SECURITY_ERASE_PREPARE 0xF3
-#define WIN_SECURITY_ERASE_UNIT 0xF4
-#define WIN_SECURITY_FREEZE_LOCK 0xF5
-#define WIN_SECURITY_DISABLE 0xF6
-#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */
-#define WIN_SET_MAX 0xF9
-#define DISABLE_SEAGATE 0xFB
-/* WIN_SMART sub-commands */
+/* ATA_CMD_SMART sub-commands */
#define SMART_READ_VALUES 0xD0
#define SMART_READ_THRESHOLDS 0xD1
-#define SMART_AUTOSAVE 0xD2
-#define SMART_SAVE 0xD3
-#define SMART_IMMEDIATE_OFFLINE 0xD4
-#define SMART_READ_LOG_SECTOR 0xD5
-#define SMART_WRITE_LOG_SECTOR 0xD6
-#define SMART_WRITE_THRESHOLDS 0xD7
#define SMART_ENABLE 0xD8
-#define SMART_DISABLE 0xD9
-#define SMART_STATUS 0xDA
-#define SMART_AUTO_OFFLINE 0xDB
/* Password used in TF4 & TF5 executing SMART commands */
#define SMART_LCYL_PASS 0x4F
#define SMART_HCYL_PASS 0xC2
-/* WIN_SETFEATURES sub-commands */
+/* ATA_CMD_SET_FEATURES sub-commands */
#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */
#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
@@ -359,15 +221,6 @@
#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */
#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */
#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */
-
-/* WIN_SECURITY sub-commands */
-
-#define SECURITY_SET_PASSWORD 0xBA
-#define SECURITY_UNLOCK 0xBB
-#define SECURITY_ERASE_PREPARE 0xBC
-#define SECURITY_ERASE_UNIT 0xBD
-#define SECURITY_FREEZE_LOCK 0xBE
-#define SECURITY_DISABLE_PASSWORD 0xBF
struct hd_geometry {
unsigned char heads;
On Fri, 5 Nov 2004 19:23:14 -0800, Chris Wedgwood <[email protected]> wrote:
> @@ -434,7 +434,7 @@
> try_to_flush_leftover_data(drive);
> if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
> /* force an abort */
> - hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
> + hwif->OUTB(ATA_CMD_IDLEIMMEDIATE,IDE_COMMAND_REG);
> }
> if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
> DRIVER(drive)->end_request(drive, 0, 0);
Just a reminder, this error recovery doesn't work on many modern hard
drives, and is a violation of all ATA specs after ATA-2*. In
particular, most Maxtor and Western Digital Drives will not recover
from errors with this command sequence. The preferred error recovery
is to do a reset followed by a set features, because that is what
Windows does (as told to me by a drive vendor). I've tested the
reset/set features method of error recovery and it works on all the
drives I've tried. I have not tried it on any older drives, or any
other types of ATAPI devices.
Ross
*Most drives set the ATA-2 support flag, so technically they are in
violation of the ATA spec if they don't support this error recovery,
but the drive vendors don't care, they just make sure it works with
windows.
On Fri, Nov 05, 2004 at 10:45:04PM -0500, Ross Biro wrote:
> Just a reminder, this error recovery doesn't work on many modern
> hard drives, and is a violation of all ATA specs after ATA-2*.
I think this code is the only user of that token and I wonder how well
tested this is? Bart? Andre?
> In particular, most Maxtor and Western Digital Drives will not
> recover from errors with this command sequence. The preferred error
> recovery is to do a reset followed by a set features, because that
> is what Windows does (as told to me by a drive vendor).
I assume for Windows they do that for all drives? Even older ones?
I also wonder what happens with TCQ when you get an error? Do you
just retry everything outstanding?
> I've tested the reset/set features method of error recovery and it
> works on all the drives I've tried. I have not tried it on any
> older drives, or any other types of ATAPI devices.
It probably should get fixed, there just doesn't seem to be much
incentive to beat on the old IDE code though :( Minor cleanups seem
worthwhile but anything intrusive I worry will break some hard-to-test
platform for someone.
That said, if libata gets PATA support merged then know this is
wonderful there.
On Fri, 5 Nov 2004 19:55:22 -0800, Chris Wedgwood <[email protected]> wrote:
> I assume for Windows they do that for all drives? Even older ones?
Most likely, but that doesn't imply that Windows XP works with ancient
ata drives.
>
> I also wonder what happens with TCQ when you get an error? Do you
> just retry everything outstanding?
My guess is yes, but I'll also bet the drive vendors have not tested
this path well.
> It probably should get fixed, there just doesn't seem to be much
> incentive to beat on the old IDE code though :( Minor cleanups seem
> worthwhile but anything intrusive I worry will break some hard-to-test
> platform for someone.
The best solution is probably to make it user selectable for now. I
know we need the reset/set features, or any sort of error causes a
major melt down. We can default to the current behaviour, so it
shouldn't break anything.
I'll make sure some patches for this are created sometime in the next
couple of months. I'll even try to make sure TCQ gets tested with
them if TCQ works well enough with the current code.
Ross
Ross
Chris Wedgwood wrote:
> ===== include/linux/ata.h 1.19 vs edited =====
> --- 1.19/include/linux/ata.h 2004-11-02 11:32:44 -08:00
> +++ edited/include/linux/ata.h 2004-11-05 19:04:41 -08:00
> @@ -122,6 +122,27 @@
> ATA_CMD_SET_FEATURES = 0xEF,
> ATA_CMD_PACKET = 0xA0,
>
> + /* ATA devices commands (used by legacy IDE code) */
> + ATA_CMD_NOP = 0x00,
> + ATA_CMD_SRST = 0x08,
> + ATA_CMD_RESTORE = 0x10,
> + ATA_CMD_MULTREAD_EXT = 0x29,
> + ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
> + ATA_CMD_MULTWRITE_EXT = 0x39,
> + ATA_CMD_SPECIFY = 0x91, /* set geom */
> + ATA_CMD_SMART = 0xB0,
> + ATA_CMD_MULTREAD = 0xC4,
> + ATA_CMD_MULTWRITE = 0xC5,
> + ATA_CMD_MULTSET = 0xC6,
> + ATA_CMD_DOORLOCK = 0xDE,
> + ATA_CMD_DOORUNLOCK = 0xDF,
> + ATA_CMD_STANDBYNOW1 = 0xE0,
> + ATA_CMD_IDLEIMMEDIATE = 0xE1,
> + ATA_CMD_ID_ATA_DMA = 0xEE,
> + ATA_CMD_READ_NATIVE_MAX = 0xF8,
> + ATA_CMD_SET_MAX = 0xF9,
> + ATA_CMD_SET_MAX_EXT = 0x37,
No need for a separate "section" for ATA_CMD_xxx used by libata versus
IDE driver. ATA_CMD_xxx are just constants, available for any user.
There is no discernible order in current linux/ata.h, so feel free to
alphabetize or order by opcode (or just leave as-is).
Jeff
Jeff Garzik wrote:
> Chris Wedgwood wrote:
>
>> ===== include/linux/ata.h 1.19 vs edited =====
>> --- 1.19/include/linux/ata.h 2004-11-02 11:32:44 -08:00
>> +++ edited/include/linux/ata.h 2004-11-05 19:04:41 -08:00
>> @@ -122,6 +122,27 @@
>> ATA_CMD_SET_FEATURES = 0xEF,
>> ATA_CMD_PACKET = 0xA0,
>>
>> + /* ATA devices commands (used by legacy IDE code) */
>> + ATA_CMD_NOP = 0x00,
>> + ATA_CMD_SRST = 0x08,
>> + ATA_CMD_RESTORE = 0x10,
>> + ATA_CMD_MULTREAD_EXT = 0x29,
>> + ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
>> + ATA_CMD_MULTWRITE_EXT = 0x39,
>> + ATA_CMD_SPECIFY = 0x91, /* set geom */
>> + ATA_CMD_SMART = 0xB0,
>> + ATA_CMD_MULTREAD = 0xC4,
>> + ATA_CMD_MULTWRITE = 0xC5,
>> + ATA_CMD_MULTSET = 0xC6,
>> + ATA_CMD_DOORLOCK = 0xDE,
>> + ATA_CMD_DOORUNLOCK = 0xDF,
>> + ATA_CMD_STANDBYNOW1 = 0xE0,
>> + ATA_CMD_IDLEIMMEDIATE = 0xE1,
>> + ATA_CMD_ID_ATA_DMA = 0xEE,
>> + ATA_CMD_READ_NATIVE_MAX = 0xF8,
>> + ATA_CMD_SET_MAX = 0xF9,
>> + ATA_CMD_SET_MAX_EXT = 0x37,
oh, also:
Please check with ATA/ATAPI-7 command names, rather than just using the
WIN_xxx names with a new prefix. Sometimes the IDE author (from ages
past) would pick names that suited them or the code, but diverged from
the common T13 command name.
Examples:
1) WIN_DIAGNOSE -> ATA_CMD_EDD
2) WIN_QUEUED_SERVICE -> ATA_CMD_SERVICE
3) WIN_STANDBYNOW1 -> ATA_CMD_STANDBY_IMMED
4) WIN_SETIDLE1 -> ATA_CMD_IDLE
5) WIN_CHECKPOWERMODE1 -> ATA_CMD_CHK_PWR_MODE
6) WIN_SLEEPNOW1 -> ATA_CMD_SLEEP
7) some are old ATA-2-era commands, some are vendor-specific commands.
Not much you can do about the naming of these.
8) remove all xxx_ONCE that are not used
9) hdreg.h lists commands in opcode value order
10) Kill WIN_SRST (dups properly named WIN_DEVICE_RESET)
Jeff
On Sat, Nov 06, 2004 at 12:05:02PM -0500, Jeff Garzik wrote:
> Please check with ATA/ATAPI-7 command names, rather than just using
> the WIN_xxx names with a new prefix. Sometimes the IDE author (from
> ages past) would pick names that suited them or the code, but
> diverged from the common T13 command name.
Fair enough
> 7) some are old ATA-2-era commands, some are vendor-specific
> commands. Not much you can do about the naming of these.
Left behind with the exception of two that the spec calls obsolete
(end of table 65 & 66 in the v7 spec I have here)
> 8) remove all xxx_ONCE that are not used
gone
> 9) hdreg.h lists commands in opcode value order
ata.h doesn't have a numeric order though, so i just grouped things
semi-logically for now
> 10) Kill WIN_SRST (dups properly named WIN_DEVICE_RESET)
now ATA_CMD_DEVICE_RESET
note, the following three patches use the names from the spec
verbatim, which makes them a bit long and ugly but not terribly so...
i'm not bothered by them personally and they are not used in that many
places so IMO they should be acceptable as-is ... yes, i know it makes
the formatting of ata.h look funny, but that was bogus anyhow :)
===== include/linux/ata.h 1.19 vs edited =====
--- 1.19/include/linux/ata.h 2004-11-02 11:32:44 -08:00
+++ edited/include/linux/ata.h 2004-11-06 21:39:38 -08:00
@@ -1,4 +1,3 @@
-
/*
Copyright 2003-2004 Red Hat, Inc. All rights reserved.
Copyright 2003-2004 Jeff Garzik
@@ -121,6 +120,26 @@
ATA_CMD_PIO_WRITE_EXT = 0x34,
ATA_CMD_SET_FEATURES = 0xEF,
ATA_CMD_PACKET = 0xA0,
+ ATA_CMD_NOP = 0x00,
+ ATA_CMD_SMART = 0xB0,
+ ATA_CMD_DEVICE_RESET = 0x08,
+ ATA_CMD_READ_MULTIPLE_EXT = 0x29,
+ ATA_CMD_WRITE_MULTIPLE_EXT= 0x39,
+ ATA_CMD_READ_MULTIPLE = 0xC4,
+ ATA_CMD_WRITE_MULTIPLE = 0xC5,
+ ATA_CMD_SET_MULTIPLE_MODE = 0xC6,
+ ATA_CMD_MEDIA_LOCK = 0xDE,
+ ATA_CMD_MEDIA_UNLOCK = 0xDF,
+ ATA_CMD_STANDBY_IMMEDIATE = 0xE0,
+ ATA_CMD_IDLE_IMMEDIATE = 0xE1,
+ ATA_CMD_READ_NATIVE_MAX_ADDRESS = 0xF8,
+ ATA_CMD_READ_NATIVE_MAX_ADDRESS_EXT = 0x27,
+ ATA_CMD_SET_MAX_ADDRESS = 0xF9,
+ ATA_CMD_SET_MAX_ADDRESS_EXT = 0x37,
+
+ /* marked obsolete in the ATA/ATAPI-7 spec */
+ ATA_CMD_RESTORE = 0x10,
+ ATA_CMD_SPECIFY = 0x91,
/* SETFEATURES stuff */
SETFEATURES_XFER = 0x03,
===== include/linux/hdreg.h 1.28 vs edited =====
--- 1.28/include/linux/hdreg.h 2004-11-02 11:32:44 -08:00
+++ edited/include/linux/hdreg.h 2004-11-06 21:49:37 -08:00
@@ -21,12 +21,8 @@
#define HD_HCYL 0x1f5 /* high byte of starting cyl */
#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
#define HD_STATUS 0x1f7 /* see status-bits */
-#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
-#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
-#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
#define HD_CMD 0x3f6 /* used for resets */
-#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
@@ -180,154 +176,20 @@
#define TASKFILE_P_IN_DMAQ 0x2000
#define TASKFILE_P_OUT_DMAQ 0x4000
-/* ATA/ATAPI Commands pre T13 Spec */
-#define WIN_NOP 0x00
-/*
- * 0x01->0x02 Reserved
- */
-#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */
-/*
- * 0x04->0x07 Reserved
- */
-#define WIN_SRST 0x08 /* ATAPI soft reset command */
-#define WIN_DEVICE_RESET 0x08
-/*
- * 0x09->0x0F Reserved
- */
-#define WIN_RECAL 0x10
-#define WIN_RESTORE WIN_RECAL
-/*
- * 0x10->0x1F Reserved
- */
-#define WIN_READ 0x20 /* 28-Bit */
-#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */
-#define WIN_READ_LONG 0x22 /* 28-Bit */
-#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */
-#define WIN_READ_EXT 0x24 /* 48-Bit */
-#define WIN_READDMA_EXT 0x25 /* 48-Bit */
-#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */
-#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */
-/*
- * 0x28
- */
-#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */
-/*
- * 0x2A->0x2F Reserved
- */
-#define WIN_WRITE 0x30 /* 28-Bit */
-#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */
-#define WIN_WRITE_LONG 0x32 /* 28-Bit */
-#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */
-#define WIN_WRITE_EXT 0x34 /* 48-Bit */
-#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */
-#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */
-#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */
-#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */
-#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */
-/*
- * 0x3A->0x3B Reserved
- */
-#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */
-/*
- * 0x3D->0x3F Reserved
- */
-#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */
-#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */
-#define WIN_VERIFY_EXT 0x42 /* 48-Bit */
-/*
- * 0x43->0x4F Reserved
- */
-#define WIN_FORMAT 0x50
-/*
- * 0x51->0x5F Reserved
- */
-#define WIN_INIT 0x60
-/*
- * 0x61->0x5F Reserved
- */
-#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */
-
-#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */
-#define WIN_DIAGNOSE 0x90
-#define WIN_SPECIFY 0x91 /* set drive geometry translation */
-#define WIN_DOWNLOAD_MICROCODE 0x92
-#define WIN_STANDBYNOW2 0x94
-#define WIN_STANDBY2 0x96
-#define WIN_SETIDLE2 0x97
-#define WIN_CHECKPOWERMODE2 0x98
-#define WIN_SLEEPNOW2 0x99
-/*
- * 0x9A VENDOR
- */
-#define WIN_PACKETCMD 0xA0 /* Send a packet command. */
-#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
-#define WIN_QUEUED_SERVICE 0xA2
-#define WIN_SMART 0xB0 /* self-monitoring and reporting */
-#define CFA_ERASE_SECTORS 0xC0
-#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/
-#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
-#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
-#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
-#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
-#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */
-#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
-#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */
-#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
-#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */
-#define WIN_GETMEDIASTATUS 0xDA
-#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */
-#define WIN_POSTBOOT 0xDC
-#define WIN_PREBOOT 0xDD
-#define WIN_DOORLOCK 0xDE /* lock door on removable drives */
-#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
-#define WIN_STANDBYNOW1 0xE0
-#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
-#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */
-#define WIN_SETIDLE1 0xE3
-#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
-#define WIN_CHECKPOWERMODE1 0xE5
-#define WIN_SLEEPNOW1 0xE6
-#define WIN_FLUSH_CACHE 0xE7
-#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
-#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */
- /* SET_FEATURES 0x22 or 0xDD */
-#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */
-#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
-#define WIN_MEDIAEJECT 0xED
-#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
-#define WIN_SETFEATURES 0xEF /* set special drive features */
#define EXABYTE_ENABLE_NEST 0xF0
-#define WIN_SECURITY_SET_PASS 0xF1
-#define WIN_SECURITY_UNLOCK 0xF2
-#define WIN_SECURITY_ERASE_PREPARE 0xF3
-#define WIN_SECURITY_ERASE_UNIT 0xF4
-#define WIN_SECURITY_FREEZE_LOCK 0xF5
-#define WIN_SECURITY_DISABLE 0xF6
-#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */
-#define WIN_SET_MAX 0xF9
-#define DISABLE_SEAGATE 0xFB
-/* WIN_SMART sub-commands */
+/* ATA_CMD_SMART sub-commands */
#define SMART_READ_VALUES 0xD0
#define SMART_READ_THRESHOLDS 0xD1
-#define SMART_AUTOSAVE 0xD2
-#define SMART_SAVE 0xD3
-#define SMART_IMMEDIATE_OFFLINE 0xD4
-#define SMART_READ_LOG_SECTOR 0xD5
-#define SMART_WRITE_LOG_SECTOR 0xD6
-#define SMART_WRITE_THRESHOLDS 0xD7
#define SMART_ENABLE 0xD8
-#define SMART_DISABLE 0xD9
-#define SMART_STATUS 0xDA
-#define SMART_AUTO_OFFLINE 0xDB
/* Password used in TF4 & TF5 executing SMART commands */
#define SMART_LCYL_PASS 0x4F
#define SMART_HCYL_PASS 0xC2
-/* WIN_SETFEATURES sub-commands */
+/* ATA_CMD_SET_FEATURES sub-commands */
#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */
#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
@@ -359,15 +221,6 @@
#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */
#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */
#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */
-
-/* WIN_SECURITY sub-commands */
-
-#define SECURITY_SET_PASSWORD 0xBA
-#define SECURITY_UNLOCK 0xBB
-#define SECURITY_ERASE_PREPARE 0xBC
-#define SECURITY_ERASE_UNIT 0xBD
-#define SECURITY_FREEZE_LOCK 0xBE
-#define SECURITY_DISABLE_PASSWORD 0xBF
struct hd_geometry {
unsigned char heads;
ide/ide-cd.c | 6 ++--
ide/ide-disk.c | 68 +++++++++++++++++++++++++--------------------------
ide/ide-floppy.c | 4 +--
ide/ide-io.c | 14 +++++-----
ide/ide-iops.c | 10 +++----
ide/ide-probe.c | 30 +++++++++++-----------
ide/ide-tape.c | 4 +--
ide/ide-taskfile.c | 21 ++++++---------
ide/ide.c | 2 -
ide/legacy/hd.c | 8 +++---
ide/ppc/pmac.c | 2 -
scsi/ide-scsi.c | 6 ++--
usb/storage/isd200.c | 10 +++----
13 files changed, 91 insertions(+), 94 deletions(-)
===== drivers/ide/ide-cd.c 1.96 vs edited =====
Index: cw-current/drivers/ide/ide-cd.c
===================================================================
--- cw-current.orig/drivers/ide/ide-cd.c 2004-11-06 21:54:32.877043104 -0800
+++ cw-current/drivers/ide/ide-cd.c 2004-11-06 21:54:32.880043207 -0800
@@ -585,7 +585,7 @@
}
if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
/* force an abort */
- HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_IDLE_IMMEDIATE,IDE_COMMAND_REG);
if (rq->errors >= ERROR_MAX) {
DRIVER(drive)->end_request(drive, 0, 0);
} else {
@@ -887,11 +887,11 @@
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
/* packet command */
- ide_execute_command(drive, WIN_PACKETCMD, handler, ATAPI_WAIT_PC, cdrom_timer_expiry);
+ ide_execute_command(drive, ATA_CMD_PACKET, handler, ATAPI_WAIT_PC, cdrom_timer_expiry);
return ide_started;
} else {
/* packet command */
- HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return (*handler) (drive);
}
}
Index: cw-current/drivers/ide/ide-disk.c
===================================================================
--- cw-current.orig/drivers/ide/ide-disk.c 2004-11-06 21:54:32.903044003 -0800
+++ cw-current/drivers/ide/ide-disk.c 2004-11-06 21:54:32.906044107 -0800
@@ -126,7 +126,7 @@
ide_hwif_t *hwif = HWIF(drive);
unsigned int dma = drive->using_dma;
u8 lba48 = (drive->addressing == 1) ? 1 : 0;
- task_ioreg_t command = WIN_NOP;
+ task_ioreg_t command = ATA_CMD_NOP;
ata_nsector_t nsectors;
nsectors.all = (u16) rq->nr_sectors;
@@ -213,13 +213,13 @@
if (dma) {
if (!hwif->dma_setup(drive)) {
if (rq_data_dir(rq)) {
- command = lba48 ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
+ command = lba48 ? ATA_CMD_WRITE_EXT : ATA_CMD_WRITE;
if (drive->vdma)
- command = lba48 ? WIN_WRITE_EXT: WIN_WRITE;
+ command = lba48 ? ATA_CMD_PIO_WRITE_EXT: ATA_CMD_PIO_WRITE;
} else {
- command = lba48 ? WIN_READDMA_EXT : WIN_READDMA;
+ command = lba48 ? ATA_CMD_READ_EXT : ATA_CMD_READ;
if (drive->vdma)
- command = lba48 ? WIN_READ_EXT: WIN_READ;
+ command = lba48 ? ATA_CMD_PIO_READ_EXT: ATA_CMD_PIO_READ;
}
hwif->dma_exec_cmd(drive, command);
hwif->dma_start(drive);
@@ -233,10 +233,10 @@
if (drive->mult_count) {
hwif->data_phase = TASKFILE_MULTI_IN;
- command = lba48 ? WIN_MULTREAD_EXT : WIN_MULTREAD;
+ command = lba48 ? ATA_CMD_READ_MULTIPLE_EXT : ATA_CMD_READ_MULTIPLE;
} else {
hwif->data_phase = TASKFILE_IN;
- command = lba48 ? WIN_READ_EXT : WIN_READ;
+ command = lba48 ? ATA_CMD_PIO_READ_EXT : ATA_CMD_PIO_READ;
}
ide_execute_command(drive, command, &task_in_intr, WAIT_CMD, NULL);
@@ -244,10 +244,10 @@
} else {
if (drive->mult_count) {
hwif->data_phase = TASKFILE_MULTI_OUT;
- command = lba48 ? WIN_MULTWRITE_EXT : WIN_MULTWRITE;
+ command = lba48 ? ATA_CMD_WRITE_MULTIPLE_EXT : ATA_CMD_WRITE_MULTIPLE;
} else {
hwif->data_phase = TASKFILE_OUT;
- command = lba48 ? WIN_WRITE_EXT : WIN_WRITE;
+ command = lba48 ? ATA_CMD_PIO_WRITE_EXT : ATA_CMD_PIO_WRITE;
}
/* FIXME: ->OUTBSYNC ? */
@@ -416,8 +416,8 @@
/* err has different meaning on cdrom and tape */
if (err == ABRT_ERR) {
if (drive->select.b.lba &&
- /* some newer drives don't support WIN_SPECIFY */
- hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY)
+ /* some newer drives don't support ATA_CMD_SPECIFY */
+ hwif->INB(IDE_COMMAND_REG) == ATA_CMD_SPECIFY)
return ide_stopped;
} else if ((err & BAD_CRC) == BAD_CRC) {
/* UDMA crc error, just retry the operation */
@@ -434,7 +434,7 @@
try_to_flush_leftover_data(drive);
if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
/* force an abort */
- hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_IDLE_IMMEDIATE,IDE_COMMAND_REG);
}
if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
DRIVER(drive)->end_request(drive, 0, 0);
@@ -482,7 +482,7 @@
/* Create IDE/ATA command request structure */
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_SELECT_OFFSET] = 0x40;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_READ_NATIVE_MAX_ADDRESS;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
/* submit command request */
@@ -508,7 +508,7 @@
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_SELECT_OFFSET] = 0x40;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX_EXT;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_READ_NATIVE_MAX_ADDRESS_EXT;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
/* submit command request */
@@ -544,7 +544,7 @@
args.tfRegister[IDE_LCYL_OFFSET] = ((addr_req >> 8) & 0xff);
args.tfRegister[IDE_HCYL_OFFSET] = ((addr_req >> 16) & 0xff);
args.tfRegister[IDE_SELECT_OFFSET] = ((addr_req >> 24) & 0x0f) | 0x40;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SET_MAX;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_MAX_ADDRESS;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
/* submit command request */
@@ -572,7 +572,7 @@
args.tfRegister[IDE_LCYL_OFFSET] = ((addr_req >>= 8) & 0xff);
args.tfRegister[IDE_HCYL_OFFSET] = ((addr_req >>= 8) & 0xff);
args.tfRegister[IDE_SELECT_OFFSET] = 0x40;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SET_MAX_EXT;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_MAX_ADDRESS_EXT;
args.hobRegister[IDE_SECTOR_OFFSET] = (addr_req >>= 8) & 0xff;
args.hobRegister[IDE_LCYL_OFFSET] = (addr_req >>= 8) & 0xff;
args.hobRegister[IDE_HCYL_OFFSET] = (addr_req >>= 8) & 0xff;
@@ -716,7 +716,7 @@
args.tfRegister[IDE_LCYL_OFFSET] = drive->cyl;
args.tfRegister[IDE_HCYL_OFFSET] = drive->cyl>>8;
args.tfRegister[IDE_SELECT_OFFSET] = ((drive->head-1)|drive->select.all)&0xBF;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SPECIFY;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SPECIFY;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &set_geometry_intr;
do_rw_taskfile(drive, &args);
@@ -727,7 +727,7 @@
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_NSECTOR_OFFSET] = drive->sect;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_RESTORE;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_RESTORE;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &recal_intr;
do_rw_taskfile(drive, &args);
@@ -740,7 +740,7 @@
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_NSECTOR_OFFSET] = drive->mult_req;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETMULT;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_MULTIPLE_MODE;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &set_multmode_intr;
do_rw_taskfile(drive, &args);
@@ -779,7 +779,7 @@
args.tfRegister[IDE_FEATURE_OFFSET] = SMART_ENABLE;
args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SMART;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
return ide_raw_taskfile(drive, &args, NULL);
@@ -794,7 +794,7 @@
args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SMART;
args.command_type = IDE_DRIVE_TASK_IN;
args.data_phase = TASKFILE_IN;
args.handler = &task_in_intr;
@@ -810,7 +810,7 @@
args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SMART;
args.command_type = IDE_DRIVE_TASK_IN;
args.data_phase = TASKFILE_IN;
args.handler = &task_in_intr;
@@ -900,9 +900,9 @@
if (ide_id_has_flush_cache_ext(drive->id) &&
(drive->capacity64 >= (1UL << 28)))
- rq->cmd[0] = WIN_FLUSH_CACHE_EXT;
+ rq->cmd[0] = ATA_CMD_FLUSH_EXT;
else
- rq->cmd[0] = WIN_FLUSH_CACHE;
+ rq->cmd[0] = ATA_CMD_FLUSH;
rq->flags |= REQ_DRIVE_TASK | REQ_SOFTBARRIER;
@@ -959,7 +959,7 @@
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ?
SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_FEATURES;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
@@ -977,9 +977,9 @@
memset(&args, 0, sizeof(ide_task_t));
if (ide_id_has_flush_cache_ext(drive->id))
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_FLUSH_EXT;
else
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_FLUSH;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
return ide_raw_taskfile(drive, &args, NULL);
@@ -993,7 +993,7 @@
args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ? SETFEATURES_EN_AAM :
SETFEATURES_DIS_AAM;
args.tfRegister[IDE_NSECTOR_OFFSET] = arg;
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_SET_FEATURES;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
ide_raw_taskfile(drive, &args, NULL);
@@ -1084,21 +1084,21 @@
return ide_stopped;
}
if (ide_id_has_flush_cache_ext(drive->id))
- args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT;
+ args->tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_FLUSH_EXT;
else
- args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE;
+ args->tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_FLUSH;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = &task_no_data_intr;
return do_rw_taskfile(drive, args);
case idedisk_pm_standby: /* Suspend step 2 (standby) */
- args->tfRegister[IDE_COMMAND_OFFSET] = WIN_STANDBYNOW1;
+ args->tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_STANDBY_IMMEDIATE;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = &task_no_data_intr;
return do_rw_taskfile(drive, args);
case idedisk_pm_idle: /* Resume step 1 (idle) */
- args->tfRegister[IDE_COMMAND_OFFSET] = WIN_IDLEIMMEDIATE;
+ args->tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_IDLE_IMMEDIATE;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = task_no_data_intr;
return do_rw_taskfile(drive, args);
@@ -1378,7 +1378,7 @@
if (drive->removable && drive->usage == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORLOCK;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_MEDIA_LOCK;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
check_disk_change(inode->i_bdev);
@@ -1401,7 +1401,7 @@
if (drive->removable && drive->usage == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORUNLOCK;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_MEDIA_UNLOCK;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
args.handler = &task_no_data_intr;
if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL))
Index: cw-current/drivers/ide/ide-floppy.c
===================================================================
--- cw-current.orig/drivers/ide/ide-floppy.c 2004-11-06 21:37:01.323677199 -0800
+++ cw-current/drivers/ide/ide-floppy.c 2004-11-06 21:54:32.907044141 -0800
@@ -1092,14 +1092,14 @@
if (test_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) {
/* Issue the packet command */
- ide_execute_command(drive, WIN_PACKETCMD,
+ ide_execute_command(drive, ATA_CMD_PACKET,
pkt_xfer_routine,
IDEFLOPPY_WAIT_CMD,
NULL);
return ide_started;
} else {
/* Issue the packet command */
- HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return (*pkt_xfer_routine) (drive);
}
}
Index: cw-current/drivers/ide/ide-io.c
===================================================================
--- cw-current.orig/drivers/ide/ide-io.c 2004-11-06 21:54:32.926044798 -0800
+++ cw-current/drivers/ide/ide-io.c 2004-11-06 21:54:32.927044833 -0800
@@ -66,11 +66,11 @@
rq->flags |= REQ_DRIVE_TASK | REQ_STARTED;
rq->buffer = buf;
- rq->buffer[0] = WIN_FLUSH_CACHE;
+ rq->buffer[0] = ATA_CMD_FLUSH;
if (ide_id_has_flush_cache_ext(drive->id) &&
(drive->capacity64 >= (1UL << 28)))
- rq->buffer[0] = WIN_FLUSH_CACHE_EXT;
+ rq->buffer[0] = ATA_CMD_FLUSH_EXT;
}
/*
@@ -505,9 +505,9 @@
/* err has different meaning on cdrom and tape */
if (err == ABRT_ERR) {
if (drive->select.b.lba &&
- (hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY))
+ (hwif->INB(IDE_COMMAND_REG) == ATA_CMD_SPECIFY))
/* some newer drives don't
- * support WIN_SPECIFY
+ * support ATA_CMD_SPECIFY
*/
return ide_stopped;
} else if ((err & BAD_CRC) == BAD_CRC) {
@@ -527,7 +527,7 @@
}
if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
/* force an abort */
- hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_IDLE_IMMEDIATE,IDE_COMMAND_REG);
}
if (rq->errors >= ERROR_MAX) {
DRIVER(drive)->end_request(drive, 0, 0);
@@ -644,7 +644,7 @@
* do_special - issue some special commands
* @drive: drive the command is for
*
- * do_special() is used to issue WIN_SPECIFY, WIN_RESTORE, and WIN_SETMULT
+ * do_special() is used to issue ATA_CMD_SPECIFY, ATA_CMD_RESTORE, and ATA_CMD_SET_MULTIPLE_MODE
* commands to a drive. It used to do much more, but has been scaled
* back.
*/
@@ -770,7 +770,7 @@
printk("fr=0x%02x ", args[2]);
printk("xx=0x%02x\n", args[3]);
#endif
- if (args[0] == WIN_SMART) {
+ if (args[0] == ATA_CMD_SMART) {
hwif->OUTB(0x4f, IDE_LCYL_REG);
hwif->OUTB(0xc2, IDE_HCYL_REG);
hwif->OUTB(args[2],IDE_FEATURE_REG);
Index: cw-current/drivers/ide/ide-iops.c
===================================================================
--- cw-current.orig/drivers/ide/ide-iops.c 2004-11-06 21:37:02.758726828 -0800
+++ cw-current/drivers/ide/ide-iops.c 2004-11-06 21:54:32.929044902 -0800
@@ -650,7 +650,7 @@
int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
{
- if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) &&
+ if ((args->tfRegister[IDE_COMMAND_OFFSET] == ATA_CMD_SET_FEATURES) &&
(args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) &&
(args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) {
#ifndef CONFIG_IDEDMA_IVB
@@ -680,7 +680,7 @@
*/
int set_transfer (ide_drive_t *drive, ide_task_t *args)
{
- if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) &&
+ if ((args->tfRegister[IDE_COMMAND_OFFSET] == ATA_CMD_SET_FEATURES) &&
(args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) &&
(args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) &&
(drive->id->dma_ultra ||
@@ -752,7 +752,7 @@
if (IDE_CONTROL_REG)
hwif->OUTB(drive->ctl,IDE_CONTROL_REG);
msleep(50);
- hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_ID_ATA, IDE_COMMAND_REG);
timeout = jiffies + WAIT_WORSTCASE;
do {
if (time_after(jiffies, timeout)) {
@@ -842,7 +842,7 @@
hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
hwif->OUTB(speed, IDE_NSECTOR_REG);
hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
- hwif->OUTB(WIN_SETFEATURES, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_SET_FEATURES, IDE_COMMAND_REG);
if ((IDE_CONTROL_REG) && (drive->quirk_list == 2))
hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
udelay(1);
@@ -1168,7 +1168,7 @@
pre_reset(drive);
SELECT_DRIVE(drive);
udelay (20);
- hwif->OUTB(WIN_SRST, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_DEVICE_RESET, IDE_COMMAND_REG);
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
__ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL);
spin_unlock_irqrestore(&ide_lock, flags);
Index: cw-current/drivers/ide/ide-probe.c
===================================================================
--- cw-current.orig/drivers/ide/ide-probe.c 2004-11-06 21:37:03.390748685 -0800
+++ cw-current/drivers/ide/ide-probe.c 2004-11-06 21:54:32.930044937 -0800
@@ -151,10 +151,10 @@
#endif /* CONFIG_SCSI_EATA_DMA || CONFIG_SCSI_EATA_PIO */
/*
- * WIN_IDENTIFY returns little-endian info,
- * WIN_PIDENTIFY *usually* returns little-endian info.
+ * ATA_CMD_ID_ATA returns little-endian info,
+ * ATA_CMD_ID_ATAPI *usually* returns little-endian info.
*/
- if (cmd == WIN_PIDENTIFY) {
+ if (cmd == ATA_CMD_ID_ATAPI) {
if ((id->model[0] == 'N' && id->model[1] == 'E') /* NEC */
|| (id->model[0] == 'F' && id->model[1] == 'X') /* Mitsumi */
|| (id->model[0] == 'P' && id->model[1] == 'i'))/* Pioneer */
@@ -177,7 +177,7 @@
/*
* Check for an ATAPI device
*/
- if (cmd == WIN_PIDENTIFY) {
+ if (cmd == ATA_CMD_ID_ATAPI) {
u8 type = (id->config >> 8) & 0x1f;
printk("ATAPI ");
switch (type) {
@@ -287,14 +287,14 @@
/* set features register for atapi
* identify command to be sure of reply
*/
- if ((cmd == WIN_PIDENTIFY))
+ if ((cmd == ATA_CMD_ID_ATAPI))
/* disable dma & overlap */
hwif->OUTB(0, IDE_FEATURE_REG);
/* ask drive for ID */
hwif->OUTB(cmd, IDE_COMMAND_REG);
- timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
+ timeout = ((cmd == ATA_CMD_ID_ATA) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
timeout += jiffies;
do {
if (time_after(jiffies, timeout)) {
@@ -414,13 +414,13 @@
if (drive->present) {
/* avoid waiting for inappropriate probes */
- if ((drive->media != ide_disk) && (cmd == WIN_IDENTIFY))
+ if ((drive->media != ide_disk) && (cmd == ATA_CMD_ID_ATA))
return 4;
}
#ifdef DEBUG
printk("probing for %s: present=%d, media=%d, probetype=%s\n",
drive->name, drive->present, drive->media,
- (cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI");
+ (cmd == ATA_CMD_ID_ATA) ? "ATA" : "ATAPI");
#endif
/* needed for some systems
@@ -441,7 +441,7 @@
}
if (OK_STAT((hwif->INB(IDE_STATUS_REG)), READY_STAT, BUSY_STAT) ||
- drive->present || cmd == WIN_PIDENTIFY) {
+ drive->present || cmd == ATA_CMD_ID_ATAPI) {
/* send cmd and wait */
if ((rc = try_to_identify(drive, cmd))) {
/* failed: try again */
@@ -450,7 +450,7 @@
if (hwif->INB(IDE_STATUS_REG) == (BUSY_STAT|READY_STAT))
return 4;
- if ((rc == 1 && cmd == WIN_PIDENTIFY) &&
+ if ((rc == 1 && cmd == ATA_CMD_ID_ATAPI) &&
((drive->autotune == IDE_TUNE_DEFAULT) ||
(drive->autotune == IDE_TUNE_AUTO))) {
unsigned long timeout;
@@ -460,7 +460,7 @@
msleep(50);
hwif->OUTB(drive->select.all, IDE_SELECT_REG);
msleep(50);
- hwif->OUTB(WIN_SRST, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_DEVICE_RESET, IDE_COMMAND_REG);
timeout = jiffies;
while (((hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) &&
time_before(jiffies, timeout + WAIT_WORSTCASE))
@@ -516,9 +516,9 @@
}
/* if !(success||timed-out) */
- if (do_probe(drive, WIN_IDENTIFY) >= 2) {
+ if (do_probe(drive, ATA_CMD_ID_ATA) >= 2) {
/* look for ATAPI device */
- (void) do_probe(drive, WIN_PIDENTIFY);
+ (void) do_probe(drive, ATA_CMD_ID_ATAPI);
}
}
@@ -559,9 +559,9 @@
if (!drive->noprobe)
{
/* if !(success||timed-out) */
- if (do_probe(drive, WIN_IDENTIFY) >= 2) {
+ if (do_probe(drive, ATA_CMD_ID_ATA) >= 2) {
/* look for ATAPI device */
- (void) do_probe(drive, WIN_PIDENTIFY);
+ (void) do_probe(drive, ATA_CMD_ID_ATAPI);
}
if (strstr(drive->id->model, "E X A B Y T E N E S T"))
enable_nest(drive);
Index: cw-current/drivers/ide/ide-tape.c
===================================================================
--- cw-current.orig/drivers/ide/ide-tape.c 2004-11-06 21:37:03.953768156 -0800
+++ cw-current/drivers/ide/ide-tape.c 2004-11-06 21:54:32.933045040 -0800
@@ -2148,10 +2148,10 @@
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) {
ide_set_handler(drive, &idetape_transfer_pc, IDETAPE_WAIT_CMD, NULL);
- hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return ide_started;
} else {
- hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ hwif->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return idetape_transfer_pc(drive);
}
}
Index: cw-current/drivers/ide/ide-taskfile.c
===================================================================
--- cw-current.orig/drivers/ide/ide-taskfile.c 2004-11-06 21:54:32.955045801 -0800
+++ cw-current/drivers/ide/ide-taskfile.c 2004-11-06 21:56:17.327655323 -0800
@@ -87,9 +87,9 @@
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
if (drive->media == ide_disk)
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_IDENTIFY;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_ID_ATA;
else
- args.tfRegister[IDE_COMMAND_OFFSET] = WIN_PIDENTIFY;
+ args.tfRegister[IDE_COMMAND_OFFSET] = ATA_CMD_ID_ATAPI;
args.command_type = IDE_DRIVE_TASK_IN;
args.data_phase = TASKFILE_IN;
args.handler = &task_in_intr;
@@ -140,13 +140,10 @@
return ide_stopped;
switch (taskfile->command) {
- case WIN_WRITEDMA_ONCE:
- case WIN_WRITEDMA:
- case WIN_WRITEDMA_EXT:
- case WIN_READDMA_ONCE:
- case WIN_READDMA:
- case WIN_READDMA_EXT:
- case WIN_IDENTIFY_DMA:
+ case ATA_CMD_WRITE:
+ case ATA_CMD_WRITE_EXT:
+ case ATA_CMD_READ:
+ case ATA_CMD_READ_EXT:
if (!hwif->dma_setup(drive)) {
hwif->dma_exec_cmd(drive, taskfile->command);
hwif->dma_start(drive);
@@ -164,7 +161,7 @@
EXPORT_SYMBOL(do_rw_taskfile);
/*
- * set_multmode_intr() is invoked on completion of a WIN_SETMULT cmd.
+ * set_multmode_intr() is invoked on completion of a ATA_CMD_SET_MULTIPLE_MODE cmd.
*/
ide_startstop_t set_multmode_intr (ide_drive_t *drive)
{
@@ -184,7 +181,7 @@
EXPORT_SYMBOL(set_multmode_intr);
/*
- * set_geometry_intr() is invoked on completion of a WIN_SPECIFY cmd.
+ * set_geometry_intr() is invoked on completion of a ATA_CMD_SPECIFY cmd.
*/
ide_startstop_t set_geometry_intr (ide_drive_t *drive)
{
@@ -210,7 +207,7 @@
EXPORT_SYMBOL(set_geometry_intr);
/*
- * recal_intr() is invoked on completion of a WIN_RESTORE (recalibrate) cmd.
+ * recal_intr() is invoked on completion of a ATA_CMD_RESTORE (recalibrate) cmd.
*/
ide_startstop_t recal_intr (ide_drive_t *drive)
{
Index: cw-current/drivers/ide/ide.c
===================================================================
--- cw-current.orig/drivers/ide/ide.c 2004-11-06 21:37:05.509821969 -0800
+++ cw-current/drivers/ide/ide.c 2004-11-06 21:54:32.958045905 -0800
@@ -1390,7 +1390,7 @@
static int set_xfer_rate (ide_drive_t *drive, int arg)
{
int err = ide_wait_cmd(drive,
- WIN_SETFEATURES, (u8) arg,
+ ATA_CMD_SET_FEATURES, (u8) arg,
SETFEATURES_XFER, 0, NULL);
if (!err && arg) {
Index: cw-current/drivers/ide/legacy/hd.c
===================================================================
--- cw-current.orig/drivers/ide/legacy/hd.c 2004-11-06 21:37:06.345850881 -0800
+++ cw-current/drivers/ide/legacy/hd.c 2004-11-06 21:54:32.960045974 -0800
@@ -370,7 +370,7 @@
struct hd_i_struct *disk = &hd_info[i];
disk->special_op = disk->recalibrate = 1;
hd_out(disk,disk->sect,disk->sect,disk->head-1,
- disk->cyl,WIN_SPECIFY,&reset_hd);
+ disk->cyl,ATA_CMD_SPECIFY,&reset_hd);
if (reset)
goto repeat;
} else
@@ -555,7 +555,7 @@
{
if (disk->recalibrate) {
disk->recalibrate = 0;
- hd_out(disk,disk->sect,0,0,0,WIN_RESTORE,&recal_intr);
+ hd_out(disk,disk->sect,0,0,0,ATA_CMD_RESTORE,&recal_intr);
return reset;
}
if (disk->head > 16) {
@@ -627,12 +627,12 @@
if (req->flags & REQ_CMD) {
switch (rq_data_dir(req)) {
case READ:
- hd_out(disk,nsect,sec,head,cyl,WIN_READ,&read_intr);
+ hd_out(disk,nsect,sec,head,cyl,ATA_CMD_PIO_READ,&read_intr);
if (reset)
goto repeat;
break;
case WRITE:
- hd_out(disk,nsect,sec,head,cyl,WIN_WRITE,&write_intr);
+ hd_out(disk,nsect,sec,head,cyl,ATA_CMD_PIO_WRITE,&write_intr);
if (reset)
goto repeat;
if (wait_DRQ()) {
Index: cw-current/drivers/ide/ppc/pmac.c
===================================================================
--- cw-current.orig/drivers/ide/ppc/pmac.c 2004-11-06 21:37:07.164879206 -0800
+++ cw-current/drivers/ide/ppc/pmac.c 2004-11-06 21:54:32.961046009 -0800
@@ -594,7 +594,7 @@
hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
hwif->OUTB(command, IDE_NSECTOR_REG);
hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
- hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
+ hwif->OUTBSYNC(drive, ATA_CMD_SET_FEATURES, IDE_COMMAND_REG);
udelay(1);
/* Timeout bumped for some powerbooks */
result = wait_for_ready(drive, 2000);
Index: cw-current/drivers/scsi/ide-scsi.c
===================================================================
--- cw-current.orig/drivers/scsi/ide-scsi.c 2004-11-06 21:54:32.980046666 -0800
+++ cw-current/drivers/scsi/ide-scsi.c 2004-11-06 21:54:32.981046700 -0800
@@ -320,7 +320,7 @@
if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
/* force an abort */
- HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_IDLE_IMMEDIATE,IDE_COMMAND_REG);
rq->errors++;
DRIVER(drive)->end_request(drive, 0, 0);
@@ -657,11 +657,11 @@
ide_set_handler(drive, &idescsi_transfer_pc,
get_timeout(pc), idescsi_expiry);
/* Issue the packet command */
- HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return ide_started;
} else {
/* Issue the packet command */
- HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+ HWIF(drive)->OUTB(ATA_CMD_PACKET, IDE_COMMAND_REG);
return idescsi_transfer_pc(drive);
}
}
Index: cw-current/drivers/usb/storage/isd200.c
===================================================================
--- cw-current.orig/drivers/usb/storage/isd200.c 2004-11-06 21:37:08.556927347 -0800
+++ cw-current/drivers/usb/storage/isd200.c 2004-11-06 21:54:32.983046770 -0800
@@ -470,14 +470,14 @@
ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_5;
ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND;
ata.write.DeviceHeadByte = info->DeviceHead;
- ata.write.CommandByte = WIN_SRST;
+ ata.write.CommandByte = ATA_CMD_DEVICE_RESET;
srb->sc_data_direction = DMA_NONE;
break;
case ACTION_IDENTIFY:
US_DEBUGP(" isd200_action(IDENTIFY)\n");
ata.generic.RegisterSelect = REG_COMMAND;
- ata.write.CommandByte = WIN_IDENTIFY;
+ ata.write.CommandByte = ATA_CMD_ID_ATA;
srb->sc_data_direction = DMA_FROM_DEVICE;
srb->request_buffer = (void *) info->id;
srb->request_bufflen = sizeof(struct hd_driveid);
@@ -1242,7 +1242,7 @@
ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8);
ataCdb->write.CylinderLowByte = (unsigned char)cylinder;
ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD);
- ataCdb->write.CommandByte = WIN_READ;
+ ataCdb->write.CommandByte = ATA_CMD_PIO_READ;
break;
case WRITE_10:
@@ -1272,7 +1272,7 @@
ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8);
ataCdb->write.CylinderLowByte = (unsigned char)cylinder;
ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD);
- ataCdb->write.CommandByte = WIN_WRITE;
+ ataCdb->write.CommandByte = ATA_CMD_PIO_WRITE;
break;
case ALLOW_MEDIUM_REMOVAL:
@@ -1286,7 +1286,7 @@
ataCdb->generic.TransferBlockSize = 1;
ataCdb->generic.RegisterSelect = REG_COMMAND;
ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ?
- WIN_DOORLOCK : WIN_DOORUNLOCK;
+ ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK;
srb->request_bufflen = 0;
} else {
US_DEBUGP(" Not removeable media, just report okay\n");
These patches seem OK to me.
Bart, wanna merge, if they are OK with you also?
Jeff
On Fri, Nov 05 2004, Chris Wedgwood wrote:
> > In particular, most Maxtor and Western Digital Drives will not
> > recover from errors with this command sequence. The preferred error
> > recovery is to do a reset followed by a set features, because that
> > is what Windows does (as told to me by a drive vendor).
>
> I assume for Windows they do that for all drives? Even older ones?
>
> I also wonder what happens with TCQ when you get an error? Do you
> just retry everything outstanding?
Any error typically causes an invalidation of the queue, so yes you just
start from scratch. Since PATA doesn't support TCQ anymore, it's not a
worry though :)
--
Jens Axboe