Commit 15f34eb1 authored by Zhao Chenhui's avatar Zhao Chenhui Committed by Kumar Gala

powerpc/85xx: Replace epapr spin table macros/defines with a struct

Signed-off-by: default avatarZhao Chenhui <chenhui.zhao@freescale.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 03bcb7e3
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Author: Andy Fleming <afleming@freescale.com> * Author: Andy Fleming <afleming@freescale.com>
* Kumar Gala <galak@kernel.crashing.org> * Kumar Gala <galak@kernel.crashing.org>
* *
* Copyright 2006-2008, 2011 Freescale Semiconductor Inc. * Copyright 2006-2008, 2011-2012 Freescale Semiconductor Inc.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/kexec.h> #include <linux/kexec.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/cpu.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
...@@ -31,23 +32,21 @@ ...@@ -31,23 +32,21 @@
extern void __early_start(void); extern void __early_start(void);
#define BOOT_ENTRY_ADDR_UPPER 0 struct epapr_spin_table {
#define BOOT_ENTRY_ADDR_LOWER 1 u32 addr_h;
#define BOOT_ENTRY_R3_UPPER 2 u32 addr_l;
#define BOOT_ENTRY_R3_LOWER 3 u32 r3_h;
#define BOOT_ENTRY_RESV 4 u32 r3_l;
#define BOOT_ENTRY_PIR 5 u32 reserved;
#define BOOT_ENTRY_R6_UPPER 6 u32 pir;
#define BOOT_ENTRY_R6_LOWER 7 };
#define NUM_BOOT_ENTRY 8
#define SIZE_BOOT_ENTRY (NUM_BOOT_ENTRY * sizeof(u32))
static int __init static int __init
smp_85xx_kick_cpu(int nr) smp_85xx_kick_cpu(int nr)
{ {
unsigned long flags; unsigned long flags;
const u64 *cpu_rel_addr; const u64 *cpu_rel_addr;
__iomem u32 *bptr_vaddr; __iomem struct epapr_spin_table *spin_table;
struct device_node *np; struct device_node *np;
int n = 0, hw_cpu = get_hard_smp_processor_id(nr); int n = 0, hw_cpu = get_hard_smp_processor_id(nr);
int ioremappable; int ioremappable;
...@@ -75,19 +74,20 @@ smp_85xx_kick_cpu(int nr) ...@@ -75,19 +74,20 @@ smp_85xx_kick_cpu(int nr)
/* Map the spin table */ /* Map the spin table */
if (ioremappable) if (ioremappable)
bptr_vaddr = ioremap(*cpu_rel_addr, SIZE_BOOT_ENTRY); spin_table = ioremap(*cpu_rel_addr,
sizeof(struct epapr_spin_table));
else else
bptr_vaddr = phys_to_virt(*cpu_rel_addr); spin_table = phys_to_virt(*cpu_rel_addr);
local_irq_save(flags); local_irq_save(flags);
out_be32(bptr_vaddr + BOOT_ENTRY_PIR, hw_cpu); out_be32(&spin_table->pir, hw_cpu);
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
out_be32(bptr_vaddr + BOOT_ENTRY_ADDR_LOWER, __pa(__early_start)); out_be32(&spin_table->addr_l, __pa(__early_start));
if (!ioremappable) if (!ioremappable)
flush_dcache_range((ulong)bptr_vaddr, flush_dcache_range((ulong)spin_table,
(ulong)(bptr_vaddr + SIZE_BOOT_ENTRY)); (ulong)spin_table + sizeof(struct epapr_spin_table));
/* Wait a bit for the CPU to ack. */ /* Wait a bit for the CPU to ack. */
while ((__secondary_hold_acknowledge != hw_cpu) && (++n < 1000)) while ((__secondary_hold_acknowledge != hw_cpu) && (++n < 1000))
...@@ -95,18 +95,18 @@ smp_85xx_kick_cpu(int nr) ...@@ -95,18 +95,18 @@ smp_85xx_kick_cpu(int nr)
#else #else
smp_generic_kick_cpu(nr); smp_generic_kick_cpu(nr);
out_be64((u64 *)(bptr_vaddr + BOOT_ENTRY_ADDR_UPPER), out_be64((u64 *)(&spin_table->addr_h),
__pa((u64)*((unsigned long long *) generic_secondary_smp_init))); __pa((u64)*((unsigned long long *)generic_secondary_smp_init)));
if (!ioremappable) if (!ioremappable)
flush_dcache_range((ulong)bptr_vaddr, flush_dcache_range((ulong)spin_table,
(ulong)(bptr_vaddr + SIZE_BOOT_ENTRY)); (ulong)spin_table + sizeof(struct epapr_spin_table));
#endif #endif
local_irq_restore(flags); local_irq_restore(flags);
if (ioremappable) if (ioremappable)
iounmap(bptr_vaddr); iounmap(spin_table);
pr_debug("waited %d msecs for CPU #%d.\n", n, nr); pr_debug("waited %d msecs for CPU #%d.\n", n, nr);
......
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