Merge nommu tree
[pandora-kernel.git] / arch / arm / kernel / head.S
index 8d87484..53b6901 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <asm/assembler.h>
 #include <asm/domain.h>
-#include <asm/mach-types.h>
 #include <asm/procinfo.h>
 #include <asm/ptrace.h>
 #include <asm/asm-offsets.h>
 #define PROCINFO_INITFUNC      12
 
 #define MACHINFO_TYPE          0
-#define MACHINFO_PHYSRAM       4
-#define MACHINFO_PHYSIO                8
-#define MACHINFO_PGOFFIO       12
-#define MACHINFO_NAME          16
+#define MACHINFO_PHYSIO                4
+#define MACHINFO_PGOFFIO       8
+#define MACHINFO_NAME          12
+
+#define KERNEL_RAM_ADDR        (PAGE_OFFSET + TEXT_OFFSET)
 
 /*
  * swapper_pg_dir is the virtual address of the initial page table.
 ENTRY(stext)
        msr     cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC @ ensure svc mode
                                                @ and irqs disabled
+       mrc     p15, 0, r9, c0, c0              @ get processor id
        bl      __lookup_processor_type         @ r5=procinfo r9=cpuid
        movs    r10, r5                         @ invalid processor (r5=0)?
-       beq     __error_p                               @ yes, error 'p'
+       beq     __error_p                       @ yes, error 'p'
        bl      __lookup_machine_type           @ r5=machinfo
        movs    r8, r5                          @ invalid machine (r5=0)?
        beq     __error_a                       @ yes, error 'a'
@@ -155,6 +156,7 @@ ENTRY(secondary_startup)
         * as it has already been validated by the primary processor.
         */
        msr     cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC
+       mrc     p15, 0, r9, c0, c0              @ get processor id
        bl      __lookup_processor_type
        movs    r10, r5                         @ invalid processor?
        moveq   r0, #'p'                        @ yes, error 'p'
@@ -250,12 +252,11 @@ __turn_mmu_on:
  * r10 = procinfo
  *
  * Returns:
- *  r0, r3, r5, r6, r7 corrupted
+ *  r0, r3, r6, r7 corrupted
  *  r4 = physical page table address
  */
        .type   __create_page_tables, %function
 __create_page_tables:
-       ldr     r5, [r8, #MACHINFO_PHYSRAM]     @ physram
        pgtbl   r4                              @ page table address
 
        /*
@@ -302,7 +303,7 @@ __create_page_tables:
         * Then map first 1MB of ram in case it contains our boot params.
         */
        add     r0, r4, #PAGE_OFFSET >> 18
-       orr     r6, r5, r7
+       orr     r6, r7, #PHYS_OFFSET
        str     r6, [r0]
 
 #ifdef CONFIG_XIP_KERNEL
@@ -310,7 +311,7 @@ __create_page_tables:
         * Map some ram to cover our .data and .bss areas.
         * Mapping 3MB should be plenty.
         */
-       sub     r3, r4, r5
+       sub     r3, r4, #PHYS_OFFSET
        mov     r3, r3, lsr #20
        add     r0, r0, r3, lsl #2
        add     r6, r6, r3, lsl #20
@@ -343,16 +344,12 @@ __create_page_tables:
        bne     1b
 #if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_CATS)
        /*
-        * If we're using the NetWinder, we need to map in
-        * the 16550-type serial port for the debug messages
+        * If we're using the NetWinder or CATS, we also need to map
+        * in the 16550-type serial port for the debug messages
         */
-       teq     r1, #MACH_TYPE_NETWINDER
-       teqne   r1, #MACH_TYPE_CATS
-       bne     1f
        add     r0, r4, #0xff000000 >> 18
        orr     r3, r7, #0x7c000000
        str     r3, [r0]
-1:
 #endif
 #ifdef CONFIG_ARCH_RPC
        /*
@@ -454,19 +451,19 @@ __error:
  * (and therefore, we are not in the correct address space).  We have to
  * calculate the offset.
  *
+ *     r9 = cpuid
  * Returns:
  *     r3, r4, r6 corrupted
  *     r5 = proc_info pointer in physical address space
- *     r9 = cpuid
+ *     r9 = cpuid (preserved)
  */
        .type   __lookup_processor_type, %function
 __lookup_processor_type:
        adr     r3, 3f
-       ldmda   r3, {r5, r6, r9}
-       sub     r3, r3, r9                      @ get offset between virt&phys
+       ldmda   r3, {r5 - r7}
+       sub     r3, r3, r7                      @ get offset between virt&phys
        add     r5, r5, r3                      @ convert virt addresses to
        add     r6, r6, r3                      @ physical address space
-       mrc     p15, 0, r9, c0, c0              @ get processor id
 1:     ldmia   r5, {r3, r4}                    @ value, mask
        and     r4, r4, r9                      @ mask wanted bits
        teq     r3, r4
@@ -481,10 +478,11 @@ __lookup_processor_type:
  * This provides a C-API version of the above function.
  */
 ENTRY(lookup_processor_type)
-       stmfd   sp!, {r4 - r6, r9, lr}
+       stmfd   sp!, {r4 - r7, r9, lr}
+       mov     r9, r0
        bl      __lookup_processor_type
        mov     r0, r5
-       ldmfd   sp!, {r4 - r6, r9, pc}
+       ldmfd   sp!, {r4 - r7, r9, pc}
 
 /*
  * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for