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