summaryrefslogtreecommitdiff
path: root/src/arch/ppc/init/ppc_main.c
blob: 5b4a15981482545047b08d99646e92ee36fee92f (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
/* 
 * Copyright (C) 2003 by Greg Watson, Los Alamos National Laboratory
 * gwatson@lanl.gov
 */

#include <sdram.h>

extern unsigned _iseg[];
extern unsigned _liseg[];
extern unsigned _eliseg[];

void (*hardwaremain)(int) = _iseg;

/*
 * At this point we're running out of flash with our
 * stack in cache ram. We need to do the following:
 *
 * - turn on real memory
 * - relocate our payload into real memory
 * - start hardwaremain() which does remainder of setup
 */

void ppc_main(void)
{
	unsigned *from;
	unsigned *to;

	board_init();

	sdram_init();

	/*
	 * Relocate payload (text & data) if necessary
	 */
	if (_liseg != _iseg) {	
		from = _liseg;
		to = _iseg;
		while (from < _eliseg)
			*to++ = *from++;
	}

	hardwaremain(0);
}