NetBSD Problem Report #52057

From www@NetBSD.org  Thu Mar  9 20:54:45 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 633A77A1BE
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  9 Mar 2017 20:54:45 +0000 (UTC)
Message-Id: <20170309205444.5B7897A276@mollari.NetBSD.org>
Date: Thu,  9 Mar 2017 20:54:44 +0000 (UTC)
From: smesgr@netbsd.org
Reply-To: smesgr@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: wd0: Identify failed for Xscale pcic controller
X-Send-Pr-Version: www-1.0

>Number:         52057
>Category:       port-arm
>Synopsis:       wd0: Identify failed for Xscale pcic controller
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-arm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 09 20:55:00 +0000 2017
>Last-Modified:  Tue Mar 14 18:35:01 +0000 2017
>Originator:     Stephan Meisinger
>Release:        NetBSD 7 (and later)
>Organization:
>Environment:
>Description:
full description here:
http://mail-index.netbsd.org/tech-kern/2017/03/06/msg021658.html

bug was properply unnoticed because
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ata/wd.c.diff?r1=1.393&r2=1.394&only_with_tag=MAIN&f=h

missing statement:

if (wd->drvp->drive_type != DRIVET_OLD)
 return 1;

was a workaround for this issue. See full description on mailing list.


>How-To-Repeat:
- boot system
- attach a CF Card into PCMCIA adapter
- mount or execute disklabel command on disk
-> observer wd0: IDENTIFY failed

>Fix:
this patch disables ATAC_CAP_DATA32 for pxapcic, which doesn't support this type of access:

Index: arch/arm/xscale/pxa2x0_pcic.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/xscale/pxa2x0_pcic.c,v
retrieving revision 1.12
diff -u -r1.12 pxa2x0_pcic.c
--- arch/arm/xscale/pxa2x0_pcic.c	13 Oct 2013 06:55:34 -0000	1.12
+++ arch/arm/xscale/pxa2x0_pcic.c	9 Mar 2017 20:38:06 -0000
@@ -400,6 +400,7 @@
 {
 	struct pxapcic_softc *sc = device_private(self);
 	struct pxapcic_socket *sock;
+	prop_dictionary_t dict;
 	int s[PXAPCIC_NSLOT];
 	int i;
 	u_int cs;
@@ -419,6 +420,9 @@

 		config_pending_incr(self);

+		dict = device_properties(sock->pcmcia);
+		prop_dictionary_set_bool(dict, "is_cap_data32", false);
+
 		/* If there's a card there, attach it. */
 		cs = (*sock->pcictag->read)(sock, PXAPCIC_CARD_STATUS);
 		if (cs == PXAPCIC_CARD_VALID)

Index: arch/arm/xscale/pxa2x0_pcic.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/xscale/pxa2x0_pcic.c,v
retrieving revision 1.12
diff -u -r1.12 pxa2x0_pcic.c
--- arch/arm/xscale/pxa2x0_pcic.c	13 Oct 2013 06:55:34 -0000	1.12
+++ arch/arm/xscale/pxa2x0_pcic.c	9 Mar 2017 20:38:06 -0000
@@ -400,6 +400,7 @@
 {
 	struct pxapcic_softc *sc = device_private(self);
 	struct pxapcic_socket *sock;
+	prop_dictionary_t dict;
 	int s[PXAPCIC_NSLOT];
 	int i;
 	u_int cs;
@@ -419,6 +420,9 @@

 		config_pending_incr(self);

+		dict = device_properties(sock->pcmcia);
+		prop_dictionary_set_bool(dict, "is_cap_data32", false);
+
 		/* If there's a card there, attach it. */
 		cs = (*sock->pcictag->read)(sock, PXAPCIC_CARD_STATUS);
 		if (cs == PXAPCIC_CARD_VALID)

>Audit-Trail:
From: smesgr <smesgr@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-arm/52057
Date: Tue, 14 Mar 2017 19:33:24 +0100

 sorry by mistake submit only one half of the patch. Here is the complete 
 patch:

 Index: dev/pcmcia/wdc_pcmcia.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pcmcia/wdc_pcmcia.c,v
 retrieving revision 1.124
 diff -u -r1.124 wdc_pcmcia.c
 --- dev/pcmcia/wdc_pcmcia.c    12 Oct 2013 16:49:01 -0000    1.124
 +++ dev/pcmcia/wdc_pcmcia.c    9 Mar 2017 20:36:04 -0000
 @@ -207,6 +207,7 @@
   wdc_pcmcia_attach(device_t parent, device_t self, void *aux)
   {
       struct wdc_pcmcia_softc *sc = device_private(self);
 +    prop_dictionary_t dict = device_properties(parent);
       struct pcmcia_attach_args *pa = aux;
       struct pcmcia_config_entry *cfe;
       struct wdc_regs *wdr;
 @@ -214,6 +215,7 @@
       bus_size_t offset;
       int i;
       int error;
 +    bool cap32 = FALSE;

       aprint_naive("\n");

 @@ -287,7 +289,10 @@
           aprint_normal_dev(self, "i/o mapped mode\n");
           wdr->data32iot = wdr->cmd_iot;
           wdr->data32ioh = wdr->cmd_iohs[wd_data];
 -        sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA32;
 +        if(!prop_dictionary_get_bool(dict, "is_cap_data32", &cap32) || 
 cap32) {
 +            sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA32;
 +        }
       }

       sc->sc_wdcdev.sc_atac.atac_pio_cap = 0;
 Index: arch/arm/xscale/pxa2x0_pcic.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/arm/xscale/pxa2x0_pcic.c,v
 retrieving revision 1.12
 diff -u -r1.12 pxa2x0_pcic.c
 --- arch/arm/xscale/pxa2x0_pcic.c    13 Oct 2013 06:55:34 -0000 1.12
 +++ arch/arm/xscale/pxa2x0_pcic.c    9 Mar 2017 20:37:12 -0000
 @@ -400,6 +400,7 @@
   {
       struct pxapcic_softc *sc = device_private(self);
       struct pxapcic_socket *sock;
 +    prop_dictionary_t dict;
       int s[PXAPCIC_NSLOT];
       int i;
       u_int cs;
 @@ -419,6 +420,9 @@

           config_pending_incr(self);

 +        dict = device_properties(sock->pcmcia);
 +        prop_dictionary_set_bool(dict, "is_cap_data32", false);
 +
           /* If there's a card there, attach it. */
           cs = (*sock->pcictag->read)(sock, PXAPCIC_CARD_STATUS);
           if (cs == PXAPCIC_CARD_VALID)

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.