Module Name: src
Committed By: jakllsch
Date: Sun Jul 22 17:57:58 UTC 2012
Modified Files:
src/sys/dev/ata: satafis_subr.c
Log Message:
SATA uses the head portion of the device register in the command protocol for
port multiplier register access. Thus, in the LBA48 case, pass the complete
r(hd|dh)_dh byte back and forth to the upper layers. (This is irrelevant in
the LBA28/CHS code path for what should be obvious reasons.)
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ata/satafis_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ata/satafis_subr.c
diff -u src/sys/dev/ata/satafis_subr.c:1.6 src/sys/dev/ata/satafis_subr.c:1.7
--- src/sys/dev/ata/satafis_subr.c:1.6 Tue Jan 24 20:04:07 2012
+++ src/sys/dev/ata/satafis_subr.c Sun Jul 22 17:57:57 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: satafis_subr.c,v 1.6 2012/01/24 20:04:07 jakllsch Exp $ */
+/* $NetBSD: satafis_subr.c,v 1.7 2012/07/22 17:57:57 jakllsch Exp $ */
/*-
* Copyright (c) 2009 Jonathan A. Kollasch.
@@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: satafis_subr.c,v 1.6 2012/01/24 20:04:07 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: satafis_subr.c,v 1.7 2012/07/22 17:57:57 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -81,14 +81,14 @@ satafis_rhd_construct_cmd(struct ata_com
fis[rhd_lba1] = (ata_c->r_lba >> 8) & 0xff;
fis[rhd_lba2] = (ata_c->r_lba >> 16) & 0xff;
if ((ata_c->flags & AT_LBA48) != 0) {
- fis[rhd_dh] = WDSD_LBA;
+ fis[rhd_dh] = ata_c->r_device;
fis[rhd_lba3] = (ata_c->r_lba >> 24) & 0xff;
fis[rhd_lba4] = (ata_c->r_lba >> 32) & 0xff;
fis[rhd_lba5] = (ata_c->r_lba >> 40) & 0xff;
fis[rhd_features1] = (ata_c->r_features >> 8) & 0xff;
} else {
- fis[rhd_dh] = ((ata_c->r_lba >> 24) & 0x0f) |
- (((ata_c->flags & AT_LBA) != 0) ? WDSD_LBA : 0);
+ fis[rhd_dh] = (ata_c->r_device & 0xf0) |
+ ((ata_c->r_lba >> 24) & 0x0f);
}
fis[rhd_count0] = (ata_c->r_count >> 0) & 0xff;
@@ -170,8 +170,10 @@ satafis_rdh_cmd_readreg(struct ata_comma
ata_c->r_lba |= (uint64_t)fis[rdh_lba3] << 24;
ata_c->r_lba |= (uint64_t)fis[rdh_lba4] << 32;
ata_c->r_lba |= (uint64_t)fis[rdh_lba5] << 40;
+ ata_c->r_device = fis[rdh_dh];
} else {
ata_c->r_lba |= (uint64_t)(fis[rdh_dh] & 0x0f) << 24;
+ ata_c->r_device = fis[rdh_dh] & 0xf0;
}
ata_c->r_count = fis[rdh_count0] << 0;
@@ -181,6 +183,4 @@ satafis_rdh_cmd_readreg(struct ata_comma
ata_c->r_error = fis[rdh_error];
ata_c->r_status = fis[rdh_status];
-
- ata_c->r_device = fis[rdh_dh] & 0xf0;
}