8e8b73bd2a413b61e407167b4d2ae2816a551d76
[coreboot.git] / src / mainboard / supermicro / h8dmr / 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 #define __PRE_RAM__
24
25 #define RAMINIT_SYSINFO 1
26
27 #define SET_NB_CFG_54 1
28
29 //used by raminit
30 #define QRANK_DIMM_SUPPORT 1
31
32 #define K8_REV_F_SUPPORT_F0_F1_WORKAROUND 0
33
34 #include <stdint.h>
35 #include <device/pci_def.h>
36 #include <device/pci_ids.h>
37 #include <arch/io.h>
38 #include <device/pnp_def.h>
39 #include <arch/romcc_io.h>
40 #include <cpu/x86/lapic.h>
41 #include <pc80/mc146818rtc.h>
42 #include "pc80/serial.c"
43
44 #include "console/console.c"
45 #include "lib/uart8250.c"
46 #include "console/vtxprintf.c"
47 #include "./arch/i386/lib/printk_init.c"
48
49 #include <cpu/amd/model_fxx_rev.h>
50 #include "northbridge/amd/amdk8/raminit.h"
51 #include "cpu/amd/model_fxx/apic_timer.c"
52
53 #include "lib/delay.c"
54
55 //#include "cpu/x86/lapic/boot_cpu.c"
56 #include "northbridge/amd/amdk8/reset_test.c"
57
58 #include "northbridge/amd/amdk8/debug.c"
59
60 #include "southbridge/nvidia/mcp55/mcp55_early_ctrl.c"
61
62 #include "northbridge/amd/amdk8/amdk8_f.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/amdk8/amdk8_f_pci.c"
69 #include "northbridge/amd/amdk8/raminit_f_dqs.c"
70
71 static inline unsigned get_nodes(void)
72 {
73         return ((pci_read_config32(PCI_DEV(0, 0x18, 0), 0x60)>>4) & 7) + 1;
74 }
75
76 #include "cpu/amd/dualcore/dualcore.c"
77
78 void hardwaremain(int ret_addr)
79 {
80         struct sys_info *sysinfo = (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in CACHE
81         struct sys_info *sysinfox = ((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in RAM
82
83         struct node_core_id id;
84
85         id = get_node_core_id_x();
86
87         print_debug("CODE IN CACHE ON NODE:"); print_debug_hex8(id.nodeid); print_debug("\n");
88
89         train_ram(id.nodeid, sysinfo, sysinfox);
90
91         /*
92                 go back, but can not use stack any more, because we only keep ret_addr and can not restore esp, and ebp
93         */
94
95         __asm__ volatile (
96                 "movl  %0, %%edi\n\t"
97                 "jmp     *%%edi\n\t"
98                 :: "a"(ret_addr)
99         );
100
101
102
103 }
104
105 #include <arch/registers.h>
106
107 void x86_exception(struct eregs *info)
108 {
109         do {
110                 hlt();
111         } while(1);
112 }
113
114