summaryrefslogtreecommitdiff
path: root/src/cpu/amd/car/copy_and_run.c
blob: f495f6dbbade4a8ddcac207e209e1181a4880a84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* by yhlu 6.2005 
	moved from nrv2v.c and some lines from crt0.S
   2006/05/02 - stepan: move nrv2b to an extra file.
*/

#if CONFIG_CBFS == 1
void cbfs_and_run_core(char*, unsigned ebp);

static void copy_and_run(void)
{
# if CONFIG_USE_FALLBACK_IMAGE == 1
	cbfs_and_run_core("fallback/coreboot_ram", 0);
# else
      	cbfs_and_run_core("normal/coreboot_ram", 0);
# endif
}

#if CONFIG_AP_CODE_IN_CAR == 1

static void copy_and_run_ap_code_in_car(unsigned ret_addr)
{
# if CONFIG_USE_FALLBACK_IMAGE == 1
	cbfs_and_run_core("fallback/coreboot_apc", ret_addr);
# else
      	cbfs_and_run_core("normal/coreboot_apc", ret_addr);
# endif
}
#endif

#else
void copy_and_run_core(u8 *src, u8 *dst, unsigned long ilen, unsigned ebp);

extern u8 _liseg, _iseg, _eiseg;

static void copy_and_run(void)
{
	uint8_t *src, *dst; 
        unsigned long ilen;

	src = &_liseg;
	dst = &_iseg;
	ilen = &_eiseg - dst;

	copy_and_run_core(src, dst, ilen, 0);
}

#if CONFIG_AP_CODE_IN_CAR == 1

extern u8 _liseg_apc, _iseg_apc, _eiseg_apc;

static void copy_and_run_ap_code_in_car(unsigned ret_addr)
{
        uint8_t *src, *dst;
        unsigned long ilen;

	src = &_liseg_apc;
	dst = &_iseg_apc;
	ilen = &_eiseg_apc - dst;

	copy_and_run_core(src, dst, ilen, ret_addr);
}
#endif
#endif