blob: 4f2c074bd69fa425065e1d18029964c666207e2f [file] [log] [blame]
Kerry She7b7b2c92011-09-08 21:16:19 +08001/*
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.
Kerry She7b7b2c92011-09-08 21:16:19 +080014 */
15
16static void setup_mb_resource_map(void)
17{
18 static const unsigned int register_values[] = {
19 /* Careful set limit registers before base registers which contain the enables */
20 /* DRAM Limit i Registers
21 * F1:0x44 i = 0
22 * F1:0x4C i = 1
23 * F1:0x54 i = 2
24 * F1:0x5C i = 3
25 * F1:0x64 i = 4
26 * F1:0x6C i = 5
27 * F1:0x74 i = 6
28 * F1:0x7C i = 7
29 * [ 2: 0] Destination Node ID
30 * 000 = Node 0
31 * 001 = Node 1
32 * 010 = Node 2
33 * 011 = Node 3
34 * 100 = Node 4
35 * 101 = Node 5
36 * 110 = Node 6
37 * 111 = Node 7
38 * [ 7: 3] Reserved
39 * [10: 8] Interleave select
40 * specifies the values of A[14:12] to use with interleave enable.
41 * [15:11] Reserved
42 * [31:16] DRAM Limit Address i Bits 39-24
43 * This field defines the upper address bits of a 40 bit address
44 * that define the end of the DRAM region.
45 */
Elyes HAOUAS023e2842016-10-07 18:07:21 +020046 /* Don't touch it, we need it for CONFIG_CAR_FAM10 */
Kerry She7b7b2c92011-09-08 21:16:19 +080047 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x4C), 0x0000f8f8, 0x00000001,
48 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x54), 0x0000f8f8, 0x00000002,
49 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x5C), 0x0000f8f8, 0x00000003,
50 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x64), 0x0000f8f8, 0x00000004,
51 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x6C), 0x0000f8f8, 0x00000005,
52 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x74), 0x0000f8f8, 0x00000006,
53 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x7C), 0x0000f8f8, 0x00000007,
54 /* DRAM Base i Registers
55 * F1:0x40 i = 0
56 * F1:0x48 i = 1
57 * F1:0x50 i = 2
58 * F1:0x58 i = 3
59 * F1:0x60 i = 4
60 * F1:0x68 i = 5
61 * F1:0x70 i = 6
62 * F1:0x78 i = 7
63 * [ 0: 0] Read Enable
64 * 0 = Reads Disabled
65 * 1 = Reads Enabled
66 * [ 1: 1] Write Enable
67 * 0 = Writes Disabled
68 * 1 = Writes Enabled
69 * [ 7: 2] Reserved
70 * [10: 8] Interleave Enable
71 * 000 = No interleave
72 * 001 = Interleave on A[12] (2 nodes)
73 * 010 = reserved
74 * 011 = Interleave on A[12] and A[14] (4 nodes)
75 * 100 = reserved
76 * 101 = reserved
77 * 110 = reserved
78 * 111 = Interleve on A[12] and A[13] and A[14] (8 nodes)
79 * [15:11] Reserved
80 * [13:16] DRAM Base Address i Bits 39-24
81 * This field defines the upper address bits of a 40-bit address
82 * that define the start of the DRAM region.
83 */
Elyes HAOUAS023e2842016-10-07 18:07:21 +020084 /* don't touch it, we need it for CONFIG_CAR_FAM10 */
Kerry She7b7b2c92011-09-08 21:16:19 +080085 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x48), 0x0000f8fc, 0x00000000,
86 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x50), 0x0000f8fc, 0x00000000,
87 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x58), 0x0000f8fc, 0x00000000,
88 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x60), 0x0000f8fc, 0x00000000,
89 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x68), 0x0000f8fc, 0x00000000,
90 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x70), 0x0000f8fc, 0x00000000,
91 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x78), 0x0000f8fc, 0x00000000,
92
93 /* Memory-Mapped I/O Limit i Registers
94 * F1:0x84 i = 0
95 * F1:0x8C i = 1
96 * F1:0x94 i = 2
97 * F1:0x9C i = 3
98 * F1:0xA4 i = 4
99 * F1:0xAC i = 5
100 * F1:0xB4 i = 6
101 * F1:0xBC i = 7
102 * [ 2: 0] Destination Node ID
103 * 000 = Node 0
104 * 001 = Node 1
105 * 010 = Node 2
106 * 011 = Node 3
107 * 100 = Node 4
108 * 101 = Node 5
109 * 110 = Node 6
110 * 111 = Node 7
111 * [ 3: 3] Reserved
112 * [ 5: 4] Destination Link ID
113 * 00 = Link 0
114 * 01 = Link 1
115 * 10 = Link 2
116 * 11 = Reserved
117 * [ 6: 6] Reserved
118 * [ 7: 7] Non-Posted
119 * 0 = CPU writes may be posted
120 * 1 = CPU writes must be non-posted
121 * [31: 8] Memory-Mapped I/O Limit Address i (39-16)
122 * This field defines the upp adddress bits of a 40-bit address that
123 * defines the end of a memory-mapped I/O region n
124 */
125 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x84), 0x00000048, 0x00000000,
126 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x8C), 0x00000048, 0x00000000,
127 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x94), 0x00000048, 0x00000000,
128 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x9C), 0x00000048, 0x00000000,
129 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xA4), 0x00000048, 0x00000000,
130 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xAC), 0x00000048, 0x00000000,
131 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xB4), 0x00000048, 0x00000000,
Kerry She7b7b2c92011-09-08 21:16:19 +0800132
133 /* Memory-Mapped I/O Base i Registers
134 * F1:0x80 i = 0
135 * F1:0x88 i = 1
136 * F1:0x90 i = 2
137 * F1:0x98 i = 3
138 * F1:0xA0 i = 4
139 * F1:0xA8 i = 5
140 * F1:0xB0 i = 6
141 * F1:0xB8 i = 7
142 * [ 0: 0] Read Enable
143 * 0 = Reads disabled
144 * 1 = Reads Enabled
145 * [ 1: 1] Write Enable
146 * 0 = Writes disabled
147 * 1 = Writes Enabled
148 * [ 2: 2] Cpu Disable
149 * 0 = Cpu can use this I/O range
150 * 1 = Cpu requests do not use this I/O range
151 * [ 3: 3] Lock
152 * 0 = base/limit registers i are read/write
153 * 1 = base/limit registers i are read-only
154 * [ 7: 4] Reserved
155 * [31: 8] Memory-Mapped I/O Base Address i (39-16)
156 * This field defines the upper address bits of a 40bit address
157 * that defines the start of memory-mapped I/O region i
158 */
159 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x80), 0x000000f0, 0x00000000,
160 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x88), 0x000000f0, 0x00000000,
161 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x90), 0x000000f0, 0x00000000,
162 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0x98), 0x000000f0, 0x00000000,
163 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xA0), 0x000000f0, 0x00000000,
164 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xA8), 0x000000f0, 0x00000000,
165 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xB0), 0x000000f0, 0x00000000,
Kerry She7b7b2c92011-09-08 21:16:19 +0800166
167 /* PCI I/O Limit i Registers
168 * F1:0xC4 i = 0
169 * F1:0xCC i = 1
170 * F1:0xD4 i = 2
171 * F1:0xDC i = 3
172 * [ 2: 0] Destination Node ID
173 * 000 = Node 0
174 * 001 = Node 1
175 * 010 = Node 2
176 * 011 = Node 3
177 * 100 = Node 4
178 * 101 = Node 5
179 * 110 = Node 6
180 * 111 = Node 7
181 * [ 3: 3] Reserved
182 * [ 5: 4] Destination Link ID
183 * 00 = Link 0
184 * 01 = Link 1
185 * 10 = Link 2
186 * 11 = reserved
187 * [11: 6] Reserved
188 * [24:12] PCI I/O Limit Address i
189 * This field defines the end of PCI I/O region n
190 * [31:25] Reserved
191 */
Kerry She7b7b2c92011-09-08 21:16:19 +0800192 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xCC), 0xFE000FC8, 0x00000000,
193 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xD4), 0xFE000FC8, 0x00000000,
194 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xDC), 0xFE000FC8, 0x00000000,
195
196 /* PCI I/O Base i Registers
197 * F1:0xC0 i = 0
198 * F1:0xC8 i = 1
199 * F1:0xD0 i = 2
200 * F1:0xD8 i = 3
201 * [ 0: 0] Read Enable
202 * 0 = Reads Disabled
203 * 1 = Reads Enabled
204 * [ 1: 1] Write Enable
205 * 0 = Writes Disabled
206 * 1 = Writes Enabled
207 * [ 3: 2] Reserved
208 * [ 4: 4] VGA Enable
209 * 0 = VGA matches Disabled
210 * 1 = matches all address < 64K and where A[9:0] is in the
211 * range 3B0-3BB or 3C0-3DF independen of the base & limit registers
212 * [ 5: 5] ISA Enable
213 * 0 = ISA matches Disabled
214 * 1 = Blocks address < 64K and in the last 768 bytes of eack 1K block
215 * from matching agains this base/limit pair
216 * [11: 6] Reserved
217 * [24:12] PCI I/O Base i
218 * This field defines the start of PCI I/O region n
219 * [31:25] Reserved
220 */
Kerry She7b7b2c92011-09-08 21:16:19 +0800221 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xC8), 0xFE000FCC, 0x00000000,
222 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xD0), 0xFE000FCC, 0x00000000,
223 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xD8), 0xFE000FCC, 0x00000000,
224
225 /* Config Base and Limit i Registers
226 * F1:0xE0 i = 0
227 * F1:0xE4 i = 1
228 * F1:0xE8 i = 2
229 * F1:0xEC i = 3
230 * [ 0: 0] Read Enable
231 * 0 = Reads Disabled
232 * 1 = Reads Enabled
233 * [ 1: 1] Write Enable
234 * 0 = Writes Disabled
235 * 1 = Writes Enabled
236 * [ 2: 2] Device Number Compare Enable
237 * 0 = The ranges are based on bus number
238 * 1 = The ranges are ranges of devices on bus 0
239 * [ 3: 3] Reserved
240 * [ 6: 4] Destination Node
241 * 000 = Node 0
242 * 001 = Node 1
243 * 010 = Node 2
244 * 011 = Node 3
245 * 100 = Node 4
246 * 101 = Node 5
247 * 110 = Node 6
248 * 111 = Node 7
249 * [ 7: 7] Reserved
250 * [ 9: 8] Destination Link
251 * 00 = Link 0
252 * 01 = Link 1
253 * 10 = Link 2
254 * 11 - Reserved
255 * [15:10] Reserved
256 * [23:16] Bus Number Base i
257 * This field defines the lowest bus number in configuration region i
258 * [31:24] Bus Number Limit i
259 * This field defines the highest bus number in configuration regin i
260 */
Elyes HAOUAS023e2842016-10-07 18:07:21 +0200261 /* AMD 8111 on link0 of CPU 0 */
Kerry She7b7b2c92011-09-08 21:16:19 +0800262 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xE4), 0x0000FC88, 0x00000000,
263 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xE8), 0x0000FC88, 0x00000000,
264 PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, 0xEC), 0x0000FC88, 0x00000000,
265 };
266
267 int max;
268 max = ARRAY_SIZE(register_values);
269 setup_resource_map(register_values, max);
270}