1 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
4 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
6 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/arch/i386/include/stdint.h" 1
7 # 11 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/arch/i386/include/stdint.h"
8 typedef unsigned char uint8_t;
9 typedef signed char int8_t;
11 typedef unsigned short uint16_t;
12 typedef signed short int16_t;
14 typedef unsigned int uint32_t;
15 typedef signed int int32_t;
23 typedef unsigned char uint_least8_t;
24 typedef signed char int_least8_t;
26 typedef unsigned short uint_least16_t;
27 typedef signed short int_least16_t;
29 typedef unsigned int uint_least32_t;
30 typedef signed int int_least32_t;
38 typedef unsigned char uint_fast8_t;
39 typedef signed char int_fast8_t;
41 typedef unsigned int uint_fast16_t;
42 typedef signed int int_fast16_t;
44 typedef unsigned int uint_fast32_t;
45 typedef signed int int_fast32_t;
54 typedef unsigned int uintptr_t;
61 typedef long int intmax_t;
62 typedef unsigned long int uintmax_t;
63 # 3 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2
64 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/include/device/pci_def.h" 1
65 # 4 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2
66 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/arch/i386/include/arch/romcc_io.h" 1
67 static void outb(unsigned char value, unsigned short port)
69 __builtin_outb(value, port);
72 static void outw(unsigned short value, unsigned short port)
74 __builtin_outw(value, port);
77 static void outl(unsigned int value, unsigned short port)
79 __builtin_outl(value, port);
83 static unsigned char inb(unsigned short port)
85 return __builtin_inb(port);
89 static unsigned char inw(unsigned short port)
91 return __builtin_inw(port);
94 static unsigned char inl(unsigned short port)
96 return __builtin_inl(port);
104 typedef __builtin_msr_t msr_t;
106 static msr_t rdmsr(unsigned long index)
108 return __builtin_rdmsr(index);
111 static void wrmsr(unsigned long index, msr_t msr)
113 __builtin_wrmsr(index, msr.lo, msr.hi);
122 static unsigned char pci_read_config8(unsigned addr)
124 outl(0x80000000 | (addr & ~3), 0xCF8);
125 return inb(0xCFC + (addr & 3));
128 static unsigned short pci_read_config16(unsigned addr)
130 outl(0x80000000 | (addr & ~3), 0xCF8);
131 return inw(0xCFC + (addr & 2));
134 static unsigned int pci_read_config32(unsigned addr)
136 outl(0x80000000 | (addr & ~3), 0xCF8);
140 static void pci_write_config8(unsigned addr, unsigned char value)
142 outl(0x80000000 | (addr & ~3), 0xCF8);
143 outb(value, 0xCFC + (addr & 3));
146 static void pci_write_config16(unsigned addr, unsigned short value)
148 outl(0x80000000 | (addr & ~3), 0xCF8);
149 outw(value, 0xCFC + (addr & 2));
152 static void pci_write_config32(unsigned addr, unsigned int value)
154 outl(0x80000000 | (addr & ~3), 0xCF8);
157 # 5 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2
158 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/pc80/serial.c" 1
159 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/include/part/fallback_boot.h" 1
160 # 2 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/pc80/serial.c" 2
161 # 44 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/pc80/serial.c"
162 static int uart_can_tx_byte(void)
164 return inb(0x3f8 + 0x05) & 0x20;
167 static void uart_wait_to_tx_byte(void)
169 while(!uart_can_tx_byte())
173 static void uart_wait_until_sent(void)
175 while(!(inb(0x3f8 + 0x05) & 0x40))
179 static void uart_tx_byte(unsigned char data)
181 uart_wait_to_tx_byte();
182 outb(data, 0x3f8 + 0x00);
184 uart_wait_until_sent();
187 static void uart_init(void)
190 outb(0x0, 0x3f8 + 0x01);
192 outb(0x01, 0x3f8 + 0x02);
194 outb(0x80 | 0x3, 0x3f8 + 0x03);
195 # 89 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/pc80/serial.c"
196 outb((115200/9600) & 0xFF, 0x3f8 + 0x00);
197 outb(((115200/9600) >> 8) & 0xFF, 0x3f8 + 0x01);
199 outb(0x3, 0x3f8 + 0x03);
201 # 6 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2
202 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/arch/i386/lib/console.c" 1
203 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/include/console/loglevel.h" 1
204 # 2 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/arch/i386/lib/console.c" 2
206 static void __console_tx_byte(unsigned char byte)
211 static void __console_tx_nibble(unsigned nibble)
214 digit = nibble + '0';
218 __console_tx_byte(digit);
221 static void __console_tx_char(int loglevel, unsigned char byte)
228 static void __console_tx_hex8(int loglevel, unsigned char value)
231 __console_tx_nibble((value >> 4U) & 0x0fU);
232 __console_tx_nibble(value & 0x0fU);
236 static void __console_tx_hex16(int loglevel, unsigned short value)
239 __console_tx_nibble((value >> 12U) & 0x0fU);
240 __console_tx_nibble((value >> 8U) & 0x0fU);
241 __console_tx_nibble((value >> 4U) & 0x0fU);
242 __console_tx_nibble(value & 0x0fU);
246 static void __console_tx_hex32(int loglevel, unsigned int value)
249 __console_tx_nibble((value >> 28U) & 0x0fU);
250 __console_tx_nibble((value >> 24U) & 0x0fU);
251 __console_tx_nibble((value >> 20U) & 0x0fU);
252 __console_tx_nibble((value >> 16U) & 0x0fU);
253 __console_tx_nibble((value >> 12U) & 0x0fU);
254 __console_tx_nibble((value >> 8U) & 0x0fU);
255 __console_tx_nibble((value >> 4U) & 0x0fU);
256 __console_tx_nibble(value & 0x0fU);
260 static void __console_tx_string(int loglevel, const char *str)
264 while((ch = *str++) != '\0') {
265 __console_tx_byte(ch);
270 static void print_emerg_char(unsigned char byte) { __console_tx_char(0, byte); }
271 static void print_emerg_hex8(unsigned char value){ __console_tx_hex8(0, value); }
272 static void print_emerg_hex16(unsigned short value){ __console_tx_hex16(0, value); }
273 static void print_emerg_hex32(unsigned int value) { __console_tx_hex32(0, value); }
274 static void print_emerg(const char *str) { __console_tx_string(0, str); }
276 static void print_alert_char(unsigned char byte) { __console_tx_char(1, byte); }
277 static void print_alert_hex8(unsigned char value) { __console_tx_hex8(1, value); }
278 static void print_alert_hex16(unsigned short value){ __console_tx_hex16(1, value); }
279 static void print_alert_hex32(unsigned int value) { __console_tx_hex32(1, value); }
280 static void print_alert(const char *str) { __console_tx_string(1, str); }
282 static void print_crit_char(unsigned char byte) { __console_tx_char(2, byte); }
283 static void print_crit_hex8(unsigned char value) { __console_tx_hex8(2, value); }
284 static void print_crit_hex16(unsigned short value){ __console_tx_hex16(2, value); }
285 static void print_crit_hex32(unsigned int value) { __console_tx_hex32(2, value); }
286 static void print_crit(const char *str) { __console_tx_string(2, str); }
288 static void print_err_char(unsigned char byte) { __console_tx_char(3, byte); }
289 static void print_err_hex8(unsigned char value) { __console_tx_hex8(3, value); }
290 static void print_err_hex16(unsigned short value){ __console_tx_hex16(3, value); }
291 static void print_err_hex32(unsigned int value) { __console_tx_hex32(3, value); }
292 static void print_err(const char *str) { __console_tx_string(3, str); }
294 static void print_warning_char(unsigned char byte) { __console_tx_char(4, byte); }
295 static void print_warning_hex8(unsigned char value) { __console_tx_hex8(4, value); }
296 static void print_warning_hex16(unsigned short value){ __console_tx_hex16(4, value); }
297 static void print_warning_hex32(unsigned int value) { __console_tx_hex32(4, value); }
298 static void print_warning(const char *str) { __console_tx_string(4, str); }
300 static void print_notice_char(unsigned char byte) { __console_tx_char(5, byte); }
301 static void print_notice_hex8(unsigned char value) { __console_tx_hex8(5, value); }
302 static void print_notice_hex16(unsigned short value){ __console_tx_hex16(5, value); }
303 static void print_notice_hex32(unsigned int value) { __console_tx_hex32(5, value); }
304 static void print_notice(const char *str) { __console_tx_string(5, str); }
306 static void print_info_char(unsigned char byte) { __console_tx_char(6, byte); }
307 static void print_info_hex8(unsigned char value) { __console_tx_hex8(6, value); }
308 static void print_info_hex16(unsigned short value){ __console_tx_hex16(6, value); }
309 static void print_info_hex32(unsigned int value) { __console_tx_hex32(6, value); }
310 static void print_info(const char *str) { __console_tx_string(6, str); }
312 static void print_debug_char(unsigned char byte) { __console_tx_char(7, byte); }
313 static void print_debug_hex8(unsigned char value) { __console_tx_hex8(7, value); }
314 static void print_debug_hex16(unsigned short value){ __console_tx_hex16(7, value); }
315 static void print_debug_hex32(unsigned int value) { __console_tx_hex32(7, value); }
316 static void print_debug(const char *str) { __console_tx_string(7, str); }
318 static void print_spew_char(unsigned char byte) { __console_tx_char(8, byte); }
319 static void print_spew_hex8(unsigned char value) { __console_tx_hex8(8, value); }
320 static void print_spew_hex16(unsigned short value){ __console_tx_hex16(8, value); }
321 static void print_spew_hex32(unsigned int value) { __console_tx_hex32(8, value); }
322 static void print_spew(const char *str) { __console_tx_string(8, str); }
323 # 128 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/arch/i386/lib/console.c"
324 static void console_init(void)
326 static const char console_test[] =
331 "Mon Jun 9 18:15:20 MDT 2003"
333 print_info(console_test);
335 # 7 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2
336 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/ram/ramtest.c" 1
337 static void write_phys(unsigned long addr, unsigned long value)
339 volatile unsigned long *ptr;
344 static unsigned long read_phys(unsigned long addr)
346 volatile unsigned long *ptr;
351 void ram_fill(unsigned long start, unsigned long stop)
357 print_debug("DRAM fill: ");
358 print_debug_hex32(start);
360 print_debug_hex32(stop);
362 for(addr = start; addr < stop ; addr += 4) {
364 if ((addr & 0xffff) == 0) {
365 print_debug_hex32(addr);
368 write_phys(addr, addr);
371 print_debug_hex32(addr);
372 print_debug("\r\nDRAM filled\r\n");
375 void ram_verify(unsigned long start, unsigned long stop)
381 print_debug("DRAM verify: ");
382 print_debug_hex32(start);
383 print_debug_char('-');
384 print_debug_hex32(stop);
386 for(addr = start; addr < stop ; addr += 4) {
389 if ((addr & 0xffff) == 0) {
390 print_debug_hex32(addr);
393 value = read_phys(addr);
396 print_err_hex32(addr);
398 print_err_hex32(value);
403 print_debug_hex32(addr);
404 print_debug("\r\nDRAM verified\r\n");
408 void ramcheck(unsigned long start, unsigned long stop)
416 print_debug("Testing DRAM : ");
417 print_debug_hex32(start);
419 print_debug_hex32(stop);
421 ram_fill(start, stop);
422 ram_verify(start, stop);
423 print_debug("Done.\n");
425 # 8 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2
427 static void die(const char *str)
438 static void sdram_set_registers(void)
440 static const unsigned int register_values[] = {
441 # 51 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
442 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x44) & 0xFF)), 0x0000f8f8, 0x003f0000,
447 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x4C) & 0xFF)), 0x0000f8f8, 0x00000001,
448 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x54) & 0xFF)), 0x0000f8f8, 0x00000002,
449 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x5C) & 0xFF)), 0x0000f8f8, 0x00000003,
450 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x64) & 0xFF)), 0x0000f8f8, 0x00000004,
451 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x6C) & 0xFF)), 0x0000f8f8, 0x00000005,
452 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x74) & 0xFF)), 0x0000f8f8, 0x00000006,
453 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x7C) & 0xFF)), 0x0000f8f8, 0x00000007,
454 # 93 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
455 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x40) & 0xFF)), 0x0000f8fc, 0x00000003,
457 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x48) & 0xFF)), 0x0000f8fc, 0x00400000,
458 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x50) & 0xFF)), 0x0000f8fc, 0x00400000,
459 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x58) & 0xFF)), 0x0000f8fc, 0x00400000,
460 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x60) & 0xFF)), 0x0000f8fc, 0x00400000,
461 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x68) & 0xFF)), 0x0000f8fc, 0x00400000,
462 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x70) & 0xFF)), 0x0000f8fc, 0x00400000,
463 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x78) & 0xFF)), 0x0000f8fc, 0x00400000,
464 # 145 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
465 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x84) & 0xFF)), 0x00000048, 0x00e1ff00,
466 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x8C) & 0xFF)), 0x00000048, 0x00dfff00,
467 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x94) & 0xFF)), 0x00000048, 0x00e3ff00,
468 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x9C) & 0xFF)), 0x00000048, 0x00000000,
469 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA4) & 0xFF)), 0x00000048, 0x00000000,
470 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xAC) & 0xFF)), 0x00000048, 0x00000000,
471 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB4) & 0xFF)), 0x00000048, 0x00000b00,
472 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xBC) & 0xFF)), 0x00000048, 0x00fe0b00,
473 # 180 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
474 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x80) & 0xFF)), 0x000000f0, 0x00e00003,
475 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x88) & 0xFF)), 0x000000f0, 0x00d80003,
476 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x90) & 0xFF)), 0x000000f0, 0x00e20003,
477 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x98) & 0xFF)), 0x000000f0, 0x00000000,
478 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA0) & 0xFF)), 0x000000f0, 0x00000000,
479 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA8) & 0xFF)), 0x000000f0, 0x00000000,
480 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB0) & 0xFF)), 0x000000f0, 0x00000a03,
482 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB8) & 0xFF)), 0x000000f0, 0x00400003,
483 # 219 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
484 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC4) & 0xFF)), 0xFE000FC8, 0x0000d000,
485 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xCC) & 0xFF)), 0xFE000FC8, 0x000ff000,
486 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD4) & 0xFF)), 0xFE000FC8, 0x00000000,
487 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xDC) & 0xFF)), 0xFE000FC8, 0x00000000,
488 # 249 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
489 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC0) & 0xFF)), 0xFE000FCC, 0x0000d003,
490 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC8) & 0xFF)), 0xFE000FCC, 0x00001013,
491 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD0) & 0xFF)), 0xFE000FCC, 0x00000000,
492 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD8) & 0xFF)), 0xFE000FCC, 0x00000000,
493 # 290 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
494 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE0) & 0xFF)), 0x0000FC88, 0xff000003,
495 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE4) & 0xFF)), 0x0000FC88, 0x00000000,
496 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE8) & 0xFF)), 0x0000FC88, 0x00000000,
497 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xEC) & 0xFF)), 0x0000FC88, 0x00000000,
498 # 316 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
499 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x40) & 0xFF)), 0x001f01fe, 0x00000001,
501 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x44) & 0xFF)), 0x001f01fe, 0x01000001,
502 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x48) & 0xFF)), 0x001f01fe, 0x02000001,
503 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x4C) & 0xFF)), 0x001f01fe, 0x03000001,
510 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x50) & 0xFF)), 0x001f01fe, 0x00000000,
511 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x54) & 0xFF)), 0x001f01fe, 0x00000000,
512 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x58) & 0xFF)), 0x001f01fe, 0x00000000,
513 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x5C) & 0xFF)), 0x001f01fe, 0x00000000,
514 # 351 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
515 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x60) & 0xFF)), 0xC01f01ff, 0x00e0fe00,
516 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x64) & 0xFF)), 0xC01f01ff, 0x00e0fe00,
517 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x68) & 0xFF)), 0xC01f01ff, 0x00e0fe00,
518 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x6C) & 0xFF)), 0xC01f01ff, 0x00e0fe00,
526 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x70) & 0xFF)), 0xC01f01ff, 0x00000000,
527 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x74) & 0xFF)), 0xC01f01ff, 0x00000000,
528 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x78) & 0xFF)), 0xC01f01ff, 0x00000000,
529 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x7C) & 0xFF)), 0xC01f01ff, 0x00000000,
530 # 387 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
531 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x80) & 0xFF)), 0xffff8888, 0x00000033,
532 # 456 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
533 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x88) & 0xFF)), 0xe8088008, 0x03623125,
534 # 487 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
535 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x8c) & 0xFF)), 0xff8fe08e, 0x00000930,
536 # 563 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
537 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)), 0xf0000000,
539 (0 << 23)|(0 << 22)|(0 << 21)|(0 << 20)|
540 (1 << 19)|(1 << 18)|(0 << 17)|(0 << 16)|
541 (2 << 14)|(0 << 13)|(0 << 12)|
542 (0 << 11)|(0 << 10)|(0 << 9)|(0 << 8)|
543 (0 << 3) |(0 << 1) |(0 << 0),
544 # 635 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
545 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x94) & 0xFF)), 0xc180f0f0, 0x0e2b0a05,
546 # 655 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
547 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x98) & 0xFF)), 0xfc00ffff, 0x00000000,
548 # 689 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
549 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((3) & 0x07) << 8) | ((0x58) & 0xFF)), 0xffe0e0e0, 0x00000000,
550 # 698 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
551 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((3) & 0x07) << 8) | ((0x5C) & 0xFF)), 0x0000003e, 0x00000000,
557 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((3) & 0x07) << 8) | ((0x60) & 0xFF)), 0xffffff00, 0x00000000,
561 print_debug("setting up CPU0 northbridge registers\r\n");
562 max = sizeof(register_values)/sizeof(register_values[0]);
563 for(i = 0; i < max; i += 3) {
571 reg = pci_read_config32(register_values[i]);
572 reg &= register_values[i+1];
573 reg |= register_values[i+2];
574 pci_write_config32(register_values[i], reg);
576 print_debug("done.\r\n");
578 # 743 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
579 static void sdram_set_spd_registers(void)
582 dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)));
585 pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)), dcl);
589 static void sdram_enable(void)
594 dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)));
595 print_debug("dcl: ");
596 print_debug_hex32(dcl);
599 pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)), dcl);
605 pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)), dcl);
607 print_debug("Initializing memory: ");
610 dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)));
612 if ((loops & 1023) == 0) {
615 } while(((dcl & (1<<8)) != 0) && (loops < 300000));
616 if (loops >= 300000) {
617 print_debug(" failed\r\n");
619 print_debug(" done\r\n");
621 # 803 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
624 static void sdram_first_normal_reference(void) {}
625 static void sdram_enable_refresh(void) {}
626 static void sdram_special_finishup(void) {}
628 # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/sdram/generic_sdram.c" 1
629 void sdram_no_memory(void)
631 print_err("No memory!!\r\n");
638 void sdram_initialize(void)
640 print_debug("Ram1\r\n");
642 sdram_set_registers();
644 print_debug("Ram2\r\n");
646 sdram_set_spd_registers();
648 print_debug("Ram3\r\n");
655 print_debug("Ram4\r\n");
656 sdram_first_normal_reference();
658 print_debug("Ram5\r\n");
659 sdram_enable_refresh();
660 sdram_special_finishup();
662 print_debug("Ram6\r\n");
664 # 810 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2
666 static int boot_cpu(void)
668 volatile unsigned long *local_apic;
669 unsigned long apic_id;
673 bsp = !!(msr.lo & (1 << 8));
675 print_debug("Bootstrap cpu\r\n");
681 static int cpu_init_detected(void)
688 htic = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x6c) & 0xFF)));
689 # 849 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
690 cpu_init = (htic & (1<<6));
692 print_debug("CPU INIT Detected.\r\n");
697 static void setup_coherent_ht_domain(void)
699 static const unsigned int register_values[] = {
700 # 884 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
701 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x40) & 0xFF)), 0xfff0f0f0, 0x00010101,
702 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x44) & 0xFF)), 0xfff0f0f0, 0x00010101,
703 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x48) & 0xFF)), 0xfff0f0f0, 0x00010101,
704 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x4c) & 0xFF)), 0xfff0f0f0, 0x00010101,
705 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x50) & 0xFF)), 0xfff0f0f0, 0x00010101,
706 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x54) & 0xFF)), 0xfff0f0f0, 0x00010101,
707 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x58) & 0xFF)), 0xfff0f0f0, 0x00010101,
708 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x5c) & 0xFF)), 0xfff0f0f0, 0x00010101,
709 # 983 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
710 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x68) & 0xFF)), 0x00800000, 0x0f00840f,
711 # 1005 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
712 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x6C) & 0xFF)), 0xffffff8c, 0x00000000 | (1 << 6) |(1 << 5)| (1 << 4),
713 # 1082 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
714 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x84) & 0xFF)), 0x00009c05, 0x11110020,
715 # 1127 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
716 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x88) & 0xFF)), 0xfffff0ff, 0x00000200,
717 # 1148 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
718 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x94) & 0xFF)), 0xff000000, 0x00ff0000,
719 # 1182 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
720 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x44) & 0xFF)), 0x0000f8f8, 0x003f0000,
725 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x4C) & 0xFF)), 0x0000f8f8, 0x00000001,
726 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x54) & 0xFF)), 0x0000f8f8, 0x00000002,
727 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x5C) & 0xFF)), 0x0000f8f8, 0x00000003,
728 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x64) & 0xFF)), 0x0000f8f8, 0x00000004,
729 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x6C) & 0xFF)), 0x0000f8f8, 0x00000005,
730 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x74) & 0xFF)), 0x0000f8f8, 0x00000006,
731 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x7C) & 0xFF)), 0x0000f8f8, 0x00000007,
732 # 1224 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
733 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x40) & 0xFF)), 0x0000f8fc, 0x00000003,
735 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x48) & 0xFF)), 0x0000f8fc, 0x00400000,
736 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x50) & 0xFF)), 0x0000f8fc, 0x00400000,
737 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x58) & 0xFF)), 0x0000f8fc, 0x00400000,
738 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x60) & 0xFF)), 0x0000f8fc, 0x00400000,
739 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x68) & 0xFF)), 0x0000f8fc, 0x00400000,
740 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x70) & 0xFF)), 0x0000f8fc, 0x00400000,
741 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x78) & 0xFF)), 0x0000f8fc, 0x00400000,
742 # 1276 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
743 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x84) & 0xFF)), 0x00000048, 0x00e1ff00,
744 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x8C) & 0xFF)), 0x00000048, 0x00dfff00,
745 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x94) & 0xFF)), 0x00000048, 0x00e3ff00,
746 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x9C) & 0xFF)), 0x00000048, 0x00000000,
747 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA4) & 0xFF)), 0x00000048, 0x00000000,
748 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xAC) & 0xFF)), 0x00000048, 0x00000000,
749 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB4) & 0xFF)), 0x00000048, 0x00000b00,
750 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xBC) & 0xFF)), 0x00000048, 0x00fe0b00,
751 # 1311 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
752 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x80) & 0xFF)), 0x000000f0, 0x00e00003,
753 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x88) & 0xFF)), 0x000000f0, 0x00d80003,
754 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x90) & 0xFF)), 0x000000f0, 0x00e20003,
755 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x98) & 0xFF)), 0x000000f0, 0x00000000,
756 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA0) & 0xFF)), 0x000000f0, 0x00000000,
757 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA8) & 0xFF)), 0x000000f0, 0x00000000,
758 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB0) & 0xFF)), 0x000000f0, 0x00000a03,
760 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB8) & 0xFF)), 0x000000f0, 0x00400003,
761 # 1350 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
762 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC4) & 0xFF)), 0xFE000FC8, 0x0000d000,
763 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xCC) & 0xFF)), 0xFE000FC8, 0x000ff000,
764 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD4) & 0xFF)), 0xFE000FC8, 0x00000000,
765 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xDC) & 0xFF)), 0xFE000FC8, 0x00000000,
766 # 1380 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
767 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC0) & 0xFF)), 0xFE000FCC, 0x0000d003,
768 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC8) & 0xFF)), 0xFE000FCC, 0x00001013,
769 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD0) & 0xFF)), 0xFE000FCC, 0x00000000,
770 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD8) & 0xFF)), 0xFE000FCC, 0x00000000,
771 # 1421 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
772 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE0) & 0xFF)), 0x0000FC88, 0xff000003,
773 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE4) & 0xFF)), 0x0000FC88, 0x00000000,
774 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE8) & 0xFF)), 0x0000FC88, 0x00000000,
775 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xEC) & 0xFF)), 0x0000FC88, 0x00000000,
780 print_debug("setting up coherent ht domain....\r\n");
781 max = sizeof(register_values)/sizeof(register_values[0]);
782 for(i = 0; i < max; i += 3) {
790 reg = pci_read_config32(register_values[i]);
791 reg &= register_values[i+1];
792 reg |= register_values[i+2] & ~register_values[i+1];
793 pci_write_config32(register_values[i], reg);
795 print_debug("done.\r\n");
798 static void enumerate_ht_chain(void)
800 unsigned next_unitid, last_unitid;;
804 uint8_t hdr_type, pos;
805 last_unitid = next_unitid;
807 id = pci_read_config32(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x00) & 0xFF)));
809 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
810 (((id >> 16) & 0xffff) == 0xffff) ||
811 (((id >> 16) & 0xffff) == 0x0000)) {
814 hdr_type = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x0e) & 0xFF)));
818 if ((hdr_type == 0) ||
820 pos = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x34) & 0xFF)));
824 cap = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((pos + 0) & 0xFF)));
827 flags = pci_read_config16(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((pos + 2) & 0xFF)));
828 if ((flags >> 13) == 0) {
831 flags |= next_unitid & 0x1f;
832 count = (flags >> 5) & 0x1f;
833 pci_write_config16(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((pos + 2) & 0xFF)), flags);
834 next_unitid += count;
838 pos = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((pos + 1) & 0xFF)));
840 } while((last_unitid != next_unitid) && (next_unitid <= 0x1f));
843 static void print_pci_devices(void)
846 for(addr = ( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0) & 0xFF));
847 addr <= ( (((0) & 0xFF) << 16) | (((0x1f) & 0x1f) << 11) | (((0x7) & 0x07) << 8) | ((0) & 0xFF));
848 addr += ( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0) & 0xFF))) {
850 id = pci_read_config32(addr + 0x00);
851 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
852 (((id >> 16) & 0xffff) == 0xffff) ||
853 (((id >> 16) & 0xffff) == 0x0000)) {
856 print_debug("PCI: 00:");
857 print_debug_hex8(addr >> 11);
858 print_debug_char('.');
859 print_debug_hex8((addr >> 8) & 7);
863 # 1525 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c"
864 static void enable_smbus(void)
867 for(addr = ( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0) & 0xFF));
868 addr <= ( (((0) & 0xFF) << 16) | (((0x1f) & 0x1f) << 11) | (((0x7) & 0x07) << 8) | ((0) & 0xFF));
869 addr += ( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0) & 0xFF))) {
871 id = pci_read_config32(addr);
872 if (id == ((0x746b << 16) | (0x1022))) {
876 if (addr > ( (((0) & 0xFF) << 16) | (((0x1f) & 0x1f) << 11) | (((0x7) & 0x07) << 8) | ((0) & 0xFF))) {
877 die("SMBUS controller not found\r\n");
880 print_debug("SMBus controller enabled\r\n");
881 pci_write_config32(addr + 0x58, 0x1000 | 1);
882 enable = pci_read_config8(addr + 0x41);
883 pci_write_config8(addr + 0x41, enable | (1 << 7));
887 static inline void smbus_delay(void)
892 static int smbus_wait_until_ready(void)
895 loops = (100*1000*10);
899 val = inw(0x1000 + 0xe0);
900 if ((val & 0x800) == 0) {
907 static int smbus_wait_until_done(void)
910 loops = (100*1000*10);
915 val = inw(0x1000 + 0xe0);
916 if (((val & 0x8) == 0) || ((val & 0x437) != 0)) {
923 static int smbus_read_byte(unsigned device, unsigned address)
925 unsigned char global_control_register;
926 unsigned char global_status_register;
929 if (smbus_wait_until_ready() < 0) {
935 outw(inw(0x1000 + 0xe2) & ~((1<<10)|(1<<9)|(1<<8)|(1<<4)), 0x1000 + 0xe2);
937 outw(((device & 0x7f) << 1) | 1, 0x1000 + 0xe4);
939 outb(address & 0xFF, 0x1000 + 0xe8);
941 outw((inw(0x1000 + 0xe2) & ~7) | (0x2), 0x1000 + 0xe2);
945 outw(inw(0x1000 + 0xe0), 0x1000 + 0xe0);
948 outw(0, 0x1000 + 0xe6);
951 outw((inw(0x1000 + 0xe2) | (1 << 3)), 0x1000 + 0xe2);
955 if (smbus_wait_until_done() < 0) {
959 global_status_register = inw(0x1000 + 0xe0);
962 byte = inw(0x1000 + 0xe6) & 0xff;
964 if (global_status_register != (1 << 4)) {
970 static void dump_spd_registers(void)
975 while(device <= ((0xa << 3) +1)) {
977 print_debug("dimm: ");
978 print_debug_hex8(device);
979 for(i = 0; i < 256; i++) {
982 if ((i & 0xf) == 0) {
987 status = smbus_read_byte(device, i);
989 print_debug("bad device\r\n");
992 byte = status & 0xff;
993 print_debug_hex8(byte);
994 print_debug_char(' ');
1001 static void dump_spd_registers1(void)
1004 print_debug("dimm: ");
1005 print_debug_hex8((0xa << 3));
1006 for(i = 0; i < 256; i++) {
1009 if ((i & 0xf) == 0) {
1010 print_debug("\r\n");
1011 print_debug_hex8(i);
1014 status = smbus_read_byte((0xa << 3), i);
1016 print_debug("bad device\r\n");
1019 byte = status & 0xff;
1020 print_debug_hex8(byte);
1021 print_debug_char(' ');
1023 print_debug("\r\n");
1028 static void dump_spd_registers2(void)
1031 print_debug("\r\n");
1032 for(dev = (0xa << 3); dev <= ((0xa << 3) +1); dev += 1) {
1033 print_debug("dimm: ");
1034 print_debug_hex8(dev);
1037 status = smbus_read_byte(dev, 0);
1039 print_debug("bad device\r\n");
1042 byte = status & 0xff;
1043 print_debug_hex8(byte);
1044 print_debug("\r\n");
1048 static void main(void)
1052 if (boot_cpu() && !cpu_init_detected()) {
1053 setup_coherent_ht_domain();
1054 enumerate_ht_chain();
1055 print_pci_devices();
1061 dump_spd_registers1();
1062 dump_spd_registers2();
1068 ram_fill( 0x00000000, 0x00001000);
1069 ram_verify(0x00000000, 0x00001000);