Angel Pons | 0612b27 | 2020-04-05 15:46:56 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Hannah Williams | 4cff1d5 | 2016-06-08 14:29:47 -0700 | [diff] [blame] | 2 | |
Ricardo Quesada | 470ca571 | 2021-07-16 16:39:28 -0700 | [diff] [blame] | 3 | #include <commonlib/include/commonlib/console/post_codes.h> |
Hannah Williams | 4cff1d5 | 2016-06-08 14:29:47 -0700 | [diff] [blame] | 4 | |
Lijian Zhao | c5d734b | 2019-04-19 16:57:46 -0700 | [diff] [blame] | 5 | External(\_SB.MPTS, MethodObj) |
| 6 | External(\_SB.MWAK, MethodObj) |
Eric Lai | 086f0fa | 2019-12-13 12:31:46 +0800 | [diff] [blame] | 7 | External(\_SB.PCI0.EGPM, MethodObj) |
| 8 | External(\_SB.PCI0.RGPM, MethodObj) |
Michael Niewöhner | 9c2d813 | 2022-05-18 22:24:17 +0200 | [diff] [blame] | 9 | External(\_SB.PCI0.LPCB.EC0.PTS, MethodObj) |
| 10 | External(\_SB.PCI0.LPCB.EC0.WAK, MethodObj) |
Lijian Zhao | c5d734b | 2019-04-19 16:57:46 -0700 | [diff] [blame] | 11 | |
Angel Pons | f0ed846 | 2022-05-02 16:52:57 +0200 | [diff] [blame] | 12 | #include <arch/x86/acpi/post.asl> |
Hannah Williams | 4cff1d5 | 2016-06-08 14:29:47 -0700 | [diff] [blame] | 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 | { |
lilacious | 40cb3fe | 2023-06-21 23:24:14 +0200 | [diff] [blame^] | 21 | DBG0 = POSTCODE_OS_ENTER_PTS |
Duncan Laurie | 0dd9135 | 2018-11-05 16:27:33 -0700 | [diff] [blame] | 22 | |
Michael Niewöhner | 9c2d813 | 2022-05-18 22:24:17 +0200 | [diff] [blame] | 23 | If (CondRefOf (\_SB.PCI0.LPCB.EC0.PTS)) |
| 24 | { |
| 25 | \_SB.PCI0.LPCB.EC0.PTS (Arg0) |
| 26 | } |
Lijian Zhao | c5d734b | 2019-04-19 16:57:46 -0700 | [diff] [blame] | 27 | If (CondRefOf (\_SB.MPTS)) |
| 28 | { |
| 29 | \_SB.MPTS (Arg0) |
| 30 | } |
Eric Lai | 086f0fa | 2019-12-13 12:31:46 +0800 | [diff] [blame] | 31 | /* |
| 32 | * Save the current PM bits then |
Subrata Banik | 2ccc0a4 | 2021-03-25 20:01:47 +0530 | [diff] [blame] | 33 | * enable GPIO PM with MISCCFG_GPIO_PM_CONFIG_BITS |
Elyes HAOUAS | a895c32 | 2020-03-31 21:55:16 +0200 | [diff] [blame] | 34 | */ |
Eric Lai | 086f0fa | 2019-12-13 12:31:46 +0800 | [diff] [blame] | 35 | If (CondRefOf (\_SB.PCI0.EGPM)) |
| 36 | { |
| 37 | \_SB.PCI0.EGPM () |
| 38 | } |
Hannah Williams | 4cff1d5 | 2016-06-08 14:29:47 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | /* The _WAK method is called on system wakeup */ |
| 42 | |
| 43 | Method (_WAK, 1) |
| 44 | { |
lilacious | 40cb3fe | 2023-06-21 23:24:14 +0200 | [diff] [blame^] | 45 | DBG0 = POSTCODE_OS_ENTER_WAKE |
Duncan Laurie | 0dd9135 | 2018-11-05 16:27:33 -0700 | [diff] [blame] | 46 | |
Michael Niewöhner | 9c2d813 | 2022-05-18 22:24:17 +0200 | [diff] [blame] | 47 | If (CondRefOf (\_SB.PCI0.LPCB.EC0.WAK)) |
| 48 | { |
| 49 | \_SB.PCI0.LPCB.EC0.WAK (Arg0) |
| 50 | } |
Lijian Zhao | c5d734b | 2019-04-19 16:57:46 -0700 | [diff] [blame] | 51 | If (CondRefOf (\_SB.MWAK)) |
| 52 | { |
| 53 | \_SB.MWAK (Arg0) |
| 54 | } |
Eric Lai | 086f0fa | 2019-12-13 12:31:46 +0800 | [diff] [blame] | 55 | /* Restore GPIO all Community PM */ |
| 56 | If (CondRefOf (\_SB.PCI0.RGPM)) |
| 57 | { |
| 58 | \_SB.PCI0.RGPM () |
| 59 | } |
Lijian Zhao | c5d734b | 2019-04-19 16:57:46 -0700 | [diff] [blame] | 60 | |
Hannah Williams | 4cff1d5 | 2016-06-08 14:29:47 -0700 | [diff] [blame] | 61 | Return (Package(){0,0}) |
| 62 | } |