aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 15:48:06 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 15:48:06 -0500
commitb0138a6cb7923a997d278b47c176778534d1095b (patch)
tree4fcb8822a69631baba568e4e1942847747123887
parent6572d6d7d0f965dda19d02af804ed3ae4b3bf1fc (diff)
parent1055a8af093fea7490445bd15cd671020e542035 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6: (78 commits) [PARISC] Use symbolic last syscall in __NR_Linux_syscalls [PARISC] Add missing statfs64 and fstatfs64 syscalls Revert "[PARISC] Optimize TLB flush on SMP systems" [PARISC] Compat signal fixes for 64-bit parisc [PARISC] Reorder syscalls to match unistd.h Revert "[PATCH] make kernel/signal.c:kill_proc_info() static" [PARISC] fix sys_rt_sigqueueinfo [PARISC] fix section mismatch warnings in harmony sound driver [PARISC] do not export get_register/set_register [PARISC] add ENTRY()/ENDPROC() and simplify assembly of HP/UX emulation code [PARISC] convert to use CONFIG_64BIT instead of __LP64__ [PARISC] use CONFIG_64BIT instead of __LP64__ [PARISC] add ASM_EXCEPTIONTABLE_ENTRY() macro [PARISC] more ENTRY(), ENDPROC(), END() conversions [PARISC] fix ENTRY() and ENDPROC() for 64bit-parisc [PARISC] Fixes /proc/cpuinfo cache output on B160L [PARISC] implement standard ENTRY(), END() and ENDPROC() [PARISC] kill ENTRY_SYS_CPUS [PARISC] clean up debugging printks in smp.c [PARISC] factor syscall_restart code out of do_signal ... Fix conflict in include/linux/sched.h due to kill_proc_info() being made publicly available to PARISC again.
-rw-r--r--arch/parisc/Kconfig9
-rw-r--r--arch/parisc/Makefile8
-rw-r--r--arch/parisc/hpux/entry_hpux.S10
-rw-r--r--arch/parisc/hpux/fs.c26
-rw-r--r--arch/parisc/hpux/gate.S23
-rw-r--r--arch/parisc/hpux/sys_hpux.c32
-rw-r--r--arch/parisc/hpux/wrappers.S45
-rw-r--r--arch/parisc/kernel/asm-offsets.c2
-rw-r--r--arch/parisc/kernel/cache.c188
-rw-r--r--arch/parisc/kernel/drivers.c19
-rw-r--r--arch/parisc/kernel/entry.S241
-rw-r--r--arch/parisc/kernel/firmware.c26
-rw-r--r--arch/parisc/kernel/head.S15
-rw-r--r--arch/parisc/kernel/hpmc.S16
-rw-r--r--arch/parisc/kernel/inventory.c10
-rw-r--r--arch/parisc/kernel/irq.c6
-rw-r--r--arch/parisc/kernel/module.c23
-rw-r--r--arch/parisc/kernel/pacache.S89
-rw-r--r--arch/parisc/kernel/parisc_ksyms.c10
-rw-r--r--arch/parisc/kernel/pci-dma.c2
-rw-r--r--arch/parisc/kernel/pci.c4
-rw-r--r--arch/parisc/kernel/perf_asm.S26
-rw-r--r--arch/parisc/kernel/process.c8
-rw-r--r--arch/parisc/kernel/processor.c11
-rw-r--r--arch/parisc/kernel/ptrace.c10
-rw-r--r--arch/parisc/kernel/real2.S16
-rw-r--r--arch/parisc/kernel/setup.c6
-rw-r--r--arch/parisc/kernel/signal.c273
-rw-r--r--arch/parisc/kernel/signal32.c42
-rw-r--r--arch/parisc/kernel/smp.c178
-rw-r--r--arch/parisc/kernel/syscall.S71
-rw-r--r--arch/parisc/kernel/syscall_table.S16
-rw-r--r--arch/parisc/kernel/time.c146
-rw-r--r--arch/parisc/kernel/traps.c153
-rw-r--r--arch/parisc/kernel/unaligned.c115
-rw-r--r--arch/parisc/kernel/unwind.c1
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S2
-rw-r--r--arch/parisc/lib/bitops.c4
-rw-r--r--arch/parisc/lib/fixup.S20
-rw-r--r--arch/parisc/lib/lusercopy.S37
-rw-r--r--arch/parisc/lib/memcpy.c38
-rw-r--r--arch/parisc/mm/fault.c4
-rw-r--r--arch/parisc/mm/init.c72
-rw-r--r--arch/parisc/mm/ioremap.c6
-rw-r--r--arch/parisc/mm/kmap.c166
-rw-r--r--arch/parisc/oprofile/init.c2
-rw-r--r--drivers/char/agp/parisc-agp.c2
-rw-r--r--drivers/net/Kconfig6
-rw-r--r--drivers/net/lasi_82596.c34
-rw-r--r--drivers/parisc/hppb.c14
-rw-r--r--drivers/parisc/iosapic_private.h2
-rw-r--r--drivers/parisc/lba_pci.c90
-rw-r--r--drivers/parisc/led.c14
-rw-r--r--drivers/parisc/power.c201
-rw-r--r--drivers/parisc/sba_iommu.c4
-rw-r--r--drivers/serial/mux.c167
-rw-r--r--include/asm-parisc/assembly.h20
-rw-r--r--include/asm-parisc/atomic.h12
-rw-r--r--include/asm-parisc/bitops.h24
-rw-r--r--include/asm-parisc/bug.h88
-rw-r--r--include/asm-parisc/cache.h29
-rw-r--r--include/asm-parisc/cacheflush.h179
-rw-r--r--include/asm-parisc/dma-mapping.h2
-rw-r--r--include/asm-parisc/elf.h2
-rw-r--r--include/asm-parisc/hardware.h16
-rw-r--r--include/asm-parisc/io.h4
-rw-r--r--include/asm-parisc/led.h2
-rw-r--r--include/asm-parisc/linkage.h28
-rw-r--r--include/asm-parisc/mmzone.h2
-rw-r--r--include/asm-parisc/module.h2
-rw-r--r--include/asm-parisc/msgbuf.h6
-rw-r--r--include/asm-parisc/page.h8
-rw-r--r--include/asm-parisc/parisc-device.h2
-rw-r--r--include/asm-parisc/pdc.h10
-rw-r--r--include/asm-parisc/pdcpat.h31
-rw-r--r--include/asm-parisc/pgalloc.h10
-rw-r--r--include/asm-parisc/pgtable.h1
-rw-r--r--include/asm-parisc/posix_types.h2
-rw-r--r--include/asm-parisc/processor.h10
-rw-r--r--include/asm-parisc/sembuf.h4
-rw-r--r--include/asm-parisc/shmbuf.h10
-rw-r--r--include/asm-parisc/signal.h2
-rw-r--r--include/asm-parisc/smp.h8
-rw-r--r--include/asm-parisc/spinlock_types.h4
-rw-r--r--include/asm-parisc/statfs.h10
-rw-r--r--include/asm-parisc/system.h2
-rw-r--r--include/asm-parisc/thread_info.h4
-rw-r--r--include/asm-parisc/tlbflush.h30
-rw-r--r--include/asm-parisc/types.h2
-rw-r--r--include/asm-parisc/uaccess.h122
-rw-r--r--include/asm-parisc/unistd.h12
-rw-r--r--include/linux/mod_devicetable.h12
-rw-r--r--include/linux/sched.h1
-rw-r--r--kernel/signal.c3
-rw-r--r--scripts/mod/file2alias.c22
-rw-r--r--scripts/mod/modpost.c3
-rw-r--r--sound/parisc/harmony.c4
97 files changed, 1586 insertions, 1920 deletions
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 28da4e71c443..3d73545e8c48 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -37,6 +37,11 @@ config GENERIC_FIND_NEXT_BIT
37 bool 37 bool
38 default y 38 default y
39 39
40config GENERIC_BUG
41 bool
42 default y
43 depends on BUG
44
40config GENERIC_HWEIGHT 45config GENERIC_HWEIGHT
41 bool 46 bool
42 default y 47 default y
@@ -45,6 +50,10 @@ config GENERIC_CALIBRATE_DELAY
45 bool 50 bool
46 default y 51 default y
47 52
53config GENERIC_TIME
54 bool
55 default y
56
48config TIME_LOW_RES 57config TIME_LOW_RES
49 bool 58 bool
50 depends on SMP 59 depends on SMP
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 9b7e42490dd1..760567a9ba16 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -35,12 +35,8 @@ FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align
35 35
36OBJCOPY_FLAGS =-O binary -R .note -R .comment -S 36OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
37 37
38GCC_VERSION := $(call cc-version) 38ifneq ($(call cc-ifversion, -lt, 0303, "bad"),)
39ifneq ($(shell if [ -z $(GCC_VERSION) ] ; then echo "bad"; fi ;),) 39$(error Sorry, GCC v3.3 or above is required.)
40$(error Sorry, couldn't find ($(cc-version)).)
41endif
42ifneq ($(shell if [ $(GCC_VERSION) -lt 0303 ] ; then echo "bad"; fi ;),)
43$(error Sorry, your compiler is too old ($(GCC_VERSION)). GCC v3.3 or above is required.)
44endif 40endif
45 41
46cflags-y := -pipe 42cflags-y := -pipe
diff --git a/arch/parisc/hpux/entry_hpux.S b/arch/parisc/hpux/entry_hpux.S
index 31c8cccfba31..d15a413572f0 100644
--- a/arch/parisc/hpux/entry_hpux.S
+++ b/arch/parisc/hpux/entry_hpux.S
@@ -18,17 +18,16 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#include <asm/unistd.h>
22#include <asm/assembly.h>
21#include <linux/sys.h> 23#include <linux/sys.h>
22#include <linux/linkage.h> 24#include <linux/linkage.h>
23#include <asm/unistd.h>
24 25
25#define ENTRY_NAME(_name_) .word _name_ 26#define ENTRY_NAME(_name_) ASM_ULONG_INSN _name_
26 27
27 .section .rodata,"a" 28 .section .rodata,"a"
28 .align 4
29 .export hpux_call_table
30 .import hpux_unimplemented_wrapper 29 .import hpux_unimplemented_wrapper
31hpux_call_table: 30ENTRY(hpux_call_table)
32 ENTRY_NAME(sys_ni_syscall) /* 0 */ 31 ENTRY_NAME(sys_ni_syscall) /* 0 */
33 ENTRY_NAME(sys_exit) 32 ENTRY_NAME(sys_exit)
34 ENTRY_NAME(hpux_fork_wrapper) 33 ENTRY_NAME(hpux_fork_wrapper)
@@ -542,5 +541,6 @@ hpux_call_table:
542 ENTRY_NAME(hpux_unimplemented_wrapper) /* 510 */ 541 ENTRY_NAME(hpux_unimplemented_wrapper) /* 510 */
543 ENTRY_NAME(hpux_unimplemented_wrapper) 542 ENTRY_NAME(hpux_unimplemented_wrapper)
544 ENTRY_NAME(hpux_unimplemented_wrapper) 543 ENTRY_NAME(hpux_unimplemented_wrapper)
544END(hpux_call_table)
545.end 545.end
546 546
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 4204cd1f3cf9..c7a81a2c014c 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -35,13 +35,13 @@ int hpux_execve(struct pt_regs *regs)
35 int error; 35 int error;
36 char *filename; 36 char *filename;
37 37
38 filename = getname((char *) regs->gr[26]); 38 filename = getname((char __user *) regs->gr[26]);
39 error = PTR_ERR(filename); 39 error = PTR_ERR(filename);
40 if (IS_ERR(filename)) 40 if (IS_ERR(filename))
41 goto out; 41 goto out;
42 42
43 error = do_execve(filename, (char **) regs->gr[25], 43 error = do_execve(filename, (char __user * __user *) regs->gr[25],
44 (char **)regs->gr[24], regs); 44 (char __user * __user *) regs->gr[24], regs);
45 45
46 if (error == 0) { 46 if (error == 0) {
47 task_lock(current); 47 task_lock(current);
@@ -63,19 +63,19 @@ struct hpux_dirent {
63}; 63};
64 64
65struct getdents_callback { 65struct getdents_callback {
66 struct hpux_dirent *current_dir; 66 struct hpux_dirent __user *current_dir;
67 struct hpux_dirent *previous; 67 struct hpux_dirent __user *previous;
68 int count; 68 int count;
69 int error; 69 int error;
70}; 70};
71 71
72#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) 72#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
73#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) 73#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
74 74
75static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 75static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
76 u64 ino, unsigned d_type) 76 u64 ino, unsigned d_type)
77{ 77{
78 struct hpux_dirent * dirent; 78 struct hpux_dirent __user * dirent;
79 struct getdents_callback * buf = (struct getdents_callback *) __buf; 79 struct getdents_callback * buf = (struct getdents_callback *) __buf;
80 ino_t d_ino; 80 ino_t d_ino;
81 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); 81 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
@@ -105,10 +105,10 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
105#undef NAME_OFFSET 105#undef NAME_OFFSET
106#undef ROUND_UP 106#undef ROUND_UP
107 107
108int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count) 108int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
109{ 109{
110 struct file * file; 110 struct file * file;
111 struct hpux_dirent * lastdirent; 111 struct hpux_dirent __user * lastdirent;
112 struct getdents_callback buf; 112 struct getdents_callback buf;
113 int error = -EBADF; 113 int error = -EBADF;
114 114
@@ -143,7 +143,7 @@ int hpux_mount(const char *fs, const char *path, int mflag,
143 return -ENOSYS; 143 return -ENOSYS;
144} 144}
145 145
146static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf) 146static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf)
147{ 147{
148 struct hpux_stat64 tmp; 148 struct hpux_stat64 tmp;
149 149
@@ -169,7 +169,7 @@ static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf)
169 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 169 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
170} 170}
171 171
172long hpux_stat64(char *filename, struct hpux_stat64 *statbuf) 172long hpux_stat64(char __user *filename, struct hpux_stat64 __user *statbuf)
173{ 173{
174 struct kstat stat; 174 struct kstat stat;
175 int error = vfs_stat(filename, &stat); 175 int error = vfs_stat(filename, &stat);
@@ -180,7 +180,7 @@ long hpux_stat64(char *filename, struct hpux_stat64 *statbuf)
180 return error; 180 return error;
181} 181}
182 182
183long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf) 183long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf)
184{ 184{
185 struct kstat stat; 185 struct kstat stat;
186 int error = vfs_fstat(fd, &stat); 186 int error = vfs_fstat(fd, &stat);
@@ -191,7 +191,7 @@ long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf)
191 return error; 191 return error;
192} 192}
193 193
194long hpux_lstat64(char *filename, struct hpux_stat64 *statbuf) 194long hpux_lstat64(char __user *filename, struct hpux_stat64 __user *statbuf)
195{ 195{
196 struct kstat stat; 196 struct kstat stat;
197 int error = vfs_lstat(filename, &stat); 197 int error = vfs_lstat(filename, &stat);
diff --git a/arch/parisc/hpux/gate.S b/arch/parisc/hpux/gate.S
index aaaf3306c05a..0b9d5b1e4b37 100644
--- a/arch/parisc/hpux/gate.S
+++ b/arch/parisc/hpux/gate.S
@@ -12,27 +12,18 @@
12#include <asm/asm-offsets.h> 12#include <asm/asm-offsets.h>
13#include <asm/unistd.h> 13#include <asm/unistd.h>
14#include <asm/errno.h> 14#include <asm/errno.h>
15#include <linux/linkage.h>
15 16
16#ifdef __LP64__ 17 .level LEVEL
17 .level 2.0w
18#else
19 .level 1.1
20#endif
21 .text 18 .text
22 19
23#ifdef __LP64__
24#define FRAME_SIZE 128
25#else
26#define FRAME_SIZE 64
27#endif
28 .import hpux_call_table 20 .import hpux_call_table
29 .import hpux_syscall_exit,code 21 .import hpux_syscall_exit,code
30 .export hpux_gateway_page
31 22
32 .align 4096 23 .align 4096
33hpux_gateway_page: 24ENTRY(hpux_gateway_page)
34 nop 25 nop
35#ifdef __LP64__ 26#ifdef CONFIG_64BIT
36#warning NEEDS WORK for 64-bit 27#warning NEEDS WORK for 64-bit
37#endif 28#endif
38 ldw -64(%r30), %r29 ;! 8th argument 29 ldw -64(%r30), %r29 ;! 8th argument
@@ -101,7 +92,7 @@ hpux_gateway_page:
101 ldo R%hpux_call_table(%r21), %r21 92 ldo R%hpux_call_table(%r21), %r21
102 comiclr,>>= __NR_HPUX_syscalls, %r22, %r0 93 comiclr,>>= __NR_HPUX_syscalls, %r22, %r0
103 b,n syscall_nosys 94 b,n syscall_nosys
104 ldwx,s %r22(%r21), %r21 95 LDREGX %r22(%r21), %r21
105 ldil L%hpux_syscall_exit,%r2 96 ldil L%hpux_syscall_exit,%r2
106 be 0(%sr7,%r21) 97 be 0(%sr7,%r21)
107 ldo R%hpux_syscall_exit(%r2),%r2 98 ldo R%hpux_syscall_exit(%r2),%r2
@@ -110,7 +101,7 @@ syscall_nosys:
110 ldil L%hpux_syscall_exit,%r1 101 ldil L%hpux_syscall_exit,%r1
111 be R%hpux_syscall_exit(%sr7,%r1) 102 be R%hpux_syscall_exit(%sr7,%r1)
112 ldo -ENOSYS(%r0),%r28 103 ldo -ENOSYS(%r0),%r28
104ENDPROC(hpux_gateway_page)
113 105
114 .align 4096 106 .align 4096
115 .export end_hpux_gateway_page 107ENTRY(end_hpux_gateway_page)
116end_hpux_gateway_page:
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index 04c2ff444396..3e025df2dc86 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -61,7 +61,7 @@ int hpux_ptrace(void)
61 return -ENOSYS; 61 return -ENOSYS;
62} 62}
63 63
64int hpux_wait(int *stat_loc) 64int hpux_wait(int __user *stat_loc)
65{ 65{
66 return sys_waitpid(-1, stat_loc, 0); 66 return sys_waitpid(-1, stat_loc, 0);
67} 67}
@@ -255,7 +255,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
255/* TODO: Are these put_user calls OK? Should they pass an int? 255/* TODO: Are these put_user calls OK? Should they pass an int?
256 * (I copied it from sys_i386.c like this.) 256 * (I copied it from sys_i386.c like this.)
257 */ 257 */
258static int hpux_uname(struct hpux_utsname *name) 258static int hpux_uname(struct hpux_utsname __user *name)
259{ 259{
260 int error; 260 int error;
261 261
@@ -300,14 +300,14 @@ static int hpux_uname(struct hpux_utsname *name)
300/* Note: HP-UX just uses the old suser() function to check perms 300/* Note: HP-UX just uses the old suser() function to check perms
301 * in this system call. We'll use capable(CAP_SYS_ADMIN). 301 * in this system call. We'll use capable(CAP_SYS_ADMIN).
302 */ 302 */
303int hpux_utssys(char *ubuf, int n, int type) 303int hpux_utssys(char __user *ubuf, int n, int type)
304{ 304{
305 int len; 305 int len;
306 int error; 306 int error;
307 switch( type ) { 307 switch( type ) {
308 case 0: 308 case 0:
309 /* uname(): */ 309 /* uname(): */
310 return( hpux_uname( (struct hpux_utsname *)ubuf ) ); 310 return hpux_uname((struct hpux_utsname __user *)ubuf);
311 break ; 311 break ;
312 case 1: 312 case 1:
313 /* Obsolete (used to be umask().) */ 313 /* Obsolete (used to be umask().) */
@@ -315,8 +315,9 @@ int hpux_utssys(char *ubuf, int n, int type)
315 break ; 315 break ;
316 case 2: 316 case 2:
317 /* ustat(): */ 317 /* ustat(): */
318 return( hpux_ustat(new_decode_dev(n), (struct hpux_ustat *)ubuf) ); 318 return hpux_ustat(new_decode_dev(n),
319 break ; 319 (struct hpux_ustat __user *)ubuf);
320 break;
320 case 3: 321 case 3:
321 /* setuname(): 322 /* setuname():
322 * 323 *
@@ -332,7 +333,7 @@ int hpux_utssys(char *ubuf, int n, int type)
332 return -EINVAL ; 333 return -EINVAL ;
333 /* Unlike Linux, HP-UX truncates it if n is too big: */ 334 /* Unlike Linux, HP-UX truncates it if n is too big: */
334 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; 335 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
335 return( sys_sethostname(ubuf, len) ); 336 return sys_sethostname(ubuf, len);
336 break ; 337 break ;
337 case 4: 338 case 4:
338 /* sethostname(): 339 /* sethostname():
@@ -346,7 +347,7 @@ int hpux_utssys(char *ubuf, int n, int type)
346 return -EINVAL ; 347 return -EINVAL ;
347 /* Unlike Linux, HP-UX truncates it if n is too big: */ 348 /* Unlike Linux, HP-UX truncates it if n is too big: */
348 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; 349 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
349 return( sys_sethostname(ubuf, len) ); 350 return sys_sethostname(ubuf, len);
350 break ; 351 break ;
351 case 5: 352 case 5:
352 /* gethostname(): 353 /* gethostname():
@@ -356,7 +357,7 @@ int hpux_utssys(char *ubuf, int n, int type)
356 /* Unlike Linux, HP-UX returns an error if n==0: */ 357 /* Unlike Linux, HP-UX returns an error if n==0: */
357 if ( n <= 0 ) 358 if ( n <= 0 )
358 return -EINVAL ; 359 return -EINVAL ;
359 return( sys_gethostname(ubuf, n) ); 360 return sys_gethostname(ubuf, n);
360 break ; 361 break ;
361 case 6: 362 case 6:
362 /* Supposedly called from setuname() in libc. 363 /* Supposedly called from setuname() in libc.
@@ -420,7 +421,7 @@ int hpux_utssys(char *ubuf, int n, int type)
420 } 421 }
421} 422}
422 423
423int hpux_getdomainname(char *name, int len) 424int hpux_getdomainname(char __user *name, int len)
424{ 425{
425 int nlen; 426 int nlen;
426 int err = -EFAULT; 427 int err = -EFAULT;
@@ -471,17 +472,18 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
471 printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1); 472 printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1);
472 473
473 if ( opcode == 1 ) { /* GETFSIND */ 474 if ( opcode == 1 ) { /* GETFSIND */
474 len = strlen_user((char *)arg1); 475 char __user *user_fsname = (char __user *)arg1;
476 len = strlen_user(user_fsname);
475 printk(KERN_DEBUG "len of arg1 = %d\n", len); 477 printk(KERN_DEBUG "len of arg1 = %d\n", len);
476 if (len == 0) 478 if (len == 0)
477 return 0; 479 return 0;
478 fsname = kmalloc(len, GFP_KERNEL); 480 fsname = kmalloc(len, GFP_KERNEL);
479 if ( !fsname ) { 481 if (!fsname) {
480 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 482 printk(KERN_DEBUG "failed to kmalloc fsname\n");
481 return 0; 483 return 0;
482 } 484 }
483 485
484 if ( copy_from_user(fsname, (char *)arg1, len) ) { 486 if (copy_from_user(fsname, user_fsname, len)) {
485 printk(KERN_DEBUG "failed to copy_from_user fsname\n"); 487 printk(KERN_DEBUG "failed to copy_from_user fsname\n");
486 kfree(fsname); 488 kfree(fsname);
487 return 0; 489 return 0;
@@ -495,7 +497,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
495 fstype = 0; 497 fstype = 0;
496 } else { 498 } else {
497 fstype = 0; 499 fstype = 0;
498 }; 500 }
499 501
500 kfree(fsname); 502 kfree(fsname);
501 503
@@ -509,7 +511,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
509 511
510 512
511/* Table of syscall names and handle for unimplemented routines */ 513/* Table of syscall names and handle for unimplemented routines */
512static const char *syscall_names[] = { 514static const char * const syscall_names[] = {
513 "nosys", /* 0 */ 515 "nosys", /* 0 */
514 "exit", 516 "exit",
515 "fork", 517 "fork",
diff --git a/arch/parisc/hpux/wrappers.S b/arch/parisc/hpux/wrappers.S
index 0b0c3a66b1be..58c53c879c02 100644
--- a/arch/parisc/hpux/wrappers.S
+++ b/arch/parisc/hpux/wrappers.S
@@ -20,19 +20,16 @@
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23#ifdef __LP64__ 23#ifdef CONFIG_64BIT
24#warning PA64 support needs more work...did first cut 24#warning PA64 support needs more work...did first cut
25#endif 25#endif
26 26
27#include <asm/asm-offsets.h> 27#include <asm/asm-offsets.h>
28#include <asm/assembly.h> 28#include <asm/assembly.h>
29#include <asm/signal.h> 29#include <asm/signal.h>
30#include <linux/linkage.h>
30 31
31#ifdef __LP64__ 32 .level LEVEL
32 .level 2.0w
33#else
34 .level 1.1
35#endif
36 .text 33 .text
37 34
38 /* These should probably go in a header file somewhere. 35 /* These should probably go in a header file somewhere.
@@ -41,7 +38,7 @@
41 * register save/restore macros. 38 * register save/restore macros.
42 */ 39 */
43 .macro reg_save regs 40 .macro reg_save regs
44#ifdef __LP64__ 41#ifdef CONFIG_64BIT
45#warning NEEDS WORK for 64-bit 42#warning NEEDS WORK for 64-bit
46#endif 43#endif
47 STREG %r3, PT_GR3(\regs) 44 STREG %r3, PT_GR3(\regs)
@@ -82,11 +79,9 @@
82 .endm 79 .endm
83 80
84 81
85 .export hpux_fork_wrapper
86 .export hpux_child_return
87 .import sys_fork 82 .import sys_fork
88 83
89hpux_fork_wrapper: 84ENTRY(hpux_fork_wrapper)
90 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs 85 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
91 ;! pointer in task 86 ;! pointer in task
92 reg_save %r1 87 reg_save %r1
@@ -128,27 +123,26 @@ fork_return:
128fork_exit: 123fork_exit:
129 bv %r0(%r2) 124 bv %r0(%r2)
130 nop 125 nop
126ENDPROC(hpux_fork_wrapper)
131 127
132 /* Set the return value for the child */ 128 /* Set the return value for the child */
133 129
134hpux_child_return: 130ENTRY(hpux_child_return)
135#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) 131#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
136 bl schedule_tail, %r2 132 bl,n schedule_tail, %r2
137 nop
138#endif 133#endif
139 134
140 LDREG TASK_PT_GR19-TASK_SZ_ALGN-128(%r30),%r2 135 LDREG TASK_PT_GR19-TASK_SZ_ALGN-128(%r30),%r2
141 b fork_return 136 b fork_return
142 copy %r0,%r28 137 copy %r0,%r28
138ENDPROC(hpux_child_return)
143 139
144 .export hpux_execve_wrapper
145 .export hpux_execv_wrapper
146 .import hpux_execve 140 .import hpux_execve
147 141
148hpux_execv_wrapper: 142ENTRY(hpux_execv_wrapper)
149 copy %r0,%r24 /* NULL environment */ 143 copy %r0,%r24 /* NULL environment */
150 144
151hpux_execve_wrapper: 145ENTRY(hpux_execve_wrapper)
152 146
153 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs 147 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
154 148
@@ -187,13 +181,13 @@ hpux_execve_wrapper:
187exec_error: 181exec_error:
188 bv %r0(%r19) 182 bv %r0(%r19)
189 nop 183 nop
184ENDPROC(hpux_execv_wrapper)
190 185
191 .export hpux_pipe_wrapper
192 .import hpux_pipe 186 .import hpux_pipe
193 187
194 /* HP-UX expects pipefd's returned in r28 & r29 */ 188 /* HP-UX expects pipefd's returned in r28 & r29 */
195 189
196hpux_pipe_wrapper: 190ENTRY(hpux_pipe_wrapper)
197 STREG %r2,-20(%r30) 191 STREG %r2,-20(%r30)
198 ldo 64(%r30),%r30 192 ldo 64(%r30),%r30
199 bl hpux_pipe,%r2 193 bl hpux_pipe,%r2
@@ -212,12 +206,11 @@ hpux_pipe_wrapper:
212pipe_exit: 206pipe_exit:
213 bv %r0(%r2) 207 bv %r0(%r2)
214 ldo -64(%r30),%r30 208 ldo -64(%r30),%r30
209ENDPROC(hpux_pipe_wrapper)
215 210
216 .export hpux_syscall_exit
217 .import syscall_exit 211 .import syscall_exit
218 212
219hpux_syscall_exit: 213ENTRY(hpux_syscall_exit)
220
221 /* 214 /*
222 * 215 *
223 * HP-UX call return conventions: 216 * HP-UX call return conventions:
@@ -246,12 +239,12 @@ hpux_syscall_exit:
246 ldo 1(%r0),%r22 239 ldo 1(%r0),%r22
247 240
248no_error: 241no_error:
249 b syscall_exit 242 b,n syscall_exit
250 nop 243ENDPROC(hpux_syscall_exit)
251 244
252 .export hpux_unimplemented_wrapper
253 .import hpux_unimplemented 245 .import hpux_unimplemented
254 246
255hpux_unimplemented_wrapper: 247ENTRY(hpux_unimplemented_wrapper)
256 b hpux_unimplemented 248 b hpux_unimplemented
257 STREG %r22,-64(%r30) /* overwrite arg8 with syscall number */ 249 STREG %r22,-64(%r30) /* overwrite arg8 with syscall number */
250ENDPROC(hpux_unimplemented_wrapper)
diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c
index c11a5bc7c067..54fdb959149c 100644
--- a/arch/parisc/kernel/asm-offsets.c
+++ b/arch/parisc/kernel/asm-offsets.c
@@ -44,7 +44,7 @@
44 44
45#define BLANK() asm volatile("\n->" : : ) 45#define BLANK() asm volatile("\n->" : : )
46 46
47#ifdef __LP64__ 47#ifdef CONFIG_64BIT
48#define FRAME_SIZE 128 48#define FRAME_SIZE 128
49#else 49#else
50#define FRAME_SIZE 64 50#define FRAME_SIZE 64
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 0be51e92a2fc..0dc924ccceb5 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -68,16 +68,6 @@ flush_cache_all_local(void)
68} 68}
69EXPORT_SYMBOL(flush_cache_all_local); 69EXPORT_SYMBOL(flush_cache_all_local);
70 70
71/* flushes EVERYTHING (tlb & cache) */
72
73void
74flush_all_caches(void)
75{
76 flush_cache_all();
77 flush_tlb_all();
78}
79EXPORT_SYMBOL(flush_all_caches);
80
81void 71void
82update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 72update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
83{ 73{
@@ -99,7 +89,7 @@ show_cache_info(struct seq_file *m)
99 89
100 seq_printf(m, "I-cache\t\t: %ld KB\n", 90 seq_printf(m, "I-cache\t\t: %ld KB\n",
101 cache_info.ic_size/1024 ); 91 cache_info.ic_size/1024 );
102 if (cache_info.dc_loop == 1) 92 if (cache_info.dc_loop != 1)
103 snprintf(buf, 32, "%lu-way associative", cache_info.dc_loop); 93 snprintf(buf, 32, "%lu-way associative", cache_info.dc_loop);
104 seq_printf(m, "D-cache\t\t: %ld KB (%s%s, %s)\n", 94 seq_printf(m, "D-cache\t\t: %ld KB (%s%s, %s)\n",
105 cache_info.dc_size/1024, 95 cache_info.dc_size/1024,
@@ -270,6 +260,83 @@ void disable_sr_hashing(void)
270 panic("SpaceID hashing is still on!\n"); 260 panic("SpaceID hashing is still on!\n");
271} 261}
272 262
263/* Simple function to work out if we have an existing address translation
264 * for a user space vma. */
265static inline int translation_exists(struct vm_area_struct *vma,
266 unsigned long addr, unsigned long pfn)
267{
268 pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
269 pmd_t *pmd;
270 pte_t pte;
271
272 if(pgd_none(*pgd))
273 return 0;
274
275 pmd = pmd_offset(pgd, addr);
276 if(pmd_none(*pmd) || pmd_bad(*pmd))
277 return 0;
278
279 /* We cannot take the pte lock here: flush_cache_page is usually
280 * called with pte lock already held. Whereas flush_dcache_page
281 * takes flush_dcache_mmap_lock, which is lower in the hierarchy:
282 * the vma itself is secure, but the pte might come or go racily.
283 */
284 pte = *pte_offset_map(pmd, addr);
285 /* But pte_unmap() does nothing on this architecture */
286
287 /* Filter out coincidental file entries and swap entries */
288 if (!(pte_val(pte) & (_PAGE_FLUSH|_PAGE_PRESENT)))
289 return 0;
290
291 return pte_pfn(pte) == pfn;
292}
293
294/* Private function to flush a page from the cache of a non-current
295 * process. cr25 contains the Page Directory of the current user
296 * process; we're going to hijack both it and the user space %sr3 to
297 * temporarily make the non-current process current. We have to do
298 * this because cache flushing may cause a non-access tlb miss which
299 * the handlers have to fill in from the pgd of the non-current
300 * process. */
301static inline void
302flush_user_cache_page_non_current(struct vm_area_struct *vma,
303 unsigned long vmaddr)
304{
305 /* save the current process space and pgd */
306 unsigned long space = mfsp(3), pgd = mfctl(25);
307
308 /* we don't mind taking interrups since they may not
309 * do anything with user space, but we can't
310 * be preempted here */
311 preempt_disable();
312
313 /* make us current */
314 mtctl(__pa(vma->vm_mm->pgd), 25);
315 mtsp(vma->vm_mm->context, 3);
316
317 flush_user_dcache_page(vmaddr);
318 if(vma->vm_flags & VM_EXEC)
319 flush_user_icache_page(vmaddr);
320
321 /* put the old current process back */
322 mtsp(space, 3);
323 mtctl(pgd, 25);
324 preempt_enable();
325}
326
327
328static inline void
329__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
330{
331 if (likely(vma->vm_mm->context == mfsp(3))) {
332 flush_user_dcache_page(vmaddr);
333 if (vma->vm_flags & VM_EXEC)
334 flush_user_icache_page(vmaddr);
335 } else {
336 flush_user_cache_page_non_current(vma, vmaddr);
337 }
338}
339
273void flush_dcache_page(struct page *page) 340void flush_dcache_page(struct page *page)
274{ 341{
275 struct address_space *mapping = page_mapping(page); 342 struct address_space *mapping = page_mapping(page);
@@ -342,7 +409,7 @@ void clear_user_page_asm(void *page, unsigned long vaddr)
342#define FLUSH_THRESHOLD 0x80000 /* 0.5MB */ 409#define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
343int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD; 410int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD;
344 411
345void parisc_setup_cache_timing(void) 412void __init parisc_setup_cache_timing(void)
346{ 413{
347 unsigned long rangetime, alltime; 414 unsigned long rangetime, alltime;
348 unsigned long size; 415 unsigned long size;
@@ -366,6 +433,9 @@ void parisc_setup_cache_timing(void)
366 if (!parisc_cache_flush_threshold) 433 if (!parisc_cache_flush_threshold)
367 parisc_cache_flush_threshold = FLUSH_THRESHOLD; 434 parisc_cache_flush_threshold = FLUSH_THRESHOLD;
368 435
436 if (parisc_cache_flush_threshold > cache_info.dc_size)
437 parisc_cache_flush_threshold = cache_info.dc_size;
438
369 printk(KERN_INFO "Setting cache flush threshold to %x (%d CPUs online)\n", parisc_cache_flush_threshold, num_online_cpus()); 439 printk(KERN_INFO "Setting cache flush threshold to %x (%d CPUs online)\n", parisc_cache_flush_threshold, num_online_cpus());
370} 440}
371 441
@@ -410,3 +480,97 @@ void kunmap_parisc(void *addr)
410} 480}
411EXPORT_SYMBOL(kunmap_parisc); 481EXPORT_SYMBOL(kunmap_parisc);
412#endif 482#endif
483
484void __flush_tlb_range(unsigned long sid, unsigned long start,
485 unsigned long end)
486{
487 unsigned long npages;
488
489 npages = ((end - (start & PAGE_MASK)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
490 if (npages >= 512) /* 2MB of space: arbitrary, should be tuned */
491 flush_tlb_all();
492 else {
493 mtsp(sid, 1);
494 purge_tlb_start();
495 if (split_tlb) {
496 while (npages--) {
497 pdtlb(start);
498 pitlb(start);
499 start += PAGE_SIZE;
500 }
501 } else {
502 while (npages--) {
503 pdtlb(start);
504 start += PAGE_SIZE;
505 }
506 }
507 purge_tlb_end();
508 }
509}
510
511static void cacheflush_h_tmp_function(void *dummy)
512{
513 flush_cache_all_local();
514}
515
516void flush_cache_all(void)
517{
518 on_each_cpu(cacheflush_h_tmp_function, NULL, 1, 1);
519}
520
521void flush_cache_mm(struct mm_struct *mm)
522{
523#ifdef CONFIG_SMP
524 flush_cache_all();
525#else
526 flush_cache_all_local();
527#endif
528}
529
530void
531flush_user_dcache_range(unsigned long start, unsigned long end)
532{
533 if ((end - start) < parisc_cache_flush_threshold)
534 flush_user_dcache_range_asm(start,end);
535 else
536 flush_data_cache();
537}
538
539void
540flush_user_icache_range(unsigned long start, unsigned long end)
541{
542 if ((end - start) < parisc_cache_flush_threshold)
543 flush_user_icache_range_asm(start,end);
544 else
545 flush_instruction_cache();
546}
547
548
549void flush_cache_range(struct vm_area_struct *vma,
550 unsigned long start, unsigned long end)
551{
552 int sr3;
553
554 if (!vma->vm_mm->context) {
555 BUG();
556 return;
557 }
558
559 sr3 = mfsp(3);
560 if (vma->vm_mm->context == sr3) {
561 flush_user_dcache_range(start,end);
562 flush_user_icache_range(start,end);
563 } else {
564 flush_cache_all();
565 }
566}
567
568void
569flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)
570{
571 BUG_ON(!vma->vm_mm->context);
572
573 if (likely(translation_exists(vma, vmaddr, pfn)))
574 __flush_cache_page(vma, vmaddr);
575
576}
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index d6c486e9501c..2ca654bd6322 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -562,12 +562,23 @@ pa_dev_attr(rev, id.hversion_rev, "0x%x\n");
562pa_dev_attr_id(hversion, "0x%03x\n"); 562pa_dev_attr_id(hversion, "0x%03x\n");
563pa_dev_attr_id(sversion, "0x%05x\n"); 563pa_dev_attr_id(sversion, "0x%05x\n");
564 564
565static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
566{
567 struct parisc_device *padev = to_parisc_device(dev);
568 struct parisc_device_id *id = &padev->id;
569
570 return sprintf(buf, "parisc:t%02Xhv%04Xrev%02Xsv%08X\n",
571 (u8)id->hw_type, (u16)id->hversion, (u8)id->hversion_rev,
572 (u32)id->sversion);
573}
574
565static struct device_attribute parisc_device_attrs[] = { 575static struct device_attribute parisc_device_attrs[] = {
566 __ATTR_RO(irq), 576 __ATTR_RO(irq),
567 __ATTR_RO(hw_type), 577 __ATTR_RO(hw_type),
568 __ATTR_RO(rev), 578 __ATTR_RO(rev),
569 __ATTR_RO(hversion), 579 __ATTR_RO(hversion),
570 __ATTR_RO(sversion), 580 __ATTR_RO(sversion),
581 __ATTR_RO(modalias),
571 __ATTR_NULL, 582 __ATTR_NULL,
572}; 583};
573 584
@@ -689,7 +700,9 @@ parse_tree_node(struct device *parent, int index, struct hardware_path *modpath)
689 .fn = check_parent, 700 .fn = check_parent,
690 }; 701 };
691 702
692 device_for_each_child(parent, &recurse_data, descend_children); 703 if (device_for_each_child(parent, &recurse_data, descend_children))
704 /* nothing */;
705
693 return d.dev; 706 return d.dev;
694} 707}
695 708
@@ -835,8 +848,8 @@ static void print_parisc_device(struct parisc_device *dev)
835 static int count; 848 static int count;
836 849
837 print_pa_hwpath(dev, hw_path); 850 print_pa_hwpath(dev, hw_path);
838 printk(KERN_INFO "%d. %s at 0x%lx [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }", 851 printk(KERN_INFO "%d. %s at 0x%p [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
839 ++count, dev->name, dev->hpa.start, hw_path, dev->id.hw_type, 852 ++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type,
840 dev->id.hversion_rev, dev->id.hversion, dev->id.sversion); 853 dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);
841 854
842 if (dev->num_addrs) { 855 if (dev->num_addrs) {
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 340b5e8d67ba..8474f9e5ca10 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -37,6 +37,8 @@
37#include <asm/unistd.h> 37#include <asm/unistd.h>
38#include <asm/thread_info.h> 38#include <asm/thread_info.h>
39 39
40#include <linux/linkage.h>
41
40#ifdef CONFIG_64BIT 42#ifdef CONFIG_64BIT
41#define CMPIB cmpib,* 43#define CMPIB cmpib,*
42#define CMPB cmpb,* 44#define CMPB cmpb,*
@@ -648,13 +650,11 @@
648 * the static part of the kernel address space. 650 * the static part of the kernel address space.
649 */ 651 */
650 652
651 .export fault_vector_20
652
653 .text 653 .text
654 654
655 .align 4096 655 .align 4096
656 656
657fault_vector_20: 657ENTRY(fault_vector_20)
658 /* First vector is invalid (0) */ 658 /* First vector is invalid (0) */
659 .ascii "cows can fly" 659 .ascii "cows can fly"
660 .byte 0 660 .byte 0
@@ -695,14 +695,13 @@ fault_vector_20:
695 def 29 695 def 29
696 def 30 696 def 30
697 def 31 697 def 31
698END(fault_vector_20)
698 699
699#ifndef CONFIG_64BIT 700#ifndef CONFIG_64BIT
700 701
701 .export fault_vector_11
702
703 .align 2048 702 .align 2048
704 703
705fault_vector_11: 704ENTRY(fault_vector_11)
706 /* First vector is invalid (0) */ 705 /* First vector is invalid (0) */
707 .ascii "cows can fly" 706 .ascii "cows can fly"
708 .byte 0 707 .byte 0
@@ -743,6 +742,7 @@ fault_vector_11:
743 def 29 742 def 29
744 def 30 743 def 30
745 def 31 744 def 31
745END(fault_vector_11)
746 746
747#endif 747#endif
748 748
@@ -762,9 +762,8 @@ fault_vector_11:
762#define CLONE_VM 0x100 /* Must agree with <linux/sched.h> */ 762#define CLONE_VM 0x100 /* Must agree with <linux/sched.h> */
763#define CLONE_UNTRACED 0x00800000 763#define CLONE_UNTRACED 0x00800000
764 764
765 .export __kernel_thread, code
766 .import do_fork 765 .import do_fork
767__kernel_thread: 766ENTRY(__kernel_thread)
768 STREG %r2, -RP_OFFSET(%r30) 767 STREG %r2, -RP_OFFSET(%r30)
769 768
770 copy %r30, %r1 769 copy %r30, %r1
@@ -797,6 +796,7 @@ __kernel_thread:
797 ldo -PT_SZ_ALGN(%r30), %r30 796 ldo -PT_SZ_ALGN(%r30), %r30
798 bv %r0(%r2) 797 bv %r0(%r2)
799 nop 798 nop
799ENDPROC(__kernel_thread)
800 800
801 /* 801 /*
802 * Child Returns here 802 * Child Returns here
@@ -805,8 +805,7 @@ __kernel_thread:
805 * into task save area. 805 * into task save area.
806 */ 806 */
807 807
808 .export ret_from_kernel_thread 808ENTRY(ret_from_kernel_thread)
809ret_from_kernel_thread:
810 809
811 /* Call schedule_tail first though */ 810 /* Call schedule_tail first though */
812 BL schedule_tail, %r2 811 BL schedule_tail, %r2
@@ -833,10 +832,10 @@ ret_from_kernel_thread:
833 bv %r0(%r1) 832 bv %r0(%r1)
834#endif 833#endif
835 ldi 0, %r26 834 ldi 0, %r26
835ENDPROC(ret_from_kernel_thread)
836 836
837 .import sys_execve, code 837 .import sys_execve, code
838 .export __execve, code 838ENTRY(__execve)
839__execve:
840 copy %r2, %r15 839 copy %r2, %r15
841 copy %r30, %r16 840 copy %r30, %r16
842 ldo PT_SZ_ALGN(%r30), %r30 841 ldo PT_SZ_ALGN(%r30), %r30
@@ -856,16 +855,15 @@ __execve:
856 copy %r16, %r30 855 copy %r16, %r30
857 bv %r0(%r2) 856 bv %r0(%r2)
858 nop 857 nop
858ENDPROC(__execve)
859 859
860 .align 4
861 860
862 /* 861 /*
863 * struct task_struct *_switch_to(struct task_struct *prev, 862 * struct task_struct *_switch_to(struct task_struct *prev,
864 * struct task_struct *next) 863 * struct task_struct *next)
865 * 864 *
866 * switch kernel stacks and return prev */ 865 * switch kernel stacks and return prev */
867 .export _switch_to, code 866ENTRY(_switch_to)
868_switch_to:
869 STREG %r2, -RP_OFFSET(%r30) 867 STREG %r2, -RP_OFFSET(%r30)
870 868
871 callee_save_float 869 callee_save_float
@@ -890,6 +888,7 @@ _switch_to_ret:
890 LDREG -RP_OFFSET(%r30), %r2 888 LDREG -RP_OFFSET(%r30), %r2
891 bv %r0(%r2) 889 bv %r0(%r2)
892 copy %r26, %r28 890 copy %r26, %r28
891ENDPROC(_switch_to)
893 892
894 /* 893 /*
895 * Common rfi return path for interruptions, kernel execve, and 894 * Common rfi return path for interruptions, kernel execve, and
@@ -907,8 +906,7 @@ _switch_to_ret:
907 906
908 .align 4096 907 .align 4096
909 908
910 .export syscall_exit_rfi 909ENTRY(syscall_exit_rfi)
911syscall_exit_rfi:
912 mfctl %cr30,%r16 910 mfctl %cr30,%r16
913 LDREG TI_TASK(%r16), %r16 /* thread_info -> task_struct */ 911 LDREG TI_TASK(%r16), %r16 /* thread_info -> task_struct */
914 ldo TASK_REGS(%r16),%r16 912 ldo TASK_REGS(%r16),%r16
@@ -978,11 +976,36 @@ intr_check_resched:
978 LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_NEED_RESCHED */ 976 LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_NEED_RESCHED */
979 bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched /* forward */ 977 bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched /* forward */
980 978
979 .import do_notify_resume,code
981intr_check_sig: 980intr_check_sig:
982 /* As above */ 981 /* As above */
983 mfctl %cr30,%r1 982 mfctl %cr30,%r1
984 LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_SIGPENDING */ 983 LDREG TI_FLAGS(%r1),%r19
985 bb,<,n %r19, 31-TIF_SIGPENDING, intr_do_signal /* forward */ 984 ldi (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %r20
985 and,COND(<>) %r19, %r20, %r0
986 b,n intr_restore /* skip past if we've nothing to do */
987
988 /* This check is critical to having LWS
989 * working. The IASQ is zero on the gateway
990 * page and we cannot deliver any signals until
991 * we get off the gateway page.
992 *
993 * Only do signals if we are returning to user space
994 */
995 LDREG PT_IASQ0(%r16), %r20
996 CMPIB=,n 0,%r20,intr_restore /* backward */
997 LDREG PT_IASQ1(%r16), %r20
998 CMPIB=,n 0,%r20,intr_restore /* backward */
999
1000 copy %r0, %r25 /* long in_syscall = 0 */
1001#ifdef CONFIG_64BIT
1002 ldo -16(%r30),%r29 /* Reference param save area */
1003#endif
1004
1005 BL do_notify_resume,%r2
1006 copy %r16, %r26 /* struct pt_regs *regs */
1007
1008 b,n intr_check_sig
986 1009
987intr_restore: 1010intr_restore:
988 copy %r16,%r29 1011 copy %r16,%r29
@@ -1072,35 +1095,6 @@ intr_do_preempt:
1072 b,n intr_restore /* ssm PSW_SM_I done by intr_restore */ 1095 b,n intr_restore /* ssm PSW_SM_I done by intr_restore */
1073#endif /* CONFIG_PREEMPT */ 1096#endif /* CONFIG_PREEMPT */
1074 1097
1075 .import do_signal,code
1076intr_do_signal:
1077 /*
1078 This check is critical to having LWS
1079 working. The IASQ is zero on the gateway
1080 page and we cannot deliver any signals until
1081 we get off the gateway page.
1082
1083 Only do signals if we are returning to user space
1084 */
1085 LDREG PT_IASQ0(%r16), %r20
1086 CMPIB= 0,%r20,intr_restore /* backward */
1087 nop
1088 LDREG PT_IASQ1(%r16), %r20
1089 CMPIB= 0,%r20,intr_restore /* backward */
1090 nop
1091
1092 copy %r0, %r24 /* unsigned long in_syscall */
1093 copy %r16, %r25 /* struct pt_regs *regs */
1094#ifdef CONFIG_64BIT
1095 ldo -16(%r30),%r29 /* Reference param save area */
1096#endif
1097
1098 BL do_signal,%r2
1099 copy %r0, %r26 /* sigset_t *oldset = NULL */
1100
1101 b intr_check_sig
1102 nop
1103
1104 /* 1098 /*
1105 * External interrupts. 1099 * External interrupts.
1106 */ 1100 */
@@ -1115,11 +1109,7 @@ intr_extint:
1115 mfctl %cr31,%r1 1109 mfctl %cr31,%r1
1116 copy %r30,%r17 1110 copy %r30,%r17
1117 /* FIXME! depi below has hardcoded idea of interrupt stack size (32k)*/ 1111 /* FIXME! depi below has hardcoded idea of interrupt stack size (32k)*/
1118#ifdef CONFIG_64BIT 1112 DEPI 0,31,15,%r17
1119 depdi 0,63,15,%r17
1120#else
1121 depi 0,31,15,%r17
1122#endif
1123 CMPB=,n %r1,%r17,2f 1113 CMPB=,n %r1,%r17,2f
1124 get_stack_use_cr31 1114 get_stack_use_cr31
1125 b,n 3f 1115 b,n 3f
@@ -1148,13 +1138,12 @@ intr_extint:
1148 1138
1149 b do_cpu_irq_mask 1139 b do_cpu_irq_mask
1150 ldo R%intr_return(%r2), %r2 /* return to intr_return, not here */ 1140 ldo R%intr_return(%r2), %r2 /* return to intr_return, not here */
1141ENDPROC(syscall_exit_rfi)
1151 1142
1152 1143
1153 /* Generic interruptions (illegal insn, unaligned, page fault, etc) */ 1144 /* Generic interruptions (illegal insn, unaligned, page fault, etc) */
1154 1145
1155 .export intr_save, code /* for os_hpmc */ 1146ENTRY(intr_save) /* for os_hpmc */
1156
1157intr_save:
1158 mfsp %sr7,%r16 1147 mfsp %sr7,%r16
1159 CMPIB=,n 0,%r16,1f 1148 CMPIB=,n 0,%r16,1f
1160 get_stack_use_cr30 1149 get_stack_use_cr30
@@ -1229,6 +1218,7 @@ skip_save_ior:
1229 1218
1230 b handle_interruption 1219 b handle_interruption
1231 ldo R%intr_check_sig(%r2), %r2 1220 ldo R%intr_check_sig(%r2), %r2
1221ENDPROC(intr_save)
1232 1222
1233 1223
1234 /* 1224 /*
@@ -1814,9 +1804,7 @@ dtlb_fault:
1814 LDREG PT_GR18(\regs),%r18 1804 LDREG PT_GR18(\regs),%r18
1815 .endm 1805 .endm
1816 1806
1817 .export sys_fork_wrapper 1807ENTRY(sys_fork_wrapper)
1818 .export child_return
1819sys_fork_wrapper:
1820 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1 1808 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
1821 ldo TASK_REGS(%r1),%r1 1809 ldo TASK_REGS(%r1),%r1
1822 reg_save %r1 1810 reg_save %r1
@@ -1853,9 +1841,10 @@ wrapper_exit:
1853 ldi __NR_fork,%r20 1841 ldi __NR_fork,%r20
1854 bv %r0(%r2) 1842 bv %r0(%r2)
1855 STREG %r20,PT_GR20(%r1) 1843 STREG %r20,PT_GR20(%r1)
1844ENDPROC(sys_fork_wrapper)
1856 1845
1857 /* Set the return value for the child */ 1846 /* Set the return value for the child */
1858child_return: 1847ENTRY(child_return)
1859 BL schedule_tail, %r2 1848 BL schedule_tail, %r2
1860 nop 1849 nop
1861 1850
@@ -1863,10 +1852,10 @@ child_return:
1863 LDREG TASK_PT_GR19(%r1),%r2 1852 LDREG TASK_PT_GR19(%r1),%r2
1864 b wrapper_exit 1853 b wrapper_exit
1865 copy %r0,%r28 1854 copy %r0,%r28
1855ENDPROC(child_return)
1866 1856
1867 1857
1868 .export sys_clone_wrapper 1858ENTRY(sys_clone_wrapper)
1869sys_clone_wrapper:
1870 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 1859 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1871 ldo TASK_REGS(%r1),%r1 /* get pt regs */ 1860 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1872 reg_save %r1 1861 reg_save %r1
@@ -1887,9 +1876,10 @@ sys_clone_wrapper:
1887 1876
1888 b wrapper_exit 1877 b wrapper_exit
1889 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2 1878 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2
1879ENDPROC(sys_clone_wrapper)
1880
1890 1881
1891 .export sys_vfork_wrapper 1882ENTRY(sys_vfork_wrapper)
1892sys_vfork_wrapper:
1893 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 1883 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1894 ldo TASK_REGS(%r1),%r1 /* get pt regs */ 1884 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1895 reg_save %r1 1885 reg_save %r1
@@ -1910,6 +1900,7 @@ sys_vfork_wrapper:
1910 1900
1911 b wrapper_exit 1901 b wrapper_exit
1912 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2 1902 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2
1903ENDPROC(sys_vfork_wrapper)
1913 1904
1914 1905
1915 .macro execve_wrapper execve 1906 .macro execve_wrapper execve
@@ -1946,22 +1937,19 @@ error_\execve:
1946 nop 1937 nop
1947 .endm 1938 .endm
1948 1939
1949 .export sys_execve_wrapper
1950 .import sys_execve 1940 .import sys_execve
1951 1941ENTRY(sys_execve_wrapper)
1952sys_execve_wrapper:
1953 execve_wrapper sys_execve 1942 execve_wrapper sys_execve
1943ENDPROC(sys_execve_wrapper)
1954 1944
1955#ifdef CONFIG_64BIT 1945#ifdef CONFIG_64BIT
1956 .export sys32_execve_wrapper
1957 .import sys32_execve 1946 .import sys32_execve
1958 1947ENTRY(sys32_execve_wrapper)
1959sys32_execve_wrapper:
1960 execve_wrapper sys32_execve 1948 execve_wrapper sys32_execve
1949ENDPROC(sys32_execve_wrapper)
1961#endif 1950#endif
1962 1951
1963 .export sys_rt_sigreturn_wrapper 1952ENTRY(sys_rt_sigreturn_wrapper)
1964sys_rt_sigreturn_wrapper:
1965 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26 1953 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26
1966 ldo TASK_REGS(%r26),%r26 /* get pt regs */ 1954 ldo TASK_REGS(%r26),%r26 /* get pt regs */
1967 /* Don't save regs, we are going to restore them from sigcontext. */ 1955 /* Don't save regs, we are going to restore them from sigcontext. */
@@ -1989,9 +1977,9 @@ sys_rt_sigreturn_wrapper:
1989 */ 1977 */
1990 bv %r0(%r2) 1978 bv %r0(%r2)
1991 LDREG PT_GR28(%r1),%r28 /* reload original r28 for syscall_exit */ 1979 LDREG PT_GR28(%r1),%r28 /* reload original r28 for syscall_exit */
1980ENDPROC(sys_rt_sigreturn_wrapper)
1992 1981
1993 .export sys_sigaltstack_wrapper 1982ENTRY(sys_sigaltstack_wrapper)
1994sys_sigaltstack_wrapper:
1995 /* Get the user stack pointer */ 1983 /* Get the user stack pointer */
1996 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 1984 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1997 ldo TASK_REGS(%r1),%r24 /* get pt regs */ 1985 ldo TASK_REGS(%r1),%r24 /* get pt regs */
@@ -1999,10 +1987,10 @@ sys_sigaltstack_wrapper:
1999 STREG %r2, -RP_OFFSET(%r30) 1987 STREG %r2, -RP_OFFSET(%r30)
2000#ifdef CONFIG_64BIT 1988#ifdef CONFIG_64BIT
2001 ldo FRAME_SIZE(%r30), %r30 1989 ldo FRAME_SIZE(%r30), %r30
2002 b,l do_sigaltstack,%r2 1990 BL do_sigaltstack,%r2
2003 ldo -16(%r30),%r29 /* Reference param save area */ 1991 ldo -16(%r30),%r29 /* Reference param save area */
2004#else 1992#else
2005 bl do_sigaltstack,%r2 1993 BL do_sigaltstack,%r2
2006 ldo FRAME_SIZE(%r30), %r30 1994 ldo FRAME_SIZE(%r30), %r30
2007#endif 1995#endif
2008 1996
@@ -2010,53 +1998,26 @@ sys_sigaltstack_wrapper:
2010 LDREG -RP_OFFSET(%r30), %r2 1998 LDREG -RP_OFFSET(%r30), %r2
2011 bv %r0(%r2) 1999 bv %r0(%r2)
2012 nop 2000 nop
2001ENDPROC(sys_sigaltstack_wrapper)
2013 2002
2014#ifdef CONFIG_64BIT 2003#ifdef CONFIG_64BIT
2015 .export sys32_sigaltstack_wrapper 2004ENTRY(sys32_sigaltstack_wrapper)
2016sys32_sigaltstack_wrapper:
2017 /* Get the user stack pointer */ 2005 /* Get the user stack pointer */
2018 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r24 2006 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r24
2019 LDREG TASK_PT_GR30(%r24),%r24 2007 LDREG TASK_PT_GR30(%r24),%r24
2020 STREG %r2, -RP_OFFSET(%r30) 2008 STREG %r2, -RP_OFFSET(%r30)
2021 ldo FRAME_SIZE(%r30), %r30 2009 ldo FRAME_SIZE(%r30), %r30
2022 b,l do_sigaltstack32,%r2 2010 BL do_sigaltstack32,%r2
2023 ldo -16(%r30),%r29 /* Reference param save area */ 2011 ldo -16(%r30),%r29 /* Reference param save area */
2024 2012
2025 ldo -FRAME_SIZE(%r30), %r30 2013 ldo -FRAME_SIZE(%r30), %r30
2026 LDREG -RP_OFFSET(%r30), %r2 2014 LDREG -RP_OFFSET(%r30), %r2
2027 bv %r0(%r2) 2015 bv %r0(%r2)
2028 nop 2016 nop
2017ENDPROC(sys32_sigaltstack_wrapper)
2029#endif 2018#endif
2030 2019
2031 .export sys_rt_sigsuspend_wrapper 2020ENTRY(syscall_exit)
2032sys_rt_sigsuspend_wrapper:
2033 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
2034 ldo TASK_REGS(%r1),%r24
2035 reg_save %r24
2036
2037 STREG %r2, -RP_OFFSET(%r30)
2038#ifdef CONFIG_64BIT
2039 ldo FRAME_SIZE(%r30), %r30
2040 b,l sys_rt_sigsuspend,%r2
2041 ldo -16(%r30),%r29 /* Reference param save area */
2042#else
2043 bl sys_rt_sigsuspend,%r2
2044 ldo FRAME_SIZE(%r30), %r30
2045#endif
2046
2047 ldo -FRAME_SIZE(%r30), %r30
2048 LDREG -RP_OFFSET(%r30), %r2
2049
2050 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
2051 ldo TASK_REGS(%r1),%r1
2052 reg_restore %r1
2053
2054 bv %r0(%r2)
2055 nop
2056
2057 .export syscall_exit
2058syscall_exit:
2059
2060 /* NOTE: HP-UX syscalls also come through here 2021 /* NOTE: HP-UX syscalls also come through here
2061 * after hpux_syscall_exit fixes up return 2022 * after hpux_syscall_exit fixes up return
2062 * values. */ 2023 * values. */
@@ -2119,9 +2080,35 @@ syscall_check_resched:
2119 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 /* long */ 2080 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 /* long */
2120 bb,<,n %r19, 31-TIF_NEED_RESCHED, syscall_do_resched /* forward */ 2081 bb,<,n %r19, 31-TIF_NEED_RESCHED, syscall_do_resched /* forward */
2121 2082
2083 .import do_signal,code
2122syscall_check_sig: 2084syscall_check_sig:
2123 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 /* get ti flags */ 2085 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
2124 bb,<,n %r19, 31-TIF_SIGPENDING, syscall_do_signal /* forward */ 2086 ldi (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %r26
2087 and,COND(<>) %r19, %r26, %r0
2088 b,n syscall_restore /* skip past if we've nothing to do */
2089
2090syscall_do_signal:
2091 /* Save callee-save registers (for sigcontext).
2092 * FIXME: After this point the process structure should be
2093 * consistent with all the relevant state of the process
2094 * before the syscall. We need to verify this.
2095 */
2096 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2097 ldo TASK_REGS(%r1), %r26 /* struct pt_regs *regs */
2098 reg_save %r26
2099
2100#ifdef CONFIG_64BIT
2101 ldo -16(%r30),%r29 /* Reference param save area */
2102#endif
2103
2104 BL do_notify_resume,%r2
2105 ldi 1, %r25 /* long in_syscall = 1 */
2106
2107 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2108 ldo TASK_REGS(%r1), %r20 /* reload pt_regs */
2109 reg_restore %r20
2110
2111 b,n syscall_check_sig
2125 2112
2126syscall_restore: 2113syscall_restore:
2127 /* Are we being ptraced? */ 2114 /* Are we being ptraced? */
@@ -2259,31 +2246,10 @@ syscall_do_resched:
2259#endif 2246#endif
2260 b syscall_check_bh /* if resched, we start over again */ 2247 b syscall_check_bh /* if resched, we start over again */
2261 nop 2248 nop
2249ENDPROC(syscall_exit)
2262 2250
2263 .import do_signal,code
2264syscall_do_signal:
2265 /* Save callee-save registers (for sigcontext).
2266 FIXME: After this point the process structure should be
2267 consistent with all the relevant state of the process
2268 before the syscall. We need to verify this. */
2269 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2270 ldo TASK_REGS(%r1), %r25 /* struct pt_regs *regs */
2271 reg_save %r25
2272
2273 ldi 1, %r24 /* unsigned long in_syscall */
2274
2275#ifdef CONFIG_64BIT
2276 ldo -16(%r30),%r29 /* Reference param save area */
2277#endif
2278 BL do_signal,%r2
2279 copy %r0, %r26 /* sigset_t *oldset = NULL */
2280
2281 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2282 ldo TASK_REGS(%r1), %r20 /* reload pt_regs */
2283 reg_restore %r20
2284
2285 b,n syscall_check_sig
2286 2251
2252get_register:
2287 /* 2253 /*
2288 * get_register is used by the non access tlb miss handlers to 2254 * get_register is used by the non access tlb miss handlers to
2289 * copy the value of the general register specified in r8 into 2255 * copy the value of the general register specified in r8 into
@@ -2294,8 +2260,6 @@ syscall_do_signal:
2294 * a -1 in it, but that is OK, it just means that we will have 2260 * a -1 in it, but that is OK, it just means that we will have
2295 * to use the slow path instead). 2261 * to use the slow path instead).
2296 */ 2262 */
2297
2298get_register:
2299 blr %r8,%r0 2263 blr %r8,%r0
2300 nop 2264 nop
2301 bv %r0(%r25) /* r0 */ 2265 bv %r0(%r25) /* r0 */
@@ -2363,13 +2327,13 @@ get_register:
2363 bv %r0(%r25) /* r31 */ 2327 bv %r0(%r25) /* r31 */
2364 copy %r31,%r1 2328 copy %r31,%r1
2365 2329
2330
2331set_register:
2366 /* 2332 /*
2367 * set_register is used by the non access tlb miss handlers to 2333 * set_register is used by the non access tlb miss handlers to
2368 * copy the value of r1 into the general register specified in 2334 * copy the value of r1 into the general register specified in
2369 * r8. 2335 * r8.
2370 */ 2336 */
2371
2372set_register:
2373 blr %r8,%r0 2337 blr %r8,%r0
2374 nop 2338 nop
2375 bv %r0(%r25) /* r0 (silly, but it is a place holder) */ 2339 bv %r0(%r25) /* r0 (silly, but it is a place holder) */
@@ -2436,3 +2400,4 @@ set_register:
2436 copy %r1,%r30 2400 copy %r1,%r30
2437 bv %r0(%r25) /* r31 */ 2401 bv %r0(%r25) /* r31 */
2438 copy %r1,%r31 2402 copy %r1,%r31
2403
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 9158b707c0dd..39dc835bf89e 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -74,7 +74,7 @@ static DEFINE_SPINLOCK(pdc_lock);
74static unsigned long pdc_result[32] __attribute__ ((aligned (8))); 74static unsigned long pdc_result[32] __attribute__ ((aligned (8)));
75static unsigned long pdc_result2[32] __attribute__ ((aligned (8))); 75static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));
76 76
77#ifdef __LP64__ 77#ifdef CONFIG_64BIT
78#define WIDE_FIRMWARE 0x1 78#define WIDE_FIRMWARE 0x1
79#define NARROW_FIRMWARE 0x2 79#define NARROW_FIRMWARE 0x2
80 80
@@ -94,12 +94,12 @@ int parisc_narrow_firmware __read_mostly = 1;
94 * when running a 64-bit kernel on such boxes (e.g. C200 or C360). 94 * when running a 64-bit kernel on such boxes (e.g. C200 or C360).
95 */ 95 */
96 96
97#ifdef __LP64__ 97#ifdef CONFIG_64BIT
98long real64_call(unsigned long function, ...); 98long real64_call(unsigned long function, ...);
99#endif 99#endif
100long real32_call(unsigned long function, ...); 100long real32_call(unsigned long function, ...);
101 101
102#ifdef __LP64__ 102#ifdef CONFIG_64BIT
103# define MEM_PDC (unsigned long)(PAGE0->mem_pdc_hi) << 32 | PAGE0->mem_pdc 103# define MEM_PDC (unsigned long)(PAGE0->mem_pdc_hi) << 32 | PAGE0->mem_pdc
104# define mem_pdc_call(args...) unlikely(parisc_narrow_firmware) ? real32_call(MEM_PDC, args) : real64_call(MEM_PDC, args) 104# define mem_pdc_call(args...) unlikely(parisc_narrow_firmware) ? real32_call(MEM_PDC, args) : real64_call(MEM_PDC, args)
105#else 105#else
@@ -117,7 +117,7 @@ long real32_call(unsigned long function, ...);
117 */ 117 */
118static unsigned long f_extend(unsigned long address) 118static unsigned long f_extend(unsigned long address)
119{ 119{
120#ifdef __LP64__ 120#ifdef CONFIG_64BIT
121 if(unlikely(parisc_narrow_firmware)) { 121 if(unlikely(parisc_narrow_firmware)) {
122 if((address & 0xff000000) == 0xf0000000) 122 if((address & 0xff000000) == 0xf0000000)
123 return 0xf0f0f0f000000000UL | (u32)address; 123 return 0xf0f0f0f000000000UL | (u32)address;
@@ -139,7 +139,7 @@ static unsigned long f_extend(unsigned long address)
139 */ 139 */
140static void convert_to_wide(unsigned long *addr) 140static void convert_to_wide(unsigned long *addr)
141{ 141{
142#ifdef __LP64__ 142#ifdef CONFIG_64BIT
143 int i; 143 int i;
144 unsigned int *p = (unsigned int *)addr; 144 unsigned int *p = (unsigned int *)addr;
145 145
@@ -158,7 +158,7 @@ static void convert_to_wide(unsigned long *addr)
158 */ 158 */
159void __init set_firmware_width(void) 159void __init set_firmware_width(void)
160{ 160{
161#ifdef __LP64__ 161#ifdef CONFIG_64BIT
162 int retval; 162 int retval;
163 unsigned long flags; 163 unsigned long flags;
164 164
@@ -238,7 +238,7 @@ int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_inf
238 * 238 *
239 * Must be correctly formatted or expect system crash 239 * Must be correctly formatted or expect system crash
240 */ 240 */
241#ifdef __LP64__ 241#ifdef CONFIG_64BIT
242int pdc_pat_chassis_send_log(unsigned long state, unsigned long data) 242int pdc_pat_chassis_send_log(unsigned long state, unsigned long data)
243{ 243{
244 int retval = 0; 244 int retval = 0;
@@ -949,7 +949,7 @@ int pdc_tod_set(unsigned long sec, unsigned long usec)
949} 949}
950EXPORT_SYMBOL(pdc_tod_set); 950EXPORT_SYMBOL(pdc_tod_set);
951 951
952#ifdef __LP64__ 952#ifdef CONFIG_64BIT
953int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr, 953int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
954 struct pdc_memory_table *tbl, unsigned long entries) 954 struct pdc_memory_table *tbl, unsigned long entries)
955{ 955{
@@ -965,7 +965,7 @@ int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
965 965
966 return retval; 966 return retval;
967} 967}
968#endif /* __LP64__ */ 968#endif /* CONFIG_64BIT */
969 969
970/* FIXME: Is this pdc used? I could not find type reference to ftc_bitmap 970/* FIXME: Is this pdc used? I could not find type reference to ftc_bitmap
971 * so I guessed at unsigned long. Someone who knows what this does, can fix 971 * so I guessed at unsigned long. Someone who knows what this does, can fix
@@ -1204,7 +1204,7 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
1204} 1204}
1205EXPORT_SYMBOL(pdc_sti_call); 1205EXPORT_SYMBOL(pdc_sti_call);
1206 1206
1207#ifdef __LP64__ 1207#ifdef CONFIG_64BIT
1208/** 1208/**
1209 * pdc_pat_cell_get_number - Returns the cell number. 1209 * pdc_pat_cell_get_number - Returns the cell number.
1210 * @cell_info: The return buffer. 1210 * @cell_info: The return buffer.
@@ -1387,7 +1387,7 @@ int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val)
1387 1387
1388 return retval; 1388 return retval;
1389} 1389}
1390#endif /* __LP64__ */ 1390#endif /* CONFIG_64BIT */
1391 1391
1392 1392
1393/***************** 32-bit real-mode calls ***********/ 1393/***************** 32-bit real-mode calls ***********/
@@ -1445,7 +1445,7 @@ long real32_call(unsigned long fn, ...)
1445 return real32_call_asm(&real_stack.sp, &real_stack.arg0, fn); 1445 return real32_call_asm(&real_stack.sp, &real_stack.arg0, fn);
1446} 1446}
1447 1447
1448#ifdef __LP64__ 1448#ifdef CONFIG_64BIT
1449/***************** 64-bit real-mode calls ***********/ 1449/***************** 64-bit real-mode calls ***********/
1450 1450
1451struct wide_stack { 1451struct wide_stack {
@@ -1496,5 +1496,5 @@ long real64_call(unsigned long fn, ...)
1496 return real64_call_asm(&real64_stack.sp, &real64_stack.arg0, fn); 1496 return real64_call_asm(&real64_stack.sp, &real64_stack.arg0, fn);
1497} 1497}
1498 1498
1499#endif /* __LP64__ */ 1499#endif /* CONFIG_64BIT */
1500 1500
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
index eaad2328fea1..9676c486bb63 100644
--- a/arch/parisc/kernel/head.S
+++ b/arch/parisc/kernel/head.S
@@ -2,7 +2,7 @@
2 * License. See the file "COPYING" in the main directory of this archive 2 * License. See the file "COPYING" in the main directory of this archive
3 * for more details. 3 * for more details.
4 * 4 *
5 * Copyright (C) 1999 by Helge Deller 5 * Copyright (C) 1999-2007 by Helge Deller <deller@gmx.de>
6 * Copyright 1999 SuSE GmbH (Philipp Rumpf) 6 * Copyright 1999 SuSE GmbH (Philipp Rumpf)
7 * Copyright 1999 Philipp Rumpf (prumpf@tux.org) 7 * Copyright 1999 Philipp Rumpf (prumpf@tux.org)
8 * Copyright 2000 Hewlett Packard (Paul Bame, bame@puffin.external.hp.com) 8 * Copyright 2000 Hewlett Packard (Paul Bame, bame@puffin.external.hp.com)
@@ -19,16 +19,17 @@
19#include <asm/assembly.h> 19#include <asm/assembly.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21 21
22#include <linux/linkage.h>
23
22 .level LEVEL 24 .level LEVEL
23 25
24 .data 26 .data
25 27ENTRY(boot_args)
26 .export boot_args
27boot_args:
28 .word 0 /* arg0 */ 28 .word 0 /* arg0 */
29 .word 0 /* arg1 */ 29 .word 0 /* arg1 */
30 .word 0 /* arg2 */ 30 .word 0 /* arg2 */
31 .word 0 /* arg3 */ 31 .word 0 /* arg3 */
32END(boot_args)
32 33
33 .text 34 .text
34 .align 4 35 .align 4
@@ -38,10 +39,9 @@ boot_args:
38 .import fault_vector_11,code /* IVA parisc 1.1 32 bit */ 39 .import fault_vector_11,code /* IVA parisc 1.1 32 bit */
39 .import $global$ /* forward declaration */ 40 .import $global$ /* forward declaration */
40#endif /*!CONFIG_64BIT*/ 41#endif /*!CONFIG_64BIT*/
41 .export stext
42 .export _stext,data /* Kernel want it this way! */ 42 .export _stext,data /* Kernel want it this way! */
43_stext: 43_stext:
44stext: 44ENTRY(stext)
45 .proc 45 .proc
46 .callinfo 46 .callinfo
47 47
@@ -343,6 +343,9 @@ smp_slave_stext:
343 343
344 .procend 344 .procend
345#endif /* CONFIG_SMP */ 345#endif /* CONFIG_SMP */
346
347ENDPROC(stext)
348
346#ifndef CONFIG_64BIT 349#ifndef CONFIG_64BIT
347 .data 350 .data
348 351
diff --git a/arch/parisc/kernel/hpmc.S b/arch/parisc/kernel/hpmc.S
index c412c0adc4a9..d8baa158d8a0 100644
--- a/arch/parisc/kernel/hpmc.S
+++ b/arch/parisc/kernel/hpmc.S
@@ -46,6 +46,8 @@
46#include <asm/assembly.h> 46#include <asm/assembly.h>
47#include <asm/pdc.h> 47#include <asm/pdc.h>
48 48
49#include <linux/linkage.h>
50
49 /* 51 /*
50 * stack for os_hpmc, the HPMC handler. 52 * stack for os_hpmc, the HPMC handler.
51 * buffer for IODC procedures (for the HPMC handler). 53 * buffer for IODC procedures (for the HPMC handler).
@@ -69,17 +71,15 @@ hpmc_raddr:
69 71
70#define HPMC_PIM_DATA_SIZE 896 /* Enough to hold all architected 2.0 state */ 72#define HPMC_PIM_DATA_SIZE 896 /* Enough to hold all architected 2.0 state */
71 73
72 .export hpmc_pim_data, data
73 .align 8 74 .align 8
74hpmc_pim_data: 75ENTRY(hpmc_pim_data)
75 .block HPMC_PIM_DATA_SIZE 76 .block HPMC_PIM_DATA_SIZE
77END(hpmc_pim_data)
76 78
77 .text 79 .text
78 80
79 .export os_hpmc, code
80 .import intr_save, code 81 .import intr_save, code
81 82ENTRY(os_hpmc)
82os_hpmc:
83 83
84 /* 84 /*
85 * registers modified: 85 * registers modified:
@@ -294,11 +294,9 @@ os_hpmc_6:
294 294
295 b . 295 b .
296 nop 296 nop
297ENDPROC(os_hpmc)
297 298
298 /* this label used to compute os_hpmc checksum */ 299 /* this label used to compute os_hpmc checksum */
299 300ENTRY(os_hpmc_end)
300 .export os_hpmc_end, code
301
302os_hpmc_end:
303 301
304 nop 302 nop
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c
index 4e847ba53180..4845a6444633 100644
--- a/arch/parisc/kernel/inventory.c
+++ b/arch/parisc/kernel/inventory.c
@@ -47,7 +47,7 @@ void __init setup_pdc(void)
47 struct pdc_system_map_mod_info module_result; 47 struct pdc_system_map_mod_info module_result;
48 struct pdc_module_path module_path; 48 struct pdc_module_path module_path;
49 struct pdc_model model; 49 struct pdc_model model;
50#ifdef __LP64__ 50#ifdef CONFIG_64BIT
51 struct pdc_pat_cell_num cell_info; 51 struct pdc_pat_cell_num cell_info;
52#endif 52#endif
53 53
@@ -73,7 +73,7 @@ void __init setup_pdc(void)
73 * clearer message. 73 * clearer message.
74 */ 74 */
75 75
76#ifdef __LP64__ 76#ifdef CONFIG_64BIT
77 status = pdc_pat_cell_get_number(&cell_info); 77 status = pdc_pat_cell_get_number(&cell_info);
78 if (status == PDC_OK) { 78 if (status == PDC_OK) {
79 pdc_type = PDC_TYPE_PAT; 79 pdc_type = PDC_TYPE_PAT;
@@ -152,7 +152,7 @@ static void __init pagezero_memconfig(void)
152 npmem_ranges = 1; 152 npmem_ranges = 1;
153} 153}
154 154
155#ifdef __LP64__ 155#ifdef CONFIG_64BIT
156 156
157/* All of the PDC PAT specific code is 64-bit only */ 157/* All of the PDC PAT specific code is 64-bit only */
158 158
@@ -408,13 +408,13 @@ static void __init sprockets_memconfig(void)
408 } 408 }
409} 409}
410 410
411#else /* !__LP64__ */ 411#else /* !CONFIG_64BIT */
412 412
413#define pat_inventory() do { } while (0) 413#define pat_inventory() do { } while (0)
414#define pat_memconfig() do { } while (0) 414#define pat_memconfig() do { } while (0)
415#define sprockets_memconfig() pagezero_memconfig() 415#define sprockets_memconfig() pagezero_memconfig()
416 416
417#endif /* !__LP64__ */ 417#endif /* !CONFIG_64BIT */
418 418
419 419
420#ifndef CONFIG_PA20 420#ifndef CONFIG_PA20
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index b39c5b9aff46..e9d09b020e86 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -336,11 +336,7 @@ unsigned int txn_alloc_data(unsigned int virt_irq)
336 336
337static inline int eirr_to_irq(unsigned long eirr) 337static inline int eirr_to_irq(unsigned long eirr)
338{ 338{
339#ifdef CONFIG_64BIT 339 int bit = fls_long(eirr);
340 int bit = fls64(eirr);
341#else
342 int bit = fls(eirr);
343#endif
344 return (BITS_PER_LONG - bit) + TIMER_IRQ; 340 return (BITS_PER_LONG - bit) + TIMER_IRQ;
345} 341}
346 342
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index f50b982b0834..fdacdd4341c9 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -46,6 +46,7 @@
46#include <linux/fs.h> 46#include <linux/fs.h>
47#include <linux/string.h> 47#include <linux/string.h>
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/bug.h>
49 50
50#include <asm/unwind.h> 51#include <asm/unwind.h>
51 52
@@ -96,7 +97,7 @@ static inline int in_local_section(struct module *me, void *loc, void *dot)
96} 97}
97 98
98 99
99#ifndef __LP64__ 100#ifndef CONFIG_64BIT
100struct got_entry { 101struct got_entry {
101 Elf32_Addr addr; 102 Elf32_Addr addr;
102}; 103};
@@ -176,7 +177,7 @@ void *module_alloc(unsigned long size)
176 return vmalloc(size); 177 return vmalloc(size);
177} 178}
178 179
179#ifndef __LP64__ 180#ifndef CONFIG_64BIT
180static inline unsigned long count_gots(const Elf_Rela *rela, unsigned long n) 181static inline unsigned long count_gots(const Elf_Rela *rela, unsigned long n)
181{ 182{
182 return 0; 183 return 0;
@@ -319,7 +320,7 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
319 return 0; 320 return 0;
320} 321}
321 322
322#ifdef __LP64__ 323#ifdef CONFIG_64BIT
323static Elf64_Word get_got(struct module *me, unsigned long value, long addend) 324static Elf64_Word get_got(struct module *me, unsigned long value, long addend)
324{ 325{
325 unsigned int i; 326 unsigned int i;
@@ -342,9 +343,9 @@ static Elf64_Word get_got(struct module *me, unsigned long value, long addend)
342 value); 343 value);
343 return i * sizeof(struct got_entry); 344 return i * sizeof(struct got_entry);
344} 345}
345#endif /* __LP64__ */ 346#endif /* CONFIG_64BIT */
346 347
347#ifdef __LP64__ 348#ifdef CONFIG_64BIT
348static Elf_Addr get_fdesc(struct module *me, unsigned long value) 349static Elf_Addr get_fdesc(struct module *me, unsigned long value)
349{ 350{
350 Elf_Fdesc *fdesc = me->module_core + me->arch.fdesc_offset; 351 Elf_Fdesc *fdesc = me->module_core + me->arch.fdesc_offset;
@@ -368,7 +369,7 @@ static Elf_Addr get_fdesc(struct module *me, unsigned long value)
368 fdesc->gp = (Elf_Addr)me->module_core + me->arch.got_offset; 369 fdesc->gp = (Elf_Addr)me->module_core + me->arch.got_offset;
369 return (Elf_Addr)fdesc; 370 return (Elf_Addr)fdesc;
370} 371}
371#endif /* __LP64__ */ 372#endif /* CONFIG_64BIT */
372 373
373enum elf_stub_type { 374enum elf_stub_type {
374 ELF_STUB_GOT, 375 ELF_STUB_GOT,
@@ -394,7 +395,7 @@ static Elf_Addr get_stub(struct module *me, unsigned long value, long addend,
394 i * sizeof(struct stub_entry); 395 i * sizeof(struct stub_entry);
395 } 396 }
396 397
397#ifndef __LP64__ 398#ifndef CONFIG_64BIT
398/* for 32-bit the stub looks like this: 399/* for 32-bit the stub looks like this:
399 * ldil L'XXX,%r1 400 * ldil L'XXX,%r1
400 * be,n R'XXX(%sr4,%r1) 401 * be,n R'XXX(%sr4,%r1)
@@ -472,7 +473,7 @@ int apply_relocate(Elf_Shdr *sechdrs,
472 return -ENOEXEC; 473 return -ENOEXEC;
473} 474}
474 475
475#ifndef __LP64__ 476#ifndef CONFIG_64BIT
476int apply_relocate_add(Elf_Shdr *sechdrs, 477int apply_relocate_add(Elf_Shdr *sechdrs,
477 const char *strtab, 478 const char *strtab,
478 unsigned int symindex, 479 unsigned int symindex,
@@ -822,7 +823,8 @@ int module_finalize(const Elf_Ehdr *hdr,
822 me->name, strtab, symhdr); 823 me->name, strtab, symhdr);
823 824
824 if(me->arch.got_count > MAX_GOTS) { 825 if(me->arch.got_count > MAX_GOTS) {
825 printk(KERN_ERR "%s: Global Offset Table overflow (used %ld, allowed %d\n", me->name, me->arch.got_count, MAX_GOTS); 826 printk(KERN_ERR "%s: Global Offset Table overflow (used %ld, allowed %d)\n",
827 me->name, me->arch.got_count, MAX_GOTS);
826 return -EINVAL; 828 return -EINVAL;
827 } 829 }
828 830
@@ -850,10 +852,11 @@ int module_finalize(const Elf_Ehdr *hdr,
850 nsyms = newptr - (Elf_Sym *)symhdr->sh_addr; 852 nsyms = newptr - (Elf_Sym *)symhdr->sh_addr;
851 DEBUGP("NEW num_symtab %lu\n", nsyms); 853 DEBUGP("NEW num_symtab %lu\n", nsyms);
852 symhdr->sh_size = nsyms * sizeof(Elf_Sym); 854 symhdr->sh_size = nsyms * sizeof(Elf_Sym);
853 return 0; 855 return module_bug_finalize(hdr, sechdrs, me);
854} 856}
855 857
856void module_arch_cleanup(struct module *mod) 858void module_arch_cleanup(struct module *mod)
857{ 859{
858 deregister_unwind_table(mod); 860 deregister_unwind_table(mod);
861 module_bug_cleanup(mod);
859} 862}
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
index e81c9937d10a..90b240878520 100644
--- a/arch/parisc/kernel/pacache.S
+++ b/arch/parisc/kernel/pacache.S
@@ -27,31 +27,21 @@
27 */ 27 */
28 28
29#ifdef CONFIG_64BIT 29#ifdef CONFIG_64BIT
30#define ADDIB addib,*
31#define CMPB cmpb,*
32#define ANDCM andcm,*
33
34 .level 2.0w 30 .level 2.0w
35#else 31#else
36#define ADDIB addib,
37#define CMPB cmpb,
38#define ANDCM andcm
39
40 .level 2.0 32 .level 2.0
41#endif 33#endif
42 34
43
44#include <asm/psw.h> 35#include <asm/psw.h>
45#include <asm/assembly.h> 36#include <asm/assembly.h>
46#include <asm/pgtable.h> 37#include <asm/pgtable.h>
47#include <asm/cache.h> 38#include <asm/cache.h>
39#include <linux/linkage.h>
48 40
49 .text 41 .text
50 .align 128 42 .align 128
51 43
52 .export flush_tlb_all_local,code 44ENTRY(flush_tlb_all_local)
53
54flush_tlb_all_local:
55 .proc 45 .proc
56 .callinfo NO_CALLS 46 .callinfo NO_CALLS
57 .entry 47 .entry
@@ -200,11 +190,11 @@ fdtdone:
200 190
201 .exit 191 .exit
202 .procend 192 .procend
193ENDPROC(flush_tlb_all_local)
203 194
204 .export flush_instruction_cache_local,code
205 .import cache_info,data 195 .import cache_info,data
206 196
207flush_instruction_cache_local: 197ENTRY(flush_instruction_cache_local)
208 .proc 198 .proc
209 .callinfo NO_CALLS 199 .callinfo NO_CALLS
210 .entry 200 .entry
@@ -241,11 +231,11 @@ fisync:
241 .exit 231 .exit
242 232
243 .procend 233 .procend
234ENDPROC(flush_instruction_cache_local)
244 235
245 .export flush_data_cache_local, code
246 .import cache_info, data
247 236
248flush_data_cache_local: 237 .import cache_info, data
238ENTRY(flush_data_cache_local)
249 .proc 239 .proc
250 .callinfo NO_CALLS 240 .callinfo NO_CALLS
251 .entry 241 .entry
@@ -283,11 +273,11 @@ fdsync:
283 .exit 273 .exit
284 274
285 .procend 275 .procend
276ENDPROC(flush_data_cache_local)
286 277
287 .export copy_user_page_asm,code
288 .align 16 278 .align 16
289 279
290copy_user_page_asm: 280ENTRY(copy_user_page_asm)
291 .proc 281 .proc
292 .callinfo NO_CALLS 282 .callinfo NO_CALLS
293 .entry 283 .entry
@@ -409,6 +399,7 @@ copy_user_page_asm:
409 .exit 399 .exit
410 400
411 .procend 401 .procend
402ENDPROC(copy_user_page_asm)
412 403
413/* 404/*
414 * NOTE: Code in clear_user_page has a hard coded dependency on the 405 * NOTE: Code in clear_user_page has a hard coded dependency on the
@@ -446,9 +437,7 @@ copy_user_page_asm:
446 * lobby for such a change. 437 * lobby for such a change.
447 */ 438 */
448 439
449 .export copy_user_page_asm,code 440ENTRY(copy_user_page_asm)
450
451copy_user_page_asm:
452 .proc 441 .proc
453 .callinfo NO_CALLS 442 .callinfo NO_CALLS
454 .entry 443 .entry
@@ -534,11 +523,10 @@ copy_user_page_asm:
534 .exit 523 .exit
535 524
536 .procend 525 .procend
526ENDPROC(copy_user_page_asm)
537#endif 527#endif
538 528
539 .export __clear_user_page_asm,code 529ENTRY(__clear_user_page_asm)
540
541__clear_user_page_asm:
542 .proc 530 .proc
543 .callinfo NO_CALLS 531 .callinfo NO_CALLS
544 .entry 532 .entry
@@ -618,10 +606,9 @@ __clear_user_page_asm:
618 .exit 606 .exit
619 607
620 .procend 608 .procend
609ENDPROC(__clear_user_page_asm)
621 610
622 .export flush_kernel_dcache_page_asm 611ENTRY(flush_kernel_dcache_page_asm)
623
624flush_kernel_dcache_page_asm:
625 .proc 612 .proc
626 .callinfo NO_CALLS 613 .callinfo NO_CALLS
627 .entry 614 .entry
@@ -662,10 +649,9 @@ flush_kernel_dcache_page_asm:
662 .exit 649 .exit
663 650
664 .procend 651 .procend
652ENDPROC(flush_kernel_dcache_page_asm)
665 653
666 .export flush_user_dcache_page 654ENTRY(flush_user_dcache_page)
667
668flush_user_dcache_page:
669 .proc 655 .proc
670 .callinfo NO_CALLS 656 .callinfo NO_CALLS
671 .entry 657 .entry
@@ -706,10 +692,9 @@ flush_user_dcache_page:
706 .exit 692 .exit
707 693
708 .procend 694 .procend
695ENDPROC(flush_user_dcache_page)
709 696
710 .export flush_user_icache_page 697ENTRY(flush_user_icache_page)
711
712flush_user_icache_page:
713 .proc 698 .proc
714 .callinfo NO_CALLS 699 .callinfo NO_CALLS
715 .entry 700 .entry
@@ -750,11 +735,10 @@ flush_user_icache_page:
750 .exit 735 .exit
751 736
752 .procend 737 .procend
738ENDPROC(flush_user_icache_page)
753 739
754 740
755 .export purge_kernel_dcache_page 741ENTRY(purge_kernel_dcache_page)
756
757purge_kernel_dcache_page:
758 .proc 742 .proc
759 .callinfo NO_CALLS 743 .callinfo NO_CALLS
760 .entry 744 .entry
@@ -794,15 +778,14 @@ purge_kernel_dcache_page:
794 .exit 778 .exit
795 779
796 .procend 780 .procend
781ENDPROC(purge_kernel_dcache_page)
797 782
798#if 0 783#if 0
799 /* Currently not used, but it still is a possible alternate 784 /* Currently not used, but it still is a possible alternate
800 * solution. 785 * solution.
801 */ 786 */
802 787
803 .export flush_alias_page 788ENTRY(flush_alias_page)
804
805flush_alias_page:
806 .proc 789 .proc
807 .callinfo NO_CALLS 790 .callinfo NO_CALLS
808 .entry 791 .entry
@@ -882,10 +865,9 @@ flush_user_dcache_range_asm:
882 .exit 865 .exit
883 866
884 .procend 867 .procend
868ENDPROC(flush_alias_page)
885 869
886 .export flush_kernel_dcache_range_asm 870ENTRY(flush_kernel_dcache_range_asm)
887
888flush_kernel_dcache_range_asm:
889 .proc 871 .proc
890 .callinfo NO_CALLS 872 .callinfo NO_CALLS
891 .entry 873 .entry
@@ -905,10 +887,9 @@ flush_kernel_dcache_range_asm:
905 .exit 887 .exit
906 888
907 .procend 889 .procend
890ENDPROC(flush_kernel_dcache_range_asm)
908 891
909 .export flush_user_icache_range_asm 892ENTRY(flush_user_icache_range_asm)
910
911flush_user_icache_range_asm:
912 .proc 893 .proc
913 .callinfo NO_CALLS 894 .callinfo NO_CALLS
914 .entry 895 .entry
@@ -927,10 +908,9 @@ flush_user_icache_range_asm:
927 .exit 908 .exit
928 909
929 .procend 910 .procend
911ENDPROC(flush_user_icache_range_asm)
930 912
931 .export flush_kernel_icache_page 913ENTRY(flush_kernel_icache_page)
932
933flush_kernel_icache_page:
934 .proc 914 .proc
935 .callinfo NO_CALLS 915 .callinfo NO_CALLS
936 .entry 916 .entry
@@ -971,10 +951,9 @@ flush_kernel_icache_page:
971 .exit 951 .exit
972 952
973 .procend 953 .procend
954ENDPROC(flush_kernel_icache_page)
974 955
975 .export flush_kernel_icache_range_asm 956ENTRY(flush_kernel_icache_range_asm)
976
977flush_kernel_icache_range_asm:
978 .proc 957 .proc
979 .callinfo NO_CALLS 958 .callinfo NO_CALLS
980 .entry 959 .entry
@@ -992,14 +971,13 @@ flush_kernel_icache_range_asm:
992 nop 971 nop
993 .exit 972 .exit
994 .procend 973 .procend
974ENDPROC(flush_kernel_icache_range_asm)
995 975
996 /* align should cover use of rfi in disable_sr_hashing_asm and 976 /* align should cover use of rfi in disable_sr_hashing_asm and
997 * srdis_done. 977 * srdis_done.
998 */ 978 */
999 .align 256 979 .align 256
1000 .export disable_sr_hashing_asm,code 980ENTRY(disable_sr_hashing_asm)
1001
1002disable_sr_hashing_asm:
1003 .proc 981 .proc
1004 .callinfo NO_CALLS 982 .callinfo NO_CALLS
1005 .entry 983 .entry
@@ -1088,5 +1066,6 @@ srdis_done:
1088 .exit 1066 .exit
1089 1067
1090 .procend 1068 .procend
1069ENDPROC(disable_sr_hashing_asm)
1091 1070
1092 .end 1071 .end
diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
index 8f6a0b312f7a..7aca704e96f0 100644
--- a/arch/parisc/kernel/parisc_ksyms.c
+++ b/arch/parisc/kernel/parisc_ksyms.c
@@ -7,7 +7,7 @@
7 * Copyright (C) 2001-2003 Grant Grundler <grundler with parisc-linux.org> 7 * Copyright (C) 2001-2003 Grant Grundler <grundler with parisc-linux.org>
8 * Copyright (C) 2002-2003 Matthew Wilcox <willy at parisc-linux.org> 8 * Copyright (C) 2002-2003 Matthew Wilcox <willy at parisc-linux.org>
9 * Copyright (C) 2002 Randolph Chung <tausq at parisc-linux.org> 9 * Copyright (C) 2002 Randolph Chung <tausq at parisc-linux.org>
10 * Copyright (C) 2002-2003 Helge Deller <deller with parisc-linux.org> 10 * Copyright (C) 2002-2007 Helge Deller <deller with parisc-linux.org>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 13 * it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ EXPORT_SYMBOL(__cmpxchg_u32);
38#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
39EXPORT_SYMBOL(__atomic_hash); 39EXPORT_SYMBOL(__atomic_hash);
40#endif 40#endif
41#ifdef __LP64__ 41#ifdef CONFIG_64BIT
42EXPORT_SYMBOL(__xchg64); 42EXPORT_SYMBOL(__xchg64);
43EXPORT_SYMBOL(__cmpxchg_u64); 43EXPORT_SYMBOL(__cmpxchg_u64);
44#endif 44#endif
@@ -58,7 +58,7 @@ EXPORT_SYMBOL(fixup_get_user_skip_2);
58EXPORT_SYMBOL(fixup_put_user_skip_1); 58EXPORT_SYMBOL(fixup_put_user_skip_1);
59EXPORT_SYMBOL(fixup_put_user_skip_2); 59EXPORT_SYMBOL(fixup_put_user_skip_2);
60 60
61#ifndef __LP64__ 61#ifndef CONFIG_64BIT
62/* Needed so insmod can set dp value */ 62/* Needed so insmod can set dp value */
63extern int $global$; 63extern int $global$;
64EXPORT_SYMBOL($global$); 64EXPORT_SYMBOL($global$);
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(__muldi3);
135asmlinkage void * __canonicalize_funcptr_for_compare(void *); 135asmlinkage void * __canonicalize_funcptr_for_compare(void *);
136EXPORT_SYMBOL(__canonicalize_funcptr_for_compare); 136EXPORT_SYMBOL(__canonicalize_funcptr_for_compare);
137 137
138#ifdef __LP64__ 138#ifdef CONFIG_64BIT
139extern void __divdi3(void); 139extern void __divdi3(void);
140extern void __udivdi3(void); 140extern void __udivdi3(void);
141extern void __umoddi3(void); 141extern void __umoddi3(void);
@@ -147,7 +147,7 @@ EXPORT_SYMBOL(__umoddi3);
147EXPORT_SYMBOL(__moddi3); 147EXPORT_SYMBOL(__moddi3);
148#endif 148#endif
149 149
150#ifndef __LP64__ 150#ifndef CONFIG_64BIT
151extern void $$dyncall(void); 151extern void $$dyncall(void);
152EXPORT_SYMBOL($$dyncall); 152EXPORT_SYMBOL($$dyncall);
153#endif 153#endif
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index a6caf1073085..0c3aecb85a5c 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -342,7 +342,7 @@ pcxl_dma_init(void)
342 pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL, 342 pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL,
343 get_order(pcxl_res_size)); 343 get_order(pcxl_res_size));
344 memset(pcxl_res_map, 0, pcxl_res_size); 344 memset(pcxl_res_map, 0, pcxl_res_size);
345 proc_gsc_root = proc_mkdir("gsc", 0); 345 proc_gsc_root = proc_mkdir("gsc", NULL);
346 if (!proc_gsc_root) 346 if (!proc_gsc_root)
347 printk(KERN_WARNING 347 printk(KERN_WARNING
348 "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); 348 "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 199887a61c76..563df0072dee 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -200,8 +200,8 @@ static void
200pcibios_link_hba_resources( struct resource *hba_res, struct resource *r) 200pcibios_link_hba_resources( struct resource *hba_res, struct resource *r)
201{ 201{
202 if (!r->parent) { 202 if (!r->parent) {
203 printk(KERN_EMERG "PCI: resource not parented! [%lx-%lx]\n", 203 printk(KERN_EMERG "PCI: resource not parented! [%p-%p]\n",
204 r->start, r->end); 204 (void*) r->start, (void*) r->end);
205 r->parent = hba_res; 205 r->parent = hba_res;
206 206
207 /* reverse link is harder *sigh* */ 207 /* reverse link is harder *sigh* */
diff --git a/arch/parisc/kernel/perf_asm.S b/arch/parisc/kernel/perf_asm.S
index 5e7bb90e7e08..43874ca3ed67 100644
--- a/arch/parisc/kernel/perf_asm.S
+++ b/arch/parisc/kernel/perf_asm.S
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <asm/assembly.h> 22#include <asm/assembly.h>
23#include <linux/linkage.h>
23 24
24#ifdef CONFIG_64BIT 25#ifdef CONFIG_64BIT
25 .level 2.0w 26 .level 2.0w
@@ -41,10 +42,8 @@
41; starting/stopping the coprocessor with the pmenb/pmdis. 42; starting/stopping the coprocessor with the pmenb/pmdis.
42; 43;
43 .text 44 .text
44 .align 32
45 45
46 .export perf_intrigue_enable_perf_counters,code 46ENTRY(perf_intrigue_enable_perf_counters)
47perf_intrigue_enable_perf_counters:
48 .proc 47 .proc
49 .callinfo frame=0,NO_CALLS 48 .callinfo frame=0,NO_CALLS
50 .entry 49 .entry
@@ -69,9 +68,9 @@ perf_intrigue_enable_perf_counters:
69 nop 68 nop
70 .exit 69 .exit
71 .procend 70 .procend
71ENDPROC(perf_intrigue_enable_perf_counters)
72 72
73 .export perf_intrigue_disable_perf_counters,code 73ENTRY(perf_intrigue_disable_perf_counters)
74perf_intrigue_disable_perf_counters:
75 .proc 74 .proc
76 .callinfo frame=0,NO_CALLS 75 .callinfo frame=0,NO_CALLS
77 .entry 76 .entry
@@ -86,6 +85,7 @@ perf_intrigue_disable_perf_counters:
86 mtctl %r26,ccr ; turn off performance coprocessor 85 mtctl %r26,ccr ; turn off performance coprocessor
87 .exit 86 .exit
88 .procend 87 .procend
88ENDPROC(perf_intrigue_disable_perf_counters)
89 89
90;*********************************************************************** 90;***********************************************************************
91;* 91;*
@@ -117,8 +117,7 @@ perf_intrigue_disable_perf_counters:
117;* 117;*
118;*********************************************************************** 118;***********************************************************************
119 119
120 .export perf_rdr_shift_in_W,code 120ENTRY(perf_rdr_shift_in_W)
121perf_rdr_shift_in_W:
122 .proc 121 .proc
123 .callinfo frame=0,NO_CALLS 122 .callinfo frame=0,NO_CALLS
124 .entry 123 .entry
@@ -550,6 +549,7 @@ perf_rdr_shift_in_W_leave:
550 .exit 549 .exit
551 MTDIAG_2 (24) ; restore DR2 550 MTDIAG_2 (24) ; restore DR2
552 .procend 551 .procend
552ENDPROC(perf_rdr_shift_in_W)
553 553
554 554
555;*********************************************************************** 555;***********************************************************************
@@ -575,8 +575,7 @@ perf_rdr_shift_in_W_leave:
575;* 575;*
576;*********************************************************************** 576;***********************************************************************
577 577
578 .export perf_rdr_shift_out_W,code 578ENTRY(perf_rdr_shift_out_W)
579perf_rdr_shift_out_W:
580 .proc 579 .proc
581 .callinfo frame=0,NO_CALLS 580 .callinfo frame=0,NO_CALLS
582 .entry 581 .entry
@@ -983,6 +982,7 @@ perf_rdr_shift_out_W_leave:
983 .exit 982 .exit
984 MTDIAG_2 (23) ; restore DR2 983 MTDIAG_2 (23) ; restore DR2
985 .procend 984 .procend
985ENDPROC(perf_rdr_shift_out_W)
986 986
987 987
988;*********************************************************************** 988;***********************************************************************
@@ -1012,8 +1012,7 @@ perf_rdr_shift_out_W_leave:
1012;* 1012;*
1013;*********************************************************************** 1013;***********************************************************************
1014 1014
1015 .export perf_rdr_shift_in_U,code 1015ENTRY(perf_rdr_shift_in_U)
1016perf_rdr_shift_in_U:
1017 .proc 1016 .proc
1018 .callinfo frame=0,NO_CALLS 1017 .callinfo frame=0,NO_CALLS
1019 .entry 1018 .entry
@@ -1343,6 +1342,7 @@ perf_rdr_shift_in_U_leave:
1343 .exit 1342 .exit
1344 MTDIAG_2 (24) ; restore DR2 1343 MTDIAG_2 (24) ; restore DR2
1345 .procend 1344 .procend
1345ENDPROC(perf_rdr_shift_in_U)
1346 1346
1347;*********************************************************************** 1347;***********************************************************************
1348;* 1348;*
@@ -1369,8 +1369,7 @@ perf_rdr_shift_in_U_leave:
1369;* 1369;*
1370;*********************************************************************** 1370;***********************************************************************
1371 1371
1372 .export perf_rdr_shift_out_U,code 1372ENTRY(perf_rdr_shift_out_U)
1373perf_rdr_shift_out_U:
1374 .proc 1373 .proc
1375 .callinfo frame=0,NO_CALLS 1374 .callinfo frame=0,NO_CALLS
1376 .entry 1375 .entry
@@ -1687,4 +1686,5 @@ perf_rdr_shift_out_U_leave:
1687 .exit 1686 .exit
1688 MTDIAG_2 (23) ; restore DR2 1687 MTDIAG_2 (23) ; restore DR2
1689 .procend 1688 .procend
1689ENDPROC(perf_rdr_shift_out_U)
1690 1690
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 2f9f9dfa66f7..0dd3847f494c 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -13,7 +13,7 @@
13 * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org> 13 * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org>
14 * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org> 14 * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org>
15 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org> 15 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
16 * Copyright (C) 2001-2002 Helge Deller <deller at parisc-linux.org> 16 * Copyright (C) 2001-2007 Helge Deller <deller at parisc-linux.org>
17 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> 17 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
18 * 18 *
19 * 19 *
@@ -303,7 +303,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
303 * Copy function and argument to be called from 303 * Copy function and argument to be called from
304 * ret_from_kernel_thread. 304 * ret_from_kernel_thread.
305 */ 305 */
306#ifdef __LP64__ 306#ifdef CONFIG_64BIT
307 cregs->gr[27] = pregs->gr[27]; 307 cregs->gr[27] = pregs->gr[27];
308#endif 308#endif
309 cregs->gr[26] = pregs->gr[26]; 309 cregs->gr[26] = pregs->gr[26];
@@ -355,8 +355,8 @@ asmlinkage int sys_execve(struct pt_regs *regs)
355 error = PTR_ERR(filename); 355 error = PTR_ERR(filename);
356 if (IS_ERR(filename)) 356 if (IS_ERR(filename))
357 goto out; 357 goto out;
358 error = do_execve(filename, (char __user **) regs->gr[25], 358 error = do_execve(filename, (char __user * __user *) regs->gr[25],
359 (char __user **) regs->gr[24], regs); 359 (char __user * __user *) regs->gr[24], regs);
360 if (error == 0) { 360 if (error == 0) {
361 task_lock(current); 361 task_lock(current);
362 current->ptrace &= ~PT_DTRACE; 362 current->ptrace &= ~PT_DTRACE;
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
index fb81e5687e7c..7c056dcebf55 100644
--- a/arch/parisc/kernel/processor.c
+++ b/arch/parisc/kernel/processor.c
@@ -93,7 +93,7 @@ static int __init processor_probe(struct parisc_device *dev)
93 cpuid = boot_cpu_data.cpu_count; 93 cpuid = boot_cpu_data.cpu_count;
94 txn_addr = dev->hpa.start; /* for legacy PDC */ 94 txn_addr = dev->hpa.start; /* for legacy PDC */
95 95
96#ifdef __LP64__ 96#ifdef CONFIG_64BIT
97 if (is_pdc_pat()) { 97 if (is_pdc_pat()) {
98 ulong status; 98 ulong status;
99 unsigned long bytecnt; 99 unsigned long bytecnt;
@@ -153,8 +153,6 @@ static int __init processor_probe(struct parisc_device *dev)
153 p->cpuid = cpuid; /* save CPU id */ 153 p->cpuid = cpuid; /* save CPU id */
154 p->txn_addr = txn_addr; /* save CPU IRQ address */ 154 p->txn_addr = txn_addr; /* save CPU IRQ address */
155#ifdef CONFIG_SMP 155#ifdef CONFIG_SMP
156 spin_lock_init(&p->lock);
157
158 /* 156 /*
159 ** FIXME: review if any other initialization is clobbered 157 ** FIXME: review if any other initialization is clobbered
160 ** for boot_cpu by the above memset(). 158 ** for boot_cpu by the above memset().
@@ -311,11 +309,11 @@ int __init init_per_cpu(int cpunum)
311 } else { 309 } else {
312 printk(KERN_WARNING "WARNING: No FP CoProcessor?!" 310 printk(KERN_WARNING "WARNING: No FP CoProcessor?!"
313 " (coproc_cfg.ccr_functional == 0x%lx, expected 0xc0)\n" 311 " (coproc_cfg.ccr_functional == 0x%lx, expected 0xc0)\n"
314#ifdef __LP64__ 312#ifdef CONFIG_64BIT
315 "Halting Machine - FP required\n" 313 "Halting Machine - FP required\n"
316#endif 314#endif
317 , coproc_cfg.ccr_functional); 315 , coproc_cfg.ccr_functional);
318#ifdef __LP64__ 316#ifdef CONFIG_64BIT
319 mdelay(100); /* previous chars get pushed to console */ 317 mdelay(100); /* previous chars get pushed to console */
320 panic("FP CoProc not reported"); 318 panic("FP CoProc not reported");
321#endif 319#endif
@@ -339,9 +337,6 @@ show_cpuinfo (struct seq_file *m, void *v)
339#ifdef CONFIG_SMP 337#ifdef CONFIG_SMP
340 if (0 == cpu_data[n].hpa) 338 if (0 == cpu_data[n].hpa)
341 continue; 339 continue;
342#ifdef ENTRY_SYS_CPUS
343#error iCOD support wants to show CPU state here
344#endif
345#endif 340#endif
346 seq_printf(m, "processor\t: %d\n" 341 seq_printf(m, "processor\t: %d\n"
347 "cpu family\t: PA-RISC %s\n", 342 "cpu family\t: PA-RISC %s\n",
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 3f28de974556..0d0d617b6f21 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -36,7 +36,7 @@
36#define DBG(x...) 36#define DBG(x...)
37#endif 37#endif
38 38
39#ifdef __LP64__ 39#ifdef CONFIG_64BIT
40 40
41/* This function is needed to translate 32 bit pt_regs offsets in to 41/* This function is needed to translate 32 bit pt_regs offsets in to
42 * 64 bit pt_regs offsets. For example, a 32 bit gdb under a 64 bit kernel 42 * 64 bit pt_regs offsets. For example, a 32 bit gdb under a 64 bit kernel
@@ -90,7 +90,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
90 case PTRACE_PEEKDATA: { 90 case PTRACE_PEEKDATA: {
91 int copied; 91 int copied;
92 92
93#ifdef __LP64__ 93#ifdef CONFIG_64BIT
94 if (__is_compat_task(child)) { 94 if (__is_compat_task(child)) {
95 unsigned int tmp; 95 unsigned int tmp;
96 96
@@ -122,7 +122,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
122 case PTRACE_POKETEXT: /* write the word at location addr. */ 122 case PTRACE_POKETEXT: /* write the word at location addr. */
123 case PTRACE_POKEDATA: 123 case PTRACE_POKEDATA:
124 ret = 0; 124 ret = 0;
125#ifdef __LP64__ 125#ifdef CONFIG_64BIT
126 if (__is_compat_task(child)) { 126 if (__is_compat_task(child)) {
127 unsigned int tmp = (unsigned int)data; 127 unsigned int tmp = (unsigned int)data;
128 DBG("sys_ptrace(POKE%s, %d, %lx, %lx)\n", 128 DBG("sys_ptrace(POKE%s, %d, %lx, %lx)\n",
@@ -145,7 +145,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
145 processes, the kernel saves all regs on a syscall. */ 145 processes, the kernel saves all regs on a syscall. */
146 case PTRACE_PEEKUSR: { 146 case PTRACE_PEEKUSR: {
147 ret = -EIO; 147 ret = -EIO;
148#ifdef __LP64__ 148#ifdef CONFIG_64BIT
149 if (__is_compat_task(child)) { 149 if (__is_compat_task(child)) {
150 unsigned int tmp; 150 unsigned int tmp;
151 151
@@ -204,7 +204,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
204 ret = 0; 204 ret = 0;
205 goto out_tsk; 205 goto out_tsk;
206 } 206 }
207#ifdef __LP64__ 207#ifdef CONFIG_64BIT
208 if (__is_compat_task(child)) { 208 if (__is_compat_task(child)) {
209 if (addr & (sizeof(int)-1)) 209 if (addr & (sizeof(int)-1))
210 goto out_tsk; 210 goto out_tsk;
diff --git a/arch/parisc/kernel/real2.S b/arch/parisc/kernel/real2.S
index 789061f6ceb4..7a92695d95a6 100644
--- a/arch/parisc/kernel/real2.S
+++ b/arch/parisc/kernel/real2.S
@@ -11,6 +11,8 @@
11#include <asm/psw.h> 11#include <asm/psw.h>
12#include <asm/assembly.h> 12#include <asm/assembly.h>
13 13
14#include <linux/linkage.h>
15
14 .section .bss 16 .section .bss
15 .export real_stack 17 .export real_stack
16 .export real32_stack 18 .export real32_stack
@@ -39,8 +41,6 @@ save_cr_end:
39 41
40 .text 42 .text
41 43
42 .export real32_call_asm
43
44 /* unsigned long real32_call_asm(unsigned int *sp, 44 /* unsigned long real32_call_asm(unsigned int *sp,
45 * unsigned int *arg0p, 45 * unsigned int *arg0p,
46 * unsigned int iodc_fn) 46 * unsigned int iodc_fn)
@@ -49,7 +49,7 @@ save_cr_end:
49 * iodc_fn is the IODC function to call 49 * iodc_fn is the IODC function to call
50 */ 50 */
51 51
52real32_call_asm: 52ENTRY(real32_call_asm)
53 STREG %rp, -RP_OFFSET(%sp) /* save RP */ 53 STREG %rp, -RP_OFFSET(%sp) /* save RP */
54#ifdef CONFIG_64BIT 54#ifdef CONFIG_64BIT
55 callee_save 55 callee_save
@@ -107,6 +107,7 @@ ric_ret:
107 LDREG -RP_OFFSET(%sp), %rp /* restore RP */ 107 LDREG -RP_OFFSET(%sp), %rp /* restore RP */
108 bv 0(%rp) 108 bv 0(%rp)
109 nop 109 nop
110ENDPROC(real32_call_asm)
110 111
111 112
112# define PUSH_CR(r, where) mfctl r, %r1 ! STREG,ma %r1, REG_SZ(where) 113# define PUSH_CR(r, where) mfctl r, %r1 ! STREG,ma %r1, REG_SZ(where)
@@ -218,7 +219,6 @@ rfi_r2v_1:
218/************************ 64-bit real-mode calls ***********************/ 219/************************ 64-bit real-mode calls ***********************/
219/* This is only usable in wide kernels right now and will probably stay so */ 220/* This is only usable in wide kernels right now and will probably stay so */
220 .text 221 .text
221 .export real64_call_asm
222 /* unsigned long real64_call_asm(unsigned long *sp, 222 /* unsigned long real64_call_asm(unsigned long *sp,
223 * unsigned long *arg0p, 223 * unsigned long *arg0p,
224 * unsigned long fn) 224 * unsigned long fn)
@@ -226,7 +226,7 @@ rfi_r2v_1:
226 * arg0p points to where saved arg values may be found 226 * arg0p points to where saved arg values may be found
227 * iodc_fn is the IODC function to call 227 * iodc_fn is the IODC function to call
228 */ 228 */
229real64_call_asm: 229ENTRY(real64_call_asm)
230 std %rp, -0x10(%sp) /* save RP */ 230 std %rp, -0x10(%sp) /* save RP */
231 std %sp, -8(%arg0) /* save SP on real-mode stack */ 231 std %sp, -8(%arg0) /* save SP on real-mode stack */
232 copy %arg0, %sp /* adopt the real-mode SP */ 232 copy %arg0, %sp /* adopt the real-mode SP */
@@ -272,19 +272,21 @@ r64_ret:
272 ldd -0x10(%sp), %rp /* restore RP */ 272 ldd -0x10(%sp), %rp /* restore RP */
273 bv 0(%rp) 273 bv 0(%rp)
274 nop 274 nop
275ENDPROC(real64_call_asm)
275 276
276#endif 277#endif
277 278
278 .export __canonicalize_funcptr_for_compare
279 .text 279 .text
280 /* http://lists.parisc-linux.org/hypermail/parisc-linux/10916.html 280 /* http://lists.parisc-linux.org/hypermail/parisc-linux/10916.html
281 ** GCC 3.3 and later has a new function in libgcc.a for 281 ** GCC 3.3 and later has a new function in libgcc.a for
282 ** comparing function pointers. 282 ** comparing function pointers.
283 */ 283 */
284__canonicalize_funcptr_for_compare: 284ENTRY(__canonicalize_funcptr_for_compare)
285#ifdef CONFIG_64BIT 285#ifdef CONFIG_64BIT
286 bve (%r2) 286 bve (%r2)
287#else 287#else
288 bv %r0(%r2) 288 bv %r0(%r2)
289#endif 289#endif
290 copy %r26,%r28 290 copy %r26,%r28
291ENDPROC(__canonicalize_funcptr_for_compare)
292
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 74b3686dd1e0..bd2116e03f34 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -120,13 +120,13 @@ extern void collect_boot_cpu_data(void);
120 120
121void __init setup_arch(char **cmdline_p) 121void __init setup_arch(char **cmdline_p)
122{ 122{
123#ifdef __LP64__ 123#ifdef CONFIG_64BIT
124 extern int parisc_narrow_firmware; 124 extern int parisc_narrow_firmware;
125#endif 125#endif
126 126
127 init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */ 127 init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */
128 128
129#ifdef __LP64__ 129#ifdef CONFIG_64BIT
130 printk(KERN_INFO "The 64-bit Kernel has started...\n"); 130 printk(KERN_INFO "The 64-bit Kernel has started...\n");
131#else 131#else
132 printk(KERN_INFO "The 32-bit Kernel has started...\n"); 132 printk(KERN_INFO "The 32-bit Kernel has started...\n");
@@ -134,7 +134,7 @@ void __init setup_arch(char **cmdline_p)
134 134
135 pdc_console_init(); 135 pdc_console_init();
136 136
137#ifdef __LP64__ 137#ifdef CONFIG_64BIT
138 if(parisc_narrow_firmware) { 138 if(parisc_narrow_firmware) {
139 printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n"); 139 printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
140 } 140 }
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index ee6653edeb7a..9784e405f849 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -59,58 +59,13 @@
59 * this. */ 59 * this. */
60#define A(__x) ((unsigned long)(__x)) 60#define A(__x) ((unsigned long)(__x))
61 61
62int do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall);
63
64/* 62/*
65 * Atomically swap in the new signal mask, and wait for a signal. 63 * Atomically swap in the new signal mask, and wait for a signal.
66 */ 64 */
67#ifdef __LP64__ 65#ifdef CONFIG_64BIT
68#include "sys32.h" 66#include "sys32.h"
69#endif 67#endif
70 68
71asmlinkage int
72sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs *regs)
73{
74 sigset_t saveset, newset;
75#ifdef __LP64__
76 compat_sigset_t newset32;
77
78 if (is_compat_task()) {
79 /* XXX: Don't preclude handling different sized sigset_t's. */
80 if (sigsetsize != sizeof(compat_sigset_t))
81 return -EINVAL;
82 if (copy_from_user(&newset32, (compat_sigset_t __user *)unewset, sizeof(newset32)))
83 return -EFAULT;
84 sigset_32to64(&newset,&newset32);
85
86 } else
87#endif
88 {
89 /* XXX: Don't preclude handling different sized sigset_t's. */
90 if (sigsetsize != sizeof(sigset_t))
91 return -EINVAL;
92
93 if (copy_from_user(&newset, unewset, sizeof(newset)))
94 return -EFAULT;
95 }
96
97 sigdelsetmask(&newset, ~_BLOCKABLE);
98
99 spin_lock_irq(&current->sighand->siglock);
100 saveset = current->blocked;
101 current->blocked = newset;
102 recalc_sigpending();
103 spin_unlock_irq(&current->sighand->siglock);
104
105 regs->gr[28] = -EINTR;
106 while (1) {
107 current->state = TASK_INTERRUPTIBLE;
108 schedule();
109 if (do_signal(&saveset, regs, 1))
110 return -EINTR;
111 }
112}
113
114/* 69/*
115 * Do a signal return - restore sigcontext. 70 * Do a signal return - restore sigcontext.
116 */ 71 */
@@ -148,7 +103,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
148 sigset_t set; 103 sigset_t set;
149 unsigned long usp = (regs->gr[30] & ~(0x01UL)); 104 unsigned long usp = (regs->gr[30] & ~(0x01UL));
150 unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE; 105 unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE;
151#ifdef __LP64__ 106#ifdef CONFIG_64BIT
152 compat_sigset_t compat_set; 107 compat_sigset_t compat_set;
153 struct compat_rt_sigframe __user * compat_frame; 108 struct compat_rt_sigframe __user * compat_frame;
154 109
@@ -162,7 +117,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
162 (usp - sigframe_size); 117 (usp - sigframe_size);
163 DBG(2,"sys_rt_sigreturn: frame is %p\n", frame); 118 DBG(2,"sys_rt_sigreturn: frame is %p\n", frame);
164 119
165#ifdef __LP64__ 120#ifdef CONFIG_64BIT
166 compat_frame = (struct compat_rt_sigframe __user *)frame; 121 compat_frame = (struct compat_rt_sigframe __user *)frame;
167 122
168 if (is_compat_task()) { 123 if (is_compat_task()) {
@@ -184,7 +139,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
184 spin_unlock_irq(&current->sighand->siglock); 139 spin_unlock_irq(&current->sighand->siglock);
185 140
186 /* Good thing we saved the old gr[30], eh? */ 141 /* Good thing we saved the old gr[30], eh? */
187#ifdef __LP64__ 142#ifdef CONFIG_64BIT
188 if (is_compat_task()) { 143 if (is_compat_task()) {
189 DBG(1,"sys_rt_sigreturn: compat_frame->uc.uc_mcontext 0x%p\n", 144 DBG(1,"sys_rt_sigreturn: compat_frame->uc.uc_mcontext 0x%p\n",
190 &compat_frame->uc.uc_mcontext); 145 &compat_frame->uc.uc_mcontext);
@@ -296,7 +251,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
296 unsigned long rp, usp; 251 unsigned long rp, usp;
297 unsigned long haddr, sigframe_size; 252 unsigned long haddr, sigframe_size;
298 int err = 0; 253 int err = 0;
299#ifdef __LP64__ 254#ifdef CONFIG_64BIT
300 compat_int_t compat_val; 255 compat_int_t compat_val;
301 struct compat_rt_sigframe __user * compat_frame; 256 struct compat_rt_sigframe __user * compat_frame;
302 compat_sigset_t compat_set; 257 compat_sigset_t compat_set;
@@ -310,7 +265,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
310 DBG(1,"setup_rt_frame: frame %p info %p\n", frame, info); 265 DBG(1,"setup_rt_frame: frame %p info %p\n", frame, info);
311 266
312 267
313#ifdef __LP64__ 268#ifdef CONFIG_64BIT
314 269
315 compat_frame = (struct compat_rt_sigframe __user *)frame; 270 compat_frame = (struct compat_rt_sigframe __user *)frame;
316 271
@@ -390,7 +345,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
390 345
391 haddr = A(ka->sa.sa_handler); 346 haddr = A(ka->sa.sa_handler);
392 /* The sa_handler may be a pointer to a function descriptor */ 347 /* The sa_handler may be a pointer to a function descriptor */
393#ifdef __LP64__ 348#ifdef CONFIG_64BIT
394 if (is_compat_task()) { 349 if (is_compat_task()) {
395#endif 350#endif
396 if (haddr & PA_PLABEL_FDESC) { 351 if (haddr & PA_PLABEL_FDESC) {
@@ -405,7 +360,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
405 haddr = fdesc.addr; 360 haddr = fdesc.addr;
406 regs->gr[19] = fdesc.gp; 361 regs->gr[19] = fdesc.gp;
407 } 362 }
408#ifdef __LP64__ 363#ifdef CONFIG_64BIT
409 } else { 364 } else {
410 Elf64_Fdesc fdesc; 365 Elf64_Fdesc fdesc;
411 Elf64_Fdesc __user *ufdesc = (Elf64_Fdesc __user *)A(haddr & ~3); 366 Elf64_Fdesc __user *ufdesc = (Elf64_Fdesc __user *)A(haddr & ~3);
@@ -425,19 +380,19 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
425 /* The syscall return path will create IAOQ values from r31. 380 /* The syscall return path will create IAOQ values from r31.
426 */ 381 */
427 sigframe_size = PARISC_RT_SIGFRAME_SIZE; 382 sigframe_size = PARISC_RT_SIGFRAME_SIZE;
428#ifdef __LP64__ 383#ifdef CONFIG_64BIT
429 if (is_compat_task()) 384 if (is_compat_task())
430 sigframe_size = PARISC_RT_SIGFRAME_SIZE32; 385 sigframe_size = PARISC_RT_SIGFRAME_SIZE32;
431#endif 386#endif
432 if (in_syscall) { 387 if (in_syscall) {
433 regs->gr[31] = haddr; 388 regs->gr[31] = haddr;
434#ifdef __LP64__ 389#ifdef CONFIG_64BIT
435 if (!test_thread_flag(TIF_32BIT)) 390 if (!test_thread_flag(TIF_32BIT))
436 sigframe_size |= 1; 391 sigframe_size |= 1;
437#endif 392#endif
438 } else { 393 } else {
439 unsigned long psw = USER_PSW; 394 unsigned long psw = USER_PSW;
440#ifdef __LP64__ 395#ifdef CONFIG_64BIT
441 if (!test_thread_flag(TIF_32BIT)) 396 if (!test_thread_flag(TIF_32BIT))
442 psw |= PSW_W; 397 psw |= PSW_W;
443#endif 398#endif
@@ -462,7 +417,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
462 regs->gr[2] = rp; /* userland return pointer */ 417 regs->gr[2] = rp; /* userland return pointer */
463 regs->gr[26] = sig; /* signal number */ 418 regs->gr[26] = sig; /* signal number */
464 419
465#ifdef __LP64__ 420#ifdef CONFIG_64BIT
466 if (is_compat_task()) { 421 if (is_compat_task()) {
467 regs->gr[25] = A(&compat_frame->info); /* siginfo pointer */ 422 regs->gr[25] = A(&compat_frame->info); /* siginfo pointer */
468 regs->gr[24] = A(&compat_frame->uc); /* ucontext pointer */ 423 regs->gr[24] = A(&compat_frame->uc); /* ucontext pointer */
@@ -516,6 +471,97 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
516 return 1; 471 return 1;
517} 472}
518 473
474static inline void
475syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
476{
477 /* Check the return code */
478 switch (regs->gr[28]) {
479 case -ERESTART_RESTARTBLOCK:
480 current_thread_info()->restart_block.fn =
481 do_no_restart_syscall;
482 case -ERESTARTNOHAND:
483 DBG(1,"ERESTARTNOHAND: returning -EINTR\n");
484 regs->gr[28] = -EINTR;
485 break;
486
487 case -ERESTARTSYS:
488 if (!(ka->sa.sa_flags & SA_RESTART)) {
489 DBG(1,"ERESTARTSYS: putting -EINTR\n");
490 regs->gr[28] = -EINTR;
491 break;
492 }
493 /* fallthrough */
494 case -ERESTARTNOINTR:
495 /* A syscall is just a branch, so all
496 * we have to do is fiddle the return pointer.
497 */
498 regs->gr[31] -= 8; /* delayed branching */
499 /* Preserve original r28. */
500 regs->gr[28] = regs->orig_r28;
501 break;
502 }
503}
504
505static inline void
506insert_restart_trampoline(struct pt_regs *regs)
507{
508 switch(regs->gr[28]) {
509 case -ERESTART_RESTARTBLOCK: {
510 /* Restart the system call - no handlers present */
511 unsigned int *usp = (unsigned int *)regs->gr[30];
512
513 /* Setup a trampoline to restart the syscall
514 * with __NR_restart_syscall
515 *
516 * 0: <return address (orig r31)>
517 * 4: <2nd half for 64-bit>
518 * 8: ldw 0(%sp), %r31
519 * 12: be 0x100(%sr2, %r0)
520 * 16: ldi __NR_restart_syscall, %r20
521 */
522#ifdef CONFIG_64BIT
523 put_user(regs->gr[31] >> 32, &usp[0]);
524 put_user(regs->gr[31] & 0xffffffff, &usp[1]);
525 put_user(0x0fc010df, &usp[2]);
526#else
527 put_user(regs->gr[31], &usp[0]);
528 put_user(0x0fc0109f, &usp[2]);
529#endif
530 put_user(0xe0008200, &usp[3]);
531 put_user(0x34140000, &usp[4]);
532
533 /* Stack is 64-byte aligned, and we only need
534 * to flush 1 cache line.
535 * Flushing one cacheline is cheap.
536 * "sync" on bigger (> 4 way) boxes is not.
537 */
538 flush_icache_range(regs->gr[30], regs->gr[30] + 4);
539
540 regs->gr[31] = regs->gr[30] + 8;
541 /* Preserve original r28. */
542 regs->gr[28] = regs->orig_r28;
543
544 return;
545 }
546 case -ERESTARTNOHAND:
547 case -ERESTARTSYS:
548 case -ERESTARTNOINTR: {
549 /* Hooray for delayed branching. We don't
550 * have to restore %r20 (the system call
551 * number) because it gets loaded in the delay
552 * slot of the branch external instruction.
553 */
554 regs->gr[31] -= 8;
555 /* Preserve original r28. */
556 regs->gr[28] = regs->orig_r28;
557
558 return;
559 }
560 default:
561 break;
562 }
563}
564
519/* 565/*
520 * Note that 'init' is a special process: it doesn't get signals it doesn't 566 * Note that 'init' is a special process: it doesn't get signals it doesn't
521 * want to handle. Thus you cannot kill init even with a SIGKILL even by 567 * want to handle. Thus you cannot kill init even with a SIGKILL even by
@@ -527,13 +573,13 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
527 * registers). As noted below, the syscall number gets restored for 573 * registers). As noted below, the syscall number gets restored for
528 * us due to the magic of delayed branching. 574 * us due to the magic of delayed branching.
529 */ 575 */
530 576asmlinkage void
531asmlinkage int 577do_signal(struct pt_regs *regs, long in_syscall)
532do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall)
533{ 578{
534 siginfo_t info; 579 siginfo_t info;
535 struct k_sigaction ka; 580 struct k_sigaction ka;
536 int signr; 581 int signr;
582 sigset_t *oldset;
537 583
538 DBG(1,"\ndo_signal: oldset=0x%p, regs=0x%p, sr7 %#lx, in_syscall=%d\n", 584 DBG(1,"\ndo_signal: oldset=0x%p, regs=0x%p, sr7 %#lx, in_syscall=%d\n",
539 oldset, regs, regs->sr[7], in_syscall); 585 oldset, regs, regs->sr[7], in_syscall);
@@ -543,7 +589,9 @@ do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall)
543 we would be called in that case, but for some reason we 589 we would be called in that case, but for some reason we
544 are. */ 590 are. */
545 591
546 if (!oldset) 592 if (test_thread_flag(TIF_RESTORE_SIGMASK))
593 oldset = &current->saved_sigmask;
594 else
547 oldset = &current->blocked; 595 oldset = &current->blocked;
548 596
549 DBG(1,"do_signal: oldset %08lx / %08lx\n", 597 DBG(1,"do_signal: oldset %08lx / %08lx\n",
@@ -560,98 +608,41 @@ do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall)
560 break; 608 break;
561 609
562 /* Restart a system call if necessary. */ 610 /* Restart a system call if necessary. */
563 if (in_syscall) { 611 if (in_syscall)
564 /* Check the return code */ 612 syscall_restart(regs, &ka);
565 switch (regs->gr[28]) { 613
566 case -ERESTART_RESTARTBLOCK:
567 current_thread_info()->restart_block.fn = do_no_restart_syscall;
568 case -ERESTARTNOHAND:
569 DBG(1,"ERESTARTNOHAND: returning -EINTR\n");
570 regs->gr[28] = -EINTR;
571 break;
572
573 case -ERESTARTSYS:
574 if (!(ka.sa.sa_flags & SA_RESTART)) {
575 DBG(1,"ERESTARTSYS: putting -EINTR\n");
576 regs->gr[28] = -EINTR;
577 break;
578 }
579 /* fallthrough */
580 case -ERESTARTNOINTR:
581 /* A syscall is just a branch, so all
582 we have to do is fiddle the return pointer. */
583 regs->gr[31] -= 8; /* delayed branching */
584 /* Preserve original r28. */
585 regs->gr[28] = regs->orig_r28;
586 break;
587 }
588 }
589 /* Whee! Actually deliver the signal. If the 614 /* Whee! Actually deliver the signal. If the
590 delivery failed, we need to continue to iterate in 615 delivery failed, we need to continue to iterate in
591 this loop so we can deliver the SIGSEGV... */ 616 this loop so we can deliver the SIGSEGV... */
592 if (handle_signal(signr, &info, &ka, oldset, regs, in_syscall)) { 617 if (handle_signal(signr, &info, &ka, oldset,
618 regs, in_syscall)) {
593 DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", 619 DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n",
594 regs->gr[28]); 620 regs->gr[28]);
595 return 1; 621 if (test_thread_flag(TIF_RESTORE_SIGMASK))
622 clear_thread_flag(TIF_RESTORE_SIGMASK);
623 return;
596 } 624 }
597 } 625 }
598 /* end of while(1) looping forever if we can't force a signal */ 626 /* end of while(1) looping forever if we can't force a signal */
599 627
600 /* Did we come from a system call? */ 628 /* Did we come from a system call? */
601 if (in_syscall) { 629 if (in_syscall)
602 /* Restart the system call - no handlers present */ 630 insert_restart_trampoline(regs);
603 if (regs->gr[28] == -ERESTART_RESTARTBLOCK) {
604 unsigned int *usp = (unsigned int *)regs->gr[30];
605
606 /* Setup a trampoline to restart the syscall
607 * with __NR_restart_syscall
608 *
609 * 0: <return address (orig r31)>
610 * 4: <2nd half for 64-bit>
611 * 8: ldw 0(%sp), %r31
612 * 12: be 0x100(%sr2, %r0)
613 * 16: ldi __NR_restart_syscall, %r20
614 */
615#ifndef __LP64__
616 put_user(regs->gr[31], &usp[0]);
617 put_user(0x0fc0109f, &usp[2]);
618#else
619 put_user(regs->gr[31] >> 32, &usp[0]);
620 put_user(regs->gr[31] & 0xffffffff, &usp[1]);
621 put_user(0x0fc010df, &usp[2]);
622#endif
623 put_user(0xe0008200, &usp[3]);
624 put_user(0x34140000, &usp[4]);
625
626 /* Stack is 64-byte aligned, and we only need
627 * to flush 1 cache line.
628 * Flushing one cacheline is cheap.
629 * "sync" on bigger (> 4 way) boxes is not.
630 */
631 asm("fdc %%r0(%%sr3, %0)\n"
632 "sync\n"
633 "fic %%r0(%%sr3, %0)\n"
634 "sync\n"
635 : : "r"(regs->gr[30]));
636
637 regs->gr[31] = regs->gr[30] + 8;
638 /* Preserve original r28. */
639 regs->gr[28] = regs->orig_r28;
640 } else if (regs->gr[28] == -ERESTARTNOHAND ||
641 regs->gr[28] == -ERESTARTSYS ||
642 regs->gr[28] == -ERESTARTNOINTR) {
643 /* Hooray for delayed branching. We don't
644 have to restore %r20 (the system call
645 number) because it gets loaded in the delay
646 slot of the branch external instruction. */
647 regs->gr[31] -= 8;
648 /* Preserve original r28. */
649 regs->gr[28] = regs->orig_r28;
650 }
651 }
652 631
653 DBG(1,"do_signal: Exit (not delivered), regs->gr[28] = %ld\n", 632 DBG(1,"do_signal: Exit (not delivered), regs->gr[28] = %ld\n",
654 regs->gr[28]); 633 regs->gr[28]);
655 634
656 return 0; 635 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
636 clear_thread_flag(TIF_RESTORE_SIGMASK);
637 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
638 }
639
640 return;
641}
642
643void do_notify_resume(struct pt_regs *regs, long in_syscall)
644{
645 if (test_thread_flag(TIF_SIGPENDING) ||
646 test_thread_flag(TIF_RESTORE_SIGMASK))
647 do_signal(regs, in_syscall);
657} 648}
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index a6b4231cafa1..1c1a37f73053 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -1,6 +1,8 @@
1/* Signal support for 32-bit kernel builds 1/* Signal support for 32-bit kernel builds
2 * 2 *
3 * Copyright (C) 2001 Matthew Wilcox <willy at parisc-linux.org> 3 * Copyright (C) 2001 Matthew Wilcox <willy at parisc-linux.org>
4 * Copyright (C) 2006 Kyle McMartin <kyle at parisc-linux.org>
5 *
4 * Code was mostly borrowed from kernel/signal.c. 6 * Code was mostly borrowed from kernel/signal.c.
5 * See kernel/signal.c for additional Copyrights. 7 * See kernel/signal.c for additional Copyrights.
6 * 8 *
@@ -401,7 +403,7 @@ setup_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __
401int 403int
402copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from) 404copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
403{ 405{
404 unsigned long tmp; 406 compat_uptr_t addr;
405 int err; 407 int err;
406 408
407 if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t))) 409 if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t)))
@@ -424,8 +426,8 @@ copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
424 err |= __get_user(to->si_uid, &from->si_uid); 426 err |= __get_user(to->si_uid, &from->si_uid);
425 break; 427 break;
426 case __SI_FAULT >> 16: 428 case __SI_FAULT >> 16:
427 err |= __get_user(tmp, &from->si_addr); 429 err |= __get_user(addr, &from->si_addr);
428 to->si_addr = (void __user *) tmp; 430 to->si_addr = compat_ptr(addr);
429 break; 431 break;
430 case __SI_POLL >> 16: 432 case __SI_POLL >> 16:
431 err |= __get_user(to->si_band, &from->si_band); 433 err |= __get_user(to->si_band, &from->si_band);
@@ -445,7 +447,8 @@ copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
445int 447int
446copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from) 448copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
447{ 449{
448 unsigned int addr; 450 compat_uptr_t addr;
451 compat_int_t val;
449 int err; 452 int err;
450 453
451 if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) 454 if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
@@ -474,8 +477,8 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
474 err |= __put_user(from->si_uid, &to->si_uid); 477 err |= __put_user(from->si_uid, &to->si_uid);
475 break; 478 break;
476 case __SI_FAULT >> 16: 479 case __SI_FAULT >> 16:
477 /* avoid type-checking warnings by copying _pad[0] in lieu of si_addr... */ 480 addr = ptr_to_compat(from->si_addr);
478 err |= __put_user(from->_sifields._pad[0], &to->si_addr); 481 err |= __put_user(addr, &to->si_addr);
479 break; 482 break;
480 case __SI_POLL >> 16: 483 case __SI_POLL >> 16:
481 err |= __put_user(from->si_band, &to->si_band); 484 err |= __put_user(from->si_band, &to->si_band);
@@ -484,17 +487,36 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
484 case __SI_TIMER >> 16: 487 case __SI_TIMER >> 16:
485 err |= __put_user(from->si_tid, &to->si_tid); 488 err |= __put_user(from->si_tid, &to->si_tid);
486 err |= __put_user(from->si_overrun, &to->si_overrun); 489 err |= __put_user(from->si_overrun, &to->si_overrun);
487 addr = (unsigned long) from->si_ptr; 490 val = (compat_int_t)from->si_int;
488 err |= __put_user(addr, &to->si_ptr); 491 err |= __put_user(val, &to->si_int);
489 break; 492 break;
490 case __SI_RT >> 16: /* Not generated by the kernel as of now. */ 493 case __SI_RT >> 16: /* Not generated by the kernel as of now. */
491 case __SI_MESGQ >> 16: 494 case __SI_MESGQ >> 16:
492 err |= __put_user(from->si_uid, &to->si_uid); 495 err |= __put_user(from->si_uid, &to->si_uid);
493 err |= __put_user(from->si_pid, &to->si_pid); 496 err |= __put_user(from->si_pid, &to->si_pid);
494 addr = (unsigned long) from->si_ptr; 497 val = (compat_int_t)from->si_int;
495 err |= __put_user(addr, &to->si_ptr); 498 err |= __put_user(val, &to->si_int);
496 break; 499 break;
497 } 500 }
498 } 501 }
499 return err; 502 return err;
500} 503}
504
505asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig,
506 struct compat_siginfo __user *uinfo)
507{
508 siginfo_t info;
509
510 if (copy_siginfo_from_user32(&info, uinfo))
511 return -EFAULT;
512
513 /* Not even root can pretend to send signals from the kernel.
514 Nor can they impersonate a kill(), which adds source info. */
515 if (info.si_code >= 0)
516 return -EPERM;
517 info.si_signo = sig;
518
519 /* POSIX.1b doesn't mention process groups. */
520 return kill_proc_info(sig, &info, pid);
521}
522
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 12cc019307ad..6ba9257fdb7f 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -16,9 +16,6 @@
16** the Free Software Foundation; either version 2 of the License, or 16** the Free Software Foundation; either version 2 of the License, or
17** (at your option) any later version. 17** (at your option) any later version.
18*/ 18*/
19#undef ENTRY_SYS_CPUS /* syscall support for iCOD-like functionality */
20
21
22#include <linux/types.h> 19#include <linux/types.h>
23#include <linux/spinlock.h> 20#include <linux/spinlock.h>
24#include <linux/slab.h> 21#include <linux/slab.h>
@@ -51,7 +48,15 @@
51#include <asm/unistd.h> 48#include <asm/unistd.h>
52#include <asm/cacheflush.h> 49#include <asm/cacheflush.h>
53 50
54#define kDEBUG 0 51#undef DEBUG_SMP
52#ifdef DEBUG_SMP
53static int smp_debug_lvl = 0;
54#define smp_debug(lvl, printargs...) \
55 if (lvl >= smp_debug_lvl) \
56 printk(printargs);
57#else
58#define smp_debug(lvl, ...)
59#endif /* DEBUG_SMP */
55 60
56DEFINE_SPINLOCK(smp_lock); 61DEFINE_SPINLOCK(smp_lock);
57 62
@@ -76,6 +81,7 @@ cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; /* Bitmap of Present CP
76EXPORT_SYMBOL(cpu_online_map); 81EXPORT_SYMBOL(cpu_online_map);
77EXPORT_SYMBOL(cpu_possible_map); 82EXPORT_SYMBOL(cpu_possible_map);
78 83
84DEFINE_PER_CPU(spinlock_t, ipi_lock) = SPIN_LOCK_UNLOCKED;
79 85
80struct smp_call_struct { 86struct smp_call_struct {
81 void (*func) (void *info); 87 void (*func) (void *info);
@@ -107,13 +113,6 @@ enum ipi_message_type {
107static void 113static void
108ipi_init(int cpuid) 114ipi_init(int cpuid)
109{ 115{
110
111 /* If CPU is present ... */
112#ifdef ENTRY_SYS_CPUS
113 /* *and* running (not stopped) ... */
114#error iCOD support wants state checked here.
115#endif
116
117#error verify IRQ_OFFSET(IPI_IRQ) is ipi_interrupt() in new IRQ region 116#error verify IRQ_OFFSET(IPI_IRQ) is ipi_interrupt() in new IRQ region
118 117
119 if(cpu_online(cpuid) ) 118 if(cpu_online(cpuid) )
@@ -133,23 +132,12 @@ ipi_init(int cpuid)
133static void 132static void
134halt_processor(void) 133halt_processor(void)
135{ 134{
136#ifdef ENTRY_SYS_CPUS
137#error halt_processor() needs rework
138/*
139** o migrate I/O interrupts off this CPU.
140** o leave IPI enabled - __cli() will disable IPI.
141** o leave CPU in online map - just change the state
142*/
143 cpu_data[this_cpu].state = STATE_STOPPED;
144 mark_bh(IPI_BH);
145#else
146 /* REVISIT : redirect I/O Interrupts to another CPU? */ 135 /* REVISIT : redirect I/O Interrupts to another CPU? */
147 /* REVISIT : does PM *know* this CPU isn't available? */ 136 /* REVISIT : does PM *know* this CPU isn't available? */
148 cpu_clear(smp_processor_id(), cpu_online_map); 137 cpu_clear(smp_processor_id(), cpu_online_map);
149 local_irq_disable(); 138 local_irq_disable();
150 for (;;) 139 for (;;)
151 ; 140 ;
152#endif
153} 141}
154 142
155 143
@@ -167,10 +155,11 @@ ipi_interrupt(int irq, void *dev_id)
167 mb(); /* Order interrupt and bit testing. */ 155 mb(); /* Order interrupt and bit testing. */
168 156
169 for (;;) { 157 for (;;) {
170 spin_lock_irqsave(&(p->lock),flags); 158 spinlock_t *lock = &per_cpu(ipi_lock, this_cpu);
159 spin_lock_irqsave(lock, flags);
171 ops = p->pending_ipi; 160 ops = p->pending_ipi;
172 p->pending_ipi = 0; 161 p->pending_ipi = 0;
173 spin_unlock_irqrestore(&(p->lock),flags); 162 spin_unlock_irqrestore(lock, flags);
174 163
175 mb(); /* Order bit clearing and data access. */ 164 mb(); /* Order bit clearing and data access. */
176 165
@@ -184,15 +173,11 @@ ipi_interrupt(int irq, void *dev_id)
184 173
185 switch (which) { 174 switch (which) {
186 case IPI_NOP: 175 case IPI_NOP:
187#if (kDEBUG>=100) 176 smp_debug(100, KERN_DEBUG "CPU%d IPI_NOP\n", this_cpu);
188 printk(KERN_DEBUG "CPU%d IPI_NOP\n",this_cpu);
189#endif /* kDEBUG */
190 break; 177 break;
191 178
192 case IPI_RESCHEDULE: 179 case IPI_RESCHEDULE:
193#if (kDEBUG>=100) 180 smp_debug(100, KERN_DEBUG "CPU%d IPI_RESCHEDULE\n", this_cpu);
194 printk(KERN_DEBUG "CPU%d IPI_RESCHEDULE\n",this_cpu);
195#endif /* kDEBUG */
196 /* 181 /*
197 * Reschedule callback. Everything to be 182 * Reschedule callback. Everything to be
198 * done is done by the interrupt return path. 183 * done is done by the interrupt return path.
@@ -200,9 +185,7 @@ ipi_interrupt(int irq, void *dev_id)
200 break; 185 break;
201 186
202 case IPI_CALL_FUNC: 187 case IPI_CALL_FUNC:
203#if (kDEBUG>=100) 188 smp_debug(100, KERN_DEBUG "CPU%d IPI_CALL_FUNC\n", this_cpu);
204 printk(KERN_DEBUG "CPU%d IPI_CALL_FUNC\n",this_cpu);
205#endif /* kDEBUG */
206 { 189 {
207 volatile struct smp_call_struct *data; 190 volatile struct smp_call_struct *data;
208 void (*func)(void *info); 191 void (*func)(void *info);
@@ -233,28 +216,16 @@ ipi_interrupt(int irq, void *dev_id)
233 break; 216 break;
234 217
235 case IPI_CPU_START: 218 case IPI_CPU_START:
236#if (kDEBUG>=100) 219 smp_debug(100, KERN_DEBUG "CPU%d IPI_CPU_START\n", this_cpu);
237 printk(KERN_DEBUG "CPU%d IPI_CPU_START\n",this_cpu);
238#endif /* kDEBUG */
239#ifdef ENTRY_SYS_CPUS
240 p->state = STATE_RUNNING;
241#endif
242 break; 220 break;
243 221
244 case IPI_CPU_STOP: 222 case IPI_CPU_STOP:
245#if (kDEBUG>=100) 223 smp_debug(100, KERN_DEBUG "CPU%d IPI_CPU_STOP\n", this_cpu);
246 printk(KERN_DEBUG "CPU%d IPI_CPU_STOP\n",this_cpu);
247#endif /* kDEBUG */
248#ifdef ENTRY_SYS_CPUS
249#else
250 halt_processor(); 224 halt_processor();
251#endif
252 break; 225 break;
253 226
254 case IPI_CPU_TEST: 227 case IPI_CPU_TEST:
255#if (kDEBUG>=100) 228 smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu);
256 printk(KERN_DEBUG "CPU%d is alive!\n",this_cpu);
257#endif /* kDEBUG */
258 break; 229 break;
259 230
260 default: 231 default:
@@ -275,12 +246,13 @@ static inline void
275ipi_send(int cpu, enum ipi_message_type op) 246ipi_send(int cpu, enum ipi_message_type op)
276{ 247{
277 struct cpuinfo_parisc *p = &cpu_data[cpu]; 248 struct cpuinfo_parisc *p = &cpu_data[cpu];
249 spinlock_t *lock = &per_cpu(ipi_lock, cpu);
278 unsigned long flags; 250 unsigned long flags;
279 251
280 spin_lock_irqsave(&(p->lock),flags); 252 spin_lock_irqsave(lock, flags);
281 p->pending_ipi |= 1 << op; 253 p->pending_ipi |= 1 << op;
282 gsc_writel(IPI_IRQ - CPU_IRQ_BASE, cpu_data[cpu].hpa); 254 gsc_writel(IPI_IRQ - CPU_IRQ_BASE, cpu_data[cpu].hpa);
283 spin_unlock_irqrestore(&(p->lock),flags); 255 spin_unlock_irqrestore(lock, flags);
284} 256}
285 257
286 258
@@ -560,13 +532,8 @@ int __init smp_boot_one_cpu(int cpuid)
560 532
561alive: 533alive:
562 /* Remember the Slave data */ 534 /* Remember the Slave data */
563#if (kDEBUG>=100) 535 smp_debug(100, KERN_DEBUG "SMP: CPU:%d came alive after %ld _us\n",
564 printk(KERN_DEBUG "SMP: CPU:%d came alive after %ld _us\n",
565 cpuid, timeout * 100); 536 cpuid, timeout * 100);
566#endif /* kDEBUG */
567#ifdef ENTRY_SYS_CPUS
568 cpu_data[cpuid].state = STATE_RUNNING;
569#endif
570 return 0; 537 return 0;
571} 538}
572 539
@@ -574,10 +541,6 @@ void __devinit smp_prepare_boot_cpu(void)
574{ 541{
575 int bootstrap_processor=cpu_data[0].cpuid; /* CPU ID of BSP */ 542 int bootstrap_processor=cpu_data[0].cpuid; /* CPU ID of BSP */
576 543
577#ifdef ENTRY_SYS_CPUS
578 cpu_data[0].state = STATE_RUNNING;
579#endif
580
581 /* Setup BSP mappings */ 544 /* Setup BSP mappings */
582 printk("SMP: bootstrap CPU ID is %d\n",bootstrap_processor); 545 printk("SMP: bootstrap CPU ID is %d\n",bootstrap_processor);
583 546
@@ -616,101 +579,6 @@ int __cpuinit __cpu_up(unsigned int cpu)
616 return cpu_online(cpu) ? 0 : -ENOSYS; 579 return cpu_online(cpu) ? 0 : -ENOSYS;
617} 580}
618 581
619
620
621#ifdef ENTRY_SYS_CPUS
622/* Code goes along with:
623** entry.s: ENTRY_NAME(sys_cpus) / * 215, for cpu stat * /
624*/
625int sys_cpus(int argc, char **argv)
626{
627 int i,j=0;
628 extern int current_pid(int cpu);
629
630 if( argc > 2 ) {
631 printk("sys_cpus:Only one argument supported\n");
632 return (-1);
633 }
634 if ( argc == 1 ){
635
636#ifdef DUMP_MORE_STATE
637 for_each_online_cpu(i) {
638 int cpus_per_line = 4;
639
640 if (j++ % cpus_per_line)
641 printk(" %3d",i);
642 else
643 printk("\n %3d",i);
644 }
645 printk("\n");
646#else
647 printk("\n 0\n");
648#endif
649 } else if((argc==2) && !(strcmp(argv[1],"-l"))) {
650 printk("\nCPUSTATE TASK CPUNUM CPUID HARDCPU(HPA)\n");
651#ifdef DUMP_MORE_STATE
652 for_each_online_cpu(i) {
653 if (cpu_data[i].cpuid != NO_PROC_ID) {
654 switch(cpu_data[i].state) {
655 case STATE_RENDEZVOUS:
656 printk("RENDEZVS ");
657 break;
658 case STATE_RUNNING:
659 printk((current_pid(i)!=0) ? "RUNNING " : "IDLING ");
660 break;
661 case STATE_STOPPED:
662 printk("STOPPED ");
663 break;
664 case STATE_HALTED:
665 printk("HALTED ");
666 break;
667 default:
668 printk("%08x?", cpu_data[i].state);
669 break;
670 }
671 if(cpu_online(i)) {
672 printk(" %4d",current_pid(i));
673 }
674 printk(" %6d",cpu_number_map(i));
675 printk(" %5d",i);
676 printk(" 0x%lx\n",cpu_data[i].hpa);
677 }
678 }
679#else
680 printk("\n%s %4d 0 0 --------",
681 (current->pid)?"RUNNING ": "IDLING ",current->pid);
682#endif
683 } else if ((argc==2) && !(strcmp(argv[1],"-s"))) {
684#ifdef DUMP_MORE_STATE
685 printk("\nCPUSTATE CPUID\n");
686 for_each_online_cpu(i) {
687 if (cpu_data[i].cpuid != NO_PROC_ID) {
688 switch(cpu_data[i].state) {
689 case STATE_RENDEZVOUS:
690 printk("RENDEZVS");break;
691 case STATE_RUNNING:
692 printk((current_pid(i)!=0) ? "RUNNING " : "IDLING");
693 break;
694 case STATE_STOPPED:
695 printk("STOPPED ");break;
696 case STATE_HALTED:
697 printk("HALTED ");break;
698 default:
699 }
700 printk(" %5d\n",i);
701 }
702 }
703#else
704 printk("\n%s CPU0",(current->pid==0)?"RUNNING ":"IDLING ");
705#endif
706 } else {
707 printk("sys_cpus:Unknown request\n");
708 return (-1);
709 }
710 return 0;
711}
712#endif /* ENTRY_SYS_CPUS */
713
714#ifdef CONFIG_PROC_FS 582#ifdef CONFIG_PROC_FS
715int __init 583int __init
716setup_profiling_timer(unsigned int multiplier) 584setup_profiling_timer(unsigned int multiplier)
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index a05800429304..10859f53e94f 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -12,27 +12,23 @@
12#include <asm/errno.h> 12#include <asm/errno.h>
13#include <asm/psw.h> 13#include <asm/psw.h>
14#include <asm/thread_info.h> 14#include <asm/thread_info.h>
15
16#include <asm/assembly.h> 15#include <asm/assembly.h>
17#include <asm/processor.h> 16#include <asm/processor.h>
18 17
18#include <linux/linkage.h>
19
19 /* We fill the empty parts of the gateway page with 20 /* We fill the empty parts of the gateway page with
20 * something that will kill the kernel or a 21 * something that will kill the kernel or a
21 * userspace application. 22 * userspace application.
22 */ 23 */
23#define KILL_INSN break 0,0 24#define KILL_INSN break 0,0
24 25
25#ifdef CONFIG_64BIT 26 .level LEVEL
26 .level 2.0w
27#else
28 .level 1.1
29#endif
30 27
31 .text 28 .text
32 29
33 .import syscall_exit,code 30 .import syscall_exit,code
34 .import syscall_exit_rfi,code 31 .import syscall_exit_rfi,code
35 .export linux_gateway_page
36 32
37 /* Linux gateway page is aliased to virtual page 0 in the kernel 33 /* Linux gateway page is aliased to virtual page 0 in the kernel
38 * address space. Since it is a gateway page it cannot be 34 * address space. Since it is a gateway page it cannot be
@@ -43,7 +39,7 @@
43 */ 39 */
44 40
45 .align ASM_PAGE_SIZE 41 .align ASM_PAGE_SIZE
46linux_gateway_page: 42ENTRY(linux_gateway_page)
47 43
48 /* ADDRESS 0x00 to 0xb0 = 176 bytes / 4 bytes per insn = 44 insns */ 44 /* ADDRESS 0x00 to 0xb0 = 176 bytes / 4 bytes per insn = 44 insns */
49 .rept 44 45 .rept 44
@@ -595,73 +591,43 @@ cas_action:
595 the other for the store. Either return -EFAULT. 591 the other for the store. Either return -EFAULT.
596 Each of the entries must be relocated. */ 592 Each of the entries must be relocated. */
597 .section __ex_table,"aw" 593 .section __ex_table,"aw"
598#ifdef CONFIG_64BIT 594 ASM_ULONG_INSN (1b - linux_gateway_page), (3b - linux_gateway_page)
599 /* Pad the address calculation */ 595 ASM_ULONG_INSN (2b - linux_gateway_page), (3b - linux_gateway_page)
600 .word 0,(2b - linux_gateway_page)
601 .word 0,(3b - linux_gateway_page)
602#else
603 .word (2b - linux_gateway_page)
604 .word (3b - linux_gateway_page)
605#endif
606 .previous 596 .previous
607 597
608 .section __ex_table,"aw"
609#ifdef CONFIG_64BIT
610 /* Pad the address calculation */
611 .word 0,(1b - linux_gateway_page)
612 .word 0,(3b - linux_gateway_page)
613#else
614 .word (1b - linux_gateway_page)
615 .word (3b - linux_gateway_page)
616#endif
617 .previous
618
619end_compare_and_swap:
620 598
621 /* Make sure nothing else is placed on this page */ 599 /* Make sure nothing else is placed on this page */
622 .align ASM_PAGE_SIZE 600 .align ASM_PAGE_SIZE
623 .export end_linux_gateway_page 601END(linux_gateway_page)
624end_linux_gateway_page: 602ENTRY(end_linux_gateway_page)
625 603
626 /* Relocate symbols assuming linux_gateway_page is mapped 604 /* Relocate symbols assuming linux_gateway_page is mapped
627 to virtual address 0x0 */ 605 to virtual address 0x0 */
628#ifdef CONFIG_64BIT 606
629 /* FIXME: The code will always be on the gateay page 607#define LWS_ENTRY(_name_) ASM_ULONG_INSN (lws_##_name_ - linux_gateway_page)
630 and thus it will be on the first 4k, the
631 assembler seems to think that the final
632 subtraction result is only a word in
633 length, so we pad the value.
634 */
635#define LWS_ENTRY(_name_) .word 0,(lws_##_name_ - linux_gateway_page)
636#else
637#define LWS_ENTRY(_name_) .word (lws_##_name_ - linux_gateway_page)
638#endif
639 608
640 .section .rodata,"a" 609 .section .rodata,"a"
641 610
642 .align ASM_PAGE_SIZE 611 .align ASM_PAGE_SIZE
643 /* Light-weight-syscall table */ 612 /* Light-weight-syscall table */
644 /* Start of lws table. */ 613 /* Start of lws table. */
645 .export lws_table 614ENTRY(lws_table)
646.Llws_table:
647lws_table:
648 LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic compare and swap */ 615 LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic compare and swap */
649 LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */ 616 LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */
617END(lws_table)
650 /* End of lws table */ 618 /* End of lws table */
651 619
652 .align ASM_PAGE_SIZE 620 .align ASM_PAGE_SIZE
653 .export sys_call_table 621ENTRY(sys_call_table)
654.Lsys_call_table:
655sys_call_table:
656#include "syscall_table.S" 622#include "syscall_table.S"
623END(sys_call_table)
657 624
658#ifdef CONFIG_64BIT 625#ifdef CONFIG_64BIT
659 .align ASM_PAGE_SIZE 626 .align ASM_PAGE_SIZE
660 .export sys_call_table64 627ENTRY(sys_call_table64)
661.Lsys_call_table64:
662sys_call_table64:
663#define SYSCALL_TABLE_64BIT 628#define SYSCALL_TABLE_64BIT
664#include "syscall_table.S" 629#include "syscall_table.S"
630END(sys_call_table64)
665#endif 631#endif
666 632
667#ifdef CONFIG_SMP 633#ifdef CONFIG_SMP
@@ -671,9 +637,7 @@ sys_call_table64:
671 */ 637 */
672 .section .data 638 .section .data
673 .align 4096 639 .align 4096
674 .export lws_lock_start 640ENTRY(lws_lock_start)
675.Llws_lock_start:
676lws_lock_start:
677 /* lws locks */ 641 /* lws locks */
678 .align 16 642 .align 16
679 .rept 16 643 .rept 16
@@ -683,6 +647,7 @@ lws_lock_start:
683 .word 0 647 .word 0
684 .word 0 648 .word 0
685 .endr 649 .endr
650END(lws_lock_start)
686 .previous 651 .previous
687#endif 652#endif
688/* CONFIG_SMP for lws_lock_start */ 653/* CONFIG_SMP for lws_lock_start */
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index be8eb9a0d24a..8bf87e5d9c37 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -10,7 +10,7 @@
10 * Copyright (C) 2000 Grant Grundler <grundler at parisc-linux.org> 10 * Copyright (C) 2000 Grant Grundler <grundler at parisc-linux.org>
11 * Copyright (C) 2001 Richard Hirst <rhirst with parisc-linux.org> 11 * Copyright (C) 2001 Richard Hirst <rhirst with parisc-linux.org>
12 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org> 12 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
13 * Copyright (C) 2001 Helge Deller <deller at parisc-linux.org> 13 * Copyright (C) 2001-2007 Helge Deller <deller at parisc-linux.org>
14 * Copyright (C) 2000-2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org> 14 * Copyright (C) 2000-2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org>
15 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> 15 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
16 * Copyright (C) 2005-2006 Kyle McMartin <kyle at parisc-linux.org> 16 * Copyright (C) 2005-2006 Kyle McMartin <kyle at parisc-linux.org>
@@ -282,8 +282,8 @@
282 * to worry about faulting trying to copy in a larger 64-bit 282 * to worry about faulting trying to copy in a larger 64-bit
283 * struct from a 32-bit user-space app. 283 * struct from a 32-bit user-space app.
284 */ 284 */
285 ENTRY_SAME(rt_sigqueueinfo) 285 ENTRY_COMP(rt_sigqueueinfo)
286 ENTRY_SAME(rt_sigsuspend_wrapper) /* not really SAME -- see the code */ 286 ENTRY_COMP(rt_sigsuspend)
287 ENTRY_SAME(chown) /* 180 */ 287 ENTRY_SAME(chown) /* 180 */
288 /* setsockopt() used by iptables: SO_SET_REPLACE/SO_SET_ADD_COUNTERS */ 288 /* setsockopt() used by iptables: SO_SET_REPLACE/SO_SET_ADD_COUNTERS */
289 ENTRY_COMP(setsockopt) 289 ENTRY_COMP(setsockopt)
@@ -377,9 +377,9 @@
377 ENTRY_SAME(inotify_init) 377 ENTRY_SAME(inotify_init)
378 ENTRY_SAME(inotify_add_watch) /* 270 */ 378 ENTRY_SAME(inotify_add_watch) /* 270 */
379 ENTRY_SAME(inotify_rm_watch) 379 ENTRY_SAME(inotify_rm_watch)
380 ENTRY_SAME(ni_syscall) /* 271 ENTRY_COMP(pselect6) */
381 ENTRY_SAME(ni_syscall) /* 272 ENTRY_COMP(ppoll) */
382 ENTRY_SAME(migrate_pages) 380 ENTRY_SAME(migrate_pages)
381 ENTRY_COMP(pselect6)
382 ENTRY_COMP(ppoll)
383 ENTRY_COMP(openat) /* 275 */ 383 ENTRY_COMP(openat) /* 275 */
384 ENTRY_SAME(mkdirat) 384 ENTRY_SAME(mkdirat)
385 ENTRY_SAME(mknodat) 385 ENTRY_SAME(mknodat)
@@ -399,5 +399,11 @@
399 ENTRY_SAME(splice) 399 ENTRY_SAME(splice)
400 ENTRY_OURS(sync_file_range) 400 ENTRY_OURS(sync_file_range)
401 ENTRY_SAME(tee) 401 ENTRY_SAME(tee)
402 ENTRY_COMP(vmsplice)
403 ENTRY_COMP(move_pages) /* 295 */
404 ENTRY_SAME(getcpu)
405 ENTRY_SAME(epoll_pwait)
406 ENTRY_COMP(statfs64)
407 ENTRY_COMP(fstatfs64)
402 /* Nothing yet */ 408 /* Nothing yet */
403 409
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 5f1b51af06a9..d1db8e518654 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/smp.h> 23#include <linux/smp.h>
24#include <linux/profile.h> 24#include <linux/profile.h>
25#include <linux/clocksource.h>
25 26
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27#include <asm/io.h> 28#include <asm/io.h>
@@ -98,7 +99,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
98 * cycles after the IT fires. But it's arbitrary how much time passes 99 * cycles after the IT fires. But it's arbitrary how much time passes
99 * before we call it "late". I've picked one second. 100 * before we call it "late". I've picked one second.
100 */ 101 */
101 if (ticks_elapsed > HZ) { 102 if (unlikely(ticks_elapsed > HZ)) {
102 /* Scenario 3: very long delay? bad in any case */ 103 /* Scenario 3: very long delay? bad in any case */
103 printk (KERN_CRIT "timer_interrupt(CPU %d): delayed!" 104 printk (KERN_CRIT "timer_interrupt(CPU %d): delayed!"
104 " cycles %lX rem %lX " 105 " cycles %lX rem %lX "
@@ -147,10 +148,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
147 write_sequnlock(&xtime_lock); 148 write_sequnlock(&xtime_lock);
148 } 149 }
149 150
150 /* check soft power switch status */
151 if (cpu == 0 && !atomic_read(&power_tasklet.count))
152 tasklet_schedule(&power_tasklet);
153
154 return IRQ_HANDLED; 151 return IRQ_HANDLED;
155} 152}
156 153
@@ -172,121 +169,41 @@ unsigned long profile_pc(struct pt_regs *regs)
172EXPORT_SYMBOL(profile_pc); 169EXPORT_SYMBOL(profile_pc);
173 170
174 171
175/* 172/* clock source code */
176 * Return the number of micro-seconds that elapsed since the last
177 * update to wall time (aka xtime). The xtime_lock
178 * must be at least read-locked when calling this routine.
179 */
180static inline unsigned long gettimeoffset (void)
181{
182#ifndef CONFIG_SMP
183 /*
184 * FIXME: This won't work on smp because jiffies are updated by cpu 0.
185 * Once parisc-linux learns the cr16 difference between processors,
186 * this could be made to work.
187 */
188 unsigned long now;
189 unsigned long prev_tick;
190 unsigned long next_tick;
191 unsigned long elapsed_cycles;
192 unsigned long usec;
193 unsigned long cpuid = smp_processor_id();
194 unsigned long cpt = clocktick;
195
196 next_tick = cpu_data[cpuid].it_value;
197 now = mfctl(16); /* Read the hardware interval timer. */
198 173
199 prev_tick = next_tick - cpt; 174static cycle_t read_cr16(void)
175{
176 return get_cycles();
177}
200 178
201 /* Assume Scenario 1: "now" is later than prev_tick. */ 179static int cr16_update_callback(void);
202 elapsed_cycles = now - prev_tick;
203 180
204/* aproximate HZ with shifts. Intended math is "(elapsed/clocktick) > HZ" */ 181static struct clocksource clocksource_cr16 = {
205#if HZ == 1000 182 .name = "cr16",
206 if (elapsed_cycles > (cpt << 10) ) 183 .rating = 300,
207#elif HZ == 250 184 .read = read_cr16,
208 if (elapsed_cycles > (cpt << 8) ) 185 .mask = CLOCKSOURCE_MASK(BITS_PER_LONG),
209#elif HZ == 100 186 .mult = 0, /* to be set */
210 if (elapsed_cycles > (cpt << 7) ) 187 .shift = 22,
211#else 188 .update_callback = cr16_update_callback,
212#warn WTF is HZ set to anyway? 189 .is_continuous = 1,
213 if (elapsed_cycles > (HZ * cpt) ) 190};
214#endif
215 {
216 /* Scenario 3: clock ticks are missing. */
217 printk (KERN_CRIT "gettimeoffset(CPU %ld): missing %ld ticks!"
218 " cycles %lX prev/now/next %lX/%lX/%lX clock %lX\n",
219 cpuid, elapsed_cycles / cpt,
220 elapsed_cycles, prev_tick, now, next_tick, cpt);
221 }
222 191
223 /* FIXME: Can we improve the precision? Not with PAGE0. */ 192static int cr16_update_callback(void)
224 usec = (elapsed_cycles * 10000) / PAGE0->mem_10msec;
225 return usec;
226#else
227 return 0;
228#endif
229}
230
231void
232do_gettimeofday (struct timeval *tv)
233{ 193{
234 unsigned long flags, seq, usec, sec; 194 int change = 0;
235 195
236 /* Hold xtime_lock and adjust timeval. */ 196 /* since the cr16 cycle counters are not syncronized across CPUs,
237 do { 197 we'll check if we should switch to a safe clocksource: */
238 seq = read_seqbegin_irqsave(&xtime_lock, flags); 198 if (clocksource_cr16.rating != 0 && num_online_cpus() > 1) {
239 usec = gettimeoffset(); 199 clocksource_cr16.rating = 0;
240 sec = xtime.tv_sec; 200 clocksource_reselect();
241 usec += (xtime.tv_nsec / 1000); 201 change = 1;
242 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
243
244 /* Move adjusted usec's into sec's. */
245 while (usec >= USEC_PER_SEC) {
246 usec -= USEC_PER_SEC;
247 ++sec;
248 } 202 }
249 203
250 /* Return adjusted result. */ 204 return change;
251 tv->tv_sec = sec;
252 tv->tv_usec = usec;
253} 205}
254 206
255EXPORT_SYMBOL(do_gettimeofday);
256
257int
258do_settimeofday (struct timespec *tv)
259{
260 time_t wtm_sec, sec = tv->tv_sec;
261 long wtm_nsec, nsec = tv->tv_nsec;
262
263 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
264 return -EINVAL;
265
266 write_seqlock_irq(&xtime_lock);
267 {
268 /*
269 * This is revolting. We need to set "xtime"
270 * correctly. However, the value in this location is
271 * the value at the most recent update of wall time.
272 * Discover what correction gettimeofday would have
273 * done, and then undo it!
274 */
275 nsec -= gettimeoffset() * 1000;
276
277 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
278 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
279
280 set_normalized_timespec(&xtime, sec, nsec);
281 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
282
283 ntp_clear();
284 }
285 write_sequnlock_irq(&xtime_lock);
286 clock_was_set();
287 return 0;
288}
289EXPORT_SYMBOL(do_settimeofday);
290 207
291void __init start_cpu_itimer(void) 208void __init start_cpu_itimer(void)
292{ 209{
@@ -301,11 +218,18 @@ void __init start_cpu_itimer(void)
301void __init time_init(void) 218void __init time_init(void)
302{ 219{
303 static struct pdc_tod tod_data; 220 static struct pdc_tod tod_data;
221 unsigned long current_cr16_khz;
304 222
305 clocktick = (100 * PAGE0->mem_10msec) / HZ; 223 clocktick = (100 * PAGE0->mem_10msec) / HZ;
306 224
307 start_cpu_itimer(); /* get CPU 0 started */ 225 start_cpu_itimer(); /* get CPU 0 started */
308 226
227 /* register at clocksource framework */
228 current_cr16_khz = PAGE0->mem_10msec/10; /* kHz */
229 clocksource_cr16.mult = clocksource_khz2mult(current_cr16_khz,
230 clocksource_cr16.shift);
231 clocksource_register(&clocksource_cr16);
232
309 if (pdc_tod_read(&tod_data) == 0) { 233 if (pdc_tod_read(&tod_data) == 0) {
310 unsigned long flags; 234 unsigned long flags;
311 235
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 65cd6ca32fed..55bc1471967d 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/console.h> 27#include <linux/console.h>
28#include <linux/kallsyms.h> 28#include <linux/kallsyms.h>
29#include <linux/bug.h>
29 30
30#include <asm/assembly.h> 31#include <asm/assembly.h>
31#include <asm/system.h> 32#include <asm/system.h>
@@ -39,6 +40,8 @@
39#include <asm/pdc.h> 40#include <asm/pdc.h>
40#include <asm/pdc_chassis.h> 41#include <asm/pdc_chassis.h>
41#include <asm/unwind.h> 42#include <asm/unwind.h>
43#include <asm/tlbflush.h>
44#include <asm/cacheflush.h>
42 45
43#include "../math-emu/math-emu.h" /* for handle_fpe() */ 46#include "../math-emu/math-emu.h" /* for handle_fpe() */
44 47
@@ -49,7 +52,7 @@
49DEFINE_SPINLOCK(pa_dbit_lock); 52DEFINE_SPINLOCK(pa_dbit_lock);
50#endif 53#endif
51 54
52int printbinary(char *buf, unsigned long x, int nbits) 55static int printbinary(char *buf, unsigned long x, int nbits)
53{ 56{
54 unsigned long mask = 1UL << (nbits - 1); 57 unsigned long mask = 1UL << (nbits - 1);
55 while (mask != 0) { 58 while (mask != 0) {
@@ -61,7 +64,7 @@ int printbinary(char *buf, unsigned long x, int nbits)
61 return nbits; 64 return nbits;
62} 65}
63 66
64#ifdef __LP64__ 67#ifdef CONFIG_64BIT
65#define RFMT "%016lx" 68#define RFMT "%016lx"
66#else 69#else
67#define RFMT "%08lx" 70#define RFMT "%08lx"
@@ -160,13 +163,13 @@ static void do_show_stack(struct unwind_frame_info *info)
160{ 163{
161 int i = 1; 164 int i = 1;
162 165
163 printk("Backtrace:\n"); 166 printk(KERN_CRIT "Backtrace:\n");
164 while (i <= 16) { 167 while (i <= 16) {
165 if (unwind_once(info) < 0 || info->ip == 0) 168 if (unwind_once(info) < 0 || info->ip == 0)
166 break; 169 break;
167 170
168 if (__kernel_text_address(info->ip)) { 171 if (__kernel_text_address(info->ip)) {
169 printk(" [<" RFMT ">] ", info->ip); 172 printk("%s [<" RFMT ">] ", (i&0x3)==1 ? KERN_CRIT : "", info->ip);
170#ifdef CONFIG_KALLSYMS 173#ifdef CONFIG_KALLSYMS
171 print_symbol("%s\n", info->ip); 174 print_symbol("%s\n", info->ip);
172#else 175#else
@@ -185,18 +188,19 @@ void show_stack(struct task_struct *task, unsigned long *s)
185 188
186 if (!task) { 189 if (!task) {
187 unsigned long sp; 190 unsigned long sp;
188 struct pt_regs *r;
189 191
190HERE: 192HERE:
191 asm volatile ("copy %%r30, %0" : "=r"(sp)); 193 asm volatile ("copy %%r30, %0" : "=r"(sp));
192 r = kzalloc(sizeof(struct pt_regs), GFP_KERNEL); 194 {
193 if (!r) 195 struct pt_regs r;
194 return; 196
195 r->iaoq[0] = (unsigned long)&&HERE; 197 memset(&r, 0, sizeof(struct pt_regs));
196 r->gr[2] = (unsigned long)__builtin_return_address(0); 198 r.iaoq[0] = (unsigned long)&&HERE;
197 r->gr[30] = sp; 199 r.gr[2] = (unsigned long)__builtin_return_address(0);
198 unwind_frame_init(&info, current, r); 200 r.gr[30] = sp;
199 kfree(r); 201
202 unwind_frame_init(&info, current, &r);
203 }
200 } else { 204 } else {
201 unwind_frame_init_from_blocked_task(&info, task); 205 unwind_frame_init_from_blocked_task(&info, task);
202 } 206 }
@@ -204,6 +208,11 @@ HERE:
204 do_show_stack(&info); 208 do_show_stack(&info);
205} 209}
206 210
211int is_valid_bugaddr(unsigned long iaoq)
212{
213 return 1;
214}
215
207void die_if_kernel(char *str, struct pt_regs *regs, long err) 216void die_if_kernel(char *str, struct pt_regs *regs, long err)
208{ 217{
209 if (user_mode(regs)) { 218 if (user_mode(regs)) {
@@ -222,15 +231,15 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
222 oops_in_progress = 1; 231 oops_in_progress = 1;
223 232
224 /* Amuse the user in a SPARC fashion */ 233 /* Amuse the user in a SPARC fashion */
225 printk( 234 if (err) printk(
226" _______________________________ \n" 235KERN_CRIT " _______________________________ \n"
227" < Your System ate a SPARC! Gah! >\n" 236KERN_CRIT " < Your System ate a SPARC! Gah! >\n"
228" ------------------------------- \n" 237KERN_CRIT " ------------------------------- \n"
229" \\ ^__^\n" 238KERN_CRIT " \\ ^__^\n"
230" \\ (xx)\\_______\n" 239KERN_CRIT " \\ (xx)\\_______\n"
231" (__)\\ )\\/\\\n" 240KERN_CRIT " (__)\\ )\\/\\\n"
232" U ||----w |\n" 241KERN_CRIT " U ||----w |\n"
233" || ||\n"); 242KERN_CRIT " || ||\n");
234 243
235 /* unlock the pdc lock if necessary */ 244 /* unlock the pdc lock if necessary */
236 pdc_emergency_unlock(); 245 pdc_emergency_unlock();
@@ -242,9 +251,20 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
242 if (!console_drivers) 251 if (!console_drivers)
243 pdc_console_restart(); 252 pdc_console_restart();
244 253
245 printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n", 254 if (err)
246 current->comm, current->pid, str, err); 255 printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
256 current->comm, current->pid, str, err);
257
258 /* Wot's wrong wif bein' racy? */
259 if (current->thread.flags & PARISC_KERNEL_DEATH) {
260 printk(KERN_CRIT "%s() recursion detected.\n", __FUNCTION__);
261 local_irq_enable();
262 while (1);
263 }
264 current->thread.flags |= PARISC_KERNEL_DEATH;
265
247 show_regs(regs); 266 show_regs(regs);
267 dump_stack();
248 268
249 if (in_interrupt()) 269 if (in_interrupt())
250 panic("Fatal exception in interrupt"); 270 panic("Fatal exception in interrupt");
@@ -255,14 +275,6 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
255 panic("Fatal exception"); 275 panic("Fatal exception");
256 } 276 }
257 277
258 /* Wot's wrong wif bein' racy? */
259 if (current->thread.flags & PARISC_KERNEL_DEATH) {
260 printk(KERN_CRIT "%s() recursion detected.\n", __FUNCTION__);
261 local_irq_enable();
262 while (1);
263 }
264
265 current->thread.flags |= PARISC_KERNEL_DEATH;
266 do_exit(SIGSEGV); 278 do_exit(SIGSEGV);
267} 279}
268 280
@@ -273,61 +285,45 @@ int syscall_ipi(int (*syscall) (struct pt_regs *), struct pt_regs *regs)
273 285
274/* gdb uses break 4,8 */ 286/* gdb uses break 4,8 */
275#define GDB_BREAK_INSN 0x10004 287#define GDB_BREAK_INSN 0x10004
276void handle_gdb_break(struct pt_regs *regs, int wot) 288static void handle_gdb_break(struct pt_regs *regs, int wot)
277{ 289{
278 struct siginfo si; 290 struct siginfo si;
279 291
280 si.si_code = wot;
281 si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
282 si.si_signo = SIGTRAP; 292 si.si_signo = SIGTRAP;
283 si.si_errno = 0; 293 si.si_errno = 0;
294 si.si_code = wot;
295 si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
284 force_sig_info(SIGTRAP, &si, current); 296 force_sig_info(SIGTRAP, &si, current);
285} 297}
286 298
287void handle_break(unsigned iir, struct pt_regs *regs) 299static void handle_break(struct pt_regs *regs)
288{ 300{
289 struct siginfo si; 301 unsigned iir = regs->iir;
290 302
291 switch(iir) { 303 if (unlikely(iir == PARISC_BUG_BREAK_INSN && !user_mode(regs))) {
292 case 0x00: 304 /* check if a BUG() or WARN() trapped here. */
293#ifdef PRINT_USER_FAULTS 305 enum bug_trap_type tt;
294 printk(KERN_DEBUG "break 0,0: pid=%d command='%s'\n", 306 tt = report_bug(regs->iaoq[0] & ~3);
295 current->pid, current->comm); 307 if (tt == BUG_TRAP_TYPE_WARN) {
296#endif 308 regs->iaoq[0] += 4;
297 die_if_kernel("Breakpoint", regs, 0); 309 regs->iaoq[1] += 4;
298#ifdef PRINT_USER_FAULTS 310 return; /* return to next instruction when WARN_ON(). */
299 show_regs(regs); 311 }
300#endif 312 die_if_kernel("Unknown kernel breakpoint", regs,
301 si.si_code = TRAP_BRKPT; 313 (tt == BUG_TRAP_TYPE_NONE) ? 9 : 0);
302 si.si_addr = (void __user *) (regs->iaoq[0] & ~3); 314 }
303 si.si_signo = SIGTRAP;
304 force_sig_info(SIGTRAP, &si, current);
305 break;
306
307 case GDB_BREAK_INSN:
308 die_if_kernel("Breakpoint", regs, 0);
309 handle_gdb_break(regs, TRAP_BRKPT);
310 break;
311 315
312 default:
313#ifdef PRINT_USER_FAULTS 316#ifdef PRINT_USER_FAULTS
314 printk(KERN_DEBUG "break %#08x: pid=%d command='%s'\n", 317 if (unlikely(iir != GDB_BREAK_INSN)) {
315 iir, current->pid, current->comm); 318 printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",
319 iir & 31, (iir>>13) & ((1<<13)-1),
320 current->pid, current->comm);
316 show_regs(regs); 321 show_regs(regs);
317#endif
318 si.si_signo = SIGTRAP;
319 si.si_code = TRAP_BRKPT;
320 si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
321 force_sig_info(SIGTRAP, &si, current);
322 return;
323 } 322 }
324} 323#endif
325
326 324
327int handle_toc(void) 325 /* send standard GDB signal */
328{ 326 handle_gdb_break(regs, TRAP_BRKPT);
329 printk(KERN_CRIT "TOC call.\n");
330 return 0;
331} 327}
332 328
333static void default_trap(int code, struct pt_regs *regs) 329static void default_trap(int code, struct pt_regs *regs)
@@ -336,7 +332,7 @@ static void default_trap(int code, struct pt_regs *regs)
336 show_regs(regs); 332 show_regs(regs);
337} 333}
338 334
339void (*cpu_lpmc) (int code, struct pt_regs *regs) = default_trap; 335void (*cpu_lpmc) (int code, struct pt_regs *regs) __read_mostly = default_trap;
340 336
341 337
342void transfer_pim_to_trap_frame(struct pt_regs *regs) 338void transfer_pim_to_trap_frame(struct pt_regs *regs)
@@ -554,7 +550,8 @@ void handle_interruption(int code, struct pt_regs *regs)
554 /* Low-priority machine check */ 550 /* Low-priority machine check */
555 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_LPMC); 551 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_LPMC);
556 552
557 flush_all_caches(); 553 flush_cache_all();
554 flush_tlb_all();
558 cpu_lpmc(5, regs); 555 cpu_lpmc(5, regs);
559 return; 556 return;
560 557
@@ -572,7 +569,7 @@ void handle_interruption(int code, struct pt_regs *regs)
572 569
573 case 9: 570 case 9:
574 /* Break instruction trap */ 571 /* Break instruction trap */
575 handle_break(regs->iir,regs); 572 handle_break(regs);
576 return; 573 return;
577 574
578 case 10: 575 case 10:
@@ -840,7 +837,7 @@ int __init check_ivt(void *iva)
840 return 0; 837 return 0;
841} 838}
842 839
843#ifndef __LP64__ 840#ifndef CONFIG_64BIT
844extern const void fault_vector_11; 841extern const void fault_vector_11;
845#endif 842#endif
846extern const void fault_vector_20; 843extern const void fault_vector_20;
@@ -852,7 +849,7 @@ void __init trap_init(void)
852 if (boot_cpu_data.cpu_type >= pcxu) 849 if (boot_cpu_data.cpu_type >= pcxu)
853 iva = (void *) &fault_vector_20; 850 iva = (void *) &fault_vector_20;
854 else 851 else
855#ifdef __LP64__ 852#ifdef CONFIG_64BIT
856 panic("Can't boot 64-bit OS on PA1.1 processor!"); 853 panic("Can't boot 64-bit OS on PA1.1 processor!");
857#else 854#else
858 iva = (void *) &fault_vector_11; 855 iva = (void *) &fault_vector_11;
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index bd2230d6a2a6..347bb922e6d0 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -20,8 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include <linux/jiffies.h>
23#include <linux/kernel.h> 24#include <linux/kernel.h>
24#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/sched.h>
27#include <linux/signal.h>
25#include <asm/uaccess.h> 28#include <asm/uaccess.h>
26 29
27/* #define DEBUG_UNALIGNED 1 */ 30/* #define DEBUG_UNALIGNED 1 */
@@ -32,7 +35,7 @@
32#define DPRINTF(fmt, args...) 35#define DPRINTF(fmt, args...)
33#endif 36#endif
34 37
35#ifdef __LP64__ 38#ifdef CONFIG_64BIT
36#define RFMT "%016lx" 39#define RFMT "%016lx"
37#else 40#else
38#define RFMT "%08lx" 41#define RFMT "%08lx"
@@ -147,15 +150,8 @@ static int emulate_ldh(struct pt_regs *regs, int toreg)
147"4: ldi -2, %1\n" 150"4: ldi -2, %1\n"
148 FIXUP_BRANCH(3b) 151 FIXUP_BRANCH(3b)
149" .previous\n" 152" .previous\n"
150" .section __ex_table,\"aw\"\n" 153 ASM_EXCEPTIONTABLE_ENTRY(1b, 4b)
151#ifdef __LP64__ 154 ASM_EXCEPTIONTABLE_ENTRY(2b, 4b)
152" .dword 1b,4b\n"
153" .dword 2b,4b\n"
154#else
155" .word 1b,4b\n"
156" .word 2b,4b\n"
157#endif
158" .previous\n"
159 : "=r" (val), "=r" (ret) 155 : "=r" (val), "=r" (ret)
160 : "0" (val), "r" (saddr), "r" (regs->isr) 156 : "0" (val), "r" (saddr), "r" (regs->isr)
161 : "r20", FIXUP_BRANCH_CLOBBER ); 157 : "r20", FIXUP_BRANCH_CLOBBER );
@@ -192,15 +188,8 @@ static int emulate_ldw(struct pt_regs *regs, int toreg, int flop)
192"4: ldi -2, %1\n" 188"4: ldi -2, %1\n"
193 FIXUP_BRANCH(3b) 189 FIXUP_BRANCH(3b)
194" .previous\n" 190" .previous\n"
195" .section __ex_table,\"aw\"\n" 191 ASM_EXCEPTIONTABLE_ENTRY(1b, 4b)
196#ifdef __LP64__ 192 ASM_EXCEPTIONTABLE_ENTRY(2b, 4b)
197" .dword 1b,4b\n"
198" .dword 2b,4b\n"
199#else
200" .word 1b,4b\n"
201" .word 2b,4b\n"
202#endif
203" .previous\n"
204 : "=r" (val), "=r" (ret) 193 : "=r" (val), "=r" (ret)
205 : "0" (val), "r" (saddr), "r" (regs->isr) 194 : "0" (val), "r" (saddr), "r" (regs->isr)
206 : "r19", "r20", FIXUP_BRANCH_CLOBBER ); 195 : "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -224,7 +213,7 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
224 regs->isr, regs->ior, toreg); 213 regs->isr, regs->ior, toreg);
225#ifdef CONFIG_PA20 214#ifdef CONFIG_PA20
226 215
227#ifndef __LP64__ 216#ifndef CONFIG_64BIT
228 if (!flop) 217 if (!flop)
229 return -1; 218 return -1;
230#endif 219#endif
@@ -243,15 +232,8 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
243"4: ldi -2, %1\n" 232"4: ldi -2, %1\n"
244 FIXUP_BRANCH(3b) 233 FIXUP_BRANCH(3b)
245" .previous\n" 234" .previous\n"
246" .section __ex_table,\"aw\"\n" 235 ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
247#ifdef __LP64__ 236 ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
248" .dword 1b,4b\n"
249" .dword 2b,4b\n"
250#else
251" .word 1b,4b\n"
252" .word 2b,4b\n"
253#endif
254" .previous\n"
255 : "=r" (val), "=r" (ret) 237 : "=r" (val), "=r" (ret)
256 : "0" (val), "r" (saddr), "r" (regs->isr) 238 : "0" (val), "r" (saddr), "r" (regs->isr)
257 : "r19", "r20", FIXUP_BRANCH_CLOBBER ); 239 : "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -275,17 +257,9 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
275"5: ldi -2, %2\n" 257"5: ldi -2, %2\n"
276 FIXUP_BRANCH(4b) 258 FIXUP_BRANCH(4b)
277" .previous\n" 259" .previous\n"
278" .section __ex_table,\"aw\"\n" 260 ASM_EXCEPTIONTABLE_ENTRY(1b,5b)
279#ifdef __LP64__ 261 ASM_EXCEPTIONTABLE_ENTRY(2b,5b)
280" .dword 1b,5b\n" 262 ASM_EXCEPTIONTABLE_ENTRY(3b,5b)
281" .dword 2b,5b\n"
282" .dword 3b,5b\n"
283#else
284" .word 1b,5b\n"
285" .word 2b,5b\n"
286" .word 3b,5b\n"
287#endif
288" .previous\n"
289 : "=r" (valh), "=r" (vall), "=r" (ret) 263 : "=r" (valh), "=r" (vall), "=r" (ret)
290 : "0" (valh), "1" (vall), "r" (saddr), "r" (regs->isr) 264 : "0" (valh), "1" (vall), "r" (saddr), "r" (regs->isr)
291 : "r19", "r20", FIXUP_BRANCH_CLOBBER ); 265 : "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -325,15 +299,8 @@ static int emulate_sth(struct pt_regs *regs, int frreg)
325"4: ldi -2, %0\n" 299"4: ldi -2, %0\n"
326 FIXUP_BRANCH(3b) 300 FIXUP_BRANCH(3b)
327" .previous\n" 301" .previous\n"
328" .section __ex_table,\"aw\"\n" 302 ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
329#ifdef __LP64__ 303 ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
330" .dword 1b,4b\n"
331" .dword 2b,4b\n"
332#else
333" .word 1b,4b\n"
334" .word 2b,4b\n"
335#endif
336" .previous\n"
337 : "=r" (ret) 304 : "=r" (ret)
338 : "r" (val), "r" (regs->ior), "r" (regs->isr) 305 : "r" (val), "r" (regs->ior), "r" (regs->isr)
339 : "r19", FIXUP_BRANCH_CLOBBER ); 306 : "r19", FIXUP_BRANCH_CLOBBER );
@@ -379,15 +346,8 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop)
379"4: ldi -2, %0\n" 346"4: ldi -2, %0\n"
380 FIXUP_BRANCH(3b) 347 FIXUP_BRANCH(3b)
381" .previous\n" 348" .previous\n"
382" .section __ex_table,\"aw\"\n" 349 ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
383#ifdef __LP64__ 350 ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
384" .dword 1b,4b\n"
385" .dword 2b,4b\n"
386#else
387" .word 1b,4b\n"
388" .word 2b,4b\n"
389#endif
390" .previous\n"
391 : "=r" (ret) 351 : "=r" (ret)
392 : "r" (val), "r" (regs->ior), "r" (regs->isr) 352 : "r" (val), "r" (regs->ior), "r" (regs->isr)
393 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER ); 353 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
@@ -410,7 +370,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
410 val, regs->isr, regs->ior); 370 val, regs->isr, regs->ior);
411 371
412#ifdef CONFIG_PA20 372#ifdef CONFIG_PA20
413#ifndef __LP64__ 373#ifndef CONFIG_64BIT
414 if (!flop) 374 if (!flop)
415 return -1; 375 return -1;
416#endif 376#endif
@@ -436,19 +396,10 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
436"6: ldi -2, %0\n" 396"6: ldi -2, %0\n"
437 FIXUP_BRANCH(5b) 397 FIXUP_BRANCH(5b)
438" .previous\n" 398" .previous\n"
439" .section __ex_table,\"aw\"\n" 399 ASM_EXCEPTIONTABLE_ENTRY(1b,6b)
440#ifdef __LP64__ 400 ASM_EXCEPTIONTABLE_ENTRY(2b,6b)
441" .dword 1b,6b\n" 401 ASM_EXCEPTIONTABLE_ENTRY(3b,6b)
442" .dword 2b,6b\n" 402 ASM_EXCEPTIONTABLE_ENTRY(4b,6b)
443" .dword 3b,6b\n"
444" .dword 4b,6b\n"
445#else
446" .word 1b,6b\n"
447" .word 2b,6b\n"
448" .word 3b,6b\n"
449" .word 4b,6b\n"
450#endif
451" .previous\n"
452 : "=r" (ret) 403 : "=r" (ret)
453 : "r" (val), "r" (regs->ior), "r" (regs->isr) 404 : "r" (val), "r" (regs->ior), "r" (regs->isr)
454 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER ); 405 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
@@ -479,21 +430,11 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
479"7: ldi -2, %0\n" 430"7: ldi -2, %0\n"
480 FIXUP_BRANCH(6b) 431 FIXUP_BRANCH(6b)
481" .previous\n" 432" .previous\n"
482" .section __ex_table,\"aw\"\n" 433 ASM_EXCEPTIONTABLE_ENTRY(1b,7b)
483#ifdef __LP64__ 434 ASM_EXCEPTIONTABLE_ENTRY(2b,7b)
484" .dword 1b,7b\n" 435 ASM_EXCEPTIONTABLE_ENTRY(3b,7b)
485" .dword 2b,7b\n" 436 ASM_EXCEPTIONTABLE_ENTRY(4b,7b)
486" .dword 3b,7b\n" 437 ASM_EXCEPTIONTABLE_ENTRY(5b,7b)
487" .dword 4b,7b\n"
488" .dword 5b,7b\n"
489#else
490" .word 1b,7b\n"
491" .word 2b,7b\n"
492" .word 3b,7b\n"
493" .word 4b,7b\n"
494" .word 5b,7b\n"
495#endif
496" .previous\n"
497 : "=r" (ret) 438 : "=r" (ret)
498 : "r" (valh), "r" (vall), "r" (regs->ior), "r" (regs->isr) 439 : "r" (valh), "r" (vall), "r" (regs->ior), "r" (regs->isr)
499 : "r19", "r20", "r21", "r1", FIXUP_BRANCH_CLOBBER ); 440 : "r19", "r20", "r21", "r1", FIXUP_BRANCH_CLOBBER );
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
index c10ab47d81fa..5f75b3e65986 100644
--- a/arch/parisc/kernel/unwind.c
+++ b/arch/parisc/kernel/unwind.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/sched.h>
13#include <linux/slab.h> 14#include <linux/slab.h>
14#include <linux/kallsyms.h> 15#include <linux/kallsyms.h>
15 16
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 3b78c2794c36..2a8253358c6c 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -68,6 +68,8 @@ SECTIONS
68 68
69 RODATA 69 RODATA
70 70
71 BUG_TABLE
72
71 /* writeable */ 73 /* writeable */
72 . = ALIGN(ASM_PAGE_SIZE); /* Make sure this is page aligned so 74 . = ALIGN(ASM_PAGE_SIZE); /* Make sure this is page aligned so
73 that we can properly leave these 75 that we can properly leave these
diff --git a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c
index f352666b5b2f..e3eb739fab19 100644
--- a/arch/parisc/lib/bitops.c
+++ b/arch/parisc/lib/bitops.c
@@ -17,7 +17,7 @@ raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = {
17}; 17};
18#endif 18#endif
19 19
20#ifdef __LP64__ 20#ifdef CONFIG_64BIT
21unsigned long __xchg64(unsigned long x, unsigned long *ptr) 21unsigned long __xchg64(unsigned long x, unsigned long *ptr)
22{ 22{
23 unsigned long temp, flags; 23 unsigned long temp, flags;
@@ -56,7 +56,7 @@ unsigned long __xchg8(char x, char *ptr)
56} 56}
57 57
58 58
59#ifdef __LP64__ 59#ifdef CONFIG_64BIT
60unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old, unsigned long new) 60unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old, unsigned long new)
61{ 61{
62 unsigned long flags; 62 unsigned long flags;
diff --git a/arch/parisc/lib/fixup.S b/arch/parisc/lib/fixup.S
index ecce3d35401f..d172d4245cdc 100644
--- a/arch/parisc/lib/fixup.S
+++ b/arch/parisc/lib/fixup.S
@@ -22,6 +22,7 @@
22#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
23#include <asm/assembly.h> 23#include <asm/assembly.h>
24#include <asm/errno.h> 24#include <asm/errno.h>
25#include <linux/linkage.h>
25 26
26#ifdef CONFIG_SMP 27#ifdef CONFIG_SMP
27 .macro get_fault_ip t1 t2 28 .macro get_fault_ip t1 t2
@@ -30,7 +31,7 @@
30 /* t2 = smp_processor_id() */ 31 /* t2 = smp_processor_id() */
31 mfctl 30,\t2 32 mfctl 30,\t2
32 ldw TI_CPU(\t2),\t2 33 ldw TI_CPU(\t2),\t2
33#ifdef __LP64__ 34#ifdef CONFIG_64BIT
34 extrd,u \t2,63,32,\t2 35 extrd,u \t2,63,32,\t2
35#endif 36#endif
36 /* t2 = &__per_cpu_offset[smp_processor_id()]; */ 37 /* t2 = &__per_cpu_offset[smp_processor_id()]; */
@@ -58,33 +59,34 @@
58 .section .fixup, "ax" 59 .section .fixup, "ax"
59 60
60 /* get_user() fixups, store -EFAULT in r8, and 0 in r9 */ 61 /* get_user() fixups, store -EFAULT in r8, and 0 in r9 */
61 .export fixup_get_user_skip_1 62ENTRY(fixup_get_user_skip_1)
62fixup_get_user_skip_1:
63 get_fault_ip %r1,%r8 63 get_fault_ip %r1,%r8
64 ldo 4(%r1), %r1 64 ldo 4(%r1), %r1
65 ldi -EFAULT, %r8 65 ldi -EFAULT, %r8
66 bv %r0(%r1) 66 bv %r0(%r1)
67 copy %r0, %r9 67 copy %r0, %r9
68ENDPROC(fixup_get_user_skip_1)
68 69
69 .export fixup_get_user_skip_2 70ENTRY(fixup_get_user_skip_2)
70fixup_get_user_skip_2:
71 get_fault_ip %r1,%r8 71 get_fault_ip %r1,%r8
72 ldo 8(%r1), %r1 72 ldo 8(%r1), %r1
73 ldi -EFAULT, %r8 73 ldi -EFAULT, %r8
74 bv %r0(%r1) 74 bv %r0(%r1)
75 copy %r0, %r9 75 copy %r0, %r9
76ENDPROC(fixup_get_user_skip_2)
76 77
77 /* put_user() fixups, store -EFAULT in r8 */ 78 /* put_user() fixups, store -EFAULT in r8 */
78 .export fixup_put_user_skip_1 79ENTRY(fixup_put_user_skip_1)
79fixup_put_user_skip_1:
80 get_fault_ip %r1,%r8 80 get_fault_ip %r1,%r8
81 ldo 4(%r1), %r1 81 ldo 4(%r1), %r1
82 bv %r0(%r1) 82 bv %r0(%r1)
83 ldi -EFAULT, %r8 83 ldi -EFAULT, %r8
84ENDPROC(fixup_put_user_skip_1)
84 85
85 .export fixup_put_user_skip_2 86ENTRY(fixup_put_user_skip_2)
86fixup_put_user_skip_2:
87 get_fault_ip %r1,%r8 87 get_fault_ip %r1,%r8
88 ldo 8(%r1), %r1 88 ldo 8(%r1), %r1
89 bv %r0(%r1) 89 bv %r0(%r1)
90 ldi -EFAULT, %r8 90 ldi -EFAULT, %r8
91ENDPROC(fixup_put_user_skip_2)
92
diff --git a/arch/parisc/lib/lusercopy.S b/arch/parisc/lib/lusercopy.S
index a0509855c9a7..1bd23ccec17b 100644
--- a/arch/parisc/lib/lusercopy.S
+++ b/arch/parisc/lib/lusercopy.S
@@ -37,6 +37,7 @@
37 37
38#include <asm/assembly.h> 38#include <asm/assembly.h>
39#include <asm/errno.h> 39#include <asm/errno.h>
40#include <linux/linkage.h>
40 41
41 /* 42 /*
42 * get_sr gets the appropriate space value into 43 * get_sr gets the appropriate space value into
@@ -67,8 +68,7 @@
67 * otherwise strlen (i.e. excludes zero byte) 68 * otherwise strlen (i.e. excludes zero byte)
68 */ 69 */
69 70
70 .export lstrncpy_from_user,code 71ENTRY(lstrncpy_from_user)
71lstrncpy_from_user:
72 .proc 72 .proc
73 .callinfo NO_CALLS 73 .callinfo NO_CALLS
74 .entry 74 .entry
@@ -87,6 +87,7 @@ $lsfu_exit:
87 bv %r0(%r2) 87 bv %r0(%r2)
88 nop 88 nop
89 .exit 89 .exit
90ENDPROC(lstrncpy_from_user)
90 91
91 .section .fixup,"ax" 92 .section .fixup,"ax"
923: fixup_branch $lsfu_exit 933: fixup_branch $lsfu_exit
@@ -94,13 +95,8 @@ $lsfu_exit:
94 .previous 95 .previous
95 96
96 .section __ex_table,"aw" 97 .section __ex_table,"aw"
97#ifdef __LP64__ 98 ASM_ULONG_INSN 1b,3b
98 .dword 1b,3b 99 ASM_ULONG_INSN 2b,3b
99 .dword 2b,3b
100#else
101 .word 1b,3b
102 .word 2b,3b
103#endif
104 .previous 100 .previous
105 101
106 .procend 102 .procend
@@ -112,8 +108,7 @@ $lsfu_exit:
112 * otherwise, returns number of bytes not transferred. 108 * otherwise, returns number of bytes not transferred.
113 */ 109 */
114 110
115 .export lclear_user,code 111ENTRY(lclear_user)
116lclear_user:
117 .proc 112 .proc
118 .callinfo NO_CALLS 113 .callinfo NO_CALLS
119 .entry 114 .entry
@@ -127,6 +122,7 @@ $lclu_done:
127 bv %r0(%r2) 122 bv %r0(%r2)
128 copy %r25,%r28 123 copy %r25,%r28
129 .exit 124 .exit
125ENDPROC(lclear_user)
130 126
131 .section .fixup,"ax" 127 .section .fixup,"ax"
1322: fixup_branch $lclu_done 1282: fixup_branch $lclu_done
@@ -134,11 +130,7 @@ $lclu_done:
134 .previous 130 .previous
135 131
136 .section __ex_table,"aw" 132 .section __ex_table,"aw"
137#ifdef __LP64__ 133 ASM_ULONG_INSN 1b,2b
138 .dword 1b,2b
139#else
140 .word 1b,2b
141#endif
142 .previous 134 .previous
143 135
144 .procend 136 .procend
@@ -151,8 +143,7 @@ $lclu_done:
151 * else strlen + 1 (i.e. includes zero byte). 143 * else strlen + 1 (i.e. includes zero byte).
152 */ 144 */
153 145
154 .export lstrnlen_user,code 146ENTRY(lstrnlen_user)
155lstrnlen_user:
156 .proc 147 .proc
157 .callinfo NO_CALLS 148 .callinfo NO_CALLS
158 .entry 149 .entry
@@ -172,6 +163,7 @@ $lslen_done:
172$lslen_nzero: 163$lslen_nzero:
173 b $lslen_done 164 b $lslen_done
174 ldo 1(%r26),%r26 /* special case for N == 0 */ 165 ldo 1(%r26),%r26 /* special case for N == 0 */
166ENDPROC(lstrnlen_user)
175 167
176 .section .fixup,"ax" 168 .section .fixup,"ax"
1773: fixup_branch $lslen_done 1693: fixup_branch $lslen_done
@@ -179,13 +171,8 @@ $lslen_nzero:
179 .previous 171 .previous
180 172
181 .section __ex_table,"aw" 173 .section __ex_table,"aw"
182#ifdef __LP64__ 174 ASM_ULONG_INSN 1b,3b
183 .dword 1b,3b 175 ASM_ULONG_INSN 2b,3b
184 .dword 2b,3b
185#else
186 .word 1b,3b
187 .word 2b,3b
188#endif
189 .previous 176 .previous
190 177
191 .procend 178 .procend
diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
index 5575e41f9d60..2c43ebe99a9c 100644
--- a/arch/parisc/lib/memcpy.c
+++ b/arch/parisc/lib/memcpy.c
@@ -96,30 +96,18 @@ DECLARE_PER_CPU(struct exception_data, exception_data);
96#define DPRINTF(fmt, args...) 96#define DPRINTF(fmt, args...)
97#endif 97#endif
98 98
99#ifndef __LP64__
100#define EXC_WORD ".word"
101#else
102#define EXC_WORD ".dword"
103#endif
104
105#define def_load_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \ 99#define def_load_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \
106 __asm__ __volatile__ ( \ 100 __asm__ __volatile__ ( \
107 "1:\t" #_insn ",ma " #_sz "(" _s ",%1), %0\n" \ 101 "1:\t" #_insn ",ma " #_sz "(" _s ",%1), %0\n\t" \
108 "\t.section __ex_table,\"aw\"\n" \ 102 ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \
109 "\t" EXC_WORD "\t1b\n" \
110 "\t" EXC_WORD "\t" #_e "\n" \
111 "\t.previous\n" \
112 : _tt(_t), "+r"(_a) \ 103 : _tt(_t), "+r"(_a) \
113 : \ 104 : \
114 : "r8") 105 : "r8")
115 106
116#define def_store_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \ 107#define def_store_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \
117 __asm__ __volatile__ ( \ 108 __asm__ __volatile__ ( \
118 "1:\t" #_insn ",ma %1, " #_sz "(" _s ",%0)\n" \ 109 "1:\t" #_insn ",ma %1, " #_sz "(" _s ",%0)\n\t" \
119 "\t.section __ex_table,\"aw\"\n" \ 110 ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \
120 "\t" EXC_WORD "\t1b\n" \
121 "\t" EXC_WORD "\t" #_e "\n" \
122 "\t.previous\n" \
123 : "+r"(_a) \ 111 : "+r"(_a) \
124 : _tt(_t) \ 112 : _tt(_t) \
125 : "r8") 113 : "r8")
@@ -133,22 +121,16 @@ DECLARE_PER_CPU(struct exception_data, exception_data);
133 121
134#define def_load_insn(_insn,_tt,_s,_o,_a,_t,_e) \ 122#define def_load_insn(_insn,_tt,_s,_o,_a,_t,_e) \
135 __asm__ __volatile__ ( \ 123 __asm__ __volatile__ ( \
136 "1:\t" #_insn " " #_o "(" _s ",%1), %0\n" \ 124 "1:\t" #_insn " " #_o "(" _s ",%1), %0\n\t" \
137 "\t.section __ex_table,\"aw\"\n" \ 125 ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \
138 "\t" EXC_WORD "\t1b\n" \
139 "\t" EXC_WORD "\t" #_e "\n" \
140 "\t.previous\n" \
141 : _tt(_t) \ 126 : _tt(_t) \
142 : "r"(_a) \ 127 : "r"(_a) \
143 : "r8") 128 : "r8")
144 129
145#define def_store_insn(_insn,_tt,_s,_t,_o,_a,_e) \ 130#define def_store_insn(_insn,_tt,_s,_t,_o,_a,_e) \
146 __asm__ __volatile__ ( \ 131 __asm__ __volatile__ ( \
147 "1:\t" #_insn " %0, " #_o "(" _s ",%1)\n" \ 132 "1:\t" #_insn " %0, " #_o "(" _s ",%1)\n\t" \
148 "\t.section __ex_table,\"aw\"\n" \ 133 ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \
149 "\t" EXC_WORD "\t1b\n" \
150 "\t" EXC_WORD "\t" #_e "\n" \
151 "\t.previous\n" \
152 : \ 134 : \
153 : _tt(_t), "r"(_a) \ 135 : _tt(_t), "r"(_a) \
154 : "r8") 136 : "r8")
@@ -167,8 +149,8 @@ extern inline void prefetch_dst(const void *addr)
167 __asm__("ldd 0(" d_space ",%0), %%r0" : : "r" (addr)); 149 __asm__("ldd 0(" d_space ",%0), %%r0" : : "r" (addr));
168} 150}
169#else 151#else
170#define prefetch_src(addr) 152#define prefetch_src(addr) do { } while(0)
171#define prefetch_dst(addr) 153#define prefetch_dst(addr) do { } while(0)
172#endif 154#endif
173 155
174/* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words 156/* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 641f9c920eee..f6f67554c623 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -24,10 +24,6 @@
24 /* dumped to the console via printk) */ 24 /* dumped to the console via printk) */
25 25
26 26
27/* Defines for parisc_acctyp() */
28#define READ 0
29#define WRITE 1
30
31/* Various important other fields */ 27/* Various important other fields */
32#define bit22set(x) (x & 0x00000200) 28#define bit22set(x) (x & 0x00000200)
33#define bits23_25set(x) (x & 0x000001c0) 29#define bits23_25set(x) (x & 0x000001c0)
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 12117db0043b..75ea9f2a8a41 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -6,7 +6,7 @@
6 * changed by Philipp Rumpf 6 * changed by Philipp Rumpf
7 * Copyright 1999 Philipp Rumpf (prumpf@tux.org) 7 * Copyright 1999 Philipp Rumpf (prumpf@tux.org)
8 * Copyright 2004 Randolph Chung (tausq@debian.org) 8 * Copyright 2004 Randolph Chung (tausq@debian.org)
9 * Copyright 2006 Helge Deller (deller@gmx.de) 9 * Copyright 2006-2007 Helge Deller (deller@gmx.de)
10 * 10 *
11 */ 11 */
12 12
@@ -24,6 +24,7 @@
24#include <linux/pagemap.h> /* for release_pages and page_cache_release */ 24#include <linux/pagemap.h> /* for release_pages and page_cache_release */
25 25
26#include <asm/pgalloc.h> 26#include <asm/pgalloc.h>
27#include <asm/pgtable.h>
27#include <asm/tlb.h> 28#include <asm/tlb.h>
28#include <asm/pdc_chassis.h> 29#include <asm/pdc_chassis.h>
29#include <asm/mmzone.h> 30#include <asm/mmzone.h>
@@ -65,11 +66,11 @@ static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly;
65physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly; 66physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly;
66int npmem_ranges __read_mostly; 67int npmem_ranges __read_mostly;
67 68
68#ifdef __LP64__ 69#ifdef CONFIG_64BIT
69#define MAX_MEM (~0UL) 70#define MAX_MEM (~0UL)
70#else /* !__LP64__ */ 71#else /* !CONFIG_64BIT */
71#define MAX_MEM (3584U*1024U*1024U) 72#define MAX_MEM (3584U*1024U*1024U)
72#endif /* !__LP64__ */ 73#endif /* !CONFIG_64BIT */
73 74
74static unsigned long mem_limit __read_mostly = MAX_MEM; 75static unsigned long mem_limit __read_mostly = MAX_MEM;
75 76
@@ -452,6 +453,8 @@ unsigned long pcxl_dma_start __read_mostly;
452 453
453void __init mem_init(void) 454void __init mem_init(void)
454{ 455{
456 int codesize, reservedpages, datasize, initsize;
457
455 high_memory = __va((max_pfn << PAGE_SHIFT)); 458 high_memory = __va((max_pfn << PAGE_SHIFT));
456 459
457#ifndef CONFIG_DISCONTIGMEM 460#ifndef CONFIG_DISCONTIGMEM
@@ -466,7 +469,32 @@ void __init mem_init(void)
466 } 469 }
467#endif 470#endif
468 471
469 printk(KERN_INFO "Memory: %luk available\n", num_physpages << (PAGE_SHIFT-10)); 472 codesize = (unsigned long)_etext - (unsigned long)_text;
473 datasize = (unsigned long)_edata - (unsigned long)_etext;
474 initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
475
476 reservedpages = 0;
477{
478 unsigned long pfn;
479#ifdef CONFIG_DISCONTIGMEM
480 int i;
481
482 for (i = 0; i < npmem_ranges; i++) {
483 for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) {
484 if (PageReserved(pfn_to_page(pfn)))
485 reservedpages++;
486 }
487 }
488#else /* !CONFIG_DISCONTIGMEM */
489 for (pfn = 0; pfn < max_pfn; pfn++) {
490 /*
491 * Only count reserved RAM pages
492 */
493 if (PageReserved(pfn_to_page(pfn)))
494 reservedpages++;
495 }
496#endif
497}
470 498
471#ifdef CONFIG_PA11 499#ifdef CONFIG_PA11
472 if (hppa_dma_ops == &pcxl_dma_ops) { 500 if (hppa_dma_ops == &pcxl_dma_ops) {
@@ -480,6 +508,38 @@ void __init mem_init(void)
480 vmalloc_start = SET_MAP_OFFSET(MAP_START); 508 vmalloc_start = SET_MAP_OFFSET(MAP_START);
481#endif 509#endif
482 510
511 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
512 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
513 num_physpages << (PAGE_SHIFT-10),
514 codesize >> 10,
515 reservedpages << (PAGE_SHIFT-10),
516 datasize >> 10,
517 initsize >> 10
518 );
519
520#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */
521 printk("virtual kernel memory layout:\n"
522 " vmalloc : 0x%p - 0x%p (%4ld MB)\n"
523 " memory : 0x%p - 0x%p (%4ld MB)\n"
524 " .init : 0x%p - 0x%p (%4ld kB)\n"
525 " .data : 0x%p - 0x%p (%4ld kB)\n"
526 " .text : 0x%p - 0x%p (%4ld kB)\n",
527
528 (void*)VMALLOC_START, (void*)VMALLOC_END,
529 (VMALLOC_END - VMALLOC_START) >> 20,
530
531 __va(0), high_memory,
532 ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
533
534 __init_begin, __init_end,
535 ((unsigned long)__init_end - (unsigned long)__init_begin) >> 10,
536
537 _etext, _edata,
538 ((unsigned long)_edata - (unsigned long)_etext) >> 10,
539
540 _text, _etext,
541 ((unsigned long)_etext - (unsigned long)_text) >> 10);
542#endif
483} 543}
484 544
485unsigned long *empty_zero_page __read_mostly; 545unsigned long *empty_zero_page __read_mostly;
@@ -547,7 +607,7 @@ void show_mem(void)
547 607
548 printk("Zone list for zone %d on node %d: ", j, i); 608 printk("Zone list for zone %d on node %d: ", j, i);
549 for (k = 0; zl->zones[k] != NULL; k++) 609 for (k = 0; zl->zones[k] != NULL; k++)
550 printk("[%d/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name); 610 printk("[%ld/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name);
551 printk("\n"); 611 printk("\n");
552 } 612 }
553 } 613 }
diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c
index 44b42c7f639d..92d496ad07c9 100644
--- a/arch/parisc/mm/ioremap.c
+++ b/arch/parisc/mm/ioremap.c
@@ -26,7 +26,7 @@
26 */ 26 */
27void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) 27void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
28{ 28{
29 void *addr; 29 void __iomem *addr;
30 struct vm_struct *area; 30 struct vm_struct *area;
31 unsigned long offset, last_addr; 31 unsigned long offset, last_addr;
32 pgprot_t pgprot; 32 pgprot_t pgprot;
@@ -80,14 +80,14 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
80 if (!area) 80 if (!area)
81 return NULL; 81 return NULL;
82 82
83 addr = area->addr; 83 addr = (void __iomem *) area->addr;
84 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, 84 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
85 phys_addr, pgprot)) { 85 phys_addr, pgprot)) {
86 vfree(addr); 86 vfree(addr);
87 return NULL; 87 return NULL;
88 } 88 }
89 89
90 return (void __iomem *) (offset + (char *)addr); 90 return (void __iomem *) (offset + (char __iomem *)addr);
91} 91}
92EXPORT_SYMBOL(__ioremap); 92EXPORT_SYMBOL(__ioremap);
93 93
diff --git a/arch/parisc/mm/kmap.c b/arch/parisc/mm/kmap.c
deleted file mode 100644
index 1b1acd5e2f6e..000000000000
--- a/arch/parisc/mm/kmap.c
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * kmap/page table map and unmap support routines
3 *
4 * Copyright 1999,2000 Hewlett-Packard Company
5 * Copyright 2000 John Marvin <jsm at hp.com>
6 * Copyright 2000 Grant Grundler <grundler at parisc-linux.org>
7 * Copyright 2000 Philipp Rumpf <prumpf@tux.org>
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24/*
25** Stolen mostly from arch/parisc/kernel/pci-dma.c
26*/
27
28#include <linux/types.h>
29#include <linux/mm.h>
30#include <linux/string.h>
31#include <linux/pci.h>
32
33#include <linux/slab.h>
34#include <linux/vmalloc.h>
35
36#include <asm/uaccess.h>
37#include <asm/pgalloc.h>
38
39#include <asm/io.h>
40#include <asm/page.h> /* get_order */
41
42#undef flush_cache_all
43#define flush_cache_all flush_all_caches
44
45typedef void (*pte_iterator_t) (pte_t * pte, unsigned long arg);
46
47#if 0
48/* XXX This routine could be used with iterate_page() to replace
49 * unmap_uncached_page() and save a little code space but I didn't
50 * do that since I'm not certain whether this is the right path. -PB
51 */
52static void unmap_cached_pte(pte_t * pte, unsigned long addr, unsigned long arg)
53{
54 pte_t page = *pte;
55 pte_clear(&init_mm, addr, pte);
56 if (!pte_none(page)) {
57 if (pte_present(page)) {
58 unsigned long map_nr = pte_pagenr(page);
59 if (map_nr < max_mapnr)
60 __free_page(mem_map + map_nr);
61 } else {
62 printk(KERN_CRIT
63 "Whee.. Swapped out page in kernel page table\n");
64 }
65 }
66}
67#endif
68
69/* These two routines should probably check a few things... */
70static void set_uncached(pte_t * pte, unsigned long arg)
71{
72 pte_val(*pte) |= _PAGE_NO_CACHE;
73}
74
75static void set_cached(pte_t * pte, unsigned long arg)
76{
77 pte_val(*pte) &= ~_PAGE_NO_CACHE;
78}
79
80static inline void iterate_pte(pmd_t * pmd, unsigned long address,
81 unsigned long size, pte_iterator_t op,
82 unsigned long arg)
83{
84 pte_t *pte;
85 unsigned long end;
86
87 if (pmd_none(*pmd))
88 return;
89 if (pmd_bad(*pmd)) {
90 pmd_ERROR(*pmd);
91 pmd_clear(pmd);
92 return;
93 }
94 pte = pte_offset(pmd, address);
95 address &= ~PMD_MASK;
96 end = address + size;
97 if (end > PMD_SIZE)
98 end = PMD_SIZE;
99 do {
100 op(pte, arg);
101 address += PAGE_SIZE;
102 pte++;
103 } while (address < end);
104}
105
106static inline void iterate_pmd(pgd_t * dir, unsigned long address,
107 unsigned long size, pte_iterator_t op,
108 unsigned long arg)
109{
110 pmd_t *pmd;
111 unsigned long end;
112
113 if (pgd_none(*dir))
114 return;
115 if (pgd_bad(*dir)) {
116 pgd_ERROR(*dir);
117 pgd_clear(dir);
118 return;
119 }
120 pmd = pmd_offset(dir, address);
121 address &= ~PGDIR_MASK;
122 end = address + size;
123 if (end > PGDIR_SIZE)
124 end = PGDIR_SIZE;
125 do {
126 iterate_pte(pmd, address, end - address, op, arg);
127 address = (address + PMD_SIZE) & PMD_MASK;
128 pmd++;
129 } while (address < end);
130}
131
132static void iterate_pages(unsigned long address, unsigned long size,
133 pte_iterator_t op, unsigned long arg)
134{
135 pgd_t *dir;
136 unsigned long end = address + size;
137
138 dir = pgd_offset_k(address);
139 flush_cache_all();
140 do {
141 iterate_pmd(dir, address, end - address, op, arg);
142 address = (address + PGDIR_SIZE) & PGDIR_MASK;
143 dir++;
144 } while (address && (address < end));
145 flush_tlb_all();
146}
147
148void
149kernel_set_cachemode(unsigned long vaddr, unsigned long size, int what)
150{
151 switch (what) {
152 case IOMAP_FULL_CACHING:
153 iterate_pages(vaddr, size, set_cached, 0);
154 flush_tlb_range(NULL, vaddr, size);
155 break;
156 case IOMAP_NOCACHE_SER:
157 iterate_pages(vaddr, size, set_uncached, 0);
158 flush_tlb_range(NULL, vaddr, size);
159 break;
160 default:
161 printk(KERN_CRIT
162 "kernel_set_cachemode mode %d not understood\n",
163 what);
164 break;
165 }
166}
diff --git a/arch/parisc/oprofile/init.c b/arch/parisc/oprofile/init.c
index a5b898c4d0b0..113f5139f551 100644
--- a/arch/parisc/oprofile/init.c
+++ b/arch/parisc/oprofile/init.c
@@ -18,6 +18,6 @@ int __init oprofile_arch_init(struct oprofile_operations * ops)
18} 18}
19 19
20 20
21void oprofile_arch_exit() 21void oprofile_arch_exit(void)
22{ 22{
23} 23}
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index 36d07e3635c6..3c8f3d633625 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -236,7 +236,7 @@ static int __init
236agp_ioc_init(void __iomem *ioc_regs) 236agp_ioc_init(void __iomem *ioc_regs)
237{ 237{
238 struct _parisc_agp_info *info = &parisc_agp_info; 238 struct _parisc_agp_info *info = &parisc_agp_info;
239 u64 *iova_base, *io_pdir, io_tlb_ps; 239 u64 iova_base, *io_pdir, io_tlb_ps;
240 int io_tlb_shift; 240 int io_tlb_shift;
241 241
242 printk(KERN_INFO DRVPFX "IO PDIR shared with sba_iommu\n"); 242 printk(KERN_INFO DRVPFX "IO PDIR shared with sba_iommu\n");
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 9d5c083f3339..38ac6796fc48 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -430,10 +430,10 @@ config HPLANCE
430 430
431config LASI_82596 431config LASI_82596
432 tristate "Lasi ethernet" 432 tristate "Lasi ethernet"
433 depends on NET_ETHERNET && PARISC && GSC_LASI 433 depends on NET_ETHERNET && GSC
434 help 434 help
435 Say Y here to support the on-board Intel 82596 ethernet controller 435 Say Y here to support the builtin Intel 82596 ethernet controller
436 built into Hewlett-Packard PA-RISC machines. 436 found in Hewlett-Packard PA-RISC machines with 10Mbit ethernet.
437 437
438config MIPS_JAZZ_SONIC 438config MIPS_JAZZ_SONIC
439 tristate "MIPS JAZZ onboard SONIC Ethernet support" 439 tristate "MIPS JAZZ onboard SONIC Ethernet support"
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index ea392f2a5aa2..452863d5d498 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -384,7 +384,7 @@ struct i596_private {
384 struct device *dev; 384 struct device *dev;
385}; 385};
386 386
387static char init_setup[] = 387static const char init_setup[] =
388{ 388{
389 0x8E, /* length, prefetch on */ 389 0x8E, /* length, prefetch on */
390 0xC8, /* fifo to 8, monitor off */ 390 0xC8, /* fifo to 8, monitor off */
@@ -683,7 +683,7 @@ static int init_i596_mem(struct net_device *dev)
683 enable_irq(dev->irq); /* enable IRQs from LAN */ 683 enable_irq(dev->irq); /* enable IRQs from LAN */
684 684
685 DEB(DEB_INIT, printk("%s: queuing CmdConfigure\n", dev->name)); 685 DEB(DEB_INIT, printk("%s: queuing CmdConfigure\n", dev->name));
686 memcpy(lp->cf_cmd.i596_config, init_setup, 14); 686 memcpy(lp->cf_cmd.i596_config, init_setup, sizeof(init_setup));
687 lp->cf_cmd.cmd.command = CmdConfigure; 687 lp->cf_cmd.cmd.command = CmdConfigure;
688 CHECK_WBACK(lp, &(lp->cf_cmd), sizeof(struct cf_cmd)); 688 CHECK_WBACK(lp, &(lp->cf_cmd), sizeof(struct cf_cmd));
689 i596_add_cmd(dev, &lp->cf_cmd.cmd); 689 i596_add_cmd(dev, &lp->cf_cmd.cmd);
@@ -1156,32 +1156,12 @@ static int __devinit i82596_probe(struct net_device *dev,
1156 dma_addr_t dma_addr; 1156 dma_addr_t dma_addr;
1157 1157
1158 /* This lot is ensure things have been cache line aligned. */ 1158 /* This lot is ensure things have been cache line aligned. */
1159 if (sizeof(struct i596_rfd) != 32) { 1159 BUILD_BUG_ON(sizeof(struct i596_rfd) != 32);
1160 printk("82596: sizeof(struct i596_rfd) = %d\n", 1160 BUILD_BUG_ON(sizeof(struct i596_rbd) & 31);
1161 (int)sizeof(struct i596_rfd)); 1161 BUILD_BUG_ON(sizeof(struct tx_cmd) & 31);
1162 return -ENODEV; 1162 BUILD_BUG_ON(sizeof(struct i596_tbd) != 32);
1163 }
1164 if ((sizeof(struct i596_rbd) % 32) != 0) {
1165 printk("82596: sizeof(struct i596_rbd) = %d\n",
1166 (int)sizeof(struct i596_rbd));
1167 return -ENODEV;
1168 }
1169 if ((sizeof(struct tx_cmd) % 32) != 0) {
1170 printk("82596: sizeof(struct tx_cmd) = %d\n",
1171 (int)sizeof(struct tx_cmd));
1172 return -ENODEV;
1173 }
1174 if (sizeof(struct i596_tbd) != 32) {
1175 printk("82596: sizeof(struct i596_tbd) = %d\n",
1176 (int)sizeof(struct i596_tbd));
1177 return -ENODEV;
1178 }
1179#ifndef __LP64__ 1163#ifndef __LP64__
1180 if (sizeof(struct i596_private) > 4096) { 1164 BUILD_BUG_ON(sizeof(struct i596_private) > 4096);
1181 printk("82596: sizeof(struct i596_private) = %d\n",
1182 (int)sizeof(struct i596_private));
1183 return -ENODEV;
1184 }
1185#endif 1165#endif
1186 1166
1187 if (!dev->base_addr || !dev->irq) 1167 if (!dev->base_addr || !dev->irq)
diff --git a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c
index 07dc2b6d4e93..9bb4db552f3c 100644
--- a/drivers/parisc/hppb.c
+++ b/drivers/parisc/hppb.c
@@ -10,10 +10,6 @@
10** the Free Software Foundation; either version 2 of the License, or 10** the Free Software Foundation; either version 2 of the License, or
11** (at your option) any later version. 11** (at your option) any later version.
12** 12**
13** This Driver currently only supports the console (port 0) on the MUX.
14** Additional work will be needed on this driver to enable the full
15** functionality of the MUX.
16**
17*/ 13*/
18 14
19#include <linux/types.h> 15#include <linux/types.h>
@@ -67,7 +63,7 @@ static int hppb_probe(struct parisc_device *dev)
67 } 63 }
68 card = card->next; 64 card = card->next;
69 } 65 }
70 printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start); 66 printk(KERN_INFO "Found GeckoBoa at 0x%x\n", dev->hpa.start);
71 67
72 card->hpa = dev->hpa.start; 68 card->hpa = dev->hpa.start;
73 card->mmio_region.name = "HP-PB Bus"; 69 card->mmio_region.name = "HP-PB Bus";
@@ -78,16 +74,18 @@ static int hppb_probe(struct parisc_device *dev)
78 74
79 status = ccio_request_resource(dev, &card->mmio_region); 75 status = ccio_request_resource(dev, &card->mmio_region);
80 if(status < 0) { 76 if(status < 0) {
81 printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08lx, %08lx)\n", 77 printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08x, %08x)\n",
82 __FILE__, card->mmio_region.start, card->mmio_region.end); 78 __FILE__, card->mmio_region.start, card->mmio_region.end);
83 } 79 }
84 80
85 return 0; 81 return 0;
86} 82}
87 83
88
89static struct parisc_device_id hppb_tbl[] = { 84static struct parisc_device_id hppb_tbl[] = {
90 { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, 85 { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, /* E25 and K */
86 { HPHW_BCPORT, 0x0, 0x501, 0xc }, /* E35 */
87 { HPHW_BCPORT, 0x0, 0x502, 0xc }, /* E45 */
88 { HPHW_BCPORT, 0x0, 0x503, 0xc }, /* E55 */
91 { 0, } 89 { 0, }
92}; 90};
93 91
diff --git a/drivers/parisc/iosapic_private.h b/drivers/parisc/iosapic_private.h
index 41e7ec2a44aa..6e05e30a2450 100644
--- a/drivers/parisc/iosapic_private.h
+++ b/drivers/parisc/iosapic_private.h
@@ -132,7 +132,7 @@ struct iosapic_irt {
132struct vector_info { 132struct vector_info {
133 struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */ 133 struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */
134 struct irt_entry *irte; /* IRT entry */ 134 struct irt_entry *irte; /* IRT entry */
135 u32 *eoi_addr; /* precalculate EOI reg address */ 135 u32 __iomem *eoi_addr; /* precalculate EOI reg address */
136 u32 eoi_data; /* IA64: ? PA: swapped txn_data */ 136 u32 eoi_data; /* IA64: ? PA: swapped txn_data */
137 int txn_irq; /* virtual IRQ number for processor */ 137 int txn_irq; /* virtual IRQ number for processor */
138 ulong txn_addr; /* IA64: id_eid PA: partial HPA */ 138 ulong txn_addr; /* IA64: id_eid PA: partial HPA */
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index ba6769934c77..21c4c299b3d6 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -168,7 +168,8 @@ lba_dump_res(struct resource *r, int d)
168 168
169 printk(KERN_DEBUG "(%p)", r->parent); 169 printk(KERN_DEBUG "(%p)", r->parent);
170 for (i = d; i ; --i) printk(" "); 170 for (i = d; i ; --i) printk(" ");
171 printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r, r->start, r->end, r->flags); 171 printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r,
172 (long)r->start, (long)r->end, r->flags);
172 lba_dump_res(r->child, d+2); 173 lba_dump_res(r->child, d+2);
173 lba_dump_res(r->sibling, d); 174 lba_dump_res(r->sibling, d);
174} 175}
@@ -647,7 +648,7 @@ truncate_pat_collision(struct resource *root, struct resource *new)
647 printk(KERN_WARNING "LBA: Truncating lmmio_space [%lx/%lx] " 648 printk(KERN_WARNING "LBA: Truncating lmmio_space [%lx/%lx] "
648 "to [%lx,%lx]\n", 649 "to [%lx,%lx]\n",
649 start, end, 650 start, end,
650 new->start, new->end ); 651 (long)new->start, (long)new->end );
651 652
652 return 0; /* truncation successful */ 653 return 0; /* truncation successful */
653} 654}
@@ -715,8 +716,8 @@ lba_fixup_bus(struct pci_bus *bus)
715 716
716 printk("FAILED: lba_fixup_bus() request for " 717 printk("FAILED: lba_fixup_bus() request for "
717 "elmmio_space [%lx/%lx]\n", 718 "elmmio_space [%lx/%lx]\n",
718 ldev->hba.elmmio_space.start, 719 (long)ldev->hba.elmmio_space.start,
719 ldev->hba.elmmio_space.end); 720 (long)ldev->hba.elmmio_space.end);
720 721
721 /* lba_dump_res(&iomem_resource, 2); */ 722 /* lba_dump_res(&iomem_resource, 2); */
722 /* BUG(); */ 723 /* BUG(); */
@@ -738,15 +739,15 @@ lba_fixup_bus(struct pci_bus *bus)
738 &(ldev->hba.lmmio_space))) { 739 &(ldev->hba.lmmio_space))) {
739 740
740 printk(KERN_WARNING "LBA: lmmio_space [%lx/%lx] duplicate!\n", 741 printk(KERN_WARNING "LBA: lmmio_space [%lx/%lx] duplicate!\n",
741 ldev->hba.lmmio_space.start, 742 (long)ldev->hba.lmmio_space.start,
742 ldev->hba.lmmio_space.end); 743 (long)ldev->hba.lmmio_space.end);
743 } else { 744 } else {
744 err = request_resource(&iomem_resource, &(ldev->hba.lmmio_space)); 745 err = request_resource(&iomem_resource, &(ldev->hba.lmmio_space));
745 if (err < 0) { 746 if (err < 0) {
746 printk(KERN_ERR "FAILED: lba_fixup_bus() request for " 747 printk(KERN_ERR "FAILED: lba_fixup_bus() request for "
747 "lmmio_space [%lx/%lx]\n", 748 "lmmio_space [%lx/%lx]\n",
748 ldev->hba.lmmio_space.start, 749 (long)ldev->hba.lmmio_space.start,
749 ldev->hba.lmmio_space.end); 750 (long)ldev->hba.lmmio_space.end);
750 } else 751 } else
751 bus->resource[i++] = &(ldev->hba.lmmio_space); 752 bus->resource[i++] = &(ldev->hba.lmmio_space);
752 } 753 }
@@ -758,8 +759,8 @@ lba_fixup_bus(struct pci_bus *bus)
758 if (err < 0) { 759 if (err < 0) {
759 printk("FAILED: lba_fixup_bus() request for " 760 printk("FAILED: lba_fixup_bus() request for "
760 "gmmio_space [%lx/%lx]\n", 761 "gmmio_space [%lx/%lx]\n",
761 ldev->hba.gmmio_space.start, 762 (long)ldev->hba.gmmio_space.start,
762 ldev->hba.gmmio_space.end); 763 (long)ldev->hba.gmmio_space.end);
763 lba_dump_res(&iomem_resource, 2); 764 lba_dump_res(&iomem_resource, 2);
764 BUG(); 765 BUG();
765 } 766 }
@@ -980,7 +981,7 @@ LBA_PORT_IN(32, 0)
980#define LBA_PORT_OUT(size, mask) \ 981#define LBA_PORT_OUT(size, mask) \
981static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ 982static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \
982{ \ 983{ \
983 void *where = (void *) PIOP_TO_GMMIO(LBA_DEV(l), addr); \ 984 void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \
984 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ 985 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \
985 WRITE_REG##size(val, where); \ 986 WRITE_REG##size(val, where); \
986 /* flush the I/O down to the elroy at least */ \ 987 /* flush the I/O down to the elroy at least */ \
@@ -1063,16 +1064,16 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1063 /* used to fix up pre-initialized MEM BARs */ 1064 /* used to fix up pre-initialized MEM BARs */
1064 if (!lba_dev->hba.lmmio_space.start) { 1065 if (!lba_dev->hba.lmmio_space.start) {
1065 sprintf(lba_dev->hba.lmmio_name, 1066 sprintf(lba_dev->hba.lmmio_name,
1066 "PCI%02lx LMMIO", 1067 "PCI%02x LMMIO",
1067 lba_dev->hba.bus_num.start); 1068 (int)lba_dev->hba.bus_num.start);
1068 lba_dev->hba.lmmio_space_offset = p->start - 1069 lba_dev->hba.lmmio_space_offset = p->start -
1069 io->start; 1070 io->start;
1070 r = &lba_dev->hba.lmmio_space; 1071 r = &lba_dev->hba.lmmio_space;
1071 r->name = lba_dev->hba.lmmio_name; 1072 r->name = lba_dev->hba.lmmio_name;
1072 } else if (!lba_dev->hba.elmmio_space.start) { 1073 } else if (!lba_dev->hba.elmmio_space.start) {
1073 sprintf(lba_dev->hba.elmmio_name, 1074 sprintf(lba_dev->hba.elmmio_name,
1074 "PCI%02lx ELMMIO", 1075 "PCI%02x ELMMIO",
1075 lba_dev->hba.bus_num.start); 1076 (int)lba_dev->hba.bus_num.start);
1076 r = &lba_dev->hba.elmmio_space; 1077 r = &lba_dev->hba.elmmio_space;
1077 r->name = lba_dev->hba.elmmio_name; 1078 r->name = lba_dev->hba.elmmio_name;
1078 } else { 1079 } else {
@@ -1089,8 +1090,8 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1089 1090
1090 case PAT_GMMIO: 1091 case PAT_GMMIO:
1091 /* MMIO space > 4GB phys addr; for 64-bit BAR */ 1092 /* MMIO space > 4GB phys addr; for 64-bit BAR */
1092 sprintf(lba_dev->hba.gmmio_name, "PCI%02lx GMMIO", 1093 sprintf(lba_dev->hba.gmmio_name, "PCI%02x GMMIO",
1093 lba_dev->hba.bus_num.start); 1094 (int)lba_dev->hba.bus_num.start);
1094 r = &lba_dev->hba.gmmio_space; 1095 r = &lba_dev->hba.gmmio_space;
1095 r->name = lba_dev->hba.gmmio_name; 1096 r->name = lba_dev->hba.gmmio_name;
1096 r->start = p->start; 1097 r->start = p->start;
@@ -1112,8 +1113,8 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1112 */ 1113 */
1113 lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024); 1114 lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024);
1114 1115
1115 sprintf(lba_dev->hba.io_name, "PCI%02lx Ports", 1116 sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
1116 lba_dev->hba.bus_num.start); 1117 (int)lba_dev->hba.bus_num.start);
1117 r = &lba_dev->hba.io_space; 1118 r = &lba_dev->hba.io_space;
1118 r->name = lba_dev->hba.io_name; 1119 r->name = lba_dev->hba.io_name;
1119 r->start = HBA_PORT_BASE(lba_dev->hba.hba_num); 1120 r->start = HBA_PORT_BASE(lba_dev->hba.hba_num);
@@ -1166,8 +1167,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1166 ** Legacy boxes but it's nice to see in /proc/iomem. 1167 ** Legacy boxes but it's nice to see in /proc/iomem.
1167 */ 1168 */
1168 r = &(lba_dev->hba.lmmio_space); 1169 r = &(lba_dev->hba.lmmio_space);
1169 sprintf(lba_dev->hba.lmmio_name, "PCI%02lx LMMIO", 1170 sprintf(lba_dev->hba.lmmio_name, "PCI%02x LMMIO",
1170 lba_dev->hba.bus_num.start); 1171 (int)lba_dev->hba.bus_num.start);
1171 r->name = lba_dev->hba.lmmio_name; 1172 r->name = lba_dev->hba.lmmio_name;
1172 1173
1173#if 1 1174#if 1
@@ -1275,8 +1276,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1275 ** an existing (but unused portion of) distributed range. 1276 ** an existing (but unused portion of) distributed range.
1276 */ 1277 */
1277 r = &(lba_dev->hba.elmmio_space); 1278 r = &(lba_dev->hba.elmmio_space);
1278 sprintf(lba_dev->hba.elmmio_name, "PCI%02lx ELMMIO", 1279 sprintf(lba_dev->hba.elmmio_name, "PCI%02x ELMMIO",
1279 lba_dev->hba.bus_num.start); 1280 (int)lba_dev->hba.bus_num.start);
1280 r->name = lba_dev->hba.elmmio_name; 1281 r->name = lba_dev->hba.elmmio_name;
1281 1282
1282#if 1 1283#if 1
@@ -1297,8 +1298,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1297#endif 1298#endif
1298 1299
1299 r = &(lba_dev->hba.io_space); 1300 r = &(lba_dev->hba.io_space);
1300 sprintf(lba_dev->hba.io_name, "PCI%02lx Ports", 1301 sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
1301 lba_dev->hba.bus_num.start); 1302 (int)lba_dev->hba.bus_num.start);
1302 r->name = lba_dev->hba.io_name; 1303 r->name = lba_dev->hba.io_name;
1303 r->flags = IORESOURCE_IO; 1304 r->flags = IORESOURCE_IO;
1304 r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L; 1305 r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L;
@@ -1406,13 +1407,20 @@ lba_hw_init(struct lba_device *d)
1406 return 0; 1407 return 0;
1407} 1408}
1408 1409
1409 1410/*
1411 * Unfortunately, when firmware numbers busses, it doesn't take into account
1412 * Cardbus bridges. So we have to renumber the busses to suit ourselves.
1413 * Elroy/Mercury don't actually know what bus number they're attached to;
1414 * we use bus 0 to indicate the directly attached bus and any other bus
1415 * number will be taken care of by the PCI-PCI bridge.
1416 */
1417static unsigned int lba_next_bus = 0;
1410 1418
1411/* 1419/*
1412** Determine if lba should claim this chip (return 0) or not (return 1). 1420 * Determine if lba should claim this chip (return 0) or not (return 1).
1413** If so, initialize the chip and tell other partners in crime they 1421 * If so, initialize the chip and tell other partners in crime they
1414** have work to do. 1422 * have work to do.
1415*/ 1423 */
1416static int __init 1424static int __init
1417lba_driver_probe(struct parisc_device *dev) 1425lba_driver_probe(struct parisc_device *dev)
1418{ 1426{
@@ -1440,7 +1448,7 @@ lba_driver_probe(struct parisc_device *dev)
1440 } 1448 }
1441 1449
1442 printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n", 1450 printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n",
1443 version, func_class & 0xf, dev->hpa.start); 1451 version, func_class & 0xf, (long)dev->hpa.start);
1444 1452
1445 if (func_class < 2) { 1453 if (func_class < 2) {
1446 printk(KERN_WARNING "Can't support LBA older than " 1454 printk(KERN_WARNING "Can't support LBA older than "
@@ -1470,17 +1478,16 @@ lba_driver_probe(struct parisc_device *dev)
1470 */ 1478 */
1471 printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n", 1479 printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n",
1472 IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major, 1480 IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major,
1473 minor, func_class, dev->hpa.start); 1481 minor, func_class, (long)dev->hpa.start);
1474 1482
1475 cfg_ops = &mercury_cfg_ops; 1483 cfg_ops = &mercury_cfg_ops;
1476 } else { 1484 } else {
1477 printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start); 1485 printk(KERN_ERR "Unknown LBA found at 0x%lx\n",
1486 (long)dev->hpa.start);
1478 return -ENODEV; 1487 return -ENODEV;
1479 } 1488 }
1480 1489
1481 /* 1490 /* Tell I/O SAPIC driver we have a IRQ handler/region. */
1482 ** Tell I/O SAPIC driver we have a IRQ handler/region.
1483 */
1484 tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE); 1491 tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE);
1485 1492
1486 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't 1493 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't
@@ -1529,16 +1536,17 @@ lba_driver_probe(struct parisc_device *dev)
1529 lba_legacy_resources(dev, lba_dev); 1536 lba_legacy_resources(dev, lba_dev);
1530 } 1537 }
1531 1538
1532 /* 1539 if (lba_dev->hba.bus_num.start < lba_next_bus)
1533 ** Tell PCI support another PCI bus was found. 1540 lba_dev->hba.bus_num.start = lba_next_bus;
1534 ** Walks PCI bus for us too. 1541
1535 */
1536 dev->dev.platform_data = lba_dev; 1542 dev->dev.platform_data = lba_dev;
1537 lba_bus = lba_dev->hba.hba_bus = 1543 lba_bus = lba_dev->hba.hba_bus =
1538 pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start, 1544 pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start,
1539 cfg_ops, NULL); 1545 cfg_ops, NULL);
1540 if (lba_bus) 1546 if (lba_bus) {
1547 lba_next_bus = lba_bus->subordinate + 1;
1541 pci_bus_add_devices(lba_bus); 1548 pci_bus_add_devices(lba_bus);
1549 }
1542 1550
1543 /* This is in lieu of calling pci_assign_unassigned_resources() */ 1551 /* This is in lieu of calling pci_assign_unassigned_resources() */
1544 if (is_pdc_pat()) { 1552 if (is_pdc_pat()) {
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 9a731c101d10..d190c05d87ed 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -66,8 +66,8 @@ static char lcd_text_default[32] __read_mostly;
66 66
67 67
68static struct workqueue_struct *led_wq; 68static struct workqueue_struct *led_wq;
69static void led_work_func(void *); 69static void led_work_func(struct work_struct *);
70static DECLARE_WORK(led_task, led_work_func, NULL); 70static DECLARE_DELAYED_WORK(led_task, led_work_func);
71 71
72#if 0 72#if 0
73#define DPRINTK(x) printk x 73#define DPRINTK(x) printk x
@@ -136,7 +136,7 @@ static int start_task(void)
136 136
137 /* Create the work queue and queue the LED task */ 137 /* Create the work queue and queue the LED task */
138 led_wq = create_singlethread_workqueue("led_wq"); 138 led_wq = create_singlethread_workqueue("led_wq");
139 queue_work(led_wq, &led_task); 139 queue_delayed_work(led_wq, &led_task, 0);
140 140
141 return 0; 141 return 0;
142} 142}
@@ -441,7 +441,7 @@ static __inline__ int led_get_diskio_activity(void)
441 441
442#define LED_UPDATE_INTERVAL (1 + (HZ*19/1000)) 442#define LED_UPDATE_INTERVAL (1 + (HZ*19/1000))
443 443
444static void led_work_func (void *unused) 444static void led_work_func (struct work_struct *unused)
445{ 445{
446 static unsigned long last_jiffies; 446 static unsigned long last_jiffies;
447 static unsigned long count_HZ; /* counter in range 0..HZ */ 447 static unsigned long count_HZ; /* counter in range 0..HZ */
@@ -588,7 +588,7 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
588 588
589 /* Ensure the work is queued */ 589 /* Ensure the work is queued */
590 if (led_wq) { 590 if (led_wq) {
591 queue_work(led_wq, &led_task); 591 queue_delayed_work(led_wq, &led_task, 0);
592 } 592 }
593 593
594 return 0; 594 return 0;
@@ -629,7 +629,7 @@ void __init register_led_regions(void)
629 ** avoid a race condition while writing the CMD/DATA register pair. 629 ** avoid a race condition while writing the CMD/DATA register pair.
630 ** 630 **
631 */ 631 */
632int lcd_print( char *str ) 632int lcd_print( const char *str )
633{ 633{
634 int i; 634 int i;
635 635
@@ -658,7 +658,7 @@ int lcd_print( char *str )
658 658
659 /* re-queue the work */ 659 /* re-queue the work */
660 if (led_wq) { 660 if (led_wq) {
661 queue_work(led_wq, &led_task); 661 queue_delayed_work(led_wq, &led_task, 0);
662 } 662 }
663 663
664 return lcd_info.lcd_width; 664 return lcd_info.lcd_width;
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index 97e9dc066f95..6dedbdef7106 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -2,7 +2,7 @@
2 * linux/drivers/parisc/power.c 2 * linux/drivers/parisc/power.c
3 * HP PARISC soft power switch support driver 3 * HP PARISC soft power switch support driver
4 * 4 *
5 * Copyright (c) 2001-2005 Helge Deller <deller@gmx.de> 5 * Copyright (c) 2001-2007 Helge Deller <deller@gmx.de>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * 8 *
@@ -29,7 +29,6 @@
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * 30 *
31 * 31 *
32 *
33 * HINT: 32 * HINT:
34 * Support of the soft power switch button may be enabled or disabled at 33 * Support of the soft power switch button may be enabled or disabled at
35 * runtime through the "/proc/sys/kernel/power" procfs entry. 34 * runtime through the "/proc/sys/kernel/power" procfs entry.
@@ -38,34 +37,28 @@
38#include <linux/module.h> 37#include <linux/module.h>
39#include <linux/init.h> 38#include <linux/init.h>
40#include <linux/kernel.h> 39#include <linux/kernel.h>
41#include <linux/string.h>
42#include <linux/notifier.h> 40#include <linux/notifier.h>
43#include <linux/reboot.h> 41#include <linux/reboot.h>
44#include <linux/sched.h> 42#include <linux/sched.h>
45#include <linux/interrupt.h> 43#include <linux/kthread.h>
46#include <linux/workqueue.h>
47 44
48#include <asm/pdc.h> 45#include <asm/pdc.h>
49#include <asm/io.h> 46#include <asm/io.h>
50#include <asm/led.h> 47#include <asm/led.h>
51#include <asm/uaccess.h>
52 48
49#define DRIVER_NAME "powersw"
50#define KTHREAD_NAME "kpowerswd"
53 51
54#ifdef DEBUG 52/* how often should the power button be polled ? */
55# define DPRINTK(x...) printk(x) 53#define POWERSWITCH_POLL_PER_SEC 2
56#else
57# define DPRINTK(x...)
58#endif
59
60
61/* filename in /proc which can be used to enable/disable the power switch */
62#define SYSCTL_FILENAME "sys/kernel/power"
63 54
55/* how long does the power button needs to be down until we react ? */
56#define POWERSWITCH_DOWN_SEC 2
64 57
58/* assembly code to access special registers */
59/* taken from PCXL ERS page 82 */
65#define DIAG_CODE(code) (0x14000000 + ((code)<<5)) 60#define DIAG_CODE(code) (0x14000000 + ((code)<<5))
66 61
67/* this will go to processor.h or any other place... */
68/* taken from PCXL ERS page 82 */
69#define MFCPU_X(rDiagReg, t_ch, t_th, code) \ 62#define MFCPU_X(rDiagReg, t_ch, t_th, code) \
70 (DIAG_CODE(code) + ((rDiagReg)<<21) + ((t_ch)<<16) + ((t_th)<<0) ) 63 (DIAG_CODE(code) + ((rDiagReg)<<21) + ((t_ch)<<16) + ((t_th)<<0) )
71 64
@@ -76,111 +69,95 @@
76#define __getDIAG(dr) ( { \ 69#define __getDIAG(dr) ( { \
77 register unsigned long __res asm("r28");\ 70 register unsigned long __res asm("r28");\
78 __asm__ __volatile__ ( \ 71 __asm__ __volatile__ ( \
79 ".word %1\n nop\n" : "=&r" (__res) : "i" (MFCPU_T(dr,28)) \ 72 ".word %1" : "=&r" (__res) : "i" (MFCPU_T(dr,28) ) \
80 ); \ 73 ); \
81 __res; \ 74 __res; \
82} ) 75} )
83 76
84 77/* local shutdown counter */
85static void deferred_poweroff(void *dummy)
86{
87 if (kill_cad_pid(SIGINT, 1)) {
88 /* just in case killing init process failed */
89 machine_power_off();
90 }
91}
92
93/*
94 * This function gets called from interrupt context.
95 * As it's called within an interrupt, it wouldn't sync if we don't
96 * use schedule_work().
97 */
98
99static DECLARE_WORK(poweroff_work, deferred_poweroff, NULL);
100
101static void poweroff(void)
102{
103 static int powering_off __read_mostly;
104
105 if (powering_off)
106 return;
107
108 powering_off++;
109 schedule_work(&poweroff_work);
110}
111
112
113/* local time-counter for shutdown */
114static int shutdown_timer __read_mostly; 78static int shutdown_timer __read_mostly;
115 79
116/* check, give feedback and start shutdown after one second */ 80/* check, give feedback and start shutdown after one second */
117static void process_shutdown(void) 81static void process_shutdown(void)
118{ 82{
119 if (shutdown_timer == 0) 83 if (shutdown_timer == 0)
120 DPRINTK(KERN_INFO "Shutdown requested...\n"); 84 printk(KERN_ALERT KTHREAD_NAME ": Shutdown requested...\n");
121 85
122 shutdown_timer++; 86 shutdown_timer++;
123 87
124 /* wait until the button was pressed for 1 second */ 88 /* wait until the button was pressed for 1 second */
125 if (shutdown_timer == HZ) { 89 if (shutdown_timer == (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC)) {
126#if defined (DEBUG) || defined(CONFIG_CHASSIS_LCD_LED) 90 static const char msg[] = "Shutting down...";
127 static char msg[] = "Shutting down..."; 91 printk(KERN_INFO KTHREAD_NAME ": %s\n", msg);
128#endif
129 DPRINTK(KERN_INFO "%s\n", msg);
130 lcd_print(msg); 92 lcd_print(msg);
131 poweroff(); 93
94 /* send kill signal */
95 if (kill_cad_pid(SIGINT, 1)) {
96 /* just in case killing init process failed */
97 if (pm_power_off)
98 pm_power_off();
99 }
132 } 100 }
133} 101}
134 102
135 103
136/* main power switch tasklet struct (scheduled from time.c) */ 104/* main power switch task struct */
137DECLARE_TASKLET_DISABLED(power_tasklet, NULL, 0); 105static struct task_struct *power_task;
106
107/* filename in /proc which can be used to enable/disable the power switch */
108#define SYSCTL_FILENAME "sys/kernel/power"
138 109
139/* soft power switch enabled/disabled */ 110/* soft power switch enabled/disabled */
140int pwrsw_enabled __read_mostly = 1; 111int pwrsw_enabled __read_mostly = 1;
141 112
142/* 113/* main kernel thread worker. It polls the button state */
143 * On gecko style machines (e.g. 712/xx and 715/xx) 114static int kpowerswd(void *param)
144 * the power switch status is stored in Bit 0 ("the highest bit")
145 * of CPU diagnose register 25.
146 *
147 */
148static void gecko_tasklet_func(unsigned long unused)
149{ 115{
150 if (unlikely(!pwrsw_enabled)) 116 __set_current_state(TASK_RUNNING);
151 return; 117
152 118 do {
153 if (__getDIAG(25) & 0x80000000) { 119 int button_not_pressed;
154 /* power switch button not pressed or released again */ 120 unsigned long soft_power_reg = (unsigned long) param;
155 /* Warning: Some machines do never reset this DIAG flag! */ 121
156 shutdown_timer = 0; 122 schedule_timeout_interruptible(pwrsw_enabled ? HZ : HZ/POWERSWITCH_POLL_PER_SEC);
157 } else { 123 __set_current_state(TASK_RUNNING);
158 process_shutdown(); 124
159 } 125 if (unlikely(!pwrsw_enabled))
160} 126 continue;
161 127
128 if (soft_power_reg) {
129 /*
130 * Non-Gecko-style machines:
131 * Check the power switch status which is read from the
132 * real I/O location at soft_power_reg.
133 * Bit 31 ("the lowest bit) is the status of the power switch.
134 * This bit is "1" if the button is NOT pressed.
135 */
136 button_not_pressed = (gsc_readl(soft_power_reg) & 0x1);
137 } else {
138 /*
139 * On gecko style machines (e.g. 712/xx and 715/xx)
140 * the power switch status is stored in Bit 0 ("the highest bit")
141 * of CPU diagnose register 25.
142 * Warning: Some machines never reset the DIAG flag, even if
143 * the button has been released again.
144 */
145 button_not_pressed = (__getDIAG(25) & 0x80000000);
146 }
147
148 if (likely(button_not_pressed)) {
149 if (unlikely(shutdown_timer && /* avoid writing if not necessary */
150 shutdown_timer < (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC))) {
151 shutdown_timer = 0;
152 printk(KERN_INFO KTHREAD_NAME ": Shutdown request aborted.\n");
153 }
154 } else
155 process_shutdown();
156
157
158 } while (!kthread_should_stop());
162 159
163 160 return 0;
164/*
165 * Check the power switch status which is read from the
166 * real I/O location at soft_power_reg.
167 * Bit 31 ("the lowest bit) is the status of the power switch.
168 */
169
170static void polling_tasklet_func(unsigned long soft_power_reg)
171{
172 unsigned long current_status;
173
174 if (unlikely(!pwrsw_enabled))
175 return;
176
177 current_status = gsc_readl(soft_power_reg);
178 if (current_status & 0x1) {
179 /* power switch button not pressed */
180 shutdown_timer = 0;
181 } else {
182 process_shutdown();
183 }
184} 161}
185 162
186 163
@@ -220,7 +197,7 @@ static struct notifier_block parisc_panic_block = {
220static int __init power_init(void) 197static int __init power_init(void)
221{ 198{
222 unsigned long ret; 199 unsigned long ret;
223 unsigned long soft_power_reg = 0; 200 unsigned long soft_power_reg;
224 201
225#if 0 202#if 0
226 request_irq( IRQ_FROM_REGION(CPU_IRQ_REGION)+2, &powerfail_interrupt, 203 request_irq( IRQ_FROM_REGION(CPU_IRQ_REGION)+2, &powerfail_interrupt,
@@ -235,44 +212,44 @@ static int __init power_init(void)
235 soft_power_reg = -1UL; 212 soft_power_reg = -1UL;
236 213
237 switch (soft_power_reg) { 214 switch (soft_power_reg) {
238 case 0: printk(KERN_INFO "Gecko-style soft power switch enabled.\n"); 215 case 0: printk(KERN_INFO DRIVER_NAME ": Gecko-style soft power switch enabled.\n");
239 power_tasklet.func = gecko_tasklet_func;
240 break; 216 break;
241 217
242 case -1UL: printk(KERN_INFO "Soft power switch support not available.\n"); 218 case -1UL: printk(KERN_INFO DRIVER_NAME ": Soft power switch support not available.\n");
243 return -ENODEV; 219 return -ENODEV;
244 220
245 default: printk(KERN_INFO "Soft power switch enabled, polling @ 0x%08lx.\n", 221 default: printk(KERN_INFO DRIVER_NAME ": Soft power switch at 0x%08lx enabled.\n",
246 soft_power_reg); 222 soft_power_reg);
247 power_tasklet.data = soft_power_reg; 223 }
248 power_tasklet.func = polling_tasklet_func; 224
225 power_task = kthread_run(kpowerswd, (void*)soft_power_reg, KTHREAD_NAME);
226 if (IS_ERR(power_task)) {
227 printk(KERN_ERR DRIVER_NAME ": thread creation failed. Driver not loaded.\n");
228 pdc_soft_power_button(0);
229 return -EIO;
249 } 230 }
250 231
251 /* Register a call for panic conditions. */ 232 /* Register a call for panic conditions. */
252 atomic_notifier_chain_register(&panic_notifier_list, 233 atomic_notifier_chain_register(&panic_notifier_list,
253 &parisc_panic_block); 234 &parisc_panic_block);
254 235
255 tasklet_enable(&power_tasklet);
256
257 return 0; 236 return 0;
258} 237}
259 238
260static void __exit power_exit(void) 239static void __exit power_exit(void)
261{ 240{
262 if (!power_tasklet.func) 241 kthread_stop(power_task);
263 return;
264 242
265 tasklet_disable(&power_tasklet);
266 atomic_notifier_chain_unregister(&panic_notifier_list, 243 atomic_notifier_chain_unregister(&panic_notifier_list,
267 &parisc_panic_block); 244 &parisc_panic_block);
268 power_tasklet.func = NULL; 245
269 pdc_soft_power_button(0); 246 pdc_soft_power_button(0);
270} 247}
271 248
272module_init(power_init); 249arch_initcall(power_init);
273module_exit(power_exit); 250module_exit(power_exit);
274 251
275 252
276MODULE_AUTHOR("Helge Deller"); 253MODULE_AUTHOR("Helge Deller <deller@gmx.de>");
277MODULE_DESCRIPTION("Soft power switch driver"); 254MODULE_DESCRIPTION("Soft power switch driver");
278MODULE_LICENSE("Dual BSD/GPL"); 255MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 76a29dadd519..322957ac2ad1 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -109,7 +109,7 @@ static unsigned long piranha_bad_128k = 0;
109 109
110#ifdef SBA_AGP_SUPPORT 110#ifdef SBA_AGP_SUPPORT
111static int sba_reserve_agpgart = 1; 111static int sba_reserve_agpgart = 1;
112module_param(sba_reserve_agpgart, int, 1); 112module_param(sba_reserve_agpgart, int, 0444);
113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); 113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
114#endif 114#endif
115 115
@@ -846,7 +846,7 @@ static void *sba_alloc_consistent(struct device *hwdev, size_t size,
846 if (!hwdev) { 846 if (!hwdev) {
847 /* only support PCI */ 847 /* only support PCI */
848 *dma_handle = 0; 848 *dma_handle = 0;
849 return 0; 849 return NULL;
850 } 850 }
851 851
852 ret = (void *) __get_free_pages(gfp, get_order(size)); 852 ret = (void *) __get_free_pages(gfp, get_order(size));
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index ccb8fa1800a5..83211013deb8 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -51,7 +51,11 @@
51 51
52#define MUX_NR 256 52#define MUX_NR 256
53static unsigned int port_cnt __read_mostly; 53static unsigned int port_cnt __read_mostly;
54static struct uart_port mux_ports[MUX_NR]; 54struct mux_port {
55 struct uart_port port;
56 int enabled;
57};
58static struct mux_port mux_ports[MUX_NR];
55 59
56static struct uart_driver mux_driver = { 60static struct uart_driver mux_driver = {
57 .owner = THIS_MODULE, 61 .owner = THIS_MODULE,
@@ -66,7 +70,36 @@ static struct timer_list mux_timer;
66 70
67#define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET) 71#define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET)
68#define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET) 72#define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET)
69#define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 73
74/**
75 * get_mux_port_count - Get the number of available ports on the Mux.
76 * @dev: The parisc device.
77 *
78 * This function is used to determine the number of ports the Mux
79 * supports. The IODC data reports the number of ports the Mux
80 * can support, but there are cases where not all the Mux ports
81 * are connected. This function can override the IODC and
82 * return the true port count.
83 */
84static int __init get_mux_port_count(struct parisc_device *dev)
85{
86 int status;
87 u8 iodc_data[32];
88 unsigned long bytecnt;
89
90 /* If this is the built-in Mux for the K-Class (Eole CAP/MUX),
91 * we only need to allocate resources for 1 port since the
92 * other 7 ports are not connected.
93 */
94 if(dev->id.hversion == 0x15)
95 return 1;
96
97 status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32);
98 BUG_ON(status != PDC_OK);
99
100 /* Return the number of ports specified in the iodc data. */
101 return ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8;
102}
70 103
71/** 104/**
72 * mux_tx_empty - Check if the transmitter fifo is empty. 105 * mux_tx_empty - Check if the transmitter fifo is empty.
@@ -250,7 +283,7 @@ static void mux_read(struct uart_port *port)
250 */ 283 */
251static int mux_startup(struct uart_port *port) 284static int mux_startup(struct uart_port *port)
252{ 285{
253 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); 286 mux_ports[port->line].enabled = 1;
254 return 0; 287 return 0;
255} 288}
256 289
@@ -262,6 +295,7 @@ static int mux_startup(struct uart_port *port)
262 */ 295 */
263static void mux_shutdown(struct uart_port *port) 296static void mux_shutdown(struct uart_port *port)
264{ 297{
298 mux_ports[port->line].enabled = 0;
265} 299}
266 300
267/** 301/**
@@ -319,7 +353,7 @@ static int mux_request_port(struct uart_port *port)
319 * @port: Ptr to the uart_port. 353 * @port: Ptr to the uart_port.
320 * @type: Bitmask of required configurations. 354 * @type: Bitmask of required configurations.
321 * 355 *
322 * Perform any autoconfiguration steps for the port. This functino is 356 * Perform any autoconfiguration steps for the port. This function is
323 * called if the UPF_BOOT_AUTOCONF flag is specified for the port. 357 * called if the UPF_BOOT_AUTOCONF flag is specified for the port.
324 * [Note: This is required for now because of a bug in the Serial core. 358 * [Note: This is required for now because of a bug in the Serial core.
325 * rmk has already submitted a patch to linus, should be available for 359 * rmk has already submitted a patch to linus, should be available for
@@ -357,11 +391,11 @@ static void mux_poll(unsigned long unused)
357 int i; 391 int i;
358 392
359 for(i = 0; i < port_cnt; ++i) { 393 for(i = 0; i < port_cnt; ++i) {
360 if(!mux_ports[i].info) 394 if(!mux_ports[i].enabled)
361 continue; 395 continue;
362 396
363 mux_read(&mux_ports[i]); 397 mux_read(&mux_ports[i].port);
364 mux_write(&mux_ports[i]); 398 mux_write(&mux_ports[i].port);
365 } 399 }
366 400
367 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); 401 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY);
@@ -371,8 +405,17 @@ static void mux_poll(unsigned long unused)
371#ifdef CONFIG_SERIAL_MUX_CONSOLE 405#ifdef CONFIG_SERIAL_MUX_CONSOLE
372static void mux_console_write(struct console *co, const char *s, unsigned count) 406static void mux_console_write(struct console *co, const char *s, unsigned count)
373{ 407{
374 while(count--) 408 /* Wait until the FIFO drains. */
375 pdc_iodc_putc(*s++); 409 while(UART_GET_FIFO_CNT(&mux_ports[0].port))
410 udelay(1);
411
412 while(count--) {
413 if(*s == '\n') {
414 UART_PUT_CHAR(&mux_ports[0].port, '\r');
415 }
416 UART_PUT_CHAR(&mux_ports[0].port, *s++);
417 }
418
376} 419}
377 420
378static int mux_console_setup(struct console *co, char *options) 421static int mux_console_setup(struct console *co, char *options)
@@ -428,19 +471,14 @@ static struct uart_ops mux_pops = {
428 */ 471 */
429static int __init mux_probe(struct parisc_device *dev) 472static int __init mux_probe(struct parisc_device *dev)
430{ 473{
431 int i, status, ports; 474 int i, status;
432 u8 iodc_data[32];
433 unsigned long bytecnt;
434 struct uart_port *port;
435 475
436 status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); 476 int port_count = get_mux_port_count(dev);
437 if(status != PDC_OK) { 477 printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.6\n", port_count);
438 printk(KERN_ERR "Serial mux: Unable to read IODC.\n");
439 return 1;
440 }
441 478
442 ports = GET_MUX_PORTS(iodc_data); 479 dev_set_drvdata(&dev->dev, (void *)(long)port_count);
443 printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.3\n", ports); 480 request_mem_region(dev->hpa.start + MUX_OFFSET,
481 port_count * MUX_LINE_OFFSET, "Mux");
444 482
445 if(!port_cnt) { 483 if(!port_cnt) {
446 mux_driver.cons = MUX_CONSOLE; 484 mux_driver.cons = MUX_CONSOLE;
@@ -450,13 +488,10 @@ static int __init mux_probe(struct parisc_device *dev)
450 printk(KERN_ERR "Serial mux: Unable to register driver.\n"); 488 printk(KERN_ERR "Serial mux: Unable to register driver.\n");
451 return 1; 489 return 1;
452 } 490 }
453
454 init_timer(&mux_timer);
455 mux_timer.function = mux_poll;
456 } 491 }
457 492
458 for(i = 0; i < ports; ++i, ++port_cnt) { 493 for(i = 0; i < port_count; ++i, ++port_cnt) {
459 port = &mux_ports[port_cnt]; 494 struct uart_port *port = &mux_ports[port_cnt].port;
460 port->iobase = 0; 495 port->iobase = 0;
461 port->mapbase = dev->hpa.start + MUX_OFFSET + 496 port->mapbase = dev->hpa.start + MUX_OFFSET +
462 (i * MUX_LINE_OFFSET); 497 (i * MUX_LINE_OFFSET);
@@ -477,27 +512,73 @@ static int __init mux_probe(struct parisc_device *dev)
477 */ 512 */
478 port->timeout = HZ / 50; 513 port->timeout = HZ / 50;
479 spin_lock_init(&port->lock); 514 spin_lock_init(&port->lock);
515
480 status = uart_add_one_port(&mux_driver, port); 516 status = uart_add_one_port(&mux_driver, port);
481 BUG_ON(status); 517 BUG_ON(status);
482 } 518 }
483 519
484#ifdef CONFIG_SERIAL_MUX_CONSOLE
485 register_console(&mux_console);
486#endif
487 return 0; 520 return 0;
488} 521}
489 522
523static int __devexit mux_remove(struct parisc_device *dev)
524{
525 int i, j;
526 int port_count = (long)dev_get_drvdata(&dev->dev);
527
528 /* Find Port 0 for this card in the mux_ports list. */
529 for(i = 0; i < port_cnt; ++i) {
530 if(mux_ports[i].port.mapbase == dev->hpa.start + MUX_OFFSET)
531 break;
532 }
533 BUG_ON(i + port_count > port_cnt);
534
535 /* Release the resources associated with each port on the device. */
536 for(j = 0; j < port_count; ++j, ++i) {
537 struct uart_port *port = &mux_ports[i].port;
538
539 uart_remove_one_port(&mux_driver, port);
540 if(port->membase)
541 iounmap(port->membase);
542 }
543
544 release_mem_region(dev->hpa.start + MUX_OFFSET, port_count * MUX_LINE_OFFSET);
545 return 0;
546}
547
548/* Hack. This idea was taken from the 8250_gsc.c on how to properly order
549 * the serial port detection in the proper order. The idea is we always
550 * want the builtin mux to be detected before addin mux cards, so we
551 * specifically probe for the builtin mux cards first.
552 *
553 * This table only contains the parisc_device_id of known builtin mux
554 * devices. All other mux cards will be detected by the generic mux_tbl.
555 */
556static struct parisc_device_id builtin_mux_tbl[] = {
557 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, 0x15, 0x0000D }, /* All K-class */
558 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, 0x44, 0x0000D }, /* E35, E45, and E55 */
559 { 0, }
560};
561
490static struct parisc_device_id mux_tbl[] = { 562static struct parisc_device_id mux_tbl[] = {
491 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0000D }, 563 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0000D },
492 { 0, } 564 { 0, }
493}; 565};
494 566
567MODULE_DEVICE_TABLE(parisc, builtin_mux_tbl);
495MODULE_DEVICE_TABLE(parisc, mux_tbl); 568MODULE_DEVICE_TABLE(parisc, mux_tbl);
496 569
570static struct parisc_driver builtin_serial_mux_driver = {
571 .name = "builtin_serial_mux",
572 .id_table = builtin_mux_tbl,
573 .probe = mux_probe,
574 .remove = __devexit_p(mux_remove),
575};
576
497static struct parisc_driver serial_mux_driver = { 577static struct parisc_driver serial_mux_driver = {
498 .name = "serial_mux", 578 .name = "serial_mux",
499 .id_table = mux_tbl, 579 .id_table = mux_tbl,
500 .probe = mux_probe, 580 .probe = mux_probe,
581 .remove = __devexit_p(mux_remove),
501}; 582};
502 583
503/** 584/**
@@ -507,7 +588,21 @@ static struct parisc_driver serial_mux_driver = {
507 */ 588 */
508static int __init mux_init(void) 589static int __init mux_init(void)
509{ 590{
510 return register_parisc_driver(&serial_mux_driver); 591 register_parisc_driver(&builtin_serial_mux_driver);
592 register_parisc_driver(&serial_mux_driver);
593
594 if(port_cnt > 0) {
595 /* Start the Mux timer */
596 init_timer(&mux_timer);
597 mux_timer.function = mux_poll;
598 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY);
599
600#ifdef CONFIG_SERIAL_MUX_CONSOLE
601 register_console(&mux_console);
602#endif
603 }
604
605 return 0;
511} 606}
512 607
513/** 608/**
@@ -517,14 +612,16 @@ static int __init mux_init(void)
517 */ 612 */
518static void __exit mux_exit(void) 613static void __exit mux_exit(void)
519{ 614{
520 int i; 615 /* Delete the Mux timer. */
521 616 if(port_cnt > 0) {
522 for (i = 0; i < port_cnt; i++) { 617 del_timer(&mux_timer);
523 uart_remove_one_port(&mux_driver, &mux_ports[i]); 618#ifdef CONFIG_SERIAL_MUX_CONSOLE
524 if (mux_ports[i].membase) 619 unregister_console(&mux_console);
525 iounmap(mux_ports[i].membase); 620#endif
526 } 621 }
527 622
623 unregister_parisc_driver(&builtin_serial_mux_driver);
624 unregister_parisc_driver(&serial_mux_driver);
528 uart_unregister_driver(&mux_driver); 625 uart_unregister_driver(&mux_driver);
529} 626}
530 627
diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h
index 5a1e0e8b1c32..5587f0023881 100644
--- a/include/asm-parisc/assembly.h
+++ b/include/asm-parisc/assembly.h
@@ -31,9 +31,13 @@
31#define STREGM std,ma 31#define STREGM std,ma
32#define SHRREG shrd 32#define SHRREG shrd
33#define SHLREG shld 33#define SHLREG shld
34#define ADDIB addib,*
35#define CMPB cmpb,*
36#define ANDCM andcm,*
34#define RP_OFFSET 16 37#define RP_OFFSET 16
35#define FRAME_SIZE 128 38#define FRAME_SIZE 128
36#define CALLEE_REG_FRAME_SIZE 144 39#define CALLEE_REG_FRAME_SIZE 144
40#define ASM_ULONG_INSN .dword
37#else /* CONFIG_64BIT */ 41#else /* CONFIG_64BIT */
38#define LDREG ldw 42#define LDREG ldw
39#define STREG stw 43#define STREG stw
@@ -42,9 +46,13 @@
42#define STREGM stwm 46#define STREGM stwm
43#define SHRREG shr 47#define SHRREG shr
44#define SHLREG shlw 48#define SHLREG shlw
49#define ADDIB addib,
50#define CMPB cmpb,
51#define ANDCM andcm
45#define RP_OFFSET 20 52#define RP_OFFSET 20
46#define FRAME_SIZE 64 53#define FRAME_SIZE 64
47#define CALLEE_REG_FRAME_SIZE 128 54#define CALLEE_REG_FRAME_SIZE 128
55#define ASM_ULONG_INSN .word
48#endif 56#endif
49 57
50#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE) 58#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE)
@@ -65,7 +73,7 @@
65 73
66#ifdef __ASSEMBLY__ 74#ifdef __ASSEMBLY__
67 75
68#ifdef __LP64__ 76#ifdef CONFIG_64BIT
69/* the 64-bit pa gnu assembler unfortunately defaults to .level 1.1 or 2.0 so 77/* the 64-bit pa gnu assembler unfortunately defaults to .level 1.1 or 2.0 so
70 * work around that for now... */ 78 * work around that for now... */
71 .level 2.0w 79 .level 2.0w
@@ -156,7 +164,7 @@
156 .endm 164 .endm
157 165
158 .macro loadgp 166 .macro loadgp
159#ifdef __LP64__ 167#ifdef CONFIG_64BIT
160 ldil L%__gp, %r27 168 ldil L%__gp, %r27
161 ldo R%__gp(%r27), %r27 169 ldo R%__gp(%r27), %r27
162#else 170#else
@@ -334,7 +342,7 @@
334 fldd,mb -8(%r30), %fr12 342 fldd,mb -8(%r30), %fr12
335 .endm 343 .endm
336 344
337#ifdef __LP64__ 345#ifdef CONFIG_64BIT
338 .macro callee_save 346 .macro callee_save
339 std,ma %r3, CALLEE_REG_FRAME_SIZE(%r30) 347 std,ma %r3, CALLEE_REG_FRAME_SIZE(%r30)
340 mfctl %cr27, %r3 348 mfctl %cr27, %r3
@@ -377,7 +385,7 @@
377 ldd,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3 385 ldd,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3
378 .endm 386 .endm
379 387
380#else /* ! __LP64__ */ 388#else /* ! CONFIG_64BIT */
381 389
382 .macro callee_save 390 .macro callee_save
383 stw,ma %r3, CALLEE_REG_FRAME_SIZE(%r30) 391 stw,ma %r3, CALLEE_REG_FRAME_SIZE(%r30)
@@ -420,7 +428,7 @@
420 mtctl %r3, %cr27 428 mtctl %r3, %cr27
421 ldw,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3 429 ldw,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3
422 .endm 430 .endm
423#endif /* ! __LP64__ */ 431#endif /* ! CONFIG_64BIT */
424 432
425 .macro save_specials regs 433 .macro save_specials regs
426 434
@@ -441,7 +449,7 @@
441 mtctl %r0, %cr18 449 mtctl %r0, %cr18
442 SAVE_CR (%cr18, PT_IAOQ1(\regs)) 450 SAVE_CR (%cr18, PT_IAOQ1(\regs))
443 451
444#ifdef __LP64__ 452#ifdef CONFIG_64BIT
445 /* cr11 (sar) is a funny one. 5 bits on PA1.1 and 6 bit on PA2.0 453 /* cr11 (sar) is a funny one. 5 bits on PA1.1 and 6 bit on PA2.0
446 * For PA2.0 mtsar or mtctl always write 6 bits, but mfctl only 454 * For PA2.0 mtsar or mtctl always write 6 bits, but mfctl only
447 * reads 5 bits. Use mfctl,w to read all six bits. Otherwise 455 * reads 5 bits. Use mfctl,w to read all six bits. Otherwise
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
index 48bf9b8ab8ff..7d57d34fcca8 100644
--- a/include/asm-parisc/atomic.h
+++ b/include/asm-parisc/atomic.h
@@ -58,7 +58,7 @@ extern void __xchg_called_with_bad_pointer(void);
58/* __xchg32/64 defined in arch/parisc/lib/bitops.c */ 58/* __xchg32/64 defined in arch/parisc/lib/bitops.c */
59extern unsigned long __xchg8(char, char *); 59extern unsigned long __xchg8(char, char *);
60extern unsigned long __xchg32(int, int *); 60extern unsigned long __xchg32(int, int *);
61#ifdef __LP64__ 61#ifdef CONFIG_64BIT
62extern unsigned long __xchg64(unsigned long, unsigned long *); 62extern unsigned long __xchg64(unsigned long, unsigned long *);
63#endif 63#endif
64 64
@@ -67,7 +67,7 @@ static __inline__ unsigned long
67__xchg(unsigned long x, __volatile__ void * ptr, int size) 67__xchg(unsigned long x, __volatile__ void * ptr, int size)
68{ 68{
69 switch(size) { 69 switch(size) {
70#ifdef __LP64__ 70#ifdef CONFIG_64BIT
71 case 8: return __xchg64(x,(unsigned long *) ptr); 71 case 8: return __xchg64(x,(unsigned long *) ptr);
72#endif 72#endif
73 case 4: return __xchg32((int) x, (int *) ptr); 73 case 4: return __xchg32((int) x, (int *) ptr);
@@ -81,7 +81,7 @@ __xchg(unsigned long x, __volatile__ void * ptr, int size)
81/* 81/*
82** REVISIT - Abandoned use of LDCW in xchg() for now: 82** REVISIT - Abandoned use of LDCW in xchg() for now:
83** o need to test sizeof(*ptr) to avoid clearing adjacent bytes 83** o need to test sizeof(*ptr) to avoid clearing adjacent bytes
84** o and while we are at it, could __LP64__ code use LDCD too? 84** o and while we are at it, could CONFIG_64BIT code use LDCD too?
85** 85**
86** if (__builtin_constant_p(x) && (x == NULL)) 86** if (__builtin_constant_p(x) && (x == NULL))
87** if (((unsigned long)p & 0xf) == 0) 87** if (((unsigned long)p & 0xf) == 0)
@@ -105,7 +105,7 @@ static __inline__ unsigned long
105__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) 105__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
106{ 106{
107 switch(size) { 107 switch(size) {
108#ifdef __LP64__ 108#ifdef CONFIG_64BIT
109 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_); 109 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_);
110#endif 110#endif
111 case 4: return __cmpxchg_u32((unsigned int *)ptr, (unsigned int) old, (unsigned int) new_); 111 case 4: return __cmpxchg_u32((unsigned int *)ptr, (unsigned int) old, (unsigned int) new_);
@@ -218,7 +218,7 @@ static __inline__ int atomic_read(const atomic_t *v)
218#define smp_mb__before_atomic_inc() smp_mb() 218#define smp_mb__before_atomic_inc() smp_mb()
219#define smp_mb__after_atomic_inc() smp_mb() 219#define smp_mb__after_atomic_inc() smp_mb()
220 220
221#ifdef __LP64__ 221#ifdef CONFIG_64BIT
222 222
223typedef struct { volatile s64 counter; } atomic64_t; 223typedef struct { volatile s64 counter; } atomic64_t;
224 224
@@ -270,7 +270,7 @@ atomic64_read(const atomic64_t *v)
270#define atomic64_dec_and_test(v) (atomic64_dec_return(v) == 0) 270#define atomic64_dec_and_test(v) (atomic64_dec_return(v) == 0)
271#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i),(v)) == 0) 271#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i),(v)) == 0)
272 272
273#endif /* __LP64__ */ 273#endif /* CONFIG_64BIT */
274 274
275#include <asm-generic/atomic.h> 275#include <asm-generic/atomic.h>
276 276
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
index 900561922c4c..015cb0d379bd 100644
--- a/include/asm-parisc/bitops.h
+++ b/include/asm-parisc/bitops.h
@@ -60,31 +60,37 @@ static __inline__ void change_bit(int nr, volatile unsigned long * addr)
60static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr) 60static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr)
61{ 61{
62 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); 62 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
63 unsigned long oldbit; 63 unsigned long old;
64 unsigned long flags; 64 unsigned long flags;
65 int set;
65 66
66 addr += (nr >> SHIFT_PER_LONG); 67 addr += (nr >> SHIFT_PER_LONG);
67 _atomic_spin_lock_irqsave(addr, flags); 68 _atomic_spin_lock_irqsave(addr, flags);
68 oldbit = *addr; 69 old = *addr;
69 *addr = oldbit | mask; 70 set = (old & mask) ? 1 : 0;
71 if (!set)
72 *addr = old | mask;
70 _atomic_spin_unlock_irqrestore(addr, flags); 73 _atomic_spin_unlock_irqrestore(addr, flags);
71 74
72 return (oldbit & mask) ? 1 : 0; 75 return set;
73} 76}
74 77
75static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr) 78static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr)
76{ 79{
77 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); 80 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
78 unsigned long oldbit; 81 unsigned long old;
79 unsigned long flags; 82 unsigned long flags;
83 int set;
80 84
81 addr += (nr >> SHIFT_PER_LONG); 85 addr += (nr >> SHIFT_PER_LONG);
82 _atomic_spin_lock_irqsave(addr, flags); 86 _atomic_spin_lock_irqsave(addr, flags);
83 oldbit = *addr; 87 old = *addr;
84 *addr = oldbit & ~mask; 88 set = (old & mask) ? 1 : 0;
89 if (set)
90 *addr = old & ~mask;
85 _atomic_spin_unlock_irqrestore(addr, flags); 91 _atomic_spin_unlock_irqrestore(addr, flags);
86 92
87 return (oldbit & mask) ? 1 : 0; 93 return set;
88} 94}
89 95
90static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr) 96static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr)
@@ -130,7 +136,7 @@ static __inline__ unsigned long __ffs(unsigned long x)
130 unsigned long ret; 136 unsigned long ret;
131 137
132 __asm__( 138 __asm__(
133#ifdef __LP64__ 139#ifdef CONFIG_64BIT
134 " ldi 63,%1\n" 140 " ldi 63,%1\n"
135 " extrd,u,*<> %0,63,32,%%r0\n" 141 " extrd,u,*<> %0,63,32,%%r0\n"
136 " extrd,u,*TR %0,31,32,%0\n" /* move top 32-bits down */ 142 " extrd,u,*TR %0,31,32,%0\n" /* move top 32-bits down */
diff --git a/include/asm-parisc/bug.h b/include/asm-parisc/bug.h
index 695588da41f8..83ba510ed5d8 100644
--- a/include/asm-parisc/bug.h
+++ b/include/asm-parisc/bug.h
@@ -1,14 +1,92 @@
1#ifndef _PARISC_BUG_H 1#ifndef _PARISC_BUG_H
2#define _PARISC_BUG_H 2#define _PARISC_BUG_H
3 3
4/*
5 * Tell the user there is some problem.
6 * The offending file and line are encoded in the __bug_table section.
7 */
8
4#ifdef CONFIG_BUG 9#ifdef CONFIG_BUG
5#define HAVE_ARCH_BUG 10#define HAVE_ARCH_BUG
6#define BUG() do { \ 11#define HAVE_ARCH_WARN_ON
7 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 12
8 dump_stack(); \ 13/* the break instruction is used as BUG() marker. */
9 panic("BUG!"); \ 14#define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"
10} while (0) 15#define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */
16
17#if defined(CONFIG_64BIT)
18#define ASM_WORD_INSN ".dword\t"
19#else
20#define ASM_WORD_INSN ".word\t"
21#endif
22
23#ifdef CONFIG_DEBUG_BUGVERBOSE
24#define BUG() \
25 do { \
26 asm volatile("\n" \
27 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
28 "\t.pushsection __bug_table,\"a\"\n" \
29 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
30 "\t.short %c1, %c2\n" \
31 "\t.org 2b+%c3\n" \
32 "\t.popsection" \
33 : : "i" (__FILE__), "i" (__LINE__), \
34 "i" (0), "i" (sizeof(struct bug_entry)) ); \
35 for(;;) ; \
36 } while(0)
37
38#else
39#define BUG() \
40 do { \
41 asm volatile(PARISC_BUG_BREAK_ASM : : ); \
42 for(;;) ; \
43 } while(0)
44#endif
45
46#ifdef CONFIG_DEBUG_BUGVERBOSE
47#define __WARN() \
48 do { \
49 asm volatile("\n" \
50 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
51 "\t.pushsection __bug_table,\"a\"\n" \
52 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
53 "\t.short %c1, %c2\n" \
54 "\t.org 2b+%c3\n" \
55 "\t.popsection" \
56 : : "i" (__FILE__), "i" (__LINE__), \
57 "i" (BUGFLAG_WARNING), \
58 "i" (sizeof(struct bug_entry)) ); \
59 } while(0)
60#else
61#define __WARN() \
62 do { \
63 asm volatile("\n" \
64 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
65 "\t.pushsection __bug_table,\"a\"\n" \
66 "2:\t" ASM_WORD_INSN "1b\n" \
67 "\t.short %c0\n" \
68 "\t.org 2b+%c1\n" \
69 "\t.popsection" \
70 : : "i" (BUGFLAG_WARNING), \
71 "i" (sizeof(struct bug_entry)) ); \
72 } while(0)
73#endif
74
75
76#define WARN_ON(x) ({ \
77 typeof(x) __ret_warn_on = (x); \
78 if (__builtin_constant_p(__ret_warn_on)) { \
79 if (__ret_warn_on) \
80 __WARN(); \
81 } else { \
82 if (unlikely(__ret_warn_on)) \
83 __WARN(); \
84 } \
85 unlikely(__ret_warn_on); \
86})
87
11#endif 88#endif
12 89
13#include <asm-generic/bug.h> 90#include <asm-generic/bug.h>
14#endif 91#endif
92
diff --git a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h
index 7d22fa206fc4..32c2cca74345 100644
--- a/include/asm-parisc/cache.h
+++ b/include/asm-parisc/cache.h
@@ -30,31 +30,11 @@
30 30
31#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 31#define __read_mostly __attribute__((__section__(".data.read_mostly")))
32 32
33extern void flush_data_cache_local(void *); /* flushes local data-cache only */ 33void parisc_cache_init(void); /* initializes cache-flushing */
34extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */ 34void disable_sr_hashing_asm(int); /* low level support for above */
35#ifdef CONFIG_SMP 35void disable_sr_hashing(void); /* turns off space register hashing */
36extern void flush_data_cache(void); /* flushes data-cache only (all processors) */ 36void free_sid(unsigned long);
37extern void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
38#else
39#define flush_data_cache() flush_data_cache_local(NULL)
40#define flush_instruction_cache() flush_instruction_cache_local(NULL)
41#endif
42
43extern void parisc_cache_init(void); /* initializes cache-flushing */
44extern void flush_all_caches(void); /* flush everything (tlb & cache) */
45extern int get_cache_info(char *);
46extern void flush_user_icache_range_asm(unsigned long, unsigned long);
47extern void flush_kernel_icache_range_asm(unsigned long, unsigned long);
48extern void flush_user_dcache_range_asm(unsigned long, unsigned long);
49extern void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
50extern void flush_kernel_dcache_page_asm(void *);
51extern void flush_kernel_icache_page(void *);
52extern void disable_sr_hashing(void); /* turns off space register hashing */
53extern void disable_sr_hashing_asm(int); /* low level support for above */
54extern void free_sid(unsigned long);
55unsigned long alloc_sid(void); 37unsigned long alloc_sid(void);
56extern void flush_user_dcache_page(unsigned long);
57extern void flush_user_icache_page(unsigned long);
58 38
59struct seq_file; 39struct seq_file;
60extern void show_cache_info(struct seq_file *m); 40extern void show_cache_info(struct seq_file *m);
@@ -63,6 +43,7 @@ extern int split_tlb;
63extern int dcache_stride; 43extern int dcache_stride;
64extern int icache_stride; 44extern int icache_stride;
65extern struct pdc_cache_info cache_info; 45extern struct pdc_cache_info cache_info;
46void parisc_setup_cache_timing(void);
66 47
67#define pdtlb(addr) asm volatile("pdtlb 0(%%sr1,%0)" : : "r" (addr)); 48#define pdtlb(addr) asm volatile("pdtlb 0(%%sr1,%0)" : : "r" (addr));
68#define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" : : "r" (addr)); 49#define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" : : "r" (addr));
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
index a799dd8ef395..2f1e1b05440a 100644
--- a/include/asm-parisc/cacheflush.h
+++ b/include/asm-parisc/cacheflush.h
@@ -2,60 +2,46 @@
2#define _PARISC_CACHEFLUSH_H 2#define _PARISC_CACHEFLUSH_H
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/cache.h> /* for flush_user_dcache_range_asm() proto */
6 5
7/* The usual comment is "Caches aren't brain-dead on the <architecture>". 6/* The usual comment is "Caches aren't brain-dead on the <architecture>".
8 * Unfortunately, that doesn't apply to PA-RISC. */ 7 * Unfortunately, that doesn't apply to PA-RISC. */
9 8
10/* Cache flush operations */ 9/* Internal implementation */
11 10void flush_data_cache_local(void *); /* flushes local data-cache only */
11void flush_instruction_cache_local(void *); /* flushes local code-cache only */
12#ifdef CONFIG_SMP 12#ifdef CONFIG_SMP
13#define flush_cache_mm(mm) flush_cache_all() 13void flush_data_cache(void); /* flushes data-cache only (all processors) */
14void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
14#else 15#else
15#define flush_cache_mm(mm) flush_cache_all_local() 16#define flush_data_cache() flush_data_cache_local(NULL)
17#define flush_instruction_cache() flush_instruction_cache_local(NULL)
16#endif 18#endif
17 19
18#define flush_cache_dup_mm(mm) flush_cache_mm(mm) 20#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
19 21
20#define flush_kernel_dcache_range(start,size) \ 22void flush_user_icache_range_asm(unsigned long, unsigned long);
21 flush_kernel_dcache_range_asm((start), (start)+(size)); 23void flush_kernel_icache_range_asm(unsigned long, unsigned long);
24void flush_user_dcache_range_asm(unsigned long, unsigned long);
25void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
26void flush_kernel_dcache_page_asm(void *);
27void flush_kernel_icache_page(void *);
28void flush_user_dcache_page(unsigned long);
29void flush_user_icache_page(unsigned long);
30void flush_user_dcache_range(unsigned long, unsigned long);
31void flush_user_icache_range(unsigned long, unsigned long);
22 32
23extern void flush_cache_all_local(void); 33/* Cache flush operations */
24 34
25static inline void cacheflush_h_tmp_function(void *dummy) 35void flush_cache_all_local(void);
26{ 36void flush_cache_all(void);
27 flush_cache_all_local(); 37void flush_cache_mm(struct mm_struct *mm);
28}
29 38
30static inline void flush_cache_all(void) 39#define flush_kernel_dcache_range(start,size) \
31{ 40 flush_kernel_dcache_range_asm((start), (start)+(size));
32 on_each_cpu(cacheflush_h_tmp_function, NULL, 1, 1);
33}
34 41
35#define flush_cache_vmap(start, end) flush_cache_all() 42#define flush_cache_vmap(start, end) flush_cache_all()
36#define flush_cache_vunmap(start, end) flush_cache_all() 43#define flush_cache_vunmap(start, end) flush_cache_all()
37 44
38extern int parisc_cache_flush_threshold;
39void parisc_setup_cache_timing(void);
40
41static inline void
42flush_user_dcache_range(unsigned long start, unsigned long end)
43{
44 if ((end - start) < parisc_cache_flush_threshold)
45 flush_user_dcache_range_asm(start,end);
46 else
47 flush_data_cache();
48}
49
50static inline void
51flush_user_icache_range(unsigned long start, unsigned long end)
52{
53 if ((end - start) < parisc_cache_flush_threshold)
54 flush_user_icache_range_asm(start,end);
55 else
56 flush_instruction_cache();
57}
58
59extern void flush_dcache_page(struct page *page); 45extern void flush_dcache_page(struct page *page);
60 46
61#define flush_dcache_mmap_lock(mapping) \ 47#define flush_dcache_mmap_lock(mapping) \
@@ -63,9 +49,15 @@ extern void flush_dcache_page(struct page *page);
63#define flush_dcache_mmap_unlock(mapping) \ 49#define flush_dcache_mmap_unlock(mapping) \
64 write_unlock_irq(&(mapping)->tree_lock) 50 write_unlock_irq(&(mapping)->tree_lock)
65 51
66#define flush_icache_page(vma,page) do { flush_kernel_dcache_page(page); flush_kernel_icache_page(page_address(page)); } while (0) 52#define flush_icache_page(vma,page) do { \
53 flush_kernel_dcache_page(page); \
54 flush_kernel_icache_page(page_address(page)); \
55} while (0)
67 56
68#define flush_icache_range(s,e) do { flush_kernel_dcache_range_asm(s,e); flush_kernel_icache_range_asm(s,e); } while (0) 57#define flush_icache_range(s,e) do { \
58 flush_kernel_dcache_range_asm(s,e); \
59 flush_kernel_icache_range_asm(s,e); \
60} while (0)
69 61
70#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 62#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
71do { \ 63do { \
@@ -80,118 +72,17 @@ do { \
80 memcpy(dst, src, len); \ 72 memcpy(dst, src, len); \
81} while (0) 73} while (0)
82 74
83static inline void flush_cache_range(struct vm_area_struct *vma, 75void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn);
84 unsigned long start, unsigned long end) 76void flush_cache_range(struct vm_area_struct *vma,
85{ 77 unsigned long start, unsigned long end);
86 int sr3;
87
88 if (!vma->vm_mm->context) {
89 BUG();
90 return;
91 }
92
93 sr3 = mfsp(3);
94 if (vma->vm_mm->context == sr3) {
95 flush_user_dcache_range(start,end);
96 flush_user_icache_range(start,end);
97 } else {
98 flush_cache_all();
99 }
100}
101
102/* Simple function to work out if we have an existing address translation
103 * for a user space vma. */
104static inline int translation_exists(struct vm_area_struct *vma,
105 unsigned long addr, unsigned long pfn)
106{
107 pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
108 pmd_t *pmd;
109 pte_t pte;
110
111 if(pgd_none(*pgd))
112 return 0;
113
114 pmd = pmd_offset(pgd, addr);
115 if(pmd_none(*pmd) || pmd_bad(*pmd))
116 return 0;
117
118 /* We cannot take the pte lock here: flush_cache_page is usually
119 * called with pte lock already held. Whereas flush_dcache_page
120 * takes flush_dcache_mmap_lock, which is lower in the hierarchy:
121 * the vma itself is secure, but the pte might come or go racily.
122 */
123 pte = *pte_offset_map(pmd, addr);
124 /* But pte_unmap() does nothing on this architecture */
125
126 /* Filter out coincidental file entries and swap entries */
127 if (!(pte_val(pte) & (_PAGE_FLUSH|_PAGE_PRESENT)))
128 return 0;
129
130 return pte_pfn(pte) == pfn;
131}
132
133/* Private function to flush a page from the cache of a non-current
134 * process. cr25 contains the Page Directory of the current user
135 * process; we're going to hijack both it and the user space %sr3 to
136 * temporarily make the non-current process current. We have to do
137 * this because cache flushing may cause a non-access tlb miss which
138 * the handlers have to fill in from the pgd of the non-current
139 * process. */
140static inline void
141flush_user_cache_page_non_current(struct vm_area_struct *vma,
142 unsigned long vmaddr)
143{
144 /* save the current process space and pgd */
145 unsigned long space = mfsp(3), pgd = mfctl(25);
146
147 /* we don't mind taking interrups since they may not
148 * do anything with user space, but we can't
149 * be preempted here */
150 preempt_disable();
151
152 /* make us current */
153 mtctl(__pa(vma->vm_mm->pgd), 25);
154 mtsp(vma->vm_mm->context, 3);
155
156 flush_user_dcache_page(vmaddr);
157 if(vma->vm_flags & VM_EXEC)
158 flush_user_icache_page(vmaddr);
159
160 /* put the old current process back */
161 mtsp(space, 3);
162 mtctl(pgd, 25);
163 preempt_enable();
164}
165
166static inline void
167__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
168{
169 if (likely(vma->vm_mm->context == mfsp(3))) {
170 flush_user_dcache_page(vmaddr);
171 if (vma->vm_flags & VM_EXEC)
172 flush_user_icache_page(vmaddr);
173 } else {
174 flush_user_cache_page_non_current(vma, vmaddr);
175 }
176}
177
178static inline void
179flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)
180{
181 BUG_ON(!vma->vm_mm->context);
182
183 if (likely(translation_exists(vma, vmaddr, pfn)))
184 __flush_cache_page(vma, vmaddr);
185
186}
187 78
79#define ARCH_HAS_FLUSH_ANON_PAGE
188static inline void 80static inline void
189flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr) 81flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
190{ 82{
191 if (PageAnon(page)) 83 if (PageAnon(page))
192 flush_user_dcache_page(vmaddr); 84 flush_user_dcache_page(vmaddr);
193} 85}
194#define ARCH_HAS_FLUSH_ANON_PAGE
195 86
196#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE 87#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
197void flush_kernel_dcache_page_addr(void *addr); 88void flush_kernel_dcache_page_addr(void *addr);
diff --git a/include/asm-parisc/dma-mapping.h b/include/asm-parisc/dma-mapping.h
index 66f0b408c669..c6c0e9ff6bde 100644
--- a/include/asm-parisc/dma-mapping.h
+++ b/include/asm-parisc/dma-mapping.h
@@ -236,7 +236,7 @@ int ccio_allocate_resource(const struct parisc_device *dev,
236 unsigned long min, unsigned long max, unsigned long align); 236 unsigned long min, unsigned long max, unsigned long align);
237#else /* !CONFIG_IOMMU_CCIO */ 237#else /* !CONFIG_IOMMU_CCIO */
238#define ccio_get_iommu(dev) NULL 238#define ccio_get_iommu(dev) NULL
239#define ccio_request_resource(dev, res) request_resource(&iomem_resource, res) 239#define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res)
240#define ccio_allocate_resource(dev, res, size, min, max, align) \ 240#define ccio_allocate_resource(dev, res, size, min, max, align) \
241 allocate_resource(&iomem_resource, res, size, min, max, \ 241 allocate_resource(&iomem_resource, res, size, min, max, \
242 align, NULL, NULL) 242 align, NULL, NULL)
diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h
index adea65fc43c9..f628ac7de83d 100644
--- a/include/asm-parisc/elf.h
+++ b/include/asm-parisc/elf.h
@@ -220,7 +220,7 @@ typedef struct elf64_fdesc {
220 * macros, and then it includes fs/binfmt_elf.c to provide an alternate 220 * macros, and then it includes fs/binfmt_elf.c to provide an alternate
221 * elf binary handler for 32 bit binaries (on the 64 bit kernel). 221 * elf binary handler for 32 bit binaries (on the 64 bit kernel).
222 */ 222 */
223#ifdef __LP64__ 223#ifdef CONFIG_64BIT
224#define ELF_CLASS ELFCLASS64 224#define ELF_CLASS ELFCLASS64
225#else 225#else
226#define ELF_CLASS ELFCLASS32 226#define ELF_CLASS ELFCLASS32
diff --git a/include/asm-parisc/hardware.h b/include/asm-parisc/hardware.h
index 106d3f7cd882..76d880dc4bae 100644
--- a/include/asm-parisc/hardware.h
+++ b/include/asm-parisc/hardware.h
@@ -1,19 +1,13 @@
1#ifndef _PARISC_HARDWARE_H 1#ifndef _PARISC_HARDWARE_H
2#define _PARISC_HARDWARE_H 2#define _PARISC_HARDWARE_H
3 3
4#include <linux/mod_devicetable.h>
4#include <asm/pdc.h> 5#include <asm/pdc.h>
5 6
6struct parisc_device_id { 7#define HWTYPE_ANY_ID PA_HWTYPE_ANY_ID
7 unsigned char hw_type; /* 5 bits used */ 8#define HVERSION_ANY_ID PA_HVERSION_ANY_ID
8 unsigned char hversion_rev; /* 4 bits */ 9#define HVERSION_REV_ANY_ID PA_HVERSION_REV_ANY_ID
9 unsigned short hversion; /* 12 bits */ 10#define SVERSION_ANY_ID PA_SVERSION_ANY_ID
10 unsigned int sversion; /* 20 bits */
11};
12
13#define HWTYPE_ANY_ID 0xff
14#define HVERSION_REV_ANY_ID 0xff
15#define HVERSION_ANY_ID 0xffff
16#define SVERSION_ANY_ID 0xffffffffU
17 11
18struct hp_hardware { 12struct hp_hardware {
19 unsigned short hw_type:5; /* HPHW_xxx */ 13 unsigned short hw_type:5; /* HPHW_xxx */
diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h
index ca46e7cc0940..c0fed91da3a2 100644
--- a/include/asm-parisc/io.h
+++ b/include/asm-parisc/io.h
@@ -67,7 +67,7 @@ static inline unsigned long long gsc_readq(unsigned long addr)
67{ 67{
68 unsigned long long ret; 68 unsigned long long ret;
69 69
70#ifdef __LP64__ 70#ifdef CONFIG_64BIT
71 __asm__ __volatile__( 71 __asm__ __volatile__(
72 " ldda 0(%1),%0\n" 72 " ldda 0(%1),%0\n"
73 : "=r" (ret) : "r" (addr) ); 73 : "=r" (ret) : "r" (addr) );
@@ -108,7 +108,7 @@ static inline void gsc_writel(unsigned int val, unsigned long addr)
108 108
109static inline void gsc_writeq(unsigned long long val, unsigned long addr) 109static inline void gsc_writeq(unsigned long long val, unsigned long addr)
110{ 110{
111#ifdef __LP64__ 111#ifdef CONFIG_64BIT
112 __asm__ __volatile__( 112 __asm__ __volatile__(
113 " stda %0,0(%1)\n" 113 " stda %0,0(%1)\n"
114 : : "r" (val), "r" (addr) ); 114 : : "r" (val), "r" (addr) );
diff --git a/include/asm-parisc/led.h b/include/asm-parisc/led.h
index efadfd543ec6..c3405ab9d60a 100644
--- a/include/asm-parisc/led.h
+++ b/include/asm-parisc/led.h
@@ -31,7 +31,7 @@ void __init register_led_regions(void);
31 31
32#ifdef CONFIG_CHASSIS_LCD_LED 32#ifdef CONFIG_CHASSIS_LCD_LED
33/* writes a string to the LCD display (if possible on this h/w) */ 33/* writes a string to the LCD display (if possible on this h/w) */
34int lcd_print(char *str); 34int lcd_print(const char *str);
35#else 35#else
36#define lcd_print(str) 36#define lcd_print(str)
37#endif 37#endif
diff --git a/include/asm-parisc/linkage.h b/include/asm-parisc/linkage.h
index 291c2d01c44f..7a09d911b538 100644
--- a/include/asm-parisc/linkage.h
+++ b/include/asm-parisc/linkage.h
@@ -1,6 +1,28 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef __ASM_PARISC_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define __ASM_PARISC_LINKAGE_H
3 3
4/* Nothing to see here... */ 4#ifndef __ALIGN
5#define __ALIGN .align 4
6#define __ALIGN_STR ".align 4"
7#endif
8
9/*
10 * In parisc assembly a semicolon marks a comment while a
11 * exclamation mark is used to seperate independend lines.
12 */
13#define ENTRY(name) \
14 .export name !\
15 ALIGN !\
16name:
5 17
18#ifdef CONFIG_64BIT
19#define ENDPROC(name) \
20 END(name)
21#else
22#define ENDPROC(name) \
23 .type name, @function !\
24 END(name)
6#endif 25#endif
26
27
28#endif /* __ASM_PARISC_LINKAGE_H */
diff --git a/include/asm-parisc/mmzone.h b/include/asm-parisc/mmzone.h
index c87813662d4d..9608d2cf214a 100644
--- a/include/asm-parisc/mmzone.h
+++ b/include/asm-parisc/mmzone.h
@@ -35,7 +35,7 @@ extern struct node_map_data node_data[];
35#define PFNNID_MAP_MAX 512 /* support 512GB */ 35#define PFNNID_MAP_MAX 512 /* support 512GB */
36extern unsigned char pfnnid_map[PFNNID_MAP_MAX]; 36extern unsigned char pfnnid_map[PFNNID_MAP_MAX];
37 37
38#ifndef __LP64__ 38#ifndef CONFIG_64BIT
39#define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT)) 39#define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT))
40#else 40#else
41/* io can be 0xf0f0f0f0f0xxxxxx or 0xfffffffff0000000 */ 41/* io can be 0xf0f0f0f0f0xxxxxx or 0xfffffffff0000000 */
diff --git a/include/asm-parisc/module.h b/include/asm-parisc/module.h
index 00f06885f843..c2cb49e934c1 100644
--- a/include/asm-parisc/module.h
+++ b/include/asm-parisc/module.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * This file contains the parisc architecture specific module code. 4 * This file contains the parisc architecture specific module code.
5 */ 5 */
6#ifdef __LP64__ 6#ifdef CONFIG_64BIT
7#define Elf_Shdr Elf64_Shdr 7#define Elf_Shdr Elf64_Shdr
8#define Elf_Sym Elf64_Sym 8#define Elf_Sym Elf64_Sym
9#define Elf_Ehdr Elf64_Ehdr 9#define Elf_Ehdr Elf64_Ehdr
diff --git a/include/asm-parisc/msgbuf.h b/include/asm-parisc/msgbuf.h
index 14ffc2782f1e..fe88f2649418 100644
--- a/include/asm-parisc/msgbuf.h
+++ b/include/asm-parisc/msgbuf.h
@@ -13,15 +13,15 @@
13 13
14struct msqid64_ds { 14struct msqid64_ds {
15 struct ipc64_perm msg_perm; 15 struct ipc64_perm msg_perm;
16#ifndef __LP64__ 16#ifndef CONFIG_64BIT
17 unsigned int __pad1; 17 unsigned int __pad1;
18#endif 18#endif
19 __kernel_time_t msg_stime; /* last msgsnd time */ 19 __kernel_time_t msg_stime; /* last msgsnd time */
20#ifndef __LP64__ 20#ifndef CONFIG_64BIT
21 unsigned int __pad2; 21 unsigned int __pad2;
22#endif 22#endif
23 __kernel_time_t msg_rtime; /* last msgrcv time */ 23 __kernel_time_t msg_rtime; /* last msgrcv time */
24#ifndef __LP64__ 24#ifndef CONFIG_64BIT
25 unsigned int __pad3; 25 unsigned int __pad3;
26#endif 26#endif
27 __kernel_time_t msg_ctime; /* last change time */ 27 __kernel_time_t msg_ctime; /* last change time */
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index 3567208191e3..f6bba4c13664 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -105,7 +105,7 @@ extern int npmem_ranges;
105/* WARNING: The definitions below must match exactly to sizeof(pte_t) 105/* WARNING: The definitions below must match exactly to sizeof(pte_t)
106 * etc 106 * etc
107 */ 107 */
108#ifdef __LP64__ 108#ifdef CONFIG_64BIT
109#define BITS_PER_PTE_ENTRY 3 109#define BITS_PER_PTE_ENTRY 3
110#define BITS_PER_PMD_ENTRY 2 110#define BITS_PER_PMD_ENTRY 2
111#define BITS_PER_PGD_ENTRY 2 111#define BITS_PER_PGD_ENTRY 2
@@ -127,7 +127,11 @@ extern int npmem_ranges;
127/* This governs the relationship between virtual and physical addresses. 127/* This governs the relationship between virtual and physical addresses.
128 * If you alter it, make sure to take care of our various fixed mapping 128 * If you alter it, make sure to take care of our various fixed mapping
129 * segments in fixmap.h */ 129 * segments in fixmap.h */
130#define __PAGE_OFFSET (0x10000000) 130#ifdef CONFIG_64BIT
131#define __PAGE_OFFSET (0x40000000) /* 1GB */
132#else
133#define __PAGE_OFFSET (0x10000000) /* 256MB */
134#endif
131 135
132#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 136#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
133 137
diff --git a/include/asm-parisc/parisc-device.h b/include/asm-parisc/parisc-device.h
index e12624d8941d..7aa13f2add7a 100644
--- a/include/asm-parisc/parisc-device.h
+++ b/include/asm-parisc/parisc-device.h
@@ -15,7 +15,7 @@ struct parisc_device {
15 unsigned int num_addrs; /* some devices have additional address ranges. */ 15 unsigned int num_addrs; /* some devices have additional address ranges. */
16 unsigned long *addr; /* which will be stored here */ 16 unsigned long *addr; /* which will be stored here */
17 17
18#ifdef __LP64__ 18#ifdef CONFIG_64BIT
19 /* parms for pdc_pat_cell_module() call */ 19 /* parms for pdc_pat_cell_module() call */
20 unsigned long pcell_loc; /* Physical Cell location */ 20 unsigned long pcell_loc; /* Physical Cell location */
21 unsigned long mod_index; /* PAT specific - Misc Module info */ 21 unsigned long mod_index; /* PAT specific - Misc Module info */
diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h
index 423c2b84b4a0..876fd8116d4a 100644
--- a/include/asm-parisc/pdc.h
+++ b/include/asm-parisc/pdc.h
@@ -341,7 +341,7 @@ struct pdc_model { /* for PDC_MODEL */
341 341
342struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */ 342struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */
343 unsigned long 343 unsigned long
344#ifdef __LP64__ 344#ifdef CONFIG_64BIT
345 cc_padW:32, 345 cc_padW:32,
346#endif 346#endif
347 cc_alias: 4, /* alias boundaries for virtual addresses */ 347 cc_alias: 4, /* alias boundaries for virtual addresses */
@@ -357,7 +357,7 @@ struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */
357 357
358struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */ 358struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */
359 unsigned long tc_pad0:12, /* reserved */ 359 unsigned long tc_pad0:12, /* reserved */
360#ifdef __LP64__ 360#ifdef CONFIG_64BIT
361 tc_padW:32, 361 tc_padW:32,
362#endif 362#endif
363 tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */ 363 tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */
@@ -445,7 +445,7 @@ struct pdc_btlb_info { /* PDC_BLOCK_TLB, return of PDC_BTLB_INFO */
445 445
446#endif /* !CONFIG_PA20 */ 446#endif /* !CONFIG_PA20 */
447 447
448#ifdef __LP64__ 448#ifdef CONFIG_64BIT
449struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */ 449struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */
450 unsigned long entries_returned; 450 unsigned long entries_returned;
451 unsigned long entries_total; 451 unsigned long entries_total;
@@ -456,7 +456,7 @@ struct pdc_memory_table { /* PDC_MEM/PDC_MEM_TABLE (arguments) */
456 unsigned int pages; 456 unsigned int pages;
457 unsigned int reserved; 457 unsigned int reserved;
458}; 458};
459#endif /* __LP64__ */ 459#endif /* CONFIG_64BIT */
460 460
461struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */ 461struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */
462 unsigned long mod_addr; 462 unsigned long mod_addr;
@@ -752,7 +752,7 @@ int pdc_get_initiator(struct hardware_path *, struct pdc_initiator *);
752int pdc_tod_read(struct pdc_tod *tod); 752int pdc_tod_read(struct pdc_tod *tod);
753int pdc_tod_set(unsigned long sec, unsigned long usec); 753int pdc_tod_set(unsigned long sec, unsigned long usec);
754 754
755#ifdef __LP64__ 755#ifdef CONFIG_64BIT
756int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr, 756int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
757 struct pdc_memory_table *tbl, unsigned long entries); 757 struct pdc_memory_table *tbl, unsigned long entries);
758#endif 758#endif
diff --git a/include/asm-parisc/pdcpat.h b/include/asm-parisc/pdcpat.h
index b4b34c0e8c1a..47539f117958 100644
--- a/include/asm-parisc/pdcpat.h
+++ b/include/asm-parisc/pdcpat.h
@@ -250,7 +250,7 @@ struct pdc_pat_pd_addr_map_entry {
250#define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL) 250#define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL)
251#define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL) 251#define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL)
252#define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL) 252#define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL)
253#define PAT_GET_MOD_PAGES(value)(((value) & 0xffffffUL) 253#define PAT_GET_MOD_PAGES(value) ((value) & 0xffffffUL)
254 254
255 255
256/* 256/*
@@ -303,35 +303,6 @@ extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 va
303*/ 303*/
304extern int pdc_pat; /* arch/parisc/kernel/inventory.c */ 304extern int pdc_pat; /* arch/parisc/kernel/inventory.c */
305 305
306/********************************************************************
307* PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr
308* ----------------------------------------------------------
309* Bit 0 to 51 - conf_base_addr
310* Bit 52 to 62 - reserved
311* Bit 63 - endianess bit
312********************************************************************/
313#define PAT_GET_CBA(value) ((value) & 0xfffffffffffff000UL)
314
315/********************************************************************
316* PDC_PAT_CELL[Return Cell Module] memaddr[1] mod_info
317* ----------------------------------------------------
318* Bit 0 to 7 - entity type
319* 0 = central agent, 1 = processor,
320* 2 = memory controller, 3 = system bus adapter,
321* 4 = local bus adapter, 5 = processor bus converter,
322* 6 = crossbar fabric connect, 7 = fabric interconnect,
323* 8 to 254 reserved, 255 = unknown.
324* Bit 8 to 15 - DVI
325* Bit 16 to 23 - IOC functions
326* Bit 24 to 39 - reserved
327* Bit 40 to 63 - mod_pages
328* number of 4K pages a module occupies starting at conf_base_addr
329********************************************************************/
330#define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL)
331#define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL)
332#define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL)
333#define PAT_GET_MOD_PAGES(value)(((value) & 0xffffffUL)
334
335#endif /* __ASSEMBLY__ */ 306#endif /* __ASSEMBLY__ */
336 307
337#endif /* ! __PARISC_PATPDC_H */ 308#endif /* ! __PARISC_PATPDC_H */
diff --git a/include/asm-parisc/pgalloc.h b/include/asm-parisc/pgalloc.h
index 3122fad38a1b..1af1a41e0723 100644
--- a/include/asm-parisc/pgalloc.h
+++ b/include/asm-parisc/pgalloc.h
@@ -14,7 +14,7 @@
14 * Here (for 64 bit kernels) we implement a Hybrid L2/L3 scheme: we 14 * Here (for 64 bit kernels) we implement a Hybrid L2/L3 scheme: we
15 * allocate the first pmd adjacent to the pgd. This means that we can 15 * allocate the first pmd adjacent to the pgd. This means that we can
16 * subtract a constant offset to get to it. The pmd and pgd sizes are 16 * subtract a constant offset to get to it. The pmd and pgd sizes are
17 * arranged so that a single pmd covers 4GB (giving a full LP64 17 * arranged so that a single pmd covers 4GB (giving a full 64-bit
18 * process access to 8TB) so our lookups are effectively L2 for the 18 * process access to 8TB) so our lookups are effectively L2 for the
19 * first 4GB of the kernel (i.e. for all ILP32 processes and all the 19 * first 4GB of the kernel (i.e. for all ILP32 processes and all the
20 * kernel for machines with under 4GB of memory) */ 20 * kernel for machines with under 4GB of memory) */
@@ -26,7 +26,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
26 26
27 if (likely(pgd != NULL)) { 27 if (likely(pgd != NULL)) {
28 memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER); 28 memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER);
29#ifdef __LP64__ 29#ifdef CONFIG_64BIT
30 actual_pgd += PTRS_PER_PGD; 30 actual_pgd += PTRS_PER_PGD;
31 /* Populate first pmd with allocated memory. We mark it 31 /* Populate first pmd with allocated memory. We mark it
32 * with PxD_FLAG_ATTACHED as a signal to the system that this 32 * with PxD_FLAG_ATTACHED as a signal to the system that this
@@ -45,7 +45,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
45 45
46static inline void pgd_free(pgd_t *pgd) 46static inline void pgd_free(pgd_t *pgd)
47{ 47{
48#ifdef __LP64__ 48#ifdef CONFIG_64BIT
49 pgd -= PTRS_PER_PGD; 49 pgd -= PTRS_PER_PGD;
50#endif 50#endif
51 free_pages((unsigned long)pgd, PGD_ALLOC_ORDER); 51 free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
@@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
72 72
73static inline void pmd_free(pmd_t *pmd) 73static inline void pmd_free(pmd_t *pmd)
74{ 74{
75#ifdef __LP64__ 75#ifdef CONFIG_64BIT
76 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) 76 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
77 /* This is the permanent pmd attached to the pgd; 77 /* This is the permanent pmd attached to the pgd;
78 * cannot free it */ 78 * cannot free it */
@@ -99,7 +99,7 @@ static inline void pmd_free(pmd_t *pmd)
99static inline void 99static inline void
100pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) 100pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
101{ 101{
102#ifdef __LP64__ 102#ifdef CONFIG_64BIT
103 /* preserve the gateway marker if this is the beginning of 103 /* preserve the gateway marker if this is the beginning of
104 * the permanent pmd */ 104 * the permanent pmd */
105 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) 105 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
index c0b61e0d1497..d7e1b10da5c6 100644
--- a/include/asm-parisc/pgtable.h
+++ b/include/asm-parisc/pgtable.h
@@ -10,7 +10,6 @@
10 * we simulate an x86-style page table for the linux mm code 10 * we simulate an x86-style page table for the linux mm code
11 */ 11 */
12 12
13#include <linux/spinlock.h>
14#include <linux/mm.h> /* for vm_area_struct */ 13#include <linux/mm.h> /* for vm_area_struct */
15#include <asm/processor.h> 14#include <asm/processor.h>
16#include <asm/cache.h> 15#include <asm/cache.h>
diff --git a/include/asm-parisc/posix_types.h b/include/asm-parisc/posix_types.h
index 9b19970de619..b634e3c47fdc 100644
--- a/include/asm-parisc/posix_types.h
+++ b/include/asm-parisc/posix_types.h
@@ -20,7 +20,7 @@ typedef int __kernel_timer_t;
20typedef int __kernel_clockid_t; 20typedef int __kernel_clockid_t;
21typedef int __kernel_daddr_t; 21typedef int __kernel_daddr_t;
22/* Note these change from narrow to wide kernels */ 22/* Note these change from narrow to wide kernels */
23#ifdef __LP64__ 23#ifdef CONFIG_64BIT
24typedef unsigned long __kernel_size_t; 24typedef unsigned long __kernel_size_t;
25typedef long __kernel_ssize_t; 25typedef long __kernel_ssize_t;
26typedef long __kernel_ptrdiff_t; 26typedef long __kernel_ptrdiff_t;
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
index fd7866dc8c83..d2f396721d3e 100644
--- a/include/asm-parisc/processor.h
+++ b/include/asm-parisc/processor.h
@@ -9,13 +9,10 @@
9#define __ASM_PARISC_PROCESSOR_H 9#define __ASM_PARISC_PROCESSOR_H
10 10
11#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
12#include <asm/prefetch.h> /* lockdep.h needs <linux/prefetch.h> */
13
14#include <linux/threads.h> 12#include <linux/threads.h>
15#include <linux/spinlock_types.h>
16 13
14#include <asm/prefetch.h>
17#include <asm/hardware.h> 15#include <asm/hardware.h>
18#include <asm/page.h>
19#include <asm/pdc.h> 16#include <asm/pdc.h>
20#include <asm/ptrace.h> 17#include <asm/ptrace.h>
21#include <asm/types.h> 18#include <asm/types.h>
@@ -41,7 +38,7 @@
41#define DEFAULT_TASK_SIZE32 (0xFFF00000UL) 38#define DEFAULT_TASK_SIZE32 (0xFFF00000UL)
42#define DEFAULT_MAP_BASE32 (0x40000000UL) 39#define DEFAULT_MAP_BASE32 (0x40000000UL)
43 40
44#ifdef __LP64__ 41#ifdef CONFIG_64BIT
45#define DEFAULT_TASK_SIZE (MAX_ADDRESS-0xf000000) 42#define DEFAULT_TASK_SIZE (MAX_ADDRESS-0xf000000)
46#define DEFAULT_MAP_BASE (0x200000000UL) 43#define DEFAULT_MAP_BASE (0x200000000UL)
47#else 44#else
@@ -87,7 +84,6 @@ struct cpuinfo_parisc {
87 unsigned long hpa; /* Host Physical address */ 84 unsigned long hpa; /* Host Physical address */
88 unsigned long txn_addr; /* MMIO addr of EIR or id_eid */ 85 unsigned long txn_addr; /* MMIO addr of EIR or id_eid */
89#ifdef CONFIG_SMP 86#ifdef CONFIG_SMP
90 spinlock_t lock; /* synchronization for ipi's */
91 unsigned long pending_ipi; /* bitmap of type ipi_message_type */ 87 unsigned long pending_ipi; /* bitmap of type ipi_message_type */
92 unsigned long ipi_count; /* number ipi Interrupts */ 88 unsigned long ipi_count; /* number ipi Interrupts */
93#endif 89#endif
@@ -277,7 +273,7 @@ on downward growing arches, it looks like this:
277 * it in here from the current->personality 273 * it in here from the current->personality
278 */ 274 */
279 275
280#ifdef __LP64__ 276#ifdef CONFIG_64BIT
281#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT)) 277#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT))
282#else 278#else
283#define USER_WIDE_MODE 0 279#define USER_WIDE_MODE 0
diff --git a/include/asm-parisc/sembuf.h b/include/asm-parisc/sembuf.h
index 1083368ef8db..1e59ffd3bd1e 100644
--- a/include/asm-parisc/sembuf.h
+++ b/include/asm-parisc/sembuf.h
@@ -13,11 +13,11 @@
13 13
14struct semid64_ds { 14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16#ifndef __LP64__ 16#ifndef CONFIG_64BIT
17 unsigned int __pad1; 17 unsigned int __pad1;
18#endif 18#endif
19 __kernel_time_t sem_otime; /* last semop time */ 19 __kernel_time_t sem_otime; /* last semop time */
20#ifndef __LP64__ 20#ifndef CONFIG_64BIT
21 unsigned int __pad2; 21 unsigned int __pad2;
22#endif 22#endif
23 __kernel_time_t sem_ctime; /* last change time */ 23 __kernel_time_t sem_ctime; /* last change time */
diff --git a/include/asm-parisc/shmbuf.h b/include/asm-parisc/shmbuf.h
index 623b6c0c49e6..0a3eada1863b 100644
--- a/include/asm-parisc/shmbuf.h
+++ b/include/asm-parisc/shmbuf.h
@@ -13,19 +13,19 @@
13 13
14struct shmid64_ds { 14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */ 15 struct ipc64_perm shm_perm; /* operation perms */
16#ifndef __LP64__ 16#ifndef CONFIG_64BIT
17 unsigned int __pad1; 17 unsigned int __pad1;
18#endif 18#endif
19 __kernel_time_t shm_atime; /* last attach time */ 19 __kernel_time_t shm_atime; /* last attach time */
20#ifndef __LP64__ 20#ifndef CONFIG_64BIT
21 unsigned int __pad2; 21 unsigned int __pad2;
22#endif 22#endif
23 __kernel_time_t shm_dtime; /* last detach time */ 23 __kernel_time_t shm_dtime; /* last detach time */
24#ifndef __LP64__ 24#ifndef CONFIG_64BIT
25 unsigned int __pad3; 25 unsigned int __pad3;
26#endif 26#endif
27 __kernel_time_t shm_ctime; /* last change time */ 27 __kernel_time_t shm_ctime; /* last change time */
28#ifndef __LP64__ 28#ifndef CONFIG_64BIT
29 unsigned int __pad4; 29 unsigned int __pad4;
30#endif 30#endif
31 size_t shm_segsz; /* size of segment (bytes) */ 31 size_t shm_segsz; /* size of segment (bytes) */
@@ -36,7 +36,7 @@ struct shmid64_ds {
36 unsigned int __unused2; 36 unsigned int __unused2;
37}; 37};
38 38
39#ifdef __LP64__ 39#ifdef CONFIG_64BIT
40/* The 'unsigned int' (formerly 'unsigned long') data types below will 40/* The 'unsigned int' (formerly 'unsigned long') data types below will
41 * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on 41 * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on
42 * a wide kernel, but if some of these values are meant to contain pointers 42 * a wide kernel, but if some of these values are meant to contain pointers
diff --git a/include/asm-parisc/signal.h b/include/asm-parisc/signal.h
index 98a82fa0cfdb..c20356375d1d 100644
--- a/include/asm-parisc/signal.h
+++ b/include/asm-parisc/signal.h
@@ -105,7 +105,7 @@
105struct siginfo; 105struct siginfo;
106 106
107/* Type of a signal handler. */ 107/* Type of a signal handler. */
108#ifdef __LP64__ 108#ifdef CONFIG_64BIT
109/* function pointers on 64-bit parisc are pointers to little structs and the 109/* function pointers on 64-bit parisc are pointers to little structs and the
110 * compiler doesn't support code which changes or tests the address of 110 * compiler doesn't support code which changes or tests the address of
111 * the function in the little struct. This is really ugly -PB 111 * the function in the little struct. This is really ugly -PB
diff --git a/include/asm-parisc/smp.h b/include/asm-parisc/smp.h
index d4c0e26afcd1..306f4950e32e 100644
--- a/include/asm-parisc/smp.h
+++ b/include/asm-parisc/smp.h
@@ -41,14 +41,6 @@ extern void smp_send_all_nop(void);
41 41
42#define PROC_CHANGE_PENALTY 15 /* Schedule penalty */ 42#define PROC_CHANGE_PENALTY 15 /* Schedule penalty */
43 43
44#undef ENTRY_SYS_CPUS
45#ifdef ENTRY_SYS_CPUS
46#define STATE_RENDEZVOUS 0
47#define STATE_STOPPED 1
48#define STATE_RUNNING 2
49#define STATE_HALTED 3
50#endif
51
52extern unsigned long cpu_present_mask; 44extern unsigned long cpu_present_mask;
53 45
54#define raw_smp_processor_id() (current_thread_info()->cpu) 46#define raw_smp_processor_id() (current_thread_info()->cpu)
diff --git a/include/asm-parisc/spinlock_types.h b/include/asm-parisc/spinlock_types.h
index d6b479bdb886..3f72f47cf4b2 100644
--- a/include/asm-parisc/spinlock_types.h
+++ b/include/asm-parisc/spinlock_types.h
@@ -1,10 +1,6 @@
1#ifndef __ASM_SPINLOCK_TYPES_H 1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H 2#define __ASM_SPINLOCK_TYPES_H
3 3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct { 4typedef struct {
9#ifdef CONFIG_PA20 5#ifdef CONFIG_PA20
10 volatile unsigned int slock; 6 volatile unsigned int slock;
diff --git a/include/asm-parisc/statfs.h b/include/asm-parisc/statfs.h
index a52d8f93f05c..1d2b8130b23d 100644
--- a/include/asm-parisc/statfs.h
+++ b/include/asm-parisc/statfs.h
@@ -30,11 +30,11 @@ struct statfs {
30struct statfs64 { 30struct statfs64 {
31 long f_type; 31 long f_type;
32 long f_bsize; 32 long f_bsize;
33 u64 f_blocks; 33 __u64 f_blocks;
34 u64 f_bfree; 34 __u64 f_bfree;
35 u64 f_bavail; 35 __u64 f_bavail;
36 u64 f_files; 36 __u64 f_files;
37 u64 f_ffree; 37 __u64 f_ffree;
38 __kernel_fsid_t f_fsid; 38 __kernel_fsid_t f_fsid;
39 long f_namelen; 39 long f_namelen;
40 long f_frsize; 40 long f_frsize;
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
index 74f037a39e6f..7e9afa720d43 100644
--- a/include/asm-parisc/system.h
+++ b/include/asm-parisc/system.h
@@ -34,7 +34,7 @@ struct pa_psw {
34 unsigned int i:1; 34 unsigned int i:1;
35}; 35};
36 36
37#ifdef __LP64__ 37#ifdef CONFIG_64BIT
38#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW + 4)) 38#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW + 4))
39#else 39#else
40#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW)) 40#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW))
diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h
index f2f83b04cd8b..949314cf6188 100644
--- a/include/asm-parisc/thread_info.h
+++ b/include/asm-parisc/thread_info.h
@@ -62,6 +62,7 @@ struct thread_info {
62#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 62#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling TIF_NEED_RESCHED */
63#define TIF_32BIT 5 /* 32 bit binary */ 63#define TIF_32BIT 5 /* 32 bit binary */
64#define TIF_MEMDIE 6 64#define TIF_MEMDIE 6
65#define TIF_RESTORE_SIGMASK 7 /* restore saved signal mask */
65 66
66#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 67#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
67#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 68#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
@@ -69,9 +70,10 @@ struct thread_info {
69#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 70#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
70#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 71#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
71#define _TIF_32BIT (1 << TIF_32BIT) 72#define _TIF_32BIT (1 << TIF_32BIT)
73#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
72 74
73#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ 75#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
74 _TIF_NEED_RESCHED) 76 _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
75 77
76#endif /* __KERNEL__ */ 78#endif /* __KERNEL__ */
77 79
diff --git a/include/asm-parisc/tlbflush.h b/include/asm-parisc/tlbflush.h
index f662e837dea1..3313da9ea00f 100644
--- a/include/asm-parisc/tlbflush.h
+++ b/include/asm-parisc/tlbflush.h
@@ -73,33 +73,11 @@ static inline void flush_tlb_page(struct vm_area_struct *vma,
73 purge_tlb_end(); 73 purge_tlb_end();
74} 74}
75 75
76static inline void flush_tlb_range(struct vm_area_struct *vma, 76void __flush_tlb_range(unsigned long sid,
77 unsigned long start, unsigned long end) 77 unsigned long start, unsigned long end);
78{
79 unsigned long npages;
80 78
81 npages = ((end - (start & PAGE_MASK)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 79#define flush_tlb_range(vma,start,end) __flush_tlb_range((vma)->vm_mm->context,start,end)
82 if (npages >= 512) /* 2MB of space: arbitrary, should be tuned */
83 flush_tlb_all();
84 else {
85 mtsp(vma->vm_mm->context,1);
86 purge_tlb_start();
87 if (split_tlb) {
88 while (npages--) {
89 pdtlb(start);
90 pitlb(start);
91 start += PAGE_SIZE;
92 }
93 } else {
94 while (npages--) {
95 pdtlb(start);
96 start += PAGE_SIZE;
97 }
98 }
99 purge_tlb_end();
100 }
101}
102 80
103#define flush_tlb_kernel_range(start, end) flush_tlb_all() 81#define flush_tlb_kernel_range(start, end) __flush_tlb_range(0,start,end)
104 82
105#endif 83#endif
diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h
index 34fdce361a5a..d4aa33033d98 100644
--- a/include/asm-parisc/types.h
+++ b/include/asm-parisc/types.h
@@ -31,7 +31,7 @@ typedef unsigned long long __u64;
31 */ 31 */
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33 33
34#ifdef __LP64__ 34#ifdef CONFIG_64BIT
35#define BITS_PER_LONG 64 35#define BITS_PER_LONG 64
36#define SHIFT_PER_LONG 6 36#define SHIFT_PER_LONG 6
37#else 37#else
diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h
index d973e8b3466c..4878b9501f24 100644
--- a/include/asm-parisc/uaccess.h
+++ b/include/asm-parisc/uaccess.h
@@ -4,7 +4,6 @@
4/* 4/*
5 * User space memory access functions 5 * User space memory access functions
6 */ 6 */
7#include <linux/sched.h>
8#include <asm/page.h> 7#include <asm/page.h>
9#include <asm/system.h> 8#include <asm/system.h>
10#include <asm/cache.h> 9#include <asm/cache.h>
@@ -43,16 +42,18 @@ static inline long access_ok(int type, const void __user * addr,
43#define put_user __put_user 42#define put_user __put_user
44#define get_user __get_user 43#define get_user __get_user
45 44
46#if BITS_PER_LONG == 32 45#if !defined(CONFIG_64BIT)
47#define LDD_KERNEL(ptr) __get_kernel_bad(); 46#define LDD_KERNEL(ptr) __get_kernel_bad();
48#define LDD_USER(ptr) __get_user_bad(); 47#define LDD_USER(ptr) __get_user_bad();
49#define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) 48#define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr)
50#define STD_USER(x, ptr) __put_user_asm64(x,ptr) 49#define STD_USER(x, ptr) __put_user_asm64(x,ptr)
50#define ASM_WORD_INSN ".word\t"
51#else 51#else
52#define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr) 52#define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr)
53#define LDD_USER(ptr) __get_user_asm("ldd",ptr) 53#define LDD_USER(ptr) __get_user_asm("ldd",ptr)
54#define STD_KERNEL(x, ptr) __put_kernel_asm("std",x,ptr) 54#define STD_KERNEL(x, ptr) __put_kernel_asm("std",x,ptr)
55#define STD_USER(x, ptr) __put_user_asm("std",x,ptr) 55#define STD_USER(x, ptr) __put_user_asm("std",x,ptr)
56#define ASM_WORD_INSN ".dword\t"
56#endif 57#endif
57 58
58/* 59/*
@@ -66,6 +67,11 @@ struct exception_table_entry {
66 long fixup; /* fixup routine */ 67 long fixup; /* fixup routine */
67}; 68};
68 69
70#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\
71 ".section __ex_table,\"aw\"\n" \
72 ASM_WORD_INSN #fault_addr ", " #except_addr "\n\t" \
73 ".previous\n"
74
69/* 75/*
70 * The page fault handler stores, in a per-cpu area, the following information 76 * The page fault handler stores, in a per-cpu area, the following information
71 * if a fixup routine is available. 77 * if a fixup routine is available.
@@ -104,43 +110,19 @@ struct exception_data {
104 __gu_err; \ 110 __gu_err; \
105}) 111})
106 112
107#ifdef __LP64__
108#define __get_kernel_asm(ldx,ptr) \
109 __asm__("\n1:\t" ldx "\t0(%2),%0\n" \
110 "\t.section __ex_table,\"aw\"\n" \
111 "\t.dword\t1b,fixup_get_user_skip_1\n" \
112 "\t.previous" \
113 : "=r"(__gu_val), "=r"(__gu_err) \
114 : "r"(ptr), "1"(__gu_err) \
115 : "r1");
116
117#define __get_user_asm(ldx,ptr) \
118 __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n" \
119 "\t.section __ex_table,\"aw\"\n" \
120 "\t.dword\t1b,fixup_get_user_skip_1\n" \
121 "\t.previous" \
122 : "=r"(__gu_val), "=r"(__gu_err) \
123 : "r"(ptr), "1"(__gu_err) \
124 : "r1");
125#else
126#define __get_kernel_asm(ldx,ptr) \ 113#define __get_kernel_asm(ldx,ptr) \
127 __asm__("\n1:\t" ldx "\t0(%2),%0\n" \ 114 __asm__("\n1:\t" ldx "\t0(%2),%0\n\t" \
128 "\t.section __ex_table,\"aw\"\n" \ 115 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\
129 "\t.word\t1b,fixup_get_user_skip_1\n" \
130 "\t.previous" \
131 : "=r"(__gu_val), "=r"(__gu_err) \ 116 : "=r"(__gu_val), "=r"(__gu_err) \
132 : "r"(ptr), "1"(__gu_err) \ 117 : "r"(ptr), "1"(__gu_err) \
133 : "r1"); 118 : "r1");
134 119
135#define __get_user_asm(ldx,ptr) \ 120#define __get_user_asm(ldx,ptr) \
136 __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n" \ 121 __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n\t" \
137 "\t.section __ex_table,\"aw\"\n" \ 122 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_get_user_skip_1)\
138 "\t.word\t1b,fixup_get_user_skip_1\n" \
139 "\t.previous" \
140 : "=r"(__gu_val), "=r"(__gu_err) \ 123 : "=r"(__gu_val), "=r"(__gu_err) \
141 : "r"(ptr), "1"(__gu_err) \ 124 : "r"(ptr), "1"(__gu_err) \
142 : "r1"); 125 : "r1");
143#endif /* !__LP64__ */
144 126
145#define __put_user(x,ptr) \ 127#define __put_user(x,ptr) \
146({ \ 128({ \
@@ -179,80 +161,54 @@ struct exception_data {
179 * r8/r9 are already listed as err/val. 161 * r8/r9 are already listed as err/val.
180 */ 162 */
181 163
182#ifdef __LP64__
183#define __put_kernel_asm(stx,x,ptr) \ 164#define __put_kernel_asm(stx,x,ptr) \
184 __asm__ __volatile__ ( \ 165 __asm__ __volatile__ ( \
185 "\n1:\t" stx "\t%2,0(%1)\n" \ 166 "\n1:\t" stx "\t%2,0(%1)\n\t" \
186 "\t.section __ex_table,\"aw\"\n" \ 167 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\
187 "\t.dword\t1b,fixup_put_user_skip_1\n" \
188 "\t.previous" \
189 : "=r"(__pu_err) \ 168 : "=r"(__pu_err) \
190 : "r"(ptr), "r"(x), "0"(__pu_err) \ 169 : "r"(ptr), "r"(x), "0"(__pu_err) \
191 : "r1") 170 : "r1")
192 171
193#define __put_user_asm(stx,x,ptr) \ 172#define __put_user_asm(stx,x,ptr) \
194 __asm__ __volatile__ ( \ 173 __asm__ __volatile__ ( \
195 "\n1:\t" stx "\t%2,0(%%sr3,%1)\n" \ 174 "\n1:\t" stx "\t%2,0(%%sr3,%1)\n\t" \
196 "\t.section __ex_table,\"aw\"\n" \ 175 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\
197 "\t.dword\t1b,fixup_put_user_skip_1\n" \
198 "\t.previous" \
199 : "=r"(__pu_err) \
200 : "r"(ptr), "r"(x), "0"(__pu_err) \
201 : "r1")
202#else
203#define __put_kernel_asm(stx,x,ptr) \
204 __asm__ __volatile__ ( \
205 "\n1:\t" stx "\t%2,0(%1)\n" \
206 "\t.section __ex_table,\"aw\"\n" \
207 "\t.word\t1b,fixup_put_user_skip_1\n" \
208 "\t.previous" \
209 : "=r"(__pu_err) \ 176 : "=r"(__pu_err) \
210 : "r"(ptr), "r"(x), "0"(__pu_err) \ 177 : "r"(ptr), "r"(x), "0"(__pu_err) \
211 : "r1") 178 : "r1")
212 179
213#define __put_user_asm(stx,x,ptr) \
214 __asm__ __volatile__ ( \
215 "\n1:\t" stx "\t%2,0(%%sr3,%1)\n" \
216 "\t.section __ex_table,\"aw\"\n" \
217 "\t.word\t1b,fixup_put_user_skip_1\n" \
218 "\t.previous" \
219 : "=r"(__pu_err) \
220 : "r"(ptr), "r"(x), "0"(__pu_err) \
221 : "r1")
222 180
223#define __put_kernel_asm64(__val,ptr) do { \ 181#if !defined(CONFIG_64BIT)
224 u64 __val64 = (u64)(__val); \ 182
225 u32 hi = (__val64) >> 32; \ 183#define __put_kernel_asm64(__val,ptr) do { \
226 u32 lo = (__val64) & 0xffffffff; \ 184 u64 __val64 = (u64)(__val); \
185 u32 hi = (__val64) >> 32; \
186 u32 lo = (__val64) & 0xffffffff; \
227 __asm__ __volatile__ ( \ 187 __asm__ __volatile__ ( \
228 "\n1:\tstw %2,0(%1)\n" \ 188 "\n1:\tstw %2,0(%1)" \
229 "\n2:\tstw %3,4(%1)\n" \ 189 "\n2:\tstw %3,4(%1)\n\t" \
230 "\t.section __ex_table,\"aw\"\n" \ 190 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
231 "\t.word\t1b,fixup_put_user_skip_2\n" \ 191 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
232 "\t.word\t2b,fixup_put_user_skip_1\n" \
233 "\t.previous" \
234 : "=r"(__pu_err) \ 192 : "=r"(__pu_err) \
235 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \ 193 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \
236 : "r1"); \ 194 : "r1"); \
237} while (0) 195} while (0)
238 196
239#define __put_user_asm64(__val,ptr) do { \ 197#define __put_user_asm64(__val,ptr) do { \
240 u64 __val64 = (u64)__val; \ 198 u64 __val64 = (u64)(__val); \
241 u32 hi = (__val64) >> 32; \ 199 u32 hi = (__val64) >> 32; \
242 u32 lo = (__val64) & 0xffffffff; \ 200 u32 lo = (__val64) & 0xffffffff; \
243 __asm__ __volatile__ ( \ 201 __asm__ __volatile__ ( \
244 "\n1:\tstw %2,0(%%sr3,%1)\n" \ 202 "\n1:\tstw %2,0(%%sr3,%1)" \
245 "\n2:\tstw %3,4(%%sr3,%1)\n" \ 203 "\n2:\tstw %3,4(%%sr3,%1)\n\t" \
246 "\t.section __ex_table,\"aw\"\n" \ 204 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
247 "\t.word\t1b,fixup_get_user_skip_2\n" \ 205 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
248 "\t.word\t2b,fixup_get_user_skip_1\n" \
249 "\t.previous" \
250 : "=r"(__pu_err) \ 206 : "=r"(__pu_err) \
251 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \ 207 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \
252 : "r1"); \ 208 : "r1"); \
253} while (0) 209} while (0)
254 210
255#endif /* !__LP64__ */ 211#endif /* !defined(CONFIG_64BIT) */
256 212
257 213
258/* 214/*
diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h
index 53b0f5d290e4..2f7c40861c91 100644
--- a/include/asm-parisc/unistd.h
+++ b/include/asm-parisc/unistd.h
@@ -772,7 +772,7 @@
772#define __NR_mknodat (__NR_Linux + 277) 772#define __NR_mknodat (__NR_Linux + 277)
773#define __NR_fchownat (__NR_Linux + 278) 773#define __NR_fchownat (__NR_Linux + 278)
774#define __NR_futimesat (__NR_Linux + 279) 774#define __NR_futimesat (__NR_Linux + 279)
775#define __NR_newfstatat (__NR_Linux + 280) 775#define __NR_fstatat64 (__NR_Linux + 280)
776#define __NR_unlinkat (__NR_Linux + 281) 776#define __NR_unlinkat (__NR_Linux + 281)
777#define __NR_renameat (__NR_Linux + 282) 777#define __NR_renameat (__NR_Linux + 282)
778#define __NR_linkat (__NR_Linux + 283) 778#define __NR_linkat (__NR_Linux + 283)
@@ -786,8 +786,14 @@
786#define __NR_splice (__NR_Linux + 291) 786#define __NR_splice (__NR_Linux + 291)
787#define __NR_sync_file_range (__NR_Linux + 292) 787#define __NR_sync_file_range (__NR_Linux + 292)
788#define __NR_tee (__NR_Linux + 293) 788#define __NR_tee (__NR_Linux + 293)
789#define __NR_vmsplice (__NR_Linux + 294)
790#define __NR_move_pages (__NR_Linux + 295)
791#define __NR_getcpu (__NR_Linux + 296)
792#define __NR_epoll_pwait (__NR_Linux + 297)
793#define __NR_statfs64 (__NR_Linux + 298)
794#define __NR_fstatfs64 (__NR_Linux + 299)
789 795
790#define __NR_Linux_syscalls 294 796#define __NR_Linux_syscalls (__NR_fstatfs64 + 1)
791 797
792#define HPUX_GATEWAY_ADDR 0xC0000004 798#define HPUX_GATEWAY_ADDR 0xC0000004
793#define LINUX_GATEWAY_ADDR 0x100 799#define LINUX_GATEWAY_ADDR 0x100
@@ -951,6 +957,8 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
951#define __ARCH_WANT_SYS_SIGPENDING 957#define __ARCH_WANT_SYS_SIGPENDING
952#define __ARCH_WANT_SYS_SIGPROCMASK 958#define __ARCH_WANT_SYS_SIGPROCMASK
953#define __ARCH_WANT_SYS_RT_SIGACTION 959#define __ARCH_WANT_SYS_RT_SIGACTION
960#define __ARCH_WANT_SYS_RT_SIGSUSPEND
961#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
954 962
955#endif /* __ASSEMBLY__ */ 963#endif /* __ASSEMBLY__ */
956 964
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e0c393cc7240..e96b2dee10bb 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -320,4 +320,16 @@ struct eisa_device_id {
320 320
321#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s" 321#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
322 322
323struct parisc_device_id {
324 __u8 hw_type; /* 5 bits used */
325 __u8 hversion_rev; /* 4 bits */
326 __u16 hversion; /* 12 bits */
327 __u32 sversion; /* 20 bits */
328};
329
330#define PA_HWTYPE_ANY_ID 0xff
331#define PA_HVERSION_REV_ANY_ID 0xff
332#define PA_HVERSION_ANY_ID 0xffff
333#define PA_SVERSION_ANY_ID 0xffffffff
334
323#endif /* LINUX_MOD_DEVICETABLE_H */ 335#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5053dc01fad4..6f7c9a4d80e5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1329,6 +1329,7 @@ extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
1329extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32); 1329extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32);
1330extern int kill_pgrp(struct pid *pid, int sig, int priv); 1330extern int kill_pgrp(struct pid *pid, int sig, int priv);
1331extern int kill_pid(struct pid *pid, int sig, int priv); 1331extern int kill_pid(struct pid *pid, int sig, int priv);
1332extern int kill_proc_info(int, struct siginfo *, pid_t);
1332extern void do_notify_parent(struct task_struct *, int); 1333extern void do_notify_parent(struct task_struct *, int);
1333extern void force_sig(int, struct task_struct *); 1334extern void force_sig(int, struct task_struct *);
1334extern void force_sig_specific(int, struct task_struct *); 1335extern void force_sig_specific(int, struct task_struct *);
diff --git a/kernel/signal.c b/kernel/signal.c
index e2a7d4bf7d57..3670225ecbc0 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1140,7 +1140,8 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
1140 return error; 1140 return error;
1141} 1141}
1142 1142
1143static int kill_proc_info(int sig, struct siginfo *info, pid_t pid) 1143int
1144kill_proc_info(int sig, struct siginfo *info, pid_t pid)
1144{ 1145{
1145 int error; 1146 int error;
1146 rcu_read_lock(); 1147 rcu_read_lock();
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index f61c9ccef6aa..b2f73ffb40bd 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -452,6 +452,24 @@ static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa,
452 return 1; 452 return 1;
453} 453}
454 454
455/* Looks like: parisc:tNhvNrevNsvN */
456static int do_parisc_entry(const char *filename, struct parisc_device_id *id,
457 char *alias)
458{
459 id->hw_type = TO_NATIVE(id->hw_type);
460 id->hversion = TO_NATIVE(id->hversion);
461 id->hversion_rev = TO_NATIVE(id->hversion_rev);
462 id->sversion = TO_NATIVE(id->sversion);
463
464 strcpy(alias, "parisc:");
465 ADD(alias, "t", id->hw_type != PA_HWTYPE_ANY_ID, id->hw_type);
466 ADD(alias, "hv", id->hversion != PA_HVERSION_ANY_ID, id->hversion);
467 ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev);
468 ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion);
469
470 return 1;
471}
472
455/* Ignore any prefix, eg. v850 prepends _ */ 473/* Ignore any prefix, eg. v850 prepends _ */
456static inline int sym_is(const char *symbol, const char *name) 474static inline int sym_is(const char *symbol, const char *name)
457{ 475{
@@ -559,6 +577,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
559 do_table(symval, sym->st_size, 577 do_table(symval, sym->st_size,
560 sizeof(struct eisa_device_id), "eisa", 578 sizeof(struct eisa_device_id), "eisa",
561 do_eisa_entry, mod); 579 do_eisa_entry, mod);
580 else if (sym_is(symname, "__mod_parisc_device_table"))
581 do_table(symval, sym->st_size,
582 sizeof(struct parisc_device_id), "parisc",
583 do_parisc_entry, mod);
562} 584}
563 585
564/* Now add out buffered information to the generated C source */ 586/* Now add out buffered information to the generated C source */
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c4b5398687b8..65bdfdb56877 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -961,7 +961,7 @@ static int init_section_ref_ok(const char *name)
961 ".opd", /* see comment [OPD] at exit_section_ref_ok() */ 961 ".opd", /* see comment [OPD] at exit_section_ref_ok() */
962 ".toc1", /* used by ppc64 */ 962 ".toc1", /* used by ppc64 */
963 ".stab", 963 ".stab",
964 ".rodata", 964 ".data.rel.ro", /* used by parisc64 */
965 ".parainstructions", 965 ".parainstructions",
966 ".text.lock", 966 ".text.lock",
967 "__bug_table", /* used by powerpc for BUG() */ 967 "__bug_table", /* used by powerpc for BUG() */
@@ -984,6 +984,7 @@ static int init_section_ref_ok(const char *name)
984 ".eh_frame", 984 ".eh_frame",
985 ".debug", 985 ".debug",
986 ".parainstructions", 986 ".parainstructions",
987 ".rodata",
987 NULL 988 NULL
988 }; 989 };
989 /* part of section name */ 990 /* part of section name */
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index cf603337b321..ff705c63a03a 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -854,7 +854,7 @@ static struct snd_kcontrol_new snd_harmony_controls[] = {
854 HARMONY_GAIN_HE_SHIFT, 1, 0), 854 HARMONY_GAIN_HE_SHIFT, 1, 0),
855}; 855};
856 856
857static void __init 857static void __devinit
858snd_harmony_mixer_reset(struct snd_harmony *h) 858snd_harmony_mixer_reset(struct snd_harmony *h)
859{ 859{
860 harmony_mute(h); 860 harmony_mute(h);
@@ -863,7 +863,7 @@ snd_harmony_mixer_reset(struct snd_harmony *h)
863 harmony_unmute(h); 863 harmony_unmute(h);
864} 864}
865 865
866static int __init 866static int __devinit
867snd_harmony_mixer_init(struct snd_harmony *h) 867snd_harmony_mixer_init(struct snd_harmony *h)
868{ 868{
869 struct snd_card *card = h->card; 869 struct snd_card *card = h->card;