From nobody@FreeBSD.org  Wed Feb 16 18:54:52 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2EBFB106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 16 Feb 2011 18:54:52 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id D90B98FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 16 Feb 2011 18:54:51 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p1GIspTx057067
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 16 Feb 2011 18:54:51 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p1GIspju057066;
	Wed, 16 Feb 2011 18:54:51 GMT
	(envelope-from nobody)
Message-Id: <201102161854.p1GIspju057066@red.freebsd.org>
Date: Wed, 16 Feb 2011 18:54:51 GMT
From: Nezmer <me@nezmer.info>
To: freebsd-gnats-submit@FreeBSD.org
Subject: iwn driver fails to power on adapter after resume
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         154826
>Category:       kern
>Synopsis:       [iwn] iwn driver fails to power on adapter after resume
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bschmidt
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 16 19:00:19 UTC 2011
>Closed-Date:    Tue Jun 19 06:54:35 UTC 2012
>Last-Modified:  Tue Jun 19 07:00:23 UTC 2012
>Originator:     Nezmer
>Release:        8/stable
>Organization:
>Environment:
FreeBSD NezmerBSD 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0 r218731M: Wed Feb 16 12:26:30 EST 2011     user@host:builddir/sys/GENERIC  amd64

>Description:
Device:
iwn0: <Intel(R) PRO/Wireless 5100> mem 0xd6200000-0xd6201fff irq 17 at device 0.0 on pci3
iwn0: MIMO 1T2R, MoW, address 00:1e:65:3c:d9:00
iwn0: [ITHREAD]
iwn0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
iwn0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
iwn0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps

After running "acpiconf -s3" then resuming, wireless network does not work.

From dmesg:
iwn0: iwn_hw_init: could not power ON adapter, error 60
iwn0: iwn_init_locked: could not initialize hardware, error 60
>How-To-Repeat:
Run "acpiconf -s3" then resume.
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Feb 17 04:15:31 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154826 
Responsible-Changed-From-To: freebsd-net->bschmidt 
Responsible-Changed-By: bschmidt 
Responsible-Changed-When: Thu Feb 17 07:04:59 UTC 2011 
Responsible-Changed-Why:  
over to me 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154826 

From: Bernhard Schmidt <bschmidt@freebsd.org>
To: bug-followup@freebsd.org,
 me@nezmer.info
Cc:  
Subject: Re: kern/154826: [iwn] iwn driver fails to power on adapter after resume
Date: Thu, 17 Feb 2011 08:14:20 +0100

 Hi,
 
 can you post the relevant bits of
 pciconf -lvc
 before and after suspend/resume for the device? Just to rule out an ACPI 
 issue.
 
 Thanks
 
 -- 
 Bernhard

