tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / southbridge / amd / cimx / sb800 / acpi / fch.asl
blob5abfcfe075e022ed4fbc383904a2941a38875d39
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
16 /* South Bridge */
17 /*  _SB.PCI0 */
19 /* Operating System Capabilities Method */
20 Method(_OSC,4)
22         // Create DWord-addressable fields from the Capabilities Buffer
23         CreateDWordField(Arg3,0,CDW1)
24         CreateDWordField(Arg3,4,CDW2)
25         CreateDWordField(Arg3,8,CDW3)
27         /* Check for proper PCI/PCIe UUID */
28         If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766")))
29         {
30                 /* Let OS control everything */
31                 Return (Arg3)
32         } Else {
33                 Or(CDW1,4,CDW1) // Unrecognized UUID
34                 Return(Arg3)
35         }
38 Method(_BBN, 0) { /* Bus number = 0 */
39         Return(0)
41 Method(_STA, 0) {
42         /* DBGO("\\_SB\\PCI0\\_STA\n") */
43         Return(0x0B)     /* Status is visible */
46 Method(_PRT,0) {
47         If(PMOD){ Return(APR0) }   /* APIC mode */
48         Return (PR0)                  /* PIC Mode */
49 } /* end _PRT */
51 /* Describe the Southbridge devices */
53 #include "pcie.asl"
55 /* PCI slot 1, 2, 3 */
56 Device(PIBR) {
57         Name(_ADR, 0x00140004)
58         Name(_PRW, Package() {0x18, 4})
60         Method(_PRT, 0) {
61                 Return (PCIB)
62         }
65 Device(STCR) {
66         Name(_ADR, 0x00110000)
67         #include "acpi/sata.asl"
68 } /* end STCR */
70 #include "usb.asl"
72 Device(SBUS) {
73         Name(_ADR, 0x00140000)
74 } /* end SBUS */
76 #include "audio.asl"
78 #include "lpc.asl"
80 Device(HPBR) {
81         Name(_ADR, 0x00140004)
82 } /* end HostPciBr */
84 Device(ACAD) {
85         Name(_ADR, 0x00140005)
86 } /* end Ac97audio */
88 Device(ACMD) {
89         Name(_ADR, 0x00140006)
90 } /* end Ac97modem */
92 Name(CRES, ResourceTemplate() {
93         /* Set the Bus number and Secondary Bus number for the PCI0 device
94          * The Secondary bus range for PCI0 lets the system
95          * know what bus values are allowed on the downstream
96          * side of this PCI bus if there is a PCI-PCI bridge.
97          * PCI busses can have 256 secondary busses which
98          * range from [0-0xFF] but they do not need to be
99          * sequential.
100          */
101         WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
102                 0x0000,         /* address granularity */
103                 0x0000,         /* range minimum */
104                 0x00FF,         /* range maximum */
105                 0x0000,         /* translation */
106                 0x0100,         /* length */
107                 ,, PSB0)                /* ResourceSourceIndex, ResourceSource, DescriptorName */
109         IO(Decode16, 0x0CF8, 0x0CF8, 1, 8)
111         WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
112                 0x0000,         /* address granularity */
113                 0x0000,         /* range minimum */
114                 0x0CF7,         /* range maximum */
115                 0x0000,         /* translation */
116                 0x0CF8          /* length */
117         )
119         WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
120                 0x0000,         /* address granularity */
121                 0x0D00,         /* range minimum */
122                 0xFFFF,         /* range maximum */
123                 0x0000,         /* translation */
124                 0xF300          /* length */
125         )
127         Memory32Fixed(READONLY, 0x000A0000, 0x00020000, VGAM)   /* VGA memory space */
129         /* memory space for PCI BARs below 4GB */
130         Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, MMIO)
131 }) /* End Name(_SB.PCI0.CRES) */
133 Method(_CRS, 0) {
134         /* DBGO("\\_SB\\PCI0\\_CRS\n") */
135         CreateDWordField(CRES, ^MMIO._BAS, MM1B)
136         CreateDWordField(CRES, ^MMIO._LEN, MM1L)
138         /*
139         * Declare memory between TOM1 and 4GB as available
140         * for PCI MMIO.
141         * Use ShiftLeft to avoid 64bit constant (for XP).
142         * This will work even if the OS does 32bit arithmetic, as
143         * 32bit (0x00000000 - TOM1) will wrap and give the same
144         * result as 64bit (0x100000000 - TOM1).
145         */
146         Store(TOM1, MM1B)
147         ShiftLeft(0x10000000, 4, Local0)
148         Subtract(Local0, TOM1, Local0)
149         Store(Local0, MM1L)
151         Return(CRES) /* note to change the Name buffer */
152 } /* end of Method(_SB.PCI0._CRS) */
156 *               FIRST METHOD CALLED UPON BOOT
158 *  1. If debugging, print current OS and ACPI interpreter.
159 *  2. Get PCI Interrupt routing from ACPI VSM, this
160 *     value is based on user choice in BIOS setup.
162 Method(_INI, 0) {
163         /* DBGO("\\_SB\\_INI\n") */
164         /* DBGO("   DSDT.ASL code from ") */
165         /* DBGO(__DATE__) */
166         /* DBGO(" ") */
167         /* DBGO(__TIME__) */
168         /* DBGO("\n   Sleep states supported: ") */
169         /* DBGO("\n") */
170         /* DBGO("   \\_OS=") */
171         /* DBGO(\_OS) */
172         /* DBGO("\n   \\_REV=") */
173         /* DBGO(\_REV) */
174         /* DBGO("\n") */
176         /* Determine the OS we're running on */
177         OSFL()
179         /* On older chips, clear PciExpWakeDisEn */
180         /*if (LLessEqual(\SBRI, 0x13)) {
181         *       Store(0,\PWDE)
182         * }
183         */
184 } /* End Method(_SB._INI) */
186 Scope(\){
187         /* Client Management index/data registers */
188         OperationRegion(CMT, SystemIO, 0x00000C50, 0x00000002)
189                 Field(CMT, ByteAcc, NoLock, Preserve) {
190                 CMTI,      8,
191                 /* Client Management Data register */
192                 G64E,   1,
193                 G64O,      1,
194                 G32O,      2,
195                 ,       2,
196                 GPSL,     2,
197         }
199         /* GPM Port register */
200         OperationRegion(GPT, SystemIO, 0x00000C52, 0x00000001)
201                 Field(GPT, ByteAcc, NoLock, Preserve) {
202                 GPB0,1,
203                 GPB1,1,
204                 GPB2,1,
205                 GPB3,1,
206                 GPB4,1,
207                 GPB5,1,
208                 GPB6,1,
209                 GPB7,1,
210         }
212         /* Flash ROM program enable register */
213         OperationRegion(FRE, SystemIO, 0x00000C6F, 0x00000001)
214                 Field(FRE, ByteAcc, NoLock, Preserve) {
215                 ,     0x00000006,
216                 FLRE, 0x00000001,
217         }
219         /* PM2 index/data registers */
220         OperationRegion(PM2R, SystemIO, 0x00000CD0, 0x00000002)
221                 Field(PM2R, ByteAcc, NoLock, Preserve) {
222                 PM2I, 0x00000008,
223                 PM2D, 0x00000008,
224         }
226         /* Power Management I/O registers, TODO:PMIO is quite different in SB800. */
227         OperationRegion(PIOR, SystemIO, 0x00000CD6, 0x00000002)
228                 Field(PIOR, ByteAcc, NoLock, Preserve) {
229                 PIOI, 0x00000008,
230                 PIOD, 0x00000008,
231         }
232         IndexField (PIOI, PIOD, ByteAcc, NoLock, Preserve) {
233                 Offset(0x00),   /* MiscControl */
234                 , 1,
235                 T1EE, 1,
236                 T2EE, 1,
237                 Offset(0x01),   /* MiscStatus */
238                 , 1,
239                 T1E, 1,
240                 T2E, 1,
241                 Offset(0x04),   /* SmiWakeUpEventEnable3 */
242                 , 7,
243                 SSEN, 1,
244                 Offset(0x07),   /* SmiWakeUpEventStatus3 */
245                 , 7,
246                 CSSM, 1,
247                 Offset(0x10),   /* AcpiEnable */
248                 , 6,
249                 PWDE, 1,
250                 Offset(0x1C),   /* ProgramIoEnable */
251                 , 3,
252                 MKME, 1,
253                 IO3E, 1,
254                 IO2E, 1,
255                 IO1E, 1,
256                 IO0E, 1,
257                 Offset(0x1D),   /* IOMonitorStatus */
258                 , 3,
259                 MKMS, 1,
260                 IO3S, 1,
261                 IO2S, 1,
262                 IO1S, 1,
263                 IO0S,1,
264                 Offset(0x20),   /* AcpiPmEvtBlk. TODO: should be 0x60 */
265                 APEB, 16,
266                 Offset(0x36),   /* GEvtLevelConfig */
267                 , 6,
268                 ELC6, 1,
269                 ELC7, 1,
270                 Offset(0x37),   /* GPMLevelConfig0 */
271                 , 3,
272                 PLC0, 1,
273                 PLC1, 1,
274                 PLC2, 1,
275                 PLC3, 1,
276                 PLC8, 1,
277                 Offset(0x38),   /* GPMLevelConfig1 */
278                 , 1,
279                  PLC4, 1,
280                  PLC5, 1,
281                 , 1,
282                  PLC6, 1,
283                  PLC7, 1,
284                 Offset(0x3B),   /* PMEStatus1 */
285                 GP0S, 1,
286                 GM4S, 1,
287                 GM5S, 1,
288                 APS, 1,
289                 GM6S, 1,
290                 GM7S, 1,
291                 GP2S, 1,
292                 STSS, 1,
293                 Offset(0x55),   /* SoftPciRst */
294                 SPRE, 1,
295                 , 1,
296                 , 1,
297                 PNAT, 1,
298                 PWMK, 1,
299                 PWNS, 1,
301                 /*      Offset(0x61), */        /*  Options_1 */
302                 /*              ,7,  */
303                 /*              R617,1, */
305                 Offset(0x65),   /* UsbPMControl */
306                 , 4,
307                 URRE, 1,
308                 Offset(0x68),   /* MiscEnable68 */
309                 , 3,
310                 TMTE, 1,
311                 , 1,
312                 Offset(0x92),   /* GEVENTIN */
313                 , 7,
314                 E7IS, 1,
315                 Offset(0x96),   /* GPM98IN */
316                 G8IS, 1,
317                 G9IS, 1,
318                 Offset(0x9A),   /* EnhanceControl */
319                 ,7,
320                 HPDE, 1,
321                 Offset(0xA8),   /* PIO7654Enable */
322                 IO4E, 1,
323                 IO5E, 1,
324                 IO6E, 1,
325                 IO7E, 1,
326                 Offset(0xA9),   /* PIO7654Status */
327                 IO4S, 1,
328                 IO5S, 1,
329                 IO6S, 1,
330                 IO7S, 1,
331         }
333         /* PM1 Event Block
334         * First word is PM1_Status, Second word is PM1_Enable
335         */
336         OperationRegion(P1EB, SystemIO, APEB, 0x04)
337                 Field(P1EB, ByteAcc, NoLock, Preserve) {
338                 TMST, 1,
339                 ,    3,
340                 BMST,    1,
341                 GBST,   1,
342                 Offset(0x01),
343                 PBST, 1,
344                 , 1,
345                 RTST, 1,
346                 , 3,
347                 PWST, 1,
348                 SPWS, 1,
349                 Offset(0x02),
350                 TMEN, 1,
351                 , 4,
352                 GBEN, 1,
353                 Offset(0x03),
354                 PBEN, 1,
355                 , 1,
356                 RTEN, 1,
357                 , 3,
358                 PWDA, 1,
359         }
362 Scope(\_SB) {
363         Device(PWRB) {  /* Start Power button device */
364                 Name(_HID, EISAID("PNP0C0C"))
365                 Name(_UID, 0xAA)
366                 Name(_PRW, Package () {3, 0x04})        /* wake from S1-S4 */
367                 Name(_STA, 0x0B)        /* sata is invisible */
368         }
369 } /* End Scope(_SB)  */