Source-Changes-HG archive

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

[src/trunk]: src -recognize CF cards by the magic value in inquiry data



details:   https://anonhg.NetBSD.org/src/rev/68214a78da33
branches:  trunk
changeset: 791009:68214a78da33
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Oct 30 15:37:49 2013 +0000

description:
-recognize CF cards by the magic value in inquiry data
-kill CFG_ATAPI_MASK, didn't see anything in the specs supporting
 that it exists

diffstat:

 distrib/utils/sysinst/disks.c |   5 +++--
 sbin/atactl/atactl.c          |  17 +++++++++++------
 sys/dev/ata/atareg.h          |   4 ++--
 sys/dev/usb/umass_isdata.c    |   8 ++++----
 4 files changed, 20 insertions(+), 14 deletions(-)

diffs (111 lines):

diff -r cd21c4656f0e -r 68214a78da33 distrib/utils/sysinst/disks.c
--- a/distrib/utils/sysinst/disks.c     Wed Oct 30 15:17:01 2013 +0000
+++ b/distrib/utils/sysinst/disks.c     Wed Oct 30 15:37:49 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.128 2013/10/30 08:39:01 mrg Exp $ */
+/*     $NetBSD: disks.c,v 1.129 2013/10/30 15:37:49 drochner Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -259,7 +259,8 @@
         * Mitsumi ATAPI devices
         */
 
-       if (!((inqbuf->atap_config & WDC_CFG_ATAPI_MASK) == WDC_CFG_ATAPI &&
+       if (!(inqbuf->atap_config != WDC_CFG_CFA_MAGIC &&
+             (inqbuf->atap_config & WDC_CFG_ATAPI) &&
              ((inqbuf->atap_model[0] == 'N' &&
                  inqbuf->atap_model[1] == 'E') ||
               (inqbuf->atap_model[0] == 'F' &&
diff -r cd21c4656f0e -r 68214a78da33 sbin/atactl/atactl.c
--- a/sbin/atactl/atactl.c      Wed Oct 30 15:17:01 2013 +0000
+++ b/sbin/atactl/atactl.c      Wed Oct 30 15:37:49 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atactl.c,v 1.71 2013/08/06 19:13:13 soren Exp $        */
+/*     $NetBSD: atactl.c,v 1.72 2013/10/30 15:37:49 drochner Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: atactl.c,v 1.71 2013/08/06 19:13:13 soren Exp $");
+__RCSID("$NetBSD: atactl.c,v 1.72 2013/10/30 15:37:49 drochner Exp $");
 #endif
 
 
@@ -947,7 +947,8 @@
         * Mitsumi ATAPI devices
         */
 
-       if (!((inqbuf->atap_config & WDC_CFG_ATAPI_MASK) == WDC_CFG_ATAPI &&
+       if (!(inqbuf->atap_config != WDC_CFG_CFA_MAGIC &&
+             (inqbuf->atap_config & WDC_CFG_ATAPI) &&
              ((inqbuf->atap_model[0] == 'N' &&
                  inqbuf->atap_model[1] == 'E') ||
               (inqbuf->atap_model[0] == 'F' &&
@@ -980,9 +981,13 @@
                    ((uint64_t)inqbuf->atap_wwn[2] << 16) |
                    ((uint64_t)inqbuf->atap_wwn[3] <<  0));
 
-       printf("Device type: %s, %s\n", inqbuf->atap_config & WDC_CFG_ATAPI ?
-              "ATAPI" : "ATA", inqbuf->atap_config & ATA_CFG_FIXED ? "fixed" :
-              "removable");
+       printf("Device type: %s",
+               inqbuf->atap_config == WDC_CFG_CFA_MAGIC ? "CF-ATA" :
+                (inqbuf->atap_config & WDC_CFG_ATAPI ? "ATAPI" : "ATA"));
+       if (inqbuf->atap_config != WDC_CFG_CFA_MAGIC)
+               printf(", %s",
+                inqbuf->atap_config & ATA_CFG_FIXED ? "fixed" : "removable");
+       printf("\n");
 
        compute_capacity(inqbuf, &capacity, &sectors, &secsize);
 
diff -r cd21c4656f0e -r 68214a78da33 sys/dev/ata/atareg.h
--- a/sys/dev/ata/atareg.h      Wed Oct 30 15:17:01 2013 +0000
+++ b/sys/dev/ata/atareg.h      Wed Oct 30 15:37:49 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atareg.h,v 1.42 2013/01/09 17:55:04 riastradh Exp $    */
+/*     $NetBSD: atareg.h,v 1.43 2013/10/30 15:37:49 drochner Exp $     */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -284,7 +284,7 @@
 struct ataparams {
     /* drive info */
     uint16_t   atap_config;            /* 0: general configuration */
-#define WDC_CFG_ATAPI_MASK     0xc000
+#define WDC_CFG_CFA_MAGIC      0x848a
 #define WDC_CFG_ATAPI          0x8000
 #define        ATA_CFG_REMOVABLE       0x0080
 #define        ATA_CFG_FIXED           0x0040
diff -r cd21c4656f0e -r 68214a78da33 sys/dev/usb/umass_isdata.c
--- a/sys/dev/usb/umass_isdata.c        Wed Oct 30 15:17:01 2013 +0000
+++ b/sys/dev/usb/umass_isdata.c        Wed Oct 30 15:37:49 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umass_isdata.c,v 1.28 2013/04/03 17:15:07 bouyer Exp $ */
+/*     $NetBSD: umass_isdata.c,v 1.29 2013/10/30 15:37:49 drochner Exp $       */
 
 /*
  * TODO:
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.28 2013/04/03 17:15:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.29 2013/10/30 15:37:49 drochner Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_umass.h"
@@ -546,8 +546,8 @@
                 * Shuffle string byte order.
                 * ATAPI Mitsumi and NEC drives don't need this.
                 */
-               if ((prms->atap_config & WDC_CFG_ATAPI_MASK) ==
-                   WDC_CFG_ATAPI &&
+               if (prms->atap_config != WDC_CFG_CFA_MAGIC &&
+                   (prms->atap_config & WDC_CFG_ATAPI) &&
                    ((prms->atap_model[0] == 'N' &&
                        prms->atap_model[1] == 'E') ||
                     (prms->atap_model[0] == 'F' &&



Home | Main Index | Thread Index | Old Index