aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2011-07-25 07:29:33 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-09-19 19:19:47 -0400
commit6dece0eb69b2a28e18d104bc5d707f1cb673f5e0 (patch)
treea5f3fcffc289d71cb31152e7d07f14da49607643
parent6c493685f1b209dd4ae41eb52c818cf12da20def (diff)
powerpc/32: Pass device tree address as u64 to machine_init
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>
-rw-r--r--arch/powerpc/kernel/head_32.S7
-rw-r--r--arch/powerpc/kernel/head_40x.S15
-rw-r--r--arch/powerpc/kernel/head_44x.S16
-rw-r--r--arch/powerpc/kernel/head_8xx.S13
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S42
-rw-r--r--arch/powerpc/kernel/setup_32.c2
6 files changed, 39 insertions, 56 deletions
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index ba250d505e07..0654dba2c1f1 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -139,8 +139,7 @@ __start:
139 trap 139 trap
140#endif /* CONFIG_PPC_PMAC */ 140#endif /* CONFIG_PPC_PMAC */
141 141
1421: mr r31,r3 /* save parameters */ 1421: mr r31,r3 /* save device tree ptr */
143 mr r30,r4
144 li r24,0 /* cpu # */ 143 li r24,0 /* cpu # */
145 144
146/* 145/*
@@ -964,8 +963,8 @@ start_here:
964 * Do early platform-specific initialization, 963 * Do early platform-specific initialization,
965 * and set up the MMU. 964 * and set up the MMU.
966 */ 965 */
967 mr r3,r31 966 li r3,0
968 mr r4,r30 967 mr r4,r31
969 bl machine_init 968 bl machine_init
970 bl __save_cpu_setup 969 bl __save_cpu_setup
971 bl MMU_init 970 bl MMU_init
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index a91626d87fc9..872a6af83bad 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -58,13 +58,7 @@
58_ENTRY(_stext); 58_ENTRY(_stext);
59_ENTRY(_start); 59_ENTRY(_start);
60 60
61 /* Save parameters we are passed. 61 mr r31,r3 /* save device tree ptr */
62 */
63 mr r31,r3
64 mr r30,r4
65 mr r29,r5
66 mr r28,r6
67 mr r27,r7
68 62
69 /* We have to turn on the MMU right away so we get cache modes 63 /* We have to turn on the MMU right away so we get cache modes
70 * set correctly. 64 * set correctly.
@@ -849,11 +843,8 @@ start_here:
849/* 843/*
850 * Decide what sort of machine this is and initialize the MMU. 844 * Decide what sort of machine this is and initialize the MMU.
851 */ 845 */
852 mr r3,r31 846 li r3,0
853 mr r4,r30 847 mr r4,r31
854 mr r5,r29
855 mr r6,r28
856 mr r7,r27
857 bl machine_init 848 bl machine_init
858 bl MMU_init 849 bl MMU_init
859 850
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index f8e971ba94f5..b725dab0f88a 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -61,14 +61,7 @@ _ENTRY(_start);
61 * of abatron_pteptrs 61 * of abatron_pteptrs
62 */ 62 */
63 nop 63 nop
64/* 64 mr r31,r3 /* save device tree ptr */
65 * Save parameters we are passed
66 */
67 mr r31,r3
68 mr r30,r4
69 mr r29,r5
70 mr r28,r6
71 mr r27,r7
72 li r24,0 /* CPU number */ 65 li r24,0 /* CPU number */
73 66
74 bl init_cpu_state 67 bl init_cpu_state
@@ -120,11 +113,8 @@ _ENTRY(_start);
120/* 113/*
121 * Decide what sort of machine this is and initialize the MMU. 114 * Decide what sort of machine this is and initialize the MMU.
122 */ 115 */
123 mr r3,r31 116 li r3,0
124 mr r4,r30 117 mr r4,r31
125 mr r5,r29
126 mr r6,r28
127 mr r7,r27
128 bl machine_init 118 bl machine_init
129 bl MMU_init 119 bl MMU_init
130 120
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 1cbf64e6b416..b68cb173ba2c 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -76,11 +76,7 @@ _ENTRY(_start);
76 */ 76 */
77 .globl __start 77 .globl __start
78__start: 78__start:
79 mr r31,r3 /* save parameters */ 79 mr r31,r3 /* save device tree ptr */
80 mr r30,r4
81 mr r29,r5
82 mr r28,r6
83 mr r27,r7
84 80
85 /* We have to turn on the MMU right away so we get cache modes 81 /* We have to turn on the MMU right away so we get cache modes
86 * set correctly. 82 * set correctly.
@@ -723,11 +719,8 @@ start_here:
723/* 719/*
724 * Decide what sort of machine this is and initialize the MMU. 720 * Decide what sort of machine this is and initialize the MMU.
725 */ 721 */
726 mr r3,r31 722 li r3,0
727 mr r4,r30 723 mr r4,r31
728 mr r5,r29
729 mr r6,r28
730 mr r7,r27
731 bl machine_init 724 bl machine_init
732 bl MMU_init 725 bl MMU_init
733 726
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 4ea9bfbf67e9..e1c699f3b7a7 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -63,17 +63,30 @@ _ENTRY(_start);
63 * of abatron_pteptrs 63 * of abatron_pteptrs
64 */ 64 */
65 nop 65 nop
66/* 66
67 * Save parameters we are passed 67 /* Translate device tree address to physical, save in r30/r31 */
68 */ 68 mfmsr r16
69 mr r31,r3 69 mfspr r17,SPRN_PID
70 mr r30,r4 70 rlwinm r17,r17,16,0x3fff0000 /* turn PID into MAS6[SPID] */
71 mr r29,r5 71 rlwimi r17,r16,28,0x00000001 /* turn MSR[DS] into MAS6[SAS] */
72 mr r28,r6 72 mtspr SPRN_MAS6,r17
73 mr r27,r7 73
74 li r25,0 /* phys kernel start (low) */ 74 tlbsx 0,r3 /* must succeed */
75 li r24,0 /* CPU number */ 75
76 li r23,0 /* phys kernel start (high) */ 76 mfspr r16,SPRN_MAS1
77 mfspr r20,SPRN_MAS3
78 rlwinm r17,r16,25,0x1f /* r17 = log2(page size) */
79 li r18,1024
80 slw r18,r18,r17 /* r18 = page size */
81 addi r18,r18,-1
82 and r19,r3,r18 /* r19 = page offset */
83 andc r31,r20,r18 /* r3 = page base */
84 or r31,r31,r19 /* r3 = devtree phys addr */
85 mfspr r30,SPRN_MAS7
86
87 li r25,0 /* phys kernel start (low) */
88 li r24,0 /* CPU number */
89 li r23,0 /* phys kernel start (high) */
77 90
78/* We try to not make any assumptions about how the boot loader 91/* We try to not make any assumptions about how the boot loader
79 * setup or used the TLBs. We invalidate all mappings from the 92 * setup or used the TLBs. We invalidate all mappings from the
@@ -198,11 +211,8 @@ _ENTRY(__early_start)
198/* 211/*
199 * Decide what sort of machine this is and initialize the MMU. 212 * Decide what sort of machine this is and initialize the MMU.
200 */ 213 */
201 mr r3,r31 214 mr r3,r30
202 mr r4,r30 215 mr r4,r31
203 mr r5,r29
204 mr r6,r28
205 mr r7,r27
206 bl machine_init 216 bl machine_init
207 bl MMU_init 217 bl MMU_init
208 218
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 209135af0a40..c1ce86357ecb 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -117,7 +117,7 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
117 * This is called very early on the boot process, after a minimal 117 * This is called very early on the boot process, after a minimal
118 * MMU environment has been set up but before MMU_init is called. 118 * MMU environment has been set up but before MMU_init is called.
119 */ 119 */
120notrace void __init machine_init(unsigned long dt_ptr) 120notrace void __init machine_init(u64 dt_ptr)
121{ 121{
122 lockdep_init(); 122 lockdep_init();
123 123