On 3 August 2010 20:25, Oleg Sharoyko <osharo...@gmail.com> wrote:

>> I wonder if the bus numbers for PCI-PCI bridges need to be restored on 
>> resume?
>> If they aren't then config transactions won't be routed properly.  You could
>> add a pcib_resume() method that prints out the various bus register values
>> after resume to see if they match what we print out during boot.

Indeed this was the problem of PCI-PIC bridges' registers not being
restored upon resume.
Thanks for your advise! I'm including the patch, which uses exiting
methods from dev/pic/pic_pci.c
to save/restore bridges' registers on suspend/resume. With it my
macbook pro no longer
looses devices after resume.

Unfortunately it doesn't help with videocard problem. Though I no
longer see 'failed to reload state'
message, display still stays blank and dark after resume. Would
freebsd-acpi be the right list
to ask for help or can you recommend anything else I can do to solve
this problem?

Index: dev/acpica/acpi_pcib_pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/acpica/acpi_pcib_pci.c,v
retrieving revision 1.18
diff -u -r1.18 acpi_pcib_pci.c
--- dev/acpica/acpi_pcib_pci.c  5 Jun 2009 18:44:36 -0000       1.18
+++ dev/acpica/acpi_pcib_pci.c  4 Aug 2010 06:54:36 -0000
@@ -65,6 +65,7 @@

 static int             acpi_pcib_pci_probe(device_t bus);
 static int             acpi_pcib_pci_attach(device_t bus);
+static int             acpi_pcib_pci_suspend(device_t bus);
 static int             acpi_pcib_pci_resume(device_t bus);
 static int             acpi_pcib_read_ivar(device_t dev, device_t child,
                            int which, uintptr_t *result);
@@ -76,7 +77,7 @@
     DEVMETHOD(device_probe,            acpi_pcib_pci_probe),
     DEVMETHOD(device_attach,           acpi_pcib_pci_attach),
     DEVMETHOD(device_shutdown,         bus_generic_shutdown),
-    DEVMETHOD(device_suspend,          bus_generic_suspend),
+    DEVMETHOD(device_suspend,          acpi_pcib_pci_suspend),
     DEVMETHOD(device_resume,           acpi_pcib_pci_resume),

     /* Bus interface */
@@ -142,9 +143,20 @@
 }

 static int
-acpi_pcib_pci_resume(device_t dev)
+acpi_pcib_pci_suspend(device_t dev)
 {
+    struct acpi_pcib_softc *sc;
+    sc = device_get_softc(dev);
+    pcib_cfg_save(&sc->ap_pcibsc);
+    return (bus_generic_suspend(dev));
+}

+static int
+acpi_pcib_pci_resume(device_t dev)
+{
+    struct acpi_pcib_softc *sc;
+    sc = device_get_softc(dev);
+    pcib_cfg_restore(&sc->ap_pcibsc);
     return (acpi_pcib_resume(dev));
 }

Index: dev/pci/pci_pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/pci/pci_pci.c,v
retrieving revision 1.61
diff -u -r1.61 pci_pci.c
--- dev/pci/pci_pci.c   10 Dec 2009 01:01:53 -0000      1.61
+++ dev/pci/pci_pci.c   4 Aug 2010 06:54:36 -0000
@@ -238,7 +238,7 @@
 /*
  * Get current bridge configuration.
  */
-static void
+void
 pcib_cfg_save(struct pcib_softc *sc)
 {
        device_t        dev;
@@ -260,7 +260,7 @@
 /*
  * Restore previous bridge configuration.
  */
-static void
+void
 pcib_cfg_restore(struct pcib_softc *sc)
 {
        device_t        dev;
Index: dev/pci/pcib_private.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/pci/pcib_private.h,v
retrieving revision 1.15
diff -u -r1.15 pcib_private.h
--- dev/pci/pcib_private.h      14 Mar 2009 14:08:53 -0000      1.15
+++ dev/pci/pcib_private.h      4 Aug 2010 06:54:36 -0000
@@ -82,5 +82,7 @@
 int            pcib_alloc_msix(device_t pcib, device_t dev, int *irq);
 int            pcib_release_msix(device_t pcib, device_t dev, int irq);
 int            pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t
*addr, uint32_t *data);
+void           pcib_cfg_save(struct pcib_softc *sc);
+void           pcib_cfg_restore(struct pcib_softc *sc);

 #endif

-- 
Oleg Sharoyko
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to