freebsd-nq/sys
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
..
amd64 Add workaround for vt efifb's early use of PHYS_TO_DMAP 2014-11-11 14:59:46 +00:00
arm Renove faith(4) and faithd(8) from base. It looks like industry 2014-11-09 21:33:01 +00:00
boot MFV r274273: 2014-11-10 08:20:21 +00:00
bsm
cam Handle PREEMPT AND ABORT service action equal to PREEMPT. 2014-11-09 22:43:29 +00:00
cddl MFV r274273: 2014-11-10 08:20:21 +00:00
compat These don't belong in the modules directory. 2014-11-06 16:52:51 +00:00
conf Renove faith(4) and faithd(8) from base. It looks like industry 2014-11-09 21:33:01 +00:00
contrib krping: In verbose mode print only first 128 bytes of krping data. 2014-10-27 22:41:55 +00:00
crypto Fix gcc build: preserve const qualifier when casting input values. 2014-11-11 13:37:28 +00:00
ddb ddb: ANSI-fy function declarations. 2014-10-12 18:01:52 +00:00
dev Use the correct device (child) when asking the bus layer about which power 2014-11-11 17:14:11 +00:00
fs Fix up some session-related races in devfs. 2014-11-03 03:12:15 +00:00
gdb Add support for gdb's memory searching capabilities to our in-kernel gdb 2014-09-05 16:40:47 +00:00
geom Add missing privilege check when setting the dump device. Before that change it 2014-11-11 04:48:09 +00:00
gnu reiserfs: Use signed i_nlink 2014-09-25 19:10:32 +00:00
i386 Renove faith(4) and faithd(8) from base. It looks like industry 2014-11-09 21:33:01 +00:00
isa
kern Add missing privilege check when setting the dump device. Before that change it 2014-11-11 04:48:09 +00:00
kgssapi Avoid dynamic syscall overhead for statically compiled modules. 2014-10-26 19:42:44 +00:00
libkern Add a complete implementation of MurmurHash3. Tweak both implementations 2014-10-18 22:15:11 +00:00
mips Renove faith(4) and faithd(8) from base. It looks like industry 2014-11-09 21:33:01 +00:00
modules Renove faith(4) and faithd(8) from base. It looks like industry 2014-11-09 21:33:01 +00:00
net Fix some minor TSO issues: 2014-11-11 12:05:59 +00:00
net80211 Fix multiple incorrect SYSCTL arguments in the kernel: 2014-10-21 07:31:21 +00:00
netgraph Remove struct arpcom. It is unused by most interface types, that allocate 2014-11-07 15:14:10 +00:00
netinet Fix some minor TSO issues: 2014-11-11 12:05:59 +00:00
netinet6 Kill custom in_matroute() radix mathing function removing one rte mutex lock. 2014-11-11 02:52:40 +00:00
netipsec Pass mbuf to pfil processing before stripping outer IP header as it 2014-11-07 12:05:20 +00:00
netnatm
netpfil Finish r274315: remove union 'u' from struct pf_send_entry. 2014-11-09 17:01:54 +00:00
netsmb
nfs Avoid dynamic syscall overhead for statically compiled modules. 2014-10-26 19:42:44 +00:00
nfsclient Follow up to r225617. In order to maximize the re-usability of kernel code 2014-10-16 18:04:43 +00:00
nfsserver Change NFS readdir() to only ignore cookies preceding the given offset for 2014-07-01 20:00:35 +00:00
nlm Avoid dynamic syscall overhead for statically compiled modules. 2014-10-26 19:42:44 +00:00
ofed Fix compile warning by removing unused variable. 2014-10-30 16:57:56 +00:00
opencrypto Fix build for kernels without COMPAT_FREEBSD32. 2014-09-22 17:32:27 +00:00
pc98 Renove faith(4) and faithd(8) from base. It looks like industry 2014-11-09 21:33:01 +00:00
powerpc Renove faith(4) and faithd(8) from base. It looks like industry 2014-11-09 21:33:01 +00:00
rpc Merge the NFSv4.1 server code in projects/nfsv4.1-server over 2014-07-01 20:47:16 +00:00
security Replace dev_clone with cdevpriv(9) KPI in audit_pipe code. 2014-08-20 16:04:30 +00:00
sparc64 Renove faith(4) and faithd(8) from base. It looks like industry 2014-11-09 21:33:01 +00:00
sys Add missing privilege check when setting the dump device. Before that change it 2014-11-11 04:48:09 +00:00
teken
tools Allow the make_dtb script to work outside of a "make buildkernel" context 2014-08-30 22:39:15 +00:00
ufs When non-forced unmount or remount rw->ro is performed, writes on UFS 2014-11-02 13:14:55 +00:00
vm Fix mis-spelling of bits and types names in the 2014-11-04 19:56:04 +00:00
x86 MFamd64: Add support for extended FPU states on i386. This includes 2014-11-02 22:58:30 +00:00
xdr
xen xen: implement the privcmd user-space device 2014-10-22 17:07:20 +00:00
Makefile Remove "pci" from CSCOPEDIRS. 2014-09-23 06:32:19 +00:00