NetBSD Problem Report #34045

From www@NetBSD.org  Fri Jul 21 01:48:49 2006
Return-Path: <www@NetBSD.org>
Received: by narn.NetBSD.org (Postfix, from userid 31301)
	id 7C04A63BA19; Fri, 21 Jul 2006 01:48:49 +0000 (UTC)
Message-Id: <20060721014849.7C04A63BA19@narn.NetBSD.org>
Date: Fri, 21 Jul 2006 01:48:49 +0000 (UTC)
From: bsd@cs.ubc.ca
Reply-To: bsd@cs.ubc.ca
To: gnats-bugs@NetBSD.org
Subject: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
X-Send-Pr-Version: www-1.0

>Number:         34045
>Category:       kern
>Synopsis:       ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 21 01:50:00 +0000 2006
>Closed-Date:    Tue Aug 01 18:16:06 +0000 2006
>Last-Modified:  Tue Aug 01 18:16:06 +0000 2006
>Originator:     Brian de Alwis
>Release:        -current as of 2006/07/14
>Organization:
UBC Computer Science
>Environment:
i386
>Description:
The wireless ath0 in my IBM ThinkPad T60 isn't being attached and I don't know how to investigate the problem.  On boot, with either a GENERIC_LAPTOP or GENERIC.MPACPI setup, I see the following message:

      ath0 at pci3 dev 0 function 0pci_mem_find: expected mem type 00000000, found 00000004
      cannot map register space

I've tried using a kernel with the appropriate PCI_* defines, but to no avail.  This is with -current to 2006/07/14; the recent changes to ath seem related to shutdown hooks.

>How-To-Repeat:
For me, just boot with NetBSD-current.
>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
Date: Fri, 21 Jul 2006 10:33:59 +0200

 Can you provide that output of "pcictl dump" for your ath device?

 Martin

From: Brian de Alwis <bsd@cs.ubc.ca>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org
Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
Date: Fri, 21 Jul 2006 15:19:22 -0700

 >  Can you provide that output of "pcictl dump" for your ath device?

 Here you go:

 $ pcictl pci3 dump -d 0
 PCI configuration registers:
   Common header:
     0x00: 0x1014168c 0x00100107 0x02000001 0x00000010

     Vendor Name: Atheros Communications (0x168c)
     Device ID: 0x1014
     Command register: 0x0107
       I/O space accesses: on
       Memory space accesses: on
       Bus mastering: on
       Special cycles: off
       MWI transactions: off
       Palette snooping: off
       Parity error checking: off
       Address/data stepping: off
       System error (SERR): on
       Fast back-to-back transactions: off
     Status register: 0x0010
       Capability List support: on
       66 MHz capable: off
       User Definable Features (UDF) support: off
       Fast back-to-back capable: off
       Data parity error detected: off
       DEVSEL timing: fast (0x0)
       Slave signaled Target Abort: off
       Master received Target Abort: off
       Master received Master Abort: off
       Asserted System Error (SERR): off
       Parity error detected: off
     Class Name: network (0x02)
     Subclass Name: ethernet (0x00)
     Interface: 0x00
     Revision ID: 0x01
     BIST: 0x00
     Header Type: 0x00 (0x00)
     Latency Timer: 0x00
     Cache Line Size: 0x10

   Type 0 ("normal" device) header:
     0x10: 0xedf00004 0x00000000 0x00000000 0x00000000
     0x20: 0x00000000 0x00000000 0x00005001 0x058a1014
     0x30: 0x00000000 0x00000040 0x00000000 0x0000010b

     Base address register at 0x10
       type: 64-bit nonprefetchable memory
       base: 0x00000000edf00000, not sized
     Base address register at 0x18
       not implemented(?)
     Base address register at 0x1c
       not implemented(?)
     Base address register at 0x20
       not implemented(?)
     Base address register at 0x24
       not implemented(?)
     Cardbus CIS Pointer: 0x00005001
     Subsystem vendor ID: 0x1014
     Subsystem ID: 0x058a
     Expansion ROM Base Address: 0x00000000
     Capability list pointer: 0x40
     Reserved @ 0x38: 0x00000000
     Maximum Latency: 0x00
     Minimum Grant: 0x00
     Interrupt pin: 0x01 (pin A)
     Interrupt line: 0x0b

   Capability register at 0x40
     type: 0x01 (Power Management, rev. 1.0)
   Capability register at 0x50
     type: 0x05 (MSI)
   Capability register at 0x60
     type: 0x10 (PCI Express)
   Capability register at 0x90
     type: 0x11 (MSI-X)

   Device-dependent header:
     0x40: 0x01c25001 0x00000000 0x00000000 0x00000000
     0x50: 0x00006005 0x00000000 0x00000000 0x00000000
     0x60: 0x00119010 0x05040cc0 0x000a2010 0x00033c11
     0x70: 0x10110048 0x00000000 0x000003c0 0x00000000
     0x80: 0x00000000 0x00000000 0x00000000 0x00000000
     0x90: 0x00000011 0x00000000 0x00000000 0x00000000
     0xa0: 0x00000004 0x00000000 0x00000000 0x00000000
     0xb0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xc0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xd0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xe0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xf0: 0x00000000 0x00000000 0x00000000 0x00000000

 -- 
   Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
       "Amusement to an observing mind is study." - Benjamin Disraeli

