]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
powerpc/32: Pass device tree address as u64 to machine_init
authorScott Wood <scottwood@freescale.com>
Mon, 25 Jul 2011 11:29:33 +0000 (11:29 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 19 Sep 2011 23:19:47 +0000 (09:19 +1000)
u64 is used rather than phys_addr_t to keep things simple, as
this is called from assembly code.

Update callers to pass a 64-bit address in r3/r4.  Other unused
register assignments that were once parameters to machine_init
are dropped.

For FSL BookE, look up the physical address of the device tree from the
effective address passed in r3 by the loader.  This is required for
situations where memory does not start at zero (due to AMP or IOMMU-less
virtualization), and thus the IMA doesn't start at zero, and thus the
device tree effective address does not equal the physical address.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/head_32.S
arch/powerpc/kernel/head_40x.S
arch/powerpc/kernel/head_44x.S
arch/powerpc/kernel/head_8xx.S
arch/powerpc/kernel/head_fsl_booke.S
arch/powerpc/kernel/setup_32.c

index ba250d505e07d210f21cb26c3ac92ddff0bca6d5..0654dba2c1f18a3582c7dc82854765d776c7dcf0 100644 (file)
@@ -139,8 +139,7 @@ __start:
        trap
 #endif /* CONFIG_PPC_PMAC */
 
-1:     mr      r31,r3                  /* save parameters */
-       mr      r30,r4
+1:     mr      r31,r3                  /* save device tree ptr */
        li      r24,0                   /* cpu # */
 
 /*
@@ -964,8 +963,8 @@ start_here:
  * Do early platform-specific initialization,
  * and set up the MMU.
  */
-       mr      r3,r31
-       mr      r4,r30
+       li      r3,0
+       mr      r4,r31
        bl      machine_init
        bl      __save_cpu_setup
        bl      MMU_init
index a91626d87fc96261a54e3637eab986e80119377c..872a6af83bad56c95cde844fc2044817e8fc8275 100644 (file)
 _ENTRY(_stext);
 _ENTRY(_start);
 
-       /* Save parameters we are passed.
-       */
-       mr      r31,r3
-       mr      r30,r4
-       mr      r29,r5
-       mr      r28,r6
-       mr      r27,r7
+       mr      r31,r3                  /* save device tree ptr */
 
        /* We have to turn on the MMU right away so we get cache modes
         * set correctly.
@@ -849,11 +843,8 @@ start_here:
 /*
  * Decide what sort of machine this is and initialize the MMU.
  */
-       mr      r3,r31
-       mr      r4,r30
-       mr      r5,r29
-       mr      r6,r28
-       mr      r7,r27
+       li      r3,0
+       mr      r4,r31
        bl      machine_init
        bl      MMU_init
 
index f8e971ba94f5b66231da5194f125efd35020b5d6..b725dab0f88a01eae1e085e094310e21d898e605 100644 (file)
@@ -61,14 +61,7 @@ _ENTRY(_start);
         * of abatron_pteptrs
         */
        nop
-/*
- * Save parameters we are passed
- */
-       mr      r31,r3
-       mr      r30,r4
-       mr      r29,r5
-       mr      r28,r6
-       mr      r27,r7
+       mr      r31,r3          /* save device tree ptr */
        li      r24,0           /* CPU number */
 
        bl      init_cpu_state
@@ -120,11 +113,8 @@ _ENTRY(_start);
 /*
  * Decide what sort of machine this is and initialize the MMU.
  */
-       mr      r3,r31
-       mr      r4,r30
-       mr      r5,r29
-       mr      r6,r28
-       mr      r7,r27
+       li      r3,0
+       mr      r4,r31
        bl      machine_init
        bl      MMU_init
 
index 1cbf64e6b416c1139b1f57582597477aef4cd61d..b68cb173ba2c6a500c37f369b9daadcf8c519d0c 100644 (file)
@@ -76,11 +76,7 @@ _ENTRY(_start);
  */
        .globl  __start
 __start:
-       mr      r31,r3                  /* save parameters */
-       mr      r30,r4
-       mr      r29,r5
-       mr      r28,r6
-       mr      r27,r7
+       mr      r31,r3                  /* save device tree ptr */
 
        /* We have to turn on the MMU right away so we get cache modes
         * set correctly.
@@ -723,11 +719,8 @@ start_here:
 /*
  * Decide what sort of machine this is and initialize the MMU.
  */
-       mr      r3,r31
-       mr      r4,r30
-       mr      r5,r29
-       mr      r6,r28
-       mr      r7,r27
+       li      r3,0
+       mr      r4,r31
        bl      machine_init
        bl      MMU_init
 
index 4ea9bfbf67e9f3d68a8a9e251e0b27183ef6ebe8..e1c699f3b7a7ce69c129ef9930eee8ab965f7696 100644 (file)
@@ -63,17 +63,30 @@ _ENTRY(_start);
         * of abatron_pteptrs
         */
        nop
-/*
- * Save parameters we are passed
- */
-       mr      r31,r3
-       mr      r30,r4
-       mr      r29,r5
-       mr      r28,r6
-       mr      r27,r7
-       li      r25,0           /* phys kernel start (low) */
-       li      r24,0           /* CPU number */
-       li      r23,0           /* phys kernel start (high) */
+
+       /* Translate device tree address to physical, save in r30/r31 */
+       mfmsr   r16
+       mfspr   r17,SPRN_PID
+       rlwinm  r17,r17,16,0x3fff0000   /* turn PID into MAS6[SPID] */
+       rlwimi  r17,r16,28,0x00000001   /* turn MSR[DS] into MAS6[SAS] */
+       mtspr   SPRN_MAS6,r17
+
+       tlbsx   0,r3                    /* must succeed */
+
+       mfspr   r16,SPRN_MAS1
+       mfspr   r20,SPRN_MAS3
+       rlwinm  r17,r16,25,0x1f         /* r17 = log2(page size) */
+       li      r18,1024
+       slw     r18,r18,r17             /* r18 = page size */
+       addi    r18,r18,-1
+       and     r19,r3,r18              /* r19 = page offset */
+       andc    r31,r20,r18             /* r3 = page base */
+       or      r31,r31,r19             /* r3 = devtree phys addr */
+       mfspr   r30,SPRN_MAS7
+
+       li      r25,0                   /* phys kernel start (low) */
+       li      r24,0                   /* CPU number */
+       li      r23,0                   /* phys kernel start (high) */
 
 /* We try to not make any assumptions about how the boot loader
  * setup or used the TLBs.  We invalidate all mappings from the
@@ -198,11 +211,8 @@ _ENTRY(__early_start)
 /*
  * Decide what sort of machine this is and initialize the MMU.
  */
-       mr      r3,r31
-       mr      r4,r30
-       mr      r5,r29
-       mr      r6,r28
-       mr      r7,r27
+       mr      r3,r30
+       mr      r4,r31
        bl      machine_init
        bl      MMU_init
 
index 209135af0a40e957fd15a166df417520df408f9e..c1ce86357ecb4a3a47411c18e6fe88cfd5c07d8b 100644 (file)
@@ -117,7 +117,7 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
  * This is called very early on the boot process, after a minimal
  * MMU environment has been set up but before MMU_init is called.
  */
-notrace void __init machine_init(unsigned long dt_ptr)
+notrace void __init machine_init(u64 dt_ptr)
 {
        lockdep_init();