aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sata_svw.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-29 13:58:21 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-29 13:58:21 -0400
commitac19bff25b6834d858274406a686f2227dd8489d (patch)
treed77670070abc662b6b14b5a9f9d6c08a56a476a9 /drivers/scsi/sata_svw.c
parent9dfb7808fb05643b0d06df7411b94d9546696bf1 (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/sata_svw.c')
-rw-r--r--drivers/scsi/sata_svw.c22
1 files changed, 16 insertions, 6 deletions
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
87static u8 k2_stat_check_status(struct ata_port *ap);
88
87 89
88static u32 k2_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) 90static 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)
136static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) 138static 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;