From: Brian de Alwis <bsd@cs.ubc.ca>
To: gnats-bugs@NetBSD.org
Cc: Martin Husemann <martin@duskware.de>, kern-bug-people@NetBSD.org,
	gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
Date: Fri, 21 Jul 2006 17:25:10 -0700

 On 2006.07.22 00:40:07 +0200, Martin Husemann wrote:
 > Can you try to replace PCI_MAPREG_TYPE_MEM with PCI_MAPREG_MEM_TYPE_64BIT
 > in sys/dev/pci/if_ath_pci.c and see if that works?

 This solution works: I'm posting this right now through the ath0 link.
 Many thanks, Martin.

     ppb2 at pci0 dev 28 function 1: Intel 82801GB/GR PCI Express Port #2 (rev. 0x02)
     pci3 at ppb2 bus 3
     pci3: i/o space, memory space enabled, rd/line, wr/inv ok
     ath0 at pci3 dev 0 function 0
     ath0: interrupting at ioapic0 pin 17 (irq 11)
     ath0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
     ath0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
     ath0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps
 54Mbps
     ath0: mac 10.3 phy 6.1 radio 10.2

 As a simple patch:

 Index: src/sys/dev/pci/if_ath_pci.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/if_ath_pci.c,v
 retrieving revision 1.14
 diff -w -b -u -r1.14 if_ath_pci.c
 --- src/sys/dev/pci/if_ath_pci.c        20 Jun 2006 14:38:34 -0000      1.14
 +++ src/sys/dev/pci/if_ath_pci.c        22 Jul 2006 00:18:23 -0000
 @@ -182,7 +182,8 @@
         /*
          * Setup memory-mapping of PCI registers.
          */
 -       if (pci_mapreg_map(pa, BS_BAR, PCI_MAPREG_TYPE_MEM, 0, &psc->sc_iot,
 +       /* kern/34045: formerly used PCI_MAPREG_TYPE_MEM */
 +       if (pci_mapreg_map(pa, BS_BAR, PCI_MAPREG_MEM_TYPE_64BIT, 0, &psc->sc_iot,
                 &psc->sc_ioh, NULL, NULL)) {
                 aprint_error("cannot map register space\n");
                 goto bad;


 -- 
   Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
       "Amusement to an observing mind is study." - Benjamin Disraeli

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
Date: Sat, 22 Jul 2006 03:14:08 +0200

 On Fri, Jul 21, 2006 at 05:25:10PM -0700, Brian de Alwis wrote:
 > -       if (pci_mapreg_map(pa, BS_BAR, PCI_MAPREG_TYPE_MEM, 0, &psc->sc_iot,
 > +       /* kern/34045: formerly used PCI_MAPREG_TYPE_MEM */
 > +       if (pci_mapreg_map(pa, BS_BAR, PCI_MAPREG_MEM_TYPE_64BIT, 0, &psc->sc_iot,

 I wonder if it could cause any problems if we would change pci_mapreg_map
 to automagically do this "upgrade".

 Martin

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, bsd@cs.ubc.ca
Cc: 
Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
Date: Fri, 21 Jul 2006 21:49:25 -0400

 On Jul 22,  1:15am, martin@duskware.de (Martin Husemann) wrote:
 -- Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -curr

 | The following reply was made to PR kern/34045; it has been noted by GNATS.
 | 
 | From: Martin Husemann <martin@duskware.de>
 | To: gnats-bugs@NetBSD.org
 | Cc: 
 | Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
 | Date: Sat, 22 Jul 2006 03:14:08 +0200
 | 
 |  On Fri, Jul 21, 2006 at 05:25:10PM -0700, Brian de Alwis wrote:
 |  > -       if (pci_mapreg_map(pa, BS_BAR, PCI_MAPREG_TYPE_MEM, 0, &psc->sc_iot,
 |  > +       /* kern/34045: formerly used PCI_MAPREG_TYPE_MEM */
 |  > +       if (pci_mapreg_map(pa, BS_BAR, PCI_MAPREG_MEM_TYPE_64BIT, 0, &psc->sc_iot,
 |  
 |  I wonder if it could cause any problems if we would change pci_mapreg_map
 |  to automagically do this "upgrade".

 Try the first and if it fails try the second?

 christos

From: Martin Husemann <martin@duskware.de>
To: Brian de Alwis <bsd@cs.ubc.ca>, gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
Date: Tue, 1 Aug 2006 01:09:41 +0200

 --DocE+STaALJfprDB
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 Could you try this patch?

 Thanks,

 Martin

 --DocE+STaALJfprDB
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch

 Index: if_ath_pci.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/if_ath_pci.c,v
 retrieving revision 1.15
 diff -u -r1.15 if_ath_pci.c
 --- if_ath_pci.c	14 Jul 2006 13:37:25 -0000	1.15
 +++ if_ath_pci.c	31 Jul 2006 23:07:30 -0000
 @@ -169,6 +169,7 @@
  	struct pci_attach_args *pa = aux;
  	pci_chipset_tag_t pc = pa->pa_pc;
  	pci_intr_handle_t ih;
 +	pcireg_t mem_type;
  	void *phook;
  	const char *intrstr = NULL;

 @@ -182,7 +183,13 @@
  	/*
  	 * Setup memory-mapping of PCI registers.
  	 */
 -	if (pci_mapreg_map(pa, BS_BAR, PCI_MAPREG_TYPE_MEM, 0, &psc->sc_iot,
 +	mem_type = pci_mapreg_type(pc, pa->pa_tag, BS_BAR);
 +	if (mem_type != PCI_MAPREG_TYPE_MEM &&
 +	    mem_type != PCI_MAPREG_MEM_TYPE_64BIT) {
 +		aprint_error("bad pci register type %d\n", (int)mem_type);
 +		goto bad;
 +	}
 +	if (pci_mapreg_map(pa, BS_BAR, mem_type, 0, &psc->sc_iot,
  		&psc->sc_ioh, NULL, NULL)) {
  		aprint_error("cannot map register space\n");
  		goto bad;

 --DocE+STaALJfprDB--

From: Brian de Alwis <bsd@cs.ubc.ca>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/34045: ath0 not working on Lenovo T60 laptop under -current: pci_mem_find problems
Date: Tue, 1 Aug 2006 11:06:10 -0700

 On 2006.08.01 01:09:41 +0200, Martin Husemann wrote:
 > Could you try this patch?

 The patch works on this system.

 I should perhaps enter this as a different PR, but wiconfig doesn't
 work on this system:

     $ sudo wiconfig ath0
     NIC serial number:                      [  ]
     Station name:                           [  ]
     SSID for IBSS creation:                 [  ]
     Current netname (SSID):                 [  ]
     Desired netname (SSID):                 [  ]
     Segmentation fault (core dumped)

 Using gdb on a debug version of wiconfig:

     (gdb) bt
     #0  0x08049798 in wi_printhex (wreq=0xbfbfdab0) at wiconfig.c:545
     #1  0x08049a3c in wi_dumpinfo (iface=0xbfbfe0b3 "ath0") at wiconfig.c:674
     #2  0x0804a127 in main (argc=2, argv=0xbfbfdf70) at wiconfig.c:885
     #3  0x080489c6 in ___start ()
     (gdb) print *wreq
     $2 = {
       wi_len = 20480, 
       wi_type = 49686, 
       wi_val =     {0 <repeats 512 times>}
     }
     (gdb) up
     #1  0x08049a3c in wi_dumpinfo (iface=0xbfbfe0b3 "ath0") at wiconfig.c:674
     674                             wi_printhex(&wreq);
     (gdb) p w[i]
     $3 = {
       wi_type = 64834, 
       wi_code = 4, 
       wi_label = 0x804a5e4 "Current BSSID:\t\t\t\t", 
       wi_opt = 0, 
       wi_desc = 0x0, 
       wi_optval = 0x0
     }
     (gdb) exit

 That len looks suspicious for a mac address :-)  I tried looking
 to see whether this was caused by similar mem-type issues, but
 wasn't able to progress far due to my unfortunately limited knowledge
 of kernel development.

 Brian.

 -- 
   Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
       "Amusement to an observing mind is study." - Benjamin Disraeli

From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/34045 CVS commit: src/sys/dev/pci
Date: Tue,  1 Aug 2006 18:11:32 +0000 (UTC)

 Module Name:	src
 Committed By:	martin
 Date:		Tue Aug  1 18:11:32 UTC 2006

 Modified Files:
 	src/sys/dev/pci: if_ath_pci.c

 Log Message:
 If the card presents 64bit memory, map it as that.
 Fixes PR kern/34045.


 To generate a diff of this commit:
 cvs rdiff -r1.15 -r1.16 src/sys/dev/pci/if_ath_pci.c

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

State-Changed-From-To: open->closed
State-Changed-By: martin@netbsd.org
State-Changed-When: Tue, 01 Aug 2006 18:16:06 +0000
State-Changed-Why:
Fixed, thanks for the report.


>Unformatted:

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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.