aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJayachandran C <jchandra@broadcom.com>2013-06-10 02:41:03 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-06-13 11:46:42 -0400
commit53c832197f3adc5a360336f75fe34a95fe2d796b (patch)
tree38051db66167b987dbdd8aa4064fbb46f86b3427 /arch
parent571886b2a52395f030d439c6259663a033e11e6a (diff)
MIPS: Netlogic: Add nlm_get_boot_data() helper
This moves the calculation and casting needed to access the CPU initialization data to a function nlm_get_boot_data() Signed-off-by: Jayachandran C <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5426/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/include/asm/netlogic/common.h11
-rw-r--r--arch/mips/netlogic/common/smp.c6
2 files changed, 11 insertions, 6 deletions
diff --git a/arch/mips/include/asm/netlogic/common.h b/arch/mips/include/asm/netlogic/common.h
index d4ede12b84c6..1b54adbd1583 100644
--- a/arch/mips/include/asm/netlogic/common.h
+++ b/arch/mips/include/asm/netlogic/common.h
@@ -59,13 +59,18 @@ int nlm_wakeup_secondary_cpus(void);
59void nlm_rmiboot_preboot(void); 59void nlm_rmiboot_preboot(void);
60void nlm_percpu_init(int hwcpuid); 60void nlm_percpu_init(int hwcpuid);
61 61
62static inline void *
63nlm_get_boot_data(int offset)
64{
65 return (void *)(CKSEG1ADDR(RESET_DATA_PHYS) + offset);
66}
67
62static inline void 68static inline void
63nlm_set_nmi_handler(void *handler) 69nlm_set_nmi_handler(void *handler)
64{ 70{
65 char *reset_data; 71 void *nmih = nlm_get_boot_data(BOOT_NMI_HANDLER);
66 72
67 reset_data = (char *)CKSEG1ADDR(RESET_DATA_PHYS); 73 *(int64_t *)nmih = (long)handler;
68 *(int64_t *)(reset_data + BOOT_NMI_HANDLER) = (long)handler;
69} 74}
70 75
71/* 76/*
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index da3d3bc02c20..1f66eef3aea7 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -254,15 +254,15 @@ unsupp:
254 254
255int __cpuinit nlm_wakeup_secondary_cpus(void) 255int __cpuinit nlm_wakeup_secondary_cpus(void)
256{ 256{
257 char *reset_data; 257 u32 *reset_data;
258 int threadmode; 258 int threadmode;
259 259
260 /* verify the mask and setup core config variables */ 260 /* verify the mask and setup core config variables */
261 threadmode = nlm_parse_cpumask(&nlm_cpumask); 261 threadmode = nlm_parse_cpumask(&nlm_cpumask);
262 262
263 /* Setup CPU init parameters */ 263 /* Setup CPU init parameters */
264 reset_data = (char *)CKSEG1ADDR(RESET_DATA_PHYS); 264 reset_data = nlm_get_boot_data(BOOT_THREAD_MODE);
265 *(int *)(reset_data + BOOT_THREAD_MODE) = threadmode; 265 *reset_data = threadmode;
266 266
267#ifdef CONFIG_CPU_XLP 267#ifdef CONFIG_CPU_XLP
268 xlp_wakeup_secondary_cpus(); 268 xlp_wakeup_secondary_cpus();