Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ata SATA uses the head portion of the device registe...



details:   https://anonhg.NetBSD.org/src/rev/06796c0fb724
branches:  trunk
changeset: 780399:06796c0fb724
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sun Jul 22 17:57:57 2012 +0000

description:
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.)

diffstat:

 sys/dev/ata/satafis_subr.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (54 lines):

diff -r 5c1a06ee2edb -r 06796c0fb724 sys/dev/ata/satafis_subr.c
--- a/sys/dev/ata/satafis_subr.c        Sun Jul 22 17:48:53 2012 +0000
+++ b/sys/dev/ata/satafis_subr.c        Sun Jul 22 17:57:57 2012 +0000
@@ -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 @@
        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 @@
                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 @@
 
        ata_c->r_error = fis[rdh_error];
        ata_c->r_status = fis[rdh_status];
-
-       ata_c->r_device = fis[rdh_dh] & 0xf0;
 }



Home | Main Index | Thread Index | Old Index