Module Name:    src
Committed By:   drochner
Date:           Wed Oct 30 15:37:49 UTC 2013

Modified Files:
        src/distrib/utils/sysinst: disks.c
        src/sbin/atactl: atactl.c
        src/sys/dev/ata: atareg.h
        src/sys/dev/usb: umass_isdata.c

Log Message:
-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


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/distrib/utils/sysinst/disks.c
cvs rdiff -u -r1.71 -r1.72 src/sbin/atactl/atactl.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ata/atareg.h
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/usb/umass_isdata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/sysinst/disks.c
diff -u src/distrib/utils/sysinst/disks.c:1.128 src/distrib/utils/sysinst/disks.c:1.129
--- src/distrib/utils/sysinst/disks.c:1.128	Wed Oct 30 08:39:01 2013
+++ src/distrib/utils/sysinst/disks.c	Wed Oct 30 15:37:49 2013
@@ -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 @@ get_descr_ata(struct disk_desc *dd, int 
 	 * 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' &&

Index: src/sbin/atactl/atactl.c
diff -u src/sbin/atactl/atactl.c:1.71 src/sbin/atactl/atactl.c:1.72
--- src/sbin/atactl/atactl.c:1.71	Tue Aug  6 19:13:13 2013
+++ src/sbin/atactl/atactl.c	Wed Oct 30 15:37:49 2013
@@ -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 @@ device_identify(int argc, char *argv[])
 	 * 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 @@ device_identify(int argc, char *argv[])
 		    ((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);
 

Index: src/sys/dev/ata/atareg.h
diff -u src/sys/dev/ata/atareg.h:1.42 src/sys/dev/ata/atareg.h:1.43
--- src/sys/dev/ata/atareg.h:1.42	Wed Jan  9 17:55:04 2013
+++ src/sys/dev/ata/atareg.h	Wed Oct 30 15:37:49 2013
@@ -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 @@ atacmd_tostatq(int cmd32)
 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

Index: src/sys/dev/usb/umass_isdata.c
diff -u src/sys/dev/usb/umass_isdata.c:1.28 src/sys/dev/usb/umass_isdata.c:1.29
--- src/sys/dev/usb/umass_isdata.c:1.28	Wed Apr  3 17:15:07 2013
+++ src/sys/dev/usb/umass_isdata.c	Wed Oct 30 15:37:49 2013
@@ -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 @@ uisdata_get_params(struct ata_drive_data
 		 * 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' &&

Reply via email to