mb/starlabs/starbook/{adl_n,mtl}: Don't configure GPE routes
[coreboot.git] / src / ec / starlabs / merlin / acpi / ec.asl
blob8fa16c5d051bf63d47a373cef56c3d488e631b6d
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 Scope (\_SB.PCI0.LPCB)
5         #include "cmos.asl"
7         Device (EC)
8         {
9                 Name (_HID, EisaId ("PNP0C09"))
10                 Name (_UID, 0x01)
11                 Name (_GPE, CONFIG_EC_GPE_SCI)
12                 Name (ECAV, 0x00)
13                 Name (ECTK, 0x01)
14                 Name (B2ST, 0x00)
15                 Name (CFAN, 0x00)
16                 Name (CMDR, 0x00)
17                 Name (DOCK, 0x00)
18                 Name (PLMX, 0x00)
19                 Name (PECH, 0x00)
20                 Name (PECL, 0x00)
21                 Name (PENV, 0x00)
22                 Name (PINV, 0x00)
23                 Name (PPSH, 0x00)
24                 Name (PPSL, 0x00)
25                 Name (PSTP, 0x00)
26                 Name (RPWR, 0x00)
27                 Name (VPWR, 0x00)
28                 Name (WTMS, 0x00)
29                 Name (AWT2, 0x00)
30                 Name (AWT1, 0x00)
31                 Name (AWT0, 0x00)
32                 Name (DLED, 0x00)
33                 Name (SPT2, 0x00)
34                 Name (PB10, 0x00)
35                 Name (IWCW, 0x00)
36                 Name (IWCR, 0x00)
37                 Name (PVOL, 0x00)
38                 Mutex (ECMT, 0x00)
40                 Name (BFFR, ResourceTemplate()
41                 {
42                         IO(Decode16, 0x0062, 0x0062, 0x00, 0x01)
43                         IO(Decode16, 0x0066, 0x0066, 0x00, 0x01)
44                 })
46                 Method (_CRS, 0, Serialized)
47                 {
48                         Return (BFFR)
49                 }
51                 Method (_STA, 0, NotSerialized)
52                 {
53                         \LIDS = 0x03
54                         Return (0x0F)
55                 }
57                 OperationRegion (SIPR, SystemIO, 0xB2, 0x1)
58                 Field (SIPR, ByteAcc, Lock, Preserve) {
59                         SMB2, 8
60                 }
62                 #include "emem.asl"
64                 // ECRD (Embedded Controller Read Method)
65                 //
66                 // Handle all commands sent to EC by BIOS
67                 //
68                 // Arguments:
69                 // Arg0 = Object to Read
70                 //
71                 // Return Value:
72                 // Read Value
73                 //
74                 Method (ECRD, 1, Serialized, 0, IntObj, FieldUnitObj)
75                 {
76                         //
77                         // Check for ECDT support, set ECAV to 1 if ECDT is supported by OS
78                         // Only check once at beginning since ECAV might be clear later in certain conditions
79                         //
80                         If (ECTK) {
81                                 If (_REV >= 0x02) {
82                                         ECAV = 0x01
83                                 }
84                                 ECTK = 0x00                                     // Clear flag for checking once only
85                         }
87                         Local0 = Acquire (ECMT, 1000)                           // Save Acquired Result
88                         If (Local0 == 0x00)                                     // Check for Mutex Acquisition
89                         {
90                                 If (ECAV) {
91                                         Local1 = DerefOf (Arg0)                 // Execute Read from EC
92                                         Release (ECMT)
93                                         Return (Local1)
94                                 } Else {
95                                         Release (ECMT)
96                                 }
97                         }
98                         Return (0)                                              // Return in case Arg0 doesn't exist
99                 }
101                 // ECWR (Embedded Controller Write Method)
102                 //
103                 // Handle all commands sent to EC by BIOS
104                 //
105                 // Arguments:
106                 // Arg0 = Value to Write
107                 // Arg1 = Object to Write to
108                 //
109                 // Return Value:
110                 // None
111                 //
112                 Method (ECWR, 2, Serialized,,,{IntObj, FieldUnitObj})
113                 {
114                         Local0 = Acquire (ECMT, 1000)                           // Save Acquired Result
115                         If (Local0 == 0x00)                                     // Check for Mutex Acquisition
116                         {
117                                 If (ECAV) {
118                                         Arg1 = Arg0                             // Execute Write to EC
119                                         Local1 = 0x00
120                                         While (1) {
121                                                 If (Arg0 == DerefOf (Arg1)) {
122                                                         Break
123                                                 }
124                                                 Sleep (1)
125                                                 Arg1 = Arg0
126                                                 Local1 += 1
127                                                 If (Local1 == 0x03) {
128                                                         Break
129                                                 }
130                                         }
131                                 }
132                                 Release (ECMT)
133                         }
134                 }
136                 #include "ac.asl"
137 #if CONFIG(SYSTEM_TYPE_LAPTOP) || CONFIG(SYSTEM_TYPE_DETACHABLE)
138                 #include "battery.asl"
139 #endif
140 #if !CONFIG(EC_STARLABS_MERLIN)
141                 #include "events.asl"
142 #endif
143                 #include "lid.asl"
144                 #include "dock.asl"
146                 Method (_REG, 2, NotSerialized)
147                 {
148                         If ((Arg0 == 0x03) && (Arg1 == 0x01))
149                         {
150                                 // Load EC Driver
151                                 ECAV = 0x01
153                                 // Initialise the Lid State
154                                 \LIDS = ECRD(RefOf(LSTE))
156                                 // Initialise the OS State
157                                 ECWR(0x01, RefOf(OSFG))
159                                 // Initialise the Power State
160                                 PWRS = (ECRD (RefOf(ECPS)) & 0x01)
162                                 // Inform the platform code
163                                 PNOT()
164                         }
165                 }
166         }