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