Move coreboot_ram and coreboot_apc to CBFS. This allows to
[coreboot.git] / src / cpu / amd / car / copy_and_run.c
1 /* by yhlu 6.2005 
2         moved from nrv2v.c and some lines from crt0.S
3    2006/05/02 - stepan: move nrv2b to an extra file.
4 */
5
6 #if CONFIG_CBFS == 1
7 void cbfs_and_run_core(char*, unsigned ebp);
8
9 static void copy_and_run(void)
10 {
11 # if USE_FALLBACK_IMAGE == 1
12         cbfs_and_run_core("fallback/coreboot_ram", 0);
13 # else
14         cbfs_and_run_core("normal/coreboot_ram", 0);
15 # endif
16 }
17
18 #if CONFIG_AP_CODE_IN_CAR == 1
19
20 static void copy_and_run_ap_code_in_car(unsigned ret_addr)
21 {
22 # if USE_FALLBACK_IMAGE == 1
23         cbfs_and_run_core("fallback/coreboot_apc", ret_addr);
24 # else
25         cbfs_and_run_core("normal/coreboot_apc", ret_addr);
26 # endif
27 }
28 #endif
29
30 #else
31 void copy_and_run_core(u8 *src, u8 *dst, unsigned long ilen, unsigned ebp);
32
33 extern u8 _liseg, _iseg, _eiseg;
34
35 static void copy_and_run(void)
36 {
37         uint8_t *src, *dst; 
38         unsigned long ilen;
39
40         src = &_liseg;
41         dst = &_iseg;
42         ilen = &_eiseg - dst;
43
44         copy_and_run_core(src, dst, ilen, 0);
45 }
46
47 #if CONFIG_AP_CODE_IN_CAR == 1
48
49 extern u8 _liseg_apc, _iseg_apc, _eiseg_apc;
50
51 static void copy_and_run_ap_code_in_car(unsigned ret_addr)
52 {
53         uint8_t *src, *dst;
54         unsigned long ilen;
55
56         src = &_liseg_apc;
57         dst = &_iseg_apc;
58         ilen = &_eiseg_apc - dst;
59
60         copy_and_run_core(src, dst, ilen, ret_addr);
61 }
62 #endif
63 #endif