blob: f2764aaa08e2890aa8bf3c83876b8b2c3352dcb5 [file] [log] [blame]
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +03001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
5 * Copyright (C) 2013 Sage Electronic Engineering, LLC
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/* South Bridge */
22/* _SB.PCI0 */
23
24/* Operating System Capabilities Method */
25Method(_OSC,4)
26{
27 // Create DWord-addressable fields from the Capabilities Buffer
28 CreateDWordField(Arg3,0,CDW1)
29 CreateDWordField(Arg3,4,CDW2)
30 CreateDWordField(Arg3,8,CDW3)
31
32 /* Check for proper PCI/PCIe UUID */
33 If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766")))
34 {
35 /* Let OS control everything */
36 Return (Arg3)
37 } Else {
38 Or(CDW1,4,CDW1) // Unrecognized UUID
39 Return(Arg3)
40 }
41}
42
43/* Describe the Southbridge devices */
44
45/* 0:11.0 - SATA */
46Device(STCR) {
47 Name(_ADR, 0x00110000)
48 #include "acpi/sata.asl"
49} /* end STCR */
50
51/* 0:14.0 - SMBUS */
52Device(SBUS) {
53 Name(_ADR, 0x00140000)
54} /* end SBUS */
55
56#include "usb.asl"
57
58/* 0:14.2 - HD Audio */
59#include "audio.asl"
60
61/* 0:14.3 - LPC */
62#include "lpc.asl"
63
64/* 0:14.7 - SD Controller */
65Device(SDCN) {
66 Name(_ADR, 0x00140007)
67} /* end SDCN */
68
69Name(CRES, ResourceTemplate() {
70 /* Set the Bus number and Secondary Bus number for the PCI0 device
71 * The Secondary bus range for PCI0 lets the system
72 * know what bus values are allowed on the downstream
73 * side of this PCI bus if there is a PCI-PCI bridge.
74 * PCI busses can have 256 secondary busses which
75 * range from [0-0xFF] but they do not need to be
76 * sequential.
77 */
78 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
79 0x0000, /* address granularity */
80 0x0000, /* range minimum */
81 0x00FF, /* range maximum */
82 0x0000, /* translation */
83 0x0100, /* length */
84 ,, PSB0) /* ResourceSourceIndex, ResourceSource, DescriptorName */
85
86 IO(Decode16, 0x0CF8, 0x0CF8, 1, 8)
87
88 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
89 0x0000, /* address granularity */
90 0x0000, /* range minimum */
91 0x0CF7, /* range maximum */
92 0x0000, /* translation */
93 0x0CF8 /* length */
94 )
95 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
96 0x0000, /* address granularity */
97 0x03B0, /* range minimum */
98 0x03DF, /* range maximum */
99 0x0000, /* translation */
100 0x0030 /* length */
101 )
102
103 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
104 0x0000, /* address granularity */
105 0x0D00, /* range minimum */
106 0xFFFF, /* range maximum */
107 0x0000, /* translation */
108 0xF300 /* length */
109 )
110
111 Memory32Fixed(READONLY, 0x000A0000, 0x00020000, VGAM) /* VGA memory space */
112 Memory32Fixed(READONLY, 0x000C0000, 0x00020000, EMM1) /* Assume C0000-E0000 empty */
113
114 /* memory space for PCI BARs below 4GB */
115 Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, MMIO)
116}) /* End Name(_SB.PCI0.CRES) */
117
118Method(_CRS, 0) {
119 /* DBGO("\\_SB\\PCI0\\_CRS\n") */
120 CreateDWordField(CRES, ^MMIO._BAS, MM1B)
121 CreateDWordField(CRES, ^MMIO._LEN, MM1L)
122
123 /*
124 * Declare memory between TOM1 and 4GB as available
125 * for PCI MMIO.
126 * Use ShiftLeft to avoid 64bit constant (for XP).
127 * This will work even if the OS does 32bit arithmetic, as
128 * 32bit (0x00000000 - TOM1) will wrap and give the same
129 * result as 64bit (0x100000000 - TOM1).
130 */
131 Store(TOM1, MM1B)
132 ShiftLeft(0x10000000, 4, Local0)
133 Subtract(Local0, TOM1, Local0)
134 Store(Local0, MM1L)
135
136 Return(CRES) /* note to change the Name buffer */
137} /* end of Method(_SB.PCI0._CRS) */
138
139/*
140 *
141 * FIRST METHOD CALLED UPON BOOT
142 *
143 * 1. If debugging, print current OS and ACPI interpreter.
144 * 2. Get PCI Interrupt routing from ACPI VSM, this
145 * value is based on user choice in BIOS setup.
146 */
147Method(_INI, 0) {
148 /* DBGO("\\_SB\\_INI\n") */
149 /* DBGO(" DSDT.ASL code from ") */
150 /* DBGO(__DATE__) */
151 /* DBGO(" ") */
152 /* DBGO(__TIME__) */
153 /* DBGO("\n Sleep states supported: ") */
154 /* DBGO("\n") */
155 /* DBGO(" \\_OS=") */
156 /* DBGO(\_OS) */
157 /* DBGO("\n \\_REV=") */
158 /* DBGO(\_REV) */
159 /* DBGO("\n") */
160
161 /* Determine the OS we're running on */
162 OSFL()
163
164 /* TODO: It is unstable. */
165 //#include "acpi/AmdImc.asl" /* Hudson IMC function */
166 //ITZE() /* enable IMC Fan Control*/
167} /* End Method(_SB._INI) */
168
169Method(OSFL, 0){
170
171 if(LNotEqual(OSVR, Ones)) {Return(OSVR)} /* OS version was already detected */
172
173 if(CondRefOf(\_OSI,Local1))
174 {
175 Store(1, OSVR) /* Assume some form of XP */
176 if (\_OSI("Windows 2006")) /* Vista */
177 {
178 Store(2, OSVR)
179 }
180 } else {
181 If(WCMP(\_OS,"Linux")) {
182 Store(3, OSVR) /* Linux */
183 } Else {
184 Store(4, OSVR) /* Gotta be WinCE */
185 }
186 }
187 Return(OSVR)
188}