janitor task: unify and cleanup naming.
[coreboot.git] / src / mainboard / supermicro / h8dmr / apc_auto.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 AMD
5  * Written by Yinghai Lu <yinghailu@amd.com> for AMD.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20  */
21
22 #define ASSEMBLY 1
23 #define __PRE_RAM__
24
25 #define RAMINIT_SYSINFO 1
26 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
27
28 #define SET_NB_CFG_54 1 
29
30 //used by raminit
31 #define QRANK_DIMM_SUPPORT 1
32
33 #define K8_REV_F_SUPPORT_F0_F1_WORKAROUND 0
34
35 #include <stdint.h>
36 #include <device/pci_def.h>
37 #include <device/pci_ids.h>
38 #include <arch/io.h>
39 #include <device/pnp_def.h>
40 #include <arch/romcc_io.h>
41 #include <cpu/x86/lapic.h>
42 #include "option_table.h"
43 #include "pc80/mc146818rtc_early.c"
44 #include "pc80/serial.c"
45
46 #if CONFIG_USE_INIT == 0
47         #include "lib/memcpy.c"
48 #endif
49
50 #include "arch/i386/lib/console.c"
51 #include "lib/uart8250.c"
52 #include "console/vtxprintf.c"
53 #include "./arch/i386/lib/printk_init.c"
54
55 #if 0 
56 static void post_code(uint8_t value) {
57 #if 1
58         int i;
59         for(i=0;i<0x80000;i++) {
60                 outb(value, 0x80);
61         }
62 #endif
63 }
64 #endif
65
66 #include <cpu/amd/model_fxx_rev.h>
67 #include "northbridge/amd/amdk8/raminit.h"
68 #include "cpu/amd/model_fxx/apic_timer.c"
69
70 #include "lib/delay.c"
71
72 //#include "cpu/x86/lapic/boot_cpu.c"
73 #include "northbridge/amd/amdk8/reset_test.c"
74
75 #include "northbridge/amd/amdk8/debug.c"
76
77 #include "southbridge/nvidia/mcp55/mcp55_early_ctrl.c"
78
79 #include "northbridge/amd/amdk8/amdk8_f.h"
80
81 #include "cpu/x86/mtrr.h"
82 #include "cpu/amd/mtrr.h"
83 #include "cpu/x86/tsc.h"
84
85 #include "northbridge/amd/amdk8/amdk8_f_pci.c"
86 #include "northbridge/amd/amdk8/raminit_f_dqs.c"
87
88 static inline unsigned get_nodes(void)
89 {
90         return ((pci_read_config32(PCI_DEV(0, 0x18, 0), 0x60)>>4) & 7) + 1;
91 }
92
93 #include "cpu/amd/dualcore/dualcore.c"
94
95 void hardwaremain(int ret_addr)
96 {
97         struct sys_info *sysinfo = (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in CACHE
98         struct sys_info *sysinfox = ((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in RAM
99
100         struct node_core_id id;
101
102         id = get_node_core_id_x();
103
104         print_debug("CODE IN CACHE ON NODE:"); print_debug_hex8(id.nodeid); print_debug("\r\n");
105
106         train_ram(id.nodeid, sysinfo, sysinfox);
107
108         /*
109                 go back, but can not use stack any more, because we only keep ret_addr and can not restore esp, and ebp
110         */
111
112         __asm__ volatile (
113                 "movl  %0, %%edi\n\t"
114                 "jmp     *%%edi\n\t"
115                 :: "a"(ret_addr)
116         );
117
118
119
120 }
121
122 #include <arch/registers.h>
123
124 void x86_exception(struct eregs *info)
125 {
126         do {
127                 hlt();
128         } while(1);
129 }
130
131