blob: 8afb6ff517df9c852da16741ceea7db07cdcefae [file] [log] [blame]
Angel Pons0612b272020-04-05 15:46:56 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Hannah Williams4cff1d52016-06-08 14:29:47 -07002
Ricardo Quesada470ca5712021-07-16 16:39:28 -07003#include <commonlib/include/commonlib/console/post_codes.h>
Hannah Williams4cff1d52016-06-08 14:29:47 -07004
Lijian Zhaoc5d734b2019-04-19 16:57:46 -07005External(\_SB.MPTS, MethodObj)
6External(\_SB.MWAK, MethodObj)
Eric Lai086f0fa2019-12-13 12:31:46 +08007External(\_SB.PCI0.EGPM, MethodObj)
8External(\_SB.PCI0.RGPM, MethodObj)
Michael Niewöhner9c2d8132022-05-18 22:24:17 +02009External(\_SB.PCI0.LPCB.EC0.PTS, MethodObj)
10External(\_SB.PCI0.LPCB.EC0.WAK, MethodObj)
Lijian Zhaoc5d734b2019-04-19 16:57:46 -070011
Angel Ponsf0ed8462022-05-02 16:52:57 +020012#include <arch/x86/acpi/post.asl>
Hannah Williams4cff1d52016-06-08 14:29:47 -070013
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
19Method (_PTS, 1)
20{
lilacious40cb3fe2023-06-21 23:24:14 +020021 DBG0 = POSTCODE_OS_ENTER_PTS
Duncan Laurie0dd91352018-11-05 16:27:33 -070022
Michael Niewöhner9c2d8132022-05-18 22:24:17 +020023 If (CondRefOf (\_SB.PCI0.LPCB.EC0.PTS))
24 {
25 \_SB.PCI0.LPCB.EC0.PTS (Arg0)
26 }
Lijian Zhaoc5d734b2019-04-19 16:57:46 -070027 If (CondRefOf (\_SB.MPTS))
28 {
29 \_SB.MPTS (Arg0)
30 }
Eric Lai086f0fa2019-12-13 12:31:46 +080031 /*
32 * Save the current PM bits then
Subrata Banik2ccc0a42021-03-25 20:01:47 +053033 * enable GPIO PM with MISCCFG_GPIO_PM_CONFIG_BITS
Elyes HAOUASa895c322020-03-31 21:55:16 +020034 */
Eric Lai086f0fa2019-12-13 12:31:46 +080035 If (CondRefOf (\_SB.PCI0.EGPM))
36 {
37 \_SB.PCI0.EGPM ()
38 }
Hannah Williams4cff1d52016-06-08 14:29:47 -070039}
40
41/* The _WAK method is called on system wakeup */
42
43Method (_WAK, 1)
44{
lilacious40cb3fe2023-06-21 23:24:14 +020045 DBG0 = POSTCODE_OS_ENTER_WAKE
Duncan Laurie0dd91352018-11-05 16:27:33 -070046
Michael Niewöhner9c2d8132022-05-18 22:24:17 +020047 If (CondRefOf (\_SB.PCI0.LPCB.EC0.WAK))
48 {
49 \_SB.PCI0.LPCB.EC0.WAK (Arg0)
50 }
Lijian Zhaoc5d734b2019-04-19 16:57:46 -070051 If (CondRefOf (\_SB.MWAK))
52 {
53 \_SB.MWAK (Arg0)
54 }
Eric Lai086f0fa2019-12-13 12:31:46 +080055 /* Restore GPIO all Community PM */
56 If (CondRefOf (\_SB.PCI0.RGPM))
57 {
58 \_SB.PCI0.RGPM ()
59 }
Lijian Zhaoc5d734b2019-04-19 16:57:46 -070060
Hannah Williams4cff1d52016-06-08 14:29:47 -070061 Return (Package(){0,0})
62}