]> git.sur5r.net Git - u-boot/blobdiff - cpu/mpc8xx/start.S
Merge branch 'master' of git://git.denx.de/u-boot-ppc4xx
[u-boot] / cpu / mpc8xx / start.S
index 3cc4ecba24b6a60dac8d2e3ead5e575ad0c06f6c..e84326ebdc5518c18068c16df7bbb3d37fd91abd 100644 (file)
  *
  *  The processor starts at 0x00000100 and the code is executed
  *  from flash. The code is organized to be at an other address
- *  in memory, but as long we don't jump around before relocating.
+ *  in memory, but as long we don't jump around before relocating,
  *  board_init lies at a quite high address and when the cpu has
  *  jumped there, everything is ok.
  *  This works because the cpu gives the FLASH (CS0) the whole
  *  address space at startup, and board_init lies as a echo of
- *  the flash somewhere up there in the memorymap.
+ *  the flash somewhere up there in the memory map.
  *
  *  board_init will change CS0 to be positioned at the correct
  *  address and (s)dram will be positioned at address 0
  */
 #include <config.h>
 #include <mpc8xx.h>
+#include <timestamp.h>
 #include <version.h>
 
 #define CONFIG_8xx 1           /* needed for Linux kernel header files */
@@ -76,9 +77,6 @@
        GOT_ENTRY(__init_end)
        GOT_ENTRY(_end)
        GOT_ENTRY(__bss_start)
-#if defined(CONFIG_FADS) || defined(CONFIG_ICU862)
-       GOT_ENTRY(environment)
-#endif
        END_GOT
 
 /*
        .globl  version_string
 version_string:
        .ascii U_BOOT_VERSION
-       .ascii " (", __DATE__, " - ", __TIME__, ")"
+       .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
        .ascii CONFIG_IDENT_STRING, "\0"
 
        . = EXC_OFF_SYS_RESET
        .globl  _start
 _start:
-       lis     r3, CFG_IMMR@h          /* position IMMR */
+       lis     r3, CONFIG_SYS_IMMR@h           /* position IMMR */
        mtspr   638, r3
        li      r21, BOOTFLAG_COLD      /* Normal Power-On: Boot from FLASH     */
        b       boot_cold
@@ -144,7 +142,7 @@ boot_warm:
        lis     r3, IDC_DISABLE@h       /* Disable data cache */
        mtspr   DC_CST, r3
 
-#if !(defined(CONFIG_IP860) || defined(CONFIG_PCU_E) || defined (CONFIG_FLAGADM))
+#if !defined(CONFIG_SYS_DELAYED_ICACHE)
                                        /* On IP860 and PCU E,
                                         * we cannot enable IC yet
                                         */
@@ -162,8 +160,8 @@ boot_warm:
         * Calculate absolute address in FLASH and jump there
         *----------------------------------------------------------------------*/
 
-       lis     r3, CFG_MONITOR_BASE@h
-       ori     r3, r3, CFG_MONITOR_BASE@l
+       lis     r3, CONFIG_SYS_MONITOR_BASE@h
+       ori     r3, r3, CONFIG_SYS_MONITOR_BASE@l
        addi    r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
        mtlr    r3
        blr
@@ -173,8 +171,8 @@ in_flash:
        /* initialize some SPRs that are hard to access from C                  */
        /*----------------------------------------------------------------------*/
 
-       lis     r3, CFG_IMMR@h          /* pass IMMR as arg1 to C routine */
-       ori     r1, r3, CFG_INIT_SP_OFFSET /* set up the stack in internal DPRAM */
+       lis     r3, CONFIG_SYS_IMMR@h           /* pass IMMR as arg1 to C routine */
+       ori     r1, r3, CONFIG_SYS_INIT_SP_OFFSET /* set up the stack in internal DPRAM */
        /* Note: R0 is still 0 here */
        stwu    r0, -4(r1)              /* clear final stack frame so that      */
        stwu    r0, -4(r1)              /* stack backtraces terminate cleanly   */
@@ -190,8 +188,8 @@ in_flash:
 
        /* Set up debug mode entry */
 
-       lis     r2, CFG_DER@h
-       ori     r2, r2, CFG_DER@l
+       lis     r2, CONFIG_SYS_DER@h
+       ori     r2, r2, CONFIG_SYS_DER@l
        mtspr   DER, r2
 
        /* let the C-code set up the rest                                       */
@@ -209,7 +207,6 @@ in_flash:
        bl      board_init_f    /* run 1st part of board init code (from Flash) */
 
 
-
        .globl  _start_of_vectors
 _start_of_vectors:
 
@@ -228,7 +225,7 @@ _start_of_vectors:
 /* Alignment exception. */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        mfspr   r4,DAR
        stw     r4,_DAR(r21)
        mfspr   r5,DSISR
