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