Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Add argument to wdccommandext() to allow the entire ...



details:   https://anonhg.NetBSD.org/src/rev/30754e52b37a
branches:  trunk
changeset: 784619:30754e52b37a
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sun Feb 03 20:13:27 2013 +0000

description:
Add argument to wdccommandext() to allow the entire contents of the
device/head register to be specified.  Needed for upcoming port multipler
support in mvsata(4).

diffstat:

 sys/dev/ata/ata_wdc.c |   8 ++++----
 sys/dev/ic/mvsata.c   |   9 +++++----
 sys/dev/ic/wdc.c      |  20 ++++++++++++--------
 sys/dev/ic/wdcvar.h   |   4 ++--
 4 files changed, 23 insertions(+), 18 deletions(-)

diffs (150 lines):

diff -r bbbb0381fc8a -r 30754e52b37a sys/dev/ata/ata_wdc.c
--- a/sys/dev/ata/ata_wdc.c     Sun Feb 03 19:41:59 2013 +0000
+++ b/sys/dev/ata/ata_wdc.c     Sun Feb 03 20:13:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata_wdc.c,v 1.102 2012/11/19 22:22:56 rkujawa Exp $    */
+/*     $NetBSD: ata_wdc.c,v 1.103 2013/02/03 20:13:27 jakllsch Exp $   */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.102 2012/11/19 22:22:56 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.103 2013/02/03 20:13:27 jakllsch Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -453,7 +453,7 @@
                        }
                        if (ata_bio->flags & ATA_LBA48) {
                            wdccommandext(chp, xfer->c_drive, atacmd_to48(cmd),
-                               (u_int64_t)ata_bio->blkno, nblks, 0);
+                               ata_bio->blkno, nblks, 0, WDSD_LBA);
                        } else {
                            wdccommand(chp, xfer->c_drive, cmd, cyl,
                                head, sect, nblks, 0);
@@ -527,7 +527,7 @@
                }
                if (ata_bio->flags & ATA_LBA48) {
                    wdccommandext(chp, xfer->c_drive, atacmd_to48(cmd),
-                       (u_int64_t)ata_bio->blkno, nblks, 0);
+                       ata_bio->blkno, nblks, 0, WDSD_LBA);
                } else {
                    wdccommand(chp, xfer->c_drive, cmd, cyl,
                        head, sect, nblks,
diff -r bbbb0381fc8a -r 30754e52b37a sys/dev/ic/mvsata.c
--- a/sys/dev/ic/mvsata.c       Sun Feb 03 19:41:59 2013 +0000
+++ b/sys/dev/ic/mvsata.c       Sun Feb 03 20:13:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mvsata.c,v 1.24 2012/07/31 15:50:34 bouyer Exp $       */
+/*     $NetBSD: mvsata.c,v 1.25 2013/02/03 20:13:28 jakllsch Exp $     */
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.24 2012/07/31 15:50:34 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.25 2013/02/03 20:13:28 jakllsch Exp $");
 
 #include "opt_mvsata.h"
 
@@ -1174,7 +1174,7 @@
                }
                if (ata_bio->flags & ATA_LBA48)
                        wdccommandext(chp, xfer->c_drive, atacmd_to48(cmd),
-                           (uint64_t)ata_bio->blkno, nblks, 0);
+                           ata_bio->blkno, nblks, 0, WDSD_LBA);
                else
                        wdccommand(chp, xfer->c_drive, cmd, cyl,
                            head, sect, nblks,
@@ -1553,7 +1553,8 @@
                MVSATA_WDC_WRITE_1(mvport, SRB_CAS, WDCTL_4BIT | WDCTL_IDS);
        if ((ata_c->flags & AT_LBA48) != 0) {
                wdccommandext(chp, drive, ata_c->r_command,
-                   ata_c->r_lba, ata_c->r_count, ata_c->r_features);
+                   ata_c->r_lba, ata_c->r_count, ata_c->r_features,
+                   ata_c->r_device & ~0x10);
        } else {
                wdccommand(chp, drive, ata_c->r_command,
                    (ata_c->r_lba >> 8) & 0xffff,
diff -r bbbb0381fc8a -r 30754e52b37a sys/dev/ic/wdc.c
--- a/sys/dev/ic/wdc.c  Sun Feb 03 19:41:59 2013 +0000
+++ b/sys/dev/ic/wdc.c  Sun Feb 03 20:13:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc.c,v 1.276 2012/12/19 14:05:29 kiyohara Exp $ */
+/*     $NetBSD: wdc.c,v 1.277 2013/02/03 20:13:28 jakllsch Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.276 2012/12/19 14:05:29 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.277 2013/02/03 20:13:28 jakllsch Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -1472,7 +1472,8 @@
        }
        if ((ata_c->flags & AT_LBA48) != 0) {
                wdccommandext(chp, drive, ata_c->r_command,
-                  ata_c->r_lba, ata_c->r_count, ata_c->r_features);
+                   ata_c->r_lba, ata_c->r_count, ata_c->r_features,
+                   ata_c->r_device & ~0x10);
        } else {
                wdccommand(chp, drive, ata_c->r_command,
                    (ata_c->r_lba >> 8) & 0xffff,
@@ -1776,22 +1777,25 @@
  */
 void
 wdccommandext(struct ata_channel *chp, u_int8_t drive, u_int8_t command,
-    u_int64_t blkno, u_int16_t count, u_int16_t features)
+    u_int64_t blkno, u_int16_t count, u_int16_t features, u_int8_t device)
 {
        struct wdc_softc *wdc = CHAN_TO_WDC(chp);
        struct wdc_regs *wdr = &wdc->regs[chp->ch_channel];
 
-       ATADEBUG_PRINT(("wdccommandext %s:%d:%d: command=0x%x blkno=%d "
-           "count=%d\n", device_xname(chp->ch_atac->atac_dev),
-           chp->ch_channel, drive, command, (u_int32_t) blkno, count),
+       ATADEBUG_PRINT(("wdccommandext %s:%d:%d: command=0x%02x "
+           "blkno=0x%012"PRIx64" count=0x%04x features=0x%04x "
+           "device=0x%02x\n", device_xname(chp->ch_atac->atac_dev),
+           chp->ch_channel, drive, command, blkno, count, features, device),
            DEBUG_FUNCS);
 
+       KASSERT(drive < wdc->wdc_maxdrives);
+
        if (wdc->select)
                wdc->select(chp,drive);
 
        /* Select drive, head, and addressing mode. */
        bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0,
-           (drive << 4) | WDSD_LBA);
+           (drive << 4) | device);
 
        if (wdc->cap & WDC_CAPABILITY_WIDEREGS) {
                bus_space_write_2(wdr->cmd_iot, wdr->cmd_iohs[wd_features],
diff -r bbbb0381fc8a -r 30754e52b37a sys/dev/ic/wdcvar.h
--- a/sys/dev/ic/wdcvar.h       Sun Feb 03 19:41:59 2013 +0000
+++ b/sys/dev/ic/wdcvar.h       Sun Feb 03 20:13:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdcvar.h,v 1.96 2012/11/19 22:22:56 rkujawa Exp $      */
+/*     $NetBSD: wdcvar.h,v 1.97 2013/02/03 20:13:28 jakllsch Exp $     */
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -166,7 +166,7 @@
 void   wdccommand(struct ata_channel *, u_int8_t, u_int8_t, u_int16_t,
                   u_int8_t, u_int8_t, u_int8_t, u_int8_t);
 void   wdccommandext(struct ata_channel *, u_int8_t, u_int8_t, u_int64_t,
-                     u_int16_t, u_int16_t);
+                     u_int16_t, u_int16_t, u_int8_t);
 void   wdccommandshort(struct ata_channel *, int, int);
 void   wdctimeout(void *arg);
 void   wdc_reset_drive(struct ata_drive_datas *, int, uint32_t *);



Home | Main Index | Thread Index | Old Index