diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2008-04-28 12:14:26 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-04-28 12:14:26 -0400 |
commit | 39b8d5254246ac56342b72f812255c8f7a74dca9 (patch) | |
tree | a9ec6bfb5d09a8367c34cc2067328d1b49bb46c1 /arch/mips/mips-boards/generic/amon.c | |
parent | 308402445e005a039a72b315cd9b5ceeaea0063c (diff) |
[MIPS] Add support for MIPS CMP platform.
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mips-boards/generic/amon.c')
-rw-r--r-- | arch/mips/mips-boards/generic/amon.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/arch/mips/mips-boards/generic/amon.c b/arch/mips/mips-boards/generic/amon.c new file mode 100644 index 000000000000..b7633fda4180 --- /dev/null +++ b/arch/mips/mips-boards/generic/amon.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 MIPS Technologies, Inc. | ||
3 | * All rights reserved. | ||
4 | |||
5 | * This program is free software; you can distribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License (Version 2) as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
17 | * | ||
18 | * Arbitrary Monitor interface | ||
19 | */ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/smp.h> | ||
24 | |||
25 | #include <asm-mips/addrspace.h> | ||
26 | #include <asm-mips/mips-boards/launch.h> | ||
27 | #include <asm-mips/mipsmtregs.h> | ||
28 | |||
29 | int amon_cpu_avail(int cpu) | ||
30 | { | ||
31 | struct cpulaunch *launch = (struct cpulaunch *)KSEG0ADDR(CPULAUNCH); | ||
32 | |||
33 | if (cpu < 0 || cpu >= NCPULAUNCH) { | ||
34 | pr_debug("avail: cpu%d is out of range\n", cpu); | ||
35 | return 0; | ||
36 | } | ||
37 | |||
38 | launch += cpu; | ||
39 | if (!(launch->flags & LAUNCH_FREADY)) { | ||
40 | pr_debug("avail: cpu%d is not ready\n", cpu); | ||
41 | return 0; | ||
42 | } | ||
43 | if (launch->flags & (LAUNCH_FGO|LAUNCH_FGONE)) { | ||
44 | pr_debug("avail: too late.. cpu%d is already gone\n", cpu); | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | return 1; | ||
49 | } | ||
50 | |||
51 | void amon_cpu_start(int cpu, | ||
52 | unsigned long pc, unsigned long sp, | ||
53 | unsigned long gp, unsigned long a0) | ||
54 | { | ||
55 | volatile struct cpulaunch *launch = | ||
56 | (struct cpulaunch *)KSEG0ADDR(CPULAUNCH); | ||
57 | |||
58 | if (!amon_cpu_avail(cpu)) | ||
59 | return; | ||
60 | if (cpu == smp_processor_id()) { | ||
61 | pr_debug("launch: I am cpu%d!\n", cpu); | ||
62 | return; | ||
63 | } | ||
64 | launch += cpu; | ||
65 | |||
66 | pr_debug("launch: starting cpu%d\n", cpu); | ||
67 | |||
68 | launch->pc = pc; | ||
69 | launch->gp = gp; | ||
70 | launch->sp = sp; | ||
71 | launch->a0 = a0; | ||
72 | |||
73 | /* Make sure target sees parameters before the go bit */ | ||
74 | smp_mb(); | ||
75 | |||
76 | launch->flags |= LAUNCH_FGO; | ||
77 | while ((launch->flags & LAUNCH_FGONE) == 0) | ||
78 | ; | ||
79 | pr_debug("launch: cpu%d gone!\n", cpu); | ||
80 | } | ||