| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
#include <commonlib/include/commonlib/console/post_codes.h> |
| 4 |
|
| 5 |
External(\_SB.MPTS, MethodObj) |
| 6 |
External(\_SB.MWAK, MethodObj) |
| 7 |
External(\_SB.PCI0.EGPM, MethodObj) |
| 8 |
External(\_SB.PCI0.RGPM, MethodObj) |
| 9 |
External(\_SB.PCI0.LPCB.EC0.PTS, MethodObj) |
| 10 |
External(\_SB.PCI0.LPCB.EC0.WAK, MethodObj) |
| 11 |
|
| 12 |
#include <arch/x86/acpi/post.asl> |
| 13 |
|
| 14 |
/* |
| 15 |
* The _PTS method (Prepare To Sleep) is called before the OS is |
| 16 |
* entering a sleep state. The sleep state number is passed in Arg0 |
| 17 |
*/ |
| 18 |
|
| 19 |
Method (_PTS, 1) |
| 20 |
{ |
| 21 |
DBG0 = POSTCODE_OS_ENTER_PTS |
| 22 |
|
| 23 |
If (CondRefOf (\_SB.PCI0.LPCB.EC0.PTS)) |
| 24 |
{ |
| 25 |
\_SB.PCI0.LPCB.EC0.PTS (Arg0) |
| 26 |
} |
| 27 |
If (CondRefOf (\_SB.MPTS)) |
| 28 |
{ |
| 29 |
\_SB.MPTS (Arg0) |
| 30 |
} |
| 31 |
/* |
| 32 |
* Save the current PM bits then |
| 33 |
* enable GPIO PM with MISCCFG_GPIO_PM_CONFIG_BITS |
| 34 |
*/ |
| 35 |
If (CondRefOf (\_SB.PCI0.EGPM)) |
| 36 |
{ |
| 37 |
\_SB.PCI0.EGPM () |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
/* The _WAK method is called on system wakeup */ |
| 42 |
|
| 43 |
Method (_WAK, 1) |
| 44 |
{ |
| 45 |
DBG0 = POSTCODE_OS_ENTER_WAKE |
| 46 |
|
| 47 |
If (CondRefOf (\_SB.PCI0.LPCB.EC0.WAK)) |
| 48 |
{ |
| 49 |
\_SB.PCI0.LPCB.EC0.WAK (Arg0) |
| 50 |
} |
| 51 |
If (CondRefOf (\_SB.MWAK)) |
| 52 |
{ |
| 53 |
\_SB.MWAK (Arg0) |
| 54 |
} |
| 55 |
/* Restore GPIO all Community PM */ |
| 56 |
If (CondRefOf (\_SB.PCI0.RGPM)) |
| 57 |
{ |
| 58 |
\_SB.PCI0.RGPM () |
| 59 |
} |
| 60 |
|
| 61 |
Return (Package(){0,0}) |
| 62 |
} |