Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Aug 2010 11:12:28 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Oleg Sharoyko <osharoiko@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: PCI config space is not restored upon resume (macbook pro)
Message-ID:  <201008041112.28704.jhb@freebsd.org>
In-Reply-To: <AANLkTika4sUaEh67bpyjJLSALKwhOYHzaAm-eWoE%2BqNW@mail.gmail.com>
References:  <AANLkTikMFhG1QLDf4raf%2BrxOKhobjoA-dRbUew2-8KeF@mail.gmail.com> <AANLkTinUvptZ9vrGq0Y8d3jUu0JzGsLCy5%2Brc3Rd=_rQ@mail.gmail.com> <AANLkTika4sUaEh67bpyjJLSALKwhOYHzaAm-eWoE%2BqNW@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, August 04, 2010 3:13:04 am Oleg Sharoyko wrote:
> On 3 August 2010 20:25, Oleg Sharoyko <osharoiko@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.

Cool, I actually think that the ACPI PCI-PCI driver can just use the
stock PCI-PCI bridge driver's suspend and resume methods.  Can you try
out this alternate patch instead?
 
> 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?

This sounds like the display just needs to be powered on via DPMS.
You might be able to make this work via acpi_video and toggling the
LCD status that way.  You could also try dpms.ko.

Index: dev/acpica/acpi_pcib.c
===================================================================
--- dev/acpica/acpi_pcib.c	(revision 210796)
+++ dev/acpica/acpi_pcib.c	(working copy)
@@ -171,13 +171,6 @@
     return_VALUE (bus_generic_attach(dev));
 }
 
-int
-acpi_pcib_resume(device_t dev)
-{
-
-    return (bus_generic_resume(dev));
-}
-
 static void
 prt_lookup_device(ACPI_PCI_ROUTING_TABLE *entry, void *arg)
 {
Index: dev/acpica/acpi_pcib_pci.c
===================================================================
--- dev/acpica/acpi_pcib_pci.c	(revision 210796)
+++ dev/acpica/acpi_pcib_pci.c	(working copy)
@@ -65,7 +65,6 @@
 
 static int		acpi_pcib_pci_probe(device_t bus);
 static int		acpi_pcib_pci_attach(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);
 static int		acpi_pcib_pci_route_interrupt(device_t pcib,
@@ -75,39 +74,20 @@
     /* Device interface */
     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_resume,		acpi_pcib_pci_resume),
 
     /* Bus interface */
-    DEVMETHOD(bus_print_child,		bus_generic_print_child),
     DEVMETHOD(bus_read_ivar,		acpi_pcib_read_ivar),
-    DEVMETHOD(bus_write_ivar,		pcib_write_ivar),
-    DEVMETHOD(bus_alloc_resource,	pcib_alloc_resource),
-    DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
-    DEVMETHOD(bus_activate_resource,	bus_generic_activate_resource),
-    DEVMETHOD(bus_deactivate_resource, 	bus_generic_deactivate_resource),
-    DEVMETHOD(bus_setup_intr,		bus_generic_setup_intr),
-    DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
 
     /* pcib interface */
-    DEVMETHOD(pcib_maxslots,		pcib_maxslots),
-    DEVMETHOD(pcib_read_config,		pcib_read_config),
-    DEVMETHOD(pcib_write_config,	pcib_write_config),
     DEVMETHOD(pcib_route_interrupt,	acpi_pcib_pci_route_interrupt),
-    DEVMETHOD(pcib_alloc_msi,		pcib_alloc_msi),
-    DEVMETHOD(pcib_release_msi,		pcib_release_msi),
-    DEVMETHOD(pcib_alloc_msix,		pcib_alloc_msix),
-    DEVMETHOD(pcib_release_msix,	pcib_release_msix),
-    DEVMETHOD(pcib_map_msi,		pcib_map_msi),
 
     {0, 0}
 };
 
 static devclass_t pcib_devclass;
 
-DEFINE_CLASS_0(pcib, acpi_pcib_pci_driver, acpi_pcib_pci_methods,
-    sizeof(struct acpi_pcib_softc));
+DEFINE_CLASS_1(pcib, acpi_pcib_pci_driver, acpi_pcib_pci_methods,
+    sizeof(struct acpi_pcib_softc), pcib_driver);
 DRIVER_MODULE(acpi_pcib, pci, acpi_pcib_pci_driver, pcib_devclass, 0, 0);
 MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1);
 
@@ -142,13 +123,6 @@
 }
 
 static int
-acpi_pcib_pci_resume(device_t dev)
-{
-
-    return (acpi_pcib_resume(dev));
-}
-
-static int
 acpi_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
 {
     struct acpi_pcib_softc *sc = device_get_softc(dev);
Index: dev/acpica/acpi_pcib_acpi.c
===================================================================
--- dev/acpica/acpi_pcib_acpi.c	(revision 210796)
+++ dev/acpica/acpi_pcib_acpi.c	(working copy)
@@ -65,7 +65,6 @@
 
 static int		acpi_pcib_acpi_probe(device_t bus);
 static int		acpi_pcib_acpi_attach(device_t bus);
-static int		acpi_pcib_acpi_resume(device_t bus);
 static int		acpi_pcib_read_ivar(device_t dev, device_t child,
 			    int which, uintptr_t *result);
 static int		acpi_pcib_write_ivar(device_t dev, device_t child,
@@ -94,7 +93,7 @@
     DEVMETHOD(device_attach,		acpi_pcib_acpi_attach),
     DEVMETHOD(device_shutdown,		bus_generic_shutdown),
     DEVMETHOD(device_suspend,		bus_generic_suspend),
-    DEVMETHOD(device_resume,		acpi_pcib_acpi_resume),
+    DEVMETHOD(device_resume,		bus_generic_resume),
 
     /* Bus interface */
     DEVMETHOD(bus_print_child,		bus_generic_print_child),
@@ -257,13 +257,6 @@
     return (acpi_pcib_attach(dev, &sc->ap_prt, sc->ap_bus));
 }
 
-static int
-acpi_pcib_acpi_resume(device_t dev)
-{
-
-    return (acpi_pcib_resume(dev));
-}
-
 /*
  * Support for standard PCI bridge ivars.
  */
Index: dev/acpica/acpi_pcibvar.h
===================================================================
--- dev/acpica/acpi_pcibvar.h	(revision 210796)
+++ dev/acpica/acpi_pcibvar.h	(working copy)
@@ -31,13 +31,14 @@
 #define	_ACPI_PCIBVAR_H_
 
 #ifdef _KERNEL
+
 void	acpi_pci_link_add_reference(device_t dev, int index, device_t pcib,
     int slot, int pin);
 int	acpi_pci_link_route_interrupt(device_t dev, int index);
 int	acpi_pcib_attach(device_t bus, ACPI_BUFFER *prt, int busno);
 int	acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
     ACPI_BUFFER *prtbuf);
-int	acpi_pcib_resume(device_t dev);
+
 #endif /* _KERNEL */
 
 #endif /* !_ACPI_PCIBVAR_H_ */
Index: dev/pci/pcib_private.h
===================================================================
--- dev/pci/pcib_private.h	(revision 210796)
+++ dev/pci/pcib_private.h	(working copy)
@@ -37,6 +37,7 @@
  * Export portions of generic PCI:PCI bridge support so that it can be
  * used by subclasses.
  */
+DECLARE_CLASS(pcib_driver);
 
 /*
  * Bridge-specific data.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008041112.28704.jhb>