Fix some builds with Kconfig.
[coreboot.git] / src / arch / ppc / init / ppc_main.c
index 06fc33c89bba40f3d0f9c1df7e8c8643b3c8e600..150deeea67666c4d0c2b2ff7bf2f8cb5e53c8bf3 100644 (file)
@@ -3,11 +3,9 @@
  * 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
@@ -15,25 +13,40 @@ void (*hardwaremain)(int) = _iseg;
  *
  * - 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 */
 }