aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven J. Hill <Steven.Hill@imgtec.com>2014-01-01 10:35:32 -0500
committerRalf Baechle <ralf@linux-mips.org>2014-01-22 14:19:02 -0500
commit5792bf6438658cb129c3022aa2cf7e9b19b5de3a (patch)
tree41d36b19a9d79bad816e3557a45aa920491db4c9
parent1336113a6c93fa345f7465e066313e5629f581d9 (diff)
MIPS: APRP: Code formatting clean-ups.
Clean-up code according to the 'checkpatch.pl' script. Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com> Reviewed-by: Qais Yousef <Qais.Yousef@imgtec.com> Patchwork: http://patchwork.linux-mips.org/patch/6097/ Reviewed-by: John Crispin <blogic@openwrt.org>
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/include/asm/amon.h15
-rw-r--r--arch/mips/include/asm/rtlx.h5
-rw-r--r--arch/mips/include/asm/vpe.h19
-rw-r--r--arch/mips/kernel/rtlx.c131
-rw-r--r--arch/mips/kernel/vpe-mt.c6
-rw-r--r--arch/mips/kernel/vpe.c252
-rw-r--r--arch/mips/mti-malta/malta-amon.c24
-rw-r--r--arch/mips/mti-malta/malta-int.c115
9 files changed, 248 insertions, 320 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bcd2fab3c4ad..a7ec153be0b9 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1950,7 +1950,6 @@ config MIPS_VPE_LOADER_TOM
1950 you to ensure the amount you put in the option and the space your 1950 you to ensure the amount you put in the option and the space your
1951 program requires is less or equal to the amount physically present. 1951 program requires is less or equal to the amount physically present.
1952 1952
1953# this should possibly be in drivers/char, but it is rather cpu related. Hmmm
1954config MIPS_VPE_APSP_API 1953config MIPS_VPE_APSP_API
1955 bool "Enable support for AP/SP API (RTLX)" 1954 bool "Enable support for AP/SP API (RTLX)"
1956 depends on MIPS_VPE_LOADER 1955 depends on MIPS_VPE_LOADER
diff --git a/arch/mips/include/asm/amon.h b/arch/mips/include/asm/amon.h
index 3bd6e763454d..3cc03c64a9c7 100644
--- a/arch/mips/include/asm/amon.h
+++ b/arch/mips/include/asm/amon.h
@@ -1,7 +1,12 @@
1/* 1/*
2 * Amon support 2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2013 Imagination Technologies Ltd.
7 *
8 * Arbitrary Monitor Support (AMON)
3 */ 9 */
4 10int amon_cpu_avail(int cpu);
5int amon_cpu_avail(int); 11int amon_cpu_start(int cpu, unsigned long pc, unsigned long sp,
6int amon_cpu_start(int, unsigned long, unsigned long, 12 unsigned long gp, unsigned long a0);
7 unsigned long, unsigned long);
diff --git a/arch/mips/include/asm/rtlx.h b/arch/mips/include/asm/rtlx.h
index fa86dfdfd3de..c1020654876e 100644
--- a/arch/mips/include/asm/rtlx.h
+++ b/arch/mips/include/asm/rtlx.h
@@ -1,8 +1,11 @@
1/* 1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 6 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
3 * Copyright (C) 2013 Imagination Technologies Ltd. 7 * Copyright (C) 2013 Imagination Technologies Ltd.
4 */ 8 */
5
6#ifndef __ASM_RTLX_H_ 9#ifndef __ASM_RTLX_H_
7#define __ASM_RTLX_H_ 10#define __ASM_RTLX_H_
8 11
diff --git a/arch/mips/include/asm/vpe.h b/arch/mips/include/asm/vpe.h
index becd5554cf5b..e0684f5f0054 100644
--- a/arch/mips/include/asm/vpe.h
+++ b/arch/mips/include/asm/vpe.h
@@ -1,22 +1,11 @@
1/* 1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 6 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 * Copyright (C) 2013 Imagination Technologies Ltd. 7 * Copyright (C) 2013 Imagination Technologies Ltd.
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 */ 8 */
19
20#ifndef _ASM_VPE_H 9#ifndef _ASM_VPE_H
21#define _ASM_VPE_H 10#define _ASM_VPE_H
22 11
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 59db407d0499..31b1b763cb29 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -1,46 +1,23 @@
1/* 1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 6 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org) 7 * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org)
4 * 8 * Copyright (C) 2013 Imagination Technologies Ltd.
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 */ 9 */
19
20#include <linux/device.h>
21#include <linux/kernel.h> 10#include <linux/kernel.h>
22#include <linux/fs.h> 11#include <linux/fs.h>
23#include <linux/init.h>
24#include <asm/uaccess.h>
25#include <linux/list.h>
26#include <linux/vmalloc.h>
27#include <linux/elf.h>
28#include <linux/seq_file.h>
29#include <linux/syscalls.h> 12#include <linux/syscalls.h>
30#include <linux/moduleloader.h> 13#include <linux/moduleloader.h>
31#include <linux/interrupt.h> 14#include <linux/atomic.h>
32#include <linux/poll.h>
33#include <linux/sched.h>
34#include <linux/wait.h>
35#include <asm/mipsmtregs.h> 15#include <asm/mipsmtregs.h>
36#include <asm/mips_mt.h> 16#include <asm/mips_mt.h>
37#include <asm/cacheflush.h>
38#include <linux/atomic.h>
39#include <asm/cpu.h>
40#include <asm/processor.h> 17#include <asm/processor.h>
41#include <asm/vpe.h>
42#include <asm/rtlx.h> 18#include <asm/rtlx.h>
43#include <asm/setup.h> 19#include <asm/setup.h>
20#include <asm/vpe.h>
44 21
45static int sp_stopping; 22static int sp_stopping;
46struct rtlx_info *rtlx; 23struct rtlx_info *rtlx;
@@ -53,22 +30,22 @@ static void __used dump_rtlx(void)
53{ 30{
54 int i; 31 int i;
55 32
56 printk("id 0x%lx state %d\n", rtlx->id, rtlx->state); 33 pr_info("id 0x%lx state %d\n", rtlx->id, rtlx->state);
57 34
58 for (i = 0; i < RTLX_CHANNELS; i++) { 35 for (i = 0; i < RTLX_CHANNELS; i++) {
59 struct rtlx_channel *chan = &rtlx->channel[i]; 36 struct rtlx_channel *chan = &rtlx->channel[i];
60 37
61 printk(" rt_state %d lx_state %d buffer_size %d\n", 38 pr_info(" rt_state %d lx_state %d buffer_size %d\n",
62 chan->rt_state, chan->lx_state, chan->buffer_size); 39 chan->rt_state, chan->lx_state, chan->buffer_size);
63 40
64 printk(" rt_read %d rt_write %d\n", 41 pr_info(" rt_read %d rt_write %d\n",
65 chan->rt_read, chan->rt_write); 42 chan->rt_read, chan->rt_write);
66 43
67 printk(" lx_read %d lx_write %d\n", 44 pr_info(" lx_read %d lx_write %d\n",
68 chan->lx_read, chan->lx_write); 45 chan->lx_read, chan->lx_write);
69 46
70 printk(" rt_buffer <%s>\n", chan->rt_buffer); 47 pr_info(" rt_buffer <%s>\n", chan->rt_buffer);
71 printk(" lx_buffer <%s>\n", chan->lx_buffer); 48 pr_info(" lx_buffer <%s>\n", chan->lx_buffer);
72 } 49 }
73} 50}
74 51
@@ -76,8 +53,7 @@ static void __used dump_rtlx(void)
76static int rtlx_init(struct rtlx_info *rtlxi) 53static int rtlx_init(struct rtlx_info *rtlxi)
77{ 54{
78 if (rtlxi->id != RTLX_ID) { 55 if (rtlxi->id != RTLX_ID) {
79 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n", 56 pr_err("no valid RTLX id at 0x%p 0x%lx\n", rtlxi, rtlxi->id);
80 rtlxi, rtlxi->id);
81 return -ENOEXEC; 57 return -ENOEXEC;
82 } 58 }
83 59
@@ -93,7 +69,7 @@ void rtlx_starting(int vpe)
93 sp_stopping = 0; 69 sp_stopping = 0;
94 70
95 /* force a reload of rtlx */ 71 /* force a reload of rtlx */
96 rtlx=NULL; 72 rtlx = NULL;
97 73
98 /* wake up any sleeping rtlx_open's */ 74 /* wake up any sleeping rtlx_open's */
99 for (i = 0; i < RTLX_CHANNELS; i++) 75 for (i = 0; i < RTLX_CHANNELS; i++)
@@ -118,31 +94,30 @@ int rtlx_open(int index, int can_sleep)
118 int ret = 0; 94 int ret = 0;
119 95
120 if (index >= RTLX_CHANNELS) { 96 if (index >= RTLX_CHANNELS) {
121 printk(KERN_DEBUG "rtlx_open index out of range\n"); 97 pr_debug(KERN_DEBUG "rtlx_open index out of range\n");
122 return -ENOSYS; 98 return -ENOSYS;
123 } 99 }
124 100
125 if (atomic_inc_return(&channel_wqs[index].in_open) > 1) { 101 if (atomic_inc_return(&channel_wqs[index].in_open) > 1) {
126 printk(KERN_DEBUG "rtlx_open channel %d already opened\n", 102 pr_debug(KERN_DEBUG "rtlx_open channel %d already opened\n", index);
127 index);
128 ret = -EBUSY; 103 ret = -EBUSY;
129 goto out_fail; 104 goto out_fail;
130 } 105 }
131 106
132 if (rtlx == NULL) { 107 if (rtlx == NULL) {
133 if( (p = vpe_get_shared(tclimit)) == NULL) { 108 p = vpe_get_shared(aprp_cpu_index());
134 if (can_sleep) { 109 if (p == NULL) {
135 ret = __wait_event_interruptible( 110 if (can_sleep) {
111 ret = __wait_event_interruptible(
136 channel_wqs[index].lx_queue, 112 channel_wqs[index].lx_queue,
137 (p = vpe_get_shared(tclimit))); 113 (p = vpe_get_shared(aprp_cpu_index())));
138 if (ret) 114 if (ret)
115 goto out_fail;
116 } else {
117 pr_debug("No SP program loaded, and device opened with O_NONBLOCK\n");
118 ret = -ENOSYS;
139 goto out_fail; 119 goto out_fail;
140 } else { 120 }
141 printk(KERN_DEBUG "No SP program loaded, and device "
142 "opened with O_NONBLOCK\n");
143 ret = -ENOSYS;
144 goto out_fail;
145 }
146 } 121 }
147 122
148 smp_rmb(); 123 smp_rmb();
@@ -164,24 +139,24 @@ int rtlx_open(int index, int can_sleep)
164 ret = -ERESTARTSYS; 139 ret = -ERESTARTSYS;
165 goto out_fail; 140 goto out_fail;
166 } 141 }
167 finish_wait(&channel_wqs[index].lx_queue, &wait); 142 finish_wait(&channel_wqs[index].lx_queue,
143 &wait);
168 } else { 144 } else {
169 pr_err(" *vpe_get_shared is NULL. " 145 pr_err(" *vpe_get_shared is NULL. Has an SP program been loaded?\n");
170 "Has an SP program been loaded?\n");
171 ret = -ENOSYS; 146 ret = -ENOSYS;
172 goto out_fail; 147 goto out_fail;
173 } 148 }
174 } 149 }
175 150
176 if ((unsigned int)*p < KSEG0) { 151 if ((unsigned int)*p < KSEG0) {
177 printk(KERN_WARNING "vpe_get_shared returned an " 152 pr_warn("vpe_get_shared returned an invalid pointer maybe an error code %d\n",
178 "invalid pointer maybe an error code %d\n", 153 (int)*p);
179 (int)*p);
180 ret = -ENOSYS; 154 ret = -ENOSYS;
181 goto out_fail; 155 goto out_fail;
182 } 156 }
183 157
184 if ((ret = rtlx_init(*p)) < 0) 158 ret = rtlx_init(*p);
159 if (ret < 0)
185 goto out_ret; 160 goto out_ret;
186 } 161 }
187 162
@@ -312,7 +287,7 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
312 size_t fl; 287 size_t fl;
313 288
314 if (rtlx == NULL) 289 if (rtlx == NULL)
315 return(-ENOSYS); 290 return -ENOSYS;
316 291
317 rt = &rtlx->channel[index]; 292 rt = &rtlx->channel[index];
318 293
@@ -321,8 +296,8 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
321 rt_read = rt->rt_read; 296 rt_read = rt->rt_read;
322 297
323 /* total number of bytes to copy */ 298 /* total number of bytes to copy */
324 count = min(count, (size_t)write_spacefree(rt_read, rt->rt_write, 299 count = min_t(size_t, count, write_spacefree(rt_read, rt->rt_write,
325 rt->buffer_size)); 300 rt->buffer_size));
326 301
327 /* first bit from write pointer to the end of the buffer, or count */ 302 /* first bit from write pointer to the end of the buffer, or count */
328 fl = min(count, (size_t) rt->buffer_size - rt->rt_write); 303 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
@@ -332,9 +307,8 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
332 goto out; 307 goto out;
333 308
334 /* if there's any left copy to the beginning of the buffer */ 309 /* if there's any left copy to the beginning of the buffer */
335 if (count - fl) { 310 if (count - fl)
336 failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl); 311 failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl);
337 }
338 312
339out: 313out:
340 count -= failed; 314 count -= failed;
@@ -360,7 +334,7 @@ static int file_release(struct inode *inode, struct file *filp)
360 return rtlx_release(iminor(inode)); 334 return rtlx_release(iminor(inode));
361} 335}
362 336
363static unsigned int file_poll(struct file *file, poll_table * wait) 337static unsigned int file_poll(struct file *file, poll_table *wait)
364{ 338{
365 int minor = iminor(file_inode(file)); 339 int minor = iminor(file_inode(file));
366 unsigned int mask = 0; 340 unsigned int mask = 0;
@@ -382,21 +356,20 @@ static unsigned int file_poll(struct file *file, poll_table * wait)
382 return mask; 356 return mask;
383} 357}
384 358
385static ssize_t file_read(struct file *file, char __user * buffer, size_t count, 359static ssize_t file_read(struct file *file, char __user *buffer, size_t count,
386 loff_t * ppos) 360 loff_t *ppos)
387{ 361{
388 int minor = iminor(file_inode(file)); 362 int minor = iminor(file_inode(file));
389 363
390 /* data available? */ 364 /* data available? */
391 if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) { 365 if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1))
392 return 0; // -EAGAIN makes cat whinge 366 return 0; /* -EAGAIN makes 'cat' whine */
393 }
394 367
395 return rtlx_read(minor, buffer, count); 368 return rtlx_read(minor, buffer, count);
396} 369}
397 370
398static ssize_t file_write(struct file *file, const char __user * buffer, 371static ssize_t file_write(struct file *file, const char __user *buffer,
399 size_t count, loff_t * ppos) 372 size_t count, loff_t *ppos)
400{ 373{
401 int minor = iminor(file_inode(file)); 374 int minor = iminor(file_inode(file));
402 375
@@ -418,11 +391,11 @@ static ssize_t file_write(struct file *file, const char __user * buffer,
418 391
419const struct file_operations rtlx_fops = { 392const struct file_operations rtlx_fops = {
420 .owner = THIS_MODULE, 393 .owner = THIS_MODULE,
421 .open = file_open, 394 .open = file_open,
422 .release = file_release, 395 .release = file_release,
423 .write = file_write, 396 .write = file_write,
424 .read = file_read, 397 .read = file_read,
425 .poll = file_poll, 398 .poll = file_poll,
426 .llseek = noop_llseek, 399 .llseek = noop_llseek,
427}; 400};
428 401
diff --git a/arch/mips/kernel/vpe-mt.c b/arch/mips/kernel/vpe-mt.c
index 45abe9abb611..949ae0e17018 100644
--- a/arch/mips/kernel/vpe-mt.c
+++ b/arch/mips/kernel/vpe-mt.c
@@ -26,7 +26,7 @@ static int hw_tcs, hw_vpes;
26int vpe_run(struct vpe *v) 26int vpe_run(struct vpe *v)
27{ 27{
28 unsigned long flags, val, dmt_flag; 28 unsigned long flags, val, dmt_flag;
29 struct vpe_notifications *n; 29 struct vpe_notifications *notifier;
30 unsigned int vpeflags; 30 unsigned int vpeflags;
31 struct tc *t; 31 struct tc *t;
32 32
@@ -139,8 +139,8 @@ int vpe_run(struct vpe *v)
139 emt(dmt_flag); 139 emt(dmt_flag);
140 local_irq_restore(flags); 140 local_irq_restore(flags);
141 141
142 list_for_each_entry(n, &v->notify, list) 142 list_for_each_entry(notifier, &v->notify, list)
143 n->start(VPE_MODULE_MINOR); 143 notifier->start(VPE_MODULE_MINOR);
144 144
145 return 0; 145 return 0;
146} 146}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 61dfd5b050ff..42d3ca08bd28 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1,37 +1,22 @@
1/* 1/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 2 * This file is subject to the terms and conditions of the GNU General Public
3 * 3 * License. See the file "COPYING" in the main directory of this archive
4 * This program is free software; you can distribute it and/or modify it 4 * for more details.
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 */
17
18/*
19 * VPE support module
20 * 5 *
21 * Provides support for loading a MIPS SP program on VPE1. 6 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
22 * The SP environment is rather simple, no tlb's. It needs to be relocatable 7 * Copyright (C) 2013 Imagination Technologies Ltd.
23 * (or partially linked). You should initialise your stack in the startup
24 * code. This loader looks for the symbol __start and sets up
25 * execution to resume from there. The MIPS SDE kit contains suitable examples.
26 * 8 *
27 * To load and run, simply cat a SP 'program file' to /dev/vpe1. 9 * VPE spport module for loading a MIPS SP program into VPE1. The SP
28 * i.e cat spapp >/dev/vpe1. 10 * environment is rather simple since there are no TLBs. It needs
11 * to be relocatable (or partiall linked). Initialize your stack in
12 * the startup-code. The loader looks for the symbol __start and sets
13 * up the execution to resume from there. To load and run, simply do
14 * a cat SP 'binary' to the /dev/vpe1 device.
29 */ 15 */
30#include <linux/kernel.h> 16#include <linux/kernel.h>
31#include <linux/device.h> 17#include <linux/device.h>
32#include <linux/fs.h> 18#include <linux/fs.h>
33#include <linux/init.h> 19#include <linux/init.h>
34#include <asm/uaccess.h>
35#include <linux/slab.h> 20#include <linux/slab.h>
36#include <linux/list.h> 21#include <linux/list.h>
37#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
@@ -46,7 +31,6 @@
46#include <asm/mipsmtregs.h> 31#include <asm/mipsmtregs.h>
47#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
48#include <linux/atomic.h> 33#include <linux/atomic.h>
49#include <asm/cpu.h>
50#include <asm/mips_mt.h> 34#include <asm/mips_mt.h>
51#include <asm/processor.h> 35#include <asm/processor.h>
52#include <asm/vpe.h> 36#include <asm/vpe.h>
@@ -109,8 +93,9 @@ struct vpe *alloc_vpe(int minor)
109{ 93{
110 struct vpe *v; 94 struct vpe *v;
111 95
112 if ((v = kzalloc(sizeof(struct vpe), GFP_KERNEL)) == NULL) 96 v = kzalloc(sizeof(struct vpe), GFP_KERNEL);
113 return NULL; 97 if (v == NULL)
98 goto out;
114 99
115 INIT_LIST_HEAD(&v->tc); 100 INIT_LIST_HEAD(&v->tc);
116 spin_lock(&vpecontrol.vpe_list_lock); 101 spin_lock(&vpecontrol.vpe_list_lock);
@@ -120,6 +105,7 @@ struct vpe *alloc_vpe(int minor)
120 INIT_LIST_HEAD(&v->notify); 105 INIT_LIST_HEAD(&v->notify);
121 v->minor = VPE_MODULE_MINOR; 106 v->minor = VPE_MODULE_MINOR;
122 107
108out:
123 return v; 109 return v;
124} 110}
125 111
@@ -128,7 +114,8 @@ struct tc *alloc_tc(int index)
128{ 114{
129 struct tc *tc; 115 struct tc *tc;
130 116
131 if ((tc = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL) 117 tc = kzalloc(sizeof(struct tc), GFP_KERNEL);
118 if (tc == NULL)
132 goto out; 119 goto out;
133 120
134 INIT_LIST_HEAD(&tc->tc); 121 INIT_LIST_HEAD(&tc->tc);
@@ -151,7 +138,7 @@ void release_vpe(struct vpe *v)
151 kfree(v); 138 kfree(v);
152} 139}
153 140
154/* Find some VPE program space */ 141/* Find some VPE program space */
155void *alloc_progmem(unsigned long len) 142void *alloc_progmem(unsigned long len)
156{ 143{
157 void *addr; 144 void *addr;
@@ -179,7 +166,7 @@ void release_progmem(void *ptr)
179} 166}
180 167
181/* Update size with this section: return offset. */ 168/* Update size with this section: return offset. */
182static long get_offset(unsigned long *size, Elf_Shdr * sechdr) 169static long get_offset(unsigned long *size, Elf_Shdr *sechdr)
183{ 170{
184 long ret; 171 long ret;
185 172
@@ -192,8 +179,8 @@ static long get_offset(unsigned long *size, Elf_Shdr * sechdr)
192 might -- code, read-only data, read-write data, small data. Tally 179 might -- code, read-only data, read-write data, small data. Tally
193 sizes, and place the offsets into sh_entsize fields: high bit means it 180 sizes, and place the offsets into sh_entsize fields: high bit means it
194 belongs in init. */ 181 belongs in init. */
195static void layout_sections(struct module *mod, const Elf_Ehdr * hdr, 182static void layout_sections(struct module *mod, const Elf_Ehdr *hdr,
196 Elf_Shdr * sechdrs, const char *secstrings) 183 Elf_Shdr *sechdrs, const char *secstrings)
197{ 184{
198 static unsigned long const masks[][2] = { 185 static unsigned long const masks[][2] = {
199 /* NOTE: all executable code must be the first section 186 /* NOTE: all executable code must be the first section
@@ -213,7 +200,6 @@ static void layout_sections(struct module *mod, const Elf_Ehdr * hdr,
213 for (i = 0; i < hdr->e_shnum; ++i) { 200 for (i = 0; i < hdr->e_shnum; ++i) {
214 Elf_Shdr *s = &sechdrs[i]; 201 Elf_Shdr *s = &sechdrs[i];
215 202
216 // || strncmp(secstrings + s->sh_name, ".init", 5) == 0)
217 if ((s->sh_flags & masks[m][0]) != masks[m][0] 203 if ((s->sh_flags & masks[m][0]) != masks[m][0]
218 || (s->sh_flags & masks[m][1]) 204 || (s->sh_flags & masks[m][1])
219 || s->sh_entsize != ~0UL) 205 || s->sh_entsize != ~0UL)
@@ -228,7 +214,6 @@ static void layout_sections(struct module *mod, const Elf_Ehdr * hdr,
228 } 214 }
229} 215}
230 216
231
232/* from module-elf32.c, but subverted a little */ 217/* from module-elf32.c, but subverted a little */
233 218
234struct mips_hi16 { 219struct mips_hi16 {
@@ -251,20 +236,18 @@ static int apply_r_mips_gprel16(struct module *me, uint32_t *location,
251{ 236{
252 int rel; 237 int rel;
253 238
254 if( !(*location & 0xffff) ) { 239 if (!(*location & 0xffff)) {
255 rel = (int)v - gp_addr; 240 rel = (int)v - gp_addr;
256 } 241 } else {
257 else {
258 /* .sbss + gp(relative) + offset */ 242 /* .sbss + gp(relative) + offset */
259 /* kludge! */ 243 /* kludge! */
260 rel = (int)(short)((int)v + gp_offs + 244 rel = (int)(short)((int)v + gp_offs +
261 (int)(short)(*location & 0xffff) - gp_addr); 245 (int)(short)(*location & 0xffff) - gp_addr);
262 } 246 }
263 247
264 if( (rel > 32768) || (rel < -32768) ) { 248 if ((rel > 32768) || (rel < -32768)) {
265 printk(KERN_DEBUG "VPE loader: apply_r_mips_gprel16: " 249 pr_debug("VPE loader: apply_r_mips_gprel16: relative address 0x%x out of range of gp register\n",
266 "relative address 0x%x out of range of gp register\n", 250 rel);
267 rel);
268 return -ENOEXEC; 251 return -ENOEXEC;
269 } 252 }
270 253
@@ -278,12 +261,12 @@ static int apply_r_mips_pc16(struct module *me, uint32_t *location,
278{ 261{
279 int rel; 262 int rel;
280 rel = (((unsigned int)v - (unsigned int)location)); 263 rel = (((unsigned int)v - (unsigned int)location));
281 rel >>= 2; // because the offset is in _instructions_ not bytes. 264 rel >>= 2; /* because the offset is in _instructions_ not bytes. */
282 rel -= 1; // and one instruction less due to the branch delay slot. 265 rel -= 1; /* and one instruction less due to the branch delay slot. */
283 266
284 if( (rel > 32768) || (rel < -32768) ) { 267 if ((rel > 32768) || (rel < -32768)) {
285 printk(KERN_DEBUG "VPE loader: " 268 pr_debug("VPE loader: apply_r_mips_pc16: relative address out of range 0x%x\n",
286 "apply_r_mips_pc16: relative address out of range 0x%x\n", rel); 269 rel);
287 return -ENOEXEC; 270 return -ENOEXEC;
288 } 271 }
289 272
@@ -304,8 +287,7 @@ static int apply_r_mips_26(struct module *me, uint32_t *location,
304 Elf32_Addr v) 287 Elf32_Addr v)
305{ 288{
306 if (v % 4) { 289 if (v % 4) {
307 printk(KERN_DEBUG "VPE loader: apply_r_mips_26 " 290 pr_debug("VPE loader: apply_r_mips_26: unaligned relocation\n");
308 " unaligned relocation\n");
309 return -ENOEXEC; 291 return -ENOEXEC;
310 } 292 }
311 293
@@ -336,7 +318,7 @@ static int apply_r_mips_hi16(struct module *me, uint32_t *location,
336 * the carry we need to add. Save the information, and let LO16 do the 318 * the carry we need to add. Save the information, and let LO16 do the
337 * actual relocation. 319 * actual relocation.
338 */ 320 */
339 n = kmalloc(sizeof *n, GFP_KERNEL); 321 n = kmalloc(sizeof(*n), GFP_KERNEL);
340 if (!n) 322 if (!n)
341 return -ENOMEM; 323 return -ENOMEM;
342 324
@@ -368,9 +350,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
368 * The value for the HI16 had best be the same. 350 * The value for the HI16 had best be the same.
369 */ 351 */
370 if (v != l->value) { 352 if (v != l->value) {
371 printk(KERN_DEBUG "VPE loader: " 353 pr_debug("VPE loader: apply_r_mips_lo16/hi16: inconsistent value information\n");
372 "apply_r_mips_lo16/hi16: \t"
373 "inconsistent value information\n");
374 goto out_free; 354 goto out_free;
375 } 355 }
376 356
@@ -466,20 +446,19 @@ static int apply_relocations(Elf32_Shdr *sechdrs,
466 + ELF32_R_SYM(r_info); 446 + ELF32_R_SYM(r_info);
467 447
468 if (!sym->st_value) { 448 if (!sym->st_value) {
469 printk(KERN_DEBUG "%s: undefined weak symbol %s\n", 449 pr_debug("%s: undefined weak symbol %s\n",
470 me->name, strtab + sym->st_name); 450 me->name, strtab + sym->st_name);
471 /* just print the warning, dont barf */ 451 /* just print the warning, dont barf */
472 } 452 }
473 453
474 v = sym->st_value; 454 v = sym->st_value;
475 455
476 res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v); 456 res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v);
477 if( res ) { 457 if (res) {
478 char *r = rstrs[ELF32_R_TYPE(r_info)]; 458 char *r = rstrs[ELF32_R_TYPE(r_info)];
479 printk(KERN_WARNING "VPE loader: .text+0x%x " 459 pr_warn("VPE loader: .text+0x%x relocation type %s for symbol \"%s\" failed\n",
480 "relocation type %s for symbol \"%s\" failed\n", 460 rel[i].r_offset, r ? r : "UNKNOWN",
481 rel[i].r_offset, r ? r : "UNKNOWN", 461 strtab + sym->st_name);
482 strtab + sym->st_name);
483 return res; 462 return res;
484 } 463 }
485 } 464 }
@@ -494,10 +473,8 @@ static inline void save_gp_address(unsigned int secbase, unsigned int rel)
494} 473}
495/* end module-elf32.c */ 474/* end module-elf32.c */
496 475
497
498
499/* Change all symbols so that sh_value encodes the pointer directly. */ 476/* Change all symbols so that sh_value encodes the pointer directly. */
500static void simplify_symbols(Elf_Shdr * sechdrs, 477static void simplify_symbols(Elf_Shdr *sechdrs,
501 unsigned int symindex, 478 unsigned int symindex,
502 const char *strtab, 479 const char *strtab,
503 const char *secstrings, 480 const char *secstrings,
@@ -538,18 +515,16 @@ static void simplify_symbols(Elf_Shdr * sechdrs,
538 break; 515 break;
539 516
540 case SHN_MIPS_SCOMMON: 517 case SHN_MIPS_SCOMMON:
541 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON " 518 pr_debug("simplify_symbols: ignoring SHN_MIPS_SCOMMON symbol <%s> st_shndx %d\n",
542 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name, 519 strtab + sym[i].st_name, sym[i].st_shndx);
543 sym[i].st_shndx); 520 /* .sbss section */
544 // .sbss section
545 break; 521 break;
546 522
547 default: 523 default:
548 secbase = sechdrs[sym[i].st_shndx].sh_addr; 524 secbase = sechdrs[sym[i].st_shndx].sh_addr;
549 525
550 if (strncmp(strtab + sym[i].st_name, "_gp", 3) == 0) { 526 if (strncmp(strtab + sym[i].st_name, "_gp", 3) == 0)
551 save_gp_address(secbase, sym[i].st_value); 527 save_gp_address(secbase, sym[i].st_value);
552 }
553 528
554 sym[i].st_value += secbase; 529 sym[i].st_value += secbase;
555 break; 530 break;
@@ -558,21 +533,21 @@ static void simplify_symbols(Elf_Shdr * sechdrs,
558} 533}
559 534
560#ifdef DEBUG_ELFLOADER 535#ifdef DEBUG_ELFLOADER
561static void dump_elfsymbols(Elf_Shdr * sechdrs, unsigned int symindex, 536static void dump_elfsymbols(Elf_Shdr *sechdrs, unsigned int symindex,
562 const char *strtab, struct module *mod) 537 const char *strtab, struct module *mod)
563{ 538{
564 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; 539 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr;
565 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym); 540 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym);
566 541
567 printk(KERN_DEBUG "dump_elfsymbols: n %d\n", n); 542 pr_debug("dump_elfsymbols: n %d\n", n);
568 for (i = 1; i < n; i++) { 543 for (i = 1; i < n; i++) {
569 printk(KERN_DEBUG " i %d name <%s> 0x%x\n", i, 544 pr_debug(" i %d name <%s> 0x%x\n", i, strtab + sym[i].st_name,
570 strtab + sym[i].st_name, sym[i].st_value); 545 sym[i].st_value);
571 } 546 }
572} 547}
573#endif 548#endif
574 549
575static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs, 550static int find_vpe_symbols(struct vpe *v, Elf_Shdr *sechdrs,
576 unsigned int symindex, const char *strtab, 551 unsigned int symindex, const char *strtab,
577 struct module *mod) 552 struct module *mod)
578{ 553{
@@ -580,16 +555,14 @@ static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs,
580 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym); 555 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym);
581 556
582 for (i = 1; i < n; i++) { 557 for (i = 1; i < n; i++) {
583 if (strcmp(strtab + sym[i].st_name, "__start") == 0) { 558 if (strcmp(strtab + sym[i].st_name, "__start") == 0)
584 v->__start = sym[i].st_value; 559 v->__start = sym[i].st_value;
585 }
586 560
587 if (strcmp(strtab + sym[i].st_name, "vpe_shared") == 0) { 561 if (strcmp(strtab + sym[i].st_name, "vpe_shared") == 0)
588 v->shared_ptr = (void *)sym[i].st_value; 562 v->shared_ptr = (void *)sym[i].st_value;
589 }
590 } 563 }
591 564
592 if ( (v->__start == 0) || (v->shared_ptr == NULL)) 565 if ((v->__start == 0) || (v->shared_ptr == NULL))
593 return -1; 566 return -1;
594 567
595 return 0; 568 return 0;
@@ -600,14 +573,14 @@ static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs,
600 * contents of the program (p)buffer performing relocatations/etc, free's it 573 * contents of the program (p)buffer performing relocatations/etc, free's it
601 * when finished. 574 * when finished.
602 */ 575 */
603static int vpe_elfload(struct vpe * v) 576static int vpe_elfload(struct vpe *v)
604{ 577{
605 Elf_Ehdr *hdr; 578 Elf_Ehdr *hdr;
606 Elf_Shdr *sechdrs; 579 Elf_Shdr *sechdrs;
607 long err = 0; 580 long err = 0;
608 char *secstrings, *strtab = NULL; 581 char *secstrings, *strtab = NULL;
609 unsigned int len, i, symindex = 0, strindex = 0, relocate = 0; 582 unsigned int len, i, symindex = 0, strindex = 0, relocate = 0;
610 struct module mod; // so we can re-use the relocations code 583 struct module mod; /* so we can re-use the relocations code */
611 584
612 memset(&mod, 0, sizeof(struct module)); 585 memset(&mod, 0, sizeof(struct module));
613 strcpy(mod.name, "VPE loader"); 586 strcpy(mod.name, "VPE loader");
@@ -621,8 +594,7 @@ static int vpe_elfload(struct vpe * v)
621 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC) 594 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
622 || !elf_check_arch(hdr) 595 || !elf_check_arch(hdr)
623 || hdr->e_shentsize != sizeof(*sechdrs)) { 596 || hdr->e_shentsize != sizeof(*sechdrs)) {
624 printk(KERN_WARNING 597 pr_warn("VPE loader: program wrong arch or weird elf version\n");
625 "VPE loader: program wrong arch or weird elf version\n");
626 598
627 return -ENOEXEC; 599 return -ENOEXEC;
628 } 600 }
@@ -631,8 +603,7 @@ static int vpe_elfload(struct vpe * v)
631 relocate = 1; 603 relocate = 1;
632 604
633 if (len < hdr->e_shoff + hdr->e_shnum * sizeof(Elf_Shdr)) { 605 if (len < hdr->e_shoff + hdr->e_shnum * sizeof(Elf_Shdr)) {
634 printk(KERN_ERR "VPE loader: program length %u truncated\n", 606 pr_err("VPE loader: program length %u truncated\n", len);
635 len);
636 607
637 return -ENOEXEC; 608 return -ENOEXEC;
638 } 609 }
@@ -647,22 +618,24 @@ static int vpe_elfload(struct vpe * v)
647 618
648 if (relocate) { 619 if (relocate) {
649 for (i = 1; i < hdr->e_shnum; i++) { 620 for (i = 1; i < hdr->e_shnum; i++) {
650 if (sechdrs[i].sh_type != SHT_NOBITS 621 if ((sechdrs[i].sh_type != SHT_NOBITS) &&
651 && len < sechdrs[i].sh_offset + sechdrs[i].sh_size) { 622 (len < sechdrs[i].sh_offset + sechdrs[i].sh_size)) {
652 printk(KERN_ERR "VPE program length %u truncated\n", 623 pr_err("VPE program length %u truncated\n",
653 len); 624 len);
654 return -ENOEXEC; 625 return -ENOEXEC;
655 } 626 }
656 627
657 /* Mark all sections sh_addr with their address in the 628 /* Mark all sections sh_addr with their address in the
658 temporary image. */ 629 temporary image. */
659 sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; 630 sechdrs[i].sh_addr = (size_t) hdr +
631 sechdrs[i].sh_offset;
660 632
661 /* Internal symbols and strings. */ 633 /* Internal symbols and strings. */
662 if (sechdrs[i].sh_type == SHT_SYMTAB) { 634 if (sechdrs[i].sh_type == SHT_SYMTAB) {
663 symindex = i; 635 symindex = i;
664 strindex = sechdrs[i].sh_link; 636 strindex = sechdrs[i].sh_link;
665 strtab = (char *)hdr + sechdrs[strindex].sh_offset; 637 strtab = (char *)hdr +
638 sechdrs[strindex].sh_offset;
666 } 639 }
667 } 640 }
668 layout_sections(&mod, hdr, sechdrs, secstrings); 641 layout_sections(&mod, hdr, sechdrs, secstrings);
@@ -689,8 +662,9 @@ static int vpe_elfload(struct vpe * v)
689 /* Update sh_addr to point to copy in image. */ 662 /* Update sh_addr to point to copy in image. */
690 sechdrs[i].sh_addr = (unsigned long)dest; 663 sechdrs[i].sh_addr = (unsigned long)dest;
691 664
692 printk(KERN_DEBUG " section sh_name %s sh_addr 0x%x\n", 665 pr_debug(" section sh_name %s sh_addr 0x%x\n",
693 secstrings + sechdrs[i].sh_name, sechdrs[i].sh_addr); 666 secstrings + sechdrs[i].sh_name,
667 sechdrs[i].sh_addr);
694 } 668 }
695 669
696 /* Fix up syms, so that st_value is a pointer to location. */ 670 /* Fix up syms, so that st_value is a pointer to location. */
@@ -711,17 +685,18 @@ static int vpe_elfload(struct vpe * v)
711 continue; 685 continue;
712 686
713 if (sechdrs[i].sh_type == SHT_REL) 687 if (sechdrs[i].sh_type == SHT_REL)
714 err = apply_relocations(sechdrs, strtab, symindex, i, 688 err = apply_relocations(sechdrs, strtab,
715 &mod); 689 symindex, i, &mod);
716 else if (sechdrs[i].sh_type == SHT_RELA) 690 else if (sechdrs[i].sh_type == SHT_RELA)
717 err = apply_relocate_add(sechdrs, strtab, symindex, i, 691 err = apply_relocate_add(sechdrs, strtab,
718 &mod); 692 symindex, i, &mod);
719 if (err < 0) 693 if (err < 0)
720 return err; 694 return err;
721 695
722 } 696 }
723 } else { 697 } else {
724 struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff); 698 struct elf_phdr *phdr = (struct elf_phdr *)
699 ((char *)hdr + hdr->e_phoff);
725 700
726 for (i = 0; i < hdr->e_phnum; i++) { 701 for (i = 0; i < hdr->e_phnum; i++) {
727 if (phdr->p_type == PT_LOAD) { 702 if (phdr->p_type == PT_LOAD) {
@@ -739,11 +714,15 @@ static int vpe_elfload(struct vpe * v)
739 if (sechdrs[i].sh_type == SHT_SYMTAB) { 714 if (sechdrs[i].sh_type == SHT_SYMTAB) {
740 symindex = i; 715 symindex = i;
741 strindex = sechdrs[i].sh_link; 716 strindex = sechdrs[i].sh_link;
742 strtab = (char *)hdr + sechdrs[strindex].sh_offset; 717 strtab = (char *)hdr +
743 718 sechdrs[strindex].sh_offset;
744 /* mark the symtab's address for when we try to find the 719
745 magic symbols */ 720 /*
746 sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; 721 * mark symtab's address for when we try
722 * to find the magic symbols
723 */
724 sechdrs[i].sh_addr = (size_t) hdr +
725 sechdrs[i].sh_offset;
747 } 726 }
748 } 727 }
749 } 728 }
@@ -754,18 +733,16 @@ static int vpe_elfload(struct vpe * v)
754 733
755 if ((find_vpe_symbols(v, sechdrs, symindex, strtab, &mod)) < 0) { 734 if ((find_vpe_symbols(v, sechdrs, symindex, strtab, &mod)) < 0) {
756 if (v->__start == 0) { 735 if (v->__start == 0) {
757 printk(KERN_WARNING "VPE loader: program does not contain " 736 pr_warn("VPE loader: program does not contain a __start symbol\n");
758 "a __start symbol\n");
759 return -ENOEXEC; 737 return -ENOEXEC;
760 } 738 }
761 739
762 if (v->shared_ptr == NULL) 740 if (v->shared_ptr == NULL)
763 printk(KERN_WARNING "VPE loader: " 741 pr_warn("VPE loader: program does not contain vpe_shared symbol.\n"
764 "program does not contain vpe_shared symbol.\n" 742 " Unable to use AMVP (AP/SP) facilities.\n");
765 " Unable to use AMVP (AP/SP) facilities.\n");
766 } 743 }
767 744
768 printk(" elf loaded\n"); 745 pr_info(" elf loaded\n");
769 return 0; 746 return 0;
770} 747}
771 748
@@ -788,30 +765,30 @@ static int getcwd(char *buff, int size)
788static int vpe_open(struct inode *inode, struct file *filp) 765static int vpe_open(struct inode *inode, struct file *filp)
789{ 766{
790 enum vpe_state state; 767 enum vpe_state state;
791 struct vpe_notifications *not; 768 struct vpe_notifications *notifier;
792 struct vpe *v; 769 struct vpe *v;
793 int ret; 770 int ret;
794 771
795 if (VPE_MODULE_MINOR != iminor(inode)) { 772 if (VPE_MODULE_MINOR != iminor(inode)) {
796 /* assume only 1 device at the moment. */ 773 /* assume only 1 device at the moment. */
797 pr_warning("VPE loader: only vpe1 is supported\n"); 774 pr_warn("VPE loader: only vpe1 is supported\n");
798 775
799 return -ENODEV; 776 return -ENODEV;
800 } 777 }
801 778
802 if ((v = get_vpe(aprp_cpu_index())) == NULL) { 779 v = get_vpe(aprp_cpu_index());
803 pr_warning("VPE loader: unable to get vpe\n"); 780 if (v == NULL) {
781 pr_warn("VPE loader: unable to get vpe\n");
804 782
805 return -ENODEV; 783 return -ENODEV;
806 } 784 }
807 785
808 state = xchg(&v->state, VPE_STATE_INUSE); 786 state = xchg(&v->state, VPE_STATE_INUSE);
809 if (state != VPE_STATE_UNUSED) { 787 if (state != VPE_STATE_UNUSED) {
810 printk(KERN_DEBUG "VPE loader: tc in use dumping regs\n"); 788 pr_debug("VPE loader: tc in use dumping regs\n");
811 789
812 list_for_each_entry(not, &v->notify, list) { 790 list_for_each_entry(notifier, &v->notify, list)
813 not->stop(aprp_cpu_index()); 791 notifier->stop(aprp_cpu_index());
814 }
815 792
816 release_progmem(v->load_addr); 793 release_progmem(v->load_addr);
817 cleanup_tc(get_tc(aprp_cpu_index())); 794 cleanup_tc(get_tc(aprp_cpu_index()));
@@ -820,7 +797,7 @@ static int vpe_open(struct inode *inode, struct file *filp)
820 /* this of-course trashes what was there before... */ 797 /* this of-course trashes what was there before... */
821 v->pbuffer = vmalloc(P_SIZE); 798 v->pbuffer = vmalloc(P_SIZE);
822 if (!v->pbuffer) { 799 if (!v->pbuffer) {
823 pr_warning("VPE loader: unable to allocate memory\n"); 800 pr_warn("VPE loader: unable to allocate memory\n");
824 return -ENOMEM; 801 return -ENOMEM;
825 } 802 }
826 v->plen = P_SIZE; 803 v->plen = P_SIZE;
@@ -833,7 +810,7 @@ static int vpe_open(struct inode *inode, struct file *filp)
833 v->cwd[0] = 0; 810 v->cwd[0] = 0;
834 ret = getcwd(v->cwd, VPE_PATH_MAX); 811 ret = getcwd(v->cwd, VPE_PATH_MAX);
835 if (ret < 0) 812 if (ret < 0)
836 printk(KERN_WARNING "VPE loader: open, getcwd returned %d\n", ret); 813 pr_warn("VPE loader: open, getcwd returned %d\n", ret);
837 814
838 v->shared_ptr = NULL; 815 v->shared_ptr = NULL;
839 v->__start = 0; 816 v->__start = 0;
@@ -856,11 +833,11 @@ static int vpe_release(struct inode *inode, struct file *filp)
856 if ((vpe_elfload(v) >= 0) && vpe_run) { 833 if ((vpe_elfload(v) >= 0) && vpe_run) {
857 vpe_run(v); 834 vpe_run(v);
858 } else { 835 } else {
859 printk(KERN_WARNING "VPE loader: ELF load failed.\n"); 836 pr_warn("VPE loader: ELF load failed.\n");
860 ret = -ENOEXEC; 837 ret = -ENOEXEC;
861 } 838 }
862 } else { 839 } else {
863 printk(KERN_WARNING "VPE loader: only elf files are supported\n"); 840 pr_warn("VPE loader: only elf files are supported\n");
864 ret = -ENOEXEC; 841 ret = -ENOEXEC;
865 } 842 }
866 843
@@ -878,8 +855,8 @@ static int vpe_release(struct inode *inode, struct file *filp)
878 return ret; 855 return ret;
879} 856}
880 857
881static ssize_t vpe_write(struct file *file, const char __user * buffer, 858static ssize_t vpe_write(struct file *file, const char __user *buffer,
882 size_t count, loff_t * ppos) 859 size_t count, loff_t *ppos)
883{ 860{
884 size_t ret = count; 861 size_t ret = count;
885 struct vpe *v; 862 struct vpe *v;
@@ -888,12 +865,12 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer,
888 return -ENODEV; 865 return -ENODEV;
889 866
890 v = get_vpe(aprp_cpu_index()); 867 v = get_vpe(aprp_cpu_index());
868
891 if (v == NULL) 869 if (v == NULL)
892 return -ENODEV; 870 return -ENODEV;
893 871
894 if ((count + v->len) > v->plen) { 872 if ((count + v->len) > v->plen) {
895 printk(KERN_WARNING 873 pr_warn("VPE loader: elf size too big. Perhaps strip uneeded symbols\n");
896 "VPE loader: elf size too big. Perhaps strip uneeded symbols\n");
897 return -ENOMEM; 874 return -ENOMEM;
898 } 875 }
899 876
@@ -915,63 +892,58 @@ const struct file_operations vpe_fops = {
915 892
916void *vpe_get_shared(int index) 893void *vpe_get_shared(int index)
917{ 894{
918 struct vpe *v; 895 struct vpe *v = get_vpe(index);
919 896
920 if ((v = get_vpe(index)) == NULL) 897 if (v == NULL)
921 return NULL; 898 return NULL;
922 899
923 return v->shared_ptr; 900 return v->shared_ptr;
924} 901}
925
926EXPORT_SYMBOL(vpe_get_shared); 902EXPORT_SYMBOL(vpe_get_shared);
927 903
928int vpe_getuid(int index) 904int vpe_getuid(int index)
929{ 905{
930 struct vpe *v; 906 struct vpe *v = get_vpe(index);
931 907
932 if ((v = get_vpe(index)) == NULL) 908 if (v == NULL)
933 return -1; 909 return -1;
934 910
935 return v->uid; 911 return v->uid;
936} 912}
937
938EXPORT_SYMBOL(vpe_getuid); 913EXPORT_SYMBOL(vpe_getuid);
939 914
940int vpe_getgid(int index) 915int vpe_getgid(int index)
941{ 916{
942 struct vpe *v; 917 struct vpe *v = get_vpe(index);
943 918
944 if ((v = get_vpe(index)) == NULL) 919 if (v == NULL)
945 return -1; 920 return -1;
946 921
947 return v->gid; 922 return v->gid;
948} 923}
949
950EXPORT_SYMBOL(vpe_getgid); 924EXPORT_SYMBOL(vpe_getgid);
951 925
952int vpe_notify(int index, struct vpe_notifications *notify) 926int vpe_notify(int index, struct vpe_notifications *notify)
953{ 927{
954 struct vpe *v; 928 struct vpe *v = get_vpe(index);
955 929
956 if ((v = get_vpe(index)) == NULL) 930 if (v == NULL)
957 return -1; 931 return -1;
958 932
959 list_add(&notify->list, &v->notify); 933 list_add(&notify->list, &v->notify);
960 return 0; 934 return 0;
961} 935}
962
963EXPORT_SYMBOL(vpe_notify); 936EXPORT_SYMBOL(vpe_notify);
964 937
965char *vpe_getcwd(int index) 938char *vpe_getcwd(int index)
966{ 939{
967 struct vpe *v; 940 struct vpe *v = get_vpe(index);
968 941
969 if ((v = get_vpe(index)) == NULL) 942 if (v == NULL)
970 return NULL; 943 return NULL;
971 944
972 return v->cwd; 945 return v->cwd;
973} 946}
974
975EXPORT_SYMBOL(vpe_getcwd); 947EXPORT_SYMBOL(vpe_getcwd);
976 948
977module_init(vpe_module_init); 949module_init(vpe_module_init);
diff --git a/arch/mips/mti-malta/malta-amon.c b/arch/mips/mti-malta/malta-amon.c
index 917df6d643ce..0319ad8b39a8 100644
--- a/arch/mips/mti-malta/malta-amon.c
+++ b/arch/mips/mti-malta/malta-amon.c
@@ -1,30 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007 MIPS Technologies, Inc. 2 * This file is subject to the terms and conditions of the GNU General Public
3 * All rights reserved. 3 * License. See the file "COPYING" in the main directory of this archive
4 4 * for more details.
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 * 5 *
14 * You should have received a copy of the GNU General Public License along 6 * Copyright (C) 2007 MIPS Technologies, Inc. All rights reserved.
15 * with this program; if not, write to the Free Software Foundation, Inc., 7 * Copyright (C) 2013 Imagination Technologies Ltd.
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 * 8 *
18 * Arbitrary Monitor interface 9 * Arbitrary Monitor Interface
19 */ 10 */
20
21#include <linux/kernel.h> 11#include <linux/kernel.h>
22#include <linux/init.h> 12#include <linux/init.h>
23#include <linux/smp.h> 13#include <linux/smp.h>
24 14
25#include <asm/addrspace.h> 15#include <asm/addrspace.h>
26#include <asm/mips-boards/launch.h>
27#include <asm/mipsmtregs.h> 16#include <asm/mipsmtregs.h>
17#include <asm/mips-boards/launch.h>
28#include <asm/vpe.h> 18#include <asm/vpe.h>
29 19
30int amon_cpu_avail(int cpu) 20int amon_cpu_avail(int cpu)
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 59a3fa5ce4e8..ca3e3a46a42f 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -1,26 +1,16 @@
1/* 1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
2 * Carsten Langgaard, carstenl@mips.com 6 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc. 7 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc.
4 * Copyright (C) 2001 Ralf Baechle 8 * Copyright (C) 2001 Ralf Baechle
5 * Copyright (C) 2013 Imagination Technologies Ltd. 9 * Copyright (C) 2013 Imagination Technologies Ltd.
6 * 10 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * Routines for generic manipulation of the interrupts found on the MIPS 11 * Routines for generic manipulation of the interrupts found on the MIPS
21 * Malta board. 12 * Malta board. The interrupt controller is located in the South Bridge
22 * The interrupt controller is located in the South Bridge a PIIX4 device 13 * a PIIX4 device with two internal 82C95 interrupt controllers.
23 * with two internal 82C95 interrupt controllers.
24 */ 14 */
25#include <linux/init.h> 15#include <linux/init.h>
26#include <linux/irq.h> 16#include <linux/irq.h>
@@ -92,7 +82,7 @@ static inline int mips_pcibios_iack(void)
92 BONITO_PCIMAP_CFG = 0; 82 BONITO_PCIMAP_CFG = 0;
93 break; 83 break;
94 default: 84 default:
95 printk(KERN_WARNING "Unknown system controller.\n"); 85 pr_emerg("Unknown system controller.\n");
96 return -1; 86 return -1;
97 } 87 }
98 return irq; 88 return irq;
@@ -156,11 +146,11 @@ static void corehi_irqdispatch(void)
156 unsigned int intrcause, datalo, datahi; 146 unsigned int intrcause, datalo, datahi;
157 struct pt_regs *regs = get_irq_regs(); 147 struct pt_regs *regs = get_irq_regs();
158 148
159 printk(KERN_EMERG "CoreHI interrupt, shouldn't happen, we die here!\n"); 149 pr_emerg("CoreHI interrupt, shouldn't happen, we die here!\n");
160 printk(KERN_EMERG "epc : %08lx\nStatus: %08lx\n" 150 pr_emerg("epc : %08lx\nStatus: %08lx\n"
161 "Cause : %08lx\nbadVaddr : %08lx\n", 151 "Cause : %08lx\nbadVaddr : %08lx\n",
162 regs->cp0_epc, regs->cp0_status, 152 regs->cp0_epc, regs->cp0_status,
163 regs->cp0_cause, regs->cp0_badvaddr); 153 regs->cp0_cause, regs->cp0_badvaddr);
164 154
165 /* Read all the registers and then print them as there is a 155 /* Read all the registers and then print them as there is a
166 problem with interspersed printk's upsetting the Bonito controller. 156 problem with interspersed printk's upsetting the Bonito controller.
@@ -178,8 +168,8 @@ static void corehi_irqdispatch(void)
178 intrcause = GT_READ(GT_INTRCAUSE_OFS); 168 intrcause = GT_READ(GT_INTRCAUSE_OFS);
179 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS); 169 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
180 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS); 170 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
181 printk(KERN_EMERG "GT_INTRCAUSE = %08x\n", intrcause); 171 pr_emerg("GT_INTRCAUSE = %08x\n", intrcause);
182 printk(KERN_EMERG "GT_CPUERR_ADDR = %02x%08x\n", 172 pr_emerg("GT_CPUERR_ADDR = %02x%08x\n",
183 datahi, datalo); 173 datahi, datalo);
184 break; 174 break;
185 case MIPS_REVISION_SCON_BONITO: 175 case MIPS_REVISION_SCON_BONITO:
@@ -191,14 +181,14 @@ static void corehi_irqdispatch(void)
191 intedge = BONITO_INTEDGE; 181 intedge = BONITO_INTEDGE;
192 intsteer = BONITO_INTSTEER; 182 intsteer = BONITO_INTSTEER;
193 pcicmd = BONITO_PCICMD; 183 pcicmd = BONITO_PCICMD;
194 printk(KERN_EMERG "BONITO_INTISR = %08x\n", intisr); 184 pr_emerg("BONITO_INTISR = %08x\n", intisr);
195 printk(KERN_EMERG "BONITO_INTEN = %08x\n", inten); 185 pr_emerg("BONITO_INTEN = %08x\n", inten);
196 printk(KERN_EMERG "BONITO_INTPOL = %08x\n", intpol); 186 pr_emerg("BONITO_INTPOL = %08x\n", intpol);
197 printk(KERN_EMERG "BONITO_INTEDGE = %08x\n", intedge); 187 pr_emerg("BONITO_INTEDGE = %08x\n", intedge);
198 printk(KERN_EMERG "BONITO_INTSTEER = %08x\n", intsteer); 188 pr_emerg("BONITO_INTSTEER = %08x\n", intsteer);
199 printk(KERN_EMERG "BONITO_PCICMD = %08x\n", pcicmd); 189 pr_emerg("BONITO_PCICMD = %08x\n", pcicmd);
200 printk(KERN_EMERG "BONITO_PCIBADADDR = %08x\n", pcibadaddr); 190 pr_emerg("BONITO_PCIBADADDR = %08x\n", pcibadaddr);
201 printk(KERN_EMERG "BONITO_PCIMSTAT = %08x\n", pcimstat); 191 pr_emerg("BONITO_PCIMSTAT = %08x\n", pcimstat);
202 break; 192 break;
203 } 193 }
204 194
@@ -377,13 +367,13 @@ static struct irqaction corehi_irqaction = {
377 .flags = IRQF_NO_THREAD, 367 .flags = IRQF_NO_THREAD,
378}; 368};
379 369
380static msc_irqmap_t __initdata msc_irqmap[] = { 370static msc_irqmap_t msc_irqmap[] __initdata = {
381 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0}, 371 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0},
382 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0}, 372 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0},
383}; 373};
384static int __initdata msc_nr_irqs = ARRAY_SIZE(msc_irqmap); 374static int msc_nr_irqs __initdata = ARRAY_SIZE(msc_irqmap);
385 375
386static msc_irqmap_t __initdata msc_eicirqmap[] = { 376static msc_irqmap_t msc_eicirqmap[] __initdata = {
387 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0}, 377 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0},
388 {MSC01E_INT_SW1, MSC01_IRQ_LEVEL, 0}, 378 {MSC01E_INT_SW1, MSC01_IRQ_LEVEL, 0},
389 {MSC01E_INT_I8259A, MSC01_IRQ_LEVEL, 0}, 379 {MSC01E_INT_I8259A, MSC01_IRQ_LEVEL, 0},
@@ -396,7 +386,7 @@ static msc_irqmap_t __initdata msc_eicirqmap[] = {
396 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0} 386 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0}
397}; 387};
398 388
399static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap); 389static int msc_nr_eicirqs __initdata = ARRAY_SIZE(msc_eicirqmap);
400 390
401/* 391/*
402 * This GIC specific tabular array defines the association between External 392 * This GIC specific tabular array defines the association between External
@@ -443,9 +433,12 @@ int __init gcmp_probe(unsigned long addr, unsigned long size)
443 if (gcmp_present >= 0) 433 if (gcmp_present >= 0)
444 return gcmp_present; 434 return gcmp_present;
445 435
446 _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ); 436 _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR,
447 _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE, MSC01_BIU_ADDRSPACE_SZ); 437 GCMP_ADDRSPACE_SZ);
448 gcmp_present = (GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) == GCMP_BASE_ADDR; 438 _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE,
439 MSC01_BIU_ADDRSPACE_SZ);
440 gcmp_present = ((GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) ==
441 GCMP_BASE_ADDR);
449 442
450 if (gcmp_present) 443 if (gcmp_present)
451 pr_debug("GCMP present\n"); 444 pr_debug("GCMP present\n");
@@ -455,9 +448,8 @@ int __init gcmp_probe(unsigned long addr, unsigned long size)
455/* Return the number of IOCU's present */ 448/* Return the number of IOCU's present */
456int __init gcmp_niocu(void) 449int __init gcmp_niocu(void)
457{ 450{
458 return gcmp_present ? 451 return gcmp_present ? ((GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >>
459 (GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >> GCMP_GCB_GC_NUMIOCU_SHF : 452 GCMP_GCB_GC_NUMIOCU_SHF) : 0;
460 0;
461} 453}
462 454
463/* Set GCMP region attributes */ 455/* Set GCMP region attributes */
@@ -606,11 +598,14 @@ void __init arch_init_irq(void)
606 set_vi_handler(MIPSCPU_INT_IPI1, malta_ipi_irqdispatch); 598 set_vi_handler(MIPSCPU_INT_IPI1, malta_ipi_irqdispatch);
607 } 599 }
608 /* Argh.. this really needs sorting out.. */ 600 /* Argh.. this really needs sorting out.. */
609 printk("CPU%d: status register was %08x\n", smp_processor_id(), read_c0_status()); 601 pr_info("CPU%d: status register was %08x\n",
602 smp_processor_id(), read_c0_status());
610 write_c0_status(read_c0_status() | STATUSF_IP3 | STATUSF_IP4); 603 write_c0_status(read_c0_status() | STATUSF_IP3 | STATUSF_IP4);
611 printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); 604 pr_info("CPU%d: status register now %08x\n",
605 smp_processor_id(), read_c0_status());
612 write_c0_status(0x1100dc00); 606 write_c0_status(0x1100dc00);
613 printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); 607 pr_info("CPU%d: status register frc %08x\n",
608 smp_processor_id(), read_c0_status());
614 for (i = 0; i < nr_cpu_ids; i++) { 609 for (i = 0; i < nr_cpu_ids; i++) {
615 arch_init_ipiirq(MIPS_GIC_IRQ_BASE + 610 arch_init_ipiirq(MIPS_GIC_IRQ_BASE +
616 GIC_RESCHED_INT(i), &irq_resched); 611 GIC_RESCHED_INT(i), &irq_resched);
@@ -628,11 +623,15 @@ void __init arch_init_irq(void)
628 cpu_ipi_call_irq = MSC01E_INT_SW1; 623 cpu_ipi_call_irq = MSC01E_INT_SW1;
629 } else { 624 } else {
630 if (cpu_has_vint) { 625 if (cpu_has_vint) {
631 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); 626 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ,
632 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); 627 ipi_resched_dispatch);
628 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ,
629 ipi_call_dispatch);
633 } 630 }
634 cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ; 631 cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE +
635 cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ; 632 MIPS_CPU_IPI_RESCHED_IRQ;
633 cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE +
634 MIPS_CPU_IPI_CALL_IRQ;
636 } 635 }
637 arch_init_ipiirq(cpu_ipi_resched_irq, &irq_resched); 636 arch_init_ipiirq(cpu_ipi_resched_irq, &irq_resched);
638 arch_init_ipiirq(cpu_ipi_call_irq, &irq_call); 637 arch_init_ipiirq(cpu_ipi_call_irq, &irq_call);
@@ -642,9 +641,7 @@ void __init arch_init_irq(void)
642 641
643void malta_be_init(void) 642void malta_be_init(void)
644{ 643{
645 if (gcmp_present) { 644 /* Could change CM error mask register. */
646 /* Could change CM error mask register */
647 }
648} 645}
649 646
650 647
@@ -724,14 +721,14 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
724 if (cause < 16) { 721 if (cause < 16) {
725 unsigned long cca_bits = (cm_error >> 15) & 7; 722 unsigned long cca_bits = (cm_error >> 15) & 7;
726 unsigned long tr_bits = (cm_error >> 12) & 7; 723 unsigned long tr_bits = (cm_error >> 12) & 7;
727 unsigned long mcmd_bits = (cm_error >> 7) & 0x1f; 724 unsigned long cmd_bits = (cm_error >> 7) & 0x1f;
728 unsigned long stag_bits = (cm_error >> 3) & 15; 725 unsigned long stag_bits = (cm_error >> 3) & 15;
729 unsigned long sport_bits = (cm_error >> 0) & 7; 726 unsigned long sport_bits = (cm_error >> 0) & 7;
730 727
731 snprintf(buf, sizeof(buf), 728 snprintf(buf, sizeof(buf),
732 "CCA=%lu TR=%s MCmd=%s STag=%lu " 729 "CCA=%lu TR=%s MCmd=%s STag=%lu "
733 "SPort=%lu\n", 730 "SPort=%lu\n",
734 cca_bits, tr[tr_bits], mcmd[mcmd_bits], 731 cca_bits, tr[tr_bits], mcmd[cmd_bits],
735 stag_bits, sport_bits); 732 stag_bits, sport_bits);
736 } else { 733 } else {
737 /* glob state & sresp together */ 734 /* glob state & sresp together */
@@ -740,7 +737,7 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
740 unsigned long c1_bits = (cm_error >> 12) & 7; 737 unsigned long c1_bits = (cm_error >> 12) & 7;
741 unsigned long c0_bits = (cm_error >> 9) & 7; 738 unsigned long c0_bits = (cm_error >> 9) & 7;
742 unsigned long sc_bit = (cm_error >> 8) & 1; 739 unsigned long sc_bit = (cm_error >> 8) & 1;
743 unsigned long mcmd_bits = (cm_error >> 3) & 0x1f; 740 unsigned long cmd_bits = (cm_error >> 3) & 0x1f;
744 unsigned long sport_bits = (cm_error >> 0) & 7; 741 unsigned long sport_bits = (cm_error >> 0) & 7;
745 snprintf(buf, sizeof(buf), 742 snprintf(buf, sizeof(buf),
746 "C3=%s C2=%s C1=%s C0=%s SC=%s " 743 "C3=%s C2=%s C1=%s C0=%s SC=%s "
@@ -748,16 +745,16 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
748 core[c3_bits], core[c2_bits], 745 core[c3_bits], core[c2_bits],
749 core[c1_bits], core[c0_bits], 746 core[c1_bits], core[c0_bits],
750 sc_bit ? "True" : "False", 747 sc_bit ? "True" : "False",
751 mcmd[mcmd_bits], sport_bits); 748 mcmd[cmd_bits], sport_bits);
752 } 749 }
753 750
754 ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >> 751 ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >>
755 GCMP_GCB_GMEO_ERROR_2ND_SHF; 752 GCMP_GCB_GMEO_ERROR_2ND_SHF;
756 753
757 printk("CM_ERROR=%08lx %s <%s>\n", cm_error, 754 pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error,
758 causes[cause], buf); 755 causes[cause], buf);
759 printk("CM_ADDR =%08lx\n", cm_addr); 756 pr_err("CM_ADDR =%08lx\n", cm_addr);
760 printk("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]); 757 pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]);
761 758
762 /* reprime cause register */ 759 /* reprime cause register */
763 GCMPGCB(GCMEC) = 0; 760 GCMPGCB(GCMEC) = 0;