From: Bernhard Schmidt <bschmidt@freebsd.org>
To: me@nezmer.info
Cc: bug-followup@freebsd.org
Subject: Re: kern/154826: [iwn] iwn driver fails to power on adapter after resume
Date: Thu, 17 Feb 2011 08:33:07 +0100

 --Boundary-00=_z8MXNe0699vB7Am
 Content-Type: Text/Plain;
   charset="iso-8859-15"
 Content-Transfer-Encoding: 7bit
 
 On Thursday, February 17, 2011 08:14:20 Bernhard Schmidt wrote:
 > Hi,
 > 
 > can you post the relevant bits of
 > pciconf -lvc
 > before and after suspend/resume for the device? Just to rule out an
 > ACPI issue.
 
 Also try attached patch.
 
 -- 
 Bernhard
 
 --Boundary-00=_z8MXNe0699vB7Am
 Content-Type: text/x-patch;
   charset="UTF-8";
   name="iwn_resume_timeout.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="iwn_resume_timeout.diff"
 
 Index: sys/dev/iwn/if_iwn.c
 ===================================================================
 --- sys/dev/iwn/if_iwn.c	(revision 218733)
 +++ sys/dev/iwn/if_iwn.c	(working copy)
 @@ -909,7 +909,7 @@ iwn_nic_lock(struct iwn_softc *sc)
  	IWN_SETBITS(sc, IWN_GP_CNTRL, IWN_GP_CNTRL_MAC_ACCESS_REQ);
  
  	/* Spin until we actually get the lock. */
 -	for (ntries = 0; ntries < 1000; ntries++) {
 +	for (ntries = 0; ntries < 15000; ntries++) {
  		if ((IWN_READ(sc, IWN_GP_CNTRL) &
  		    (IWN_GP_CNTRL_MAC_ACCESS_ENA | IWN_GP_CNTRL_SLEEP)) ==
  		    IWN_GP_CNTRL_MAC_ACCESS_ENA)
 
 --Boundary-00=_z8MXNe0699vB7Am--

From: Nezmer <me@nezmer.info>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/154826: [iwn] iwn driver fails to power on adapter after
 resume
Date: Thu, 17 Feb 2011 17:06:39 +0200

 The output of "pciconf -lvc" is the same before and after resume:
 
 iwn0@pci0:3:0:0:	class=0x028000 card=0x12018086 chip=0x42328086 rev=0x00 hdr=0x00
     vendor     = 'Intel Corporation'
     device     = 'Carte Intel WiFi Link 5100 AGN (Intel WiFi Link 5100)'
     class      = network
     cap 01[c8] = powerspec 3  supports D0 D3  current D0
     cap 05[d0] = MSI supports 1 message, 64 bit enabled with 1 message
     cap 10[e0] = PCI-Express 1 endpoint max data 128(128) link x1(x1)
 ecap 0001[100] = AER 1 0 fatal 0 non-fatal 1 corrected
 ecap 0003[140] = Serial 1 001e65ffff3cd900
 
 The patch didn't fix the bug.

From: Bernhard Schmidt <bschmidt@freebsd.org>
To: Nezmer <me@nezmer.info>
Cc: bug-followup@freebsd.org
Subject: Re: kern/154826: [iwn] iwn driver fails to power on adapter after resume
Date: Thu, 17 Feb 2011 18:48:35 +0100

 Ok, 2 things to try:
 - What happens if you destroy the VAP before suspending?
   ifconfig wlan0 destroy
 - Does it make a difference if you unload the module before suspend and
   reload it after resume?
 
 -- 
 Bernhard

From: Nezmer <me@nezmer.info>
To: Bernhard Schmidt <bschmidt@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: kern/154826: [iwn] iwn driver fails to power on adapter after
 resume
Date: Thu, 17 Feb 2011 20:49:29 +0200

 On Thu, Feb 17, 2011 at 06:48:35PM +0100, Bernhard Schmidt wrote:
 > Ok, 2 things to try:
 > - What happens if you destroy the VAP before suspending?
 >   ifconfig wlan0 destroy
 
 Same error.
 
 > - Does it make a difference if you unload the module before suspend and
 >   reload it after resume?
 > 
 
 New error.
 
 iwn0: <Intel(R) PRO/Wireless 5100> mem 0xd6200000-0xd6201fff irq 17 at device 0.0 on pci3
 iwn0: adapter type 15 not supported
 device_attach: iwn0 attach returned 6

From: Bernhard Schmidt <bschmidt@freebsd.org>
To: Nezmer <me@nezmer.info>
Cc: bug-followup@freebsd.org
Subject: Re: kern/154826: [iwn] iwn driver fails to power on adapter after resume
Date: Thu, 17 Feb 2011 21:16:35 +0100

 On Thursday 17 February 2011 19:49:29 Nezmer wrote:
 > On Thu, Feb 17, 2011 at 06:48:35PM +0100, Bernhard Schmidt wrote:
 > > Ok, 2 things to try:
 > > - What happens if you destroy the VAP before suspending?
 > >   ifconfig wlan0 destroy
 > 
 > Same error.
 > 
 > > - Does it make a difference if you unload the module before suspend and
 > >   reload it after resume?
 > 
 > New error.
 > 
 > iwn0: <Intel(R) PRO/Wireless 5100> mem 0xd6200000-0xd6201fff irq 17 at
 >  device 0.0 on pci3 iwn0: adapter type 15 not supported
 > device_attach: iwn0 attach returned 6
 
 This is clearly not an iwn(4) issue, "adapter type 15" tells us that bogus 
 values are read from PCI space, something like 0xffffffff for 32bit registers. 
 I suspect that the PCI space is not correctly restored on resume, but I have 
 no clue about that..
 
 There have been quite some changes in that regard to HEAD, so, can I talk you 
 into trying this with a kernel from HEAD? It might just work..
 
 --
 Bernhard
State-Changed-From-To: open->feedback 
State-Changed-By: bschmidt 
State-Changed-When: Tue Jun 19 06:53:28 UTC 2012 
State-Changed-Why:  
feedback requested 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154826 
State-Changed-From-To: feedback->closed 
State-Changed-By: bschmidt 
State-Changed-When: Tue Jun 19 06:54:22 UTC 2012 
State-Changed-Why:  
email bounces 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154826 

From: Bernhard Schmidt <bschmidt@freebsd.org>
To: Nezmer <me@nezmer.info>
Cc: bug-followup@freebsd.org
Subject: Re: kern/154826: [iwn] iwn driver fails to power on adapter after resume
Date: Tue, 19 Jun 2012 08:53:15 +0200

 On Thu, Feb 17, 2011 at 9:16 PM, Bernhard Schmidt <bschmidt@freebsd.org> wrote:
 > This is clearly not an iwn(4) issue, "adapter type 15" tells us that bogus
 > values are read from PCI space, something like 0xffffffff for 32bit registers.
 > I suspect that the PCI space is not correctly restored on resume, but I have
 > no clue about that..
 >
 > There have been quite some changes in that regard to HEAD, so, can I talk you
 > into trying this with a kernel from HEAD? It might just work..
 
 Did you have a chance to test this with a newer version? stable/9 maybe?
 
 -- 
 Bernhard
>Unformatted:
