3bf3ef4076952f6fd4f857ced3841f9aaf1c7c8f
[coreboot.git] / src / mainboard / msi / ms7260 / apc_auto.c
1 /*
2  * This file is part of the LinuxBIOS 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 __ROMCC__
25
26 #define RAMINIT_SYSINFO 1
27 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
28 #define SET_NB_CFG_54 1                 /* Used by RAM init. */
29 #define QRANK_DIMM_SUPPORT 1
30 #define K8_REV_F_SUPPORT_F0_F1_WORKAROUND 0
31
32 #include <stdint.h>
33 #include <device/pci_def.h>
34 #include <device/pci_ids.h>
35 #include <arch/io.h>
36 #include <device/pnp_def.h>
37 #include <arch/romcc_io.h>
38 #include <cpu/x86/lapic.h>
39 #include "option_table.h"
40 #include "pc80/mc146818rtc_early.c"
41 #include "pc80/serial.c"
42 #if CONFIG_USE_INIT == 0
43 #include "lib/memcpy.c"
44 #endif
45 #include "arch/i386/lib/console.c"
46 #include <cpu/amd/model_fxx_rev.h>
47 #include "northbridge/amd/amdk8/raminit.h"
48 #include "cpu/amd/model_fxx/apic_timer.c"
49 #include "lib/delay.c"
50 /* #include "cpu/x86/lapic/boot_cpu.c" */
51 #include "northbridge/amd/amdk8/reset_test.c"
52 #include "northbridge/amd/amdk8/debug.c"
53 #include "southbridge/nvidia/mcp55/mcp55_early_ctrl.c"
54 #include "northbridge/amd/amdk8/amdk8_f.h"
55 #include "cpu/x86/mtrr.h"
56 #include "cpu/amd/mtrr.h"
57 #include "cpu/x86/tsc.h"
58 #include "northbridge/amd/amdk8/amdk8_f_pci.c"
59 #include "northbridge/amd/amdk8/raminit_f_dqs.c"
60 #include "cpu/amd/dualcore/dualcore.c"
61
62 void hardwaremain(int ret_addr)
63 {
64         struct sys_info *sysinfo = (DCACHE_RAM_BASE + DCACHE_RAM_SIZE -
65                                     DCACHE_RAM_GLOBAL_VAR_SIZE); /* in CACHE */
66         struct sys_info *sysinfox = ((CONFIG_LB_MEM_TOPK << 10) -
67                                      DCACHE_RAM_GLOBAL_VAR_SIZE); /* in RAM */
68         struct node_core_id id;
69
70         id = get_node_core_id_x();
71
72         /* FIXME: For USBDEBUG_DIRECT you need to make sure dbg_info gets
73          * assigned in AP.
74          */
75         print_debug("CODE IN CACHE ON NODE:");
76         print_debug_hex8(id.nodeid);
77         print_debug("\r\n");
78
79         train_ram(id.nodeid, sysinfo, sysinfox);
80
81         /* Go back, but cannot use stack any more, because we only
82          * keep ret_addr and can not restore esp, and ebp.
83          */
84         __asm__ __volatile__(
85                 "movl %0, %%edi\n\t"
86                 "jmp *%%edi\n\t"
87                 : : "a" (ret_addr)
88         );
89 }
90
91 struct eregs {
92         uint32_t eax, ecx, edx, ebx, esp, ebp, esi, edi;
93         uint32_t vector;
94         uint32_t error_code;
95         uint32_t eip;
96         uint32_t cs;
97         uint32_t eflags;
98 };
99
100 void x86_exception(struct eregs *info)
101 {
102         while (1)
103                 hlt();
104 }