linux-mips
[Top] [All Lists]

[PATCH 04/11] MIPS: Netlogic: Add nlm_get_boot_data() helper

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH 04/11] MIPS: Netlogic: Add nlm_get_boot_data() helper
From: "Jayachandran C" <jchandra@broadcom.com>
Date: Mon, 10 Jun 2013 13:11:03 +0530
Cc: "Jayachandran C" <jchandra@broadcom.com>
In-reply-to: <1370850070-5127-1-git-send-email-jchandra@broadcom.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1370850070-5127-1-git-send-email-jchandra@broadcom.com>
Sender: linux-mips-bounce@linux-mips.org
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>
---
 arch/mips/include/asm/netlogic/common.h |   11 ++++++++---
 arch/mips/netlogic/common/smp.c         |    6 +++---
 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 d4ede12..1b54adb 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);
 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;
 }
 
 /*
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index da3d3bc..1f66eef 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -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();
-- 
1.7.9.5



<Prev in Thread] Current Thread [Next in Thread>