@@ -246,7 +243,7 @@ Alignment:
 /* Program check exception */
        . = 0x700
 ProgramCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG(SRR0, SRR1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
        li      r20,MSR_KERNEL
        rlwimi  r20,r23,0,16,16         /* copy EE bit from saved MSR */
@@ -267,75 +264,7 @@ ProgramCheck:
        STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
        STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
        STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
-
-       . = 0xc00
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
-       addis   r11,r0,0                /* get functions table addr */
-       ori     r11,r11,0               /* Note: this code is patched in trap_init */
-       addis   r12,r0,0                /* get number of functions */
-       ori     r12,r12,0
-
-       cmplw   0, r0, r12
-       bge     1f
-
-       rlwinm  r0,r0,2,0,31            /* fn_addr = fn_tbl[r0] */
-       add     r11,r11,r0
-       lwz     r11,0(r11)
-
-       li      r20,0xd00-4             /* Get stack pointer */
-       lwz     r12,0(r20)
-       subi    r12,r12,12              /* Adjust stack pointer */
-       li      r0,0xc00+_end_back-SystemCall
-       cmplw   0, r0, r12              /* Check stack overflow */
-       bgt     1f
-       stw     r12,0(r20)
-
-       mflr    r0
-       stw     r0,0(r12)
-       mfspr   r0,SRR0
-       stw     r0,4(r12)
-       mfspr   r0,SRR1
-       stw     r0,8(r12)
-
-       li      r12,0xc00+_back-SystemCall
-       mtlr    r12
-       mtspr   SRR0,r11
-
-1:     SYNC
-       rfi
-
-_back:
-
-       mfmsr   r11                     /* Disable interrupts */
-       li      r12,0
-       ori     r12,r12,MSR_EE
-       andc    r11,r11,r12
-       SYNC                            /* Some chip revs need this... */
-       mtmsr   r11
-       SYNC
-
-       li      r12,0xd00-4             /* restore regs */
-       lwz     r12,0(r12)
-
-       lwz     r11,0(r12)
-       mtlr    r11
-       lwz     r11,4(r12)
-       mtspr   SRR0,r11
-       lwz     r11,8(r12)
-       mtspr   SRR1,r11
-
-       addi    r12,r12,12              /* Adjust stack pointer */
-       li      r20,0xd00-4
-       stw     r12,0(r20)
-
-       SYNC
-       rfi
-_end_back:
-
+       STD_EXCEPTION(0xc00, SystemCall, UnknownException)
        STD_EXCEPTION(0xd00, SingleStep, UnknownException)
 
        STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
@@ -567,16 +496,16 @@ relocate_code:
        mr      r10, r5         /* Save copy of Destination Address     */
 
        mr      r3,  r5                         /* Destination Address  */
-       lis     r4, CFG_MONITOR_BASE@h          /* Source      Address  */
-       ori     r4, r4, CFG_MONITOR_BASE@l
+       lis     r4, CONFIG_SYS_MONITOR_BASE@h           /* Source      Address  */
+       ori     r4, r4, CONFIG_SYS_MONITOR_BASE@l
        lwz     r5, GOT(__init_end)
        sub     r5, r5, r4
-       li      r6, CFG_CACHELINE_SIZE          /* Cache Line Size      */
+       li      r6, CONFIG_SYS_CACHELINE_SIZE           /* Cache Line Size      */
 
        /*
         * Fix GOT pointer:
         *
-        * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
+        * New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE) + Destination Address
         *
         * Offset:
         */
@@ -650,8 +579,8 @@ in_ram:
        /*
         * Relocation Function, r14 point to got2+0x8000
         *
-         * Adjust got2 pointers, no need to check for 0, this code
-         * already puts a few entries in the table.
+        * Adjust got2 pointers, no need to check for 0, this code
+        * already puts a few entries in the table.
         */
        li      r0,__got2_entries@sectoff@l
        la      r3,GOT(_GOT2_TABLE_)
@@ -660,15 +589,17 @@ in_ram:
        sub     r11,r3,r11
        addi    r3,r3,-4
 1:     lwzu    r0,4(r3)
+       cmpwi   r0,0
+       beq-    2f
        add     r0,r0,r11
        stw     r0,0(r3)
-       bdnz    1b
+2:     bdnz    1b
 
        /*
-         * Now adjust the fixups and the pointers to the fixups
+        * Now adjust the fixups and the pointers to the fixups
         * in case we need to move ourselves again.
         */
-2:     li      r0,__fixup_entries@sectoff@l
+       li      r0,__fixup_entries@sectoff@l
        lwz     r3,GOT(_FIXUP_TABLE_)
        cmpwi   r0,0
        mtctr   r0
@@ -686,16 +617,7 @@ clear_bss:
         * Now clear BSS segment
         */
        lwz     r3,GOT(__bss_start)
-#if defined(CONFIG_FADS) || defined(CONFIG_ICU862)
-       /*
-        * For the FADS - the environment is the very last item in flash.
-        * The real .bss stops just before environment starts, so only
-        * clear up to that point.
-        */
-       lwz     r4,GOT(environment)
-#else
        lwz     r4,GOT(_end)
-#endif
 
        cmplw   0, r3, r4
        beq     6f