51902b4bbbbb386ae473c3a3b90515951b04dcd2
[coreboot.git] / src / mainboard / gigabyte / ga_2761gxdk / ap_romstage.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 __PRE_RAM__
26
27 #define K8_REV_F_SUPPORT_F0_F1_WORKAROUND 0
28
29 #include <stdint.h>
30 #include <device/pci_def.h>
31 #include <device/pci_ids.h>
32 #include <arch/io.h>
33 #include <device/pnp_def.h>
34 #include <arch/romcc_io.h>
35 #include <cpu/x86/lapic.h>
36 #include <pc80/mc146818rtc.h>
37
38 #include "lib/uart8250.c"
39 #include "arch/x86/lib/printk_init.c"
40 #include "console/vtxprintf.c"
41 #include "console/console.c"
42
43 #include <cpu/amd/model_fxx_rev.h>
44 #include "northbridge/amd/amdk8/raminit.h"
45 #include "cpu/amd/model_fxx/apic_timer.c"
46
47 #include "lib/delay.c"
48
49 //#include "cpu/x86/lapic/boot_cpu.c"
50 #include "northbridge/amd/amdk8/reset_test.c"
51
52 #include "northbridge/amd/amdk8/debug.c"
53
54 #include "southbridge/sis/sis966/sis966_early_ctrl.c"
55
56 #include "northbridge/amd/amdk8/amdk8_f.h"
57
58 #include "cpu/x86/mtrr.h"
59 #include "cpu/amd/mtrr.h"
60 #include "cpu/x86/tsc.h"
61
62 #include "northbridge/amd/amdk8/amdk8_f_pci.c"
63 #include "northbridge/amd/amdk8/raminit_f_dqs.c"
64
65 #include "cpu/amd/dualcore/dualcore.c"
66
67 void hardwaremain(int ret_addr)
68 {
69         struct sys_info *sysinfo = (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in CACHE
70         struct sys_info *sysinfox = ((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in RAM
71
72         struct node_core_id id;
73
74         id = get_node_core_id_x();
75
76         //FIXME: for USBDEBUG you need to make sure dbg_info get assigned in AP
77         print_debug("CODE IN CACHE ON NODE:"); print_debug_hex8(id.nodeid); print_debug("\n");
78
79         train_ram(id.nodeid, sysinfo, sysinfox);
80
81         /*
82                 go back, but can not use stack any more, because we only keep ret_addr and can not restore esp, and ebp
83         */
84
85         __asm__ volatile (
86                 "movl  %0, %%edi\n\t"
87                 "jmp     *%%edi\n\t"
88                 :: "a"(ret_addr)
89         );
90
91
92
93 }
94
95 #include <arch/registers.h>
96
97 void x86_exception(struct eregs *info)
98 {
99         do {
100                 hlt();
101         } while(1);
102 }
103
104