diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-29 13:58:21 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-29 13:58:21 -0400 |
commit | ac19bff25b6834d858274406a686f2227dd8489d (patch) | |
tree | d77670070abc662b6b14b5a9f9d6c08a56a476a9 /drivers/scsi | |
parent | 9dfb7808fb05643b0d06df7411b94d9546696bf1 (diff) |
[libata] ensure ->tf_read() hook reads Status and Error registers
We want ->tf_read() to get a complete snapshot of all taskfile
registers, without requiring the callers to manually call
ata_chk_status() and ata_chk_err() themselves.
This also fixes a minor bug in sata_vsc where the lower bits of the
feature register were incorrectly placed in the HOB (high order bits)
portion of struct ata_taskfile.
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/libata-core.c | 4 | ||||
-rw-r--r-- | drivers/scsi/pdc_adma.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sata_qstor.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sata_svw.c | 22 | ||||
-rw-r--r-- | drivers/scsi/sata_vsc.c | 20 |
5 files changed, 36 insertions, 14 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index f53d7b8ac33f..56c81f0aa1d9 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -370,6 +370,8 @@ static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) | |||
370 | { | 370 | { |
371 | struct ata_ioports *ioaddr = &ap->ioaddr; | 371 | struct ata_ioports *ioaddr = &ap->ioaddr; |
372 | 372 | ||
373 | tf->command = ata_check_status(ap); | ||
374 | tf->feature = ata_chk_err(ap); | ||
373 | tf->nsect = inb(ioaddr->nsect_addr); | 375 | tf->nsect = inb(ioaddr->nsect_addr); |
374 | tf->lbal = inb(ioaddr->lbal_addr); | 376 | tf->lbal = inb(ioaddr->lbal_addr); |
375 | tf->lbam = inb(ioaddr->lbam_addr); | 377 | tf->lbam = inb(ioaddr->lbam_addr); |
@@ -402,6 +404,8 @@ static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
402 | { | 404 | { |
403 | struct ata_ioports *ioaddr = &ap->ioaddr; | 405 | struct ata_ioports *ioaddr = &ap->ioaddr; |
404 | 406 | ||
407 | tf->command = ata_check_status(ap); | ||
408 | tf->feature = ata_chk_err(ap); | ||
405 | tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); | 409 | tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); |
406 | tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); | 410 | tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); |
407 | tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); | 411 | tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index 7999817915c3..af99feb9d237 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c | |||
@@ -490,7 +490,7 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set) | |||
490 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 490 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { |
491 | 491 | ||
492 | /* check main status, clearing INTRQ */ | 492 | /* check main status, clearing INTRQ */ |
493 | u8 status = ata_chk_status(ap); | 493 | u8 status = ata_check_status(ap); |
494 | if ((status & ATA_BUSY)) | 494 | if ((status & ATA_BUSY)) |
495 | continue; | 495 | continue; |
496 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", | 496 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 250dafa6bc36..1aaf3304d397 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -433,7 +433,7 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set) | |||
433 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 433 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { |
434 | 434 | ||
435 | /* check main status, clearing INTRQ */ | 435 | /* check main status, clearing INTRQ */ |
436 | u8 status = ata_chk_status(ap); | 436 | u8 status = ata_check_status(ap); |
437 | if ((status & ATA_BUSY)) | 437 | if ((status & ATA_BUSY)) |
438 | continue; | 438 | continue; |
439 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", | 439 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index e0f9570bc6dd..46208f52d0e1 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -84,6 +84,8 @@ | |||
84 | /* Port stride */ | 84 | /* Port stride */ |
85 | #define K2_SATA_PORT_OFFSET 0x100 | 85 | #define K2_SATA_PORT_OFFSET 0x100 |
86 | 86 | ||
87 | static u8 k2_stat_check_status(struct ata_port *ap); | ||
88 | |||
87 | 89 | ||
88 | static u32 k2_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | 90 | static u32 k2_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) |
89 | { | 91 | { |
@@ -136,16 +138,24 @@ static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
136 | static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | 138 | static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) |
137 | { | 139 | { |
138 | struct ata_ioports *ioaddr = &ap->ioaddr; | 140 | struct ata_ioports *ioaddr = &ap->ioaddr; |
139 | u16 nsect, lbal, lbam, lbah; | 141 | u16 nsect, lbal, lbam, lbah, feature; |
140 | 142 | ||
141 | nsect = tf->nsect = readw(ioaddr->nsect_addr); | 143 | tf->command = k2_stat_check_status(ap); |
142 | lbal = tf->lbal = readw(ioaddr->lbal_addr); | ||
143 | lbam = tf->lbam = readw(ioaddr->lbam_addr); | ||
144 | lbah = tf->lbah = readw(ioaddr->lbah_addr); | ||
145 | tf->device = readw(ioaddr->device_addr); | 144 | tf->device = readw(ioaddr->device_addr); |
145 | feature = readw(ioaddr->error_addr); | ||
146 | nsect = readw(ioaddr->nsect_addr); | ||
147 | lbal = readw(ioaddr->lbal_addr); | ||
148 | lbam = readw(ioaddr->lbam_addr); | ||
149 | lbah = readw(ioaddr->lbah_addr); | ||
150 | |||
151 | tf->feature = feature; | ||
152 | tf->nsect = nsect; | ||
153 | tf->lbal = lbal; | ||
154 | tf->lbam = lbam; | ||
155 | tf->lbah = lbah; | ||
146 | 156 | ||
147 | if (tf->flags & ATA_TFLAG_LBA48) { | 157 | if (tf->flags & ATA_TFLAG_LBA48) { |
148 | tf->hob_feature = readw(ioaddr->error_addr) >> 8; | 158 | tf->hob_feature = feature >> 8; |
149 | tf->hob_nsect = nsect >> 8; | 159 | tf->hob_nsect = nsect >> 8; |
150 | tf->hob_lbal = lbal >> 8; | 160 | tf->hob_lbal = lbal >> 8; |
151 | tf->hob_lbam = lbam >> 8; | 161 | tf->hob_lbam = lbam >> 8; |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 5af05fdf8544..54273e0063c7 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -153,16 +153,24 @@ static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
153 | static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | 153 | static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) |
154 | { | 154 | { |
155 | struct ata_ioports *ioaddr = &ap->ioaddr; | 155 | struct ata_ioports *ioaddr = &ap->ioaddr; |
156 | u16 nsect, lbal, lbam, lbah; | 156 | u16 nsect, lbal, lbam, lbah, feature; |
157 | 157 | ||
158 | nsect = tf->nsect = readw(ioaddr->nsect_addr); | 158 | tf->command = ata_check_status(ap); |
159 | lbal = tf->lbal = readw(ioaddr->lbal_addr); | ||
160 | lbam = tf->lbam = readw(ioaddr->lbam_addr); | ||
161 | lbah = tf->lbah = readw(ioaddr->lbah_addr); | ||
162 | tf->device = readw(ioaddr->device_addr); | 159 | tf->device = readw(ioaddr->device_addr); |
160 | feature = readw(ioaddr->error_addr); | ||
161 | nsect = readw(ioaddr->nsect_addr); | ||
162 | lbal = readw(ioaddr->lbal_addr); | ||
163 | lbam = readw(ioaddr->lbam_addr); | ||
164 | lbah = readw(ioaddr->lbah_addr); | ||
165 | |||
166 | tf->feature = feature; | ||
167 | tf->nsect = nsect; | ||
168 | tf->lbal = lbal; | ||
169 | tf->lbam = lbam; | ||
170 | tf->lbah = lbah; | ||
163 | 171 | ||
164 | if (tf->flags & ATA_TFLAG_LBA48) { | 172 | if (tf->flags & ATA_TFLAG_LBA48) { |
165 | tf->hob_feature = readb(ioaddr->error_addr); | 173 | tf->hob_feature = feature >> 8; |
166 | tf->hob_nsect = nsect >> 8; | 174 | tf->hob_nsect = nsect >> 8; |
167 | tf->hob_lbal = lbal >> 8; | 175 | tf->hob_lbal = lbal >> 8; |
168 | tf->hob_lbam = lbam >> 8; | 176 | tf->hob_lbam = lbam >> 8; |