diff options
author | Jayachandran C <jchandra@broadcom.com> | 2013-06-10 02:41:04 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-06-13 11:46:42 -0400 |
commit | 919f9abb3723f088290c62648b12fbfc7600d923 (patch) | |
tree | 00d1373418b59a086874a31a9cb5fefb16985cb9 | |
parent | 53c832197f3adc5a360336f75fe34a95fe2d796b (diff) |
MIPS: Netlogic: move cpu_ready array to boot area
Move the nlm_cpu_ready[] array used by the cpu wakeup code to the
boot area, along with rest of the boot parameter code.
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5425/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/include/asm/netlogic/common.h | 6 | ||||
-rw-r--r-- | arch/mips/netlogic/common/reset.S | 6 | ||||
-rw-r--r-- | arch/mips/netlogic/common/smp.c | 6 | ||||
-rw-r--r-- | arch/mips/netlogic/common/smpboot.S | 5 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/setup.c | 1 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/wakeup.c | 3 | ||||
-rw-r--r-- | arch/mips/netlogic/xlr/setup.c | 1 | ||||
-rw-r--r-- | arch/mips/netlogic/xlr/wakeup.c | 3 |
8 files changed, 22 insertions, 9 deletions
diff --git a/arch/mips/include/asm/netlogic/common.h b/arch/mips/include/asm/netlogic/common.h index 1b54adbd1583..bb68c3398c80 100644 --- a/arch/mips/include/asm/netlogic/common.h +++ b/arch/mips/include/asm/netlogic/common.h | |||
@@ -39,11 +39,17 @@ | |||
39 | * Common SMP definitions | 39 | * Common SMP definitions |
40 | */ | 40 | */ |
41 | #define RESET_VEC_PHYS 0x1fc00000 | 41 | #define RESET_VEC_PHYS 0x1fc00000 |
42 | #define RESET_VEC_SIZE 8192 /* 8KB reset code and data */ | ||
42 | #define RESET_DATA_PHYS (RESET_VEC_PHYS + (1<<10)) | 43 | #define RESET_DATA_PHYS (RESET_VEC_PHYS + (1<<10)) |
44 | |||
45 | /* Offsets of parameters in the RESET_DATA_PHYS area */ | ||
43 | #define BOOT_THREAD_MODE 0 | 46 | #define BOOT_THREAD_MODE 0 |
44 | #define BOOT_NMI_LOCK 4 | 47 | #define BOOT_NMI_LOCK 4 |
45 | #define BOOT_NMI_HANDLER 8 | 48 | #define BOOT_NMI_HANDLER 8 |
46 | 49 | ||
50 | /* CPU ready flags for each CPU */ | ||
51 | #define BOOT_CPU_READY 2048 | ||
52 | |||
47 | #ifndef __ASSEMBLY__ | 53 | #ifndef __ASSEMBLY__ |
48 | #include <linux/cpumask.h> | 54 | #include <linux/cpumask.h> |
49 | #include <linux/spinlock.h> | 55 | #include <linux/spinlock.h> |
diff --git a/arch/mips/netlogic/common/reset.S b/arch/mips/netlogic/common/reset.S index 98691d6b3bbe..b11691c629d0 100644 --- a/arch/mips/netlogic/common/reset.S +++ b/arch/mips/netlogic/common/reset.S | |||
@@ -216,8 +216,10 @@ EXPORT(nlm_boot_siblings) | |||
216 | ori t1, ST0_KX | 216 | ori t1, ST0_KX |
217 | #endif | 217 | #endif |
218 | mtc0 t1, CP0_STATUS | 218 | mtc0 t1, CP0_STATUS |
219 | /* mark CPU ready */ | 219 | |
220 | PTR_LA t1, nlm_cpu_ready | 220 | /* mark CPU ready, careful here, previous mtcr trashed registers */ |
221 | li t3, CKSEG1ADDR(RESET_DATA_PHYS) | ||
222 | ADDIU t1, t3, BOOT_CPU_READY | ||
221 | sll v1, v0, 2 | 223 | sll v1, v0, 2 |
222 | PTR_ADDU t1, v1 | 224 | PTR_ADDU t1, v1 |
223 | li t2, 1 | 225 | li t2, 1 |
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c index 1f66eef3aea7..885d293b61da 100644 --- a/arch/mips/netlogic/common/smp.c +++ b/arch/mips/netlogic/common/smp.c | |||
@@ -145,7 +145,6 @@ void nlm_cpus_done(void) | |||
145 | * Boot all other cpus in the system, initialize them, and bring them into | 145 | * Boot all other cpus in the system, initialize them, and bring them into |
146 | * the boot function | 146 | * the boot function |
147 | */ | 147 | */ |
148 | int nlm_cpu_ready[NR_CPUS]; | ||
149 | unsigned long nlm_next_gp; | 148 | unsigned long nlm_next_gp; |
150 | unsigned long nlm_next_sp; | 149 | unsigned long nlm_next_sp; |
151 | static cpumask_t phys_cpu_present_mask; | 150 | static cpumask_t phys_cpu_present_mask; |
@@ -168,6 +167,7 @@ void __init nlm_smp_setup(void) | |||
168 | { | 167 | { |
169 | unsigned int boot_cpu; | 168 | unsigned int boot_cpu; |
170 | int num_cpus, i, ncore; | 169 | int num_cpus, i, ncore; |
170 | volatile u32 *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY); | ||
171 | char buf[64]; | 171 | char buf[64]; |
172 | 172 | ||
173 | boot_cpu = hard_smp_processor_id(); | 173 | boot_cpu = hard_smp_processor_id(); |
@@ -181,10 +181,10 @@ void __init nlm_smp_setup(void) | |||
181 | num_cpus = 1; | 181 | num_cpus = 1; |
182 | for (i = 0; i < NR_CPUS; i++) { | 182 | for (i = 0; i < NR_CPUS; i++) { |
183 | /* | 183 | /* |
184 | * nlm_cpu_ready array is not set for the boot_cpu, | 184 | * cpu_ready array is not set for the boot_cpu, |
185 | * it is only set for ASPs (see smpboot.S) | 185 | * it is only set for ASPs (see smpboot.S) |
186 | */ | 186 | */ |
187 | if (nlm_cpu_ready[i]) { | 187 | if (cpu_ready[i]) { |
188 | cpumask_set_cpu(i, &phys_cpu_present_mask); | 188 | cpumask_set_cpu(i, &phys_cpu_present_mask); |
189 | __cpu_number_map[i] = num_cpus; | 189 | __cpu_number_map[i] = num_cpus; |
190 | __cpu_logical_map[num_cpus] = i; | 190 | __cpu_logical_map[num_cpus] = i; |
diff --git a/arch/mips/netlogic/common/smpboot.S b/arch/mips/netlogic/common/smpboot.S index 7c7e884f8912..6029d1b37f88 100644 --- a/arch/mips/netlogic/common/smpboot.S +++ b/arch/mips/netlogic/common/smpboot.S | |||
@@ -109,8 +109,9 @@ NESTED(nlm_rmiboot_preboot, 16, sp) | |||
109 | andi t2, t0, 0x3 /* thread num */ | 109 | andi t2, t0, 0x3 /* thread num */ |
110 | sll t0, 2 /* offset in cpu array */ | 110 | sll t0, 2 /* offset in cpu array */ |
111 | 111 | ||
112 | PTR_LA t1, nlm_cpu_ready /* mark CPU ready */ | 112 | li t3, CKSEG1ADDR(RESET_DATA_PHYS) |
113 | PTR_ADDU t1, t0 | 113 | ADDIU t1, t3, BOOT_CPU_READY |
114 | ADDU t1, t0 | ||
114 | li t3, 1 | 115 | li t3, 1 |
115 | sw t3, 0(t1) | 116 | sw t3, 0(t1) |
116 | 117 | ||
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c index 5bdd354fef48..8f6992432f34 100644 --- a/arch/mips/netlogic/xlp/setup.c +++ b/arch/mips/netlogic/xlp/setup.c | |||
@@ -108,6 +108,7 @@ void __init prom_init(void) | |||
108 | 108 | ||
109 | /* Update reset entry point with CPU init code */ | 109 | /* Update reset entry point with CPU init code */ |
110 | reset_vec = (void *)CKSEG1ADDR(RESET_VEC_PHYS); | 110 | reset_vec = (void *)CKSEG1ADDR(RESET_VEC_PHYS); |
111 | memset(reset_vec, 0, RESET_VEC_SIZE); | ||
111 | memcpy(reset_vec, (void *)nlm_reset_entry, | 112 | memcpy(reset_vec, (void *)nlm_reset_entry, |
112 | (nlm_reset_entry_end - nlm_reset_entry)); | 113 | (nlm_reset_entry_end - nlm_reset_entry)); |
113 | 114 | ||
diff --git a/arch/mips/netlogic/xlp/wakeup.c b/arch/mips/netlogic/xlp/wakeup.c index abb3e08cc052..feb573670f90 100644 --- a/arch/mips/netlogic/xlp/wakeup.c +++ b/arch/mips/netlogic/xlp/wakeup.c | |||
@@ -82,6 +82,7 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask) | |||
82 | struct nlm_soc_info *nodep; | 82 | struct nlm_soc_info *nodep; |
83 | uint64_t syspcibase; | 83 | uint64_t syspcibase; |
84 | uint32_t syscoremask; | 84 | uint32_t syscoremask; |
85 | volatile uint32_t *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY); | ||
85 | int core, n, cpu, count, val; | 86 | int core, n, cpu, count, val; |
86 | 87 | ||
87 | for (n = 0; n < NLM_NR_NODES; n++) { | 88 | for (n = 0; n < NLM_NR_NODES; n++) { |
@@ -125,7 +126,7 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask) | |||
125 | /* spin until the first hw thread sets its ready */ | 126 | /* spin until the first hw thread sets its ready */ |
126 | count = 0x20000000; | 127 | count = 0x20000000; |
127 | do { | 128 | do { |
128 | val = *(volatile int *)&nlm_cpu_ready[cpu]; | 129 | val = cpu_ready[cpu]; |
129 | } while (val == 0 && --count > 0); | 130 | } while (val == 0 && --count > 0); |
130 | } | 131 | } |
131 | } | 132 | } |
diff --git a/arch/mips/netlogic/xlr/setup.c b/arch/mips/netlogic/xlr/setup.c index 7e27f8591867..214d123b79fa 100644 --- a/arch/mips/netlogic/xlr/setup.c +++ b/arch/mips/netlogic/xlr/setup.c | |||
@@ -211,6 +211,7 @@ void __init prom_init(void) | |||
211 | 211 | ||
212 | /* Update reset entry point with CPU init code */ | 212 | /* Update reset entry point with CPU init code */ |
213 | reset_vec = (void *)CKSEG1ADDR(RESET_VEC_PHYS); | 213 | reset_vec = (void *)CKSEG1ADDR(RESET_VEC_PHYS); |
214 | memset(reset_vec, 0, RESET_VEC_SIZE); | ||
214 | memcpy(reset_vec, (void *)nlm_reset_entry, | 215 | memcpy(reset_vec, (void *)nlm_reset_entry, |
215 | (nlm_reset_entry_end - nlm_reset_entry)); | 216 | (nlm_reset_entry_end - nlm_reset_entry)); |
216 | 217 | ||
diff --git a/arch/mips/netlogic/xlr/wakeup.c b/arch/mips/netlogic/xlr/wakeup.c index 3ebf7411d67b..c06e4c9f0478 100644 --- a/arch/mips/netlogic/xlr/wakeup.c +++ b/arch/mips/netlogic/xlr/wakeup.c | |||
@@ -53,6 +53,7 @@ int __cpuinit xlr_wakeup_secondary_cpus(void) | |||
53 | { | 53 | { |
54 | struct nlm_soc_info *nodep; | 54 | struct nlm_soc_info *nodep; |
55 | unsigned int i, j, boot_cpu; | 55 | unsigned int i, j, boot_cpu; |
56 | volatile u32 *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY); | ||
56 | 57 | ||
57 | /* | 58 | /* |
58 | * In case of RMI boot, hit with NMI to get the cores | 59 | * In case of RMI boot, hit with NMI to get the cores |
@@ -71,7 +72,7 @@ int __cpuinit xlr_wakeup_secondary_cpus(void) | |||
71 | nodep->coremask = 1; | 72 | nodep->coremask = 1; |
72 | for (i = 1; i < NLM_CORES_PER_NODE; i++) { | 73 | for (i = 1; i < NLM_CORES_PER_NODE; i++) { |
73 | for (j = 1000000; j > 0; j--) { | 74 | for (j = 1000000; j > 0; j--) { |
74 | if (nlm_cpu_ready[i * NLM_THREADS_PER_CORE]) | 75 | if (cpu_ready[i * NLM_THREADS_PER_CORE]) |
75 | break; | 76 | break; |
76 | udelay(10); | 77 | udelay(10); |
77 | } | 78 | } |