xref: /aosp_15_r20/external/coreboot/src/superio/smsc/mec1308/acpi/superio.asl (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1/* SPDX-License-Identifier: GPL-2.0-only */
2
3// Scope is \_SB.PCI0.LPCB
4
5Device (SIO) {
6	Name (_HID, EisaId ("PNP0A05"))
7
8	OperationRegion (SIOA, SystemIO, 0x2E, 0x02)
9	Field (SIOA, ByteAcc, NoLock, Preserve)
10	{
11		SI2E, 8,
12		SI2F, 8,
13	}
14
15	IndexField (SI2E, SI2F, ByteAcc, NoLock, Preserve)
16	{
17		Offset (0x07),
18		SLDN, 8,	/* Logical Device Number */
19		Offset (0x30),
20		SACT, 8,	/* Activate */
21		Offset (0x60),
22		IO0H, 8,	/* Base Address 0 MSB */
23		IO0L, 8,	/* Base Address 0 LSB */
24		Offset (0x62),
25		IO1H, 8,	/* Base Address 1 MSB */
26		IO1L, 8,	/* Base Address 1 LSB */
27		Offset (0x70),
28		IQ00, 8,	/* Interrupt Select */
29	}
30
31	Name (LPM1, 1)		/* ACPI PM1 */
32	Name (LEC1, 2)		/* EC 1 */
33	Name (LEC2, 3)		/* EC 2 */
34	Name (LSP1, 4)		/* Serial Port */
35	Name (LKBC, 7)		/* Keyboard */
36	Name (LEC0, 8)		/* EC 0 */
37	Name (LMBX, 9)		/* Mailbox */
38
39	Method (ENTR, 0, NotSerialized)
40	{
41		SI2E = 0x55
42	}
43
44	Method (EXIT, 0, NotSerialized)
45	{
46		SI2E = 0xaa
47	}
48
49	/* Parse activate register for an LDN */
50	Method (ISEN, 1, NotSerialized)
51	{
52		ENTR ()
53		SLDN = Arg0
54		Local0 = SACT
55		EXIT ()
56
57		/* Check if it exists */
58		If (Local0 == 0xFF)
59		{
60			Return (0x00)
61		}
62
63		/* Check if activated */
64		If (Local0 == 1)
65		{
66			Return (0x0F)
67		}
68		Else
69		{
70			Return (0x0D)
71		}
72	}
73
74	/* Enable an LDN via the activate register */
75	Method (SENA, 1, NotSerialized)
76	{
77		ENTR ()
78		SLDN = Arg0
79		SACT = 1
80		EXIT ()
81	}
82
83	/* Disable an LDN via the activate register */
84	Method (SDIS, 1, NotSerialized)
85	{
86		ENTR ()
87		SLDN = Arg0
88		SACT = 0
89		EXIT ()
90	}
91
92#ifdef SIO_ENABLE_SPM1
93	Device (SPM1) {
94		Name (_HID, EISAID ("PNP0C02"))
95		Name (_UID, 1)
96
97		Method (_STA, 0, NotSerialized) {
98			Return (ISEN (LPM1))
99		}
100
101		Name (_CRS, ResourceTemplate ()
102		{
103			IO (Decode16, SIO_SPM1_IO0, SIO_SPM1_IO0, 0x08, 0x08)
104		})
105	}
106#endif
107
108#ifdef SIO_ENABLE_SEC1
109	Device (SEC1) {
110		Name (_HID, EISAID ("PNP0C09"))
111		Name (_UID, 2)
112
113		Method (_STA, 0, NotSerialized) {
114			Return (ISEN (LEC1))
115		}
116
117		Name (_CRS, ResourceTemplate ()
118		{
119			IO (Decode16, SIO_SEC1_IO0, SIO_SEC1_IO0, 0x04, 0x04)
120		})
121	}
122#endif
123
124#ifdef SIO_ENABLE_SEC2
125	Device (SEC2) {
126		Name (_HID, EISAID ("PNP0C09"))
127		Name (_UID, 3)
128
129		Method (_STA, 0, NotSerialized) {
130			Return (ISEN (LEC2))
131		}
132
133		Name (_CRS, ResourceTemplate ()
134		{
135			IO (Decode16, SIO_SEC2_IO0, SIO_SEC2_IO0, 0x04, 0x04)
136		})
137	}
138#endif
139
140#ifdef SIO_ENABLE_SSP1
141	Device (SSP1) {
142		Name (_HID, EISAID ("PNP0501"))
143		Name (_UID, 4)
144
145		Method (_STA, 0, NotSerialized) {
146			Return (ISEN (LSP1))
147		}
148
149		Name (_CRS, ResourceTemplate ()
150		{
151			IO (Decode16, SIO_SSP1_IO0, SIO_SSP1_IO0, 0x08, 0x08)
152			IRQNoFlags () {SIO_SSP1_IRQ}
153		})
154	}
155#endif
156
157#ifdef SIO_ENABLE_SKBC
158	Device (SKBC)		// Keyboard
159	{
160		Name (_HID, EISAID("PNP0303"))
161		Name (_CID, EISAID("PNP030B"))
162
163		Method (_STA, 0, NotSerialized) {
164			Return (ISEN (LKBC))
165		}
166
167		Name (_CRS, ResourceTemplate()
168		{
169			IO (Decode16, 0x60, 0x60, 0x01, 0x01)
170			IO (Decode16, 0x64, 0x64, 0x01, 0x01)
171			IRQNoFlags () {1}
172		})
173	}
174#endif
175
176#ifdef SIO_ENABLE_SEC0
177	Device (SEC0) {
178		Name (_HID, EISAID ("PNP0C09"))
179		Name (_UID, 8)
180
181		Method (_STA, 0, NotSerialized) {
182			Return (ISEN (LEC0))
183		}
184
185		Name (_CRS, ResourceTemplate ()
186		{
187			IO (Decode16, SIO_SEC0_IO0, SIO_SEC0_IO0, 0x04, 0x04)
188		})
189	}
190#endif
191
192#ifdef SIO_ENABLE_SMBX
193	Device (SMBX)		// Mailbox
194	{
195		Name (_HID, EISAID("PNP0C02"))
196		Name (_UID, 9)
197
198		Method (_STA, 0, NotSerialized) {
199			Return (ISEN (LMBX))
200		}
201
202		Name (_CRS, ResourceTemplate()
203		{
204			IO (Decode16, SIO_SMBX_IO0, SIO_SMBX_IO0, 0x01, 0x34)
205		})
206	}
207#endif
208}
209