public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stefan Dösinger" <stefandoesinger-RbZlAiThDcE@public.gmane.org>
To: Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: davem-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	pp-YuCZbdju05vHOG6cAo2yLw@public.gmane.org,
	ACPI Developers
	<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: b44 suspend/resume (Re: PCI not restored correctly after suspend to ram)
Date: Mon, 22 Mar 2004 21:27:43 +0100	[thread overview]
Message-ID: <200403222127.43854.stefandoesinger@gmx.at> (raw)
In-Reply-To: <1079728500.7277.140.camel-D2Zvc0uNKG8@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2612 bytes --]

Hi,
> > I can get most devices devies to work by setting the pci registers with
> > setpci after resume. I use the attached fixpci.sh script to do so. I can
> > get my soundcard, the ethernet card(02:02.0) ...
>
> 02:02.0 Ethernet controller: Broadcom Corporation BCM4401 100Base-T (rev
> 01)
>
> I think this is the b44. Looking at b44_suspend/b44_resume, I don't see
> any calls to pci_save_state()/pci_restore_state() that I would expect,
> so it comes back after resume with bus mastering disabled etc.
I added pci_save_state()/pci_restore_state() to the b44 driver and it works.
I send the patch.
I don't know much about the diff utility so you might have to specify the 
files manually when patching.

> 02:02.0 Ethernet controller: Broadcom Corporation BCM4401 100Base-T (rev
> 01)
>         Subsystem: Acer Incorporated [ALI]: Unknown device 001f
>         Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
> ParErr- Stepping- SERR+ FastB2B-
>         Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort+
> <TAbort- <MAbort- >SERR- <PERR-
>         Latency: 64
>         Interrupt: pin A routed to IRQ 5
>         Region 0: Memory at d0204000 (32-bit, non-prefetchable)
> [size=8K]
>         Capabilities: [40] Power Management version 2
>                 Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA
> PME(D0+,D1+,D2+,D3hot+,D3cold+)
>                 Status: D0 PME-Enable- DSel=0 DScale=2 PME-
> 00: e4 14 01 44 06 01 10 08 01 00 00 02 00 40 00 00
> 10: 00 40 20 d0 00 00 00 00 00 00 00 00 00 00 00 00
> 20: 00 00 00 00 00 00 00 00 00 00 00 00 25 10 1f 00
> 30: 00 00 00 00 40 00 00 00 00 00 00 00 05 01 00 00
>
> ------------
> lspci_after_suspend
> 02:02.0 Ethernet controller: Broadcom Corporation BCM4401 100Base-T (rev
> 01)
>         Subsystem: Acer Incorporated [ALI]: Unknown device 001f
>         Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop-
> ParErr- Stepping- SERR- FastB2B-
>         Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
> <TAbort- <MAbort- >SERR- <PERR-
>         Interrupt: pin A routed to IRQ 5
>         Region 0: [virtual] Memory at d0204000 (32-bit,
> non-prefetchable) [disabled] [size=8K]
>         Capabilities: [40] Power Management version 2
>                 Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA
> PME(D0+,D1+,D2+,D3hot+,D3cold+)
>                 Status: D0 PME-Enable- DSel=0 DScale=2 PME-
> 00: e4 14 01 44 00 00 10 00 01 00 00 02 00 00 00 00
> 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 20: 00 00 00 00 00 00 00 00 00 00 00 00 25 10 1f 00
> 30: 00 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00

[-- Attachment #2: b44.h.diff --]
[-- Type: text/x-diff, Size: 297 bytes --]

--- linux-2.6.4-orig/drivers/net/b44.h	2004-02-18 04:58:36.000000000 +0100
+++ linux-2.6.4/drivers/net/b44.h	2004-03-22 21:06:01.000000000 +0100
@@ -538,6 +538,11 @@
 	u8			phy_addr;
 	u8			mdc_port;
 	u8			core_unit;
+	
+#ifdef CONFIG_PM
+	u32 pm_state[16];
+#endif
+	
 };
 
 #endif /* _B44_H */

[-- Attachment #3: b44.c.diff --]
[-- Type: text/x-diff, Size: 864 bytes --]

--- linux-2.6.4-orig/drivers/net/b44.c	2004-02-18 04:57:39.000000000 +0100
+++ linux-2.6.4/drivers/net/b44.c	2004-03-22 21:15:06.674051288 +0100
@@ -1863,6 +1863,8 @@
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct b44 *bp = dev->priv;
+	pci_save_state(pdev, bp->pm_state);
+
 
         if (!netif_running(dev))
                  return 0;
@@ -1877,6 +1879,9 @@
 	b44_free_rings(bp);
 
 	spin_unlock_irq(&bp->lock);
+	
+	pci_disable_device(pdev); /* disable busmastering */
+	pci_set_power_state(pdev,state); /* Zzz. */
 	return 0;
 }
 
