5 #include <device/pci_def.h>
7 #include <device/pnp_def.h>
8 #include <arch/romcc_io.h>
9 #include <cpu/x86/lapic.h>
10 #include "option_table.h"
11 #include "pc80/mc146818rtc_early.c"
12 #include "pc80/serial.c"
13 #include "arch/i386/lib/console.c"
14 #include "ram/ramtest.c"
17 static void post_code(uint8_t value) {
20 for(i=0;i<0x80000;i++) {
27 #include "southbridge/intel/i82801er/i82801er_early_smbus.c"
28 #include "northbridge/intel/e7501/raminit.h"
30 #if CONFIG_USE_INIT == 0
31 #include "lib/memcpy.c"
34 #include "cpu/x86/lapic/boot_cpu.c"
35 #include "northbridge/intel/e7501/debug.c"
36 #include "superio/winbond/w83627hf/w83627hf_early_serial.c"
38 #include "cpu/x86/mtrr/earlymtrr.c"
39 #include "cpu/x86/bist.h"
41 #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
43 static void hard_reset(void)
50 static void soft_reset(void)
59 static void memreset_setup(void)
63 static void memreset(int controllers, const struct mem_controller *ctrl)
67 static inline void activate_spd_rom(const struct mem_controller *ctrl)
72 static inline int spd_read_byte(unsigned device, unsigned address)
74 return smbus_read_byte(device, address);
78 #include "northbridge/intel/e7501/raminit.c"
79 #include "northbridge/intel/e7501/reset_test.c"
80 #include "sdram/generic_sdram.c"
83 #include "cpu/x86/car/copy_and_run.c"
85 #if USE_FALLBACK_IMAGE == 1
87 #include "southbridge/intel/i82801er/cmos_failover.c"
89 void real_main(unsigned long bist);
91 void amd64_main(unsigned long bist)
93 /* Is this a deliberate reset by the bios */
95 if (bios_reset_detected() && last_boot_normal()) {
98 /* This is the primary cpu how should I boot? */
101 if (do_normal_boot()) {
110 __asm__ volatile ("jmp __normal_image"
112 : "a" (bist) /* inputs */
117 //CPU reset will reset memtroller ???
118 asm volatile ("jmp __cpu_reset"
120 : "a"(bist) /* inputs */
128 void real_main(unsigned long bist)
130 void amd64_main(unsigned long bist)
133 static const struct mem_controller memctrl[] = {
135 .d0 = PCI_DEV(0, 0, 0),
136 .d0f1 = PCI_DEV(0, 0, 1),
137 .channel0 = { (0xa<<3)|0, (0xa<<3)|1, (0xa<<3)|2, 0 },
138 .channel1 = { (0xa<<3)|4, (0xa<<3)|5, (0xa<<3)|6, 0 },
142 unsigned cpu_reset = 0;
146 // early_mtrr_init();
153 w83627hf_enable_serial(SERIAL_DEV, TTYS0_BASE);
157 /* Halt if there was a built in self test failure */
158 report_bist_failure(bist);
160 // setup_s2735_resource_map();
162 if(bios_reset_detected()) {
169 dump_spd_registers(&memctrl[0]);
172 dump_smbus_registers();
176 sdram_initialize(1, memctrl);
183 dump_pci_device(PCI_DEV(0, 0, 0));
189 /* Check value of esp to verify if we have enough rom for stack in Cache as RAM */
196 printk_debug("v_esp=%08x\r\n", v_esp);
198 print_debug("v_esp="); print_debug_hex32(v_esp); print_debug("\r\n");
208 printk_debug("cpu_reset = %08x\r\n",cpu_reset);
210 print_debug("cpu_reset = "); print_debug_hex32(cpu_reset); print_debug("\r\n");
214 print_debug("Clearing initial memory region: ");
216 print_debug("No cache as ram now - ");
218 /* store cpu_reset to ebx */
225 #define CLEAR_FIRST_1M_RAM 1
226 #include "cpu/x86/car/cache_as_ram_post.c"
229 #undef CLEAR_FIRST_1M_RAM
230 #include "cpu/x86/car/cache_as_ram_post.c"
234 /* set new esp */ /* before _RAMBASE */
237 ::"a"( (DCACHE_RAM_BASE + DCACHE_RAM_SIZE)- _RAMBASE )
241 unsigned new_cpu_reset;
243 /* get back cpu_reset from ebx */
246 :"=a" (new_cpu_reset)
249 /* We can not go back any more, we lost old stack data in cache as ram*/
250 if(new_cpu_reset==0) {
251 print_debug("Use Ram as Stack now - done\r\n");
254 print_debug("Use Ram as Stack now - \r\n");
257 printk_debug("new_cpu_reset = %08x\r\n", new_cpu_reset);
259 print_debug("new_cpu_reset = "); print_debug_hex32(new_cpu_reset); print_debug("\r\n");
262 /*copy and execute coreboot_ram */
263 copy_and_run(new_cpu_reset);
264 /* We will not return */
269 print_debug("should not be here -\r\n");