]> git.karo-electronics.de Git - linux-beck.git/commitdiff
MIPS: Netlogic: Add nlm_get_boot_data() helper
authorJayachandran C <jchandra@broadcom.com>
Mon, 10 Jun 2013 06:41:03 +0000 (06:41 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 13 Jun 2013 15:46:42 +0000 (17:46 +0200)
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>
arch/mips/include/asm/netlogic/common.h
arch/mips/netlogic/common/smp.c

index d4ede12b84c63ecd759632e332d69e2cb2707e37..1b54adbd1583a946bcf267a664fcf87992c13246 100644 (file)
@@ -59,13 +59,18 @@ int nlm_wakeup_secondary_cpus(void);
 void nlm_rmiboot_preboot(void);
 void nlm_percpu_init(int hwcpuid);
 
+static inline void *
+nlm_get_boot_data(int offset)
+{
+       return (void *)(CKSEG1ADDR(RESET_DATA_PHYS) + offset);
+}
+
 static inline void
 nlm_set_nmi_handler(void *handler)
 {
-       char *reset_data;
+       void *nmih = nlm_get_boot_data(BOOT_NMI_HANDLER);
 
-       reset_data = (char *)CKSEG1ADDR(RESET_DATA_PHYS);
-       *(int64_t *)(reset_data + BOOT_NMI_HANDLER) = (long)handler;
+       *(int64_t *)nmih = (long)handler;
 }
 
 /*
index da3d3bc02c206b4137e0d59502d5f4143ab5b94d..1f66eef3aea7521eb71a3f42bec5029371887f44 100644 (file)
@@ -254,15 +254,15 @@ unsupp:
 
 int __cpuinit nlm_wakeup_secondary_cpus(void)
 {
-       char *reset_data;
+       u32 *reset_data;
        int threadmode;
 
        /* verify the mask and setup core config variables */
        threadmode = nlm_parse_cpumask(&nlm_cpumask);
 
        /* Setup CPU init parameters */
-       reset_data = (char *)CKSEG1ADDR(RESET_DATA_PHYS);
-       *(int *)(reset_data + BOOT_THREAD_MODE) = threadmode;
+       reset_data = nlm_get_boot_data(BOOT_THREAD_MODE);
+       *reset_data = threadmode;
 
 #ifdef CONFIG_CPU_XLP
        xlp_wakeup_secondary_cpus();