6 #include <device/pci_def.h>
8 #include <device/pnp_def.h>
9 #include <arch/romcc_io.h>
10 #include <cpu/x86/lapic.h>
11 #include "option_table.h"
12 #include "pc80/mc146818rtc_early.c"
13 #include "pc80/serial.c"
14 #include "arch/i386/lib/console.c"
15 #include "lib/ramtest.c"
18 static void post_code(uint8_t value) {
21 for(i=0;i<0x80000;i++) {
28 #include "southbridge/intel/i82801er/i82801er_early_smbus.c"
29 #include "northbridge/intel/e7501/raminit.h"
31 #include "cpu/x86/lapic/boot_cpu.c"
32 #include "northbridge/intel/e7501/debug.c"
33 #include "superio/winbond/w83627hf/w83627hf_early_serial.c"
35 #include "cpu/x86/mtrr/earlymtrr.c"
36 #include "cpu/x86/bist.h"
38 #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
40 // FIXME: There's another hard_reset() in reset.c. Why?
41 static void hard_reset(void)
48 static void soft_reset(void)
57 static void memreset_setup(void)
61 static void memreset(int controllers, const struct mem_controller *ctrl)
65 static inline void activate_spd_rom(const struct mem_controller *ctrl)
70 static inline int spd_read_byte(unsigned device, unsigned address)
72 return smbus_read_byte(device, address);
76 #include "northbridge/intel/e7501/raminit.c"
77 #include "northbridge/intel/e7501/reset_test.c"
78 #include "lib/generic_sdram.c"
81 #include "cpu/x86/car/copy_and_run.c"
83 #if CONFIG_USE_FALLBACK_IMAGE == 1
85 #include "southbridge/intel/i82801er/cmos_failover.c"
87 void real_main(unsigned long bist);
89 void amd64_main(unsigned long bist)
91 /* Is this a deliberate reset by the bios */
93 if (bios_reset_detected() && last_boot_normal()) {
96 /* This is the primary cpu how should I boot? */
99 if (do_normal_boot()) {
108 __asm__ volatile ("jmp __normal_image"
110 : "a" (bist) /* inputs */
115 //CPU reset will reset memtroller ???
116 asm volatile ("jmp __cpu_reset"
118 : "a"(bist) /* inputs */
126 void real_main(unsigned long bist)
128 void amd64_main(unsigned long bist)
131 static const struct mem_controller memctrl[] = {
133 .d0 = PCI_DEV(0, 0, 0),
134 .d0f1 = PCI_DEV(0, 0, 1),
135 .channel0 = { (0xa<<3)|0, (0xa<<3)|1, (0xa<<3)|2, 0 },
136 .channel1 = { (0xa<<3)|4, (0xa<<3)|5, (0xa<<3)|6, 0 },
140 unsigned cpu_reset = 0;
144 // early_mtrr_init();
151 w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
155 /* Halt if there was a built in self test failure */
156 report_bist_failure(bist);
158 // setup_s2735_resource_map();
160 if(bios_reset_detected()) {
167 dump_spd_registers(&memctrl[0]);
170 dump_smbus_registers();
174 sdram_initialize(1, memctrl);
181 dump_pci_device(PCI_DEV(0, 0, 0));
187 /* Check value of esp to verify if we have enough rom for stack in Cache as RAM */
194 printk_debug("v_esp=%08x\r\n", v_esp);
196 print_debug("v_esp="); print_debug_hex32(v_esp); print_debug("\r\n");
206 printk_debug("cpu_reset = %08x\r\n",cpu_reset);
208 print_debug("cpu_reset = "); print_debug_hex32(cpu_reset); print_debug("\r\n");
212 print_debug("Clearing initial memory region: ");
214 print_debug("No cache as ram now - ");
216 /* store cpu_reset to ebx */
223 #define CLEAR_FIRST_1M_RAM 1
224 #include "cpu/x86/car/cache_as_ram_post.c"
227 #undef CLEAR_FIRST_1M_RAM
228 #include "cpu/x86/car/cache_as_ram_post.c"
232 /* set new esp */ /* before CONFIG_RAMBASE */
235 ::"a"( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- CONFIG_RAMBASE )
239 unsigned new_cpu_reset;
241 /* get back cpu_reset from ebx */
244 :"=a" (new_cpu_reset)
247 /* We can not go back any more, we lost old stack data in cache as ram*/
248 if(new_cpu_reset==0) {
249 print_debug("Use Ram as Stack now - done\r\n");
252 print_debug("Use Ram as Stack now - \r\n");
255 printk_debug("new_cpu_reset = %08x\r\n", new_cpu_reset);
257 print_debug("new_cpu_reset = "); print_debug_hex32(new_cpu_reset); print_debug("\r\n");
260 #ifdef DEACTIVATE_CAR
261 print_debug("Deactivating CAR");
262 #include DEACTIVATE_CAR_FILE
263 print_debug(" - Done.\r\n");
265 /*copy and execute coreboot_ram */
266 copy_and_run(new_cpu_reset);
267 /* We will not return */
272 print_debug("should not be here -\r\n");