diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-12-07 03:58:55 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-12-07 04:10:14 -0500 |
commit | b332b8bc9c67165eabdfc7d10b4a2e4cc9f937d0 (patch) | |
tree | de3ab55f4519918fc77b90765a185973b282993d /arch/sparc64 | |
parent | f194d132e4971111f85c18c96067acffb13cee6d (diff) |
[SPARC64]: Fix memory controller register access when non-SMP.
get_cpu() always returns zero on non-SMP builds, but we
really want the physical cpu number in this code in order
to do the right thing.
Based upon a non-SMP kernel boot failure report from Bernd Zeimetz.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/chmc.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc64/kernel/chmc.c index 777d34577045..6d4f02e8a4cf 100644 --- a/arch/sparc64/kernel/chmc.c +++ b/arch/sparc64/kernel/chmc.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* $Id: chmc.c,v 1.4 2002/01/08 16:00:14 davem Exp $ | 1 | /* memctrlr.c: Driver for UltraSPARC-III memory controller. |
2 | * memctrlr.c: Driver for UltraSPARC-III memory controller. | ||
3 | * | 2 | * |
4 | * Copyright (C) 2001 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 2001, 2007 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | ||
7 | #include <linux/module.h> | 6 | #include <linux/module.h> |
@@ -16,6 +15,7 @@ | |||
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <asm/spitfire.h> | 16 | #include <asm/spitfire.h> |
18 | #include <asm/chmctrl.h> | 17 | #include <asm/chmctrl.h> |
18 | #include <asm/cpudata.h> | ||
19 | #include <asm/oplib.h> | 19 | #include <asm/oplib.h> |
20 | #include <asm/prom.h> | 20 | #include <asm/prom.h> |
21 | #include <asm/io.h> | 21 | #include <asm/io.h> |
@@ -242,8 +242,11 @@ int chmc_getunumber(int syndrome_code, | |||
242 | */ | 242 | */ |
243 | static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset) | 243 | static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset) |
244 | { | 244 | { |
245 | unsigned long ret; | 245 | unsigned long ret, this_cpu; |
246 | int this_cpu = get_cpu(); | 246 | |
247 | preempt_disable(); | ||
248 | |||
249 | this_cpu = real_hard_smp_processor_id(); | ||
247 | 250 | ||
248 | if (mp->portid == this_cpu) { | 251 | if (mp->portid == this_cpu) { |
249 | __asm__ __volatile__("ldxa [%1] %2, %0" | 252 | __asm__ __volatile__("ldxa [%1] %2, %0" |
@@ -255,7 +258,8 @@ static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset) | |||
255 | : "r" (mp->regs + offset), | 258 | : "r" (mp->regs + offset), |
256 | "i" (ASI_PHYS_BYPASS_EC_E)); | 259 | "i" (ASI_PHYS_BYPASS_EC_E)); |
257 | } | 260 | } |
258 | put_cpu(); | 261 | |
262 | preempt_enable(); | ||
259 | 263 | ||
260 | return ret; | 264 | return ret; |
261 | } | 265 | } |