blob: 83e3410ccb23348bade525749b7c4db3b210948d [file] [log] [blame]
Steve Goodrichbf0988b2013-07-10 11:59:11 -06001/*
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.
Steve Goodrichbf0988b2013-07-10 11:59:11 -060015 */
16
Martin Rothec23f042017-11-22 19:21:55 -070017/* System Bus */
Steve Goodrichbf0988b2013-07-10 11:59:11 -060018/* _SB.PCI0 */
19
Mike Loptien9e8690b2013-07-18 10:30:47 -060020/* Operating System Capabilities Method */
21Method(_OSC,4)
22{
Mike Loptien9e8690b2013-07-18 10:30:47 -060023 /* Check for proper PCI/PCIe UUID */
24 If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766")))
25 {
26 /* Let OS control everything */
27 Return (Arg3)
28 } Else {
Marc Jones1faa11e2018-08-15 22:17:45 -060029 CreateDWordField(Arg3,0,CDW1)
Mike Loptien9e8690b2013-07-18 10:30:47 -060030 Or(CDW1,4,CDW1) // Unrecognized UUID
31 Return(Arg3)
32 }
33}
34
Steve Goodrichbf0988b2013-07-10 11:59:11 -060035/* Describe the Southbridge devices */
36
Mike Loptienac90d802013-07-17 15:14:59 -060037/* 0:11.0 - SATA */
38Device(STCR) {
39 Name(_ADR, 0x00110000)
40 #include "acpi/sata.asl"
41} /* end STCR */
42
43/* 0:14.0 - SMBUS */
44Device(SBUS) {
45 Name(_ADR, 0x00140000)
46} /* end SBUS */
47
48#include "usb.asl"
49
50/* 0:14.2 - HD Audio */
51#include "audio.asl"
52
53/* 0:14.3 - LPC */
54#include "lpc.asl"
55
56/* 0:14.7 - SD Controller */
57Device(SDCN) {
58 Name(_ADR, 0x00140007)
59} /* end SDCN */
60
Martin Roth083504b2017-06-24 21:30:14 -060061#if !IS_ENABLED(CONFIG_SOUTHBRIDGE_AMD_AGESA_YANGTZE)
Mike Loptienac90d802013-07-17 15:14:59 -060062
63/* 0:14.4 - PCI slot 1, 2, 3 */
Steve Goodrichbf0988b2013-07-10 11:59:11 -060064Device(PIBR) {
65 Name(_ADR, 0x00140004)
66 Name(_PRW, Package() {0x18, 4})
67
68 Method(_PRT, 0) {
69 Return (PCIB)
70 }
71}
72
Mike Loptienac90d802013-07-17 15:14:59 -060073/* 0:14.6 - GEC Controller */
Steve Goodrichbf0988b2013-07-10 11:59:11 -060074Device(ACMD) {
75 Name(_ADR, 0x00140006)
76} /* end Ac97modem */
Mike Loptienac90d802013-07-17 15:14:59 -060077#endif
Steve Goodrichbf0988b2013-07-10 11:59:11 -060078
79Name(CRES, ResourceTemplate() {
Mike Loptien6cf5c8e2013-07-18 10:16:31 -060080 /* Set the Bus number and Secondary Bus number for the PCI0 device
81 * The Secondary bus range for PCI0 lets the system
82 * know what bus values are allowed on the downstream
83 * side of this PCI bus if there is a PCI-PCI bridge.
84 * PCI busses can have 256 secondary busses which
85 * range from [0-0xFF] but they do not need to be
86 * sequential.
87 */
88 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
89 0x0000, /* address granularity */
90 0x0000, /* range minimum */
91 0x00FF, /* range maximum */
92 0x0000, /* translation */
93 0x0100, /* length */
94 ,, PSB0) /* ResourceSourceIndex, ResourceSource, DescriptorName */
95
Steve Goodrichbf0988b2013-07-10 11:59:11 -060096 IO(Decode16, 0x0CF8, 0x0CF8, 1, 8)
97
98 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
99 0x0000, /* address granularity */
100 0x0000, /* range minimum */
101 0x0CF7, /* range maximum */
102 0x0000, /* translation */
103 0x0CF8 /* length */
104 )
105 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
Mike Loptienac90d802013-07-17 15:14:59 -0600106 0x0000, /* address granularity */
107 0x03B0, /* range minimum */
108 0x03DF, /* range maximum */
109 0x0000, /* translation */
110 0x0030 /* length */
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600111 )
Mike Loptienac90d802013-07-17 15:14:59 -0600112
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600113 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
114 0x0000, /* address granularity */
115 0x0D00, /* range minimum */
116 0xFFFF, /* range maximum */
117 0x0000, /* translation */
118 0xF300 /* length */
119 )
120
121 Memory32Fixed(READONLY, 0x000A0000, 0x00020000, VGAM) /* VGA memory space */
122 Memory32Fixed(READONLY, 0x000C0000, 0x00020000, EMM1) /* Assume C0000-E0000 empty */
123
124 /* memory space for PCI BARs below 4GB */
125 Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, MMIO)
126}) /* End Name(_SB.PCI0.CRES) */
127
128Method(_CRS, 0) {
129 /* DBGO("\\_SB\\PCI0\\_CRS\n") */
130 CreateDWordField(CRES, ^MMIO._BAS, MM1B)
131 CreateDWordField(CRES, ^MMIO._LEN, MM1L)
132
133 /*
Mike Loptienac90d802013-07-17 15:14:59 -0600134 * Declare memory between TOM1 and 4GB as available
135 * for PCI MMIO.
136 * Use ShiftLeft to avoid 64bit constant (for XP).
137 * This will work even if the OS does 32bit arithmetic, as
138 * 32bit (0x00000000 - TOM1) will wrap and give the same
139 * result as 64bit (0x100000000 - TOM1).
140 */
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600141 Store(TOM1, MM1B)
142 ShiftLeft(0x10000000, 4, Local0)
143 Subtract(Local0, TOM1, Local0)
144 Store(Local0, MM1L)
145
146 Return(CRES) /* note to change the Name buffer */
147} /* end of Method(_SB.PCI0._CRS) */
148
Elyes HAOUAS99850602019-02-21 16:38:43 +0100149#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
150 #include "acpi/AmdImc.asl" /* Hudson IMC function */
151#endif
152
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600153/*
Mike Loptienac90d802013-07-17 15:14:59 -0600154 *
155 * FIRST METHOD CALLED UPON BOOT
156 *
157 * 1. If debugging, print current OS and ACPI interpreter.
158 * 2. Get PCI Interrupt routing from ACPI VSM, this
159 * value is based on user choice in BIOS setup.
160 */
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600161Method(_INI, 0) {
162 /* DBGO("\\_SB\\_INI\n") */
163 /* DBGO(" DSDT.ASL code from ") */
164 /* DBGO(__DATE__) */
165 /* DBGO(" ") */
166 /* DBGO(__TIME__) */
167 /* DBGO("\n Sleep states supported: ") */
168 /* DBGO("\n") */
169 /* DBGO(" \\_OS=") */
170 /* DBGO(\_OS) */
171 /* DBGO("\n \\_REV=") */
172 /* DBGO(\_REV) */
173 /* DBGO("\n") */
174
175 /* Determine the OS we're running on */
Edward O'Callaghanf7d8f092014-05-31 13:57:52 +1000176 OSFL()
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600177
Martin Roth083504b2017-06-24 21:30:14 -0600178#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
Kyösti Mälkki51769b22017-01-28 09:48:29 +0200179#if IS_ENABLED(CONFIG_ACPI_ENABLE_THERMAL_ZONE)
WANG Siyuanb640fd32014-10-22 13:47:18 +0800180 ITZE() /* enable IMC Fan Control*/
181#endif
Kyösti Mälkki51769b22017-01-28 09:48:29 +0200182#endif
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600183} /* End Method(_SB._INI) */
184
Edward O'Callaghanf7d8f092014-05-31 13:57:52 +1000185Method(OSFL, 0){
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600186
Elyes HAOUASba28e8d2016-08-31 19:22:16 +0200187 if (LNotEqual(OSVR, Ones)) {Return(OSVR)} /* OS version was already detected */
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600188
Elyes HAOUASba28e8d2016-08-31 19:22:16 +0200189 if (CondRefOf(\_OSI))
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600190 {
Edward O'Callaghanf7d8f092014-05-31 13:57:52 +1000191 Store(1, OSVR) /* Assume some form of XP */
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600192 if (\_OSI("Windows 2006")) /* Vista */
193 {
Edward O'Callaghanf7d8f092014-05-31 13:57:52 +1000194 Store(2, OSVR)
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600195 }
196 } else {
197 If(WCMP(\_OS,"Linux")) {
Edward O'Callaghanf7d8f092014-05-31 13:57:52 +1000198 Store(3, OSVR) /* Linux */
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600199 } Else {
Edward O'Callaghanf7d8f092014-05-31 13:57:52 +1000200 Store(4, OSVR) /* Gotta be WinCE */
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600201 }
202 }
Edward O'Callaghanf7d8f092014-05-31 13:57:52 +1000203 Return(OSVR)
Steve Goodrichbf0988b2013-07-10 11:59:11 -0600204}