1 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c"
4 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c"
6 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/arch/i386/include/stdint.h" 1
7 # 11 "/home/eric/projects/linuxbios/checkin/hdama/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/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
64 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/include/device/pci_def.h" 1
65 # 4 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
66 # 1 "/home/eric/projects/linuxbios/checkin/hdama/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);
115 # 64 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/arch/i386/include/arch/romcc_io.h"
116 typedef unsigned device_t;
118 static unsigned char pci_read_config8(device_t dev, unsigned where)
122 outl(0x80000000 | (addr & ~3), 0xCF8);
123 return inb(0xCFC + (addr & 3));
126 static unsigned short pci_read_config16(device_t dev, unsigned where)
130 outl(0x80000000 | (addr & ~3), 0xCF8);
131 return inw(0xCFC + (addr & 2));
134 static unsigned int pci_read_config32(device_t dev, unsigned where)
138 outl(0x80000000 | (addr & ~3), 0xCF8);
142 static void pci_write_config8(device_t dev, unsigned where, unsigned char value)
146 outl(0x80000000 | (addr & ~3), 0xCF8);
147 outb(value, 0xCFC + (addr & 3));
150 static void pci_write_config16(device_t dev, unsigned where, unsigned short value)
154 outl(0x80000000 | (addr & ~3), 0xCF8);
155 outw(value, 0xCFC + (addr & 2));
158 static void pci_write_config32(device_t dev, unsigned where, unsigned int value)
162 outl(0x80000000 | (addr & ~3), 0xCF8);
167 static device_t pci_locate_device(unsigned pci_id, device_t dev)
169 for(; dev <= ( (((255) & 0xFF) << 16) | (((31) & 0x1f) << 11) | (((7) & 0x7) << 8)); dev += ( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((1) & 0x7) << 8))) {
171 id = pci_read_config32(dev, 0);
176 return (0xffffffffU);
178 # 5 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
179 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/pc80/serial.c" 1
180 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/include/part/fallback_boot.h" 1
181 # 2 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/pc80/serial.c" 2
182 # 44 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/pc80/serial.c"
183 static int uart_can_tx_byte(void)
185 return inb(0x3f8 + 0x05) & 0x20;
188 static void uart_wait_to_tx_byte(void)
190 while(!uart_can_tx_byte())
194 static void uart_wait_until_sent(void)
196 while(!(inb(0x3f8 + 0x05) & 0x40))
200 static void uart_tx_byte(unsigned char data)
202 uart_wait_to_tx_byte();
203 outb(data, 0x3f8 + 0x00);
205 uart_wait_until_sent();
208 static void uart_init(void)
211 outb(0x0, 0x3f8 + 0x01);
213 outb(0x01, 0x3f8 + 0x02);
215 outb(0x80 | 0x3, 0x3f8 + 0x03);
216 # 87 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/pc80/serial.c"
217 outb((115200/9600) & 0xFF, 0x3f8 + 0x00);
218 outb(((115200/9600) >> 8) & 0xFF, 0x3f8 + 0x01);
220 outb(0x3, 0x3f8 + 0x03);
222 # 6 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
223 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/arch/i386/lib/console.c" 1
224 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/include/console/loglevel.h" 1
225 # 2 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/arch/i386/lib/console.c" 2
227 static void __console_tx_byte(unsigned char byte)
232 static void __console_tx_nibble(unsigned nibble)
235 digit = nibble + '0';
239 __console_tx_byte(digit);
242 static void __console_tx_char(int loglevel, unsigned char byte)
249 static void __console_tx_hex8(int loglevel, unsigned char value)
252 __console_tx_nibble((value >> 4U) & 0x0fU);
253 __console_tx_nibble(value & 0x0fU);
257 static void __console_tx_hex16(int loglevel, unsigned short value)
260 __console_tx_nibble((value >> 12U) & 0x0fU);
261 __console_tx_nibble((value >> 8U) & 0x0fU);
262 __console_tx_nibble((value >> 4U) & 0x0fU);
263 __console_tx_nibble(value & 0x0fU);
267 static void __console_tx_hex32(int loglevel, unsigned int value)
270 __console_tx_nibble((value >> 28U) & 0x0fU);
271 __console_tx_nibble((value >> 24U) & 0x0fU);
272 __console_tx_nibble((value >> 20U) & 0x0fU);
273 __console_tx_nibble((value >> 16U) & 0x0fU);
274 __console_tx_nibble((value >> 12U) & 0x0fU);
275 __console_tx_nibble((value >> 8U) & 0x0fU);
276 __console_tx_nibble((value >> 4U) & 0x0fU);
277 __console_tx_nibble(value & 0x0fU);
281 static void __console_tx_string(int loglevel, const char *str)
285 while((ch = *str++) != '\0') {
286 __console_tx_byte(ch);
291 static void print_emerg_char(unsigned char byte) { __console_tx_char(0, byte); }
292 static void print_emerg_hex8(unsigned char value){ __console_tx_hex8(0, value); }
293 static void print_emerg_hex16(unsigned short value){ __console_tx_hex16(0, value); }
294 static void print_emerg_hex32(unsigned int value) { __console_tx_hex32(0, value); }
295 static void print_emerg(const char *str) { __console_tx_string(0, str); }
297 static void print_alert_char(unsigned char byte) { __console_tx_char(1, byte); }
298 static void print_alert_hex8(unsigned char value) { __console_tx_hex8(1, value); }
299 static void print_alert_hex16(unsigned short value){ __console_tx_hex16(1, value); }
300 static void print_alert_hex32(unsigned int value) { __console_tx_hex32(1, value); }
301 static void print_alert(const char *str) { __console_tx_string(1, str); }
303 static void print_crit_char(unsigned char byte) { __console_tx_char(2, byte); }
304 static void print_crit_hex8(unsigned char value) { __console_tx_hex8(2, value); }
305 static void print_crit_hex16(unsigned short value){ __console_tx_hex16(2, value); }
306 static void print_crit_hex32(unsigned int value) { __console_tx_hex32(2, value); }
307 static void print_crit(const char *str) { __console_tx_string(2, str); }
309 static void print_err_char(unsigned char byte) { __console_tx_char(3, byte); }
310 static void print_err_hex8(unsigned char value) { __console_tx_hex8(3, value); }
311 static void print_err_hex16(unsigned short value){ __console_tx_hex16(3, value); }
312 static void print_err_hex32(unsigned int value) { __console_tx_hex32(3, value); }
313 static void print_err(const char *str) { __console_tx_string(3, str); }
315 static void print_warning_char(unsigned char byte) { __console_tx_char(4, byte); }
316 static void print_warning_hex8(unsigned char value) { __console_tx_hex8(4, value); }
317 static void print_warning_hex16(unsigned short value){ __console_tx_hex16(4, value); }
318 static void print_warning_hex32(unsigned int value) { __console_tx_hex32(4, value); }
319 static void print_warning(const char *str) { __console_tx_string(4, str); }
321 static void print_notice_char(unsigned char byte) { __console_tx_char(5, byte); }
322 static void print_notice_hex8(unsigned char value) { __console_tx_hex8(5, value); }
323 static void print_notice_hex16(unsigned short value){ __console_tx_hex16(5, value); }
324 static void print_notice_hex32(unsigned int value) { __console_tx_hex32(5, value); }
325 static void print_notice(const char *str) { __console_tx_string(5, str); }
327 static void print_info_char(unsigned char byte) { __console_tx_char(6, byte); }
328 static void print_info_hex8(unsigned char value) { __console_tx_hex8(6, value); }
329 static void print_info_hex16(unsigned short value){ __console_tx_hex16(6, value); }
330 static void print_info_hex32(unsigned int value) { __console_tx_hex32(6, value); }
331 static void print_info(const char *str) { __console_tx_string(6, str); }
333 static void print_debug_char(unsigned char byte) { __console_tx_char(7, byte); }
334 static void print_debug_hex8(unsigned char value) { __console_tx_hex8(7, value); }
335 static void print_debug_hex16(unsigned short value){ __console_tx_hex16(7, value); }
336 static void print_debug_hex32(unsigned int value) { __console_tx_hex32(7, value); }
337 static void print_debug(const char *str) { __console_tx_string(7, str); }
339 static void print_spew_char(unsigned char byte) { __console_tx_char(8, byte); }
340 static void print_spew_hex8(unsigned char value) { __console_tx_hex8(8, value); }
341 static void print_spew_hex16(unsigned short value){ __console_tx_hex16(8, value); }
342 static void print_spew_hex32(unsigned int value) { __console_tx_hex32(8, value); }
343 static void print_spew(const char *str) { __console_tx_string(8, str); }
344 # 128 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/arch/i386/lib/console.c"
345 static void console_init(void)
347 static const char console_test[] =
352 "Fri Jun 13 21:02:41 MDT 2003"
354 print_info(console_test);
358 static void die(const char *str)
365 # 7 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
366 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/ram/ramtest.c" 1
367 static void write_phys(unsigned long addr, unsigned long value)
369 volatile unsigned long *ptr;
374 static unsigned long read_phys(unsigned long addr)
376 volatile unsigned long *ptr;
381 void ram_fill(unsigned long start, unsigned long stop)
387 print_debug("DRAM fill: ");
388 print_debug_hex32(start);
390 print_debug_hex32(stop);
392 for(addr = start; addr < stop ; addr += 4) {
394 if ((addr & 0xffff) == 0) {
395 print_debug_hex32(addr);
398 write_phys(addr, addr);
401 print_debug_hex32(addr);
402 print_debug("\r\nDRAM filled\r\n");
405 void ram_verify(unsigned long start, unsigned long stop)
411 print_debug("DRAM verify: ");
412 print_debug_hex32(start);
413 print_debug_char('-');
414 print_debug_hex32(stop);
416 for(addr = start; addr < stop ; addr += 4) {
419 if ((addr & 0xffff) == 0) {
420 print_debug_hex32(addr);
423 value = read_phys(addr);
426 print_err_hex32(addr);
428 print_err_hex32(value);
433 print_debug_hex32(addr);
434 print_debug("\r\nDRAM verified\r\n");
438 void ram_check(unsigned long start, unsigned long stop)
446 print_debug("Testing DRAM : ");
447 print_debug_hex32(start);
449 print_debug_hex32(stop);
451 ram_fill(start, stop);
452 ram_verify(start, stop);
453 print_debug("Done.\n");
455 # 8 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
456 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/early_ht.c" 1
457 static void enumerate_ht_chain(void)
464 unsigned next_unitid, last_unitid;;
468 uint8_t hdr_type, pos;
469 last_unitid = next_unitid;
471 id = pci_read_config32(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), 0x00);
473 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
474 (((id >> 16) & 0xffff) == 0xffff) ||
475 (((id >> 16) & 0xffff) == 0x0000)) {
478 hdr_type = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), 0x0e);
482 if ((hdr_type == 0) ||
484 pos = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), 0x34);
488 cap = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), pos + 0);
491 flags = pci_read_config16(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), pos + 2);
492 if ((flags >> 13) == 0) {
495 flags |= next_unitid & 0x1f;
496 count = (flags >> 5) & 0x1f;
497 pci_write_config16(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), pos + 2, flags);
498 next_unitid += count;
502 pos = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), pos + 1);
504 } while((last_unitid != next_unitid) && (next_unitid <= 0x1f));
506 # 9 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
507 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/southbridge/amd/amd8111/amd8111_early_smbus.c" 1
508 # 12 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/southbridge/amd/amd8111/amd8111_early_smbus.c"
509 static void enable_smbus(void)
512 dev = pci_locate_device(((((0x746b) & 0xFFFF) << 16) | ((0x1022) & 0xFFFF)), 0);
513 if (dev == (0xffffffffU)) {
514 die("SMBUS controller not found\r\n");
517 print_debug("SMBus controller enabled\r\n");
518 pci_write_config32(dev, 0x58, 0x1000 | 1);
519 enable = pci_read_config8(dev, 0x41);
520 pci_write_config8(dev, 0x41, enable | (1 << 7));
524 static inline void smbus_delay(void)
529 static int smbus_wait_until_ready(void)
532 loops = (100*1000*10);
536 val = inw(0x1000 + 0xe0);
537 if ((val & 0x800) == 0) {
544 static int smbus_wait_until_done(void)
547 loops = (100*1000*10);
552 val = inw(0x1000 + 0xe0);
553 if (((val & 0x8) == 0) || ((val & 0x437) != 0)) {
560 static int smbus_read_byte(unsigned device, unsigned address)
562 unsigned char global_control_register;
563 unsigned char global_status_register;
566 if (smbus_wait_until_ready() < 0) {
572 outw(inw(0x1000 + 0xe2) & ~((1<<10)|(1<<9)|(1<<8)|(1<<4)), 0x1000 + 0xe2);
574 outw(((device & 0x7f) << 1) | 1, 0x1000 + 0xe4);
576 outb(address & 0xFF, 0x1000 + 0xe8);
578 outw((inw(0x1000 + 0xe2) & ~7) | (0x2), 0x1000 + 0xe2);
582 outw(inw(0x1000 + 0xe0), 0x1000 + 0xe0);
585 outw(0, 0x1000 + 0xe6);
588 outw((inw(0x1000 + 0xe2) | (1 << 3)), 0x1000 + 0xe2);
592 if (smbus_wait_until_done() < 0) {
596 global_status_register = inw(0x1000 + 0xe0);
599 byte = inw(0x1000 + 0xe6) & 0xff;
601 if (global_status_register != (1 << 4)) {
606 # 10 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
607 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c" 1
608 # 10 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
609 static void setup_resource_map(const unsigned int *register_values, int max)
612 print_debug("setting up resource map....\r\n");
613 for(i = 0; i < max; i += 3) {
623 dev = register_values[i] & ~0xff;
624 where = register_values[i] & 0xff;
625 reg = pci_read_config32(dev, where);
626 reg &= register_values[i+1];
627 reg |= register_values[i+2];
628 pci_write_config32(dev, where, reg);
636 print_debug("done.\r\n");
639 static void setup_default_resource_map(void)
641 static const unsigned int register_values[] = {
642 # 70 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
643 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x44) & 0xFF)), 0x0000f8f8, 0x00000000,
644 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x4C) & 0xFF)), 0x0000f8f8, 0x00000001,
645 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x54) & 0xFF)), 0x0000f8f8, 0x00000002,
646 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x5C) & 0xFF)), 0x0000f8f8, 0x00000003,
647 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x64) & 0xFF)), 0x0000f8f8, 0x00000004,
648 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x6C) & 0xFF)), 0x0000f8f8, 0x00000005,
649 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x74) & 0xFF)), 0x0000f8f8, 0x00000006,
650 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x7C) & 0xFF)), 0x0000f8f8, 0x00000007,
651 # 108 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
652 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x40) & 0xFF)), 0x0000f8fc, 0x00000000,
653 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x48) & 0xFF)), 0x0000f8fc, 0x00000000,
654 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x50) & 0xFF)), 0x0000f8fc, 0x00000000,
655 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x58) & 0xFF)), 0x0000f8fc, 0x00000000,
656 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x60) & 0xFF)), 0x0000f8fc, 0x00000000,
657 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x68) & 0xFF)), 0x0000f8fc, 0x00000000,
658 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x70) & 0xFF)), 0x0000f8fc, 0x00000000,
659 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x78) & 0xFF)), 0x0000f8fc, 0x00000000,
660 # 149 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
661 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x84) & 0xFF)), 0x00000048, 0x00000000,
662 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x8C) & 0xFF)), 0x00000048, 0x00000000,
663 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x94) & 0xFF)), 0x00000048, 0x00000000,
664 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x9C) & 0xFF)), 0x00000048, 0x00000000,
665 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA4) & 0xFF)), 0x00000048, 0x00000000,
666 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xAC) & 0xFF)), 0x00000048, 0x00000000,
667 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB4) & 0xFF)), 0x00000048, 0x00000000,
668 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xBC) & 0xFF)), 0x00000048, 0x00000000,
669 # 184 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
670 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x80) & 0xFF)), 0x000000f0, 0x00000000,
671 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x88) & 0xFF)), 0x000000f0, 0x00000000,
672 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x90) & 0xFF)), 0x000000f0, 0x00000000,
673 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x98) & 0xFF)), 0x000000f0, 0x00000000,
674 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA0) & 0xFF)), 0x000000f0, 0x00000000,
675 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA8) & 0xFF)), 0x000000f0, 0x00000000,
676 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB0) & 0xFF)), 0x000000f0, 0x00000000,
677 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB8) & 0xFF)), 0x000000f0, 0x00000000,
678 # 218 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
679 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC4) & 0xFF)), 0xFE000FC8, 0x01fff000,
680 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xCC) & 0xFF)), 0xFE000FC8, 0x00000000,
681 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD4) & 0xFF)), 0xFE000FC8, 0x00000000,
682 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xDC) & 0xFF)), 0xFE000FC8, 0x00000000,
683 # 248 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
684 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC0) & 0xFF)), 0xFE000FCC, 0x00000003,
685 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC8) & 0xFF)), 0xFE000FCC, 0x00000000,
686 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD0) & 0xFF)), 0xFE000FCC, 0x00000000,
687 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD8) & 0xFF)), 0xFE000FCC, 0x00000000,
688 # 289 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
689 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE0) & 0xFF)), 0x0000FC88, 0xff000003,
690 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE4) & 0xFF)), 0x0000FC88, 0x00000000,
691 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE8) & 0xFF)), 0x0000FC88, 0x00000000,
692 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xEC) & 0xFF)), 0x0000FC88, 0x00000000,
695 max = sizeof(register_values)/sizeof(register_values[0]);
696 setup_resource_map(register_values, max);
699 static void sdram_set_registers(void)
701 static const unsigned int register_values[] = {
702 # 339 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
703 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x44) & 0xFF)), 0x0000f8f8, 0x003f0000,
704 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x4C) & 0xFF)), 0x0000f8f8, 0x007f0001,
706 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x54) & 0xFF)), 0x0000f8f8, 0x00000002,
707 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x5C) & 0xFF)), 0x0000f8f8, 0x00000003,
708 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x64) & 0xFF)), 0x0000f8f8, 0x00000004,
709 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x6C) & 0xFF)), 0x0000f8f8, 0x00000005,
710 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x74) & 0xFF)), 0x0000f8f8, 0x00000006,
711 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x7C) & 0xFF)), 0x0000f8f8, 0x00000007,
712 # 378 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
713 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x40) & 0xFF)), 0x0000f8fc, 0x00000003,
714 # 398 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
715 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x48) & 0xFF)), 0x0000f8fc, 0x00400003,
716 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x50) & 0xFF)), 0x0000f8fc, 0x00800000,
717 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x58) & 0xFF)), 0x0000f8fc, 0x00800000,
718 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x60) & 0xFF)), 0x0000f8fc, 0x00800000,
719 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x68) & 0xFF)), 0x0000f8fc, 0x00800000,
720 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x70) & 0xFF)), 0x0000f8fc, 0x00800000,
721 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x78) & 0xFF)), 0x0000f8fc, 0x00800000,
722 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x78) & 0xFF)), 0x0000f8fc, 0x00800000,
723 # 451 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
724 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x84) & 0xFF)), 0x00000048, 0x00fe2f00,
725 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x8C) & 0xFF)), 0x00000048, 0x00000000,
726 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x94) & 0xFF)), 0x00000048, 0x00000000,
727 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x9C) & 0xFF)), 0x00000048, 0x00000000,
728 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA4) & 0xFF)), 0x00000048, 0x00fec000,
729 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xAC) & 0xFF)), 0x00000048, 0x0000b000,
730 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB4) & 0xFF)), 0x00000048, 0x00000000,
731 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xBC) & 0xFF)), 0x00000048, 0x00000000,
732 # 503 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
733 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x80) & 0xFF)), 0x000000f0, 0x00fc0003,
734 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x88) & 0xFF)), 0x000000f0, 0x00000000,
735 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x90) & 0xFF)), 0x000000f0, 0x00000000,
736 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0x98) & 0xFF)), 0x000000f0, 0x00000000,
737 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA0) & 0xFF)), 0x000000f0, 0x00fec00e,
738 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xA8) & 0xFF)), 0x000000f0, 0x00000a03,
739 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB0) & 0xFF)), 0x000000f0, 0x00000000,
740 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xB8) & 0xFF)), 0x000000f0, 0x00000000,
741 # 545 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
742 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC4) & 0xFF)), 0xFE000FC8, 0x01fff000,
743 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xCC) & 0xFF)), 0xFE000FC8, 0x00000000,
744 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD4) & 0xFF)), 0xFE000FC8, 0x00000000,
745 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xDC) & 0xFF)), 0xFE000FC8, 0x00000000,
746 # 583 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
747 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC0) & 0xFF)), 0xFE000FCC, 0x00000033,
748 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xC8) & 0xFF)), 0xFE000FCC, 0x00000000,
749 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD0) & 0xFF)), 0xFE000FCC, 0x00000000,
750 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xD8) & 0xFF)), 0xFE000FCC, 0x00000000,
751 # 632 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
752 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE0) & 0xFF)), 0x0000FC88, 0xff000003,
753 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE4) & 0xFF)), 0x0000FC88, 0x00000000,
754 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xE8) & 0xFF)), 0x0000FC88, 0x00000000,
755 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((1) & 0x07) << 8) | ((0xEC) & 0xFF)), 0x0000FC88, 0x00000000,
756 # 659 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
757 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x40) & 0xFF)), 0x001f01fe, 0x00000001,
758 # 671 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
759 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x44) & 0xFF)), 0x001f01fe, 0x00001001,
760 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x48) & 0xFF)), 0x001f01fe, 0x00000000,
761 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x4C) & 0xFF)), 0x001f01fe, 0x00000000,
763 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x50) & 0xFF)), 0x001f01fe, 0x00000000,
764 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x54) & 0xFF)), 0x001f01fe, 0x00000000,
765 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x58) & 0xFF)), 0x001f01fe, 0x00000000,
766 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x5C) & 0xFF)), 0x001f01fe, 0x00000000,
767 # 711 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
768 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x60) & 0xFF)), 0xC01f01ff, 0x03e0ee00,
769 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x64) & 0xFF)), 0xC01f01ff, 0x03e0ee00,
770 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x68) & 0xFF)), 0xC01f01ff, 0x00000000,
771 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x6C) & 0xFF)), 0xC01f01ff, 0x00000000,
773 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x70) & 0xFF)), 0xC01f01ff, 0x00000000,
774 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x74) & 0xFF)), 0xC01f01ff, 0x00000000,
775 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x78) & 0xFF)), 0xC01f01ff, 0x00000000,
776 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x7C) & 0xFF)), 0xC01f01ff, 0x00000000,
777 # 747 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
778 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x80) & 0xFF)), 0xffff8888, 0x00000003,
779 # 817 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
780 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x88) & 0xFF)), 0xe8088008, 0x13723335,
781 # 855 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
782 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x8c) & 0xFF)), 0xff8fe08e, 0x00100a20,
783 # 937 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
784 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)), 0xf0000000,
786 (0 << 23)|(0 << 22)|(0 << 21)|(0 << 20)|
787 (0 << 19)|(0 << 18)|(0 << 17)|(1 << 16)|
788 (2 << 14)|(0 << 13)|(0 << 12)|
789 (0 << 11)|(0 << 10)|(0 << 9)|(0 << 8)|
790 (0 << 3) |(0 << 1) |(0 << 0),
791 # 1016 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
792 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x94) & 0xFF)), 0xc180f0f0, 0x065b0b08,
793 # 1033 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
794 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x98) & 0xFF)), 0xfc00ffff, 0x00000000,
795 # 1067 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
796 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((3) & 0x07) << 8) | ((0x58) & 0xFF)), 0xffe0e0e0, 0x00000000,
797 # 1076 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
798 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((3) & 0x07) << 8) | ((0x5C) & 0xFF)), 0x0000003e, 0x00000000,
804 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((3) & 0x07) << 8) | ((0x60) & 0xFF)), 0xffffff00, 0x00000000,
808 print_debug("setting up CPU0 northbridge registers\r\n");
809 max = sizeof(register_values)/sizeof(register_values[0]);
810 for(i = 0; i < max; i += 3) {
820 dev = register_values[i] & ~0xff;
821 where = register_values[i] & 0xff;
822 reg = pci_read_config32(dev, where);
823 reg &= register_values[i+1];
824 reg |= register_values[i+2];
825 pci_write_config32(dev, where, reg);
834 print_debug("done.\r\n");
836 # 1132 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
837 static void sdram_set_spd_registers(void)
840 dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90);
843 pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90, dcl);
847 static void sdram_enable(void)
852 dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90);
853 print_debug("dcl: ");
854 print_debug_hex32(dcl);
857 pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90, dcl);
863 pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90, dcl);
865 print_debug("Initializing memory: ");
868 dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90);
870 if ((loops & 1023) == 0) {
873 } while(((dcl & (1<<8)) != 0) && (loops < 300000));
874 if (loops >= 300000) {
875 print_debug(" failed\r\n");
877 print_debug(" done\r\n");
879 # 1192 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c"
882 static void sdram_first_normal_reference(void) {}
883 static void sdram_enable_refresh(void) {}
884 static void sdram_special_finishup(void) {}
885 # 11 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
886 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/coherent_ht.c" 1
887 # 9 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/coherent_ht.c"
888 static void setup_coherent_ht_domain(void)
890 static const unsigned int register_values[] = {
891 # 37 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/coherent_ht.c"
892 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x40) & 0xFF)), 0xfff0f0f0, 0x00010101,
893 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x44) & 0xFF)), 0xfff0f0f0, 0x00010101,
894 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x48) & 0xFF)), 0xfff0f0f0, 0x00010101,
895 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x4c) & 0xFF)), 0xfff0f0f0, 0x00010101,
896 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x50) & 0xFF)), 0xfff0f0f0, 0x00010101,
897 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x54) & 0xFF)), 0xfff0f0f0, 0x00010101,
898 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x58) & 0xFF)), 0xfff0f0f0, 0x00010101,
899 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x5c) & 0xFF)), 0xfff0f0f0, 0x00010101,
900 # 136 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/coherent_ht.c"
901 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x68) & 0xFF)), 0x00800000, 0x0f00840f,
902 # 158 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/coherent_ht.c"
903 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x6C) & 0xFF)), 0xffffff8c, 0x00000000 | (1 << 6) |(1 << 5)| (1 << 4),
904 # 235 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/coherent_ht.c"
905 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x84) & 0xFF)), 0x00009c05, 0x11110020,
906 # 280 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/coherent_ht.c"
907 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x88) & 0xFF)), 0xfffff0ff, 0x00000200,
908 # 301 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/coherent_ht.c"
909 ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x94) & 0xFF)), 0xff000000, 0x00ff0000,
918 print_debug("setting up coherent ht domain....\r\n");
919 max = sizeof(register_values)/sizeof(register_values[0]);
920 for(i = 0; i < max; i += 3) {
930 dev = register_values[i] & ~0xff;
931 where = register_values[i] & 0xff;
932 reg = pci_read_config32(dev, where);
933 reg &= register_values[i+1];
934 reg |= register_values[i+2];
935 pci_write_config32(dev, where, reg);
943 print_debug("done.\r\n");
945 # 12 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
946 # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/sdram/generic_sdram.c" 1
947 void sdram_no_memory(void)
949 print_err("No memory!!\r\n");
956 void sdram_initialize(void)
958 print_debug("Ram1\r\n");
960 sdram_set_registers();
962 print_debug("Ram2\r\n");
964 sdram_set_spd_registers();
966 print_debug("Ram3\r\n");
973 print_debug("Ram4\r\n");
974 sdram_first_normal_reference();
976 print_debug("Ram5\r\n");
977 sdram_enable_refresh();
978 sdram_special_finishup();
980 print_debug("Ram6\r\n");
982 # 13 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2
984 static int boot_cpu(void)
986 volatile unsigned long *local_apic;
987 unsigned long apic_id;
991 bsp = !!(msr.lo & (1 << 8));
993 print_debug("Bootstrap cpu\r\n");
999 static int cpu_init_detected(void)
1006 htic = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((0) & 0x7) << 8)), 0x6c);
1007 # 52 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c"
1008 cpu_init = (htic & (1<<6));
1010 print_debug("CPU INIT Detected.\r\n");
1016 static void print_pci_devices(void)
1019 for(dev = ( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8));
1020 dev <= ( (((0) & 0xFF) << 16) | (((0x1f) & 0x1f) << 11) | (((0x7) & 0x7) << 8));
1021 dev += ( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((1) & 0x7) << 8))) {
1023 id = pci_read_config32(dev, 0x00);
1024 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
1025 (((id >> 16) & 0xffff) == 0xffff) ||
1026 (((id >> 16) & 0xffff) == 0x0000)) {
1029 print_debug("PCI: 00:");
1030 print_debug_hex8(dev >> 11);
1031 print_debug_char('.');
1032 print_debug_hex8((dev >> 8) & 7);
1033 print_debug("\r\n");
1038 static void dump_spd_registers(void)
1041 device = (0xa << 3);
1042 print_debug("\r\n");
1043 while(device <= ((0xa << 3) +7)) {
1045 print_debug("dimm: ");
1046 print_debug_hex8(device);
1047 for(i = 0; i < 256; i++) {
1050 if ((i & 0xf) == 0) {
1051 print_debug("\r\n");
1052 print_debug_hex8(i);
1055 status = smbus_read_byte(device, i);
1057 print_debug("bad device\r\n");
1060 byte = status & 0xff;
1061 print_debug_hex8(byte);
1062 print_debug_char(' ');
1065 print_debug("\r\n");
1069 static void pnp_write_config(unsigned char port, unsigned char value, unsigned char reg)
1072 outb(value, port +1);
1075 static unsigned char pnp_read_config(unsigned char port, unsigned char reg)
1078 return inb(port +1);
1081 static void pnp_set_logical_device(unsigned char port, int device)
1083 pnp_write_config(port, device, 0x07);
1086 static void pnp_set_enable(unsigned char port, int enable)
1088 pnp_write_config(port, enable?0x1:0x0, 0x30);
1091 static int pnp_read_enable(unsigned char port)
1093 return !!pnp_read_config(port, 0x30);
1096 static void pnp_set_iobase0(unsigned char port, unsigned iobase)
1098 pnp_write_config(port, (iobase >> 8) & 0xff, 0x60);
1099 pnp_write_config(port, iobase & 0xff, 0x61);
1102 static void pnp_set_iobase1(unsigned char port, unsigned iobase)
1104 pnp_write_config(port, (iobase >> 8) & 0xff, 0x62);
1105 pnp_write_config(port, iobase & 0xff, 0x63);
1108 static void pnp_set_irq0(unsigned char port, unsigned irq)
1110 pnp_write_config(port, irq, 0x70);
1113 static void pnp_set_irq1(unsigned char port, unsigned irq)
1115 pnp_write_config(port, irq, 0x72);
1118 static void pnp_set_drq(unsigned char port, unsigned drq)
1120 pnp_write_config(port, drq & 0xff, 0x74);
1122 # 179 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c"
1123 static void pc87360_enable_serial(void)
1125 pnp_set_logical_device(0x2e, 0x03);
1126 pnp_set_enable(0x2e, 1);
1127 pnp_set_iobase0(0x2e, 0x3f8);
1130 static void main(void)
1132 pc87360_enable_serial();
1135 if (boot_cpu() && !cpu_init_detected()) {
1136 setup_coherent_ht_domain();
1137 enumerate_ht_chain();
1138 print_pci_devices();
1142 dump_spd_registers();
1144 ram_check(0x00000000, 0x00001000);
1145 ram_check(0x00000000, 0x00180000);