Commit 10fb0484 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/sparc-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents c57cd56b 964918f1
...@@ -147,7 +147,6 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file) ...@@ -147,7 +147,6 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file)
* memory and creates the pointer tables from them, and puts their * memory and creates the pointer tables from them, and puts their
* addresses on the "stack", returning the new stack pointer value. * addresses on the "stack", returning the new stack pointer value.
*/ */
#define A(__x) ((unsigned long)(__x))
static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm)
{ {
...@@ -171,7 +170,7 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) ...@@ -171,7 +170,7 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm)
current->mm->arg_start = (unsigned long) p; current->mm->arg_start = (unsigned long) p;
while (argc-->0) { while (argc-->0) {
char c; char c;
put_user(((u32)A(p)),argv++); put_user(((u32)(unsigned long)(p)),argv++);
do { do {
get_user(c,p++); get_user(c,p++);
} while (c); } while (c);
...@@ -180,7 +179,7 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) ...@@ -180,7 +179,7 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm)
current->mm->arg_end = current->mm->env_start = (unsigned long) p; current->mm->arg_end = current->mm->env_start = (unsigned long) p;
while (envc-->0) { while (envc-->0) {
char c; char c;
put_user(((u32)A(p)),envp++); put_user(((u32)(unsigned long)(p)),envp++);
do { do {
get_user(c,p++); get_user(c,p++);
} while (c); } while (c);
......
...@@ -1697,12 +1697,12 @@ linux_sparc_syscall32: ...@@ -1697,12 +1697,12 @@ linux_sparc_syscall32:
add %sp, PTREGS_OFF, %o0 add %sp, PTREGS_OFF, %o0
srl %i0, 0, %o0 srl %i0, 0, %o0
#endif #endif
mov %i4, %o4 ! IEU1 srl %i4, 0, %o4 ! IEU1
lduw [%l7 + %l4], %l7 ! Load lduw [%l7 + %l4], %l7 ! Load
srl %i1, 0, %o1 ! IEU0 Group srl %i1, 0, %o1 ! IEU0 Group
ldx [%curptr + TI_FLAGS], %l0 ! Load ldx [%curptr + TI_FLAGS], %l0 ! Load
mov %i5, %o5 ! IEU1 srl %i5, 0, %o5 ! IEU1
srl %i2, 0, %o2 ! IEU0 Group srl %i2, 0, %o2 ! IEU0 Group
andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU0 Group andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU0 Group
bne,pn %icc, linux_syscall_trace32 ! CTI bne,pn %icc, linux_syscall_trace32 ! CTI
......
...@@ -579,26 +579,26 @@ void fault_in_user_windows(void) ...@@ -579,26 +579,26 @@ void fault_in_user_windows(void)
do_exit(SIGILL); do_exit(SIGILL);
} }
asmlinkage int sparc_do_fork(unsigned long clone_flags, asmlinkage long sparc_do_fork(unsigned long clone_flags,
unsigned long stack_start, unsigned long stack_start,
struct pt_regs *regs, struct pt_regs *regs,
unsigned long stack_size) unsigned long stack_size)
{ {
unsigned long parent_tid_ptr, child_tid_ptr; int __user *parent_tid_ptr, *child_tid_ptr;
clone_flags &= ~CLONE_IDLETASK; clone_flags &= ~CLONE_IDLETASK;
parent_tid_ptr = regs->u_regs[UREG_I2];
child_tid_ptr = regs->u_regs[UREG_I4];
if (test_thread_flag(TIF_32BIT)) { if (test_thread_flag(TIF_32BIT)) {
parent_tid_ptr &= 0xffffffff; parent_tid_ptr = compat_ptr(regs->u_regs[UREG_I2]);
child_tid_ptr &= 0xffffffff; child_tid_ptr = compat_ptr(regs->u_regs[UREG_I4]);
} else {
parent_tid_ptr = (int __user *) regs->u_regs[UREG_I2];
child_tid_ptr = (int __user *) regs->u_regs[UREG_I4];
} }
return do_fork(clone_flags, stack_start, return do_fork(clone_flags, stack_start,
regs, stack_size, regs, stack_size,
(int __user *) parent_tid_ptr, parent_tid_ptr, child_tid_ptr);
(int __user *) child_tid_ptr);
} }
/* Copy a Sparc thread. The fork() return value conventions /* Copy a Sparc thread. The fork() return value conventions
......
...@@ -1349,7 +1349,7 @@ asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp) ...@@ -1349,7 +1349,7 @@ asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp)
return ret; return ret;
} }
asmlinkage int do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp) asmlinkage long do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp)
{ {
stack_t uss, uoss; stack_t uss, uoss;
u32 u_ss_sp = 0; u32 u_ss_sp = 0;
......
...@@ -26,15 +26,6 @@ ...@@ -26,15 +26,6 @@
#include <linux/compat.h> #include <linux/compat.h>
#include <asm/kbio.h> #include <asm/kbio.h>
/* Use this to get at 32-bit user passed pointers. */
#define A(__x) \
({ unsigned long __ret; \
__asm__ ("srl %0, 0, %0" \
: "=r" (__ret) \
: "0" (__x)); \
__ret; \
})
#define SUNOS_NR_OPEN 256 #define SUNOS_NR_OPEN 256
struct rtentry32 { struct rtentry32 {
...@@ -108,7 +99,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg) ...@@ -108,7 +99,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
int ntty = N_TTY; int ntty = N_TTY;
int tmp; int tmp;
p = (int __user *)A(arg); p = (int __user *) (unsigned long) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(tmp, p)) if(get_user(tmp, p))
goto out; goto out;
...@@ -241,7 +232,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg) ...@@ -241,7 +232,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
int oldval, newval, __user *ptr; int oldval, newval, __user *ptr;
cmd = TIOCSPGRP; cmd = TIOCSPGRP;
ptr = (int __user *) A(arg); ptr = (int __user *) (unsigned long) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(oldval, ptr)) if(get_user(oldval, ptr))
goto out; goto out;
...@@ -260,7 +251,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg) ...@@ -260,7 +251,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
int oldval, newval, __user *ptr; int oldval, newval, __user *ptr;
cmd = TIOCGPGRP; cmd = TIOCGPGRP;
ptr = (int __user *) A(arg); ptr = (int __user *) (unsigned long) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(oldval, ptr)) if(get_user(oldval, ptr))
goto out; goto out;
......
...@@ -13,85 +13,135 @@ ...@@ -13,85 +13,135 @@
.text .text
.align 32 #define SIGN1(STUB,SYSCALL,REG1) \
.globl sys32_mmap .align 32; \
sys32_mmap: .globl STUB; \
srl %o4, 0, %o4 STUB: sethi %hi(SYSCALL), %g1; \
sethi %hi(sys_mmap), %g1 jmpl %g1 + %lo(SYSCALL), %g0; \
jmpl %g1 + %lo(sys_mmap), %g0 sra REG1, 0, REG1
srl %o5, 0, %o5
.align 32 #define SIGN2(STUB,SYSCALL,REG1,REG2) \
.globl sys32_lseek .align 32; \
.globl sys32_chmod, sys32_mknod .globl STUB; \
sys32_lseek: STUB: sethi %hi(SYSCALL), %g1; \
sra %o1, 0, %o1 sra REG1, 0, REG1; \
sethi %hi(sys_lseek), %g1 jmpl %g1 + %lo(SYSCALL), %g0; \
jmpl %g1 + %lo(sys_lseek), %g0 sra REG2, 0, REG2
nop
sys32_chmod:
sethi %hi(0xffff), %g2
sethi %hi(sys_chmod), %g1
orcc %g2, %lo(0xffff), %g2
jmpl %g1 + %lo(sys_chmod), %g0
and %o1, %g2, %o1
sys32_mknod:
sethi %hi(0xffff), %g2
sethi %hi(sys_mknod), %g1
orcc %g2, %lo(0xffff), %g2
jmpl %g1 + %lo(sys_mknod), %g0
and %o2, %g2, %o2
.align 32 #define SIGN3(STUB,SYSCALL,REG1,REG2,REG3) \
.globl sys32_sendto, sys32_recvfrom .align 32; \
sys32_sendto: .globl STUB; \
sethi %hi(sys_sendto), %g1 STUB: sra REG1, 0, REG1; \
jmpl %g1 + %lo(sys_sendto), %g0 sethi %hi(SYSCALL), %g1; \
srl %o4, 0, %o4 sra REG2, 0, REG2; \
sys32_recvfrom: jmpl %g1 + %lo(SYSCALL), %g0; \
srl %o4, 0, %o4 sra REG3, 0, REG3
sethi %hi(sys_recvfrom), %g1
jmpl %g1 + %lo(sys_recvfrom), %g0
srl %o5, 0, %o5
.globl sys32_bdflush #define SIGN4(STUB,SYSCALL,REG1,REG2,REG3,REG4) \
sys32_bdflush: .align 32; \
sethi %hi(sys_bdflush), %g1 .globl STUB; \
jmpl %g1 + %lo(sys_bdflush), %g0 STUB: sra REG1, 0, REG1; \
sra %o1, 0, %o1 sethi %hi(SYSCALL), %g1; \
sra REG2, 0, REG2; \
sra REG3, 0, REG3; \
jmpl %g1 + %lo(SYSCALL), %g0; \
sra REG4, 0, REG4
SIGN1(sys32_exit, sparc_exit, %o0)
SIGN1(sys32_exit_group, sys_exit_group, %o0)
SIGN1(sys32_wait4, compat_sys_wait4, %o2)
SIGN1(sys32_creat, sys_creat, %o1)
SIGN1(sys32_mknod, sys_mknod, %o1)
SIGN1(sys32_perfctr, sys_perfctr, %o0)
SIGN1(sys32_umount, sys_umount, %o1)
SIGN1(sys32_signal, sys_signal, %o0)
SIGN1(sys32_access, sys_access, %o1)
SIGN1(sys32_msync, sys_msync, %o2)
SIGN2(sys32_reboot, sys_reboot, %o0, %o1)
SIGN1(sys32_setitimer, compat_sys_setitimer, %o0)
SIGN1(sys32_getitimer, compat_sys_getitimer, %o0)
SIGN1(sys32_sethostname, sys_sethostname, %o1)
SIGN1(sys32_swapon, sys_swapon, %o1)
SIGN1(sys32_sigaction, compat_sys_sigaction, %o0)
SIGN1(sys32_rt_sigaction, compat_sys_rt_sigaction, %o0)
SIGN1(sys32_sigprocmask, compat_sys_sigprocmask, %o0)
SIGN1(sys32_rt_sigprocmask, compat_sys_rt_sigprocmask, %o0)
SIGN2(sys32_rt_sigqueueinfo, compat_sys_rt_sigqueueinfo, %o0, %o1)
SIGN1(sys32_getrusage, compat_sys_getrusage, %o0)
SIGN1(sys32_setxattr, sys_setxattr, %o4)
SIGN1(sys32_lsetxattr, sys_lsetxattr, %o4)
SIGN1(sys32_fsetxattr, sys_fsetxattr, %o4)
SIGN1(sys32_fgetxattr, sys_fgetxattr, %o0)
SIGN1(sys32_flistxattr, sys_flistxattr, %o0)
SIGN1(sys32_fremovexattr, sys_fremovexattr, %o0)
SIGN2(sys32_tkill, sys_tkill, %o0, %o1)
SIGN1(sys32_epoll_create, sys_epoll_create, %o0)
SIGN3(sys32_epoll_ctl, sys_epoll_ctl, %o0, %o1, %o2)
SIGN3(sys32_epoll_wait, sys_epoll_wait, %o0, %o2, %o3)
SIGN1(sys32_readahead, compat_sys_readahead, %o0)
SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4)
SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5)
SIGN2(sys32_bdflush, sys_bdflush, %o0, %o1)
SIGN1(sys32_mlockall, sys_mlockall, %o0)
SIGN1(sys32_nfsservctl, compat_sys_nfsservctl, %o0)
SIGN1(sys32_clock_settime, compat_clock_settime, %o1)
SIGN1(sys32_clock_nanosleep, compat_clock_nanosleep, %o1)
SIGN1(sys32_timer_settime, compat_timer_settime, %o1)
SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
SIGN1(sys32_select, compat_sys_select, %o0)
SIGN1(sys32_mkdir, sys_mkdir, %o1)
SIGN2(sys32_futex, compat_sys_futex, %o1, %o2)
SIGN1(sys32_sysfs, compat_sys_sysfs, %o0)
SIGN3(sys32_ipc, compat_sys_ipc, %o1, %o2, %o3)
SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1)
SIGN2(sys32_sendfile64, compat_sys_sendfile64, %o0, %o1)
SIGN1(sys32_prctl, sys_prctl, %o0)
SIGN1(sys32_sched_rr_get_interval, compat_sys_sched_rr_get_interval, %o0)
SIGN2(sys32_waitpid, sys_waitpid, %o0, %o2)
SIGN1(sys32_getgroups, sys_getgroups, %o0)
SIGN1(sys32_getpgid, sys_getpgid, %o0)
SIGN2(sys32_getpriority, sys_getpriority, %o0, %o1)
SIGN1(sys32_getsid, sys_getsid, %o0)
SIGN2(sys32_kill, sys_kill, %o0, %o1)
SIGN1(sys32_nice, sys_nice, %o0)
SIGN1(sys32_lseek, sys_lseek, %o1)
SIGN2(sys32_open, sparc32_open, %o1, %o2)
SIGN1(sys32_readlink, sys_readlink, %o2)
SIGN1(sys32_sched_get_priority_max, sys_sched_get_priority_max, %o0)
SIGN1(sys32_sched_get_priority_min, sys_sched_get_priority_min, %o0)
SIGN1(sys32_sched_getparam, sys_sched_getparam, %o0)
SIGN1(sys32_sched_getscheduler, sys_sched_getscheduler, %o0)
SIGN1(sys32_sched_setparam, sys_sched_setparam, %o0)
SIGN2(sys32_sched_setscheduler, sys_sched_setscheduler, %o0, %o1)
SIGN1(sys32_getdomainname, sys_getdomainname, %o1)
SIGN1(sys32_setdomainname, sys_setdomainname, %o1)
SIGN1(sys32_setgroups, sys_setgroups, %o0)
SIGN2(sys32_setpgid, sys_setpgid, %o0, %o1)
SIGN3(sys32_setpriority, sys_setpriority, %o0, %o1, %o2)
SIGN1(sys32_ssetmask, sys_ssetmask, %o0)
SIGN2(sys32_syslog, sys_syslog, %o0, %o1)
SIGN1(sys32_umask, sys_umask, %o0)
SIGN3(sys32_tgkill, sys_tgkill, %o0, %o1, %o2)
SIGN1(sys32_sendto, sys_sendto, %o0)
SIGN1(sys32_recvfrom, sys_recvfrom, %o0)
SIGN3(sys32_socket, sys_socket, %o0, %o1, %o2)
SIGN2(sys32_connect, sys_connect, %o0, %o2)
SIGN2(sys32_bind, sys_bind, %o0, %o2)
SIGN2(sys32_listen, sys_listen, %o0, %o1)
SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
SIGN2(sys32_shutdown, sys_shutdown, %o0, %o1)
SIGN3(sys32_socketpair, sys_socketpair, %o0, %o1, %o2)
SIGN1(sys32_getpeername, sys_getpeername, %o0)
SIGN1(sys32_getsockname, sys_getsockname, %o0)
.align 32
.globl sys32_mmap2 .globl sys32_mmap2
sys32_mmap2: sys32_mmap2:
srl %o4, 0, %o4
sethi %hi(sys_mmap), %g1 sethi %hi(sys_mmap), %g1
srl %o5, 0, %o5
jmpl %g1 + %lo(sys_mmap), %g0 jmpl %g1 + %lo(sys_mmap), %g0
sllx %o5, 12, %o5 sllx %o5, 12, %o5
.globl sys32_mq_timedsend
sys32_mq_timedsend:
sethi %hi(compat_sys_mq_timedsend), %g1
jmpl %g1 + %lo(compat_sys_mq_timedsend), %g0
srl %o4, 0, %o4
.globl sys32_mq_timedreceive
sys32_mq_timedreceive:
sethi %hi(compat_sys_mq_timedreceive), %g1
jmpl %g1 + %lo(compat_sys_mq_timedreceive), %g0
srl %o4, 0, %o4
.globl sys32_select
sys32_select:
sethi %hi(compat_sys_select), %g1
jmpl %g1 + %lo(compat_sys_select), %g0
srl %o4, 0, %o4
.globl sys32_futex
sys32_futex:
sethi %hi(compat_sys_futex), %g1
jmpl %g1 + %lo(compat_sys_futex), %g0
srl %o4, 0, %o4
.align 32 .align 32
.globl sys32_socketcall .globl sys32_socketcall
sys32_socketcall: /* %o0=call, %o1=args */ sys32_socketcall: /* %o0=call, %o1=args */
...@@ -199,23 +249,23 @@ do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ ...@@ -199,23 +249,23 @@ do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */
lduwa [%o1 + 0x4] %asi, %o1 lduwa [%o1 + 0x4] %asi, %o1
nop nop
nop nop
do_sys_sendto: /* sys32_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
ldswa [%o1 + 0x0] %asi, %o0 ldswa [%o1 + 0x0] %asi, %o0
sethi %hi(sys32_sendto), %g1 sethi %hi(sys_sendto), %g1
lduwa [%o1 + 0x8] %asi, %o2 lduwa [%o1 + 0x8] %asi, %o2
lduwa [%o1 + 0xc] %asi, %o3 lduwa [%o1 + 0xc] %asi, %o3
lduwa [%o1 + 0x10] %asi, %o4 lduwa [%o1 + 0x10] %asi, %o4
ldswa [%o1 + 0x14] %asi, %o5 ldswa [%o1 + 0x14] %asi, %o5
jmpl %g1 + %lo(sys32_sendto), %g0 jmpl %g1 + %lo(sys_sendto), %g0
lduwa [%o1 + 0x4] %asi, %o1 lduwa [%o1 + 0x4] %asi, %o1
do_sys_recvfrom: /* sys32_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
ldswa [%o1 + 0x0] %asi, %o0 ldswa [%o1 + 0x0] %asi, %o0
sethi %hi(sys32_recvfrom), %g1 sethi %hi(sys_recvfrom), %g1
lduwa [%o1 + 0x8] %asi, %o2 lduwa [%o1 + 0x8] %asi, %o2
lduwa [%o1 + 0xc] %asi, %o3 lduwa [%o1 + 0xc] %asi, %o3
lduwa [%o1 + 0x10] %asi, %o4 lduwa [%o1 + 0x10] %asi, %o4
lduwa [%o1 + 0x14] %asi, %o5 lduwa [%o1 + 0x14] %asi, %o5
jmpl %g1 + %lo(sys32_recvfrom), %g0 jmpl %g1 + %lo(sys_recvfrom), %g0
lduwa [%o1 + 0x4] %asi, %o1 lduwa [%o1 + 0x4] %asi, %o1
do_sys_shutdown: /* sys_shutdown(int, int) */ do_sys_shutdown: /* sys_shutdown(int, int) */
ldswa [%o1 + 0x0] %asi, %o0 ldswa [%o1 + 0x0] %asi, %o0
......
...@@ -179,7 +179,7 @@ asmlinkage unsigned long sparc_brk(unsigned long brk) ...@@ -179,7 +179,7 @@ asmlinkage unsigned long sparc_brk(unsigned long brk)
* sys_pipe() is the normal C calling standard for creating * sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way unix traditionally does this, though. * a pipe. It's not the way unix traditionally does this, though.
*/ */
asmlinkage int sparc_pipe(struct pt_regs *regs) asmlinkage long sparc_pipe(struct pt_regs *regs)
{ {
int fd[2]; int fd[2];
int error; int error;
...@@ -199,22 +199,22 @@ asmlinkage int sparc_pipe(struct pt_regs *regs) ...@@ -199,22 +199,22 @@ asmlinkage int sparc_pipe(struct pt_regs *regs)
* This is really horribly ugly. * This is really horribly ugly.
*/ */
asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long third, void *ptr, long fifth) asmlinkage long sys_ipc(unsigned int call, int first, int second, unsigned long third, void __user *ptr, long fifth)
{ {
int err; int err;
/* No need for backward compatibility. We can start fresh... */ /* No need for backward compatibility. We can start fresh... */
if (call <= SEMCTL) {
if (call <= SEMCTL)
switch (call) { switch (call) {
case SEMOP: case SEMOP:
err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL); err = sys_semtimedop(first, ptr, second, NULL);
goto out; goto out;
case SEMTIMEDOP: case SEMTIMEDOP:
err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth); err = sys_semtimedop(first, ptr, second,
(const struct timespec __user *) fifth);
goto out; goto out;
case SEMGET: case SEMGET:
err = sys_semget (first, second, (int)third); err = sys_semget(first, second, (int)third);
goto out; goto out;
case SEMCTL: { case SEMCTL: {
union semun fourth; union semun fourth;
...@@ -222,79 +222,87 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir ...@@ -222,79 +222,87 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
if (!ptr) if (!ptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if (get_user(fourth.__pad, (void __user * __user *)ptr)) if (get_user(fourth.__pad,
(void __user * __user *) ptr))
goto out; goto out;
err = sys_semctl (first, second | IPC_64, (int)third, fourth); err = sys_semctl(first, second | IPC_64,
(int)third, fourth);
goto out; goto out;
} }
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
};
} }
if (call <= MSGCTL) if (call <= MSGCTL) {
switch (call) { switch (call) {
case MSGSND: case MSGSND:
err = sys_msgsnd (first, (struct msgbuf __user *) ptr, err = sys_msgsnd(first, ptr, second, (int)third);
second, (int)third);
goto out; goto out;
case MSGRCV: case MSGRCV:
err = sys_msgrcv (first, (struct msgbuf __user *) ptr, second, fifth, (int)third); err = sys_msgrcv(first, ptr, second, fifth,
(int)third);
goto out; goto out;
case MSGGET: case MSGGET:
err = sys_msgget ((key_t) first, second); err = sys_msgget((key_t) first, second);
goto out; goto out;
case MSGCTL: case MSGCTL:
err = sys_msgctl (first, second | IPC_64, (struct msqid_ds __user *) ptr); err = sys_msgctl(first, second | IPC_64, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
};
} }
if (call <= SHMCTL) if (call <= SHMCTL) {
switch (call) { switch (call) {
case SHMAT: { case SHMAT: {
ulong raddr; ulong raddr;
err = do_shmat (first, (char __user *) ptr, second, &raddr); err = do_shmat(first, ptr, second, &raddr);
if (!err) { if (!err) {
if (put_user(raddr, (ulong __user *) third)) if (put_user(raddr,
(ulong __user *) third))
err = -EFAULT; err = -EFAULT;
} }
goto out; goto out;
} }
case SHMDT: case SHMDT:
err = sys_shmdt ((char __user *)ptr); err = sys_shmdt(ptr);
goto out; goto out;
case SHMGET: case SHMGET:
err = sys_shmget (first, second, (int)third); err = sys_shmget(first, second, (int)third);
goto out; goto out;
case SHMCTL: case SHMCTL:
err = sys_shmctl (first, second | IPC_64, (struct shmid_ds __user *) ptr); err = sys_shmctl(first, second | IPC_64, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
} };
else } else {
err = -ENOSYS; err = -ENOSYS;
}
out: out:
return err; return err;
} }
asmlinkage int sparc64_newuname(struct new_utsname __user *name) asmlinkage long sparc64_newuname(struct new_utsname __user *name)
{ {
int ret = sys_newuname(name); int ret = sys_newuname(name);
if (current->personality == PER_LINUX32 && !ret) { if (current->personality == PER_LINUX32 && !ret) {
ret = copy_to_user(name->machine, "sparc\0\0", 8) ? -EFAULT : 0; ret = (copy_to_user(name->machine, "sparc\0\0", 8)
? -EFAULT : 0);
} }
return ret; return ret;
} }
asmlinkage int sparc64_personality(unsigned long personality) asmlinkage long sparc64_personality(unsigned long personality)
{ {
int ret; int ret;
if (current->personality == PER_LINUX32 && personality == PER_LINUX) if (current->personality == PER_LINUX32 &&
personality == PER_LINUX)
personality = PER_LINUX32; personality = PER_LINUX32;
ret = sys_personality(personality); ret = sys_personality(personality);
if (ret == PER_LINUX32) if (ret == PER_LINUX32)
...@@ -408,8 +416,7 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr, ...@@ -408,8 +416,7 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr,
} }
/* we come to here via sys_nis_syscall so it can setup the regs argument */ /* we come to here via sys_nis_syscall so it can setup the regs argument */
asmlinkage unsigned long asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs)
c_sys_nis_syscall (struct pt_regs *regs)
{ {
static int count; static int count;
...@@ -427,8 +434,7 @@ c_sys_nis_syscall (struct pt_regs *regs) ...@@ -427,8 +434,7 @@ c_sys_nis_syscall (struct pt_regs *regs)
/* #define DEBUG_SPARC_BREAKPOINT */ /* #define DEBUG_SPARC_BREAKPOINT */
asmlinkage void asmlinkage void sparc_breakpoint(struct pt_regs *regs)
sparc_breakpoint (struct pt_regs *regs)
{ {
siginfo_t info; siginfo_t info;
...@@ -452,7 +458,7 @@ sparc_breakpoint (struct pt_regs *regs) ...@@ -452,7 +458,7 @@ sparc_breakpoint (struct pt_regs *regs)
extern void check_pending(int signum); extern void check_pending(int signum);
asmlinkage int sys_getdomainname(char __user *name, int len) asmlinkage long sys_getdomainname(char __user *name, int len)
{ {
int nlen; int nlen;
int err = -EFAULT; int err = -EFAULT;
...@@ -473,7 +479,7 @@ asmlinkage int sys_getdomainname(char __user *name, int len) ...@@ -473,7 +479,7 @@ asmlinkage int sys_getdomainname(char __user *name, int len)
return err; return err;
} }
asmlinkage int solaris_syscall(struct pt_regs *regs) asmlinkage long solaris_syscall(struct pt_regs *regs)
{ {
static int count; static int count;
...@@ -493,7 +499,7 @@ asmlinkage int solaris_syscall(struct pt_regs *regs) ...@@ -493,7 +499,7 @@ asmlinkage int solaris_syscall(struct pt_regs *regs)
} }
#ifndef CONFIG_SUNOS_EMUL #ifndef CONFIG_SUNOS_EMUL
asmlinkage int sunos_syscall(struct pt_regs *regs) asmlinkage long sunos_syscall(struct pt_regs *regs)
{ {
static int count; static int count;
...@@ -511,7 +517,7 @@ asmlinkage int sunos_syscall(struct pt_regs *regs) ...@@ -511,7 +517,7 @@ asmlinkage int sunos_syscall(struct pt_regs *regs)
} }
#endif #endif
asmlinkage int sys_utrap_install(utrap_entry_t type, asmlinkage long sys_utrap_install(utrap_entry_t type,
utrap_handler_t new_p, utrap_handler_t new_p,
utrap_handler_t new_d, utrap_handler_t new_d,
utrap_handler_t __user *old_p, utrap_handler_t __user *old_p,
...@@ -582,8 +588,7 @@ long sparc_memory_ordering(unsigned long model, struct pt_regs *regs) ...@@ -582,8 +588,7 @@ long sparc_memory_ordering(unsigned long model, struct pt_regs *regs)
return 0; return 0;
} }
asmlinkage long asmlinkage long sys_rt_sigaction(int sig,
sys_rt_sigaction(int sig,
const struct sigaction __user *act, const struct sigaction __user *act,
struct sigaction __user *oact, struct sigaction __user *oact,
void __user *restorer, void __user *restorer,
...@@ -615,8 +620,7 @@ sys_rt_sigaction(int sig, ...@@ -615,8 +620,7 @@ sys_rt_sigaction(int sig,
/* Invoked by rtrap code to update performance counters in /* Invoked by rtrap code to update performance counters in
* user space. * user space.
*/ */
asmlinkage void asmlinkage void update_perfctrs(void)
update_perfctrs(void)
{ {
unsigned long pic, tmp; unsigned long pic, tmp;
...@@ -628,8 +632,7 @@ update_perfctrs(void) ...@@ -628,8 +632,7 @@ update_perfctrs(void)
reset_pic(); reset_pic();
} }
asmlinkage int asmlinkage long sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2)
sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2)
{ {
int err = 0; int err = 0;
......
...@@ -62,31 +62,6 @@ ...@@ -62,31 +62,6 @@
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
/* Use this to get at 32-bit user passed pointers. */
/* Things to consider: the low-level assembly stub does
srl x, 0, x for first four arguments, so if you have
pointer to something in the first four arguments, just
declare it as a pointer, not u32. On the other side,
arguments from 5th onwards should be declared as u32
for pointers, and need AA() around each usage.
A() macro should be used for places where you e.g.
have some internal variable u32 and just want to get
rid of a compiler warning. AA() has to be used in
places where you want to convert a function argument
to 32bit pointer or when you e.g. access pt_regs
structure and want to consider 32bit registers only.
-jj
*/
#define A(__x) ((unsigned long)(__x))
#define AA(__x) \
({ unsigned long __ret; \
__asm__ ("srl %0, 0, %0" \
: "=r" (__ret) \
: "0" (__x)); \
__ret; \
})
asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group) asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
{ {
return sys_chown(filename, low2highuid(user), low2highgid(group)); return sys_chown(filename, low2highuid(user), low2highgid(group));
...@@ -281,8 +256,7 @@ static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i) ...@@ -281,8 +256,7 @@ static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
struct msgbuf32 { s32 mtype; char mtext[1]; }; struct msgbuf32 { s32 mtype; char mtext[1]; };
struct ipc_perm32 struct ipc_perm32 {
{
key_t key; key_t key;
compat_uid_t uid; compat_uid_t uid;
compat_gid_t gid; compat_gid_t gid;
...@@ -383,21 +357,22 @@ struct shmid64_ds32 { ...@@ -383,21 +357,22 @@ struct shmid64_ds32 {
* This is really horribly ugly. * This is really horribly ugly.
*/ */
#define IPCOP_MASK(__x) (1UL << ((__x)&~IPC_64)) #define IPCOP_MASK(__x) (1UL << ((__x)&~IPC_64))
static int do_sys32_semctl(int first, int second, int third, void *uptr) static int do_sys32_semctl(int first, int second, int third,
compat_uptr_t __user *uptr)
{ {
union semun fourth; union semun fourth;
u32 pad; compat_uptr_t pad;
int err = -EINVAL; int err = -EINVAL;
if (!uptr) if (!uptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if (get_user (pad, (u32 __user *)uptr)) if (get_user(pad, uptr))
goto out; goto out;
if ((third & ~IPC_64) == SETVAL) if ((third & ~IPC_64) == SETVAL)
fourth.val = (int)pad; fourth.val = (int)pad;
else else
fourth.__pad = (void __user *)A(pad); fourth.__pad = compat_ptr(pad);
if (IPCOP_MASK (third) & if (IPCOP_MASK (third) &
(IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) | (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) |
IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) | IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) |
...@@ -405,8 +380,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr) ...@@ -405,8 +380,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
err = sys_semctl (first, second, third, fourth); err = sys_semctl (first, second, third, fourth);
} else if (third & IPC_64) { } else if (third & IPC_64) {
struct semid64_ds s; struct semid64_ds s;
struct semid64_ds32 __user *usp = struct semid64_ds32 __user *usp = compat_ptr(pad);
(struct semid64_ds32 __user *)A(pad);
mm_segment_t old_fs; mm_segment_t old_fs;
int need_back_translation; int need_back_translation;
...@@ -434,8 +408,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr) ...@@ -434,8 +408,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
} }
} else { } else {
struct semid_ds s; struct semid_ds s;
struct semid_ds32 __user *usp = struct semid_ds32 __user *usp = compat_ptr(pad);
(struct semid_ds32 __user *)A(pad);
mm_segment_t old_fs; mm_segment_t old_fs;
int need_back_translation; int need_back_translation;
...@@ -474,13 +447,15 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr) ...@@ -474,13 +447,15 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
return err; return err;
} }
static int do_sys32_msgsnd (int first, int second, int third, void *uptr) static int do_sys32_msgsnd(int first, int second, int third,
void __user *uptr)
{ {
struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER); struct msgbuf32 __user *up = uptr;
struct msgbuf32 __user *up = (struct msgbuf32 __user *) uptr; struct msgbuf *p;
mm_segment_t old_fs; mm_segment_t old_fs;
int err; int err;
p = kmalloc(second + sizeof (struct msgbuf), GFP_USER);
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
err = -EFAULT; err = -EFAULT;
...@@ -489,15 +464,16 @@ static int do_sys32_msgsnd (int first, int second, int third, void *uptr) ...@@ -489,15 +464,16 @@ static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
goto out; goto out;
old_fs = get_fs (); old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
err = sys_msgsnd (first, (struct msgbuf __user *) p, second, third); err = sys_msgsnd (first, (struct msgbuf __user *) p,
second, third);
set_fs (old_fs); set_fs (old_fs);
out: out:
kfree (p); kfree (p);
return err; return err;
} }
static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, static int do_sys32_msgrcv(int first, int second, int msgtyp, int third,
int version, void *uptr) int version, void __user *uptr)
{ {
struct msgbuf32 __user *up; struct msgbuf32 __user *up;
struct msgbuf *p; struct msgbuf *p;
...@@ -505,21 +481,21 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, ...@@ -505,21 +481,21 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
int err; int err;
if (!version) { if (!version) {
struct ipc_kludge __user *uipck = struct ipc_kludge __user *uipck = uptr;
(struct ipc_kludge __user *) uptr;
struct ipc_kludge ipck; struct ipc_kludge ipck;
err = -EINVAL; err = -EINVAL;
if (!uptr) if (!uptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge))) if (copy_from_user (&ipck, uipck,
sizeof (struct ipc_kludge)))
goto out; goto out;
uptr = (void *)A(ipck.msgp); uptr = compat_ptr(ipck.msgp);
msgtyp = ipck.msgtyp; msgtyp = ipck.msgtyp;
} }
err = -ENOMEM; err = -ENOMEM;
p = kmalloc (second + sizeof (struct msgbuf), GFP_USER); p = kmalloc(second + sizeof (struct msgbuf), GFP_USER);
if (!p) if (!p)
goto out; goto out;
old_fs = get_fs (); old_fs = get_fs ();
...@@ -529,7 +505,7 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, ...@@ -529,7 +505,7 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
set_fs (old_fs); set_fs (old_fs);
if (err < 0) if (err < 0)
goto free_then_out; goto free_then_out;
up = (struct msgbuf32 __user *) uptr; up = uptr;
if (put_user (p->mtype, &up->mtype) || if (put_user (p->mtype, &up->mtype) ||
__copy_to_user (&up->mtext, p->mtext, err)) __copy_to_user (&up->mtext, p->mtext, err))
err = -EFAULT; err = -EFAULT;
...@@ -539,39 +515,46 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, ...@@ -539,39 +515,46 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
return err; return err;
} }
static int do_sys32_msgctl (int first, int second, void *uptr) static int do_sys32_msgctl(int first, int second, void __user *uptr)
{ {
int err; int err;
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) | (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) |
IPCOP_MASK (IPC_RMID))) { IPCOP_MASK (IPC_RMID))) {
err = sys_msgctl (first, second, err = sys_msgctl (first, second, uptr);
(struct msqid_ds __user *)uptr);
} else if (second & IPC_64) { } else if (second & IPC_64) {
struct msqid64_ds m; struct msqid64_ds m;
struct msqid64_ds32 __user *up = struct msqid64_ds32 __user *up = uptr;
(struct msqid64_ds32 __user *) uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
if (second == (IPC_SET|IPC_64)) { if (second == (IPC_SET|IPC_64)) {
err = get_user (m.msg_perm.uid, &up->msg_perm.uid); err = get_user (m.msg_perm.uid,
err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid); &up->msg_perm.uid);
err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode); err |= __get_user (m.msg_perm.gid,
err |= __get_user (m.msg_qbytes, &up->msg_qbytes); &up->msg_perm.gid);
err |= __get_user (m.msg_perm.mode,
&up->msg_perm.mode);
err |= __get_user (m.msg_qbytes,
&up->msg_qbytes);
if (err) if (err)
goto out; goto out;
} }
old_fs = get_fs (); old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
err = sys_msgctl (first, second, (struct msqid_ds __user *)&m); err = sys_msgctl(first, second,
(struct msqid_ds __user *)&m);
set_fs (old_fs); set_fs (old_fs);
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) { (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
int err2 = copy_to_user(&up->msg_perm, &m.msg_perm, sizeof(struct ipc64_perm) + 3*sizeof(time_t)); int err2 = copy_to_user(&up->msg_perm,
err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes); &m.msg_perm,
(sizeof(struct ipc64_perm) + 3*sizeof(time_t)));
err2 |= __put_user (m.msg_cbytes,
&up->msg_cbytes);
err2 |= __put_user (m.msg_qnum, &up->msg_qnum); err2 |= __put_user (m.msg_qnum, &up->msg_qnum);
err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes); err2 |= __put_user (m.msg_qbytes,
&up->msg_qbytes);
err2 |= __put_user (m.msg_lspid, &up->msg_lspid); err2 |= __put_user (m.msg_lspid, &up->msg_lspid);
err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid); err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid);
if (err2) if (err2)
...@@ -579,39 +562,52 @@ static int do_sys32_msgctl (int first, int second, void *uptr) ...@@ -579,39 +562,52 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
} }
} else { } else {
struct msqid_ds m; struct msqid_ds m;
struct msqid_ds32 __user *up = struct msqid_ds32 __user *up = uptr;
(struct msqid_ds32 __user *)uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
if (second == IPC_SET) { if (second == IPC_SET) {
err = get_user (m.msg_perm.uid, &up->msg_perm.uid); err = get_user(m.msg_perm.uid,
err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid); &up->msg_perm.uid);
err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode); err |= __get_user(m.msg_perm.gid,
err |= __get_user (m.msg_qbytes, &up->msg_qbytes); &up->msg_perm.gid);
err |= __get_user(m.msg_perm.mode,
&up->msg_perm.mode);
err |= __get_user(m.msg_qbytes,
&up->msg_qbytes);
if (err) if (err)
goto out; goto out;
} }
old_fs = get_fs (); old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
err = sys_msgctl (first, second, (struct msqid_ds __user *) &m); err = sys_msgctl(first, second,
(struct msqid_ds __user *) &m);
set_fs (old_fs); set_fs (old_fs);
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) { (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
int err2 = put_user (m.msg_perm.key, &up->msg_perm.key); int err2 = put_user(m.msg_perm.key,
err2 |= __put_user (high2lowuid(m.msg_perm.uid), &up->msg_perm.uid); &up->msg_perm.key);
err2 |= __put_user (high2lowgid(m.msg_perm.gid), &up->msg_perm.gid); err2 |= __put_user(high2lowuid(m.msg_perm.uid),
err2 |= __put_user (high2lowuid(m.msg_perm.cuid), &up->msg_perm.cuid); &up->msg_perm.uid);
err2 |= __put_user (high2lowgid(m.msg_perm.cgid), &up->msg_perm.cgid); err2 |= __put_user(high2lowgid(m.msg_perm.gid),
err2 |= __put_user (m.msg_perm.mode, &up->msg_perm.mode); &up->msg_perm.gid);
err2 |= __put_user (m.msg_perm.seq, &up->msg_perm.seq); err2 |= __put_user(high2lowuid(m.msg_perm.cuid),
err2 |= __put_user (m.msg_stime, &up->msg_stime); &up->msg_perm.cuid);
err2 |= __put_user (m.msg_rtime, &up->msg_rtime); err2 |= __put_user(high2lowgid(m.msg_perm.cgid),
err2 |= __put_user (m.msg_ctime, &up->msg_ctime); &up->msg_perm.cgid);
err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes); err2 |= __put_user(m.msg_perm.mode,
err2 |= __put_user (m.msg_qnum, &up->msg_qnum); &up->msg_perm.mode);
err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes); err2 |= __put_user(m.msg_perm.seq,
err2 |= __put_user (m.msg_lspid, &up->msg_lspid); &up->msg_perm.seq);
err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid); err2 |= __put_user(m.msg_stime, &up->msg_stime);
err2 |= __put_user(m.msg_rtime, &up->msg_rtime);
err2 |= __put_user(m.msg_ctime, &up->msg_ctime);
err2 |= __put_user(m.msg_cbytes,
&up->msg_cbytes);
err2 |= __put_user(m.msg_qnum, &up->msg_qnum);
err2 |= __put_user(m.msg_qbytes,
&up->msg_qbytes);
err2 |= __put_user(m.msg_lspid, &up->msg_lspid);
err2 |= __put_user(m.msg_lrpid, &up->msg_lrpid);
if (err2) if (err2)
err = -EFAULT; err = -EFAULT;
} }
...@@ -624,7 +620,7 @@ static int do_sys32_msgctl (int first, int second, void *uptr) ...@@ -624,7 +620,7 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
static int do_sys32_shmat (int first, int second, int third, int version, void __user *uptr) static int do_sys32_shmat (int first, int second, int third, int version, void __user *uptr)
{ {
unsigned long raddr; unsigned long raddr;
u32 __user *uaddr = (u32 __user *)A((u32)third); u32 __user *uaddr = compat_ptr((compat_uptr_t)third);
int err = -EINVAL; int err = -EINVAL;
if (version == 1) if (version == 1)
...@@ -637,66 +633,75 @@ static int do_sys32_shmat (int first, int second, int third, int version, void _ ...@@ -637,66 +633,75 @@ static int do_sys32_shmat (int first, int second, int third, int version, void _
return err; return err;
} }
static int do_sys32_shmctl (int first, int second, void *uptr) static int do_sys32_shmctl(int first, int second, void __user *uptr)
{ {
int err; int err;
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) | IPCOP_MASK (SHM_UNLOCK) | (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) |
IPCOP_MASK (IPC_RMID))) { IPCOP_MASK (SHM_UNLOCK) | IPCOP_MASK (IPC_RMID))) {
if (second == (IPC_INFO|IPC_64)) if (second == (IPC_INFO|IPC_64)) {
second = IPC_INFO; /* So that we don't have to translate it */ /* So that we don't have to translate it */
err = sys_shmctl (first, second, second = IPC_INFO;
(struct shmid_ds __user *) uptr); }
err = sys_shmctl(first, second, uptr);
} else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) { } else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) {
struct shmid64_ds s; struct shmid64_ds s;
struct shmid64_ds32 __user *up = struct shmid64_ds32 __user *up = uptr;
(struct shmid64_ds32 __user *) uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
if (second == (IPC_SET|IPC_64)) { if (second == (IPC_SET|IPC_64)) {
err = get_user (s.shm_perm.uid, &up->shm_perm.uid); err = get_user(s.shm_perm.uid,
err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid); &up->shm_perm.uid);
err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode); err |= __get_user(s.shm_perm.gid,
&up->shm_perm.gid);
err |= __get_user(s.shm_perm.mode,
&up->shm_perm.mode);
if (err) if (err)
goto out; goto out;
} }
old_fs = get_fs (); old_fs = get_fs();
set_fs (KERNEL_DS); set_fs(KERNEL_DS);
err = sys_shmctl (first, second, (struct shmid_ds __user *)&s); err = sys_shmctl(first, second,
set_fs (old_fs); (struct shmid_ds __user *)&s);
set_fs(old_fs);
if (err < 0) if (err < 0)
goto out; goto out;
/* Mask it even in this case so it becomes a CSE. */ /* Mask it even in this case so it becomes a CSE. */
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) { (IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) {
int err2 = copy_to_user (&up->shm_perm, &s.shm_perm, sizeof(struct ipc64_perm) + 3*sizeof(time_t)); int err2 = copy_to_user(&up->shm_perm,
err2 |= __put_user (s.shm_segsz, &up->shm_segsz); &s.shm_perm,
err2 |= __put_user (s.shm_nattch, &up->shm_nattch); sizeof(struct ipc64_perm) + 3*sizeof(time_t));
err2 |= __put_user (s.shm_cpid, &up->shm_cpid); err2 |= __put_user(s.shm_segsz, &up->shm_segsz);
err2 |= __put_user (s.shm_lpid, &up->shm_lpid); err2 |= __put_user(s.shm_nattch,&up->shm_nattch);
err2 |= __put_user(s.shm_cpid, &up->shm_cpid);
err2 |= __put_user(s.shm_lpid, &up->shm_lpid);
if (err2) if (err2)
err = -EFAULT; err = -EFAULT;
} }
} else { } else {
struct shmid_ds s; struct shmid_ds s;
struct shmid_ds32 __user *up = struct shmid_ds32 __user *up = uptr;
(struct shmid_ds32 __user *) uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
second &= ~IPC_64; second &= ~IPC_64;
if (second == IPC_SET) { if (second == IPC_SET) {
err = get_user (s.shm_perm.uid, &up->shm_perm.uid); err = get_user(s.shm_perm.uid,
err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid); &up->shm_perm.uid);
err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode); err |= __get_user(s.shm_perm.gid,
&up->shm_perm.gid);
err |= __get_user(s.shm_perm.mode,
&up->shm_perm.mode);
if (err) if (err)
goto out; goto out;
} }
old_fs = get_fs (); old_fs = get_fs();
set_fs (KERNEL_DS); set_fs(KERNEL_DS);
err = sys_shmctl (first, second, (struct shmid_ds __user *) &s); err = sys_shmctl(first, second,
set_fs (old_fs); (struct shmid_ds __user *) &s);
set_fs(old_fs);
if (err < 0) if (err < 0)
goto out; goto out;
...@@ -707,33 +712,45 @@ static int do_sys32_shmctl (int first, int second, void *uptr) ...@@ -707,33 +712,45 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
u32 shm_tot, shm_rss, shm_swp; u32 shm_tot, shm_rss, shm_swp;
u32 swap_attempts, swap_successes; u32 swap_attempts, swap_successes;
}; };
struct shm_info32 __user *uip = struct shm_info32 __user *uip = uptr;
(struct shm_info32 __user *) uptr; struct shm_info *kp = (struct shm_info *) &s;
struct shm_info *kp = (struct shm_info *)&s; int err2 = put_user(kp->used_ids,
int err2 = put_user (kp->used_ids, &uip->used_ids); &uip->used_ids);
err2 |= __put_user (kp->shm_tot, &uip->shm_tot); err2 |= __put_user(kp->shm_tot, &uip->shm_tot);
err2 |= __put_user (kp->shm_rss, &uip->shm_rss); err2 |= __put_user(kp->shm_rss, &uip->shm_rss);
err2 |= __put_user (kp->shm_swp, &uip->shm_swp); err2 |= __put_user(kp->shm_swp, &uip->shm_swp);
err2 |= __put_user (kp->swap_attempts, &uip->swap_attempts); err2 |= __put_user(kp->swap_attempts,
err2 |= __put_user (kp->swap_successes, &uip->swap_successes); &uip->swap_attempts);
err2 |= __put_user(kp->swap_successes,
&uip->swap_successes);
if (err2) if (err2)
err = -EFAULT; err = -EFAULT;
} else if (IPCOP_MASK (second) & } else if (IPCOP_MASK (second) &
(IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) { (IPCOP_MASK (SHM_STAT) |
int err2 = put_user (s.shm_perm.key, &up->shm_perm.key); IPCOP_MASK (IPC_STAT))) {
err2 |= __put_user (high2lowuid(s.shm_perm.uid), &up->shm_perm.uid); int err2;
err2 |= __put_user (high2lowuid(s.shm_perm.gid), &up->shm_perm.gid);
err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid); err2 = put_user(s.shm_perm.key,
err2 |= __put_user (high2lowuid(s.shm_perm.cgid), &up->shm_perm.cgid); &up->shm_perm.key);
err2 |= __put_user (s.shm_perm.mode, &up->shm_perm.mode); err2 |= __put_user(high2lowuid(s.shm_perm.uid),
err2 |= __put_user (s.shm_perm.seq, &up->shm_perm.seq); &up->shm_perm.uid);
err2 |= __put_user (s.shm_atime, &up->shm_atime); err2 |= __put_user(high2lowuid(s.shm_perm.gid),
err2 |= __put_user (s.shm_dtime, &up->shm_dtime); &up->shm_perm.gid);
err2 |= __put_user (s.shm_ctime, &up->shm_ctime); err2 |= __put_user(high2lowuid(s.shm_perm.cuid),
err2 |= __put_user (s.shm_segsz, &up->shm_segsz); &up->shm_perm.cuid);
err2 |= __put_user (s.shm_nattch, &up->shm_nattch); err2 |= __put_user(high2lowuid(s.shm_perm.cgid),
err2 |= __put_user (s.shm_cpid, &up->shm_cpid); &up->shm_perm.cgid);
err2 |= __put_user (s.shm_lpid, &up->shm_lpid); err2 |= __put_user(s.shm_perm.mode,
&up->shm_perm.mode);
err2 |= __put_user(s.shm_perm.seq,
&up->shm_perm.seq);
err2 |= __put_user(s.shm_atime, &up->shm_atime);
err2 |= __put_user(s.shm_dtime, &up->shm_dtime);
err2 |= __put_user(s.shm_ctime, &up->shm_ctime);
err2 |= __put_user(s.shm_segsz, &up->shm_segsz);
err2 |= __put_user(s.shm_nattch,&up->shm_nattch);
err2 |= __put_user(s.shm_cpid, &up->shm_cpid);
err2 |= __put_user(s.shm_lpid, &up->shm_lpid);
if (err2) if (err2)
err = -EFAULT; err = -EFAULT;
} }
...@@ -742,12 +759,14 @@ static int do_sys32_shmctl (int first, int second, void *uptr) ...@@ -742,12 +759,14 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
return err; return err;
} }
static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems, static int sys32_semtimedop(int semid, struct sembuf __user *tsems,
int nsems,
const struct compat_timespec __user *timeout32) const struct compat_timespec __user *timeout32)
{ {
struct compat_timespec t32; struct compat_timespec t32;
struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64)); struct timespec __user *t64;
t64 = compat_alloc_user_space(sizeof(*t64));
if (copy_from_user(&t32, timeout32, sizeof(t32))) if (copy_from_user(&t32, timeout32, sizeof(t32)))
return -EFAULT; return -EFAULT;
...@@ -758,77 +777,81 @@ static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems, ...@@ -758,77 +777,81 @@ static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems,
return sys_semtimedop(semid, tsems, nsems, t64); return sys_semtimedop(semid, tsems, nsems, t64);
} }
asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) asmlinkage long compat_sys_ipc(u32 call, int first, int second, int third, compat_uptr_t __ptr, u32 fifth)
{ {
int version, err; int version, err;
void __user *ptr = compat_ptr(__ptr);
version = call >> 16; /* hack for backward compatibility */ version = call >> 16; /* hack for backward compatibility */
call &= 0xffff; call &= 0xffff;
if (call <= SEMCTL) if (call <= SEMCTL) {
switch (call) { switch (call) {
case SEMOP: case SEMOP:
/* struct sembuf is the same on 32 and 64bit :)) */ /* struct sembuf is the same on 32 and 64 :)) */
err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second, NULL); err = sys_semtimedop (first, ptr, second, NULL);
goto out; goto out;
case SEMTIMEDOP: case SEMTIMEDOP:
err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second, (const struct compat_timespec __user *) AA(fifth)); err = sys32_semtimedop(first, ptr, second,
compat_ptr(fifth));
case SEMGET: case SEMGET:
err = sys_semget (first, second, third); err = sys_semget(first, second, third);
goto out; goto out;
case SEMCTL: case SEMCTL:
err = do_sys32_semctl (first, second, third, (void *)AA(ptr)); err = do_sys32_semctl(first, second, third, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
}; };
if (call <= MSGCTL) }
if (call <= MSGCTL) {
switch (call) { switch (call) {
case MSGSND: case MSGSND:
err = do_sys32_msgsnd (first, second, third, (void *)AA(ptr)); err = do_sys32_msgsnd(first, second, third, ptr);
goto out; goto out;
case MSGRCV: case MSGRCV:
err = do_sys32_msgrcv (first, second, fifth, third, err = do_sys32_msgrcv(first, second, fifth,
version, (void *)AA(ptr)); third, version, ptr);
goto out; goto out;
case MSGGET: case MSGGET:
err = sys_msgget ((key_t) first, second); err = sys_msgget((key_t) first, second);
goto out; goto out;
case MSGCTL: case MSGCTL:
err = do_sys32_msgctl (first, second, (void *)AA(ptr)); err = do_sys32_msgctl(first, second, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
};
} }
if (call <= SHMCTL) if (call <= SHMCTL) {
switch (call) { switch (call) {
case SHMAT: case SHMAT:
err = do_sys32_shmat (first, second, third, err = do_sys32_shmat(first, second, third,
version, (void __user *)AA(ptr)); version, ptr);
goto out; goto out;
case SHMDT: case SHMDT:
err = sys_shmdt ((char __user *)AA(ptr)); err = sys_shmdt(ptr);
goto out; goto out;
case SHMGET: case SHMGET:
err = sys_shmget (first, second, third); err = sys_shmget(first, second, third);
goto out; goto out;
case SHMCTL: case SHMCTL:
err = do_sys32_shmctl (first, second, (void *)AA(ptr)); err = do_sys32_shmctl(first, second, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
};
} }
err = -ENOSYS; err = -ENOSYS;
out: out:
return err; return err;
} }
asmlinkage int sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
{ {
if ((int)high < 0) if ((int)high < 0)
return -EINVAL; return -EINVAL;
...@@ -836,7 +859,7 @@ asmlinkage int sys32_truncate64(const char __user * path, unsigned long high, un ...@@ -836,7 +859,7 @@ asmlinkage int sys32_truncate64(const char __user * path, unsigned long high, un
return sys_truncate(path, (high << 32) | low); return sys_truncate(path, (high << 32) | low);
} }
asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low) asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
{ {
if ((int)high < 0) if ((int)high < 0)
return -EINVAL; return -EINVAL;
...@@ -879,7 +902,7 @@ static int fillonedir(void * __buf, const char * name, int namlen, ...@@ -879,7 +902,7 @@ static int fillonedir(void * __buf, const char * name, int namlen,
return 0; return 0;
} }
asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count) asmlinkage long old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count)
{ {
int error = -EBADF; int error = -EBADF;
struct file * file; struct file * file;
...@@ -943,7 +966,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, i ...@@ -943,7 +966,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, i
return 0; return 0;
} }
asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count) asmlinkage long sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count)
{ {
struct file * file; struct file * file;
struct linux_dirent32 __user *lastdirent; struct linux_dirent32 __user *lastdirent;
...@@ -964,7 +987,7 @@ asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dir ...@@ -964,7 +987,7 @@ asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dir
goto out_putf; goto out_putf;
lastdirent = buf.previous; lastdirent = buf.previous;
error = buf.error; error = buf.error;
if(lastdirent) { if (lastdirent) {
put_user(file->f_pos, &lastdirent->d_off); put_user(file->f_pos, &lastdirent->d_off);
error = count - buf.count; error = count - buf.count;
} }
...@@ -1006,7 +1029,7 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) ...@@ -1006,7 +1029,7 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
return err; return err;
} }
asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2) asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
{ {
return sys_sysfs(option, arg1, arg2); return sys_sysfs(option, arg1, arg2);
} }
...@@ -1028,7 +1051,7 @@ struct sysinfo32 { ...@@ -1028,7 +1051,7 @@ struct sysinfo32 {
char _f[20-2*sizeof(int)-sizeof(int)]; char _f[20-2*sizeof(int)-sizeof(int)];
}; };
asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info) asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
{ {
struct sysinfo s; struct sysinfo s;
int ret, err; int ret, err;
...@@ -1075,7 +1098,7 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info) ...@@ -1075,7 +1098,7 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
return ret; return ret;
} }
asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval) asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval)
{ {
struct timespec t; struct timespec t;
int ret; int ret;
...@@ -1089,7 +1112,10 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_times ...@@ -1089,7 +1112,10 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_times
return ret; return ret;
} }
asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset, compat_size_t sigsetsize) asmlinkage long compat_sys_rt_sigprocmask(int how,
compat_sigset_t __user *set,
compat_sigset_t __user *oset,
compat_size_t sigsetsize)
{ {
sigset_t s; sigset_t s;
compat_sigset_t s32; compat_sigset_t s32;
...@@ -1126,7 +1152,8 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat ...@@ -1126,7 +1152,8 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat
return 0; return 0;
} }
asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize) asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
compat_size_t sigsetsize)
{ {
sigset_t s; sigset_t s;
compat_sigset_t s32; compat_sigset_t s32;
...@@ -1149,8 +1176,8 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t si ...@@ -1149,8 +1176,8 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t si
return ret; return ret;
} }
asmlinkage int asmlinkage long sys32_rt_sigtimedwait(compat_sigset_t __user *uthese,
sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo, siginfo_t32 __user *uinfo,
struct compat_timespec __user *uts, struct compat_timespec __user *uts,
compat_size_t sigsetsize) compat_size_t sigsetsize)
{ {
...@@ -1234,8 +1261,8 @@ sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo, ...@@ -1234,8 +1261,8 @@ sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
return ret; return ret;
} }
asmlinkage int asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig,
sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo) siginfo_t32 __user *uinfo)
{ {
siginfo_t info; siginfo_t info;
int ret; int ret;
...@@ -1250,7 +1277,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo) ...@@ -1250,7 +1277,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo)
return ret; return ret;
} }
asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 __user *act, asmlinkage long compat_sys_sigaction(int sig, struct old_sigaction32 __user *act,
struct old_sigaction32 __user *oact) struct old_sigaction32 __user *oact)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
...@@ -1289,10 +1316,11 @@ asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 __user *act, ...@@ -1289,10 +1316,11 @@ asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 __user *act,
return ret; return ret;
} }
asmlinkage int asmlinkage long compat_sys_rt_sigaction(int sig,
sys32_rt_sigaction(int sig, struct sigaction32 __user *act, struct sigaction32 __user *act,
struct sigaction32 __user *oact, struct sigaction32 __user *oact,
void __user *restorer, compat_size_t sigsetsize) void __user *restorer,
compat_size_t sigsetsize)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -1351,7 +1379,7 @@ sys32_rt_sigaction(int sig, struct sigaction32 __user *act, ...@@ -1351,7 +1379,7 @@ sys32_rt_sigaction(int sig, struct sigaction32 __user *act,
* sparc32_execve() executes a new program after the asm stub has set * sparc32_execve() executes a new program after the asm stub has set
* things up for us. This should basically do what I want it to. * things up for us. This should basically do what I want it to.
*/ */
asmlinkage int sparc32_execve(struct pt_regs *regs) asmlinkage long sparc32_execve(struct pt_regs *regs)
{ {
int error, base = 0; int error, base = 0;
char *filename; char *filename;
...@@ -1359,19 +1387,21 @@ asmlinkage int sparc32_execve(struct pt_regs *regs) ...@@ -1359,19 +1387,21 @@ asmlinkage int sparc32_execve(struct pt_regs *regs)
/* User register window flush is done by entry.S */ /* User register window flush is done by entry.S */
/* Check for indirect call. */ /* Check for indirect call. */
if((u32)regs->u_regs[UREG_G1] == 0) if ((u32)regs->u_regs[UREG_G1] == 0)
base = 1; base = 1;
filename = getname((char __user *)AA(regs->u_regs[base + UREG_I0])); filename = getname(compat_ptr(regs->u_regs[base + UREG_I0]));
error = PTR_ERR(filename); error = PTR_ERR(filename);
if(IS_ERR(filename)) if (IS_ERR(filename))
goto out; goto out;
error = compat_do_execve(filename, error = compat_do_execve(filename,
compat_ptr((u32)regs->u_regs[base + UREG_I1]), compat_ptr(regs->u_regs[base + UREG_I1]),
compat_ptr((u32)regs->u_regs[base + UREG_I2]), regs); compat_ptr(regs->u_regs[base + UREG_I2]), regs);
putname(filename); putname(filename);
if(!error) { if (!error) {
fprs_write(0); fprs_write(0);
current_thread_info()->xfsr[0] = 0; current_thread_info()->xfsr[0] = 0;
current_thread_info()->fpsaved[0] = 0; current_thread_info()->fpsaved[0] = 0;
...@@ -1384,13 +1414,13 @@ asmlinkage int sparc32_execve(struct pt_regs *regs) ...@@ -1384,13 +1414,13 @@ asmlinkage int sparc32_execve(struct pt_regs *regs)
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
asmlinkage int sys32_init_module(void __user *umod, u32 len, asmlinkage long sys32_init_module(void __user *umod, u32 len,
const char __user *uargs) const char __user *uargs)
{ {
return sys_init_module(umod, len, uargs); return sys_init_module(umod, len, uargs);
} }
asmlinkage int sys32_delete_module(const char __user *name_user, asmlinkage long sys32_delete_module(const char __user *name_user,
unsigned int flags) unsigned int flags)
{ {
return sys_delete_module(name_user, flags); return sys_delete_module(name_user, flags);
...@@ -1398,14 +1428,13 @@ asmlinkage int sys32_delete_module(const char __user *name_user, ...@@ -1398,14 +1428,13 @@ asmlinkage int sys32_delete_module(const char __user *name_user,
#else /* CONFIG_MODULES */ #else /* CONFIG_MODULES */
asmlinkage int asmlinkage long sys32_init_module(const char __user *name_user,
sys32_init_module(const char *name_user, struct module *mod_user) struct module __user *mod_user)
{ {
return -ENOSYS; return -ENOSYS;
} }
asmlinkage int asmlinkage long sys32_delete_module(const char __user *name_user)
sys32_delete_module(const char *name_user)
{ {
return -ENOSYS; return -ENOSYS;
} }
...@@ -1417,7 +1446,7 @@ sys32_delete_module(const char *name_user) ...@@ -1417,7 +1446,7 @@ sys32_delete_module(const char *name_user)
extern struct timezone sys_tz; extern struct timezone sys_tz;
asmlinkage int sys32_gettimeofday(struct compat_timeval __user *tv, asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv,
struct timezone __user *tz) struct timezone __user *tz)
{ {
if (tv) { if (tv) {
...@@ -1447,7 +1476,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i) ...@@ -1447,7 +1476,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
return 0; return 0;
} }
asmlinkage int sys32_settimeofday(struct compat_timeval __user *tv, asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv,
struct timezone __user *tz) struct timezone __user *tz)
{ {
struct timespec kts; struct timespec kts;
...@@ -1465,7 +1494,7 @@ asmlinkage int sys32_settimeofday(struct compat_timeval __user *tv, ...@@ -1465,7 +1494,7 @@ asmlinkage int sys32_settimeofday(struct compat_timeval __user *tv,
return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
} }
asmlinkage int sys32_utimes(char __user *filename, asmlinkage long sys32_utimes(char __user *filename,
struct compat_timeval __user *tvs) struct compat_timeval __user *tvs)
{ {
struct timeval ktvs[2]; struct timeval ktvs[2];
...@@ -1480,74 +1509,61 @@ asmlinkage int sys32_utimes(char __user *filename, ...@@ -1480,74 +1509,61 @@ asmlinkage int sys32_utimes(char __user *filename,
} }
/* These are here just in case some old sparc32 binary calls it. */ /* These are here just in case some old sparc32 binary calls it. */
asmlinkage int sys32_pause(void) asmlinkage long sys32_pause(void)
{ {
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule(); schedule();
return -ERESTARTNOHAND; return -ERESTARTNOHAND;
} }
/* PCI config space poking. */ asmlinkage compat_ssize_t sys32_pread64(unsigned int fd,
char __user *ubuf,
asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
{
return sys_pciconfig_read((unsigned long) bus,
(unsigned long) dfn,
(unsigned long) off,
(unsigned long) len,
(unsigned char __user *)AA(ubuf));
}
asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
{
return sys_pciconfig_write((unsigned long) bus,
(unsigned long) dfn,
(unsigned long) off,
(unsigned long) len,
(unsigned char __user *)AA(ubuf));
}
asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
{
return sys_prctl(option,
(unsigned long) arg2,
(unsigned long) arg3,
(unsigned long) arg4,
(unsigned long) arg5);
}
asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char __user *ubuf,
compat_size_t count, compat_size_t count,
u32 poshi, u32 poslo) unsigned long poshi,
unsigned long poslo)
{ {
return sys_pread64(fd, ubuf, count, return sys_pread64(fd, ubuf, count, (poshi << 32) | poslo);
((loff_t)AA(poshi) << 32) | AA(poslo));
} }
asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char __user *ubuf, asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd,
compat_size_t count, u32 poshi, u32 poslo) char __user *ubuf,
compat_size_t count,
unsigned long poshi,
unsigned long poslo)
{ {
return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); return sys_pwrite64(fd, ubuf, count, (poshi << 32) | poslo);
} }
asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count) asmlinkage long compat_sys_readahead(int fd,
unsigned long offhi,
unsigned long offlo,
compat_size_t count)
{ {
return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); return sys_readahead(fd, (offhi << 32) | offlo, count);
} }
long sys32_fadvise64(int fd, u32 offhi, u32 offlo, s32 len, int advice) long compat_sys_fadvise64(int fd,
unsigned long offhi,
unsigned long offlo,
compat_size_t len, int advice)
{ {
return sys_fadvise64_64(fd, ((loff_t)AA(offhi)<<32)|AA(offlo), len, advice); return sys_fadvise64_64(fd, (offhi << 32) | offlo, len, advice);
} }
long sys32_fadvise64_64(int fd, u32 offhi, u32 offlo, u32 lenhi, u32 lenlo, int advice) long compat_sys_fadvise64_64(int fd,
unsigned long offhi, unsigned long offlo,
unsigned long lenhi, unsigned long lenlo,
int advice)
{ {
return sys_fadvise64_64(fd, ((loff_t)AA(offhi)<<32)|AA(offlo), return sys_fadvise64_64(fd,
((loff_t)AA(lenhi)<<32)|AA(lenlo), advice); (offhi << 32) | offlo,
(lenhi << 32) | lenlo,
advice);
} }
asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
compat_off_t __user *offset,
compat_size_t count)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int ret; int ret;
...@@ -1568,7 +1584,9 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset ...@@ -1568,7 +1584,9 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset
return ret; return ret;
} }
asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count) asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
compat_loff_t __user *offset,
compat_size_t count)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int ret; int ret;
...@@ -1606,14 +1624,14 @@ struct timex32 { ...@@ -1606,14 +1624,14 @@ struct timex32 {
extern int do_adjtimex(struct timex *); extern int do_adjtimex(struct timex *);
asmlinkage int sys32_adjtimex(struct timex32 __user *utp) asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
{ {
struct timex txc; struct timex txc;
int ret; int ret;
memset(&txc, 0, sizeof(struct timex)); memset(&txc, 0, sizeof(struct timex));
if(get_user(txc.modes, &utp->modes) || if (get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) || __get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) || __get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) || __get_user(txc.maxerror, &utp->maxerror) ||
...@@ -1637,7 +1655,7 @@ asmlinkage int sys32_adjtimex(struct timex32 __user *utp) ...@@ -1637,7 +1655,7 @@ asmlinkage int sys32_adjtimex(struct timex32 __user *utp)
ret = do_adjtimex(&txc); ret = do_adjtimex(&txc);
if(put_user(txc.modes, &utp->modes) || if (put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) || __put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) || __put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) || __put_user(txc.maxerror, &utp->maxerror) ||
...@@ -1666,7 +1684,8 @@ asmlinkage int sys32_adjtimex(struct timex32 __user *utp) ...@@ -1666,7 +1684,8 @@ asmlinkage int sys32_adjtimex(struct timex32 __user *utp)
* not force O_LARGEFILE on. * not force O_LARGEFILE on.
*/ */
asmlinkage long sparc32_open(const char __user *filename, int flags, int mode) asmlinkage long sparc32_open(const char __user *filename,
int flags, int mode)
{ {
char * tmp; char * tmp;
int fd, error; int fd, error;
...@@ -1703,7 +1722,7 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr, ...@@ -1703,7 +1722,7 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
{ {
struct vm_area_struct *vma; struct vm_area_struct *vma;
unsigned long ret = -EINVAL; unsigned long ret = -EINVAL;
unsigned long new_addr = AA(__new_addr); unsigned long new_addr = __new_addr;
if (old_len > 0xf0000000UL || new_len > 0xf0000000UL) if (old_len > 0xf0000000UL || new_len > 0xf0000000UL)
goto out; goto out;
...@@ -1744,13 +1763,6 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr, ...@@ -1744,13 +1763,6 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
return ret; return ret;
} }
asmlinkage int sys_setpriority32(u32 which, u32 who, u32 niceval)
{
return sys_setpriority((int) which,
(int) who,
(int) niceval);
}
struct __sysctl_args32 { struct __sysctl_args32 {
u32 name; u32 name;
int nlen; int nlen;
...@@ -1781,21 +1793,24 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) ...@@ -1781,21 +1793,24 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
basically copy the whole sysctl.c here, and basically copy the whole sysctl.c here, and
glibc's __sysctl uses rw memory for the structure glibc's __sysctl uses rw memory for the structure
anyway. */ anyway. */
if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) || if (get_user(oldlen, (u32 __user *)(unsigned long)tmp.oldlenp) ||
put_user(oldlen, (size_t __user *)addr)) put_user(oldlen, (size_t __user *)addr))
return -EFAULT; return -EFAULT;
oldlenp = (size_t __user *)addr; oldlenp = (size_t __user *)addr;
} }
lock_kernel(); lock_kernel();
error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, error = do_sysctl((int __user *)(unsigned long) tmp.name,
(void __user *)A(tmp.oldval), tmp.nlen,
oldlenp, (void __user *)A(tmp.newval), tmp.newlen); (void __user *)(unsigned long) tmp.oldval,
oldlenp,
(void __user *)(unsigned long) tmp.newval,
tmp.newlen);
unlock_kernel(); unlock_kernel();
if (oldlenp) { if (oldlenp) {
if (!error) { if (!error) {
if (get_user(oldlen, (size_t __user *)addr) || if (get_user(oldlen, (size_t __user *)addr) ||
put_user(oldlen, (u32 __user *)A(tmp.oldlenp))) put_user(oldlen, (u32 __user *)(unsigned long) tmp.oldlenp))
error = -EFAULT; error = -EFAULT;
} }
copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
...@@ -1804,10 +1819,11 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) ...@@ -1804,10 +1819,11 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
#endif #endif
} }
long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, long sys32_lookup_dcookie(unsigned long cookie_high,
unsigned long cookie_low,
char __user *buf, size_t len) char __user *buf, size_t len)
{ {
return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low, return sys_lookup_dcookie((cookie_high << 32) | cookie_low,
buf, len); buf, len);
} }
......
...@@ -59,15 +59,6 @@ ...@@ -59,15 +59,6 @@
#include <net/sock.h> #include <net/sock.h>
#include <net/compat.h> #include <net/compat.h>
/* Use this to get at 32-bit user passed pointers. */
#define A(__x) \
({ unsigned long __ret; \
__asm__ ("srl %0, 0, %0" \
: "=r" (__ret) \
: "0" (__x)); \
__ret; \
})
#define SUNOS_NR_OPEN 256 #define SUNOS_NR_OPEN 256
asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 off) asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 off)
...@@ -308,13 +299,12 @@ static int sunos_filldir(void * __buf, const char * name, int namlen, ...@@ -308,13 +299,12 @@ static int sunos_filldir(void * __buf, const char * name, int namlen,
return 0; return 0;
} }
asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt) asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt)
{ {
struct file * file; struct file * file;
struct sunos_dirent __user *lastdirent; struct sunos_dirent __user *lastdirent;
struct sunos_dirent_callback buf; struct sunos_dirent_callback buf;
int error = -EBADF; int error = -EBADF;
void __user *dirent = (void __user *)A(u_dirent);
if (fd >= SUNOS_NR_OPEN) if (fd >= SUNOS_NR_OPEN)
goto out; goto out;
...@@ -389,11 +379,11 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen, ...@@ -389,11 +379,11 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen,
return 0; return 0;
} }
asmlinkage int sunos_getdirentries(unsigned int fd, u32 u_dirent, asmlinkage int sunos_getdirentries(unsigned int fd,
int cnt, u32 u_basep) void __user *dirent,
int cnt,
unsigned int __user *basep)
{ {
void __user *dirent = (void __user *) A(u_dirent);
unsigned int __user *basep = (unsigned int __user *)A(u_basep);
struct file * file; struct file * file;
struct sunos_direntry __user *lastdirent; struct sunos_direntry __user *lastdirent;
int error = -EBADF; int error = -EBADF;
...@@ -813,13 +803,12 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid) ...@@ -813,13 +803,12 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int, extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int,
struct compat_rusage *); struct compat_rusage *);
asmlinkage int sunos_wait4(compat_pid_t pid, u32 stat_addr, int options, u32 ru) asmlinkage int sunos_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru)
{ {
int ret; int ret;
ret = compat_sys_wait4((pid ? pid : ((compat_pid_t)-1)), ret = compat_sys_wait4((pid ? pid : ((compat_pid_t)-1)),
(compat_uint_t *)A(stat_addr), options, stat_addr, options, ru);
(struct compat_rusage *)A(ru));
return ret; return ret;
} }
...@@ -893,7 +882,7 @@ asmlinkage s32 sunos_sysconf (int name) ...@@ -893,7 +882,7 @@ asmlinkage s32 sunos_sysconf (int name)
return ret; return ret;
} }
asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr) asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, void __user *ptr)
{ {
union semun arg4; union semun arg4;
int ret; int ret;
...@@ -919,7 +908,7 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr) ...@@ -919,7 +908,7 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
} }
/* sys_semctl(): */ /* sys_semctl(): */
/* value to modify semaphore to */ /* value to modify semaphore to */
arg4.__pad=(void __user *)A(ptr); arg4.__pad = ptr;
ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4); ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4);
break; break;
case 1: case 1:
...@@ -928,7 +917,7 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr) ...@@ -928,7 +917,7 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
break; break;
case 2: case 2:
/* sys_semop(): */ /* sys_semop(): */
ret = sys_semop((int)arg1, (struct sembuf __user *)A(arg2), ret = sys_semop((int)arg1, (struct sembuf __user *)(unsigned long)arg2,
(unsigned int) arg3); (unsigned int) arg3);
break; break;
default: default:
...@@ -1041,13 +1030,13 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) ...@@ -1041,13 +1030,13 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
rval = sys_msgget((key_t)arg1, (int)arg2); rval = sys_msgget((key_t)arg1, (int)arg2);
break; break;
case 1: case 1:
if (!sunos_msqid_get((struct msqid_ds32 __user *)A(arg3), &kds)) { if (!sunos_msqid_get((struct msqid_ds32 __user *)(unsigned long)arg3, &kds)) {
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
rval = sys_msgctl((int)arg1, (int)arg2, rval = sys_msgctl((int)arg1, (int)arg2,
(struct msqid_ds __user *)A(arg3)); (struct msqid_ds __user *)(unsigned long)arg3);
set_fs(old_fs); set_fs(old_fs);
if (!rval) if (!rval)
rval = sunos_msqid_put((struct msqid_ds32 __user *)A(arg3), rval = sunos_msqid_put((struct msqid_ds32 __user *)(unsigned long)arg3,
&kds); &kds);
} else } else
rval = -EFAULT; rval = -EFAULT;
...@@ -1071,7 +1060,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) ...@@ -1071,7 +1060,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
(long)arg4, (int)arg5); (long)arg4, (int)arg5);
set_fs(old_fs); set_fs(old_fs);
if (!rval) if (!rval)
rval = sunos_msgbuf_put((struct msgbuf32 __user *)A(arg2), rval = sunos_msgbuf_put((struct msgbuf32 __user *)(unsigned long)arg2,
kmbuf, arg3); kmbuf, arg3);
kfree(kmbuf); kfree(kmbuf);
break; break;
...@@ -1079,7 +1068,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) ...@@ -1079,7 +1068,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
rval = -EFAULT; rval = -EFAULT;
kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3,
GFP_KERNEL); GFP_KERNEL);
if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)A(arg2), if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2,
kmbuf, arg3)) kmbuf, arg3))
break; break;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
...@@ -1154,26 +1143,26 @@ asmlinkage int sunos_shmsys(int op, u32 arg1, u32 arg2, u32 arg3) ...@@ -1154,26 +1143,26 @@ asmlinkage int sunos_shmsys(int op, u32 arg1, u32 arg2, u32 arg3)
switch(op) { switch(op) {
case 0: case 0:
/* do_shmat(): attach a shared memory area */ /* do_shmat(): attach a shared memory area */
rval = do_shmat((int)arg1,(char __user *)A(arg2),(int)arg3,&raddr); rval = do_shmat((int)arg1,(char __user *)(unsigned long)arg2,(int)arg3,&raddr);
if (!rval) if (!rval)
rval = (int) raddr; rval = (int) raddr;
break; break;
case 1: case 1:
/* sys_shmctl(): modify shared memory area attr. */ /* sys_shmctl(): modify shared memory area attr. */
if (!sunos_shmid_get((struct shmid_ds32 __user *)A(arg3), &ksds)) { if (!sunos_shmid_get((struct shmid_ds32 __user *)(unsigned long)arg3, &ksds)) {
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
rval = sys_shmctl((int) arg1,(int) arg2, rval = sys_shmctl((int) arg1,(int) arg2,
(struct shmid_ds __user *) &ksds); (struct shmid_ds __user *) &ksds);
set_fs(old_fs); set_fs(old_fs);
if (!rval) if (!rval)
rval = sunos_shmid_put((struct shmid_ds32 __user *)A(arg3), rval = sunos_shmid_put((struct shmid_ds32 __user *)(unsigned long)arg3,
&ksds); &ksds);
} else } else
rval = -EFAULT; rval = -EFAULT;
break; break;
case 2: case 2:
/* sys_shmdt(): detach a shared memory area */ /* sys_shmdt(): detach a shared memory area */
rval = sys_shmdt((char __user *)A(arg1)); rval = sys_shmdt((char __user *)(unsigned long)arg1);
break; break;
case 3: case 3:
/* sys_shmget(): get a shared memory area */ /* sys_shmget(): get a shared memory area */
...@@ -1215,66 +1204,60 @@ static inline int check_nonblock(int ret, int fd) ...@@ -1215,66 +1204,60 @@ static inline int check_nonblock(int ret, int fd)
return ret; return ret;
} }
asmlinkage int sunos_read(unsigned int fd, u32 buf, u32 count) asmlinkage int sunos_read(unsigned int fd, char __user *buf, u32 count)
{ {
int ret; int ret;
ret = check_nonblock(sys_read(fd, (char __user *)A(buf), count), fd); ret = check_nonblock(sys_read(fd, buf, count), fd);
return ret; return ret;
} }
asmlinkage int sunos_readv(u32 fd, u32 vector, s32 count) asmlinkage int sunos_readv(u32 fd, void __user *vector, s32 count)
{ {
int ret; int ret;
ret = check_nonblock(compat_sys_readv(fd, (void __user *) A(vector), ret = check_nonblock(compat_sys_readv(fd, vector, count), fd);
count), fd);
return ret; return ret;
} }
asmlinkage int sunos_write(unsigned int fd, u32 buf, u32 count) asmlinkage int sunos_write(unsigned int fd, char __user *buf, u32 count)
{ {
int ret; int ret;
ret = check_nonblock(sys_write(fd, (char __user *)A(buf), count), fd); ret = check_nonblock(sys_write(fd, buf, count), fd);
return ret; return ret;
} }
asmlinkage int sunos_writev(u32 fd, u32 vector, s32 count) asmlinkage int sunos_writev(u32 fd, void __user *vector, s32 count)
{ {
int ret; int ret;
ret = check_nonblock(compat_sys_writev(fd, (void __user *)A(vector), ret = check_nonblock(compat_sys_writev(fd, vector, count), fd);
count), fd);
return ret; return ret;
} }
asmlinkage int sunos_recv(int fd, u32 ubuf, int size, unsigned flags) asmlinkage int sunos_recv(u32 __fd, void __user *ubuf, int size, unsigned flags)
{ {
int ret; int ret, fd = (int) __fd;
ret = check_nonblock(sys_recv(fd, (void __user *)A(ubuf), ret = check_nonblock(sys_recv(fd, ubuf, size, flags), fd);
size, flags), fd);
return ret; return ret;
} }
asmlinkage int sunos_send(int fd, u32 buff, int len, unsigned flags) asmlinkage int sunos_send(u32 __fd, void __user *buff, int len, unsigned flags)
{ {
int ret; int ret, fd = (int) __fd;
ret = check_nonblock(sys_send(fd, (void __user *)A(buff), ret = check_nonblock(sys_send(fd, buff, len, flags), fd);
len, flags), fd);
return ret; return ret;
} }
asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen) asmlinkage int sunos_accept(u32 __fd, struct sockaddr __user *sa, int __user *addrlen)
{ {
int ret; int ret, fd = (int) __fd;
while (1) { while (1) {
ret = check_nonblock(sys_accept(fd, ret = check_nonblock(sys_accept(fd, sa, addrlen), fd);
(struct sockaddr __user *)A(sa),
(int __user *)A(addrlen)), fd);
if (ret != -ENETUNREACH && ret != -EHOSTUNREACH) if (ret != -ENETUNREACH && ret != -EHOSTUNREACH)
break; break;
} }
...@@ -1283,7 +1266,9 @@ asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen) ...@@ -1283,7 +1266,9 @@ asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen)
#define SUNOS_SV_INTERRUPT 2 #define SUNOS_SV_INTERRUPT 2
asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) asmlinkage int sunos_sigaction (int sig,
struct old_sigaction32 __user *act,
struct old_sigaction32 __user *oact)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -1292,11 +1277,11 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) ...@@ -1292,11 +1277,11 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact)
compat_old_sigset_t mask; compat_old_sigset_t mask;
u32 u_handler; u32 u_handler;
if (get_user(u_handler, &((struct old_sigaction32 __user *)A(act))->sa_handler) || if (get_user(u_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 __user *)A(act))->sa_flags)) __get_user(new_ka.sa.sa_flags, &act->sa_flags))
return -EFAULT; return -EFAULT;
new_ka.sa.sa_handler = (void *) (long) u_handler; new_ka.sa.sa_handler = (void *) (long) u_handler;
__get_user(mask, &((struct old_sigaction32 __user *)A(act))->sa_mask); __get_user(mask, &act->sa_mask);
new_ka.sa.sa_restorer = NULL; new_ka.sa.sa_restorer = NULL;
new_ka.ka_restorer = NULL; new_ka.ka_restorer = NULL;
siginitset(&new_ka.sa.sa_mask, mask); siginitset(&new_ka.sa.sa_mask, mask);
...@@ -1307,18 +1292,22 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) ...@@ -1307,18 +1292,22 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact)
if (!ret && oact) { if (!ret && oact) {
old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT; old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT;
if (put_user((long)old_ka.sa.sa_handler, &((struct old_sigaction32 __user *)A(oact))->sa_handler) || if (put_user((long)old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_flags, &((struct old_sigaction32 __user *)A(oact))->sa_flags)) __put_user(old_ka.sa.sa_flags, &oact->sa_flags))
return -EFAULT; return -EFAULT;
__put_user(old_ka.sa.sa_mask.sig[0], &((struct old_sigaction32 __user *)A(oact))->sa_mask); __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
} }
return ret; return ret;
} }
asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval, asmlinkage int sunos_setsockopt(u32 __fd, u32 __level, u32 __optname,
int optlen) char __user *optval, u32 __optlen)
{ {
int fd = (int) __fd;
int level = (int) __level;
int optname = (int) __optname;
int optlen = (int) __optlen;
int tr_opt = optname; int tr_opt = optname;
int ret; int ret;
...@@ -1328,13 +1317,16 @@ asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval, ...@@ -1328,13 +1317,16 @@ asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval,
tr_opt += 30; tr_opt += 30;
} }
ret = sys_setsockopt(fd, level, tr_opt, ret = sys_setsockopt(fd, level, tr_opt,
(char __user *)A(optval), optlen); optval, optlen);
return ret; return ret;
} }
asmlinkage int sunos_getsockopt(int fd, int level, int optname, asmlinkage int sunos_getsockopt(u32 __fd, u32 __level, u32 __optname,
u32 optval, u32 optlen) char __user *optval, int __user *optlen)
{ {
int fd = (int) __fd;
int level = (int) __level;
int optname = (int) __optname;
int tr_opt = optname; int tr_opt = optname;
int ret; int ret;
...@@ -1344,7 +1336,6 @@ asmlinkage int sunos_getsockopt(int fd, int level, int optname, ...@@ -1344,7 +1336,6 @@ asmlinkage int sunos_getsockopt(int fd, int level, int optname,
tr_opt += 30; tr_opt += 30;
} }
ret = compat_sys_getsockopt(fd, level, tr_opt, ret = compat_sys_getsockopt(fd, level, tr_opt,
(void __user *)(unsigned long) optval, optval, optlen);
(void __user *)(unsigned long) optlen);
return ret; return ret;
} }
...@@ -19,62 +19,62 @@ ...@@ -19,62 +19,62 @@
.globl sys_call_table32 .globl sys_call_table32
sys_call_table32: sys_call_table32:
/*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write /*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write
/*5*/ .word sparc32_open, sys_close, compat_sys_wait4, sys_creat, sys_link /*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link
/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod /*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod
/*15*/ .word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek /*15*/ .word sys_chmod, sys32_lchown16, sparc_brk, sys32_perfctr, sys32_lseek
/*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16 /*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
/*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause /*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
.word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
/*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid /*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
.word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16 .word sys32_umount, sys32_setgid16, sys32_getgid16, sys32_signal, sys32_geteuid16
/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl /*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
.word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve
/*60*/ .word sys_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize /*60*/ .word sys32_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize
.word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid .word sys32_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
/*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect /*70*/ .word sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect
.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16 .word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64 /*80*/ .word sys32_setgroups16, sys_getpgrp, sys32_setgroups, sys32_setitimer, sys32_ftruncate64
.word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid .word sys32_swapon, sys32_getitimer, sys_setuid, sys32_sethostname, sys_setgid
/*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid /*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid
.word sys_fsync, sys_setpriority32, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall .word sys_fsync, sys32_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
/*100*/ .word sys_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending /*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending
.word sys32_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid .word sys32_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid
/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall /*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall
.word sys_getgroups, sys32_gettimeofday, compat_sys_getrusage, sys_nis_syscall, sys_getcwd .word sys32_getgroups, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd
/*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod /*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod
.word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename, sys_truncate .word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename, sys_truncate
/*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall /*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall
.word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64 .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, sys_stat64
/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit /*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit
.word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write
/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 /*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
.word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount .word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall /*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall
.word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys_setxattr .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents /*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
.word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr .word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr
/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall /*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
.word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sparc64_newuname .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sparc64_newuname
/*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl /*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
.word sys_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask .word sys32_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask
/*200*/ .word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir /*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir
.word sys32_readahead, sys32_socketcall, sys_syslog, sys32_lookup_dcookie, sys32_fadvise64 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
/*210*/ .word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys32_sysinfo /*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo
.word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex .word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex
/*220*/ .word compat_sys_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys_getpgid /*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid
.word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
/*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, compat_statfs64 /*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, compat_statfs64
.word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall .word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler /*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
/*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, compat_sys_nfsservctl /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
.word sys_ni_syscall, compat_clock_settime, compat_clock_gettime, compat_clock_getres, compat_clock_nanosleep .word sys_ni_syscall, sys32_clock_settime, compat_clock_gettime, compat_clock_getres, sys32_clock_nanosleep
/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, compat_timer_settime, compat_timer_gettime, sys_timer_getoverrun /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_timer_gettime, sys_timer_getoverrun
.word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
/*270*/ .word compat_sys_io_submit, sys_io_cancel, compat_sys_io_getevents, compat_sys_mq_open, sys_mq_unlink /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
.word sys32_mq_timedsend, sys32_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall .word sys_mq_timedsend, sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall
/*280*/ .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall /*280*/ .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
/* Now the 64-bit native Linux syscall table. */ /* Now the 64-bit native Linux syscall table. */
...@@ -148,12 +148,12 @@ sys_call_table: ...@@ -148,12 +148,12 @@ sys_call_table:
.align 4 .align 4
.globl sunos_sys_table .globl sunos_sys_table
sunos_sys_table: sunos_sys_table:
/*0*/ .word sunos_indir, sparc_exit, sys_fork /*0*/ .word sunos_indir, sys32_exit, sys_fork
.word sunos_read, sunos_write, sunos_open .word sunos_read, sunos_write, sunos_open
.word sys_close, sunos_wait4, sys_creat .word sys_close, sunos_wait4, sys_creat
.word sys_link, sys_unlink, sunos_execv .word sys_link, sys_unlink, sunos_execv
.word sys_chdir, sunos_nosys, sys32_mknod .word sys_chdir, sunos_nosys, sys32_mknod
.word sys32_chmod, sys32_lchown16, sunos_brk .word sys_chmod, sys32_lchown16, sunos_brk
.word sunos_nosys, sys32_lseek, sunos_getpid .word sunos_nosys, sys32_lseek, sunos_getpid
.word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys
.word sunos_getuid, sunos_nosys, sys_ptrace .word sunos_getuid, sunos_nosys, sys_ptrace
...@@ -180,26 +180,26 @@ sunos_sys_table: ...@@ -180,26 +180,26 @@ sunos_sys_table:
.word compat_sys_getitimer, sys_gethostname, sys_sethostname .word compat_sys_getitimer, sys_gethostname, sys_sethostname
.word sunos_getdtablesize, sys_dup2, sunos_nop .word sunos_getdtablesize, sys_dup2, sunos_nop
.word compat_sys_fcntl, sunos_select, sunos_nop .word compat_sys_fcntl, sunos_select, sunos_nop
.word sys_fsync, sys_setpriority32, sys_socket .word sys_fsync, sys32_setpriority, sys32_socket
.word sys_connect, sunos_accept .word sys32_connect, sunos_accept
/*100*/ .word sys_getpriority, sunos_send, sunos_recv /*100*/ .word sys_getpriority, sunos_send, sunos_recv
.word sunos_nosys, sys_bind, sunos_setsockopt .word sunos_nosys, sys32_bind, sunos_setsockopt
.word sys_listen, sunos_nosys, sunos_sigaction .word sys32_listen, sunos_nosys, sunos_sigaction
.word sunos_sigblock, sunos_sigsetmask, sys_sigpause .word sunos_sigblock, sunos_sigsetmask, sys_sigpause
.word sys32_sigstack, compat_sys_recvmsg, compat_sys_sendmsg .word sys32_sigstack, sys32_recvmsg, sys32_sendmsg
.word sunos_nosys, sys32_gettimeofday, compat_sys_getrusage .word sunos_nosys, sys32_gettimeofday, compat_sys_getrusage
.word sunos_getsockopt, sunos_nosys, sunos_readv .word sunos_getsockopt, sunos_nosys, sunos_readv
.word sunos_writev, sys32_settimeofday, sys32_fchown16 .word sunos_writev, sys32_settimeofday, sys32_fchown16
.word sys_fchmod, sys32_recvfrom, sys32_setreuid16 .word sys_fchmod, sys32_recvfrom, sys32_setreuid16
.word sys32_setregid16, sys_rename, sys_truncate .word sys32_setregid16, sys_rename, sys_truncate
.word sys_ftruncate, sys_flock, sunos_nosys .word sys_ftruncate, sys_flock, sunos_nosys
.word sys32_sendto, sys_shutdown, sys_socketpair .word sys32_sendto, sys32_shutdown, sys32_socketpair
.word sys_mkdir, sys_rmdir, sys32_utimes .word sys_mkdir, sys_rmdir, sys32_utimes
.word sys32_sigreturn, sunos_nosys, sys_getpeername .word sys32_sigreturn, sunos_nosys, sys32_getpeername
.word sunos_gethostid, sunos_nosys, compat_sys_getrlimit .word sunos_gethostid, sunos_nosys, compat_sys_getrlimit
.word compat_sys_setrlimit, sunos_killpg, sunos_nosys .word compat_sys_setrlimit, sunos_killpg, sunos_nosys
.word sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys
/*150*/ .word sys_getsockname, sunos_nosys, sunos_nosys /*150*/ .word sys32_getsockname, sunos_nosys, sunos_nosys
.word sys_poll, sunos_nosys, sunos_nosys .word sys_poll, sunos_nosys, sunos_nosys
.word sunos_getdirentries, compat_sys_statfs, compat_sys_fstatfs .word sunos_getdirentries, compat_sys_statfs, compat_sys_fstatfs
.word sys_oldumount, sunos_nosys, sunos_nosys .word sys_oldumount, sunos_nosys, sunos_nosys
......
...@@ -830,17 +830,9 @@ typedef struct fore200e_bus { ...@@ -830,17 +830,9 @@ typedef struct fore200e_bus {
#if defined(CONFIG_ATM_FORE200E_SBA) #if defined(CONFIG_ATM_FORE200E_SBA)
# if defined(CONFIG_ATM_FORE200E_PCA) # if defined(CONFIG_ATM_FORE200E_PCA)
# if (PCI_DMA_BIDIRECTIONAL == SBUS_DMA_BIDIRECTIONAL) && \
(PCI_DMA_TODEVICE == SBUS_DMA_TODEVICE) && \
(PCI_DMA_FROMDEVICE == SBUS_DMA_FROMDEVICE)
# define FORE200E_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL # define FORE200E_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL
# define FORE200E_DMA_TODEVICE PCI_DMA_TODEVICE # define FORE200E_DMA_TODEVICE PCI_DMA_TODEVICE
# define FORE200E_DMA_FROMDEVICE PCI_DMA_FROMDEVICE # define FORE200E_DMA_FROMDEVICE PCI_DMA_FROMDEVICE
# else
/* in that case, we'll need to add an extra indirection, e.g.
fore200e->bus->dma_direction[ fore200e_dma_direction ] */
# error PCI and SBUS DMA direction flags have different values!
# endif
# else # else
# define FORE200E_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL # define FORE200E_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL
# define FORE200E_DMA_TODEVICE SBUS_DMA_TODEVICE # define FORE200E_DMA_TODEVICE SBUS_DMA_TODEVICE
......
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
#define dma_unmap_single(d,h,s,dir) sbus_unmap_single(d,h,s,dir) #define dma_unmap_single(d,h,s,dir) sbus_unmap_single(d,h,s,dir)
#define dma_map_sg(d,s,n,dir) sbus_map_sg(d,s,n,dir) #define dma_map_sg(d,s,n,dir) sbus_map_sg(d,s,n,dir)
#define dma_unmap_sg(d,s,n,dir) sbus_unmap_sg(d,s,n,dir) #define dma_unmap_sg(d,s,n,dir) sbus_unmap_sg(d,s,n,dir)
#define scsi_to_fc_dma_dir(dir) scsi_to_sbus_dma_dir(dir)
#define FC_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL
#else #else
#define dma_alloc_consistent(d,s,p) pci_alloc_consistent(d,s,p) #define dma_alloc_consistent(d,s,p) pci_alloc_consistent(d,s,p)
#define dma_free_consistent(d,s,v,h) pci_free_consistent(d,s,v,h) #define dma_free_consistent(d,s,v,h) pci_free_consistent(d,s,v,h)
...@@ -68,8 +66,6 @@ ...@@ -68,8 +66,6 @@
#define dma_unmap_single(d,h,s,dir) pci_unmap_single(d,h,s,dir) #define dma_unmap_single(d,h,s,dir) pci_unmap_single(d,h,s,dir)
#define dma_map_sg(d,s,n,dir) pci_map_sg(d,s,n,dir) #define dma_map_sg(d,s,n,dir) pci_map_sg(d,s,n,dir)
#define dma_unmap_sg(d,s,n,dir) pci_unmap_sg(d,s,n,dir) #define dma_unmap_sg(d,s,n,dir) pci_unmap_sg(d,s,n,dir)
#define scsi_to_fc_dma_dir(dir) scsi_to_pci_dma_dir(dir)
#define FC_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL
#endif #endif
#define FCP_CMND(SCpnt) ((fcp_cmnd *)&(SCpnt->SCp)) #define FCP_CMND(SCpnt) ((fcp_cmnd *)&(SCpnt->SCp))
...@@ -167,7 +163,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status) ...@@ -167,7 +163,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status)
fcmd = l->fcmds + i; fcmd = l->fcmds + i;
plogi = l->logi + 3 * i; plogi = l->logi + 3 * i;
dma_unmap_single (fc->dev, fcmd->cmd, 3 * sizeof(logi), dma_unmap_single (fc->dev, fcmd->cmd, 3 * sizeof(logi),
FC_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
plogi->code = LS_PLOGI; plogi->code = LS_PLOGI;
memcpy (&plogi->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn)); memcpy (&plogi->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn));
memcpy (&plogi->node_wwn, &fc->wwn_node, sizeof(fc_wwn)); memcpy (&plogi->node_wwn, &fc->wwn_node, sizeof(fc_wwn));
...@@ -188,7 +184,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status) ...@@ -188,7 +184,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status)
} }
#endif #endif
fcmd->cmd = dma_map_single (fc->dev, plogi, 3 * sizeof(logi), fcmd->cmd = dma_map_single (fc->dev, plogi, 3 * sizeof(logi),
FC_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
fcmd->rsp = fcmd->cmd + 2 * sizeof(logi); fcmd->rsp = fcmd->cmd + 2 * sizeof(logi);
if (fc->hw_enque (fc, fcmd)) if (fc->hw_enque (fc, fcmd))
printk ("FC: Cannot enque PLOGI packet on %s\n", fc->name); printk ("FC: Cannot enque PLOGI packet on %s\n", fc->name);
...@@ -212,7 +208,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status) ...@@ -212,7 +208,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status)
case FC_STATUS_OK: case FC_STATUS_OK:
plogi = l->logi + 3 * i; plogi = l->logi + 3 * i;
dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi),
FC_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
if (!fc->wwn_dest.lo && !fc->wwn_dest.hi) { if (!fc->wwn_dest.lo && !fc->wwn_dest.hi) {
memcpy (&fc->wwn_dest, &plogi[1].node_wwn, sizeof(fc_wwn)); memcpy (&fc->wwn_dest, &plogi[1].node_wwn, sizeof(fc_wwn));
FCD(("Dest WWN %08x%08x\n", *(u32 *)&fc->wwn_dest, fc->wwn_dest.lo)) FCD(("Dest WWN %08x%08x\n", *(u32 *)&fc->wwn_dest, fc->wwn_dest.lo))
...@@ -231,7 +227,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status) ...@@ -231,7 +227,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status)
case FC_STATUS_ERR_OFFLINE: case FC_STATUS_ERR_OFFLINE:
fc->state = FC_STATE_OFFLINE; fc->state = FC_STATE_OFFLINE;
dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi),
FC_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
printk ("%s: FC is offline\n", fc->name); printk ("%s: FC is offline\n", fc->name);
if (atomic_dec_and_test (&l->todo)) if (atomic_dec_and_test (&l->todo))
up(&l->sem); up(&l->sem);
...@@ -256,7 +252,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status) ...@@ -256,7 +252,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status)
switch (status) { switch (status) {
case FC_STATUS_OK: /* Ok, let's have a fun on a loop */ case FC_STATUS_OK: /* Ok, let's have a fun on a loop */
dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi),
FC_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
p = (fc_al_posmap *)(l->logi + 3 * i); p = (fc_al_posmap *)(l->logi + 3 * i);
#ifdef FCDEBUG #ifdef FCDEBUG
{ {
...@@ -306,7 +302,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status) ...@@ -306,7 +302,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status)
FCD(("SID %d DID %d\n", fc->sid, fc->did)) FCD(("SID %d DID %d\n", fc->sid, fc->did))
fcmd = l->fcmds + i; fcmd = l->fcmds + i;
dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi),
FC_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
fch = &fcmd->fch; fch = &fcmd->fch;
memset(l->logi + 3 * i, 0, 3 * sizeof(logi)); memset(l->logi + 3 * i, 0, 3 * sizeof(logi));
FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT); FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT);
...@@ -317,7 +313,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status) ...@@ -317,7 +313,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status)
fch->param = 0; fch->param = 0;
l->logi [3 * i].code = LS_FLOGI; l->logi [3 * i].code = LS_FLOGI;
fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi),
FC_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
fcmd->rsp = fcmd->cmd + sizeof(logi); fcmd->rsp = fcmd->cmd + sizeof(logi);
fcmd->cmdlen = sizeof(logi); fcmd->cmdlen = sizeof(logi);
fcmd->rsplen = sizeof(logi); fcmd->rsplen = sizeof(logi);
...@@ -434,11 +430,12 @@ static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hd ...@@ -434,11 +430,12 @@ static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hd
if (fcmd->data) { if (fcmd->data) {
if (SCpnt->use_sg) if (SCpnt->use_sg)
dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->buffer, SCpnt->use_sg, dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->buffer,
scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); SCpnt->use_sg,
SCpnt->sc_data_direction);
else else
dma_unmap_single(fc->dev, fcmd->data, SCpnt->request_bufflen, dma_unmap_single(fc->dev, fcmd->data, SCpnt->request_bufflen,
scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); SCpnt->sc_data_direction);
} }
break; break;
default: default:
...@@ -579,7 +576,7 @@ int fcp_initialize(fc_channel *fcchain, int count) ...@@ -579,7 +576,7 @@ int fcp_initialize(fc_channel *fcchain, int count)
fc->ls = (void *)l; fc->ls = (void *)l;
/* Assumes sizeof(fc_al_posmap) < 3 * sizeof(logi), which is true */ /* Assumes sizeof(fc_al_posmap) < 3 * sizeof(logi), which is true */
fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi),
FC_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
fcmd->proto = PROTO_REPORT_AL_MAP; fcmd->proto = PROTO_REPORT_AL_MAP;
fcmd->token = i; fcmd->token = i;
fcmd->fc = fc; fcmd->fc = fc;
...@@ -598,7 +595,7 @@ int fcp_initialize(fc_channel *fcchain, int count) ...@@ -598,7 +595,7 @@ int fcp_initialize(fc_channel *fcchain, int count)
} else { } else {
fc->state = FC_STATE_OFFLINE; fc->state = FC_STATE_OFFLINE;
enable_irq(fc->irq); enable_irq(fc->irq);
dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL);
if (atomic_dec_and_test (&l->todo)) if (atomic_dec_and_test (&l->todo))
goto all_done; goto all_done;
} }
...@@ -615,7 +612,7 @@ int fcp_initialize(fc_channel *fcchain, int count) ...@@ -615,7 +612,7 @@ int fcp_initialize(fc_channel *fcchain, int count)
FCD(("SID %d DID %d\n", fc->sid, fc->did)) FCD(("SID %d DID %d\n", fc->sid, fc->did))
fcmd = l->fcmds + i; fcmd = l->fcmds + i;
dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL);
fch = &fcmd->fch; fch = &fcmd->fch;
FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT); FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT);
FILL_FCHDR_SID(fch, 0); FILL_FCHDR_SID(fch, 0);
...@@ -624,7 +621,7 @@ int fcp_initialize(fc_channel *fcchain, int count) ...@@ -624,7 +621,7 @@ int fcp_initialize(fc_channel *fcchain, int count)
FILL_FCHDR_OXRX(fch, 0xffff, 0xffff); FILL_FCHDR_OXRX(fch, 0xffff, 0xffff);
fch->param = 0; fch->param = 0;
l->logi [3 * i].code = LS_FLOGI; l->logi [3 * i].code = LS_FLOGI;
fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), DMA_BIDIRECTIONAL);
fcmd->rsp = fcmd->cmd + sizeof(logi); fcmd->rsp = fcmd->cmd + sizeof(logi);
fcmd->cmdlen = sizeof(logi); fcmd->cmdlen = sizeof(logi);
fcmd->rsplen = sizeof(logi); fcmd->rsplen = sizeof(logi);
...@@ -652,7 +649,7 @@ int fcp_initialize(fc_channel *fcchain, int count) ...@@ -652,7 +649,7 @@ int fcp_initialize(fc_channel *fcchain, int count)
switch (fc->state) { switch (fc->state) {
case FC_STATE_ONLINE: break; case FC_STATE_ONLINE: break;
case FC_STATE_OFFLINE: break; case FC_STATE_OFFLINE: break;
default: dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); default: dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL);
break; break;
} }
} }
...@@ -821,14 +818,14 @@ static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, i ...@@ -821,14 +818,14 @@ static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, i
cmd->fcp_data_len = SCpnt->request_bufflen; cmd->fcp_data_len = SCpnt->request_bufflen;
fcmd->data = dma_map_single (fc->dev, (char *)SCpnt->request_buffer, fcmd->data = dma_map_single (fc->dev, (char *)SCpnt->request_buffer,
SCpnt->request_bufflen, SCpnt->request_bufflen,
scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); SCpnt->sc_data_direction);
} else { } else {
struct scatterlist *sg = (struct scatterlist *)SCpnt->buffer; struct scatterlist *sg = (struct scatterlist *)SCpnt->buffer;
int nents; int nents;
FCD(("XXX: Use_sg %d %d\n", SCpnt->use_sg, sg->length)) FCD(("XXX: Use_sg %d %d\n", SCpnt->use_sg, sg->length))
nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg, nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg,
scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); SCpnt->sc_data_direction);
if (nents > 1) printk ("%s: SG for nents %d (use_sg %d) not handled yet\n", fc->name, nents, SCpnt->use_sg); if (nents > 1) printk ("%s: SG for nents %d (use_sg %d) not handled yet\n", fc->name, nents, SCpnt->use_sg);
fcmd->data = sg_dma_address(sg); fcmd->data = sg_dma_address(sg);
cmd->fcp_data_len = sg_dma_len(sg); cmd->fcp_data_len = sg_dma_len(sg);
...@@ -1065,7 +1062,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len) ...@@ -1065,7 +1062,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len)
FILL_FCHDR_SEQ_DF_SEQ(fch, 0, 0, 0); FILL_FCHDR_SEQ_DF_SEQ(fch, 0, 0, 0);
FILL_FCHDR_OXRX(fch, 0xffff, 0xffff); FILL_FCHDR_OXRX(fch, 0xffff, 0xffff);
fch->param = 0; fch->param = 0;
fcmd->cmd = dma_map_single (fc->dev, data, 2 * len, FC_DMA_BIDIRECTIONAL); fcmd->cmd = dma_map_single (fc->dev, data, 2 * len, DMA_BIDIRECTIONAL);
fcmd->rsp = fcmd->cmd + len; fcmd->rsp = fcmd->cmd + len;
fcmd->cmdlen = len; fcmd->cmdlen = len;
fcmd->rsplen = len; fcmd->rsplen = len;
...@@ -1100,7 +1097,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len) ...@@ -1100,7 +1097,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len)
clear_bit(fcmd->token, fc->scsi_bitmap); clear_bit(fcmd->token, fc->scsi_bitmap);
fc->scsi_free++; fc->scsi_free++;
dma_unmap_single (fc->dev, fcmd->cmd, 2 * len, FC_DMA_BIDIRECTIONAL); dma_unmap_single (fc->dev, fcmd->cmd, 2 * len, DMA_BIDIRECTIONAL);
return l.status; return l.status;
} }
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "scsi.h"
#include "hosts.h"
#include "esp.h" #include "esp.h"
#include <asm/sbus.h> #include <asm/sbus.h>
...@@ -366,7 +364,7 @@ static char *phase_string(int phase) ...@@ -366,7 +364,7 @@ static char *phase_string(int phase)
} }
#ifdef DEBUG_STATE_MACHINE #ifdef DEBUG_STATE_MACHINE
static inline void esp_advance_phase(Scsi_Cmnd *s, int newphase) static inline void esp_advance_phase(struct scsi_cmnd *s, int newphase)
{ {
ESPLOG(("<%s>", phase_string(newphase))); ESPLOG(("<%s>", phase_string(newphase)));
s->SCp.sent_command = s->SCp.phase; s->SCp.sent_command = s->SCp.phase;
...@@ -419,48 +417,48 @@ static inline void esp_cmd(struct esp *esp, u8 cmd) ...@@ -419,48 +417,48 @@ static inline void esp_cmd(struct esp *esp, u8 cmd)
* Note that these are per-ESP queues, not global queues like * Note that these are per-ESP queues, not global queues like
* the aha152x driver uses. * the aha152x driver uses.
*/ */
static inline void append_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC) static inline void append_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC)
{ {
Scsi_Cmnd *end; struct scsi_cmnd *end;
new_SC->host_scribble = (unsigned char *) NULL; new_SC->host_scribble = (unsigned char *) NULL;
if (!*SC) if (!*SC)
*SC = new_SC; *SC = new_SC;
else { else {
for (end=*SC;end->host_scribble;end=(Scsi_Cmnd *)end->host_scribble) for (end=*SC;end->host_scribble;end=(struct scsi_cmnd *)end->host_scribble)
; ;
end->host_scribble = (unsigned char *) new_SC; end->host_scribble = (unsigned char *) new_SC;
} }
} }
static inline void prepend_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC) static inline void prepend_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC)
{ {
new_SC->host_scribble = (unsigned char *) *SC; new_SC->host_scribble = (unsigned char *) *SC;
*SC = new_SC; *SC = new_SC;
} }
static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd **SC) static inline struct scsi_cmnd *remove_first_SC(struct scsi_cmnd **SC)
{ {
Scsi_Cmnd *ptr; struct scsi_cmnd *ptr;
ptr = *SC; ptr = *SC;
if (ptr) if (ptr)
*SC = (Scsi_Cmnd *) (*SC)->host_scribble; *SC = (struct scsi_cmnd *) (*SC)->host_scribble;
return ptr; return ptr;
} }
static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, int target, int lun) static inline struct scsi_cmnd *remove_SC(struct scsi_cmnd **SC, int target, int lun)
{ {
Scsi_Cmnd *ptr, *prev; struct scsi_cmnd *ptr, *prev;
for (ptr = *SC, prev = NULL; for (ptr = *SC, prev = NULL;
ptr && ((ptr->device->id != target) || (ptr->device->lun != lun)); ptr && ((ptr->device->id != target) || (ptr->device->lun != lun));
prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble) prev = ptr, ptr = (struct scsi_cmnd *) ptr->host_scribble)
; ;
if (ptr) { if (ptr) {
if (prev) if (prev)
prev->host_scribble=ptr->host_scribble; prev->host_scribble=ptr->host_scribble;
else else
*SC=(Scsi_Cmnd *)ptr->host_scribble; *SC=(struct scsi_cmnd *)ptr->host_scribble;
} }
return ptr; return ptr;
} }
...@@ -1062,7 +1060,7 @@ static void __init esp_init_swstate(struct esp *esp) ...@@ -1062,7 +1060,7 @@ static void __init esp_init_swstate(struct esp *esp)
esp->prev_hme_dmacsr = 0xffffffff; esp->prev_hme_dmacsr = 0xffffffff;
} }
static int __init detect_one_esp(Scsi_Host_Template *tpnt, struct sbus_dev *esp_dev, static int __init detect_one_esp(struct scsi_host_template *tpnt, struct sbus_dev *esp_dev,
struct sbus_dev *espdma, struct sbus_bus *sbus, struct sbus_dev *espdma, struct sbus_bus *sbus,
int id, int hme) int id, int hme)
{ {
...@@ -1137,7 +1135,7 @@ static int __init detect_one_esp(Scsi_Host_Template *tpnt, struct sbus_dev *esp_ ...@@ -1137,7 +1135,7 @@ static int __init detect_one_esp(Scsi_Host_Template *tpnt, struct sbus_dev *esp_
#include <asm/sun4paddr.h> #include <asm/sun4paddr.h>
static int __init esp_detect(Scsi_Host_Template *tpnt) static int __init esp_detect(struct scsi_host_template *tpnt)
{ {
static struct sbus_dev esp_dev; static struct sbus_dev esp_dev;
int esps_in_use = 0; int esps_in_use = 0;
...@@ -1162,7 +1160,7 @@ static int __init esp_detect(Scsi_Host_Template *tpnt) ...@@ -1162,7 +1160,7 @@ static int __init esp_detect(Scsi_Host_Template *tpnt)
#else /* !CONFIG_SUN4 */ #else /* !CONFIG_SUN4 */
static int __init esp_detect(Scsi_Host_Template *tpnt) static int __init esp_detect(struct scsi_host_template *tpnt)
{ {
struct sbus_bus *sbus; struct sbus_bus *sbus;
struct sbus_dev *esp_dev, *sbdev_iter; struct sbus_dev *esp_dev, *sbdev_iter;
...@@ -1428,7 +1426,7 @@ static int esp_proc_info(struct Scsi_Host *host, char *buffer, char **start, off ...@@ -1428,7 +1426,7 @@ static int esp_proc_info(struct Scsi_Host *host, char *buffer, char **start, off
return esp_host_info(esp, buffer, offset, length); return esp_host_info(esp, buffer, offset, length);
} }
static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp) static void esp_get_dmabufs(struct esp *esp, struct scsi_cmnd *sp)
{ {
if (sp->use_sg == 0) { if (sp->use_sg == 0) {
sp->SCp.this_residual = sp->request_bufflen; sp->SCp.this_residual = sp->request_bufflen;
...@@ -1437,7 +1435,7 @@ static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp) ...@@ -1437,7 +1435,7 @@ static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp)
if (sp->request_bufflen) { if (sp->request_bufflen) {
sp->SCp.have_data_in = sbus_map_single(esp->sdev, sp->SCp.buffer, sp->SCp.have_data_in = sbus_map_single(esp->sdev, sp->SCp.buffer,
sp->SCp.this_residual, sp->SCp.this_residual,
scsi_to_sbus_dma_dir(sp->sc_data_direction)); sp->sc_data_direction);
sp->SCp.ptr = (char *) ((unsigned long)sp->SCp.have_data_in); sp->SCp.ptr = (char *) ((unsigned long)sp->SCp.have_data_in);
} else { } else {
sp->SCp.ptr = NULL; sp->SCp.ptr = NULL;
...@@ -1447,26 +1445,26 @@ static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp) ...@@ -1447,26 +1445,26 @@ static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp)
sp->SCp.buffers_residual = sbus_map_sg(esp->sdev, sp->SCp.buffers_residual = sbus_map_sg(esp->sdev,
sp->SCp.buffer, sp->SCp.buffer,
sp->use_sg, sp->use_sg,
scsi_to_sbus_dma_dir(sp->sc_data_direction)); sp->sc_data_direction);
sp->SCp.this_residual = sg_dma_len(sp->SCp.buffer); sp->SCp.this_residual = sg_dma_len(sp->SCp.buffer);
sp->SCp.ptr = (char *) ((unsigned long)sg_dma_address(sp->SCp.buffer)); sp->SCp.ptr = (char *) ((unsigned long)sg_dma_address(sp->SCp.buffer));
} }
} }
static void esp_release_dmabufs(struct esp *esp, Scsi_Cmnd *sp) static void esp_release_dmabufs(struct esp *esp, struct scsi_cmnd *sp)
{ {
if (sp->use_sg) { if (sp->use_sg) {
sbus_unmap_sg(esp->sdev, sp->buffer, sp->use_sg, sbus_unmap_sg(esp->sdev, sp->buffer, sp->use_sg,
scsi_to_sbus_dma_dir(sp->sc_data_direction)); sp->sc_data_direction);
} else if (sp->request_bufflen) { } else if (sp->request_bufflen) {
sbus_unmap_single(esp->sdev, sbus_unmap_single(esp->sdev,
sp->SCp.have_data_in, sp->SCp.have_data_in,
sp->request_bufflen, sp->request_bufflen,
scsi_to_sbus_dma_dir(sp->sc_data_direction)); sp->sc_data_direction);
} }
} }
static void esp_restore_pointers(struct esp *esp, Scsi_Cmnd *sp) static void esp_restore_pointers(struct esp *esp, struct scsi_cmnd *sp)
{ {
struct esp_pointers *ep = &esp->data_pointers[sp->device->id]; struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
...@@ -1476,7 +1474,7 @@ static void esp_restore_pointers(struct esp *esp, Scsi_Cmnd *sp) ...@@ -1476,7 +1474,7 @@ static void esp_restore_pointers(struct esp *esp, Scsi_Cmnd *sp)
sp->SCp.buffers_residual = ep->saved_buffers_residual; sp->SCp.buffers_residual = ep->saved_buffers_residual;
} }
static void esp_save_pointers(struct esp *esp, Scsi_Cmnd *sp) static void esp_save_pointers(struct esp *esp, struct scsi_cmnd *sp)
{ {
struct esp_pointers *ep = &esp->data_pointers[sp->device->id]; struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
...@@ -1506,7 +1504,7 @@ static void esp_save_pointers(struct esp *esp, Scsi_Cmnd *sp) ...@@ -1506,7 +1504,7 @@ static void esp_save_pointers(struct esp *esp, Scsi_Cmnd *sp)
* case where we could see an interrupt is where we have disconnected * case where we could see an interrupt is where we have disconnected
* commands active and they are trying to reselect us. * commands active and they are trying to reselect us.
*/ */
static inline void esp_check_cmd(struct esp *esp, Scsi_Cmnd *sp) static inline void esp_check_cmd(struct esp *esp, struct scsi_cmnd *sp)
{ {
switch (sp->cmd_len) { switch (sp->cmd_len) {
case 6: case 6:
...@@ -1557,8 +1555,8 @@ static inline void build_wide_nego_msg(struct esp *esp, int size) ...@@ -1557,8 +1555,8 @@ static inline void build_wide_nego_msg(struct esp *esp, int size)
static void esp_exec_cmd(struct esp *esp) static void esp_exec_cmd(struct esp *esp)
{ {
Scsi_Cmnd *SCptr; struct scsi_cmnd *SCptr;
Scsi_Device *SDptr; struct scsi_device *SDptr;
struct esp_device *esp_dev; struct esp_device *esp_dev;
volatile u8 *cmdp = esp->esp_command; volatile u8 *cmdp = esp->esp_command;
u8 the_esp_command; u8 the_esp_command;
...@@ -1834,7 +1832,7 @@ static void esp_exec_cmd(struct esp *esp) ...@@ -1834,7 +1832,7 @@ static void esp_exec_cmd(struct esp *esp)
} }
/* Queue a SCSI command delivered from the mid-level Linux SCSI code. */ /* Queue a SCSI command delivered from the mid-level Linux SCSI code. */
static int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) static int esp_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
{ {
struct esp *esp; struct esp *esp;
...@@ -1871,7 +1869,7 @@ static int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -1871,7 +1869,7 @@ static int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
} }
/* Dump driver state. */ /* Dump driver state. */
static void esp_dump_cmd(Scsi_Cmnd *SCptr) static void esp_dump_cmd(struct scsi_cmnd *SCptr)
{ {
ESPLOG(("[tgt<%02x> lun<%02x> " ESPLOG(("[tgt<%02x> lun<%02x> "
"pphase<%s> cphase<%s>]", "pphase<%s> cphase<%s>]",
...@@ -1882,7 +1880,7 @@ static void esp_dump_cmd(Scsi_Cmnd *SCptr) ...@@ -1882,7 +1880,7 @@ static void esp_dump_cmd(Scsi_Cmnd *SCptr)
static void esp_dump_state(struct esp *esp) static void esp_dump_state(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
#ifdef DEBUG_ESP_CMDS #ifdef DEBUG_ESP_CMDS
int i; int i;
#endif #endif
...@@ -1921,13 +1919,13 @@ static void esp_dump_state(struct esp *esp) ...@@ -1921,13 +1919,13 @@ static void esp_dump_state(struct esp *esp)
ESPLOG(("esp%d: disconnected ", esp->esp_id)); ESPLOG(("esp%d: disconnected ", esp->esp_id));
while (SCptr) { while (SCptr) {
esp_dump_cmd(SCptr); esp_dump_cmd(SCptr);
SCptr = (Scsi_Cmnd *) SCptr->host_scribble; SCptr = (struct scsi_cmnd *) SCptr->host_scribble;
} }
ESPLOG(("\n")); ESPLOG(("\n"));
} }
/* Abort a command. The host_lock is acquired by caller. */ /* Abort a command. The host_lock is acquired by caller. */
static int esp_abort(Scsi_Cmnd *SCptr) static int esp_abort(struct scsi_cmnd *SCptr)
{ {
struct esp *esp = (struct esp *) SCptr->device->host->hostdata; struct esp *esp = (struct esp *) SCptr->device->host->hostdata;
int don; int don;
...@@ -1957,14 +1955,14 @@ static int esp_abort(Scsi_Cmnd *SCptr) ...@@ -1957,14 +1955,14 @@ static int esp_abort(Scsi_Cmnd *SCptr)
ESP_INTSOFF(esp->dregs); ESP_INTSOFF(esp->dregs);
} }
if (esp->issue_SC) { if (esp->issue_SC) {
Scsi_Cmnd **prev, *this; struct scsi_cmnd **prev, *this;
for (prev = (&esp->issue_SC), this = esp->issue_SC; for (prev = (&esp->issue_SC), this = esp->issue_SC;
this != NULL; this != NULL;
prev = (Scsi_Cmnd **) &(this->host_scribble), prev = (struct scsi_cmnd **) &(this->host_scribble),
this = (Scsi_Cmnd *) this->host_scribble) { this = (struct scsi_cmnd *) this->host_scribble) {
if (this == SCptr) { if (this == SCptr) {
*prev = (Scsi_Cmnd *) this->host_scribble; *prev = (struct scsi_cmnd *) this->host_scribble;
this->host_scribble = NULL; this->host_scribble = NULL;
esp_release_dmabufs(esp, this); esp_release_dmabufs(esp, this);
...@@ -2010,7 +2008,7 @@ static int esp_abort(Scsi_Cmnd *SCptr) ...@@ -2010,7 +2008,7 @@ static int esp_abort(Scsi_Cmnd *SCptr)
*/ */
static int esp_finish_reset(struct esp *esp) static int esp_finish_reset(struct esp *esp)
{ {
Scsi_Cmnd *sp = esp->current_SC; struct scsi_cmnd *sp = esp->current_SC;
/* Clean up currently executing command, if any. */ /* Clean up currently executing command, if any. */
if (sp != NULL) { if (sp != NULL) {
...@@ -2059,7 +2057,7 @@ static int esp_do_resetbus(struct esp *esp) ...@@ -2059,7 +2057,7 @@ static int esp_do_resetbus(struct esp *esp)
* *
* The host_lock is acquired by caller. * The host_lock is acquired by caller.
*/ */
static int esp_reset(Scsi_Cmnd *SCptr) static int esp_reset(struct scsi_cmnd *SCptr)
{ {
struct esp *esp = (struct esp *) SCptr->device->host->hostdata; struct esp *esp = (struct esp *) SCptr->device->host->hostdata;
...@@ -2077,7 +2075,7 @@ static int esp_reset(Scsi_Cmnd *SCptr) ...@@ -2077,7 +2075,7 @@ static int esp_reset(Scsi_Cmnd *SCptr)
/* Internal ESP done function. */ /* Internal ESP done function. */
static void esp_done(struct esp *esp, int error) static void esp_done(struct esp *esp, int error)
{ {
Scsi_Cmnd *done_SC = esp->current_SC; struct scsi_cmnd *done_SC = esp->current_SC;
esp->current_SC = NULL; esp->current_SC = NULL;
...@@ -2168,7 +2166,7 @@ static inline void hme_fifo_push(struct esp *esp, u8 *bytes, u8 count) ...@@ -2168,7 +2166,7 @@ static inline void hme_fifo_push(struct esp *esp, u8 *bytes, u8 count)
/* We try to avoid some interrupts by jumping ahead and see if the ESP /* We try to avoid some interrupts by jumping ahead and see if the ESP
* has gotten far enough yet. Hence the following. * has gotten far enough yet. Hence the following.
*/ */
static inline int skipahead1(struct esp *esp, Scsi_Cmnd *scp, static inline int skipahead1(struct esp *esp, struct scsi_cmnd *scp,
int prev_phase, int new_phase) int prev_phase, int new_phase)
{ {
if (scp->SCp.sent_command != prev_phase) if (scp->SCp.sent_command != prev_phase)
...@@ -2202,7 +2200,7 @@ static inline int skipahead1(struct esp *esp, Scsi_Cmnd *scp, ...@@ -2202,7 +2200,7 @@ static inline int skipahead1(struct esp *esp, Scsi_Cmnd *scp,
return do_intr_end; return do_intr_end;
} }
static inline int skipahead2(struct esp *esp, Scsi_Cmnd *scp, static inline int skipahead2(struct esp *esp, struct scsi_cmnd *scp,
int prev_phase1, int prev_phase2, int new_phase) int prev_phase1, int prev_phase2, int new_phase)
{ {
if (scp->SCp.sent_command != prev_phase1 && if (scp->SCp.sent_command != prev_phase1 &&
...@@ -2318,7 +2316,7 @@ static inline void dma_flashclear(struct esp *esp) ...@@ -2318,7 +2316,7 @@ static inline void dma_flashclear(struct esp *esp)
dma_invalidate(esp); dma_invalidate(esp);
} }
static int dma_can_transfer(struct esp *esp, Scsi_Cmnd *sp) static int dma_can_transfer(struct esp *esp, struct scsi_cmnd *sp)
{ {
__u32 base, end, sz; __u32 base, end, sz;
...@@ -2379,7 +2377,7 @@ static int dma_can_transfer(struct esp *esp, Scsi_Cmnd *sp) ...@@ -2379,7 +2377,7 @@ static int dma_can_transfer(struct esp *esp, Scsi_Cmnd *sp)
* tell the ESP to eat the extraneous byte so that we can proceed * tell the ESP to eat the extraneous byte so that we can proceed
* to the next phase. * to the next phase.
*/ */
static int esp100_sync_hwbug(struct esp *esp, Scsi_Cmnd *sp, int fifocnt) static int esp100_sync_hwbug(struct esp *esp, struct scsi_cmnd *sp, int fifocnt)
{ {
/* Do not touch this piece of code. */ /* Do not touch this piece of code. */
if ((!(esp->erev == esp100)) || if ((!(esp->erev == esp100)) ||
...@@ -2479,7 +2477,7 @@ static inline int reconnect_lun(struct esp *esp) ...@@ -2479,7 +2477,7 @@ static inline int reconnect_lun(struct esp *esp)
/* This puts the driver in a state where it can revitalize a command that /* This puts the driver in a state where it can revitalize a command that
* is being continued due to reselection. * is being continued due to reselection.
*/ */
static inline void esp_connect(struct esp *esp, Scsi_Cmnd *sp) static inline void esp_connect(struct esp *esp, struct scsi_cmnd *sp)
{ {
struct esp_device *esp_dev = sp->device->hostdata; struct esp_device *esp_dev = sp->device->hostdata;
...@@ -2502,7 +2500,7 @@ static inline void esp_connect(struct esp *esp, Scsi_Cmnd *sp) ...@@ -2502,7 +2500,7 @@ static inline void esp_connect(struct esp *esp, Scsi_Cmnd *sp)
/* This will place the current working command back into the issue queue /* This will place the current working command back into the issue queue
* if we are to receive a reselection amidst a selection attempt. * if we are to receive a reselection amidst a selection attempt.
*/ */
static inline void esp_reconnect(struct esp *esp, Scsi_Cmnd *sp) static inline void esp_reconnect(struct esp *esp, struct scsi_cmnd *sp)
{ {
if (!esp->disconnected_SC) if (!esp->disconnected_SC)
ESPLOG(("esp%d: Weird, being reselected but disconnected " ESPLOG(("esp%d: Weird, being reselected but disconnected "
...@@ -2540,7 +2538,7 @@ static inline int esp_bytes_sent(struct esp *esp, int fifo_count) ...@@ -2540,7 +2538,7 @@ static inline int esp_bytes_sent(struct esp *esp, int fifo_count)
return rval - fifo_count; return rval - fifo_count;
} }
static inline void advance_sg(Scsi_Cmnd *sp) static inline void advance_sg(struct scsi_cmnd *sp)
{ {
++sp->SCp.buffer; ++sp->SCp.buffer;
--sp->SCp.buffers_residual; --sp->SCp.buffers_residual;
...@@ -2568,7 +2566,7 @@ static inline void advance_sg(Scsi_Cmnd *sp) ...@@ -2568,7 +2566,7 @@ static inline void advance_sg(Scsi_Cmnd *sp)
*/ */
static int esp_do_data(struct esp *esp) static int esp_do_data(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
int thisphase, hmuch; int thisphase, hmuch;
ESPDATA(("esp_do_data: ")); ESPDATA(("esp_do_data: "));
...@@ -2619,7 +2617,7 @@ static int esp_do_data(struct esp *esp) ...@@ -2619,7 +2617,7 @@ static int esp_do_data(struct esp *esp)
/* See how successful the data transfer was. */ /* See how successful the data transfer was. */
static int esp_do_data_finale(struct esp *esp) static int esp_do_data_finale(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
struct esp_device *esp_dev = SCptr->device->hostdata; struct esp_device *esp_dev = SCptr->device->hostdata;
int bogus_data = 0, bytes_sent = 0, fifocnt, ecount = 0; int bogus_data = 0, bytes_sent = 0, fifocnt, ecount = 0;
...@@ -2800,7 +2798,7 @@ static int esp_do_data_finale(struct esp *esp) ...@@ -2800,7 +2798,7 @@ static int esp_do_data_finale(struct esp *esp)
* a tape, we don't want to go into a loop re-negotiating * a tape, we don't want to go into a loop re-negotiating
* synchronous capabilities over and over. * synchronous capabilities over and over.
*/ */
static int esp_should_clear_sync(Scsi_Cmnd *sp) static int esp_should_clear_sync(struct scsi_cmnd *sp)
{ {
u8 cmd1 = sp->cmnd[0]; u8 cmd1 = sp->cmnd[0];
u8 cmd2 = sp->data_cmnd[0]; u8 cmd2 = sp->data_cmnd[0];
...@@ -2834,7 +2832,7 @@ static int esp_should_clear_sync(Scsi_Cmnd *sp) ...@@ -2834,7 +2832,7 @@ static int esp_should_clear_sync(Scsi_Cmnd *sp)
*/ */
static int esp_do_freebus(struct esp *esp) static int esp_do_freebus(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
struct esp_device *esp_dev = SCptr->device->hostdata; struct esp_device *esp_dev = SCptr->device->hostdata;
int rval; int rval;
...@@ -2905,7 +2903,7 @@ static int esp_do_freebus(struct esp *esp) ...@@ -2905,7 +2903,7 @@ static int esp_do_freebus(struct esp *esp)
*/ */
static int esp_bad_reconnect(struct esp *esp) static int esp_bad_reconnect(struct esp *esp)
{ {
Scsi_Cmnd *sp; struct scsi_cmnd *sp;
ESPLOG(("esp%d: Eieeee, reconnecting unknown command!\n", ESPLOG(("esp%d: Eieeee, reconnecting unknown command!\n",
esp->esp_id)); esp->esp_id));
...@@ -2914,7 +2912,7 @@ static int esp_bad_reconnect(struct esp *esp) ...@@ -2914,7 +2912,7 @@ static int esp_bad_reconnect(struct esp *esp)
ESPLOG(("esp%d: issue_SC[", esp->esp_id)); ESPLOG(("esp%d: issue_SC[", esp->esp_id));
while (sp) { while (sp) {
ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun)); ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun));
sp = (Scsi_Cmnd *) sp->host_scribble; sp = (struct scsi_cmnd *) sp->host_scribble;
} }
ESPLOG(("]\n")); ESPLOG(("]\n"));
sp = esp->current_SC; sp = esp->current_SC;
...@@ -2928,7 +2926,7 @@ static int esp_bad_reconnect(struct esp *esp) ...@@ -2928,7 +2926,7 @@ static int esp_bad_reconnect(struct esp *esp)
ESPLOG(("esp%d: disconnected_SC[", esp->esp_id)); ESPLOG(("esp%d: disconnected_SC[", esp->esp_id));
while (sp) { while (sp) {
ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun)); ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun));
sp = (Scsi_Cmnd *) sp->host_scribble; sp = (struct scsi_cmnd *) sp->host_scribble;
} }
ESPLOG(("]\n")); ESPLOG(("]\n"));
return do_reset_bus; return do_reset_bus;
...@@ -2938,7 +2936,7 @@ static int esp_bad_reconnect(struct esp *esp) ...@@ -2938,7 +2936,7 @@ static int esp_bad_reconnect(struct esp *esp)
static int esp_do_reconnect(struct esp *esp) static int esp_do_reconnect(struct esp *esp)
{ {
int lun, target; int lun, target;
Scsi_Cmnd *SCptr; struct scsi_cmnd *SCptr;
/* Check for all bogus conditions first. */ /* Check for all bogus conditions first. */
target = reconnect_target(esp); target = reconnect_target(esp);
...@@ -2988,7 +2986,7 @@ static int esp_do_reconnect(struct esp *esp) ...@@ -2988,7 +2986,7 @@ static int esp_do_reconnect(struct esp *esp)
*/ */
static int esp_do_status(struct esp *esp) static int esp_do_status(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
int intr, rval; int intr, rval;
rval = skipahead1(esp, SCptr, in_the_dark, in_status); rval = skipahead1(esp, SCptr, in_the_dark, in_status);
...@@ -3133,7 +3131,7 @@ static int esp_enter_status(struct esp *esp) ...@@ -3133,7 +3131,7 @@ static int esp_enter_status(struct esp *esp)
static int esp_disconnect_amidst_phases(struct esp *esp) static int esp_disconnect_amidst_phases(struct esp *esp)
{ {
Scsi_Cmnd *sp = esp->current_SC; struct scsi_cmnd *sp = esp->current_SC;
struct esp_device *esp_dev = sp->device->hostdata; struct esp_device *esp_dev = sp->device->hostdata;
/* This means real problems if we see this /* This means real problems if we see this
...@@ -3226,7 +3224,7 @@ static int esp_do_phase_determine(struct esp *esp) ...@@ -3226,7 +3224,7 @@ static int esp_do_phase_determine(struct esp *esp)
/* First interrupt after exec'ing a cmd comes here. */ /* First interrupt after exec'ing a cmd comes here. */
static int esp_select_complete(struct esp *esp) static int esp_select_complete(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
struct esp_device *esp_dev = SCptr->device->hostdata; struct esp_device *esp_dev = SCptr->device->hostdata;
int cmd_bytes_sent, fcnt; int cmd_bytes_sent, fcnt;
...@@ -3582,7 +3580,7 @@ static int check_singlebyte_msg(struct esp *esp) ...@@ -3582,7 +3580,7 @@ static int check_singlebyte_msg(struct esp *esp)
* this because so many initiators cannot cope with this occurring. * this because so many initiators cannot cope with this occurring.
*/ */
static int target_with_ants_in_pants(struct esp *esp, static int target_with_ants_in_pants(struct esp *esp,
Scsi_Cmnd *SCptr, struct scsi_cmnd *SCptr,
struct esp_device *esp_dev) struct esp_device *esp_dev)
{ {
if (esp_dev->sync || SCptr->device->borken) { if (esp_dev->sync || SCptr->device->borken) {
...@@ -3641,7 +3639,7 @@ static void sync_report(struct esp *esp) ...@@ -3641,7 +3639,7 @@ static void sync_report(struct esp *esp)
static int check_multibyte_msg(struct esp *esp) static int check_multibyte_msg(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
struct esp_device *esp_dev = SCptr->device->hostdata; struct esp_device *esp_dev = SCptr->device->hostdata;
u8 regval = 0; u8 regval = 0;
int message_out = 0; int message_out = 0;
...@@ -3822,7 +3820,7 @@ static int check_multibyte_msg(struct esp *esp) ...@@ -3822,7 +3820,7 @@ static int check_multibyte_msg(struct esp *esp)
static int esp_do_msgindone(struct esp *esp) static int esp_do_msgindone(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
int message_out = 0, it = 0, rval; int message_out = 0, it = 0, rval;
rval = skipahead1(esp, SCptr, in_msgin, in_msgindone); rval = skipahead1(esp, SCptr, in_msgin, in_msgindone);
...@@ -3904,7 +3902,7 @@ static int esp_do_msgindone(struct esp *esp) ...@@ -3904,7 +3902,7 @@ static int esp_do_msgindone(struct esp *esp)
static int esp_do_cmdbegin(struct esp *esp) static int esp_do_cmdbegin(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
esp_advance_phase(SCptr, in_cmdend); esp_advance_phase(SCptr, in_cmdend);
if (esp->erev == fashme) { if (esp->erev == fashme) {
...@@ -4125,7 +4123,7 @@ static espfunc_t bus_vector[] = { ...@@ -4125,7 +4123,7 @@ static espfunc_t bus_vector[] = {
/* This is the second tier in our dual-level SCSI state machine. */ /* This is the second tier in our dual-level SCSI state machine. */
static int esp_work_bus(struct esp *esp) static int esp_work_bus(struct esp *esp)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; struct scsi_cmnd *SCptr = esp->current_SC;
unsigned int phase; unsigned int phase;
ESPBUS(("esp_work_bus: ")); ESPBUS(("esp_work_bus: "));
...@@ -4153,7 +4151,7 @@ static espfunc_t isvc_vector[] = { ...@@ -4153,7 +4151,7 @@ static espfunc_t isvc_vector[] = {
/* Main interrupt handler for an esp adapter. */ /* Main interrupt handler for an esp adapter. */
static void esp_handle(struct esp *esp) static void esp_handle(struct esp *esp)
{ {
Scsi_Cmnd *SCptr; struct scsi_cmnd *SCptr;
int what_next = do_intr_end; int what_next = do_intr_end;
SCptr = esp->current_SC; SCptr = esp->current_SC;
...@@ -4353,7 +4351,7 @@ static irqreturn_t esp_intr(int irq, void *dev_id, struct pt_regs *pregs) ...@@ -4353,7 +4351,7 @@ static irqreturn_t esp_intr(int irq, void *dev_id, struct pt_regs *pregs)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int esp_slave_alloc(Scsi_Device *SDptr) static int esp_slave_alloc(struct scsi_device *SDptr)
{ {
struct esp_device *esp_dev = struct esp_device *esp_dev =
kmalloc(sizeof(struct esp_device), GFP_ATOMIC); kmalloc(sizeof(struct esp_device), GFP_ATOMIC);
...@@ -4365,7 +4363,7 @@ static int esp_slave_alloc(Scsi_Device *SDptr) ...@@ -4365,7 +4363,7 @@ static int esp_slave_alloc(Scsi_Device *SDptr)
return 0; return 0;
} }
static void esp_slave_destroy(Scsi_Device *SDptr) static void esp_slave_destroy(struct scsi_device *SDptr)
{ {
struct esp *esp = (struct esp *) SDptr->host->hostdata; struct esp *esp = (struct esp *) SDptr->host->hostdata;
...@@ -4374,7 +4372,7 @@ static void esp_slave_destroy(Scsi_Device *SDptr) ...@@ -4374,7 +4372,7 @@ static void esp_slave_destroy(Scsi_Device *SDptr)
SDptr->hostdata = NULL; SDptr->hostdata = NULL;
} }
static Scsi_Host_Template driver_template = { static struct scsi_host_template driver_template = {
.proc_name = "esp", .proc_name = "esp",
.proc_info = esp_proc_info, .proc_info = esp_proc_info,
.name = "Sun ESP 100/100a/200", .name = "Sun ESP 100/100a/200",
......
...@@ -10,9 +10,20 @@ ...@@ -10,9 +10,20 @@
#include <linux/config.h> #include <linux/config.h>
/* #include "scsi.h" */
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_request.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
/* For dvma controller register definitions. */ /* For dvma controller register definitions. */
#include <asm/dma.h> #include <asm/dma.h>
#define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir))
/* The ESP SCSI controllers have their register sets in three /* The ESP SCSI controllers have their register sets in three
* "classes": * "classes":
* *
...@@ -181,9 +192,9 @@ struct esp { ...@@ -181,9 +192,9 @@ struct esp {
int bursts; /* Burst sizes our DVMA supports */ int bursts; /* Burst sizes our DVMA supports */
/* Our command queues, only one cmd lives in the current_SC queue. */ /* Our command queues, only one cmd lives in the current_SC queue. */
Scsi_Cmnd *issue_SC; /* Commands to be issued */ struct scsi_cmnd *issue_SC; /* Commands to be issued */
Scsi_Cmnd *current_SC; /* Who is currently working the bus */ struct scsi_cmnd *current_SC; /* Who is currently working the bus */
Scsi_Cmnd *disconnected_SC;/* Commands disconnected from the bus */ struct scsi_cmnd *disconnected_SC;/* Commands disconnected from the bus */
/* Message goo */ /* Message goo */
u8 cur_msgout[16]; u8 cur_msgout[16];
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include "scsi.h"
#include "hosts.h"
#include "qlogicpti.h" #include "qlogicpti.h"
#include <asm/sbus.h> #include <asm/sbus.h>
...@@ -809,7 +807,7 @@ static int __init qpti_map_queues(struct qlogicpti *qpti) ...@@ -809,7 +807,7 @@ static int __init qpti_map_queues(struct qlogicpti *qpti)
} }
/* Detect all PTI Qlogic ISP's in the machine. */ /* Detect all PTI Qlogic ISP's in the machine. */
static int __init qlogicpti_detect(Scsi_Host_Template *tpnt) static int __init qlogicpti_detect(struct scsi_host_template *tpnt)
{ {
struct qlogicpti *qpti; struct qlogicpti *qpti;
struct Scsi_Host *qpti_host; struct Scsi_Host *qpti_host;
...@@ -878,7 +876,7 @@ static int __init qlogicpti_detect(Scsi_Host_Template *tpnt) ...@@ -878,7 +876,7 @@ static int __init qlogicpti_detect(Scsi_Host_Template *tpnt)
qpti_get_bursts(qpti); qpti_get_bursts(qpti);
qpti_get_clock(qpti); qpti_get_clock(qpti);
/* Clear out Scsi_Cmnd array. */ /* Clear out scsi_cmnd array. */
memset(qpti->cmd_slots, 0, sizeof(qpti->cmd_slots)); memset(qpti->cmd_slots, 0, sizeof(qpti->cmd_slots));
if (qpti_map_queues(qpti) < 0) if (qpti_map_queues(qpti) < 0)
...@@ -997,7 +995,7 @@ static inline void marker_frob(struct Command_Entry *cmd) ...@@ -997,7 +995,7 @@ static inline void marker_frob(struct Command_Entry *cmd)
marker->rsvd = 0; marker->rsvd = 0;
} }
static inline void cmd_frob(struct Command_Entry *cmd, Scsi_Cmnd *Cmnd, static inline void cmd_frob(struct Command_Entry *cmd, struct scsi_cmnd *Cmnd,
struct qlogicpti *qpti) struct qlogicpti *qpti)
{ {
memset(cmd, 0, sizeof(struct Command_Entry)); memset(cmd, 0, sizeof(struct Command_Entry));
...@@ -1027,7 +1025,7 @@ static inline void cmd_frob(struct Command_Entry *cmd, Scsi_Cmnd *Cmnd, ...@@ -1027,7 +1025,7 @@ static inline void cmd_frob(struct Command_Entry *cmd, Scsi_Cmnd *Cmnd,
} }
/* Do it to it baby. */ /* Do it to it baby. */
static inline int load_cmd(Scsi_Cmnd *Cmnd, struct Command_Entry *cmd, static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
struct qlogicpti *qpti, u_int in_ptr, u_int out_ptr) struct qlogicpti *qpti, u_int in_ptr, u_int out_ptr)
{ {
struct dataseg *ds; struct dataseg *ds;
...@@ -1038,7 +1036,7 @@ static inline int load_cmd(Scsi_Cmnd *Cmnd, struct Command_Entry *cmd, ...@@ -1038,7 +1036,7 @@ static inline int load_cmd(Scsi_Cmnd *Cmnd, struct Command_Entry *cmd,
int sg_count; int sg_count;
sg = (struct scatterlist *) Cmnd->buffer; sg = (struct scatterlist *) Cmnd->buffer;
sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, scsi_to_sbus_dma_dir(Cmnd->sc_data_direction)); sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, Cmnd->sc_data_direction);
ds = cmd->dataseg; ds = cmd->dataseg;
cmd->segment_cnt = sg_count; cmd->segment_cnt = sg_count;
...@@ -1081,7 +1079,7 @@ static inline int load_cmd(Scsi_Cmnd *Cmnd, struct Command_Entry *cmd, ...@@ -1081,7 +1079,7 @@ static inline int load_cmd(Scsi_Cmnd *Cmnd, struct Command_Entry *cmd,
sbus_map_single(qpti->sdev, sbus_map_single(qpti->sdev,
Cmnd->request_buffer, Cmnd->request_buffer,
Cmnd->request_bufflen, Cmnd->request_bufflen,
scsi_to_sbus_dma_dir(Cmnd->sc_data_direction)); Cmnd->sc_data_direction);
cmd->dataseg[0].d_base = (u32) ((unsigned long)Cmnd->SCp.ptr); cmd->dataseg[0].d_base = (u32) ((unsigned long)Cmnd->SCp.ptr);
cmd->dataseg[0].d_count = Cmnd->request_bufflen; cmd->dataseg[0].d_count = Cmnd->request_bufflen;
...@@ -1115,11 +1113,11 @@ static inline void update_can_queue(struct Scsi_Host *host, u_int in_ptr, u_int ...@@ -1115,11 +1113,11 @@ static inline void update_can_queue(struct Scsi_Host *host, u_int in_ptr, u_int
/* /*
* Until we scan the entire bus with inquiries, go throught this fella... * Until we scan the entire bus with inquiries, go throught this fella...
*/ */
static void ourdone(Scsi_Cmnd *Cmnd) static void ourdone(struct scsi_cmnd *Cmnd)
{ {
struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata; struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata;
int tgt = Cmnd->device->id; int tgt = Cmnd->device->id;
void (*done) (Scsi_Cmnd *); void (*done) (struct scsi_cmnd *);
/* This grot added by DaveM, blame him for ugliness. /* This grot added by DaveM, blame him for ugliness.
* The issue is that in the 2.3.x driver we use the * The issue is that in the 2.3.x driver we use the
...@@ -1127,7 +1125,7 @@ static void ourdone(Scsi_Cmnd *Cmnd) ...@@ -1127,7 +1125,7 @@ static void ourdone(Scsi_Cmnd *Cmnd)
* completion linked list at interrupt service time, * completion linked list at interrupt service time,
* so we have to store the done function pointer elsewhere. * so we have to store the done function pointer elsewhere.
*/ */
done = (void (*)(Scsi_Cmnd *)) done = (void (*)(struct scsi_cmnd *))
(((unsigned long) Cmnd->SCp.Message) (((unsigned long) Cmnd->SCp.Message)
#ifdef __sparc_v9__ #ifdef __sparc_v9__
| ((unsigned long) Cmnd->SCp.Status << 32UL) | ((unsigned long) Cmnd->SCp.Status << 32UL)
...@@ -1164,10 +1162,10 @@ static void ourdone(Scsi_Cmnd *Cmnd) ...@@ -1164,10 +1162,10 @@ static void ourdone(Scsi_Cmnd *Cmnd)
done(Cmnd); done(Cmnd);
} }
static int qlogicpti_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *)); static int qlogicpti_queuecommand(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *));
static int qlogicpti_queuecommand_slow(Scsi_Cmnd *Cmnd, static int qlogicpti_queuecommand_slow(struct scsi_cmnd *Cmnd,
void (*done)(Scsi_Cmnd *)) void (*done)(struct scsi_cmnd *))
{ {
struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata; struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata;
...@@ -1238,7 +1236,7 @@ static int qlogicpti_queuecommand_slow(Scsi_Cmnd *Cmnd, ...@@ -1238,7 +1236,7 @@ static int qlogicpti_queuecommand_slow(Scsi_Cmnd *Cmnd,
* *
* "This code must fly." -davem * "This code must fly." -davem
*/ */
static int qlogicpti_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *)) static int qlogicpti_queuecommand(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *))
{ {
struct Scsi_Host *host = Cmnd->device->host; struct Scsi_Host *host = Cmnd->device->host;
struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;
...@@ -1351,9 +1349,9 @@ static int qlogicpti_return_status(struct Status_Entry *sts, int id) ...@@ -1351,9 +1349,9 @@ static int qlogicpti_return_status(struct Status_Entry *sts, int id)
return (sts->scsi_status & STATUS_MASK) | (host_status << 16); return (sts->scsi_status & STATUS_MASK) | (host_status << 16);
} }
static Scsi_Cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
{ {
Scsi_Cmnd *Cmnd, *done_queue = NULL; struct scsi_cmnd *Cmnd, *done_queue = NULL;
struct Status_Entry *sts; struct Status_Entry *sts;
u_int in_ptr, out_ptr; u_int in_ptr, out_ptr;
...@@ -1412,12 +1410,12 @@ static Scsi_Cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) ...@@ -1412,12 +1410,12 @@ static Scsi_Cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
sbus_unmap_sg(qpti->sdev, sbus_unmap_sg(qpti->sdev,
(struct scatterlist *)Cmnd->buffer, (struct scatterlist *)Cmnd->buffer,
Cmnd->use_sg, Cmnd->use_sg,
scsi_to_sbus_dma_dir(Cmnd->sc_data_direction)); Cmnd->sc_data_direction);
} else { } else {
sbus_unmap_single(qpti->sdev, sbus_unmap_single(qpti->sdev,
(__u32)((unsigned long)Cmnd->SCp.ptr), (__u32)((unsigned long)Cmnd->SCp.ptr),
Cmnd->request_bufflen, Cmnd->request_bufflen,
scsi_to_sbus_dma_dir(Cmnd->sc_data_direction)); Cmnd->sc_data_direction);
} }
qpti->cmd_count[Cmnd->device->id]--; qpti->cmd_count[Cmnd->device->id]--;
sbus_writew(out_ptr, qpti->qregs + MBOX5); sbus_writew(out_ptr, qpti->qregs + MBOX5);
...@@ -1433,16 +1431,16 @@ static irqreturn_t qpti_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1433,16 +1431,16 @@ static irqreturn_t qpti_intr(int irq, void *dev_id, struct pt_regs *regs)
{ {
struct qlogicpti *qpti = dev_id; struct qlogicpti *qpti = dev_id;
unsigned long flags; unsigned long flags;
Scsi_Cmnd *dq; struct scsi_cmnd *dq;
spin_lock_irqsave(qpti->qhost->host_lock, flags); spin_lock_irqsave(qpti->qhost->host_lock, flags);
dq = qlogicpti_intr_handler(qpti); dq = qlogicpti_intr_handler(qpti);
if (dq != NULL) { if (dq != NULL) {
do { do {
Scsi_Cmnd *next; struct scsi_cmnd *next;
next = (Scsi_Cmnd *) dq->host_scribble; next = (struct scsi_cmnd *) dq->host_scribble;
dq->scsi_done(dq); dq->scsi_done(dq);
dq = next; dq = next;
} while (dq != NULL); } while (dq != NULL);
...@@ -1452,7 +1450,7 @@ static irqreturn_t qpti_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1452,7 +1450,7 @@ static irqreturn_t qpti_intr(int irq, void *dev_id, struct pt_regs *regs)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int qlogicpti_abort(Scsi_Cmnd *Cmnd) static int qlogicpti_abort(struct scsi_cmnd *Cmnd)
{ {
u_short param[6]; u_short param[6];
struct Scsi_Host *host = Cmnd->device->host; struct Scsi_Host *host = Cmnd->device->host;
...@@ -1489,7 +1487,7 @@ static int qlogicpti_abort(Scsi_Cmnd *Cmnd) ...@@ -1489,7 +1487,7 @@ static int qlogicpti_abort(Scsi_Cmnd *Cmnd)
return return_status; return return_status;
} }
static int qlogicpti_reset(Scsi_Cmnd *Cmnd) static int qlogicpti_reset(struct scsi_cmnd *Cmnd)
{ {
u_short param[6]; u_short param[6];
struct Scsi_Host *host = Cmnd->device->host; struct Scsi_Host *host = Cmnd->device->host;
...@@ -1513,7 +1511,7 @@ static int qlogicpti_reset(Scsi_Cmnd *Cmnd) ...@@ -1513,7 +1511,7 @@ static int qlogicpti_reset(Scsi_Cmnd *Cmnd)
return return_status; return return_status;
} }
static Scsi_Host_Template driver_template = { static struct scsi_host_template driver_template = {
.detect = qlogicpti_detect, .detect = qlogicpti_detect,
.release = qlogicpti_release, .release = qlogicpti_release,
.info = qlogicpti_info, .info = qlogicpti_info,
......
...@@ -8,6 +8,17 @@ ...@@ -8,6 +8,17 @@
#include <linux/config.h> #include <linux/config.h>
/* #include "scsi.h" */
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_request.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir))
/* Qlogic/SBUS controller registers. */ /* Qlogic/SBUS controller registers. */
#define SBUS_CFG1 0x006UL #define SBUS_CFG1 0x006UL
#define SBUS_CTRL 0x008UL #define SBUS_CTRL 0x008UL
...@@ -352,7 +363,7 @@ struct qlogicpti { ...@@ -352,7 +363,7 @@ struct qlogicpti {
* Ex000 sparc64 machines with >4GB of ram we just keep track of the * Ex000 sparc64 machines with >4GB of ram we just keep track of the
* scsi command pointers here. This is essentially what Matt Jacob does. -DaveM * scsi command pointers here. This is essentially what Matt Jacob does. -DaveM
*/ */
Scsi_Cmnd *cmd_slots[QLOGICPTI_REQ_QUEUE_LEN + 1]; struct scsi_cmnd *cmd_slots[QLOGICPTI_REQ_QUEUE_LEN + 1];
/* The rest of the elements are unimportant for performance. */ /* The rest of the elements are unimportant for performance. */
struct qlogicpti *next; struct qlogicpti *next;
......
...@@ -744,7 +744,7 @@ extern int copy_mount_options (const void __user *, unsigned long *); ...@@ -744,7 +744,7 @@ extern int copy_mount_options (const void __user *, unsigned long *);
#define SMBFS_NAME "smbfs" #define SMBFS_NAME "smbfs"
#define NCPFS_NAME "ncpfs" #define NCPFS_NAME "ncpfs"
asmlinkage int compat_sys_mount(char __user * dev_name, char __user * dir_name, asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name,
char __user * type, unsigned long flags, char __user * type, unsigned long flags,
void __user * data) void __user * data)
{ {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#ifndef _SPARC_SBUS_H #ifndef _SPARC_SBUS_H
#define _SPARC_SBUS_H #define _SPARC_SBUS_H
#include <linux/dma-mapping.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/oplib.h> #include <asm/oplib.h>
...@@ -106,10 +107,10 @@ extern void sbus_set_sbus64(struct sbus_dev *, int); ...@@ -106,10 +107,10 @@ extern void sbus_set_sbus64(struct sbus_dev *, int);
extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp);
extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32); extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32);
#define SBUS_DMA_BIDIRECTIONAL 0 #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL
#define SBUS_DMA_TODEVICE 1 #define SBUS_DMA_TODEVICE DMA_TO_DEVICE
#define SBUS_DMA_FROMDEVICE 2 #define SBUS_DMA_FROMDEVICE DMA_FROM_DEVICE
#define SBUS_DMA_NONE 3 #define SBUS_DMA_NONE DMA_NONE
/* All the rest use streaming mode mappings. */ /* All the rest use streaming mode mappings. */
extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#ifndef _SPARC64_SBUS_H #ifndef _SPARC64_SBUS_H
#define _SPARC64_SBUS_H #define _SPARC64_SBUS_H
#include <linux/dma-mapping.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/oplib.h> #include <asm/oplib.h>
...@@ -99,10 +100,10 @@ extern void sbus_set_sbus64(struct sbus_dev *, int); ...@@ -99,10 +100,10 @@ extern void sbus_set_sbus64(struct sbus_dev *, int);
extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp); extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp);
extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t); extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t);
#define SBUS_DMA_BIDIRECTIONAL 0 #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL
#define SBUS_DMA_TODEVICE 1 #define SBUS_DMA_TODEVICE DMA_TO_DEVICE
#define SBUS_DMA_FROMDEVICE 2 #define SBUS_DMA_FROMDEVICE DMA_FROM_DEVICE
#define SBUS_DMA_NONE 3 #define SBUS_DMA_NONE DMA_NONE
/* All the rest use streaming mode mappings. */ /* All the rest use streaming mode mappings. */
extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int);
......
...@@ -446,7 +446,6 @@ static __inline__ _syscall1(int,dup,int,fd) ...@@ -446,7 +446,6 @@ static __inline__ _syscall1(int,dup,int,fd)
static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp) static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp)
static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode) static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode)
static __inline__ _syscall1(int,close,int,fd) static __inline__ _syscall1(int,close,int,fd)
static __inline__ _syscall1(int,_exit,int,exitcode)
static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
#include <linux/linkage.h> #include <linux/linkage.h>
......
...@@ -399,7 +399,7 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, ...@@ -399,7 +399,7 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
return ret; return ret;
} }
asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
compat_ulong_t __user *user_mask_ptr) compat_ulong_t __user *user_mask_ptr)
{ {
unsigned long kernel_mask; unsigned long kernel_mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment