From f610d2466cb182fcc798bcbf99c1f12072144b2c Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Sun, 12 Oct 2003 21:18:56 +0000 Subject: [PATCH] pre-mem startup git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1207 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/arch/ppc/init/Config.lb | 2 +- src/arch/ppc/init/ppc_main.c | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/arch/ppc/init/ppc_main.c diff --git a/src/arch/ppc/init/Config.lb b/src/arch/ppc/init/Config.lb index fcda384bb6..5fcae5f3c2 100644 --- a/src/arch/ppc/init/Config.lb +++ b/src/arch/ppc/init/Config.lb @@ -1,2 +1,2 @@ init crt0.S.lb -#initobject stuff.o +initobject ppc_main.o diff --git a/src/arch/ppc/init/ppc_main.c b/src/arch/ppc/init/ppc_main.c new file mode 100644 index 0000000000..06fc33c89b --- /dev/null +++ b/src/arch/ppc/init/ppc_main.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2003 by Greg Watson, Los Alamos National Laboratory + * gwatson@lanl.gov + */ + +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 executing payload + */ + +void ppc_main(void) +{ + unsigned *from; + unsigned *to; + + sdram_init(); + + /* + * Relocate payload (text & data) if necessary + */ + if (_liseg != _iseg) { + from = _liseg; + to = _iseg; + while (from < _eliseg) + *to++ = *from++; + } + + hardwaremain(0); +}