* gwatson@lanl.gov
*/
-extern unsigned _iseg[];
-extern unsigned _liseg[];
-extern unsigned _eliseg[];
-
-void (*hardwaremain)(int) = _iseg;
+#include <board.h>
+#include <sdram.h>
+#include <cbfs.h>
/*
* At this point we're running out of flash with our
*
* - turn on real memory
* - relocate our payload into real memory
- * - start executing payload
+ * - start hardwaremain() which does remainder of setup
*/
+extern void flush_dcache(void);
+
void ppc_main(void)
{
- unsigned *from;
- unsigned *to;
+ void (*payload)(void);
+
+ /*
+ * very early board initialization
+ */
+ board_init();
+
+ /*
+ * turn on memory
+ */
+ memory_init();
- sdram_init();
+ /*
+ * final initialization before jumping to payload
+ */
+ board_init2();
/*
- * Relocate payload (text & data) if necessary
+ * Flush cache now that memory is enabled.
*/
- if (_liseg != _iseg) {
- from = _liseg;
- to = _iseg;
- while (from < _eliseg)
- *to++ = *from++;
- }
-
- hardwaremain(0);
+ flush_dcache();
+
+ /*
+ * Relocate payload (text & data)
+ */
+ payload = cbfs_load_stage("fallback/coreboot_ram");
+ payload();
+
+ /* NOT REACHED */
}