Re: [PATCH 2.6.11-rc3 01/08] ide: add individual ATA_TFLAG_{OUT|IN}_* flags

2005-03-04 Thread Tejun Heo

01_ide_TFLAG_OUT_IN.patch

This patch replaces ide_task_t->tf_{out|in}_flags handling
with newly defined individual ATA_TFLAG_{OUT|IN}_* flags and
helper functions ide_{load|read}_taskfile().  To ease
transition of the IDE code, temporary flags
ATA_TFLAG_IDE_FLAGGED and ATA_TFLAG_IDE_LBA48 are defined.
This patch is tit-for-tat and shouldn't change any behavior.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>

 drivers/ide/ide-disk.c |4 
 drivers/ide/ide-io.c   |   35 +--
 drivers/ide/ide-taskfile.c |  220 +++--
 include/linux/ata.h|   66 -
 include/linux/ide.h|   10 +-
 5 files changed, 213 insertions(+), 122 deletions(-)

Index: linux-taskfile-ng/drivers/ide/ide-disk.c
===
--- linux-taskfile-ng.orig/drivers/ide/ide-disk.c   2005-03-05 
10:37:51.738348597 +0900
+++ linux-taskfile-ng/drivers/ide/ide-disk.c2005-03-05 10:46:58.305078940 
+0900
@@ -337,7 +337,7 @@ static u64 idedisk_read_native_max_addre
tf->device  = 0x40;
if (lba48) {
tf->command = WIN_READ_NATIVE_MAX_EXT;
-   tf->flags |= ATA_TFLAG_LBA48;
+   tf->flags |= ATA_TFLAG_IDE_LBA48;
} else
tf->command = WIN_READ_NATIVE_MAX;
 
