Commit 53c83219 authored by Jayachandran C's avatar Jayachandran C Committed by Ralf Baechle

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: default avatarJayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5426/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 571886b2
...@@ -59,13 +59,18 @@ int nlm_wakeup_secondary_cpus(void); ...@@ -59,13 +59,18 @@ int nlm_wakeup_secondary_cpus(void);
void nlm_rmiboot_preboot(void); void nlm_rmiboot_preboot(void);
void nlm_percpu_init(int hwcpuid); 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 static inline void
nlm_set_nmi_handler(void *handler) 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 *)nmih = (long)handler;
*(int64_t *)(reset_data + BOOT_NMI_HANDLER) = (long)handler;
} }
/* /*
......
...@@ -254,15 +254,15 @@ static int nlm_parse_cpumask(cpumask_t *wakeup_mask) ...@@ -254,15 +254,15 @@ static int nlm_parse_cpumask(cpumask_t *wakeup_mask)
int __cpuinit nlm_wakeup_secondary_cpus(void) int __cpuinit nlm_wakeup_secondary_cpus(void)
{ {
char *reset_data; u32 *reset_data;
int threadmode; int threadmode;
/* verify the mask and setup core config variables */ /* verify the mask and setup core config variables */
threadmode = nlm_parse_cpumask(&nlm_cpumask); threadmode = nlm_parse_cpumask(&nlm_cpumask);
/* Setup CPU init parameters */ /* Setup CPU init parameters */
reset_data = (char *)CKSEG1ADDR(RESET_DATA_PHYS); reset_data = nlm_get_boot_data(BOOT_THREAD_MODE);
*(int *)(reset_data + BOOT_THREAD_MODE) = threadmode; *reset_data = threadmode;
#ifdef CONFIG_CPU_XLP #ifdef CONFIG_CPU_XLP
xlp_wakeup_secondary_cpus(); xlp_wakeup_secondary_cpus();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment