blob: a973149e6d227803c9d1b71c06359ee52aafbe8e [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
3#include <include/console/post_codes.h>
4
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)
Lijian Zhaoc5d734b2019-04-19 16:57:46 -07009
Hannah Williams4cff1d52016-06-08 14:29:47 -070010/* Port 80 POST */
11
12OperationRegion (POST, SystemIO, CONFIG_POST_IO_PORT, 1)
13Field (POST, ByteAcc, Lock, Preserve)
14{
15 DBG0, 8
16}
17
18/*
19 * The _PTS method (Prepare To Sleep) is called before the OS is
20 * entering a sleep state. The sleep state number is passed in Arg0
21 */
22
23Method (_PTS, 1)
24{
Alexey Buyanov03248032020-06-01 21:41:14 -070025 DBG0 = POST_OS_ENTER_PTS
Duncan Laurie0dd91352018-11-05 16:27:33 -070026
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
33 * enable GPIO PM with MISCCFG_ENABLE_GPIO_PM_CONFIG
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{
Alexey Buyanov03248032020-06-01 21:41:14 -070045 DBG0 = POST_OS_ENTER_WAKE
Duncan Laurie0dd91352018-11-05 16:27:33 -070046
Lijian Zhaoc5d734b2019-04-19 16:57:46 -070047 If (CondRefOf (\_SB.MWAK))
48 {
49 \_SB.MWAK (Arg0)
50 }
Eric Lai086f0fa2019-12-13 12:31:46 +080051 /* Restore GPIO all Community PM */
52 If (CondRefOf (\_SB.PCI0.RGPM))
53 {
54 \_SB.PCI0.RGPM ()
55 }
Lijian Zhaoc5d734b2019-04-19 16:57:46 -070056
Hannah Williams4cff1d52016-06-08 14:29:47 -070057 Return (Package(){0,0})
58}