1/*
2 * Copyright (C) 2007-2009 coresystems GmbH
3 * Copyright (C) 2013 Google Inc.
4 * Copyright (C) 2016 Bin Meng <bmeng.cn@gmail.com>
5 *
6 * Modified from coreboot src/soc/intel/baytrail/acpi/lpc.asl
7 *
8 * SPDX-License-Identifier:	GPL-2.0+
9 */
10
11/* Intel LPC Bus Device - 0:1f.0 */
12
13Scope (\)
14{
15	/* Intel Legacy Block */
16	OperationRegion(ILBS, SystemMemory, ILB_BASE_ADDRESS, ILB_BASE_SIZE)
17	Field(ILBS, AnyAcc, NoLock, Preserve) {
18		Offset (0x8),
19		PRTA, 8,
20		PRTB, 8,
21		PRTC, 8,
22		PRTD, 8,
23		PRTE, 8,
24		PRTF, 8,
25		PRTG, 8,
26		PRTH, 8,
27		Offset (0x88),
28		    , 3,
29		UI3E, 1,
30		UI4E, 1
31	}
32}
33
34Device (LPCB)
35{
36	Name(_ADR, 0x001f0000)
37
38	OperationRegion(LPC0, PCI_Config, 0x00, 0x100)
39	Field(LPC0, AnyAcc, NoLock, Preserve) {
40		Offset(0x08),
41		SRID, 8,
42		Offset(0x80),
43		C1EN, 1,
44		Offset(0x84)
45	}
46
47	#include <asm/acpi/irqlinks.asl>
48
49	/* Firmware Hub */
50	Device (FWH)
51	{
52		Name(_HID, EISAID("INT0800"))
53		Name(_CRS, ResourceTemplate()
54		{
55			Memory32Fixed(ReadOnly, 0xff000000, 0x01000000)
56		})
57	}
58
59	/* 8259 Interrupt Controller */
60	Device (PIC)
61	{
62		Name(_HID, EISAID("PNP0000"))
63		Name(_CRS, ResourceTemplate()
64		{
65			IO(Decode16, 0x20, 0x20, 0x01, 0x02)
66			IO(Decode16, 0x24, 0x24, 0x01, 0x02)
67			IO(Decode16, 0x28, 0x28, 0x01, 0x02)
68			IO(Decode16, 0x2c, 0x2c, 0x01, 0x02)
69			IO(Decode16, 0x30, 0x30, 0x01, 0x02)
70			IO(Decode16, 0x34, 0x34, 0x01, 0x02)
71			IO(Decode16, 0x38, 0x38, 0x01, 0x02)
72			IO(Decode16, 0x3c, 0x3c, 0x01, 0x02)
73			IO(Decode16, 0xa0, 0xa0, 0x01, 0x02)
74			IO(Decode16, 0xa4, 0xa4, 0x01, 0x02)
75			IO(Decode16, 0xa8, 0xa8, 0x01, 0x02)
76			IO(Decode16, 0xac, 0xac, 0x01, 0x02)
77			IO(Decode16, 0xb0, 0xb0, 0x01, 0x02)
78			IO(Decode16, 0xb4, 0xb4, 0x01, 0x02)
79			IO(Decode16, 0xb8, 0xb8, 0x01, 0x02)
80			IO(Decode16, 0xbc, 0xbc, 0x01, 0x02)
81			IO(Decode16, 0x4d0, 0x4d0, 0x01, 0x02)
82			IRQNoFlags () { 2 }
83		})
84	}
85
86	/* 8254 timer */
87	Device (TIMR)
88	{
89		Name(_HID, EISAID("PNP0100"))
90		Name(_CRS, ResourceTemplate()
91		{
92			IO(Decode16, 0x40, 0x40, 0x01, 0x04)
93			IO(Decode16, 0x50, 0x50, 0x10, 0x04)
94			IRQNoFlags() { 0 }
95		})
96	}
97
98	/* HPET */
99	Device (HPET)
100	{
101		Name(_HID, EISAID("PNP0103"))
102		Name(_CID, 0x010CD041)
103		Name(_CRS, ResourceTemplate()
104		{
105			Memory32Fixed(ReadOnly, HPET_BASE_ADDRESS, HPET_BASE_SIZE)
106		})
107
108		Method(_STA)
109		{
110			Return (STA_VISIBLE)
111		}
112	}
113
114	/* Internal UART */
115	Device (IURT)
116	{
117		Name(_HID, EISAID("PNP0501"))
118		Name(_UID, 1)
119
120		Method(_STA, 0, Serialized)
121		{
122			If (LEqual(IURE, 1)) {
123				Store(1, UI3E)
124				Store(1, UI4E)
125				Store(1, C1EN)
126				Return (STA_VISIBLE)
127			} Else {
128				Return (STA_MISSING)
129			}
130
131		}
132
133		Method(_DIS, 0, Serialized)
134		{
135			Store(0, UI3E)
136			Store(0, UI4E)
137			Store(0, C1EN)
138		}
139
140		Method(_CRS, 0, Serialized)
141		{
142			Name(BUF0, ResourceTemplate()
143			{
144				IO(Decode16, 0x03f8, 0x03f8, 0x01, 0x08)
145				IRQNoFlags() { 3 }
146			})
147
148			Name(BUF1, ResourceTemplate()
149			{
150				IO(Decode16, 0x03f8, 0x03f8, 0x01, 0x08)
151				IRQNoFlags() { 4 }
152			})
153
154			If (LLessEqual(SRID, 0x04)) {
155				Return (BUF0)
156			} Else {
157				Return (BUF1)
158			}
159		}
160	}
161
162	/* Real Time Clock */
163	Device (RTC)
164	{
165		Name(_HID, EISAID("PNP0B00"))
166		Name(_CRS, ResourceTemplate()
167		{
168			IO(Decode16, 0x70, 0x70, 1, 8)
169			/*
170			 * Disable as Windows doesn't like it, and systems
171			 * don't seem to use it
172			 */
173			/* IRQNoFlags() { 8 } */
174		})
175	}
176
177	/* LPC device: Resource consumption */
178	Device (LDRC)
179	{
180		Name(_HID, EISAID("PNP0C02"))
181		Name(_UID, 2)
182
183		Name(RBUF, ResourceTemplate()
184		{
185			IO(Decode16, 0x61, 0x61, 0x1, 0x01) /* NMI Status */
186			IO(Decode16, 0x63, 0x63, 0x1, 0x01) /* CPU Reserved */
187			IO(Decode16, 0x65, 0x65, 0x1, 0x01) /* CPU Reserved */
188			IO(Decode16, 0x67, 0x67, 0x1, 0x01) /* CPU Reserved */
189			IO(Decode16, 0x80, 0x80, 0x1, 0x01) /* Port 80 Post */
190			IO(Decode16, 0x92, 0x92, 0x1, 0x01) /* CPU Reserved */
191			IO(Decode16, 0xb2, 0xb2, 0x1, 0x02) /* SWSMI */
192		})
193
194		Method(_CRS, 0, NotSerialized)
195		{
196			Return (RBUF)
197		}
198	}
199}
200