@@ -379,7 +379,7 @@ static u64 idedisk_set_max_address(ide_d
tf->device  = 0x40;
tf->command = WIN_SET_MAX_EXT;
 
-   tf->flags |= ATA_TFLAG_LBA48;
+   tf->flags |= ATA_TFLAG_IDE_LBA48;
} else {
tf->device  = ((addr_req >> 24) & 0xf) | 0x40;
tf->command = WIN_SET_MAX;
Index: linux-taskfile-ng/drivers/ide/ide-io.c
===
--- linux-taskfile-ng.orig/drivers/ide/ide-io.c 2005-03-05 10:37:51.738348597 
+0900
+++ linux-taskfile-ng/drivers/ide/ide-io.c  2005-03-05 10:46:58.307078627 
+0900
@@ -64,7 +64,7 @@ void ide_task_init_flush(ide_drive_t *dr
if (ide_id_has_flush_cache_ext(drive->id) &&
(drive->capacity64 >= (1UL << 28))) {
tf->command = WIN_FLUSH_CACHE_EXT;
-   tf->flags |= ATA_TFLAG_LBA48;
+   tf->flags |= ATA_TFLAG_IDE_LBA48;
} else
tf->command = WIN_FLUSH_CACHE;
 
@@ -322,7 +322,7 @@ u64 ide_tf_get_address(ide_drive_t *driv
 {
u32 high, low;
 
-   if (tf->flags & ATA_TFLAG_LBA48) {
+   if (tf->flags & ATA_TFLAG_IDE_LBA48) {
high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) | 
tf->hob_lbal;
low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
} else {
@@ -458,31 +458,10 @@ void ide_end_drive_cmd (ide_drive_t *dri

if (args) {
struct ata_taskfile *tf = >tf;
-
-   if (args->tf_in_flags.b.data)
-   args->data = hwif->INW(IDE_DATA_REG);
-
-   tf->feature = err;
-
-   /* be sure we're looking at the low order bits */
-   hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG);
-
-   tf->nsect   = hwif->INB(IDE_NSECTOR_REG);
-   tf->lbal= hwif->INB(IDE_SECTOR_REG);
-   tf->lbam= hwif->INB(IDE_LCYL_REG);
-   tf->lbah= hwif->INB(IDE_HCYL_REG);
-   tf->device  = hwif->INB(IDE_SELECT_REG);
-   tf->command = stat;
-
-   if (tf->flags & ATA_TFLAG_LBA48) {
-   hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
-
-   tf->hob_feature = hwif->INB(IDE_FEATURE_REG);
-   tf->hob_nsect   = hwif->INB(IDE_NSECTOR_REG);
-   tf->hob_lbal= hwif->INB(IDE_SECTOR_REG);
-   tf->hob_lbam= hwif->INB(IDE_LCYL_REG);
-   tf->hob_lbah= hwif->INB(IDE_HCYL_REG);
-   }
+   tf->flags |= ATA_TFLAG_IN_ADDR | ATA_TFLAG_IN_DEVICE;
+   if (tf->flags & ATA_TFLAG_IDE_LBA48)
+   tf->flags |= ATA_TFLAG_IN_LBA48;
+   ide_read_taskfile(drive, args, stat, err);
}
} else if (blk_pm_request(rq)) {
 #ifdef DEBUG_PM
@@ -935,7 +914,7 @@ static ide_startstop_t execute_drive_cmd
break;
}
 
-   if (args->tf_out_flags.all != 0) 
+   if (args->tf.flags & ATA_TFLAG_IDE_FLAGGED)
return flagged_taskfile(drive, args);
return do_rw_taskfile(drive, args);
} else if (rq->flags & REQ_DRIVE_CMD) {
Index: linux-taskfile-ng/drivers/ide/ide-taskfile.c

Re: [PATCH 2.6.11-rc3 01/08] ide: add individual ATA_TFLAG_{OUT|IN}_* flags

2005-03-04 Thread Tejun Heo

01_ide_TFLAG_OUT_IN.patch

This patch replaces ide_task_t-tf_{out|in}_flags handling
with newly defined individual ATA_TFLAG_{OUT|IN}_* flags and
helper functions ide_{load|read}_taskfile().  To ease
transition of the IDE code, temporary flags
ATA_TFLAG_IDE_FLAGGED and ATA_TFLAG_IDE_LBA48 are defined.
This patch is tit-for-tat and shouldn't change any behavior.

Signed-off-by: Tejun Heo [EMAIL PROTECTED]

 drivers/ide/ide-disk.c |4 
 drivers/ide/ide-io.c   |   35 +--
 drivers/ide/ide-taskfile.c |  220 +++--
 include/linux/ata.h|   66 -
 include/linux/ide.h|   10 +-
 5 files changed, 213 insertions(+), 122 deletions(-)

Index: linux-taskfile-ng/drivers/ide/ide-disk.c
===
--- linux-taskfile-ng.orig/drivers/ide/ide-disk.c   2005-03-05 
10:37:51.738348597 +0900
+++ linux-taskfile-ng/drivers/ide/ide-disk.c2005-03-05 10:46:58.305078940 
+0900
@@ -337,7 +337,7 @@ static u64 idedisk_read_native_max_addre
tf-device  = 0x40;
if (lba48) {
tf-command = WIN_READ_NATIVE_MAX_EXT;
-   tf-flags |= ATA_TFLAG_LBA48;
+   tf-flags |= ATA_TFLAG_IDE_LBA48;
} else
tf-command = WIN_READ_NATIVE_MAX;
 
@@ -379,7 +379,7 @@ static u64 idedisk_set_max_address(ide_d
tf-device  = 0x40;
tf-command = WIN_SET_MAX_EXT;
 
-   tf-flags |= ATA_TFLAG_LBA48;
+   tf-flags |= ATA_TFLAG_IDE_LBA48;
} else {
tf-device  = ((addr_req  24)  0xf) | 0x40;
tf-command = WIN_SET_MAX;
Index: linux-taskfile-ng/drivers/ide/ide-io.c
===
--- linux-taskfile-ng.orig/drivers/ide/ide-io.c 2005-03-05 10:37:51.738348597 
+0900
+++ linux-taskfile-ng/drivers/ide/ide-io.c  2005-03-05 10:46:58.307078627 
+0900
@@ -64,7 +64,7 @@ void ide_task_init_flush(ide_drive_t *dr
if (ide_id_has_flush_cache_ext(drive-id) 
(drive-capacity64 = (1UL  28))) {
tf-command = WIN_FLUSH_CACHE_EXT;
-   tf-flags |= ATA_TFLAG_LBA48;
+   tf-flags |= ATA_TFLAG_IDE_LBA48;
} else
tf-command = WIN_FLUSH_CACHE;
 
@@ -322,7 +322,7 @@ u64 ide_tf_get_address(ide_drive_t *driv
 {
u32 high, low;
 
-   if (tf-flags  ATA_TFLAG_LBA48) {
+   if (tf-flags  ATA_TFLAG_IDE_LBA48) {
high = (tf-hob_lbah  16) | (tf-hob_lbam  8) | 
tf-hob_lbal;
low = (tf-lbah  16) | (tf-lbam  8) | tf-lbal;
} else {
@@ -458,31 +458,10 @@ void ide_end_drive_cmd (ide_drive_t *dri

if (args) {
struct ata_taskfile *tf = args-tf;
-
-   if (args-tf_in_flags.b.data)
-   args-data = hwif-INW(IDE_DATA_REG);
-
-   tf-feature = err;
-
-   /* be sure we're looking at the low order bits */
-   hwif-OUTB(drive-ctl  ~0x80, IDE_CONTROL_REG);
-
-   tf-nsect   = hwif-INB(IDE_NSECTOR_REG);
-   tf-lbal= hwif-INB(IDE_SECTOR_REG);
-   tf-lbam= hwif-INB(IDE_LCYL_REG);
-   tf-lbah= hwif-INB(IDE_HCYL_REG);
-   tf-device  = hwif-INB(IDE_SELECT_REG);
-   tf-command = stat;
-
-   if (tf-flags  ATA_TFLAG_LBA48) {
-   hwif-OUTB(drive-ctl|0x80, IDE_CONTROL_REG);
-
-   tf-hob_feature = hwif-INB(IDE_FEATURE_REG);
-   tf-hob_nsect   = hwif-INB(IDE_NSECTOR_REG);
-   tf-hob_lbal= hwif-INB(IDE_SECTOR_REG);
-   tf-hob_lbam= hwif-INB(IDE_LCYL_REG);
-   tf-hob_lbah= hwif-INB(IDE_HCYL_REG);
-   }
+   tf-flags |= ATA_TFLAG_IN_ADDR | ATA_TFLAG_IN_DEVICE;
+   if (tf-flags  ATA_TFLAG_IDE_LBA48)
+   tf-flags |= ATA_TFLAG_IN_LBA48;
+   ide_read_taskfile(drive, args, stat, err);
}
} else if (blk_pm_request(rq)) {
 #ifdef DEBUG_PM
@@ -935,7 +914,7 @@ static ide_startstop_t execute_drive_cmd
break;
}
 
-   if (args-tf_out_flags.all != 0) 
+   if (args-tf.flags  ATA_TFLAG_IDE_FLAGGED)
return flagged_taskfile(drive, args);
return do_rw_taskfile(drive, args);
} else if (rq-flags  REQ_DRIVE_CMD) {
Index: linux-taskfile-ng/drivers/ide/ide-taskfile.c
===
---