f8f12855d28dcd749dd5da26081cd857feccecea
[coreboot.git] / src / mainboard / amd / mahogany_fam10 / apc_auto.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2010 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #define ASSEMBLY 1
21 #define __PRE_RAM__
22
23 #define RAMINIT_SYSINFO 1
24 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
25
26 #define SET_NB_CFG_54 1
27
28 //used by raminit
29 #define QRANK_DIMM_SUPPORT 1
30
31 #include <stdint.h>
32 #include <device/pci_def.h>
33 #include <device/pci_ids.h>
34 #include <arch/io.h>
35 #include <device/pnp_def.h>
36 #include <arch/romcc_io.h>
37 #include <cpu/x86/lapic.h>
38 #include "option_table.h"
39 #include "pc80/mc146818rtc_early.c"
40 #include "pc80/serial.c"
41 #if CONFIG_USE_INIT == 0
42         #include "lib/memcpy.c"
43 #endif
44 #include "arch/i386/lib/console.c"
45
46 #include <cpu/amd/model_10xxx_rev.h>
47 #include "northbridge/amd/amdfam10/raminit.h"
48 #include "cpu/amd/model_fxx/apic_timer.c"
49
50 #include "lib/delay.c"
51
52 #if NODE_NUMS == 64
53          #define NODE_PCI(x,fn) ((x<32)?PCI_DEV(CONFIG_CBB,CONFIG_CDB+x,fn):PCI_DEV(CONFIG_CBB-1, CONFIG_CDB+x-32, fn))
54 #else
55          #define NODE_PCI(x, fn) PCI_DEV(CONFIG_CBB,CONFIG_CDB+x,fn)
56 #endif
57
58 //#include "cpu/x86/lapic/boot_cpu.c"
59 #include "northbridge/amd/amdfam10/reset_test.c"
60 #include "northbridge/amd/amdfam10/debug.c"
61 #include "southbridge/amd/amd8111/amd8111_early_ctrl.c"
62 #include "northbridge/amd/amdfam10/amdfam10.h"
63
64 #include "cpu/x86/mtrr.h"
65 #include "cpu/amd/mtrr.h"
66 #include "cpu/x86/tsc.h"
67
68 #include "northbridge/amd/amdfam10/amdfam10_pci.c"
69 #include "northbridge/amd/amdfam10/amdfam10_conf.c"
70 #include "northbridge/amd/amdfam10/raminit_ddr2_dqs.c"
71
72 #include "cpu/amd/quadcore/quadcore.c"
73
74 void hardwaremain(int ret_addr)
75 {
76         struct sys_info *sysinfo = (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in CACHE
77         struct sys_info *sysinfox = ((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in RAM
78
79         struct node_core_id id;
80
81         id = get_node_core_id_x();
82
83         printk_debug("CODE IN CACHE ON NODE: %02x\n");
84
85         train_ram(id.nodeid, sysinfo, sysinfox);
86
87         /* go back, but can not use stack any more, because we only keep
88         ret_addr and can not restore esp, and ebp */
89
90         __asm__ volatile (
91                 "movl   %0, %%edi\n\t"
92                 "jmp      *%%edi\n\t"
93                 :: "a"(ret_addr)
94         );
95
96
97
98 }
99
100 #include <arch/registers.h>
101
102 void x86_exception(struct eregs *info)
103 {
104         do {
105                 hlt();
106         } while(1);
107 }
108
109