* libata - error register patch.
@ 2004-09-29 22:50 Andy Warner
2004-10-04 21:25 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: Andy Warner @ 2004-09-29 22:50 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
It's entirely possible I'm missing something either
very obvious, or very subtle, but I think the reading
of the error register in libata et al is incorrect.
Current code only reads the error register when
in LBA48 mode, and then stores it in tf->hob_feature.
Attached patch always reads it and stores it
in tf->feature.
--
andyw@pobox.com
Andy Warner Voice: (612) 801-8549 Fax: (208) 575-5634
[-- Attachment #2: error_patch --]
[-- Type: text/plain, Size: 2414 bytes --]
diff -ur pre/drivers/scsi/libata-core.c post/drivers/scsi/libata-core.c
--- pre/drivers/scsi/libata-core.c 2004-09-29 17:28:02.128241280 -0500
+++ post/drivers/scsi/libata-core.c 2004-09-29 17:30:39.849416316 -0500
@@ -321,10 +321,10 @@
tf->lbam = inb(ioaddr->lbam_addr);
tf->lbah = inb(ioaddr->lbah_addr);
tf->device = inb(ioaddr->device_addr);
+ tf->feature = inb(ioaddr->error_addr);
if (tf->flags & ATA_TFLAG_LBA48) {
outb(tf->ctl | ATA_HOB, ioaddr->ctl_addr);
- tf->hob_feature = inb(ioaddr->error_addr);
tf->hob_nsect = inb(ioaddr->nsect_addr);
tf->hob_lbal = inb(ioaddr->lbal_addr);
tf->hob_lbam = inb(ioaddr->lbam_addr);
@@ -353,10 +353,10 @@
tf->lbam = readb((void __iomem *)ioaddr->lbam_addr);
tf->lbah = readb((void __iomem *)ioaddr->lbah_addr);
tf->device = readb((void __iomem *)ioaddr->device_addr);
+ tf->feature = readb((void __iomem *)ioaddr->error_addr);
if (tf->flags & ATA_TFLAG_LBA48) {
writeb(tf->ctl | ATA_HOB, (void __iomem *) ap->ioaddr.ctl_addr);
- tf->hob_feature = readb((void __iomem *)ioaddr->error_addr);
tf->hob_nsect = readb((void __iomem *)ioaddr->nsect_addr);
tf->hob_lbal = readb((void __iomem *)ioaddr->lbal_addr);
tf->hob_lbam = readb((void __iomem *)ioaddr->lbam_addr);
diff -ur pre/drivers/scsi/sata_svw.c post/drivers/scsi/sata_svw.c
--- pre/drivers/scsi/sata_svw.c 2004-09-29 17:32:42.396805890 -0500
+++ post/drivers/scsi/sata_svw.c 2004-09-29 17:34:39.625030054 -0500
@@ -138,9 +138,9 @@
lbam = tf->lbam = readw(ioaddr->lbam_addr);
lbah = tf->lbah = readw(ioaddr->lbah_addr);
tf->device = readw(ioaddr->device_addr);
+ tf->feature = readw(ioaddr->error_addr);
if (tf->flags & ATA_TFLAG_LBA48) {
- tf->hob_feature = readw(ioaddr->error_addr) >> 8;
tf->hob_nsect = nsect >> 8;
tf->hob_lbal = lbal >> 8;
tf->hob_lbam = lbam >> 8;
diff -ur pre/drivers/scsi/sata_vsc.c post/drivers/scsi/sata_vsc.c
--- pre/drivers/scsi/sata_vsc.c 2004-09-29 17:32:30.539605204 -0500
+++ post/drivers/scsi/sata_vsc.c 2004-09-29 17:36:36.286359905 -0500
@@ -139,9 +139,9 @@
lbam = tf->lbam = readw(ioaddr->lbam_addr);
lbah = tf->lbah = readw(ioaddr->lbah_addr);
tf->device = readw(ioaddr->device_addr);
+ tf->feature = readb(ioaddr->error_addr);
if (tf->flags & ATA_TFLAG_LBA48) {
- tf->hob_feature = readb(ioaddr->error_addr);
tf->hob_nsect = nsect >> 8;
tf->hob_lbal = lbal >> 8;
tf->hob_lbam = lbam >> 8;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: libata - error register patch.
2004-09-29 22:50 libata - error register patch Andy Warner
@ 2004-10-04 21:25 ` Jeff Garzik
2004-10-04 21:44 ` Andy Warner
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2004-10-04 21:25 UTC (permalink / raw)
To: Andy Warner; +Cc: linux-ide
Andy Warner wrote:
> It's entirely possible I'm missing something either
> very obvious, or very subtle, but I think the reading
> of the error register in libata et al is incorrect.
>
> Current code only reads the error register when
> in LBA48 mode, and then stores it in tf->hob_feature.
> Attached patch always reads it and stores it
> in tf->feature.
I'm still thinking about this one.
I need to check and see the behavior of this register, as we have a
separate ata_chk_err() as well.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: libata - error register patch.
2004-10-04 21:25 ` Jeff Garzik
@ 2004-10-04 21:44 ` Andy Warner
0 siblings, 0 replies; 3+ messages in thread
From: Andy Warner @ 2004-10-04 21:44 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Andy Warner, linux-ide
Jeff Garzik wrote:
> [...]
> I'm still thinking about this one.
>
> I need to check and see the behavior of this register, as we have a
> separate ata_chk_err() as well.
I think the existing behaviour is odd.
I can see a case for either removing any read of the error
register in ata_tf_read_xxx() and relying solely on ata_chk_err()
or going with my patch.
I can's see any case for leaving it as it is - I can find no
code that uses tf->hob_feature after calling ata_tf_read_xxx().
Looks to me like a cut and paste error from way back that got
mashed by LBA48 support.
Reads of the error register are not destructive (at least
according to the specs.)
--
andyw@pobox.com
Andy Warner Voice: (612) 801-8549 Fax: (208) 575-5634
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-10-04 21:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-29 22:50 libata - error register patch Andy Warner
2004-10-04 21:25 ` Jeff Garzik
2004-10-04 21:44 ` Andy Warner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).