xref: /aosp_15_r20/external/coreboot/src/superio/smsc/sio1007/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 (_ADR, 0x2E)
7	OperationRegion (SIOA, SystemIO, 0x2E, 0x02)
8	Field (SIOA, ByteAcc, NoLock, Preserve)
9	{
10		SI2E, 8,
11		SI2F, 8,
12	}
13
14	IndexField (SI2E, SI2F, ByteAcc, NoLock, Preserve)
15	{
16		Offset (0x02),
17		SCNT, 8,	/* Configure Control */
18		Offset (0x07),
19		SLDN, 8,	/* Logical Device Number */
20		Offset (0x30),
21		SACT, 8,	/* Activate */
22		Offset (0x60),
23		IO0H, 8,	/* Base Address 0 MSB */
24		IO0L, 8,	/* Base Address 0 LSB */
25		Offset (0x62),
26		IO1H, 8,	/* Base Address 1 MSB */
27		IO1L, 8,	/* Base Address 1 LSB */
28		Offset (0x70),
29		IQ00, 8,	/* Interrupt Select */
30	}
31
32	Name (SFDC, 0)		/* Floppy Disk Controller */
33	Name (SSP1, 1)		/* Serial Port 1 */
34	Name (SENV, 4)		/* Environment Controller */
35	Name (SKBC, 5)		/* Keyboard */
36	Name (SKBM, 6)		/* Mouse */
37	Name (SGPI, 7)		/* GPIO */
38	Name (SINF, 10)		/* Consumer IR */
39
40	Method (ENTR, 0, NotSerialized)
41	{
42		SI2E = 0x87
43		SI2E = 0x01
44		SI2E = 0x55
45		SI2E = 0x55
46	}
47
48	Method (EXIT, 0, NotSerialized)
49	{
50		SCNT = 0x02
51	}
52
53	/* Parse activate register for an LDN */
54	Method (ISEN, 1, NotSerialized)
55	{
56		ENTR ()
57		SLDN = Arg0
58		Local0 = SACT
59		EXIT ()
60
61		/* Check if it exists */
62		If (Local0 == 0xFF)
63		{
64			Return (0x00)
65		}
66
67		/* Check if activated */
68		If (Local0 == 1)
69		{
70			Return (0x0F)
71		}
72		Else
73		{
74			Return (0x0D)
75		}
76	}
77
78	/* Enable an LDN via the activate register */
79	Method (SENA, 1, NotSerialized)
80	{
81		ENTR ()
82		SLDN = Arg0
83		SACT = 1
84		EXIT ()
85	}
86
87	/* Disable an LDN via the activate register */
88	Method (SDIS, 1, NotSerialized)
89	{
90		ENTR ()
91		SLDN = Arg0
92		SACT = 0
93		EXIT ()
94	}
95
96#ifdef SIO_ENABLE_ENVC
97	Device (ENVC) {
98		Name (_HID, EISAID ("PNP0C02"))
99		Name (_UID, 10)
100
101		Method (_STA, 0, NotSerialized) {
102			Return (ISEN (SENV))
103		}
104
105		Name (_CRS, ResourceTemplate ()
106		{
107			IO (Decode16, SIO_ENVC_IO0, SIO_ENVC_IO0, 0x08, 0x08)
108			IO (Decode16, SIO_ENVC_IO1, SIO_ENVC_IO1, 0x04, 0x04)
109		})
110
111		OperationRegion (ECAP, SystemIO, SIO_ENVC_IO0, 0x07)
112		Field (ECAP, ByteAcc, NoLock, Preserve)
113		{
114			Offset (0x05),
115			ECAI, 8,  // Address Index Register
116			ECAD, 8,  // Address Data Register
117		}
118
119		// Registers for thermal zone implementations
120		IndexField (ECAI, ECAD, ByteAcc, NoLock, Preserve)
121		{
122			Offset (0x29),
123			TIN1, 8,  // TMPIN1 Reading
124			TIN2, 8,  // TMPIN2 Reading
125			TIN3, 8,  // TMPIN3 Reading
126			Offset (0x6b),
127			F2PS, 8,  // FAN2 PWM Setting
128			Offset (0x73),
129			F3PS, 8,  // FAN3 PWM Setting
130		}
131	}
132#endif
133
134#ifdef SIO_ENABLE_GPIO
135	Device (GPIO) {
136		Name (_HID, EISAID ("PNP0C02"))
137		Name (_UID, 11)
138
139		Method (_STA, 0, NotSerialized) {
140			Return (0x0F)
141		}
142
143		Name (_CRS, ResourceTemplate ()
144		{
145			IO (Decode16, SIO_GPIO_IO0, SIO_GPIO_IO0, 0x01, 0x01)
146			IO (Decode16, SIO_GPIO_IO1, SIO_GPIO_IO1, 0x08, 0x08)
147		})
148	}
149#endif
150
151#ifdef SIO_ENABLE_COM1
152	Device (COM1) {
153		Name (_HID, EISAID ("PNP0501"))
154		Name (_UID, 1)
155
156		Method (_STA, 0, NotSerialized) {
157			Return (ISEN (SSP1))
158		}
159
160		Name (_CRS, ResourceTemplate ()
161		{
162			IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08)
163			IRQNoFlags () {4}
164		})
165	}
166#endif
167
168#ifdef SIO_ENABLE_PS2K
169	Device (PS2K)		// Keyboard
170	{
171		Name (_HID, EISAID("PNP0303"))
172		Name (_CID, EISAID("PNP030B"))
173
174		Method (_STA, 0, NotSerialized) {
175			Return (ISEN (SKBC))
176		}
177
178		Name (_CRS, ResourceTemplate()
179		{
180			IO (Decode16, 0x60, 0x60, 0x01, 0x01)
181			IO (Decode16, 0x64, 0x64, 0x01, 0x01)
182			IRQNoFlags () {1}
183		})
184	}
185#endif
186
187#ifdef SIO_ENABLE_PS2M
188	Device (PS2M)		// Mouse
189	{
190		Name (_HID, EISAID("PNP0F13"))
191
192		Method (_STA, 0, NotSerialized) {
193			Return (ISEN (SKBM))
194		}
195
196		Name (_CRS, ResourceTemplate()
197		{
198			IRQNoFlags () {12}
199		})
200	}
201#endif
202
203#ifdef SIO_ENABLE_FDC0
204	Device (FDC0)		// Floppy controller
205	{
206		Name (_HID, EISAID ("PNP0700"))
207
208		Method (_STA, 0, NotSerialized) {
209			Return (ISEN (SFDC))
210		}
211
212		Name (_CRS, ResourceTemplate()
213		{
214			IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
215			IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
216			IRQNoFlags () {6}
217			DMA (Compatibility, NotBusMaster, Transfer8) {2}
218		})
219	}
220#endif
221
222#ifdef SIO_ENABLE_INFR
223	Device (INFR)		// Infrared controller
224	{
225		Name (_HID, EISAID ("PNP0510"))
226
227		Method (_STA, 0, NotSerialized) {
228			Return (ISEN (SINF))
229		}
230
231		Name (_CRS, ResourceTemplate()
232		{
233			IO (Decode16, SIO_INFR_IO0, SIO_INFR_IO0, 0x08, 0x08)
234			IRQNoFlags () { SIO_INFR_IRQ }
235		})
236	}
237#endif
238}
239