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