freebsd-dev/sys/dev/pci
Adrian Chadd 2da2ade021 Use the correct device (child) when asking the bus layer about which power
state said device should go into.

This was a snafu introduced in the ACPI/PCI awareness separation.

When putting a device into a power state, the bus (and thus firmware,
eg ACPI) should be asked before hand to check whether the device
can indeed go into that power state.

There's a set of nodes in ACPI under each device - the _SxD nodes - which
state which ACPI power state to put the device into when the system is
going into power save state 'x'.  So when going into S3, the existence
of an _S3D node would override whatever the system was trying to do.

By default the PCI code wants to put devices into D3 before suspending.

I have a laptop here (Asus Zenbook - check the PR) whose EHCI controller
really wants to be in D2 during suspend, not D3.  So if we put it into
D3 and then try to enter S3, everything hangs.  The device itself
can go into D3 - it just can't be there when the call to ACPI to enter
S3 occurs.  The PCI patch fixes this.

jkim@ noticed that the same is needed for the ACPI child device
enumeration.

Thankyou to Matt Dillon (the programmer, not the actor) for buying me
this particular laptop so I could debug the issues with the Atheros
AR9485 that is in it.  It's his fault that I ended up with this
laptop and was sufficiently annoyed by the lack of USB suspend
to go down this rabbit hole.

Tested:

* Thinkpad T400
* Thinkpad X230
* Thinkpad T42
* Thinkpad T60
* Asus Zenbook (see PR)
* Asus EEEPC 701
* Asus EEEPC 1001PX

TODO:

* Figure out what we should do about devices we unload drivers for
  that want to be in a specific state when entering S3 / S4 -
  the "put devices into D3 if they're not bound to a driver" option
  may also mess with things.

PR:		kern/194884
Reviewed by:	jhb, jkim
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Matt Dillon <dillon@apollo.backplane.com> (hardware)
2014-11-11 17:14:11 +00:00
..
eisa_pci.c
fixup_pci.c Use device_printf(). 2013-08-11 06:57:57 +00:00
hostb_pci.c Expand the set of APIs available for locating PCI capabilities: 2012-03-03 18:08:57 +00:00
ignore_pci.c
isa_pci.c Implement BUS_ADD_CHILD() for the isab(4) driver. It already calls 2011-12-14 12:34:02 +00:00
pci_if.m pci: add a new pci_child_added newbus method. 2014-08-22 15:05:51 +00:00
pci_pci.c Follow up to r225617. In order to maximize the re-usability of kernel code 2014-10-16 18:04:43 +00:00
pci_private.h Stage one of multipass suspend/resume 2014-09-23 02:56:40 +00:00
pci_subr.c Add support for managing PCI bus numbers. As with BARs and PCI-PCI bridge 2014-02-12 04:30:37 +00:00
pci_user.c Add support for displaying VPD for PCI devices via pciconf. 2014-01-20 20:56:09 +00:00
pci.c Use the correct device (child) when asking the bus layer about which power 2014-11-11 17:14:11 +00:00
pcib_if.m Be consistent with the whitespace in the rest of these files. 2014-04-29 20:49:47 +00:00
pcib_private.h Add support for PCIe ARI 2014-04-01 16:02:02 +00:00
pcib_support.c Add missing copyright date. 2014-04-01 17:35:31 +00:00
pcireg.h Add IOMMU PCI subclass, found on Tyan S8236 motherboard. 2014-05-20 14:39:22 +00:00
pcivar.h pci: add a new pci_child_added newbus method. 2014-08-22 15:05:51 +00:00
vga_pci.c Remove ia64. 2014-07-07 00:27:09 +00:00