printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / cpu / intel / model_6fx / 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
34 #ifdef CAR_DEBUG
35         /* Check value of esp to verify if we have enough rom for stack in Cache as RAM */
36         unsigned v_esp;
37         __asm__ volatile (
38                 "movl   %%esp, %0\n"
39                 : "=a" (v_esp)
40         );
41         printk(BIOS_SPEW, "v_esp=%08x\n", v_esp);
42 #endif
43
44 cpu_reset_x:
45
46         printk(BIOS_SPEW, "cpu_reset = %08x\n", cpu_reset);
47         printk(BIOS_SPEW, "No cache as ram now - ");
48
49         /* store cpu_reset to ebx */
50         __asm__ volatile (
51                 "movl %0, %%ebx\n\t"
52                 ::"a" (cpu_reset)
53         );
54
55 #undef CLEAR_FIRST_1M_RAM 
56 #include "cache_as_ram_post.c"
57
58         /* For now: use rambase + 1MB - 64K (counting downwards) as stack. This
59          * makes sure that we stay completely within the 1M of memory we
60          * preserve with the memcpy above.
61          */
62
63 #ifndef HIGH_MEMORY_SAVE
64 #define HIGH_MEMORY_SAVE ( (1024 - 64) * 1024 )
65 #endif
66
67         __asm__ volatile (
68                 "movl %0, %%ebp\n"
69                 "movl %0, %%esp\n"
70                 :: "a" (CONFIG_RAMBASE + HIGH_MEMORY_SAVE)
71         );
72
73         {
74                 unsigned new_cpu_reset;
75
76                 /* get back cpu_reset from ebx */
77                 __asm__ volatile (
78                         "movl %%ebx, %0\n"
79                         :"=a" (new_cpu_reset)
80                 );
81
82                 /* Copy and execute coreboot_ram */
83                 copy_and_run(new_cpu_reset);
84         }
85
86         /* We will not return */
87         printk(BIOS_DEBUG, "sorry. parachute did not open.\n");
88 }