Eric Biederman | f96a810 | 2003-06-16 16:57:34 +0000 | [diff] [blame] | 1 | # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" |
| 2 | # 1 "<built-in>" |
| 3 | # 1 "<command line>" |
| 4 | # 1 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" |
| 5 | |
| 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; |
| 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/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) |
| 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 | # 64 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/arch/i386/include/arch/romcc_io.h" |
| 116 | typedef unsigned device_t; |
| 117 | |
| 118 | static unsigned char pci_read_config8(device_t dev, unsigned where) |
| 119 | { |
| 120 | unsigned addr; |
| 121 | addr = dev | where; |
| 122 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 123 | return inb(0xCFC + (addr & 3)); |
| 124 | } |
| 125 | |
| 126 | static unsigned short pci_read_config16(device_t dev, unsigned where) |
| 127 | { |
| 128 | unsigned addr; |
| 129 | addr = dev | where; |
| 130 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 131 | return inw(0xCFC + (addr & 2)); |
| 132 | } |
| 133 | |
| 134 | static unsigned int pci_read_config32(device_t dev, unsigned where) |
| 135 | { |
| 136 | unsigned addr; |
| 137 | addr = dev | where; |
| 138 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 139 | return inl(0xCFC); |
| 140 | } |
| 141 | |
| 142 | static void pci_write_config8(device_t dev, unsigned where, unsigned char value) |
| 143 | { |
| 144 | unsigned addr; |
| 145 | addr = dev | where; |
| 146 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 147 | outb(value, 0xCFC + (addr & 3)); |
| 148 | } |
| 149 | |
| 150 | static void pci_write_config16(device_t dev, unsigned where, unsigned short value) |
| 151 | { |
| 152 | unsigned addr; |
| 153 | addr = dev | where; |
| 154 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 155 | outw(value, 0xCFC + (addr & 2)); |
| 156 | } |
| 157 | |
| 158 | static void pci_write_config32(device_t dev, unsigned where, unsigned int value) |
| 159 | { |
| 160 | unsigned addr; |
| 161 | addr = dev | where; |
| 162 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 163 | outl(value, 0xCFC); |
| 164 | } |
| 165 | |
| 166 | |
| 167 | static device_t pci_locate_device(unsigned pci_id, device_t dev) |
| 168 | { |
| 169 | for(; dev <= ( (((255) & 0xFF) << 16) | (((31) & 0x1f) << 11) | (((7) & 0x7) << 8)); dev += ( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((1) & 0x7) << 8))) { |
| 170 | unsigned int id; |
| 171 | id = pci_read_config32(dev, 0); |
| 172 | if (id == pci_id) { |
| 173 | return dev; |
| 174 | } |
| 175 | } |
| 176 | return (0xffffffffU); |
| 177 | } |
| 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) |
| 184 | { |
| 185 | return inb(0x3f8 + 0x05) & 0x20; |
| 186 | } |
| 187 | |
| 188 | static void uart_wait_to_tx_byte(void) |
| 189 | { |
| 190 | while(!uart_can_tx_byte()) |
| 191 | ; |
| 192 | } |
| 193 | |
| 194 | static void uart_wait_until_sent(void) |
| 195 | { |
| 196 | while(!(inb(0x3f8 + 0x05) & 0x40)) |
| 197 | ; |
| 198 | } |
| 199 | |
| 200 | static void uart_tx_byte(unsigned char data) |
| 201 | { |
| 202 | uart_wait_to_tx_byte(); |
| 203 | outb(data, 0x3f8 + 0x00); |
| 204 | |
| 205 | uart_wait_until_sent(); |
| 206 | } |
| 207 | |
| 208 | static void uart_init(void) |
| 209 | { |
| 210 | |
| 211 | outb(0x0, 0x3f8 + 0x01); |
| 212 | |
| 213 | outb(0x01, 0x3f8 + 0x02); |
| 214 | |
| 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); |
| 219 | |
| 220 | outb(0x3, 0x3f8 + 0x03); |
| 221 | } |
| 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 |
| 226 | |
| 227 | static void __console_tx_byte(unsigned char byte) |
| 228 | { |
| 229 | uart_tx_byte(byte); |
| 230 | } |
| 231 | |
| 232 | static void __console_tx_nibble(unsigned nibble) |
| 233 | { |
| 234 | unsigned char digit; |
| 235 | digit = nibble + '0'; |
| 236 | if (digit > '9') { |
| 237 | digit += 39; |
| 238 | } |
| 239 | __console_tx_byte(digit); |
| 240 | } |
| 241 | |
| 242 | static void __console_tx_char(int loglevel, unsigned char byte) |
| 243 | { |
| 244 | if (8 > loglevel) { |
| 245 | uart_tx_byte(byte); |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | static void __console_tx_hex8(int loglevel, unsigned char value) |
| 250 | { |
| 251 | if (8 > loglevel) { |
| 252 | __console_tx_nibble((value >> 4U) & 0x0fU); |
| 253 | __console_tx_nibble(value & 0x0fU); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | static void __console_tx_hex16(int loglevel, unsigned short value) |
| 258 | { |
| 259 | if (8 > loglevel) { |
| 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); |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | static void __console_tx_hex32(int loglevel, unsigned int value) |
| 268 | { |
| 269 | if (8 > loglevel) { |
| 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); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | static void __console_tx_string(int loglevel, const char *str) |
| 282 | { |
| 283 | if (8 > loglevel) { |
| 284 | unsigned char ch; |
| 285 | while((ch = *str++) != '\0') { |
| 286 | __console_tx_byte(ch); |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
| 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); } |
| 296 | |
| 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); } |
| 302 | |
| 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); } |
| 308 | |
| 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); } |
| 314 | |
| 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); } |
| 320 | |
| 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); } |
| 326 | |
| 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); } |
| 332 | |
| 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); } |
| 338 | |
| 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) |
| 346 | { |
| 347 | static const char console_test[] = |
| 348 | "\r\n\r\nLinuxBIOS-" |
| 349 | "1.1.0" |
| 350 | ".0Fallback" |
| 351 | " " |
| 352 | "Fri Jun 13 21:02:41 MDT 2003" |
| 353 | " starting...\r\n"; |
| 354 | print_info(console_test); |
| 355 | } |
| 356 | |
| 357 | |
| 358 | static void die(const char *str) |
| 359 | { |
| 360 | print_emerg(str); |
| 361 | do { |
| 362 | hlt(); |
| 363 | } while(1); |
| 364 | } |
| 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) |
| 368 | { |
| 369 | volatile unsigned long *ptr; |
| 370 | ptr = (void *)addr; |
| 371 | *ptr = value; |
| 372 | } |
| 373 | |
| 374 | static unsigned long read_phys(unsigned long addr) |
| 375 | { |
| 376 | volatile unsigned long *ptr; |
| 377 | ptr = (void *)addr; |
| 378 | return *ptr; |
| 379 | } |
| 380 | |
| 381 | void ram_fill(unsigned long start, unsigned long stop) |
| 382 | { |
| 383 | unsigned long addr; |
| 384 | |
| 385 | |
| 386 | |
| 387 | print_debug("DRAM fill: "); |
| 388 | print_debug_hex32(start); |
| 389 | print_debug("-"); |
| 390 | print_debug_hex32(stop); |
| 391 | print_debug("\r\n"); |
| 392 | for(addr = start; addr < stop ; addr += 4) { |
| 393 | |
| 394 | if ((addr & 0xffff) == 0) { |
| 395 | print_debug_hex32(addr); |
| 396 | print_debug("\r"); |
| 397 | } |
| 398 | write_phys(addr, addr); |
| 399 | }; |
| 400 | |
| 401 | print_debug_hex32(addr); |
| 402 | print_debug("\r\nDRAM filled\r\n"); |
| 403 | } |
| 404 | |
| 405 | void ram_verify(unsigned long start, unsigned long stop) |
| 406 | { |
| 407 | unsigned long addr; |
| 408 | |
| 409 | |
| 410 | |
| 411 | print_debug("DRAM verify: "); |
| 412 | print_debug_hex32(start); |
| 413 | print_debug_char('-'); |
| 414 | print_debug_hex32(stop); |
| 415 | print_debug("\r\n"); |
| 416 | for(addr = start; addr < stop ; addr += 4) { |
| 417 | unsigned long value; |
| 418 | |
| 419 | if ((addr & 0xffff) == 0) { |
| 420 | print_debug_hex32(addr); |
| 421 | print_debug("\r"); |
| 422 | } |
| 423 | value = read_phys(addr); |
| 424 | if (value != addr) { |
| 425 | |
| 426 | print_err_hex32(addr); |
| 427 | print_err_char(':'); |
| 428 | print_err_hex32(value); |
| 429 | print_err("\r\n"); |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | print_debug_hex32(addr); |
| 434 | print_debug("\r\nDRAM verified\r\n"); |
| 435 | } |
| 436 | |
| 437 | |
| 438 | void ram_check(unsigned long start, unsigned long stop) |
| 439 | { |
| 440 | int result; |
| 441 | |
| 442 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | print_debug("Testing DRAM : "); |
| 447 | print_debug_hex32(start); |
| 448 | print_debug("-"); |
| 449 | print_debug_hex32(stop); |
| 450 | print_debug("\r\n"); |
| 451 | ram_fill(start, stop); |
| 452 | ram_verify(start, stop); |
| 453 | print_debug("Done.\n"); |
| 454 | } |
| 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) |
| 458 | { |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | unsigned next_unitid, last_unitid;; |
| 465 | next_unitid = 1; |
| 466 | do { |
| 467 | uint32_t id; |
| 468 | uint8_t hdr_type, pos; |
| 469 | last_unitid = next_unitid; |
| 470 | |
| 471 | id = pci_read_config32(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), 0x00); |
| 472 | |
| 473 | if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) || |
| 474 | (((id >> 16) & 0xffff) == 0xffff) || |
| 475 | (((id >> 16) & 0xffff) == 0x0000)) { |
| 476 | break; |
| 477 | } |
| 478 | hdr_type = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), 0x0e); |
| 479 | pos = 0; |
| 480 | hdr_type &= 0x7f; |
| 481 | |
| 482 | if ((hdr_type == 0) || |
| 483 | (hdr_type == 1)) { |
| 484 | pos = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), 0x34); |
| 485 | } |
| 486 | while(pos != 0) { |
| 487 | uint8_t cap; |
| 488 | cap = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), pos + 0); |
| 489 | if (cap == 0x08) { |
| 490 | uint16_t flags; |
| 491 | flags = pci_read_config16(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), pos + 2); |
| 492 | if ((flags >> 13) == 0) { |
| 493 | unsigned count; |
| 494 | flags &= ~0x1f; |
| 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; |
| 499 | break; |
| 500 | } |
| 501 | } |
| 502 | pos = pci_read_config8(( (((0) & 0xFF) << 16) | (((0) & 0x1f) << 11) | (((0) & 0x7) << 8)), pos + 1); |
| 503 | } |
| 504 | } while((last_unitid != next_unitid) && (next_unitid <= 0x1f)); |
| 505 | } |
| 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) |
| 510 | { |
| 511 | device_t dev; |
| 512 | dev = pci_locate_device(((((0x746b) & 0xFFFF) << 16) | ((0x1022) & 0xFFFF)), 0); |
| 513 | if (dev == (0xffffffffU)) { |
| 514 | die("SMBUS controller not found\r\n"); |
| 515 | } |
| 516 | uint8_t enable; |
| 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)); |
| 521 | } |
| 522 | |
| 523 | |
| 524 | static inline void smbus_delay(void) |
| 525 | { |
| 526 | outb(0x80, 0x80); |
| 527 | } |
| 528 | |
| 529 | static int smbus_wait_until_ready(void) |
| 530 | { |
| 531 | unsigned long loops; |
| 532 | loops = (100*1000*10); |
| 533 | do { |
| 534 | unsigned short val; |
| 535 | smbus_delay(); |
| 536 | val = inw(0x1000 + 0xe0); |
| 537 | if ((val & 0x800) == 0) { |
| 538 | break; |
| 539 | } |
| 540 | } while(--loops); |
| 541 | return loops?0:-1; |
| 542 | } |
| 543 | |
| 544 | static int smbus_wait_until_done(void) |
| 545 | { |
| 546 | unsigned long loops; |
| 547 | loops = (100*1000*10); |
| 548 | do { |
| 549 | unsigned short val; |
| 550 | smbus_delay(); |
| 551 | |
| 552 | val = inw(0x1000 + 0xe0); |
| 553 | if (((val & 0x8) == 0) || ((val & 0x437) != 0)) { |
| 554 | break; |
| 555 | } |
| 556 | } while(--loops); |
| 557 | return loops?0:-1; |
| 558 | } |
| 559 | |
| 560 | static int smbus_read_byte(unsigned device, unsigned address) |
| 561 | { |
| 562 | unsigned char global_control_register; |
| 563 | unsigned char global_status_register; |
| 564 | unsigned char byte; |
| 565 | |
| 566 | if (smbus_wait_until_ready() < 0) { |
| 567 | return -1; |
| 568 | } |
| 569 | |
| 570 | |
| 571 | |
| 572 | outw(inw(0x1000 + 0xe2) & ~((1<<10)|(1<<9)|(1<<8)|(1<<4)), 0x1000 + 0xe2); |
| 573 | |
| 574 | outw(((device & 0x7f) << 1) | 1, 0x1000 + 0xe4); |
| 575 | |
| 576 | outb(address & 0xFF, 0x1000 + 0xe8); |
| 577 | |
| 578 | outw((inw(0x1000 + 0xe2) & ~7) | (0x2), 0x1000 + 0xe2); |
| 579 | |
| 580 | |
| 581 | |
| 582 | outw(inw(0x1000 + 0xe0), 0x1000 + 0xe0); |
| 583 | |
| 584 | |
| 585 | outw(0, 0x1000 + 0xe6); |
| 586 | |
| 587 | |
| 588 | outw((inw(0x1000 + 0xe2) | (1 << 3)), 0x1000 + 0xe2); |
| 589 | |
| 590 | |
| 591 | |
| 592 | if (smbus_wait_until_done() < 0) { |
| 593 | return -1; |
| 594 | } |
| 595 | |
| 596 | global_status_register = inw(0x1000 + 0xe0); |
| 597 | |
| 598 | |
| 599 | byte = inw(0x1000 + 0xe6) & 0xff; |
| 600 | |
| 601 | if (global_status_register != (1 << 4)) { |
| 602 | return -1; |
| 603 | } |
| 604 | return byte; |
| 605 | } |
| 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) |
| 610 | { |
| 611 | int i; |
| 612 | print_debug("setting up resource map....\r\n"); |
| 613 | for(i = 0; i < max; i += 3) { |
| 614 | device_t dev; |
| 615 | unsigned where; |
| 616 | unsigned long reg; |
| 617 | |
| 618 | |
| 619 | |
| 620 | |
| 621 | |
| 622 | |
| 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); |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | } |
| 636 | print_debug("done.\r\n"); |
| 637 | } |
| 638 | |
| 639 | static void setup_default_resource_map(void) |
| 640 | { |
| 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, |
| 693 | }; |
| 694 | int max; |
| 695 | max = sizeof(register_values)/sizeof(register_values[0]); |
| 696 | setup_resource_map(register_values, max); |
| 697 | } |
| 698 | |
| 699 | static void sdram_set_registers(void) |
| 700 | { |
| 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, |
| 705 | |
| 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, |
| 762 | |
| 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, |
| 772 | |
| 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, |
| 785 | (4 << 25)|(0 << 24)| |
| 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, |
| 799 | |
| 800 | |
| 801 | |
| 802 | |
| 803 | |
| 804 | ( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((3) & 0x07) << 8) | ((0x60) & 0xFF)), 0xffffff00, 0x00000000, |
| 805 | }; |
| 806 | int i; |
| 807 | int max; |
| 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) { |
| 811 | device_t dev; |
| 812 | unsigned where; |
| 813 | unsigned long reg; |
| 814 | |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 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); |
| 826 | |
| 827 | |
| 828 | |
| 829 | |
| 830 | |
| 831 | |
| 832 | |
| 833 | } |
| 834 | print_debug("done.\r\n"); |
| 835 | } |
| 836 | # 1132 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c" |
| 837 | static void sdram_set_spd_registers(void) |
| 838 | { |
| 839 | unsigned long dcl; |
| 840 | dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90); |
| 841 | |
| 842 | dcl &= ~(1<<17); |
| 843 | pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90, dcl); |
| 844 | } |
| 845 | |
| 846 | |
| 847 | static void sdram_enable(void) |
| 848 | { |
| 849 | unsigned long dcl; |
| 850 | |
| 851 | |
| 852 | dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90); |
| 853 | print_debug("dcl: "); |
| 854 | print_debug_hex32(dcl); |
| 855 | print_debug("\r\n"); |
| 856 | dcl |= (1<<3); |
| 857 | pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90, dcl); |
| 858 | dcl &= ~(1<<3); |
| 859 | dcl &= ~(1<<0); |
| 860 | dcl &= ~(1<<1); |
| 861 | dcl &= ~(1<<2); |
| 862 | dcl |= (1<<8); |
| 863 | pci_write_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90, dcl); |
| 864 | |
| 865 | print_debug("Initializing memory: "); |
| 866 | int loops = 0; |
| 867 | do { |
| 868 | dcl = pci_read_config32(( (((0) & 0xFF) << 16) | (((0x18) & 0x1f) << 11) | (((2) & 0x7) << 8)), 0x90); |
| 869 | loops += 1; |
| 870 | if ((loops & 1023) == 0) { |
| 871 | print_debug("."); |
| 872 | } |
| 873 | } while(((dcl & (1<<8)) != 0) && (loops < 300000)); |
| 874 | if (loops >= 300000) { |
| 875 | print_debug(" failed\r\n"); |
| 876 | } else { |
| 877 | print_debug(" done\r\n"); |
| 878 | } |
| 879 | # 1192 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/northbridge/amd/amdk8/raminit.c" |
| 880 | } |
| 881 | |
| 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) |
| 889 | { |
| 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, |
| 910 | |
| 911 | |
| 912 | |
| 913 | |
| 914 | |
| 915 | }; |
| 916 | int i; |
| 917 | int max; |
| 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) { |
| 921 | device_t dev; |
| 922 | unsigned where; |
| 923 | unsigned long reg; |
| 924 | |
| 925 | |
| 926 | |
| 927 | |
| 928 | |
| 929 | |
| 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); |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | |
| 941 | |
| 942 | } |
| 943 | print_debug("done.\r\n"); |
| 944 | } |
| 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) |
| 948 | { |
| 949 | print_err("No memory!!\r\n"); |
| 950 | while(1) { |
| 951 | hlt(); |
| 952 | } |
| 953 | } |
| 954 | |
| 955 | |
| 956 | void sdram_initialize(void) |
| 957 | { |
| 958 | print_debug("Ram1\r\n"); |
| 959 | |
| 960 | sdram_set_registers(); |
| 961 | |
| 962 | print_debug("Ram2\r\n"); |
| 963 | |
| 964 | sdram_set_spd_registers(); |
| 965 | |
| 966 | print_debug("Ram3\r\n"); |
| 967 | |
| 968 | |
| 969 | |
| 970 | |
| 971 | sdram_enable(); |
| 972 | |
| 973 | print_debug("Ram4\r\n"); |
| 974 | sdram_first_normal_reference(); |
| 975 | |
| 976 | print_debug("Ram5\r\n"); |
| 977 | sdram_enable_refresh(); |
| 978 | sdram_special_finishup(); |
| 979 | |
| 980 | print_debug("Ram6\r\n"); |
| 981 | } |
| 982 | # 13 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" 2 |
| 983 | |
| 984 | static int boot_cpu(void) |
| 985 | { |
| 986 | volatile unsigned long *local_apic; |
| 987 | unsigned long apic_id; |
| 988 | int bsp; |
| 989 | msr_t msr; |
| 990 | msr = rdmsr(0x1b); |
| 991 | bsp = !!(msr.lo & (1 << 8)); |
| 992 | if (bsp) { |
| 993 | print_debug("Bootstrap cpu\r\n"); |
| 994 | } |
| 995 | |
| 996 | return bsp; |
| 997 | } |
| 998 | |
| 999 | static int cpu_init_detected(void) |
| 1000 | { |
| 1001 | unsigned long dcl; |
| 1002 | int cpu_init; |
| 1003 | |
| 1004 | unsigned long htic; |
| 1005 | |
| 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)); |
| 1009 | if (cpu_init) { |
| 1010 | print_debug("CPU INIT Detected.\r\n"); |
| 1011 | } |
| 1012 | return cpu_init; |
| 1013 | } |
| 1014 | |
| 1015 | |
| 1016 | static void print_pci_devices(void) |
| 1017 | { |
| 1018 | device_t dev; |
| 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))) { |
| 1022 | uint32_t id; |
| 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)) { |
| 1027 | continue; |
| 1028 | } |
| 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"); |
| 1034 | } |
| 1035 | } |
| 1036 | |
| 1037 | |
| 1038 | static void dump_spd_registers(void) |
| 1039 | { |
| 1040 | unsigned device; |
| 1041 | device = (0xa << 3); |
| 1042 | print_debug("\r\n"); |
| 1043 | while(device <= ((0xa << 3) +7)) { |
| 1044 | int i; |
| 1045 | print_debug("dimm: "); |
| 1046 | print_debug_hex8(device); |
| 1047 | for(i = 0; i < 256; i++) { |
| 1048 | int status; |
| 1049 | unsigned char byte; |
| 1050 | if ((i & 0xf) == 0) { |
| 1051 | print_debug("\r\n"); |
| 1052 | print_debug_hex8(i); |
| 1053 | print_debug(": "); |
| 1054 | } |
| 1055 | status = smbus_read_byte(device, i); |
| 1056 | if (status < 0) { |
| 1057 | print_debug("bad device\r\n"); |
| 1058 | break; |
| 1059 | } |
| 1060 | byte = status & 0xff; |
| 1061 | print_debug_hex8(byte); |
| 1062 | print_debug_char(' '); |
| 1063 | } |
| 1064 | device += 1; |
| 1065 | print_debug("\r\n"); |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | static void pnp_write_config(unsigned char port, unsigned char value, unsigned char reg) |
| 1070 | { |
| 1071 | outb(reg, port); |
| 1072 | outb(value, port +1); |
| 1073 | } |
| 1074 | |
| 1075 | static unsigned char pnp_read_config(unsigned char port, unsigned char reg) |
| 1076 | { |
| 1077 | outb(reg, port); |
| 1078 | return inb(port +1); |
| 1079 | } |
| 1080 | |
| 1081 | static void pnp_set_logical_device(unsigned char port, int device) |
| 1082 | { |
| 1083 | pnp_write_config(port, device, 0x07); |
| 1084 | } |
| 1085 | |
| 1086 | static void pnp_set_enable(unsigned char port, int enable) |
| 1087 | { |
| 1088 | pnp_write_config(port, enable?0x1:0x0, 0x30); |
| 1089 | } |
| 1090 | |
| 1091 | static int pnp_read_enable(unsigned char port) |
| 1092 | { |
| 1093 | return !!pnp_read_config(port, 0x30); |
| 1094 | } |
| 1095 | |
| 1096 | static void pnp_set_iobase0(unsigned char port, unsigned iobase) |
| 1097 | { |
| 1098 | pnp_write_config(port, (iobase >> 8) & 0xff, 0x60); |
| 1099 | pnp_write_config(port, iobase & 0xff, 0x61); |
| 1100 | } |
| 1101 | |
| 1102 | static void pnp_set_iobase1(unsigned char port, unsigned iobase) |
| 1103 | { |
| 1104 | pnp_write_config(port, (iobase >> 8) & 0xff, 0x62); |
| 1105 | pnp_write_config(port, iobase & 0xff, 0x63); |
| 1106 | } |
| 1107 | |
| 1108 | static void pnp_set_irq0(unsigned char port, unsigned irq) |
| 1109 | { |
| 1110 | pnp_write_config(port, irq, 0x70); |
| 1111 | } |
| 1112 | |
| 1113 | static void pnp_set_irq1(unsigned char port, unsigned irq) |
| 1114 | { |
| 1115 | pnp_write_config(port, irq, 0x72); |
| 1116 | } |
| 1117 | |
| 1118 | static void pnp_set_drq(unsigned char port, unsigned drq) |
| 1119 | { |
| 1120 | pnp_write_config(port, drq & 0xff, 0x74); |
| 1121 | } |
| 1122 | # 179 "/home/eric/projects/linuxbios/checkin/hdama/freebios2/src/mainboard/arima/hdama/auto.c" |
| 1123 | static void pc87360_enable_serial(void) |
| 1124 | { |
| 1125 | pnp_set_logical_device(0x2e, 0x03); |
| 1126 | pnp_set_enable(0x2e, 1); |
| 1127 | pnp_set_iobase0(0x2e, 0x3f8); |
| 1128 | } |
| 1129 | |
| 1130 | static void main(void) |
| 1131 | { |
| 1132 | pc87360_enable_serial(); |
| 1133 | uart_init(); |
| 1134 | console_init(); |
| 1135 | if (boot_cpu() && !cpu_init_detected()) { |
| 1136 | setup_coherent_ht_domain(); |
| 1137 | enumerate_ht_chain(); |
| 1138 | print_pci_devices(); |
| 1139 | enable_smbus(); |
| 1140 | sdram_initialize(); |
| 1141 | |
| 1142 | dump_spd_registers(); |
| 1143 | |
| 1144 | ram_check(0x00000000, 0x00001000); |
| 1145 | ram_check(0x00000000, 0x00180000); |
| 1146 | } |
| 1147 | } |