Eric Biederman | 6aa31cc | 2003-06-10 21:22:07 +0000 | [diff] [blame] | 1 | # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" |
| 2 | # 1 "<built-in>" |
| 3 | # 1 "<command line>" |
| 4 | # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" |
| 5 | |
| 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; |
| 10 | |
| 11 | typedef unsigned short uint16_t; |
| 12 | typedef signed short int16_t; |
| 13 | |
| 14 | typedef unsigned int uint32_t; |
| 15 | typedef signed int int32_t; |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | typedef unsigned char uint_least8_t; |
| 24 | typedef signed char int_least8_t; |
| 25 | |
| 26 | typedef unsigned short uint_least16_t; |
| 27 | typedef signed short int_least16_t; |
| 28 | |
| 29 | typedef unsigned int uint_least32_t; |
| 30 | typedef signed int int_least32_t; |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | typedef unsigned char uint_fast8_t; |
| 39 | typedef signed char int_fast8_t; |
| 40 | |
| 41 | typedef unsigned int uint_fast16_t; |
| 42 | typedef signed int int_fast16_t; |
| 43 | |
| 44 | typedef unsigned int uint_fast32_t; |
| 45 | typedef signed int int_fast32_t; |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | typedef int intptr_t; |
| 54 | typedef unsigned int uintptr_t; |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 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) |
| 68 | { |
| 69 | __builtin_outb(value, port); |
| 70 | } |
| 71 | |
| 72 | static void outw(unsigned short value, unsigned short port) |
| 73 | { |
| 74 | __builtin_outw(value, port); |
| 75 | } |
| 76 | |
| 77 | static void outl(unsigned int value, unsigned short port) |
| 78 | { |
| 79 | __builtin_outl(value, port); |
| 80 | } |
| 81 | |
| 82 | |
| 83 | static unsigned char inb(unsigned short port) |
| 84 | { |
| 85 | return __builtin_inb(port); |
| 86 | } |
| 87 | |
| 88 | |
| 89 | static unsigned char inw(unsigned short port) |
| 90 | { |
| 91 | return __builtin_inw(port); |
| 92 | } |
| 93 | |
| 94 | static unsigned char inl(unsigned short port) |
| 95 | { |
| 96 | return __builtin_inl(port); |
| 97 | } |
| 98 | |
| 99 | static void hlt(void) |
| 100 | { |
| 101 | __builtin_hlt(); |
| 102 | } |
| 103 | |
| 104 | typedef __builtin_msr_t msr_t; |
| 105 | |
| 106 | static msr_t rdmsr(unsigned long index) |
| 107 | { |
| 108 | return __builtin_rdmsr(index); |
| 109 | } |
| 110 | |
| 111 | static void wrmsr(unsigned long index, msr_t msr) |
| 112 | { |
| 113 | __builtin_wrmsr(index, msr.lo, msr.hi); |
| 114 | } |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | static unsigned char pci_read_config8(unsigned addr) |
| 123 | { |
| 124 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 125 | return inb(0xCFC + (addr & 3)); |
| 126 | } |
| 127 | |
| 128 | static unsigned short pci_read_config16(unsigned addr) |
| 129 | { |
| 130 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 131 | return inw(0xCFC + (addr & 2)); |
| 132 | } |
| 133 | |
| 134 | static unsigned int pci_read_config32(unsigned addr) |
| 135 | { |
| 136 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 137 | return inl(0xCFC); |
| 138 | } |
| 139 | |
| 140 | static void pci_write_config8(unsigned addr, unsigned char value) |
| 141 | { |
| 142 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 143 | outb(value, 0xCFC + (addr & 3)); |
| 144 | } |
| 145 | |
| 146 | static void pci_write_config16(unsigned addr, unsigned short value) |
| 147 | { |
| 148 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 149 | outw(value, 0xCFC + (addr & 2)); |
| 150 | } |
| 151 | |
| 152 | static void pci_write_config32(unsigned addr, unsigned int value) |
| 153 | { |
| 154 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 155 | outl(value, 0xCFC); |
| 156 | } |
| 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) |
| 163 | { |
| 164 | return inb(0x3f8 + 0x05) & 0x20; |
| 165 | } |
| 166 | |
| 167 | static void uart_wait_to_tx_byte(void) |
| 168 | { |
| 169 | while(!uart_can_tx_byte()) |
| 170 | ; |
| 171 | } |
| 172 | |
| 173 | static void uart_wait_until_sent(void) |
| 174 | { |
| 175 | while(!(inb(0x3f8 + 0x05) & 0x40)) |
| 176 | ; |
| 177 | } |
| 178 | |
| 179 | static void uart_tx_byte(unsigned char data) |
| 180 | { |
| 181 | uart_wait_to_tx_byte(); |
| 182 | outb(data, 0x3f8 + 0x00); |
| 183 | |
| 184 | uart_wait_until_sent(); |
| 185 | } |
| 186 | |
| 187 | static void uart_init(void) |
| 188 | { |
| 189 | |
| 190 | outb(0x0, 0x3f8 + 0x01); |
| 191 | |
| 192 | outb(0x01, 0x3f8 + 0x02); |
| 193 | |
| 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); |
| 198 | |
| 199 | outb(0x3, 0x3f8 + 0x03); |
| 200 | } |
| 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 |
| 205 | |
| 206 | static void __console_tx_byte(unsigned char byte) |
| 207 | { |
| 208 | uart_tx_byte(byte); |
| 209 | } |
| 210 | |
| 211 | static void __console_tx_nibble(unsigned nibble) |
| 212 | { |
| 213 | unsigned char digit; |
| 214 | digit = nibble + '0'; |
| 215 | if (digit > '9') { |
| 216 | digit += 39; |
| 217 | } |
| 218 | __console_tx_byte(digit); |
| 219 | } |
| 220 | |
| 221 | static void __console_tx_char(int loglevel, unsigned char byte) |
| 222 | { |
| 223 | if (8 > loglevel) { |
| 224 | uart_tx_byte(byte); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | static void __console_tx_hex8(int loglevel, unsigned char value) |
| 229 | { |
| 230 | if (8 > loglevel) { |
| 231 | __console_tx_nibble((value >> 4U) & 0x0fU); |
| 232 | __console_tx_nibble(value & 0x0fU); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | static void __console_tx_hex16(int loglevel, unsigned short value) |
| 237 | { |
| 238 | if (8 > loglevel) { |
| 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); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | static void __console_tx_hex32(int loglevel, unsigned int value) |
| 247 | { |
| 248 | if (8 > loglevel) { |
| 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); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | static void __console_tx_string(int loglevel, const char *str) |
| 261 | { |
| 262 | if (8 > loglevel) { |
| 263 | unsigned char ch; |
| 264 | while((ch = *str++) != '\0') { |
| 265 | __console_tx_byte(ch); |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | |
| 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); } |
| 275 | |
| 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); } |
| 281 | |
| 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); } |
| 287 | |
| 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); } |
| 293 | |
| 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); } |
| 299 | |
| 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); } |
| 305 | |
| 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); } |
| 311 | |
| 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); } |
| 317 | |
| 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) |
| 325 | { |
| 326 | static const char console_test[] = |
| 327 | "\r\n\r\nLinuxBIOS-" |
| 328 | "1.1.0" |
| 329 | ".0Fallback" |
| 330 | " " |
| 331 | "Mon Jun 9 18:15:20 MDT 2003" |
| 332 | " starting...\r\n"; |
| 333 | print_info(console_test); |
| 334 | } |
| 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) |
| 338 | { |
| 339 | volatile unsigned long *ptr; |
| 340 | ptr = (void *)addr; |
| 341 | *ptr = value; |
| 342 | } |
| 343 | |
| 344 | static unsigned long read_phys(unsigned long addr) |
| 345 | { |
| 346 | volatile unsigned long *ptr; |
| 347 | ptr = (void *)addr; |
| 348 | return *ptr; |
| 349 | } |
| 350 | |
| 351 | void ram_fill(unsigned long start, unsigned long stop) |
| 352 | { |
| 353 | unsigned long addr; |
| 354 | |
| 355 | |
| 356 | |
| 357 | print_debug("DRAM fill: "); |
| 358 | print_debug_hex32(start); |
| 359 | print_debug("-"); |
| 360 | print_debug_hex32(stop); |
| 361 | print_debug("\r\n"); |
| 362 | for(addr = start; addr < stop ; addr += 4) { |
| 363 | |
| 364 | if ((addr & 0xffff) == 0) { |
| 365 | print_debug_hex32(addr); |
| 366 | print_debug("\r"); |
| 367 | } |
| 368 | write_phys(addr, addr); |
| 369 | }; |
| 370 | |
| 371 | print_debug_hex32(addr); |
| 372 | print_debug("\r\nDRAM filled\r\n"); |
| 373 | } |
| 374 | |
| 375 | void ram_verify(unsigned long start, unsigned long stop) |
| 376 | { |
| 377 | unsigned long addr; |
| 378 | |
| 379 | |
| 380 | |
| 381 | print_debug("DRAM verify: "); |
| 382 | print_debug_hex32(start); |
| 383 | print_debug_char('-'); |
| 384 | print_debug_hex32(stop); |
| 385 | print_debug("\r\n"); |
| 386 | for(addr = start; addr < stop ; addr += 4) { |
| 387 | unsigned long value; |
| 388 | |
| 389 | if ((addr & 0xffff) == 0) { |
| 390 | print_debug_hex32(addr); |
| 391 | print_debug("\r"); |
| 392 | } |
| 393 | value = read_phys(addr); |
| 394 | if (value != addr) { |
| 395 | |
| 396 | print_err_hex32(addr); |
| 397 | print_err_char(':'); |
| 398 | print_err_hex32(value); |
| 399 | print_err("\r\n"); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | print_debug_hex32(addr); |
| 404 | print_debug("\r\nDRAM verified\r\n"); |
| 405 | } |
| 406 | |
| 407 | |
| 408 | void ramcheck(unsigned long start, unsigned long stop) |
| 409 | { |
| 410 | int result; |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | |
| 416 | print_debug("Testing DRAM : "); |
| 417 | print_debug_hex32(start); |
| 418 | print_debug("-"); |
| 419 | print_debug_hex32(stop); |
| 420 | print_debug("\r\n"); |
| 421 | ram_fill(start, stop); |
| 422 | ram_verify(start, stop); |
| 423 | print_debug("Done.\n"); |
| 424 | } |
| 425 | # 8 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2 |
| 426 | |
| 427 | static void die(const char *str) |
| 428 | { |
| 429 | print_emerg(str); |
| 430 | do { |
| 431 | hlt(); |
| 432 | } while(1); |
| 433 | } |
| 434 | |
| 435 | |
| 436 | |
| 437 | |
| 438 | static void sdram_set_registers(void) |
| 439 | { |
| 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, |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 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, |
| 456 | |
| 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, |
| 481 | |
| 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, |
| 500 | |
| 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, |
| 504 | |
| 505 | |
| 506 | |
| 507 | |
| 508 | |
| 509 | |
| 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, |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | |
| 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, |
| 538 | (4 << 25)|(0 << 24)| |
| 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, |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((3) & 0x07) << 8) | ((0x60) & 0xFF)), 0xffffff00, 0x00000000, |
| 558 | }; |
| 559 | int i; |
| 560 | int max; |
| 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) { |
| 564 | unsigned long reg; |
| 565 | |
| 566 | |
| 567 | |
| 568 | |
| 569 | |
| 570 | |
| 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); |
| 575 | } |
| 576 | print_debug("done.\r\n"); |
| 577 | } |
| 578 | # 743 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" |
| 579 | static void sdram_set_spd_registers(void) |
| 580 | { |
| 581 | unsigned long dcl; |
| 582 | dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF))); |
| 583 | |
| 584 | dcl &= ~(1<<17); |
| 585 | pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)), dcl); |
| 586 | } |
| 587 | |
| 588 | |
| 589 | static void sdram_enable(void) |
| 590 | { |
| 591 | unsigned long dcl; |
| 592 | |
| 593 | |
| 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); |
| 597 | print_debug("\r\n"); |
| 598 | dcl |= (1<<3); |
| 599 | pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)), dcl); |
| 600 | dcl &= ~(1<<3); |
| 601 | dcl &= ~(1<<0); |
| 602 | dcl &= ~(1<<1); |
| 603 | dcl &= ~(1<<2); |
| 604 | dcl |= (1<<8); |
| 605 | pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF)), dcl); |
| 606 | |
| 607 | print_debug("Initializing memory: "); |
| 608 | int loops = 0; |
| 609 | do { |
| 610 | dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x07) << 8) | ((0x90) & 0xFF))); |
| 611 | loops += 1; |
| 612 | if ((loops & 1023) == 0) { |
| 613 | print_debug("."); |
| 614 | } |
| 615 | } while(((dcl & (1<<8)) != 0) && (loops < 300000)); |
| 616 | if (loops >= 300000) { |
| 617 | print_debug(" failed\r\n"); |
| 618 | } else { |
| 619 | print_debug(" done\r\n"); |
| 620 | } |
| 621 | # 803 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" |
| 622 | } |
| 623 | |
| 624 | static void sdram_first_normal_reference(void) {} |
| 625 | static void sdram_enable_refresh(void) {} |
| 626 | static void sdram_special_finishup(void) {} |
| 627 | |
| 628 | # 1 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/sdram/generic_sdram.c" 1 |
| 629 | void sdram_no_memory(void) |
| 630 | { |
| 631 | print_err("No memory!!\r\n"); |
| 632 | while(1) { |
| 633 | hlt(); |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | |
| 638 | void sdram_initialize(void) |
| 639 | { |
| 640 | print_debug("Ram1\r\n"); |
| 641 | |
| 642 | sdram_set_registers(); |
| 643 | |
| 644 | print_debug("Ram2\r\n"); |
| 645 | |
| 646 | sdram_set_spd_registers(); |
| 647 | |
| 648 | print_debug("Ram3\r\n"); |
| 649 | |
| 650 | |
| 651 | |
| 652 | |
| 653 | sdram_enable(); |
| 654 | |
| 655 | print_debug("Ram4\r\n"); |
| 656 | sdram_first_normal_reference(); |
| 657 | |
| 658 | print_debug("Ram5\r\n"); |
| 659 | sdram_enable_refresh(); |
| 660 | sdram_special_finishup(); |
| 661 | |
| 662 | print_debug("Ram6\r\n"); |
| 663 | } |
| 664 | # 810 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" 2 |
| 665 | |
| 666 | static int boot_cpu(void) |
| 667 | { |
| 668 | volatile unsigned long *local_apic; |
| 669 | unsigned long apic_id; |
| 670 | int bsp; |
| 671 | msr_t msr; |
| 672 | msr = rdmsr(0x1b); |
| 673 | bsp = !!(msr.lo & (1 << 8)); |
| 674 | if (bsp) { |
| 675 | print_debug("Bootstrap cpu\r\n"); |
| 676 | } |
| 677 | |
| 678 | return bsp; |
| 679 | } |
| 680 | |
| 681 | static int cpu_init_detected(void) |
| 682 | { |
| 683 | unsigned long dcl; |
| 684 | int cpu_init; |
| 685 | |
| 686 | unsigned long htic; |
| 687 | |
| 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)); |
| 691 | if (cpu_init) { |
| 692 | print_debug("CPU INIT Detected.\r\n"); |
| 693 | } |
| 694 | return cpu_init; |
| 695 | } |
| 696 | |
| 697 | static void setup_coherent_ht_domain(void) |
| 698 | { |
| 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, |
| 721 | |
| 722 | |
| 723 | |
| 724 | |
| 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, |
| 734 | |
| 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, |
| 759 | |
| 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, |
| 776 | |
| 777 | }; |
| 778 | int i; |
| 779 | int max; |
| 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) { |
| 783 | unsigned long reg; |
| 784 | |
| 785 | |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 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); |
| 794 | } |
| 795 | print_debug("done.\r\n"); |
| 796 | } |
| 797 | |
| 798 | static void enumerate_ht_chain(void) |
| 799 | { |
| 800 | unsigned next_unitid, last_unitid;; |
| 801 | next_unitid = 1; |
| 802 | do { |
| 803 | uint32_t id; |
| 804 | uint8_t hdr_type, pos; |
| 805 | last_unitid = next_unitid; |
| 806 | |
| 807 | id = pci_read_config32(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x00) & 0xFF))); |
| 808 | |
| 809 | if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) || |
| 810 | (((id >> 16) & 0xffff) == 0xffff) || |
| 811 | (((id >> 16) & 0xffff) == 0x0000)) { |
| 812 | break; |
| 813 | } |
| 814 | hdr_type = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x0e) & 0xFF))); |
| 815 | pos = 0; |
| 816 | hdr_type &= 0x7f; |
| 817 | |
| 818 | if ((hdr_type == 0) || |
| 819 | (hdr_type == 1)) { |
| 820 | pos = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((0x34) & 0xFF))); |
| 821 | } |
| 822 | while(pos != 0) { |
| 823 | uint8_t cap; |
| 824 | cap = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((pos + 0) & 0xFF))); |
| 825 | if (cap == 0x08) { |
| 826 | uint16_t flags; |
| 827 | flags = pci_read_config16(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((pos + 2) & 0xFF))); |
| 828 | if ((flags >> 13) == 0) { |
| 829 | unsigned count; |
| 830 | flags &= ~0x1f; |
| 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; |
| 835 | break; |
| 836 | } |
| 837 | } |
| 838 | pos = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x07) << 8) | ((pos + 1) & 0xFF))); |
| 839 | } |
| 840 | } while((last_unitid != next_unitid) && (next_unitid <= 0x1f)); |
| 841 | } |
| 842 | |
| 843 | static void print_pci_devices(void) |
| 844 | { |
| 845 | uint32_t addr; |
| 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))) { |
| 849 | uint32_t id; |
| 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)) { |
| 854 | continue; |
| 855 | } |
| 856 | print_debug("PCI: 00:"); |
| 857 | print_debug_hex8(addr >> 11); |
| 858 | print_debug_char('.'); |
| 859 | print_debug_hex8((addr >> 8) & 7); |
| 860 | print_debug("\r\n"); |
| 861 | } |
| 862 | } |
| 863 | # 1525 "/home/eric/projects/linuxbios/checkin/solo/freebios2/src/mainboard/amd/solo/auto.c" |
| 864 | static void enable_smbus(void) |
| 865 | { |
| 866 | uint32_t addr; |
| 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))) { |
| 870 | uint32_t id; |
| 871 | id = pci_read_config32(addr); |
| 872 | if (id == ((0x746b << 16) | (0x1022))) { |
| 873 | break; |
| 874 | } |
| 875 | } |
| 876 | if (addr > ( (((0) & 0xFF) << 16) | (((0x1f) & 0x1f) << 11) | (((0x7) & 0x07) << 8) | ((0) & 0xFF))) { |
| 877 | die("SMBUS controller not found\r\n"); |
| 878 | } |
| 879 | uint8_t enable; |
| 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)); |
| 884 | } |
| 885 | |
| 886 | |
| 887 | static inline void smbus_delay(void) |
| 888 | { |
| 889 | outb(0x80, 0x80); |
| 890 | } |
| 891 | |
| 892 | static int smbus_wait_until_ready(void) |
| 893 | { |
| 894 | unsigned long loops; |
| 895 | loops = (100*1000*10); |
| 896 | do { |
| 897 | unsigned short val; |
| 898 | smbus_delay(); |
| 899 | val = inw(0x1000 + 0xe0); |
| 900 | if ((val & 0x800) == 0) { |
| 901 | break; |
| 902 | } |
| 903 | } while(--loops); |
| 904 | return loops?0:-1; |
| 905 | } |
| 906 | |
| 907 | static int smbus_wait_until_done(void) |
| 908 | { |
| 909 | unsigned long loops; |
| 910 | loops = (100*1000*10); |
| 911 | do { |
| 912 | unsigned short val; |
| 913 | smbus_delay(); |
| 914 | |
| 915 | val = inw(0x1000 + 0xe0); |
| 916 | if (((val & 0x8) == 0) || ((val & 0x437) != 0)) { |
| 917 | break; |
| 918 | } |
| 919 | } while(--loops); |
| 920 | return loops?0:-1; |
| 921 | } |
| 922 | |
| 923 | static int smbus_read_byte(unsigned device, unsigned address) |
| 924 | { |
| 925 | unsigned char global_control_register; |
| 926 | unsigned char global_status_register; |
| 927 | unsigned char byte; |
| 928 | |
| 929 | if (smbus_wait_until_ready() < 0) { |
| 930 | return -1; |
| 931 | } |
| 932 | |
| 933 | |
| 934 | |
| 935 | outw(inw(0x1000 + 0xe2) & ~((1<<10)|(1<<9)|(1<<8)|(1<<4)), 0x1000 + 0xe2); |
| 936 | |
| 937 | outw(((device & 0x7f) << 1) | 1, 0x1000 + 0xe4); |
| 938 | |
| 939 | outb(address & 0xFF, 0x1000 + 0xe8); |
| 940 | |
| 941 | outw((inw(0x1000 + 0xe2) & ~7) | (0x2), 0x1000 + 0xe2); |
| 942 | |
| 943 | |
| 944 | |
| 945 | outw(inw(0x1000 + 0xe0), 0x1000 + 0xe0); |
| 946 | |
| 947 | |
| 948 | outw(0, 0x1000 + 0xe6); |
| 949 | |
| 950 | |
| 951 | outw((inw(0x1000 + 0xe2) | (1 << 3)), 0x1000 + 0xe2); |
| 952 | |
| 953 | |
| 954 | |
| 955 | if (smbus_wait_until_done() < 0) { |
| 956 | return -1; |
| 957 | } |
| 958 | |
| 959 | global_status_register = inw(0x1000 + 0xe0); |
| 960 | |
| 961 | |
| 962 | byte = inw(0x1000 + 0xe6) & 0xff; |
| 963 | |
| 964 | if (global_status_register != (1 << 4)) { |
| 965 | return -1; |
| 966 | } |
| 967 | return byte; |
| 968 | } |
| 969 | |
| 970 | static void dump_spd_registers(void) |
| 971 | { |
| 972 | unsigned device; |
| 973 | device = (0xa << 3); |
| 974 | print_debug("\r\n"); |
| 975 | while(device <= ((0xa << 3) +1)) { |
| 976 | int i; |
| 977 | print_debug("dimm: "); |
| 978 | print_debug_hex8(device); |
| 979 | for(i = 0; i < 256; i++) { |
| 980 | int status; |
| 981 | unsigned char byte; |
| 982 | if ((i & 0xf) == 0) { |
| 983 | print_debug("\r\n"); |
| 984 | print_debug_hex8(i); |
| 985 | print_debug(": "); |
| 986 | } |
| 987 | status = smbus_read_byte(device, i); |
| 988 | if (status < 0) { |
| 989 | print_debug("bad device\r\n"); |
| 990 | continue; |
| 991 | } |
| 992 | byte = status & 0xff; |
| 993 | print_debug_hex8(byte); |
| 994 | print_debug_char(' '); |
| 995 | } |
| 996 | device += 1; |
| 997 | print_debug("\r\n"); |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | static void dump_spd_registers1(void) |
| 1002 | { |
| 1003 | int i; |
| 1004 | print_debug("dimm: "); |
| 1005 | print_debug_hex8((0xa << 3)); |
| 1006 | for(i = 0; i < 256; i++) { |
| 1007 | int status; |
| 1008 | unsigned char byte; |
| 1009 | if ((i & 0xf) == 0) { |
| 1010 | print_debug("\r\n"); |
| 1011 | print_debug_hex8(i); |
| 1012 | print_debug(": "); |
| 1013 | } |
| 1014 | status = smbus_read_byte((0xa << 3), i); |
| 1015 | if (status < 0) { |
| 1016 | print_debug("bad device\r\n"); |
| 1017 | break; |
| 1018 | } |
| 1019 | byte = status & 0xff; |
| 1020 | print_debug_hex8(byte); |
| 1021 | print_debug_char(' '); |
| 1022 | } |
| 1023 | print_debug("\r\n"); |
| 1024 | } |
| 1025 | |
| 1026 | |
| 1027 | |
| 1028 | static void dump_spd_registers2(void) |
| 1029 | { |
| 1030 | unsigned dev; |
| 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); |
| 1035 | int status; |
| 1036 | unsigned char byte; |
| 1037 | status = smbus_read_byte(dev, 0); |
| 1038 | if (status < 0) { |
| 1039 | print_debug("bad device\r\n"); |
| 1040 | continue; |
| 1041 | } |
| 1042 | byte = status & 0xff; |
| 1043 | print_debug_hex8(byte); |
| 1044 | print_debug("\r\n"); |
| 1045 | } |
| 1046 | } |
| 1047 | |
| 1048 | static void main(void) |
| 1049 | { |
| 1050 | uart_init(); |
| 1051 | console_init(); |
| 1052 | if (boot_cpu() && !cpu_init_detected()) { |
| 1053 | setup_coherent_ht_domain(); |
| 1054 | enumerate_ht_chain(); |
| 1055 | print_pci_devices(); |
| 1056 | enable_smbus(); |
| 1057 | sdram_initialize(); |
| 1058 | |
| 1059 | |
| 1060 | |
| 1061 | dump_spd_registers1(); |
| 1062 | dump_spd_registers2(); |
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | ram_fill( 0x00000000, 0x00001000); |
| 1069 | ram_verify(0x00000000, 0x00001000); |
| 1070 | |
| 1071 | |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | } |
| 1076 | } |