Remove fallback/normal handling in mainboards'
[coreboot.git] / src / cpu / intel / model_6ex / cache_as_ram_disable.c
1 /*
2  * This file is part of the coreboot project.
3  * 
4  * Copyright (C) 2007-2009 coresystems GmbH
5  *
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
9  * the License.
10  *
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.
15  *
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,
19  * MA 02110-1301 USA
20  */
21
22 #include "cpu/x86/car/copy_and_run.c"
23
24 void real_main(unsigned long bist);
25
26 void stage1_main(unsigned long bist)
27 {
28         unsigned int cpu_reset = 0;
29
30         real_main(bist);
31
32         /* No servicable parts below this line .. */
33 #ifdef CAR_DEBUG
34         /* Check value of esp to verify if we have enough rom for stack in Cache as RAM */
35         unsigned v_esp;
36         __asm__ volatile (
37                 "movl   %%esp, %0\n"
38                 : "=a" (v_esp)
39         );
40         printk_spew("v_esp=%08x\n", v_esp);
41 #endif
42
43 cpu_reset_x:
44
45         printk_spew("cpu_reset = %08x\n", cpu_reset);
46         printk_spew("No cache as ram now - ");
47
48         /* store cpu_reset to ebx */
49         __asm__ volatile (
50                 "movl %0, %%ebx\n\t"
51                 ::"a" (cpu_reset)
52         );
53
54 #undef CLEAR_FIRST_1M_RAM 
55 #include "cache_as_ram_post.c"
56
57         /* For now: use rambase + 1MB - 64K (counting downwards) as stack. This
58          * makes sure that we stay completely within the 1M of memory we
59          * preserve with the memcpy above.
60          */
61
62 #ifndef HIGH_MEMORY_SAVE
63 #define HIGH_MEMORY_SAVE ( (1024 - 64) * 1024 )
64 #endif
65
66         __asm__ volatile (
67                 "movl %0, %%ebp\n"
68                 "movl %0, %%esp\n"
69                 :: "a" (CONFIG_RAMBASE + HIGH_MEMORY_SAVE)
70         );
71
72         {
73                 unsigned new_cpu_reset;
74
75                 /* get back cpu_reset from ebx */
76                 __asm__ volatile (
77                         "movl %%ebx, %0\n"
78                         :"=a" (new_cpu_reset)
79                 );
80
81                 /* Copy and execute coreboot_ram */
82                 copy_and_run(new_cpu_reset);
83         }
84
85         /* We will not return */
86         printk_debug("sorry. parachute did not open.\n");
87 }