@@ -1885,6 +1890,9 @@
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct b44 *bp = dev->priv;
 
+	pci_set_power_state(pdev,0);
+	pci_restore_state(pdev, bp->pm_state);
+		
 	if (!netif_running(dev))
 		return 0;
 
@@ -1899,6 +1907,7 @@
 	add_timer(&bp->timer);
 
 	b44_enable_ints(bp);
+
 	return 0;
 }
 

  parent reply	other threads:[~2004-03-22 20:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18  8:35 PCI not restored correctly after suspend to ram Stefan Dösinger
     [not found] ` <200403180935.09436.stefan.doesinger-dYJrdcitkgg0+Ua9VpOLR6Q1ief8SNuKXqFh9Ls21Oc@public.gmane.org>
2004-03-19 10:59   ` Bruno Ducrot
2004-03-19 18:10   ` Len Brown
     [not found]     ` <1079719856.7278.30.camel-D2Zvc0uNKG8@public.gmane.org>
2004-03-21 19:28       ` Stefan Dösinger
2004-03-23 20:42       ` Stefan Dösinger
2004-03-31 16:15       ` Pavel Machek
2004-03-19 19:25   ` Len Brown
2004-03-19 20:35   ` b44 suspend/resume (Re: PCI not restored correctly after suspend to ram) Len Brown
     [not found]     ` <1079728500.7277.140.camel-D2Zvc0uNKG8@public.gmane.org>
2004-03-21 19:13       ` Stefan Dösinger
2004-03-22 20:27       ` Stefan Dösinger [this message]
2004-03-23  2:45       ` David S. Miller
2004-03-20  4:47   ` PCI not restored correctly after suspend to ram Len Brown
2004-03-20  5:46   ` pci bridge suspend/resume (Re: PCI not restored correctly after suspend to ram) Len Brown
     [not found]     ` <1079761564.7274.730.camel-D2Zvc0uNKG8@public.gmane.org>
2004-03-20  5:52       ` cardbus " Len Brown
     [not found]         ` <1079761951.7277.735.camel-D2Zvc0uNKG8@public.gmane.org>
2004-03-21 19:36           ` Stefan Dösinger
2004-03-20  8:28       ` pci " Jeff Garzik
     [not found]         ` <405C00C6.3010805-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2004-03-20 13:45           ` Matthew Wilcox
     [not found]             ` <20040320134542.GV25059-+pPCBgu9SkPzIGdyhVEDUDl5KyyQGfY2kSSpQ9I8OhVaa/9Udqfwiw@public.gmane.org>
2004-03-20 18:00               ` Grant Grundler
2004-03-20 18:10               ` Greg KH
     [not found]                 ` <20040320181000.GA8272-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2004-03-22 22:34                   ` Adam Belay
     [not found]                     ` <20040322223425.GB3213-IBH0VoN/3vPQT0dZR+AlfA@public.gmane.org>
2004-03-23  9:23                       ` Russell King
     [not found]                         ` <20040323092338.A21352-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2004-03-23 16:07                           ` Grant Grundler
2004-03-24  1:35                       ` Greg KH
     [not found]                         ` <20040324013557.GB21477-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2004-03-24  9:07                           ` Russell King
     [not found]                             ` <20040324090746.A13095-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2004-03-24 13:26                               ` Matthew Wilcox
     [not found]                                 ` <20040324132632.GI25059-+pPCBgu9SkPzIGdyhVEDUDl5KyyQGfY2kSSpQ9I8OhVaa/9Udqfwiw@public.gmane.org>
2004-03-24 15:14                                   ` Russell King
2004-03-31  6:03                               ` Nate Lawson
     [not found]                                 ` <20040330214941.L85074-Y6VGUYTwhu0@public.gmane.org>
2004-03-31  7:28                                   ` Russell King
     [not found]                                     ` <20040331082834.B27804-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2004-03-31 15:28                                       ` Grant Grundler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200403222127.43854.stefandoesinger@gmx.at \
    --to=stefandoesinger-rbzlaithdce@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=davem-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=pp-YuCZbdju05vHOG6cAo2yLw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox