diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-11-06 10:40:37 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-11-06 10:40:37 +0000 |
commit | 1b2cca43962b305f5786dcdfc424ca22ce44cce6 (patch) | |
tree | 47f46e685c87dffdf5bee15e7cb55f4aee71f6a9 /sys/arch/amd64 | |
parent | 65d3cf7e6b97615ce69a5bc0815fcdd5f188376e (diff) |
Add support for Power Resources for Dx states and the necessary hook
for PCI devices. This hook should be called twice, before and after
changing the power state of a PCI device.
Before setting the device to the new state, the ACPI layer will notify
every power resources linked to the device for that state and make sure
they are turned "_ON". After changing the state of the device, it will
decrement the reference of every power resources linked to that device
for the old state and turn them "_OFF" if they are no longer referenced.
This fixes the no-USB after resume problem seen on various ThinkPad,
problem initialy diagnosed with Alexander Polakov.
ok kettenis@, deraadt@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/include/pci_machdep.h | 3 | ||||
-rw-r--r-- | sys/arch/amd64/pci/pci_machdep.c | 16 |
2 files changed, 13 insertions, 6 deletions
diff --git a/sys/arch/amd64/include/pci_machdep.h b/sys/arch/amd64/include/pci_machdep.h index 51894074a34..395970faffd 100644 --- a/sys/arch/amd64/include/pci_machdep.h +++ b/sys/arch/amd64/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.21 2012/09/19 23:23:50 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.22 2013/11/06 10:40:36 mpi Exp $ */ /* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */ /* @@ -95,6 +95,7 @@ void pci_decompose_tag(pci_chipset_tag_t, pcitag_t, void pci_dev_postattach(struct device *, struct pci_attach_args *); pcireg_t pci_min_powerstate(pci_chipset_tag_t, pcitag_t); +void pci_set_powerstate_md(pci_chipset_tag_t, pcitag_t, int, int); /* * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c index b6afa739d27..9fac42f5785 100644 --- a/sys/arch/amd64/pci/pci_machdep.c +++ b/sys/arch/amd64/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.57 2013/05/30 16:19:25 deraadt Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.58 2013/11/06 10:40:36 mpi Exp $ */ /* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -665,6 +665,8 @@ pci_init_extents(void) #include "acpi.h" #if NACPI > 0 void acpi_pci_match(struct device *, struct pci_attach_args *); +pcireg_t acpi_pci_min_powerstate(pci_chipset_tag_t, pcitag_t); +void acpi_pci_set_powerstate(pci_chipset_tag_t, pcitag_t, int, int); #endif void @@ -675,10 +677,6 @@ pci_dev_postattach(struct device *dev, struct pci_attach_args *pa) #endif } -#if NACPI > 0 -pcireg_t acpi_pci_min_powerstate(pci_chipset_tag_t, pcitag_t); -#endif - pcireg_t pci_min_powerstate(pci_chipset_tag_t pc, pcitag_t tag) { @@ -688,3 +686,11 @@ pci_min_powerstate(pci_chipset_tag_t pc, pcitag_t tag) return pci_get_powerstate(pc, tag); #endif } + +void +pci_set_powerstate_md(pci_chipset_tag_t pc, pcitag_t tag, int state, int pre) +{ +#if NACPI > 0 + acpi_pci_set_powerstate(pc, tag, state, pre); +#endif +} |