2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2008 coresystems GmbH
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 #include "cpu/x86/car/copy_and_run.c"
24 void real_main(unsigned long bist);
26 void stage1_main(unsigned long bist)
28 unsigned int cpu_reset = 0;
30 #if USE_FALLBACK_IMAGE == 1
31 /* Is this a deliberate reset by the bios */
32 if (bios_reset_detected() && last_boot_normal()) {
35 /* This is the primary cpu how should I boot? */
37 if (do_normal_boot()) {
45 __asm__ volatile ("jmp __normal_image"
47 : "a" (bist) /* inputs */
54 /* No servicable parts below this line .. */
57 /* Check value of esp to verify if we have enough rom for stack in Cache as RAM */
63 printk_spew("v_esp=%08x\r\n", v_esp);
68 printk_spew("cpu_reset = %08x\r\n",cpu_reset);
71 print_spew("Clearing initial memory region: ");
73 print_spew("No cache as ram now - ");
75 /* store cpu_reset to ebx */
82 #define CLEAR_FIRST_1M_RAM 1
83 #include "cache_as_ram_post.c"
85 #undef CLEAR_FIRST_1M_RAM
86 #include "cache_as_ram_post.c"
90 /* set new esp */ /* before _RAMBASE */
93 ::"a"( (DCACHE_RAM_BASE + DCACHE_RAM_SIZE)- _RAMBASE )
97 unsigned new_cpu_reset;
99 /* get back cpu_reset from ebx */
102 :"=a" (new_cpu_reset)
105 #ifdef CONFIG_DEACTIVATE_CAR
106 print_debug("Deactivating CAR");
107 #include CONFIG_DEACTIVATE_CAR_FILE
108 print_debug(" - Done.\r\n");
110 /* Copy and execute coreboot_ram */
111 copy_and_run(new_cpu_reset);
112 /* We will not return */
115 print_debug("sorry. parachute did not open.\r\n");