diff options
| author | Dave Kleikamp <jfs.adm@hostme.bitkeeper.com> | 2002-10-06 18:12:26 -0700 |
|---|---|---|
| committer | Dave Kleikamp <jfs.adm@hostme.bitkeeper.com> | 2002-10-06 18:12:26 -0700 |
| commit | e3489dc28c0603221d32408ed9f3c048f2cb789b (patch) | |
| tree | 3c9fb7d4d74788749c7ee1ea60228aacae6fe2c8 /include | |
| parent | 854f96ea62977d57b644a35acbb2f66e5f44bda5 (diff) | |
| parent | 258ee56ad55dd9c90fefe616411d25f143541f65 (diff) | |
Merge bk://linux.bkbits.net/linux-2.5
into hostme.bitkeeper.com:/ua/repos/j/jfs/linux-2.5
Diffstat (limited to 'include')
83 files changed, 1633 insertions, 1134 deletions
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index 23eb6d2eb42d..363f1477ac16 100644 --- a/include/asm-alpha/unistd.h +++ b/include/asm-alpha/unistd.h @@ -533,12 +533,6 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6)\ #include <linux/signal.h> #include <asm/ptrace.h> -extern void sys_idle(void); -static inline void idle(void) -{ - sys_idle(); -} - extern long sys_open(const char *, int, int); static inline long open(const char * name, int mode, int flags) { @@ -597,12 +591,6 @@ static inline long setsid(void) return sys_setsid(); } -extern long sys_sync(void); -static inline long sync(void) -{ - return sys_sync(); -} - struct rusage; extern asmlinkage long sys_wait4(pid_t, unsigned int *, int, struct rusage *); static inline pid_t waitpid(int pid, int * wait_stat, int flags) @@ -610,17 +598,6 @@ static inline pid_t waitpid(int pid, int * wait_stat, int flags) return sys_wait4(pid, wait_stat, flags, NULL); } -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} - -extern long sys_delete_module(const char *name); -static inline long delete_module(const char *name) -{ - return sys_delete_module(name); -} - #endif /* diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 32d3f3bff93b..5ac18f2fcfd0 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -403,24 +403,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 struct rusage; asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru); -static inline long idle(void) -{ - extern long sys_idle(void); - return sys_idle(); -} - -static inline long pause(void) -{ - extern long sys_pause(void); - return sys_pause(); -} - -static inline long sync(void) -{ - extern long sys_sync(void); - return sys_sync(); -} - static inline pid_t setsid(void) { extern long sys_setsid(void); @@ -474,17 +456,6 @@ static inline pid_t waitpid(pid_t pid, int *wait_stat, int options) return sys_wait4((int)pid, wait_stat, options, NULL); } -static inline long delete_module(const char *name) -{ - extern long sys_delete_module(const char *name); - return sys_delete_module(name); -} - -static inline pid_t wait(int * wait_stat) -{ - return sys_wait4(-1, wait_stat, 0, NULL); -} - /* * The following two can't be eliminated yet - they rely on * specific conditions. diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h index f386c73562ea..7657bf9b1d92 100644 --- a/include/asm-cris/unistd.h +++ b/include/asm-cris/unistd.h @@ -365,12 +365,6 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ * some others too. */ #define __NR__exit __NR_exit -static inline _syscall0(int,idle) -static inline _syscall0(int,fork) -static inline _syscall2(int,clone,unsigned long,flags,char *,esp) -static inline _syscall0(int,pause) -static inline _syscall0(int,setup) -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall1(int,dup,int,fd) @@ -384,14 +378,6 @@ static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) /* the following are just while developing the elinux port! */ static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) -static inline _syscall2(int,socketcall,int,call,unsigned long *,args) -static inline _syscall3(int,ioctl,unsigned int,fd,unsigned int,cmd,unsigned long,arg) -static inline _syscall5(int,mount,const char *,a,const char *,b,const char *,c,unsigned long,rwflag,const void *,data) - -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 1a095484bd32..8765a0f82aff 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -362,8 +362,6 @@ __syscall_return(type,__res); \ * some others too. */ #define __NR__exit __NR_exit -static inline _syscall0(int,pause) -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -374,12 +372,6 @@ static inline _syscall3(int,open,const char *,file,int,flag,int,mode) 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 _syscall1(int,delete_module,const char *,name) - -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index 76e3509417d1..8061d1f9f0cb 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h @@ -309,7 +309,6 @@ name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ struct rusage; -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -319,7 +318,6 @@ 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 _syscall1(int,close,int,fd) static inline _syscall4(pid_t,wait4,pid_t,pid,int *,wait_stat,int,options,struct rusage*, rusage) -static inline _syscall1(int,delete_module,const char *,name) static inline _syscall2(pid_t,clone,unsigned long,flags,void*,sp); #define __NR__exit __NR_exit @@ -331,12 +329,6 @@ waitpid (int pid, int *wait_stat, int flags) return wait4(pid, wait_stat, flags, NULL); } -static inline pid_t -wait (int * wait_stat) -{ - return wait4(-1, wait_stat, 0, 0); -} - #endif /* __KERNEL_SYSCALLS__ */ /* diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index bb231c4b4321..c99410180fe2 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h @@ -350,8 +350,6 @@ __syscall_return(type,__res); \ * some others too. */ #define __NR__exit __NR_exit -static inline _syscall0(int,pause) -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -362,12 +360,6 @@ static inline _syscall3(int,open,const char *,file,int,flag,int,mode) 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 _syscall1(int,delete_module,const char *,name) - -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h index bce8e78485aa..293b93991430 100644 --- a/include/asm-mips/unistd.h +++ b/include/asm-mips/unistd.h @@ -467,7 +467,6 @@ return -1; \ * some others too. */ #define __NR__exit __NR_exit -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -478,12 +477,6 @@ static inline _syscall3(int,open,const char *,file,int,flag,int,mode) 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 _syscall1(int,delete_module,const char *,name) - -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif /* !defined (__KERNEL_SYSCALLS__) */ #endif /* !defined (_LANGUAGE_ASSEMBLY) */ diff --git a/include/asm-mips64/unistd.h b/include/asm-mips64/unistd.h index 2bcacbf897e6..f8a7d5398807 100644 --- a/include/asm-mips64/unistd.h +++ b/include/asm-mips64/unistd.h @@ -793,7 +793,6 @@ return -1; \ * some others too. */ #define __NR__exit __NR_exit -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -804,12 +803,6 @@ static inline _syscall3(int,open,const char *,file,int,flag,int,mode) 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 _syscall1(int,delete_module,const char *,name) - -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif /* !defined (__KERNEL_SYSCALLS__) */ #endif /* !defined (_LANGUAGE_ASSEMBLY) */ diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h index 45b38d1b0e18..8a89c82a6d9b 100644 --- a/include/asm-parisc/unistd.h +++ b/include/asm-parisc/unistd.h @@ -806,24 +806,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 #ifdef __KERNEL_SYSCALLS__ -static inline int idle(void) -{ - extern int sys_idle(void); - return sys_idle(); -} - -static inline int pause(void) -{ - extern int sys_pause(void); - return sys_pause(); -} - -static inline int sync(void) -{ - extern int sys_sync(void); - return sys_sync(); -} - static inline pid_t setsid(void) { extern int sys_setsid(void); @@ -877,18 +859,6 @@ static inline pid_t waitpid(pid_t pid, int *wait_stat, int options) return sys_wait4((int)pid, wait_stat, options, NULL); } -static inline int delete_module(const char *name) -{ - extern int sys_delete_module(const char *name); - return sys_delete_module(name); -} - -static inline pid_t wait(int * wait_stat) -{ - extern int sys_wait4(int, int *, int, struct rusage *); - return sys_wait4(-1, wait_stat, 0, NULL); -} - static inline int execve(char *filename, char * argv [], char * envp[]) { diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h index 9d8e3a4de7bd..a456cb464fec 100644 --- a/include/asm-ppc/unistd.h +++ b/include/asm-ppc/unistd.h @@ -436,10 +436,6 @@ extern int open(const char *file, int flag, int mode); extern int close(int fd); extern pid_t waitpid(pid_t pid, int *wait_stat, int options); -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1, wait_stat, 0); -} #endif /* __KERNEL_SYSCALLS__ */ /* diff --git a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h index 8916fce9d39b..0323053d5a7d 100644 --- a/include/asm-ppc64/unistd.h +++ b/include/asm-ppc64/unistd.h @@ -431,8 +431,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ * System call prototypes. */ #define __NR__exit __NR_exit -static inline _syscall0(int,pause) -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -443,12 +441,6 @@ static inline _syscall3(int,open,const char *,file,int,flag,int,mode) 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 _syscall1(int,delete_module,const char *,name) - -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif /* __KERNEL_SYSCALLS__ */ diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index 29f287dd9f87..b848a9dd86af 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h @@ -59,8 +59,8 @@ static inline void set_bit_cs(int nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 3; /* align address to 4 */ nr += (addr & 3) << 3; /* add alignment to bit number */ + addr ^= addr & 3; /* align address to 4 */ #endif addr += (nr ^ (nr & 31)) >> 3; /* calculate address for CS */ mask = 1UL << (nr & 31); /* make OR mask */ @@ -84,8 +84,8 @@ static inline void clear_bit_cs(int nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 3; /* align address to 4 */ nr += (addr & 3) << 3; /* add alignment to bit number */ + addr ^= addr & 3; /* align address to 4 */ #endif addr += (nr ^ (nr & 31)) >> 3; /* calculate address for CS */ mask = ~(1UL << (nr & 31)); /* make AND mask */ @@ -109,8 +109,8 @@ static inline void change_bit_cs(int nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 3; /* align address to 4 */ nr += (addr & 3) << 3; /* add alignment to bit number */ + addr ^= addr & 3; /* align address to 4 */ #endif addr += (nr ^ (nr & 31)) >> 3; /* calculate address for CS */ mask = 1UL << (nr & 31); /* make XOR mask */ @@ -160,8 +160,8 @@ static inline int test_and_clear_bit_cs(int nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 3; /* align address to 4 */ nr += (addr & 3) << 3; /* add alignment to bit number */ + addr ^= addr & 3; /* align address to 4 */ #endif addr += (nr ^ (nr & 31)) >> 3; /* calculate address for CS */ mask = ~(1UL << (nr & 31)); /* make AND mask */ @@ -186,8 +186,8 @@ static inline int test_and_change_bit_cs(int nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 3; /* align address to 4 */ nr += (addr & 3) << 3; /* add alignment to bit number */ + addr ^= addr & 3; /* align address to 4 */ #endif addr += (nr ^ (nr & 31)) >> 3; /* calculate address for CS */ mask = 1UL << (nr & 31); /* make XOR mask */ diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h index f2621064c8dc..fb53233f0399 100644 --- a/include/asm-s390/checksum.h +++ b/include/asm-s390/checksum.h @@ -27,13 +27,27 @@ * * it's best to have buff aligned on a 32-bit boundary */ -unsigned int -csum_partial(const unsigned char * buff, int len, unsigned int sum); +static inline unsigned int +csum_partial(const unsigned char * buff, int len, unsigned int sum) +{ + register_pair rp; + /* + * Experiments with ethernet and slip connections show that buf + * is aligned on either a 2-byte or 4-byte boundary. + */ + rp.subreg.even = (unsigned long) buff; + rp.subreg.odd = (unsigned long) len; + __asm__ __volatile__ ( + "0: cksm %0,%1\n" /* do checksum on longs */ + " jo 0b\n" + : "+&d" (sum), "+&a" (rp) : : "cc" ); + return sum; +} /* * csum_partial as an inline function */ -extern inline unsigned int +static inline unsigned int csum_partial_inline(const unsigned char * buff, int len, unsigned int sum) { register_pair rp; @@ -55,7 +69,7 @@ csum_partial_inline(const unsigned char * buff, int len, unsigned int sum) * better 64-bit) boundary */ -extern inline unsigned int +static inline unsigned int csum_partial_copy(const char *src, char *dst, int len,unsigned int sum) { memcpy(dst,src,len); @@ -71,7 +85,7 @@ csum_partial_copy(const char *src, char *dst, int len,unsigned int sum) * Copy from userspace and compute checksum. If we catch an exception * then zero the rest of the buffer. */ -extern inline unsigned int +static inline unsigned int csum_partial_copy_from_user (const char *src, char *dst, int len, unsigned int sum, int *err_ptr) @@ -88,7 +102,7 @@ csum_partial_copy_from_user (const char *src, char *dst, } -extern inline unsigned int +static inline unsigned int csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) { memcpy(dst,src,len); @@ -98,10 +112,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum /* * Fold a partial checksum without adding pseudo headers */ -#if 1 -unsigned short csum_fold(unsigned int sum); -#else -extern inline unsigned short +static inline unsigned short csum_fold(unsigned int sum) { register_pair rp; @@ -116,14 +127,13 @@ csum_fold(unsigned int sum) : "+&d" (sum), "=d" (rp) : : "cc" ); return ((unsigned short) ~sum); } -#endif /* * This is a version of ip_compute_csum() optimized for IP headers, * which always checksum on 4 octet boundaries. * */ -extern inline unsigned short +static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) { register_pair rp; @@ -143,7 +153,7 @@ ip_fast_csum(unsigned char *iph, unsigned int ihl) * computes the checksum of the TCP/UDP pseudo-header * returns a 32-bit checksum */ -extern inline unsigned int +static inline unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, unsigned short proto, unsigned int sum) @@ -176,7 +186,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, * returns a 16-bit checksum, already complemented */ -extern inline unsigned short int +static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, unsigned short proto, unsigned int sum) @@ -189,7 +199,7 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, * in icmp.c */ -extern inline unsigned short +static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { return csum_fold(csum_partial(buff, len, 0)); diff --git a/include/asm-s390/dasd.h b/include/asm-s390/dasd.h index 1ea18f182184..d536b229bfc9 100644 --- a/include/asm-s390/dasd.h +++ b/include/asm-s390/dasd.h @@ -13,6 +13,8 @@ * 12/06/01 DASD_API_VERSION 2 - binary compatible to 0 (new BIODASDINFO2) * 01/23/02 DASD_API_VERSION 3 - added BIODASDPSRD (and BIODASDENAPAV) IOCTL * 02/15/02 DASD_API_VERSION 4 - added BIODASDSATTR IOCTL + * ##/##/## DASD_API_VERSION 5 - added boxed dasd support TOBEDONE + * 21/06/02 DASD_API_VERSION 6 - fixed HDIO_GETGEO: geo.start is in sectors! * */ @@ -22,7 +24,7 @@ #define DASD_IOCTL_LETTER 'D' -#define DASD_API_VERSION 4 +#define DASD_API_VERSION 6 /* * struct dasd_information2_t diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h index e46698ba43b1..56a4043a1155 100644 --- a/include/asm-s390/debug.h +++ b/include/asm-s390/debug.h @@ -160,7 +160,8 @@ debug_text_event(debug_info_t* id, int level, const char* txt) } extern debug_entry_t * -debug_sprintf_event(debug_info_t* id,int level,char *string,...); +debug_sprintf_event(debug_info_t* id,int level,char *string,...) + __attribute__ ((format(printf, 3, 4))); extern inline debug_entry_t* @@ -195,7 +196,8 @@ debug_text_exception(debug_info_t* id, int level, const char* txt) extern debug_entry_t * -debug_sprintf_exception(debug_info_t* id,int level,char *string,...); +debug_sprintf_exception(debug_info_t* id,int level,char *string,...) + __attribute__ ((format(printf, 3, 4))); int debug_register_view(debug_info_t* id, struct debug_view* view); int debug_unregister_view(debug_info_t* id, struct debug_view* view); diff --git a/include/asm-s390/hardirq.h b/include/asm-s390/hardirq.h index d7b47844d7c2..7f38c6f01e05 100644 --- a/include/asm-s390/hardirq.h +++ b/include/asm-s390/hardirq.h @@ -14,15 +14,13 @@ #include <linux/config.h> #include <linux/threads.h> -#include <asm/lowcore.h> #include <linux/sched.h> #include <linux/cache.h> +#include <asm/lowcore.h> /* entry.S is sensitive to the offsets of these fields */ typedef struct { unsigned int __softirq_pending; - unsigned int __local_irq_count; - unsigned int __local_bh_count; unsigned int __syscall_count; struct task_struct * __ksoftirqd_task; /* waitqueue is too large */ } ____cacheline_aligned irq_cpustat_t; @@ -30,64 +28,81 @@ typedef struct { #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ /* - * Are we in an interrupt context? Either doing bottom half - * or hardware interrupt processing? + * We put the hardirq and softirq counter into the preemption + * counter. The bitmask has the following meaning: + * + * - bits 0-7 are the preemption count (max preemption depth: 256) + * - bits 8-15 are the softirq count (max # of softirqs: 256) + * - bits 16-23 are the hardirq count (max # of hardirqs: 256) + * + * - ( bit 26 is the PREEMPT_ACTIVE flag. ) + * + * PREEMPT_MASK: 0x000000ff + * SOFTIRQ_MASK: 0x0000ff00 + * HARDIRQ_MASK: 0x00010000 */ -#define in_interrupt() ({ int __cpu = smp_processor_id(); \ - (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); }) -#define in_irq() (local_irq_count(smp_processor_id()) != 0) - -#ifndef CONFIG_SMP +#define PREEMPT_BITS 8 +#define SOFTIRQ_BITS 8 +#define HARDIRQ_BITS 1 -#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) -#define hardirq_endlock(cpu) do { } while (0) - -#define hardirq_enter(cpu) (local_irq_count(cpu)++) -#define hardirq_exit(cpu) (local_irq_count(cpu)--) +#define PREEMPT_SHIFT 0 +#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) +#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) -#define synchronize_irq() do { } while (0) +#define __MASK(x) ((1UL << (x))-1) -#else /* CONFIG_SMP */ +#define PREEMPT_MASK (__MASK(PREEMPT_BITS) << PREEMPT_SHIFT) +#define SOFTIRQ_MASK (__MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) +#define HARDIRQ_MASK (__MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) -#include <asm/atomic.h> -#include <asm/smp.h> +#define hardirq_count() (preempt_count() & HARDIRQ_MASK) +#define softirq_count() (preempt_count() & SOFTIRQ_MASK) +#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) -extern atomic_t global_irq_holder; -extern atomic_t global_irq_lock; -extern atomic_t global_irq_count; +#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) +#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) +#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) + +/* + * Are we doing bottom half or hardware interrupt processing? + * Are we in a softirq context? Interrupt context? + */ +#define in_irq() (hardirq_count()) +#define in_softirq() (softirq_count()) +#define in_interrupt() (irq_count()) -static inline void release_irqlock(int cpu) -{ - /* if we didn't own the irq lock, just ignore.. */ - if (atomic_read(&global_irq_holder) == cpu) { - atomic_set(&global_irq_holder,NO_PROC_ID); - atomic_set(&global_irq_lock,0); - } -} -static inline void hardirq_enter(int cpu) -{ - ++local_irq_count(cpu); - atomic_inc(&global_irq_count); -} +#define hardirq_trylock() (!in_interrupt()) +#define hardirq_endlock() do { } while (0) -static inline void hardirq_exit(int cpu) -{ - atomic_dec(&global_irq_count); - --local_irq_count(cpu); -} +#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) -static inline int hardirq_trylock(int cpu) -{ - return !atomic_read(&global_irq_count) && - !atomic_read(&global_irq_lock); -} +extern void do_call_softirq(void); -#define hardirq_endlock(cpu) do { } while (0) +#if CONFIG_PREEMPT +# define in_atomic() (in_interrupt() || preempt_count() == PREEMPT_ACTIVE) +# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) +#else +# define in_atomic() (preempt_count() != 0) +# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET +#endif -extern void synchronize_irq(void); +#define irq_exit() \ +do { \ + preempt_count() -= IRQ_EXIT_OFFSET; \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ + /* Use the async. stack for softirq */ \ + do_call_softirq(); \ + preempt_enable_no_resched(); \ +} while (0) + +#ifndef CONFIG_SMP +# define synchronize_irq(irq) barrier() +#else + extern void synchronize_irq(unsigned int irq); +#endif /* CONFIG_SMP */ -#endif /* CONFIG_SMP */ +extern void show_stack(unsigned long * esp); #endif /* __ASM_HARDIRQ_H */ diff --git a/include/asm-s390/irq.h b/include/asm-s390/irq.h index 8ecfe3324a44..bcc71eccbc63 100644 --- a/include/asm-s390/irq.h +++ b/include/asm-s390/irq.h @@ -637,6 +637,12 @@ int s390_request_irq_special( int irq, const char *devname, void *dev_id); +extern int s390_request_console_irq (int irq, + void (*handler) (int, void *, struct pt_regs *), + unsigned long irqflags, + const char *devname, + void *dev_id); + extern int set_cons_dev(int irq); extern int wait_cons_dev(int irq); extern schib_t *s390_get_schib( int irq ); @@ -860,28 +866,8 @@ typedef struct { __u32 vrdccrft : 8; /* real device feature (output) */ } __attribute__ ((packed,aligned(4))) diag210_t; -void VM_virtual_device_info( __u16 devno, /* device number */ - senseid_t *ps ); /* ptr to senseID data */ +extern int diag210( diag210_t * addr); -extern __inline__ int diag210( diag210_t * addr) -{ - int ccode; - - __asm__ __volatile__( -#ifdef CONFIG_ARCH_S390X - " sam31\n" - " diag %1,0,0x210\n" - " sam64\n" -#else - " diag %1,0,0x210\n" -#endif - " ipm %0\n" - " srl %0,28" - : "=d" (ccode) - : "a" (addr) - : "cc" ); - return ccode; -} extern __inline__ int chsc( chsc_area_t * chsc_area) { int cc; @@ -897,67 +883,6 @@ extern __inline__ int chsc( chsc_area_t * chsc_area) return cc; } -/* - * Various low-level irq details needed by irq.c, process.c, - * time.c, io_apic.c and smp.c - * - * Interrupt entry/exit code at both C and assembly level - */ - -#ifdef CONFIG_SMP - -#include <asm/atomic.h> - -static inline void irq_enter(int cpu, unsigned int irq) -{ - hardirq_enter(cpu); - while (atomic_read(&global_irq_lock) != 0) { - eieio(); - } -} - -static inline void irq_exit(int cpu, unsigned int irq) -{ - hardirq_exit(cpu); - release_irqlock(cpu); -} - - -#else - -#define irq_enter(cpu, irq) (++local_irq_count(cpu)) -#define irq_exit(cpu, irq) (--local_irq_count(cpu)) - -#endif - -#define __STR(x) #x -#define STR(x) __STR(x) - -/* - * x86 profiling function, SMP safe. We might want to do this in - * assembly totally? - * is this ever used anyway? - */ -extern char _stext; -static inline void s390_do_profile (unsigned long addr) -{ - if (prof_buffer && current->pid) { -#ifndef CONFIG_ARCH_S390X - addr &= 0x7fffffff; -#endif - addr -= (unsigned long) &_stext; - addr >>= prof_shift; - /* - * Don't ignore out-of-bounds EIP values silently, - * put them into the last histogram slot, so if - * present, they will show up as a sharp peak. - */ - if (addr > prof_len-1) - addr = prof_len-1; - atomic_inc((atomic_t *)&prof_buffer[addr]); - } -} - #include <asm/s390io.h> #define get_irq_lock(irq) &ioinfo[irq]->irq_lock diff --git a/include/asm-s390/kmap_types.h b/include/asm-s390/kmap_types.h new file mode 100644 index 000000000000..27f3d6c49ad5 --- /dev/null +++ b/include/asm-s390/kmap_types.h @@ -0,0 +1,21 @@ +#ifdef __KERNEL__ +#ifndef _ASM_KMAP_TYPES_H +#define _ASM_KMAP_TYPES_H + +enum km_type { + KM_BOUNCE_READ, + KM_SKB_SUNRPC_DATA, + KM_SKB_DATA_SOFTIRQ, + KM_USER0, + KM_USER1, + KM_BIO_SRC_IRQ, + KM_BIO_DST_IRQ, + KM_PTE0, + KM_PTE1, + KM_IRQ0, + KM_IRQ1, + KM_TYPE_NR +}; + +#endif +#endif /* __KERNEL__ */ diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index d5ad56f99aa4..d33376528713 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h @@ -52,41 +52,12 @@ #define __LC_PFAULT_INTPARM 0x080 -/* interrupt handler start with all io, external and mcck interrupt disabled */ - -#define _RESTART_PSW_MASK 0x00080000 -#define _EXT_PSW_MASK 0x04080000 -#define _PGM_PSW_MASK 0x04080000 -#define _SVC_PSW_MASK 0x04080000 -#define _MCCK_PSW_MASK 0x04080000 -#define _IO_PSW_MASK 0x04080000 -#define _USER_PSW_MASK 0x070DC000/* DAT, IO, EXT, Home-space */ -#define _WAIT_PSW_MASK 0x070E0000/* DAT, IO, EXT, Wait, Home-space */ -#define _DW_PSW_MASK 0x000A0000/* disabled wait PSW mask */ - -#define _PRIMARY_MASK 0x0000 /* MASK for SACF */ -#define _SECONDARY_MASK 0x0100 /* MASK for SACF */ -#define _ACCESS_MASK 0x0200 /* MASK for SACF */ -#define _HOME_MASK 0x0300 /* MASK for SACF */ - -#define _PSW_PRIM_SPACE_MODE 0x00000000 -#define _PSW_SEC_SPACE_MODE 0x00008000 -#define _PSW_ACC_REG_MODE 0x00004000 -#define _PSW_HOME_SPACE_MODE 0x0000C000 - -#define _PSW_WAIT_MASK_BIT 0x00020000 /* Wait bit */ -#define _PSW_IO_MASK_BIT 0x02000000 /* IO bit */ -#define _PSW_IO_WAIT 0x02020000 /* IO & Wait bit */ - -/* we run in 31 Bit mode */ -#define _ADDR_31 0x80000000 - #ifndef __ASSEMBLY__ #include <linux/config.h> -#include <asm/processor.h> #include <linux/types.h> #include <asm/atomic.h> +#include <asm/processor.h> #include <asm/sigp.h> void restart_int_handler(void); @@ -176,25 +147,16 @@ struct _lowcore __u8 pad12[0x1000-0xe04]; /* 0xe04 */ } __attribute__((packed)); /* End structure*/ +#define S390_lowcore (*((struct _lowcore *) 0)) +extern struct _lowcore *lowcore_ptr[]; + extern __inline__ void set_prefix(__u32 address) { __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); } -#define S390_lowcore (*((struct _lowcore *) 0)) -extern struct _lowcore *lowcore_ptr[]; - -#ifndef CONFIG_SMP -#define get_cpu_lowcore(cpu) (&S390_lowcore) -#define safe_get_cpu_lowcore(cpu) (&S390_lowcore) -#else -#define get_cpu_lowcore(cpu) (lowcore_ptr[(cpu)]) -#define safe_get_cpu_lowcore(cpu) \ - ((cpu) == smp_processor_id() ? &S390_lowcore : lowcore_ptr[(cpu)]) -#endif -#endif /* __ASSEMBLY__ */ - #define __PANIC_MAGIC 0xDEADC0DE #endif +#endif diff --git a/include/asm-s390/param.h b/include/asm-s390/param.h index 4c47f9f048f2..753b8bdeecba 100644 --- a/include/asm-s390/param.h +++ b/include/asm-s390/param.h @@ -9,6 +9,12 @@ #ifndef _ASMS390_PARAM_H #define _ASMS390_PARAM_H +#ifdef __KERNEL__ +# define HZ 100 /* Internal kernel timer frequency */ +# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ +#endif + #ifndef HZ #define HZ 100 #endif @@ -25,8 +31,4 @@ #define MAXHOSTNAMELEN 64 /* max length of hostname */ -#ifdef __KERNEL__ -# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ -#endif - #endif diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h index 9ef3dd733514..5a216e91891b 100644 --- a/include/asm-s390/pgalloc.h +++ b/include/asm-s390/pgalloc.h @@ -16,6 +16,8 @@ #include <linux/config.h> #include <asm/processor.h> #include <linux/threads.h> +#include <linux/gfp.h> +#include <linux/mm.h> #define check_pgt_cache() do {} while (0) diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index b48ab817e095..b11c0deb09c4 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h @@ -176,6 +176,8 @@ extern char empty_zero_page[PAGE_SIZE]; #define _SEGMENT_TABLE (_USER_SEG_TABLE_LEN|0x80000000|0x100) #define _KERNSEG_TABLE (_KERNEL_SEG_TABLE_LEN) +#define USER_STD_MASK 0x00000080UL + /* * No mapping available */ diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 542f7f1e3150..31bbde234ee9 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h @@ -101,8 +101,8 @@ typedef struct thread_struct thread_struct; /* need to define ... */ #define start_thread(regs, new_psw, new_stackp) do { \ - regs->psw.mask = _USER_PSW_MASK; \ - regs->psw.addr = new_psw | 0x80000000; \ + regs->psw.mask = PSW_USER_BITS; \ + regs->psw.addr = new_psw | PSW_ADDR_AMODE31; \ regs->gprs[15] = new_stackp ; \ } while (0) @@ -137,19 +137,6 @@ unsigned long get_wchan(struct task_struct *p); #define cpu_relax() barrier() /* - * Set of msr bits that gdb can change on behalf of a process. - */ -/* Only let our hackers near the condition codes */ -#define PSW_MASK_DEBUGCHANGE 0x00003000UL -/* Don't let em near the addressing mode either */ -#define PSW_ADDR_DEBUGCHANGE 0x7FFFFFFFUL -#define PSW_ADDR_MASK 0x7FFFFFFFUL -/* Program event recording mask */ -#define PSW_PER_MASK 0x40000000UL -#define USER_STD_MASK 0x00000080UL -#define PSW_PROBLEM_STATE 0x00010000UL - -/* * Set PSW mask to specified value, while leaving the * PSW addr pointing to the next instruction. */ @@ -178,7 +165,8 @@ static inline void enabled_wait(void) unsigned long reg; psw_t wait_psw; - wait_psw.mask = 0x070e0000; + wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT | + PSW_MASK_MCHECK | PSW_MASK_WAIT; asm volatile ( " basr %0,0\n" "0: la %0,1f-0b(%0)\n" @@ -200,7 +188,7 @@ static inline void disabled_wait(unsigned long code) psw_t *dw_psw = (psw_t *)(((unsigned long) &psw_buffer+sizeof(psw_t)-1) & -sizeof(psw_t)); - dw_psw->mask = 0x000a0000; + dw_psw->mask = PSW_BASE_BITS | PSW_MASK_WAIT; dw_psw->addr = code; /* * Store status and then load disabled wait psw, diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h index edc3b5b5c1f2..5f64a65843f7 100644 --- a/include/asm-s390/ptrace.h +++ b/include/asm-s390/ptrace.h @@ -114,7 +114,6 @@ #include <linux/config.h> #include <linux/stddef.h> #include <linux/types.h> - #include <asm/setup.h> /* this typedef defines how a Program Status Word looks like */ @@ -124,10 +123,32 @@ typedef struct __u32 addr; } __attribute__ ((aligned(8))) psw_t; -#ifdef __KERNEL__ -#define FIX_PSW(addr) ((unsigned long)(addr)|0x80000000UL) -#define ADDR_BITS_REMOVE(addr) ((addr)&0x7fffffff) -#endif +#define PSW_MASK_PER 0x40000000UL +#define PSW_MASK_DAT 0x04000000UL +#define PSW_MASK_IO 0x02000000UL +#define PSW_MASK_EXT 0x01000000UL +#define PSW_MASK_KEY 0x00F00000UL +#define PSW_MASK_MCHECK 0x00040000UL +#define PSW_MASK_WAIT 0x00020000UL +#define PSW_MASK_PSTATE 0x00010000UL +#define PSW_MASK_ASC 0x0000C000UL +#define PSW_MASK_CC 0x00003000UL +#define PSW_MASK_PM 0x00000F00UL + +#define PSW_ADDR_AMODE31 0x80000000UL +#define PSW_ADDR_INSN 0x7FFFFFFFUL + +#define PSW_BASE_BITS 0x00080000UL + +#define PSW_ASC_PRIMARY 0x00000000UL +#define PSW_ASC_ACCREG 0x00004000UL +#define PSW_ASC_SECONDARY 0x00008000UL +#define PSW_ASC_HOME 0x0000C000UL + +#define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY) +#define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ + PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ + PSW_MASK_PSTATE) typedef union { @@ -328,8 +349,8 @@ struct user_regs_struct }; #ifdef __KERNEL__ -#define user_mode(regs) (((regs)->psw.mask & PSW_PROBLEM_STATE) != 0) -#define instruction_pointer(regs) ((regs)->psw.addr) +#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) +#define instruction_pointer(regs) ((regs)->psw.addr & PSW_MASK_INSN) extern void show_regs(struct pt_regs * regs); #endif diff --git a/include/asm-s390/rwsem.h b/include/asm-s390/rwsem.h index 1072694713be..4345d83de401 100644 --- a/include/asm-s390/rwsem.h +++ b/include/asm-s390/rwsem.h @@ -48,9 +48,11 @@ struct rwsem_waiter; -extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); +extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *); +extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *); extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); +extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *); +extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *); /* * the semaphore definition @@ -105,6 +107,27 @@ static inline void __down_read(struct rw_semaphore *sem) } /* + * trylock for reading -- returns 1 if successful, 0 if contention + */ +static inline int __down_read_trylock(struct rw_semaphore *sem) +{ + signed long old, new; + + __asm__ __volatile__( + " l %0,0(%2)\n" + "0: ltr %1,%0\n" + " jm 1f\n" + " ahi %1,%3\n" + " cs %0,%1,0(%2)\n" + " jl 0b\n" + "1:" + : "=&d" (old), "=&d" (new) + : "a" (&sem->count), "i" (RWSEM_ACTIVE_READ_BIAS) + : "cc", "memory" ); + return old >= 0 ? 1 : 0; +} + +/* * lock for writing */ static inline void __down_write(struct rw_semaphore *sem) @@ -126,6 +149,26 @@ static inline void __down_write(struct rw_semaphore *sem) } /* + * trylock for writing -- returns 1 if successful, 0 if contention + */ +static inline int __down_write_trylock(struct rw_semaphore *sem) +{ + signed long old; + + __asm__ __volatile__( + " l %0,0(%1)\n" + "0: ltr %0,%0\n" + " jnz 1f\n" + " cs %0,%2,0(%1)\n" + " jl 0b\n" + "1:" + : "=&d" (old) + : "a" (&sem->count), "d" (RWSEM_ACTIVE_WRITE_BIAS) + : "cc", "memory" ); + return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; +} + +/* * unlock after reading */ static inline void __up_read(struct rw_semaphore *sem) @@ -169,6 +212,27 @@ static inline void __up_write(struct rw_semaphore *sem) } /* + * downgrade write lock to read lock + */ +static inline void __downgrade_write(struct rw_semaphore *sem) +{ + signed long old, new, tmp; + + tmp = -RWSEM_WAITING_BIAS; + __asm__ __volatile__( + " l %0,0(%2)\n" + "0: lr %1,%0\n" + " a %1,%3\n" + " cs %0,%1,0(%2)\n" + " jl 0b" + : "=&d" (old), "=&d" (new) + : "a" (&sem->count), "m" (tmp) + : "cc", "memory" ); + if (new > 1) // FIXME: is this correct ?!? + rwsem_downgrade_wake(sem); +} + +/* * implement atomic add functionality */ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem) diff --git a/include/asm-s390/s390io.h b/include/asm-s390/s390io.h index 95f9c5b61973..8424a470e887 100644 --- a/include/asm-s390/s390io.h +++ b/include/asm-s390/s390io.h @@ -9,22 +9,25 @@ #ifndef __s390io_h #define __s390io_h +#include <linux/device.h> + /* * IRQ data structure used by I/O subroutines * * Note : If bit flags are added, the "unused" value must be * decremented accordingly ! */ -typedef struct _ioinfo { +typedef struct subchannel { unsigned int irq; /* aka. subchannel number */ spinlock_t irq_lock; /* irq lock */ - void *private_data; /* pointer to private data */ - - struct _ioinfo *prev; - struct _ioinfo *next; __u8 st; /* subchannel type */ + void *private_data; /* pointer to private data */ + + struct subchannel *prev; + struct subchannel *next; + union { unsigned int info; struct { @@ -78,8 +81,26 @@ typedef struct _ioinfo { unsigned long qflag; /* queued flags */ __u8 qlpm; /* queued logical path mask */ ssd_info_t ssd_info; /* subchannel description */ + struct device dev; /* entry in device tree */ +} __attribute__ ((aligned(8))) ioinfo_t; + - } __attribute__ ((aligned(8))) ioinfo_t; +/* + * There are four different subchannel types, but we are currently + * only interested in I/O subchannels. This means there is only + * one subchannel_driver, other subchannels belonging to css_bus_type + * are simply ignored. + */ +struct subchannel_driver { + enum { + SUBCHANNEL_TYPE_IO = 0, + SUBCHANNEL_TYPE_CHSC = 1, + SUBCHANNEL_TYPE_MESSAGE = 2, + SUBCHANNEL_TYPE_ADM = 3, + } st; /* subchannel type */ + struct device_driver drv; /* entry in driver tree */ +}; +extern struct bus_type css_bus_type; #define IOINFO_FLAGS_BUSY 0x80000000 #define IOINFO_FLAGS_OPER 0x40000000 diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index 8caa0b8bdd87..7bd666e535ae 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h @@ -11,7 +11,7 @@ #include <linux/config.h> #include <linux/threads.h> -#include <linux/ptrace.h> +#include <linux/bitops.h> #if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__) @@ -29,6 +29,7 @@ typedef struct } sigp_info; extern volatile unsigned long cpu_online_map; +extern unsigned long cpu_possible_map; #define NO_PROC_ID 0xFF /* No processor magic marker */ @@ -46,14 +47,20 @@ extern volatile unsigned long cpu_online_map; #define smp_processor_id() (current_thread_info()->cpu) -extern __inline__ int cpu_logical_map(int cpu) +#define cpu_online(cpu) (cpu_online_map & (1<<(cpu))) +#define cpu_possible(cpu) (cpu_possible_map & (1<<(cpu))) + +extern inline unsigned int num_online_cpus(void) { - return cpu; + return hweight32(cpu_online_map); } -extern __inline__ int cpu_number_map(int cpu) +extern inline int any_online_cpu(unsigned int mask) { - return cpu; + if (mask & cpu_online_map) + return __ffs(mask & cpu_online_map); + + return -1; } extern __inline__ __u16 hard_smp_processor_id(void) diff --git a/include/asm-s390/softirq.h b/include/asm-s390/softirq.h index b82aac30db21..91f9853561dd 100644 --- a/include/asm-s390/softirq.h +++ b/include/asm-s390/softirq.h @@ -9,34 +9,27 @@ #ifndef __ASM_SOFTIRQ_H #define __ASM_SOFTIRQ_H -#ifndef __LINUX_SMP_H #include <linux/smp.h> -#endif +#include <linux/preempt.h> #include <asm/atomic.h> #include <asm/hardirq.h> #include <asm/lowcore.h> -#define __cpu_bh_enable(cpu) \ - do { barrier(); local_bh_count(cpu)--; } while (0) -#define cpu_bh_disable(cpu) \ - do { local_bh_count(cpu)++; barrier(); } while (0) - -#define local_bh_disable() cpu_bh_disable(smp_processor_id()) -#define __local_bh_enable() __cpu_bh_enable(smp_processor_id()) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) +#define local_bh_disable() \ + do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) +#define __local_bh_enable() \ + do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) extern void do_call_softirq(void); -#define local_bh_enable() \ -do { \ - unsigned int *ptr = &local_bh_count(smp_processor_id()); \ - barrier(); \ - if (!--*ptr) \ - if (softirq_pending(smp_processor_id())) \ - /* Use the async. stack for softirq */ \ - do_call_softirq(); \ +#define local_bh_enable() \ +do { \ + __local_bh_enable(); \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ + /* Use the async. stack for softirq */ \ + do_call_softirq(); \ + preempt_check_resched(); \ } while (0) #endif /* __ASM_SOFTIRQ_H */ diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h index 46e77f6fb9f1..176feb128687 100644 --- a/include/asm-s390/spinlock.h +++ b/include/asm-s390/spinlock.h @@ -76,6 +76,8 @@ typedef struct { #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) +#define rwlock_is_locked(x) ((x)->lock != 0) + #define _raw_read_lock(rw) \ asm volatile(" l 2,0(%1)\n" \ " j 1f\n" \ diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index 15e1af97a358..e0a825fdc763 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h @@ -12,96 +12,207 @@ #define __ASM_SYSTEM_H #include <linux/config.h> +#include <linux/kernel.h> #include <asm/types.h> +#include <asm/ptrace.h> +#include <asm/setup.h> + #ifdef __KERNEL__ -#include <asm/lowcore.h> -#endif -#include <linux/kernel.h> + +struct task_struct; + +extern struct task_struct *resume(void *, void *); + +static inline void save_fp_regs(s390_fp_regs *fpregs) +{ + asm volatile ( + " std 0,8(%0)\n" + " std 2,24(%0)\n" + " std 4,40(%0)\n" + " std 6,56(%0)" + : : "a" (fpregs) : "memory" ); + if (!MACHINE_HAS_IEEE) + return; + asm volatile( + " stfpc 0(%0)\n" + " std 1,16(%0)\n" + " std 3,32(%0)\n" + " std 5,48(%0)\n" + " std 7,64(%0)\n" + " std 8,72(%0)\n" + " std 9,80(%0)\n" + " std 10,88(%0)\n" + " std 11,96(%0)\n" + " std 12,104(%0)\n" + " std 13,112(%0)\n" + " std 14,120(%0)\n" + " std 15,128(%0)\n" + : : "a" (fpregs) : "memory" ); +} + +static inline void restore_fp_regs(s390_fp_regs *fpregs) +{ + asm volatile ( + " ld 0,8(%0)\n" + " ld 2,24(%0)\n" + " ld 4,40(%0)\n" + " ld 6,56(%0)" + : : "a" (fpregs)); + if (!MACHINE_HAS_IEEE) + return; + asm volatile( + " lfpc 0(%0)\n" + " ld 1,16(%0)\n" + " ld 3,32(%0)\n" + " ld 5,48(%0)\n" + " ld 7,64(%0)\n" + " ld 8,72(%0)\n" + " ld 9,80(%0)\n" + " ld 10,88(%0)\n" + " ld 11,96(%0)\n" + " ld 12,104(%0)\n" + " ld 13,112(%0)\n" + " ld 14,120(%0)\n" + " ld 15,128(%0)\n" + : : "a" (fpregs)); +} #define switch_to(prev,next,last) do { \ if (prev == next) \ break; \ - save_fp_regs1(&prev->thread.fp_regs); \ - restore_fp_regs1(&next->thread.fp_regs); \ + save_fp_regs(&prev->thread.fp_regs); \ + restore_fp_regs(&next->thread.fp_regs); \ resume(prev,next); \ } while (0) -struct task_struct; - #define nop() __asm__ __volatile__ ("nop") -#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) - -extern void __misaligned_u16(void); -extern void __misaligned_u32(void); +#define xchg(ptr,x) \ + ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) static inline unsigned long __xchg(unsigned long x, void * ptr, int size) { + unsigned long addr, old; + int shift; + switch (size) { - case 1: - asm volatile ( - " lhi 1,3\n" - " nr 1,%0\n" /* isolate last 2 bits */ - " xr %0,1\n" /* align ptr */ - " bras 2,0f\n" - " icm 1,8,3(%1)\n" /* for ptr&3 == 0 */ - " stcm 0,8,3(%1)\n" - " icm 1,4,3(%1)\n" /* for ptr&3 == 1 */ - " stcm 0,4,3(%1)\n" - " icm 1,2,3(%1)\n" /* for ptr&3 == 2 */ - " stcm 0,2,3(%1)\n" - " icm 1,1,3(%1)\n" /* for ptr&3 == 3 */ - " stcm 0,1,3(%1)\n" - "0: sll 1,3\n" - " la 2,0(1,2)\n" /* r2 points to an icm */ - " l 0,0(%0)\n" /* get fullword */ - "1: lr 1,0\n" /* cs loop */ - " ex 0,0(2)\n" /* insert x */ - " cs 0,1,0(%0)\n" - " jl 1b\n" - " ex 0,4(2)" /* store *ptr to x */ - : "+a&" (ptr) : "a" (&x) - : "memory", "cc", "0", "1", "2"); - break; - case 2: - if(((__u32)ptr)&1) - __misaligned_u16(); - asm volatile ( - " lhi 1,2\n" - " nr 1,%0\n" /* isolate bit 2^1 */ - " xr %0,1\n" /* align ptr */ - " bras 2,0f\n" - " icm 1,12,2(%1)\n" /* for ptr&2 == 0 */ - " stcm 0,12,2(%1)\n" - " icm 1,3,2(%1)\n" /* for ptr&2 == 1 */ - " stcm 0,3,2(%1)\n" - "0: sll 1,2\n" - " la 2,0(1,2)\n" /* r2 points to an icm */ - " l 0,0(%0)\n" /* get fullword */ - "1: lr 1,0\n" /* cs loop */ - " ex 0,0(2)\n" /* insert x */ - " cs 0,1,0(%0)\n" - " jl 1b\n" - " ex 0,4(2)" /* store *ptr to x */ - : "+a&" (ptr) : "a" (&x) - : "memory", "cc", "0", "1", "2"); - break; - case 4: - if(((__u32)ptr)&3) - __misaligned_u32(); - asm volatile ( - " l 0,0(%1)\n" - "0: cs 0,%0,0(%1)\n" - " jl 0b\n" - " lr %0,0\n" - : "+d&" (x) : "a" (ptr) - : "memory", "cc", "0" ); - break; + case 1: + addr = (unsigned long) ptr; + shift = (3 ^ (addr & 3)) << 3; + addr ^= addr & 3; + asm volatile( + " l %0,0(%3)\n" + "0: lr 0,%0\n" + " nr 0,%2\n" + " or 0,%1\n" + " cs %0,0,0(%3)\n" + " jl 0b\n" + : "=&d" (old) + : "d" (x << shift), "d" (~(255 << shift)), "a" (addr) + : "memory", "cc", "0" ); + x = old >> shift; + break; + case 2: + addr = (unsigned long) ptr; + shift = (2 ^ (addr & 2)) << 3; + addr ^= addr & 2; + asm volatile( + " l %0,0(%3)\n" + "0: lr 0,%0\n" + " nr 0,%2\n" + " or 0,%1\n" + " cs %0,0,0(%3)\n" + " jl 0b\n" + : "=&d" (old) + : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr) + : "memory", "cc", "0" ); + x = old >> shift; + break; + case 4: + asm volatile ( + " l %0,0(%2)\n" + "0: cs %0,%1,0(%2)\n" + " jl 0b\n" + : "=&d" (old) : "d" (x), "a" (ptr) + : "memory", "cc", "0" ); + x = old; + break; } return x; } /* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ + +#define __HAVE_ARCH_CMPXCHG 1 + +#define cmpxchg(ptr,o,n)\ + ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ + (unsigned long)(n),sizeof(*(ptr)))) + +static inline unsigned long +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) +{ + unsigned long addr, prev, tmp; + int shift; + + switch (size) { + case 1: + addr = (unsigned long) ptr; + shift = (3 ^ (addr & 3)) << 3; + addr ^= addr & 3; + asm volatile( + " l %0,0(%4)\n" + "0: nr %0,%5\n" + " lr %1,%0\n" + " or %0,%2\n" + " or %1,%3\n" + " cs %0,%1,0(%4)\n" + " jnl 1f\n" + " xr %1,%0\n" + " nr %1,%5\n" + " jnz 0b\n" + "1:" + : "=&d" (prev), "=&d" (tmp) + : "d" (old << shift), "d" (new << shift), "a" (ptr), + "d" (~(255 << shift)) + : "memory", "cc" ); + return prev >> shift; + case 2: + addr = (unsigned long) ptr; + shift = (2 ^ (addr & 2)) << 3; + addr ^= addr & 2; + asm volatile( + " l %0,0(%4)\n" + "0: nr %0,%5\n" + " lr %1,%0\n" + " or %0,%2\n" + " or %1,%3\n" + " cs %0,%1,0(%4)\n" + " jnl 1f\n" + " xr %1,%0\n" + " nr %1,%5\n" + " jnz 0b\n" + "1:" + : "=&d" (prev), "=&d" (tmp) + : "d" (old << shift), "d" (new << shift), "a" (ptr), + "d" (~(65535 << shift)) + : "memory", "cc" ); + return prev >> shift; + case 4: + asm volatile ( + " cs %0,%2,0(%3)\n" + : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) + : "memory", "cc" ); + return prev; + } + return old; +} + +/* * Force strict CPU ordering. * And yes, this is required on UP too when we're talking * to devices. @@ -130,22 +241,29 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) #define local_irq_enable() ({ \ __u8 __dummy; \ __asm__ __volatile__ ( \ - "stosm 0(%0),0x03" : : "a" (&__dummy) : "memory"); \ + "stosm 0(%1),0x03" : "=m" (__dummy) : "a" (&__dummy) ); \ }) #define local_irq_disable() ({ \ __u32 __flags; \ __asm__ __volatile__ ( \ - "stnsm 0(%0),0xFC" : : "a" (&__flags) : "memory"); \ + "stnsm 0(%1),0xFC" : "=m" (__flags) : "a" (&__flags) ); \ __flags; \ }) #define local_save_flags(x) \ - __asm__ __volatile__("stosm 0(%0),0" : : "a" (&x) : "memory") + __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x) ) #define local_irq_restore(x) \ __asm__ __volatile__("ssm 0(%0)" : : "a" (&x) : "memory") +#define irqs_disabled() \ +({ \ + unsigned long flags; \ + local_save_flags(flags); \ + !((flags >> 24) & 3); \ +}) + #define __load_psw(psw) \ __asm__ __volatile__("lpsw 0(%0)" : : "a" (&psw) : "cc" ); @@ -210,16 +328,6 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) #ifdef CONFIG_SMP -extern void __global_cli(void); -extern void __global_sti(void); - -extern unsigned long __global_save_flags(void); -extern void __global_restore_flags(unsigned long); -#define cli() __global_cli() -#define sti() __global_sti() -#define save_flags(x) ((x)=__global_save_flags()) -#define restore_flags(x) __global_restore_flags(x) - extern void smp_ctl_set_bit(int cr, int bit); extern void smp_ctl_clear_bit(int cr, int bit); #define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit) @@ -227,32 +335,16 @@ extern void smp_ctl_clear_bit(int cr, int bit); #else -#define cli() local_irq_disable() -#define sti() local_irq_enable() -#define save_flags(x) local_save_flags(x) -#define restore_flags(x) local_irq_restore(x) - #define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit) #define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit) - -#endif - -#ifdef __KERNEL__ -extern struct task_struct *resume(void *, void *); - -extern int save_fp_regs1(s390_fp_regs *fpregs); -extern void save_fp_regs(s390_fp_regs *fpregs); -extern int restore_fp_regs1(s390_fp_regs *fpregs); -extern void restore_fp_regs(s390_fp_regs *fpregs); +#endif /* CONFIG_SMP */ extern void (*_machine_restart)(char *command); extern void (*_machine_halt)(void); extern void (*_machine_power_off)(void); -#endif +#endif /* __KERNEL__ */ #endif - - diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h index 329f401b52c0..26a7c4d21be8 100644 --- a/include/asm-s390/thread_info.h +++ b/include/asm-s390/thread_info.h @@ -25,11 +25,9 @@ struct thread_info { struct exec_domain *exec_domain; /* execution domain */ unsigned long flags; /* low level flags */ unsigned int cpu; /* current CPU */ - int preempt_count; /* 0 => preemptable, <0 => BUG */ + unsigned int preempt_count; /* 0 => preemptable */ }; -#define PREEMPT_ACTIVE 0x4000000 - /* * macros/functions for gaining access to the thread information structure */ @@ -84,4 +82,6 @@ static inline struct thread_info *current_thread_info(void) #endif /* __KERNEL__ */ +#define PREEMPT_ACTIVE 0x4000000 + #endif /* _ASM_THREAD_INFO_H */ diff --git a/include/asm-s390/tlbflush.h b/include/asm-s390/tlbflush.h index 372c70f353f3..f079ea53a2a2 100644 --- a/include/asm-s390/tlbflush.h +++ b/include/asm-s390/tlbflush.h @@ -91,8 +91,7 @@ static inline void global_flush_tlb(void) static inline void __flush_tlb_mm(struct mm_struct * mm) { - if ((smp_num_cpus > 1) && - ((atomic_read(&mm->mm_count) != 1) || + if (((atomic_read(&mm->mm_count) != 1) || (mm->cpu_vm_mask != (1UL << smp_processor_id())))) { mm->cpu_vm_mask = (1UL << smp_processor_id()); global_flush_tlb(); diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index ff9cf61ee3e6..bfec140e0b89 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h @@ -231,6 +231,16 @@ #define __NR_futex 238 #define __NR_sched_setaffinity 239 #define __NR_sched_getaffinity 240 +#define __NR_security 241 /* syscall for security modules */ +/* + * Number 242 is reserved for tux + */ +#define __NR_io_setup 243 +#define __NR_io_destroy 244 +#define __NR_io_getevents 245 +#define __NR_io_submit 246 +#define __NR_io_cancel 247 +#define __NR_exit_group 248 /* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */ @@ -368,9 +378,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ * some others too. */ #define __NR__exit __NR_exit -static inline _syscall0(int,idle) -static inline _syscall0(int,pause) -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -380,7 +387,6 @@ 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 _syscall1(int,close,int,fd) static inline _syscall1(int,_exit,int,exitcode) -static inline _syscall1(int,delete_module,const char *,name) static inline _syscall2(long,stat,char *,filename,struct stat *,statbuf) struct rusage; @@ -390,11 +396,6 @@ static inline pid_t waitpid(int pid, int *wait_stat, int flags) return sys_wait4(pid, wait_stat, flags, NULL); } -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} - #endif /* diff --git a/include/asm-s390x/bitops.h b/include/asm-s390x/bitops.h index eaff499377dd..8e95aa43780d 100644 --- a/include/asm-s390x/bitops.h +++ b/include/asm-s390x/bitops.h @@ -63,8 +63,8 @@ static inline void set_bit_cs(unsigned long nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 7; /* align address to 8 */ nr += (addr & 7) << 3; /* add alignment to bit number */ + addr ^= addr & 7; /* align address to 8 */ #endif addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ mask = 1UL << (nr & 63); /* make OR mask */ @@ -88,8 +88,8 @@ static inline void clear_bit_cs(unsigned long nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 7; /* align address to 8 */ nr += (addr & 7) << 3; /* add alignment to bit number */ + addr ^= addr & 7; /* align address to 8 */ #endif addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ mask = ~(1UL << (nr & 63)); /* make AND mask */ @@ -113,8 +113,8 @@ static inline void change_bit_cs(unsigned long nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 7; /* align address to 8 */ nr += (addr & 7) << 3; /* add alignment to bit number */ + addr ^= addr & 7; /* align address to 8 */ #endif addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ mask = 1UL << (nr & 63); /* make XOR mask */ @@ -139,8 +139,8 @@ test_and_set_bit_cs(unsigned long nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 7; /* align address to 8 */ nr += (addr & 7) << 3; /* add alignment to bit number */ + addr ^= addr & 7; /* align address to 8 */ #endif addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ mask = 1UL << (nr & 63); /* make OR/test mask */ @@ -166,8 +166,8 @@ test_and_clear_bit_cs(unsigned long nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 7; /* align address to 8 */ nr += (addr & 7) << 3; /* add alignment to bit number */ + addr ^= addr & 7; /* align address to 8 */ #endif addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ mask = ~(1UL << (nr & 63)); /* make AND mask */ @@ -193,8 +193,8 @@ test_and_change_bit_cs(unsigned long nr, volatile void *ptr) addr = (unsigned long) ptr; #if ALIGN_CS == 1 - addr ^= addr & 7; /* align address to 8 */ nr += (addr & 7) << 3; /* add alignment to bit number */ + addr ^= addr & 7; /* align address to 8 */ #endif addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ mask = 1UL << (nr & 63); /* make XOR mask */ @@ -811,7 +811,14 @@ extern __inline__ int fls(int x) * hweightN: returns the hamming weight (i.e. the number * of bits set) of a N-bit word */ - +#define hweight64(x) \ +({ \ + unsigned long __x = (x); \ + unsigned int __w; \ + __w = generic_hweight32((unsigned int) __x); \ + __w += generic_hweight32((unsigned int) (__x>>32)); \ + __w; \ +}) #define hweight32(x) generic_hweight32(x) #define hweight16(x) generic_hweight16(x) #define hweight8(x) generic_hweight8(x) diff --git a/include/asm-s390x/checksum.h b/include/asm-s390x/checksum.h index 8c436737e6f0..e44eb70fb63f 100644 --- a/include/asm-s390x/checksum.h +++ b/include/asm-s390x/checksum.h @@ -27,13 +27,29 @@ * * it's best to have buff aligned on a 32-bit boundary */ -unsigned int -csum_partial(const unsigned char * buff, int len, unsigned int sum); +static inline unsigned int +csum_partial(const unsigned char * buff, int len, unsigned int sum) +{ + /* + * Experiments with ethernet and slip connections show that buff + * is aligned on either a 2-byte or 4-byte boundary. + */ + __asm__ __volatile__ ( + " lgr 2,%1\n" /* address in gpr 2 */ + " lgfr 3,%2\n" /* length in gpr 3 */ + "0: cksm %0,2\n" /* do checksum on longs */ + " jo 0b\n" + : "+&d" (sum) + : "d" (buff), "d" (len) + : "cc", "2", "3" ); + return sum; + +} /* * csum_partial as an inline function */ -extern inline unsigned int +static inline unsigned int csum_partial_inline(const unsigned char * buff, int len, unsigned int sum) { __asm__ __volatile__ ( @@ -55,7 +71,7 @@ csum_partial_inline(const unsigned char * buff, int len, unsigned int sum) * better 64-bit) boundary */ -extern inline unsigned int +static inline unsigned int csum_partial_copy(const char *src, char *dst, int len,unsigned int sum) { memcpy(dst,src,len); @@ -71,7 +87,7 @@ csum_partial_copy(const char *src, char *dst, int len,unsigned int sum) * Copy from userspace and compute checksum. If we catch an exception * then zero the rest of the buffer. */ -extern inline unsigned int +static inline unsigned int csum_partial_copy_from_user (const char *src, char *dst, int len, unsigned int sum, int *err_ptr) @@ -87,7 +103,7 @@ csum_partial_copy_from_user (const char *src, char *dst, return csum_partial(dst, len, sum); } -extern inline unsigned int +static inline unsigned int csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) { memcpy(dst,src,len); @@ -97,7 +113,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum /* * Fold a partial checksum without adding pseudo headers */ -extern inline unsigned short +static inline unsigned short csum_fold(unsigned int sum) { __asm__ __volatile__ ( @@ -116,7 +132,7 @@ csum_fold(unsigned int sum) * which always checksum on 4 octet boundaries. * */ -extern inline unsigned short +static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) { unsigned long sum; @@ -137,7 +153,7 @@ ip_fast_csum(unsigned char *iph, unsigned int ihl) * computes the checksum of the TCP/UDP pseudo-header * returns a 32-bit checksum */ -extern inline unsigned int +static inline unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, unsigned short proto, unsigned int sum) @@ -170,7 +186,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, * returns a 16-bit checksum, already complemented */ -extern inline unsigned short int +static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, unsigned short proto, unsigned int sum) @@ -183,7 +199,7 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, * in icmp.c */ -extern inline unsigned short +static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { return csum_fold(csum_partial_inline(buff, len, 0)); diff --git a/include/asm-s390x/dasd.h b/include/asm-s390x/dasd.h index 1ea18f182184..d536b229bfc9 100644 --- a/include/asm-s390x/dasd.h +++ b/include/asm-s390x/dasd.h @@ -13,6 +13,8 @@ * 12/06/01 DASD_API_VERSION 2 - binary compatible to 0 (new BIODASDINFO2) * 01/23/02 DASD_API_VERSION 3 - added BIODASDPSRD (and BIODASDENAPAV) IOCTL * 02/15/02 DASD_API_VERSION 4 - added BIODASDSATTR IOCTL + * ##/##/## DASD_API_VERSION 5 - added boxed dasd support TOBEDONE + * 21/06/02 DASD_API_VERSION 6 - fixed HDIO_GETGEO: geo.start is in sectors! * */ @@ -22,7 +24,7 @@ #define DASD_IOCTL_LETTER 'D' -#define DASD_API_VERSION 4 +#define DASD_API_VERSION 6 /* * struct dasd_information2_t diff --git a/include/asm-s390x/debug.h b/include/asm-s390x/debug.h index e46698ba43b1..56a4043a1155 100644 --- a/include/asm-s390x/debug.h +++ b/include/asm-s390x/debug.h @@ -160,7 +160,8 @@ debug_text_event(debug_info_t* id, int level, const char* txt) } extern debug_entry_t * -debug_sprintf_event(debug_info_t* id,int level,char *string,...); +debug_sprintf_event(debug_info_t* id,int level,char *string,...) + __attribute__ ((format(printf, 3, 4))); extern inline debug_entry_t* @@ -195,7 +196,8 @@ debug_text_exception(debug_info_t* id, int level, const char* txt) extern debug_entry_t * -debug_sprintf_exception(debug_info_t* id,int level,char *string,...); +debug_sprintf_exception(debug_info_t* id,int level,char *string,...) + __attribute__ ((format(printf, 3, 4))); int debug_register_view(debug_info_t* id, struct debug_view* view); int debug_unregister_view(debug_info_t* id, struct debug_view* view); diff --git a/include/asm-s390x/hardirq.h b/include/asm-s390x/hardirq.h index 607f34ee659a..05ead85061d9 100644 --- a/include/asm-s390x/hardirq.h +++ b/include/asm-s390x/hardirq.h @@ -21,8 +21,6 @@ /* entry.S is sensitive to the offsets of these fields */ typedef struct { unsigned int __softirq_pending; - unsigned int __local_irq_count; - unsigned int __local_bh_count; unsigned int __syscall_count; struct task_struct * __ksoftirqd_task; /* waitqueue is too large */ } ____cacheline_aligned irq_cpustat_t; @@ -30,64 +28,82 @@ typedef struct { #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ /* - * Are we in an interrupt context? Either doing bottom half - * or hardware interrupt processing? + * We put the hardirq and softirq counter into the preemption + * counter. The bitmask has the following meaning: + * + * - bits 0-7 are the preemption count (max preemption depth: 256) + * - bits 8-15 are the softirq count (max # of softirqs: 256) + * - bits 16-23 are the hardirq count (max # of hardirqs: 256) + * + * - ( bit 26 is the PREEMPT_ACTIVE flag. ) + * + * PREEMPT_MASK: 0x000000ff + * SOFTIRQ_MASK: 0x0000ff00 + * HARDIRQ_MASK: 0x00010000 */ -#define in_interrupt() ({ int __cpu = smp_processor_id(); \ - (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); }) -#define in_irq() (local_irq_count(smp_processor_id()) != 0) +#define PREEMPT_BITS 8 +#define SOFTIRQ_BITS 8 +// FIXME: we have 2^16 i/o and 2^16 external interrupts... +#define HARDIRQ_BITS 1 -#ifndef CONFIG_SMP - -#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) -#define hardirq_endlock(cpu) do { } while (0) - -#define hardirq_enter(cpu) (local_irq_count(cpu)++) -#define hardirq_exit(cpu) (local_irq_count(cpu)--) +#define PREEMPT_SHIFT 0 +#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) +#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) -#define synchronize_irq() do { } while (0) +#define __MASK(x) ((1UL << (x))-1) -#else +#define PREEMPT_MASK (__MASK(PREEMPT_BITS) << PREEMPT_SHIFT) +#define SOFTIRQ_MASK (__MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) +#define HARDIRQ_MASK (__MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) -#include <asm/atomic.h> -#include <asm/smp.h> +#define hardirq_count() (preempt_count() & HARDIRQ_MASK) +#define softirq_count() (preempt_count() & SOFTIRQ_MASK) +#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) -extern atomic_t global_irq_holder; -extern atomic_t global_irq_lock; -extern atomic_t global_irq_count; +#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) +#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) +#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) -static inline void release_irqlock(int cpu) -{ - /* if we didn't own the irq lock, just ignore.. */ - if (atomic_read(&global_irq_holder) == cpu) { - atomic_set(&global_irq_holder,NO_PROC_ID); - atomic_set(&global_irq_lock,0); - } -} +/* + * Are we doing bottom half or hardware interrupt processing? + * Are we in a softirq context? Interrupt context? + */ +#define in_irq() (hardirq_count()) +#define in_softirq() (softirq_count()) +#define in_interrupt() (irq_count()) -static inline void hardirq_enter(int cpu) -{ - ++local_irq_count(cpu); - atomic_inc(&global_irq_count); -} -static inline void hardirq_exit(int cpu) -{ - atomic_dec(&global_irq_count); - --local_irq_count(cpu); -} +#define hardirq_trylock() (!in_interrupt()) +#define hardirq_endlock() do { } while (0) -static inline int hardirq_trylock(int cpu) -{ - return !atomic_read(&global_irq_count) && - !atomic_read(&global_irq_lock); -} +#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) -#define hardirq_endlock(cpu) do { } while (0) +extern void do_call_softirq(void); -extern void synchronize_irq(void); +#if CONFIG_PREEMPT +# define in_atomic() (in_interrupt() || preempt_count() == PREEMPT_ACTIVE) +# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) +#else +# define in_atomic() (preempt_count() != 0) +# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET +#endif + +#define irq_exit() \ +do { \ + preempt_count() -= IRQ_EXIT_OFFSET; \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ + /* Use the async. stack for softirq */ \ + do_call_softirq(); \ + preempt_enable_no_resched(); \ +} while (0) +#ifndef CONFIG_SMP +# define synchronize_irq(irq) barrier() +#else + extern void synchronize_irq(unsigned int irq); #endif /* CONFIG_SMP */ +extern void show_stack(unsigned long * esp); + #endif /* __ASM_HARDIRQ_H */ diff --git a/include/asm-s390x/irq.h b/include/asm-s390x/irq.h index 8ecfe3324a44..bcc71eccbc63 100644 --- a/include/asm-s390x/irq.h +++ b/include/asm-s390x/irq.h @@ -637,6 +637,12 @@ int s390_request_irq_special( int irq, const char *devname, void *dev_id); +extern int s390_request_console_irq (int irq, + void (*handler) (int, void *, struct pt_regs *), + unsigned long irqflags, + const char *devname, + void *dev_id); + extern int set_cons_dev(int irq); extern int wait_cons_dev(int irq); extern schib_t *s390_get_schib( int irq ); @@ -860,28 +866,8 @@ typedef struct { __u32 vrdccrft : 8; /* real device feature (output) */ } __attribute__ ((packed,aligned(4))) diag210_t; -void VM_virtual_device_info( __u16 devno, /* device number */ - senseid_t *ps ); /* ptr to senseID data */ +extern int diag210( diag210_t * addr); -extern __inline__ int diag210( diag210_t * addr) -{ - int ccode; - - __asm__ __volatile__( -#ifdef CONFIG_ARCH_S390X - " sam31\n" - " diag %1,0,0x210\n" - " sam64\n" -#else - " diag %1,0,0x210\n" -#endif - " ipm %0\n" - " srl %0,28" - : "=d" (ccode) - : "a" (addr) - : "cc" ); - return ccode; -} extern __inline__ int chsc( chsc_area_t * chsc_area) { int cc; @@ -897,67 +883,6 @@ extern __inline__ int chsc( chsc_area_t * chsc_area) return cc; } -/* - * Various low-level irq details needed by irq.c, process.c, - * time.c, io_apic.c and smp.c - * - * Interrupt entry/exit code at both C and assembly level - */ - -#ifdef CONFIG_SMP - -#include <asm/atomic.h> - -static inline void irq_enter(int cpu, unsigned int irq) -{ - hardirq_enter(cpu); - while (atomic_read(&global_irq_lock) != 0) { - eieio(); - } -} - -static inline void irq_exit(int cpu, unsigned int irq) -{ - hardirq_exit(cpu); - release_irqlock(cpu); -} - - -#else - -#define irq_enter(cpu, irq) (++local_irq_count(cpu)) -#define irq_exit(cpu, irq) (--local_irq_count(cpu)) - -#endif - -#define __STR(x) #x -#define STR(x) __STR(x) - -/* - * x86 profiling function, SMP safe. We might want to do this in - * assembly totally? - * is this ever used anyway? - */ -extern char _stext; -static inline void s390_do_profile (unsigned long addr) -{ - if (prof_buffer && current->pid) { -#ifndef CONFIG_ARCH_S390X - addr &= 0x7fffffff; -#endif - addr -= (unsigned long) &_stext; - addr >>= prof_shift; - /* - * Don't ignore out-of-bounds EIP values silently, - * put them into the last histogram slot, so if - * present, they will show up as a sharp peak. - */ - if (addr > prof_len-1) - addr = prof_len-1; - atomic_inc((atomic_t *)&prof_buffer[addr]); - } -} - #include <asm/s390io.h> #define get_irq_lock(irq) &ioinfo[irq]->irq_lock diff --git a/include/asm-s390x/kmap_types.h b/include/asm-s390x/kmap_types.h new file mode 100644 index 000000000000..27f3d6c49ad5 --- /dev/null +++ b/include/asm-s390x/kmap_types.h @@ -0,0 +1,21 @@ +#ifdef __KERNEL__ +#ifndef _ASM_KMAP_TYPES_H +#define _ASM_KMAP_TYPES_H + +enum km_type { + KM_BOUNCE_READ, + KM_SKB_SUNRPC_DATA, + KM_SKB_DATA_SOFTIRQ, + KM_USER0, + KM_USER1, + KM_BIO_SRC_IRQ, + KM_BIO_DST_IRQ, + KM_PTE0, + KM_PTE1, + KM_IRQ0, + KM_IRQ1, + KM_TYPE_NR +}; + +#endif +#endif /* __KERNEL__ */ diff --git a/include/asm-s390x/lowcore.h b/include/asm-s390x/lowcore.h index edb29f4df6bf..41e0c5fc07cf 100644 --- a/include/asm-s390x/lowcore.h +++ b/include/asm-s390x/lowcore.h @@ -38,6 +38,8 @@ #define __LC_IO_INT_WORD 0x0C0 #define __LC_MCCK_CODE 0x0E8 +#define __LC_DIAG44_OPCODE 0x214 + #define __LC_SAVE_AREA 0xC00 #define __LC_KERNEL_STACK 0xD40 #define __LC_ASYNC_STACK 0xD48 @@ -54,32 +56,6 @@ #define __LC_PFAULT_INTPARM 0x11B8 -/* interrupt handler start with all io, external and mcck interrupt disabled */ - -#define _RESTART_PSW_MASK 0x0000000180000000 -#define _EXT_PSW_MASK 0x0400000180000000 -#define _PGM_PSW_MASK 0x0400000180000000 -#define _SVC_PSW_MASK 0x0400000180000000 -#define _MCCK_PSW_MASK 0x0400000180000000 -#define _IO_PSW_MASK 0x0400000180000000 -#define _USER_PSW_MASK 0x0705C00180000000 -#define _WAIT_PSW_MASK 0x0706000180000000 -#define _DW_PSW_MASK 0x0002000180000000 - -#define _PRIMARY_MASK 0x0000 /* MASK for SACF */ -#define _SECONDARY_MASK 0x0100 /* MASK for SACF */ -#define _ACCESS_MASK 0x0200 /* MASK for SACF */ -#define _HOME_MASK 0x0300 /* MASK for SACF */ - -#define _PSW_PRIM_SPACE_MODE 0x0000000000000000 -#define _PSW_SEC_SPACE_MODE 0x0000800000000000 -#define _PSW_ACC_REG_MODE 0x0000400000000000 -#define _PSW_HOME_SPACE_MODE 0x0000C00000000000 - -#define _PSW_WAIT_MASK_BIT 0x0002000000000000 -#define _PSW_IO_MASK_BIT 0x0200000000000000 -#define _PSW_IO_WAIT 0x0202000000000000 - #ifndef __ASSEMBLY__ #include <linux/config.h> @@ -146,7 +122,8 @@ struct _lowcore psw_t io_new_psw; /* 0x1f0 */ psw_t return_psw; /* 0x200 */ __u32 sync_io_word; /* 0x210 */ - __u8 pad8[0xc00-0x214]; /* 0x214 */ + __u32 diag44_opcode; /* 0x214 */ + __u8 pad8[0xc00-0x218]; /* 0x218 */ /* System info area */ __u64 save_area[16]; /* 0xc00 */ __u8 pad9[0xd40-0xc80]; /* 0xc80 */ @@ -191,25 +168,17 @@ struct _lowcore __u8 pad17[0x2000-0x1400]; /* 0x1400 */ } __attribute__((packed)); /* End structure*/ +#define S390_lowcore (*((struct _lowcore *) 0)) +extern struct _lowcore *lowcore_ptr[]; + extern __inline__ void set_prefix(__u32 address) { __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); } -#define S390_lowcore (*((struct _lowcore *) 0)) -extern struct _lowcore *lowcore_ptr[]; +#define __PANIC_MAGIC 0xDEADC0DE -#ifndef CONFIG_SMP -#define get_cpu_lowcore(cpu) (&S390_lowcore) -#define safe_get_cpu_lowcore(cpu) (&S390_lowcore) -#else -#define get_cpu_lowcore(cpu) (lowcore_ptr[(cpu)]) -#define safe_get_cpu_lowcore(cpu) \ - ((cpu) == smp_processor_id() ? &S390_lowcore : lowcore_ptr[(cpu)]) #endif -#endif /* __ASSEMBLY__ */ - -#define __PANIC_MAGIC 0xDEADC0DE #endif diff --git a/include/asm-s390x/param.h b/include/asm-s390x/param.h index f2e0cc0a4dcc..753b8bdeecba 100644 --- a/include/asm-s390x/param.h +++ b/include/asm-s390x/param.h @@ -9,11 +9,14 @@ #ifndef _ASMS390_PARAM_H #define _ASMS390_PARAM_H -#ifndef HZ -#define HZ 100 #ifdef __KERNEL__ -#define hz_to_std(a) (a) +# define HZ 100 /* Internal kernel timer frequency */ +# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ #endif + +#ifndef HZ +#define HZ 100 #endif #define EXEC_PAGESIZE 4096 @@ -28,8 +31,4 @@ #define MAXHOSTNAMELEN 64 /* max length of hostname */ -#ifdef __KERNEL__ -# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ -#endif - #endif diff --git a/include/asm-s390x/pgalloc.h b/include/asm-s390x/pgalloc.h index 282ec93f29d4..838eb9ff927e 100644 --- a/include/asm-s390x/pgalloc.h +++ b/include/asm-s390x/pgalloc.h @@ -16,6 +16,8 @@ #include <linux/config.h> #include <asm/processor.h> #include <linux/threads.h> +#include <linux/gfp.h> +#include <linux/mm.h> #define check_pgt_cache() do { } while (0) diff --git a/include/asm-s390x/pgtable.h b/include/asm-s390x/pgtable.h index 6c590334ab3a..f84930684b68 100644 --- a/include/asm-s390x/pgtable.h +++ b/include/asm-s390x/pgtable.h @@ -168,6 +168,8 @@ extern char empty_zero_page[PAGE_SIZE]; #define _REGION_TABLE (_REGION_THIRD|_REGION_THIRD_LEN|0x40|0x100) #define _KERN_REGION_TABLE (_REGION_THIRD|_REGION_THIRD_LEN) +#define USER_STD_MASK 0x0000000000000080UL + /* Bits in the storage key */ #define _PAGE_CHANGED 0x02 /* HW changed bit */ #define _PAGE_REFERENCED 0x04 /* HW referenced bit */ diff --git a/include/asm-s390x/processor.h b/include/asm-s390x/processor.h index f578c9eba468..334cd6dcf6c4 100644 --- a/include/asm-s390x/processor.h +++ b/include/asm-s390x/processor.h @@ -111,13 +111,13 @@ typedef struct thread_struct thread_struct; /* need to define ... */ #define start_thread(regs, new_psw, new_stackp) do { \ - regs->psw.mask = _USER_PSW_MASK; \ + regs->psw.mask = PSW_USER_BITS; \ regs->psw.addr = new_psw; \ regs->gprs[15] = new_stackp; \ } while (0) #define start_thread31(regs, new_psw, new_stackp) do { \ - regs->psw.mask = _USER_PSW_MASK & ~(1L << 32); \ + regs->psw.mask = PSW_USER32_BITS; \ regs->psw.addr = new_psw; \ regs->gprs[15] = new_stackp; \ } while (0) @@ -154,19 +154,6 @@ unsigned long get_wchan(struct task_struct *p); #define cpu_relax() barrier() /* - * Set of msr bits that gdb can change on behalf of a process. - */ -/* Only let our hackers near the condition codes */ -#define PSW_MASK_DEBUGCHANGE 0x0000300000000000UL -/* Don't let em near the addressing mode either */ -#define PSW_ADDR_DEBUGCHANGE 0xFFFFFFFFFFFFFFFFUL -#define PSW_ADDR_MASK 0xFFFFFFFFFFFFFFFFUL -/* Program event recording mask */ -#define PSW_PER_MASK 0x4000000000000000UL -#define USER_STD_MASK 0x0000000000000080UL -#define PSW_PROBLEM_STATE 0x0001000000000000UL - -/* * Set PSW mask to specified value, while leaving the * PSW addr pointing to the next instruction. */ @@ -194,7 +181,8 @@ static inline void enabled_wait(void) unsigned long reg; psw_t wait_psw; - wait_psw.mask = 0x0706000180000000; + wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT | + PSW_MASK_MCHECK | PSW_MASK_WAIT; asm volatile ( " larl %0,0f\n" " stg %0,8(%1)\n" @@ -214,7 +202,7 @@ static inline void disabled_wait(addr_t code) psw_t *dw_psw = (psw_t *)(((unsigned long) &psw_buffer+sizeof(psw_t)-1) & -sizeof(psw_t)); - dw_psw->mask = 0x0002000180000000; + dw_psw->mask = PSW_BASE_BITS | PSW_MASK_WAIT; dw_psw->addr = code; /* * Store status and then load disabled wait psw, diff --git a/include/asm-s390x/ptrace.h b/include/asm-s390x/ptrace.h index 311d6624a6d0..adf7fbaf629b 100644 --- a/include/asm-s390x/ptrace.h +++ b/include/asm-s390x/ptrace.h @@ -104,10 +104,33 @@ typedef struct __u64 addr; } __attribute__ ((aligned(8))) psw_t; -#ifdef __KERNEL__ -#define FIX_PSW(addr) ((unsigned long)(addr)) -#define ADDR_BITS_REMOVE(addr) ((addr)) -#endif +#define PSW_MASK_PER 0x4000000000000000UL +#define PSW_MASK_DAT 0x0400000000000000UL +#define PSW_MASK_IO 0x0200000000000000UL +#define PSW_MASK_EXT 0x0100000000000000UL +#define PSW_MASK_KEY 0x00F0000000000000UL +#define PSW_MASK_MCHECK 0x0004000000000000UL +#define PSW_MASK_WAIT 0x0002000000000000UL +#define PSW_MASK_PSTATE 0x0001000000000000UL +#define PSW_MASK_ASC 0x0000C00000000000UL +#define PSW_MASK_CC 0x0000300000000000UL +#define PSW_MASK_PM 0x00000F0000000000UL + +#define PSW_BASE_BITS 0x0000000180000000UL +#define PSW_BASE32_BITS 0x0000000080000000UL + +#define PSW_ASC_PRIMARY 0x0000000000000000UL +#define PSW_ASC_ACCREG 0x0000400000000000UL +#define PSW_ASC_SECONDARY 0x0000800000000000UL +#define PSW_ASC_HOME 0x0000C00000000000UL + +#define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY) +#define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ + PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ + PSW_MASK_PSTATE) +#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ + PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ + PSW_MASK_PSTATE) typedef union { @@ -309,7 +332,7 @@ struct user_regs_struct }; #ifdef __KERNEL__ -#define user_mode(regs) (((regs)->psw.mask & PSW_PROBLEM_STATE) != 0) +#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) #define instruction_pointer(regs) ((regs)->psw.addr) extern void show_regs(struct pt_regs * regs); #endif diff --git a/include/asm-s390x/rwsem.h b/include/asm-s390x/rwsem.h index 5ee597eadc88..ec635241c20e 100644 --- a/include/asm-s390x/rwsem.h +++ b/include/asm-s390x/rwsem.h @@ -48,9 +48,11 @@ struct rwsem_waiter; -extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); +extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *); +extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *); extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); +extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *); +extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *); /* * the semaphore definition @@ -105,6 +107,27 @@ static inline void __down_read(struct rw_semaphore *sem) } /* + * trylock for reading -- returns 1 if successful, 0 if contention + */ +static inline int __down_read_trylock(struct rw_semaphore *sem) +{ + signed long old, new; + + __asm__ __volatile__( + " lg %0,0(%2)\n" + "0: ltgr %1,%0\n" + " jm 1f\n" + " aghi %1,%3\n" + " csg %0,%1,0(%2)\n" + " jl 0b\n" + "1:" + : "=&d" (old), "=&d" (new) + : "a" (&sem->count), "i" (RWSEM_ACTIVE_READ_BIAS) + : "cc", "memory" ); + return old >= 0 ? 1 : 0; +} + +/* * lock for writing */ static inline void __down_write(struct rw_semaphore *sem) @@ -126,6 +149,26 @@ static inline void __down_write(struct rw_semaphore *sem) } /* + * trylock for writing -- returns 1 if successful, 0 if contention + */ +static inline int __down_write_trylock(struct rw_semaphore *sem) +{ + signed long old; + + __asm__ __volatile__( + " lg %0,0(%1)\n" + "0: ltgr %0,%0\n" + " jnz 1f\n" + " csg %0,%2,0(%1)\n" + " jl 0b\n" + "1:" + : "=&d" (old) + : "a" (&sem->count), "d" (RWSEM_ACTIVE_WRITE_BIAS) + : "cc", "memory" ); + return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; +} + +/* * unlock after reading */ static inline void __up_read(struct rw_semaphore *sem) @@ -169,6 +212,27 @@ static inline void __up_write(struct rw_semaphore *sem) } /* + * downgrade write lock to read lock + */ +static inline void __downgrade_write(struct rw_semaphore *sem) +{ + signed long old, new, tmp; + + tmp = -RWSEM_WAITING_BIAS; + __asm__ __volatile__( + " lg %0,0(%2)\n" + "0: lgr %1,%0\n" + " ag %1,%3\n" + " csg %0,%1,0(%2)\n" + " jl 0b" + : "=&d" (old), "=&d" (new) + : "a" (&sem->count), "m" (tmp) + : "cc", "memory" ); + if (new > 1) // FIXME: is this correct ?!? + rwsem_downgrade_wake(sem); +} + +/* * implement atomic add functionality */ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem) diff --git a/include/asm-s390x/s390io.h b/include/asm-s390x/s390io.h index 9a984f96dcfa..8424a470e887 100644 --- a/include/asm-s390x/s390io.h +++ b/include/asm-s390x/s390io.h @@ -9,21 +9,24 @@ #ifndef __s390io_h #define __s390io_h +#include <linux/device.h> + /* * IRQ data structure used by I/O subroutines * * Note : If bit flags are added, the "unused" value must be * decremented accordingly ! */ -typedef struct _ioinfo { +typedef struct subchannel { unsigned int irq; /* aka. subchannel number */ spinlock_t irq_lock; /* irq lock */ - void *private_data; /* pointer to private data */ - struct _ioinfo *prev; - struct _ioinfo *next; + __u8 st; /* subchannel type */ + + void *private_data; /* pointer to private data */ - __u8 st; /* subchannel type */ + struct subchannel *prev; + struct subchannel *next; union { unsigned int info; @@ -78,8 +81,26 @@ typedef struct _ioinfo { unsigned long qflag; /* queued flags */ __u8 qlpm; /* queued logical path mask */ ssd_info_t ssd_info; /* subchannel description */ + struct device dev; /* entry in device tree */ +} __attribute__ ((aligned(8))) ioinfo_t; - } __attribute__ ((aligned(8))) ioinfo_t; + +/* + * There are four different subchannel types, but we are currently + * only interested in I/O subchannels. This means there is only + * one subchannel_driver, other subchannels belonging to css_bus_type + * are simply ignored. + */ +struct subchannel_driver { + enum { + SUBCHANNEL_TYPE_IO = 0, + SUBCHANNEL_TYPE_CHSC = 1, + SUBCHANNEL_TYPE_MESSAGE = 2, + SUBCHANNEL_TYPE_ADM = 3, + } st; /* subchannel type */ + struct device_driver drv; /* entry in driver tree */ +}; +extern struct bus_type css_bus_type; #define IOINFO_FLAGS_BUSY 0x80000000 #define IOINFO_FLAGS_OPER 0x40000000 diff --git a/include/asm-s390x/setup.h b/include/asm-s390x/setup.h index 0a0419089bf5..9aa13a641520 100644 --- a/include/asm-s390x/setup.h +++ b/include/asm-s390x/setup.h @@ -25,11 +25,12 @@ */ extern unsigned long machine_flags; -#define MACHINE_IS_VM (machine_flags & 1) -#define MACHINE_IS_P390 (machine_flags & 4) -#define MACHINE_HAS_MVPG (machine_flags & 16) +#define MACHINE_IS_VM (machine_flags & 1) +#define MACHINE_IS_P390 (machine_flags & 4) +#define MACHINE_HAS_MVPG (machine_flags & 16) +#define MACHINE_HAS_DIAG44 (machine_flags & 32) -#define MACHINE_HAS_HWC (!MACHINE_IS_P390) +#define MACHINE_HAS_HWC (!MACHINE_IS_P390) /* * Console mode. Override with conmode= diff --git a/include/asm-s390x/smp.h b/include/asm-s390x/smp.h index 8caa0b8bdd87..28e1fd23b426 100644 --- a/include/asm-s390x/smp.h +++ b/include/asm-s390x/smp.h @@ -11,7 +11,7 @@ #include <linux/config.h> #include <linux/threads.h> -#include <linux/ptrace.h> +#include <linux/bitops.h> #if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__) @@ -29,6 +29,7 @@ typedef struct } sigp_info; extern volatile unsigned long cpu_online_map; +extern volatile unsigned long cpu_possible_map; #define NO_PROC_ID 0xFF /* No processor magic marker */ @@ -46,14 +47,20 @@ extern volatile unsigned long cpu_online_map; #define smp_processor_id() (current_thread_info()->cpu) -extern __inline__ int cpu_logical_map(int cpu) +#define cpu_online(cpu) (cpu_online_map & (1<<(cpu))) +#define cpu_possible(cpu) (cpu_possible_map & (1<<(cpu))) + +extern inline unsigned int num_online_cpus(void) { - return cpu; + return hweight64(cpu_online_map); } -extern __inline__ int cpu_number_map(int cpu) +extern inline int any_online_cpu(unsigned int mask) { - return cpu; + if (mask & cpu_online_map) + return __ffs(mask & cpu_online_map); + + return -1; } extern __inline__ __u16 hard_smp_processor_id(void) diff --git a/include/asm-s390x/softirq.h b/include/asm-s390x/softirq.h index b82aac30db21..91f9853561dd 100644 --- a/include/asm-s390x/softirq.h +++ b/include/asm-s390x/softirq.h @@ -9,34 +9,27 @@ #ifndef __ASM_SOFTIRQ_H #define __ASM_SOFTIRQ_H -#ifndef __LINUX_SMP_H #include <linux/smp.h> -#endif +#include <linux/preempt.h> #include <asm/atomic.h> #include <asm/hardirq.h> #include <asm/lowcore.h> -#define __cpu_bh_enable(cpu) \ - do { barrier(); local_bh_count(cpu)--; } while (0) -#define cpu_bh_disable(cpu) \ - do { local_bh_count(cpu)++; barrier(); } while (0) - -#define local_bh_disable() cpu_bh_disable(smp_processor_id()) -#define __local_bh_enable() __cpu_bh_enable(smp_processor_id()) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) +#define local_bh_disable() \ + do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) +#define __local_bh_enable() \ + do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) extern void do_call_softirq(void); -#define local_bh_enable() \ -do { \ - unsigned int *ptr = &local_bh_count(smp_processor_id()); \ - barrier(); \ - if (!--*ptr) \ - if (softirq_pending(smp_processor_id())) \ - /* Use the async. stack for softirq */ \ - do_call_softirq(); \ +#define local_bh_enable() \ +do { \ + __local_bh_enable(); \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ + /* Use the async. stack for softirq */ \ + do_call_softirq(); \ + preempt_check_resched(); \ } while (0) #endif /* __ASM_SOFTIRQ_H */ diff --git a/include/asm-s390x/spinlock.h b/include/asm-s390x/spinlock.h index d18dba14f2eb..e9e226f5f23d 100644 --- a/include/asm-s390x/spinlock.h +++ b/include/asm-s390x/spinlock.h @@ -12,6 +12,20 @@ #define __ASM_SPINLOCK_H /* + * Grmph, take care of %&#! user space programs that include + * asm/spinlock.h. The diagnose is only available in kernel + * context. + */ +#ifdef __KERNEL__ +#include <asm/lowcore.h> +#define __DIAG44_INSN "ex" +#define __DIAG44_OPERAND __LC_DIAG44_OPCODE +#else +#define __DIAG44_INSN "#" +#define __DIAG44_OPERAND 0 +#endif + +/* * Simple spin lock operations. There are two variants, one clears IRQ's * on the local processor, one does not. * @@ -31,12 +45,13 @@ extern inline void _raw_spin_lock(spinlock_t *lp) { unsigned long reg1, reg2; __asm__ __volatile(" bras %1,1f\n" - "0: # diag 0,0,68\n" + "0: " __DIAG44_INSN " 0,%4\n" "1: slr %0,%0\n" " cs %0,%1,0(%3)\n" " jl 0b\n" : "=&d" (reg1), "=&d" (reg2), "+m" (lp->lock) - : "a" (&lp->lock) : "cc" ); + : "a" (&lp->lock), "i" (__DIAG44_OPERAND) + : "cc" ); } extern inline int _raw_spin_trylock(spinlock_t *lp) @@ -76,46 +91,52 @@ typedef struct { #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) +#define rwlock_is_locked(x) ((x)->lock != 0) + #define _raw_read_lock(rw) \ asm volatile(" lg 2,0(%1)\n" \ " j 1f\n" \ - "0: # diag 0,0,68\n" \ + "0: " __DIAG44_INSN " 0,%2\n" \ "1: nihh 2,0x7fff\n" /* clear high (=write) bit */ \ " la 3,1(2)\n" /* one more reader */ \ " csg 2,3,0(%1)\n" /* try to write new value */ \ " jl 0b" \ - : "+m" ((rw)->lock) : "a" (&(rw)->lock) \ + : "+m" ((rw)->lock) \ + : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \ : "2", "3", "cc" ) #define _raw_read_unlock(rw) \ asm volatile(" lg 2,0(%1)\n" \ " j 1f\n" \ - "0: # diag 0,0,68\n" \ + "0: " __DIAG44_INSN " 0,%2\n" \ "1: lgr 3,2\n" \ " bctgr 3,0\n" /* one less reader */ \ " csg 2,3,0(%1)\n" \ " jl 0b" \ - : "+m" ((rw)->lock) : "a" (&(rw)->lock) \ + : "+m" ((rw)->lock) \ + : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \ : "2", "3", "cc" ) #define _raw_write_lock(rw) \ asm volatile(" llihh 3,0x8000\n" /* new lock value = 0x80...0 */ \ " j 1f\n" \ - "0: # diag 0,0,68\n" \ + "0: " __DIAG44_INSN " 0,%2\n" \ "1: slgr 2,2\n" /* old lock value must be 0 */ \ " csg 2,3,0(%1)\n" \ " jl 0b" \ - : "+m" ((rw)->lock) : "a" (&(rw)->lock) \ + : "+m" ((rw)->lock) \ + : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \ : "2", "3", "cc" ) #define _raw_write_unlock(rw) \ asm volatile(" slgr 3,3\n" /* new lock value = 0 */ \ " j 1f\n" \ - "0: # diag 0,0,68\n" \ + "0: " __DIAG44_INSN " 0,%2\n" \ "1: llihh 2,0x8000\n" /* old lock value must be 0x8..0 */\ " csg 2,3,0(%1)\n" \ " jl 0b" \ - : "+m" ((rw)->lock) : "a" (&(rw)->lock) \ + : "+m" ((rw)->lock) \ + : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \ : "2", "3", "cc" ) #endif /* __ASM_SPINLOCK_H */ diff --git a/include/asm-s390x/system.h b/include/asm-s390x/system.h index 81810a4819b9..74470fc09edd 100644 --- a/include/asm-s390x/system.h +++ b/include/asm-s390x/system.h @@ -12,13 +12,64 @@ #define __ASM_SYSTEM_H #include <linux/config.h> +#include <linux/kernel.h> #include <asm/types.h> +#include <asm/ptrace.h> +#include <asm/setup.h> + #ifdef __KERNEL__ -#include <asm/lowcore.h> -#endif -#include <linux/kernel.h> -#define switch_to(prev,next),last do { \ +struct task_struct; + +extern struct task_struct *resume(void *, void *); + +static inline void save_fp_regs(s390_fp_regs *fpregs) +{ + asm volatile ( + " stfpc 0(%0)\n" + " std 0,8(%0)\n" + " std 1,16(%0)\n" + " std 2,24(%0)\n" + " std 3,32(%0)\n" + " std 4,40(%0)\n" + " std 5,48(%0)\n" + " std 6,56(%0)\n" + " std 7,64(%0)\n" + " std 8,72(%0)\n" + " std 9,80(%0)\n" + " std 10,88(%0)\n" + " std 11,96(%0)\n" + " std 12,104(%0)\n" + " std 13,112(%0)\n" + " std 14,120(%0)\n" + " std 15,128(%0)\n" + : : "a" (fpregs) : "memory" ); +} + +static inline void restore_fp_regs(s390_fp_regs *fpregs) +{ + asm volatile ( + " lfpc 0(%0)\n" + " ld 0,8(%0)\n" + " ld 1,16(%0)\n" + " ld 2,24(%0)\n" + " ld 3,32(%0)\n" + " ld 4,40(%0)\n" + " ld 5,48(%0)\n" + " ld 6,56(%0)\n" + " ld 7,64(%0)\n" + " ld 8,72(%0)\n" + " ld 9,80(%0)\n" + " ld 10,88(%0)\n" + " ld 11,96(%0)\n" + " ld 12,104(%0)\n" + " ld 13,112(%0)\n" + " ld 14,120(%0)\n" + " ld 15,128(%0)\n" + : : "a" (fpregs)); +} + +#define switch_to(prev,next,last) do { \ if (prev == next) \ break; \ save_fp_regs(&prev->thread.fp_regs); \ @@ -26,8 +77,6 @@ resume(prev,next); \ } while (0) -struct task_struct; - #define nop() __asm__ __volatile__ ("nop") #define xchg(ptr,x) \ @@ -39,82 +88,142 @@ extern void __misaligned_u64(void); static inline unsigned long __xchg(unsigned long x, void * ptr, int size) { + unsigned long addr, old; + int shift; + switch (size) { - case 1: - asm volatile ( - " lghi 1,3\n" - " nr 1,%0\n" /* isolate last 2 bits */ - " xr %0,1\n" /* align ptr */ - " bras 2,0f\n" - " icm 1,8,7(%1)\n" /* for ptr&3 == 0 */ - " stcm 0,8,7(%1)\n" - " icm 1,4,7(%1)\n" /* for ptr&3 == 1 */ - " stcm 0,4,7(%1)\n" - " icm 1,2,7(%1)\n" /* for ptr&3 == 2 */ - " stcm 0,2,7(%1)\n" - " icm 1,1,7(%1)\n" /* for ptr&3 == 3 */ - " stcm 0,1,7(%1)\n" - "0: sll 1,3\n" - " la 2,0(1,2)\n" /* r2 points to an icm */ - " l 0,0(%0)\n" /* get fullword */ - "1: lr 1,0\n" /* cs loop */ - " ex 0,0(2)\n" /* insert x */ - " cs 0,1,0(%0)\n" - " jl 1b\n" - " ex 0,4(2)" /* store *ptr to x */ - : "+&a" (ptr) : "a" (&x) - : "memory", "cc", "0", "1", "2"); - break; - case 2: - if(((addr_t)ptr)&1) - __misaligned_u16(); - asm volatile ( - " lghi 1,2\n" - " nr 1,%0\n" /* isolate bit 2^1 */ - " xr %0,1\n" /* align ptr */ - " bras 2,0f\n" - " icm 1,12,6(%1)\n" /* for ptr&2 == 0 */ - " stcm 0,12,6(%1)\n" - " icm 1,3,2(%1)\n" /* for ptr&2 == 1 */ - " stcm 0,3,2(%1)\n" - "0: sll 1,2\n" - " la 2,0(1,2)\n" /* r2 points to an icm */ - " l 0,0(%0)\n" /* get fullword */ - "1: lr 1,0\n" /* cs loop */ - " ex 0,0(2)\n" /* insert x */ - " cs 0,1,0(%0)\n" - " jl 1b\n" - " ex 0,4(2)" /* store *ptr to x */ - : "+&a" (ptr) : "a" (&x) - : "memory", "cc", "0", "1", "2"); - break; - case 4: - if(((addr_t)ptr)&3) - __misaligned_u32(); - asm volatile ( - " l 0,0(%1)\n" - "0: cs 0,%0,0(%1)\n" - " jl 0b\n" - " lgfr %0,0\n" - : "+d" (x) : "a" (ptr) - : "memory", "cc", "0" ); - break; - case 8: - if(((addr_t)ptr)&7) - __misaligned_u64(); - asm volatile ( - " lg 0,0(%1)\n" - "0: csg 0,%0,0(%1)\n" - " jl 0b\n" - " lgr %0,0\n" - : "+d" (x) : "a" (ptr) - : "memory", "cc", "0" ); - break; + case 1: + addr = (unsigned long) ptr; + shift = (3 ^ (addr & 3)) << 3; + addr ^= addr & 3; + asm volatile( + " l %0,0(%3)\n" + "0: lr 0,%0\n" + " nr 0,%2\n" + " or 0,%1\n" + " cs %0,0,0(%3)\n" + " jl 0b\n" + : "=&d" (old) + : "d" (x << shift), "d" (~(255 << shift)), "a" (addr) + : "memory", "cc", "0" ); + x = old >> shift; + break; + case 2: + addr = (unsigned long) ptr; + shift = (2 ^ (addr & 2)) << 3; + addr ^= addr & 2; + asm volatile( + " l %0,0(%3)\n" + "0: lr 0,%0\n" + " nr 0,%2\n" + " or 0,%1\n" + " cs %0,0,0(%3)\n" + " jl 0b\n" + : "=&d" (old) + : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr) + : "memory", "cc", "0" ); + x = old >> shift; + break; + case 4: + asm volatile ( + " l %0,0(%2)\n" + "0: cs %0,%1,0(%2)\n" + " jl 0b\n" + : "=&d" (old) : "d" (x), "a" (ptr) + : "memory", "cc", "0" ); + x = old; + break; + case 8: + asm volatile ( + " lg %0,0(%2)\n" + "0: csg %0,%1,0(%2)\n" + " jl 0b\n" + : "=&d" (old) : "d" (x), "a" (ptr) + : "memory", "cc", "0" ); + x = old; + break; } return x; } /* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ + +#define __HAVE_ARCH_CMPXCHG 1 + +#define cmpxchg(ptr,o,n)\ + ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ + (unsigned long)(n),sizeof(*(ptr)))) + +static inline unsigned long +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) +{ + unsigned long addr, prev, tmp; + int shift; + + switch (size) { + case 1: + addr = (unsigned long) ptr; + shift = (3 ^ (addr & 3)) << 3; + addr ^= addr & 3; + asm volatile( + " l %0,0(%4)\n" + "0: nr %0,%5\n" + " lr %1,%0\n" + " or %0,%2\n" + " or %1,%3\n" + " cs %0,%1,0(%4)\n" + " jnl 1f\n" + " xr %1,%0\n" + " nr %1,%5\n" + " jnz 0b\n" + "1:" + : "=&d" (prev), "=&d" (tmp) + : "d" (old << shift), "d" (new << shift), "a" (ptr), + "d" (~(255 << shift)) + : "memory", "cc" ); + return prev >> shift; + case 2: + addr = (unsigned long) ptr; + shift = (2 ^ (addr & 2)) << 3; + addr ^= addr & 2; + asm volatile( + " l %0,0(%4)\n" + "0: nr %0,%5\n" + " lr %1,%0\n" + " or %0,%2\n" + " or %1,%3\n" + " cs %0,%1,0(%4)\n" + " jnl 1f\n" + " xr %1,%0\n" + " nr %1,%5\n" + " jnz 0b\n" + "1:" + : "=&d" (prev), "=&d" (tmp) + : "d" (old << shift), "d" (new << shift), "a" (ptr), + "d" (~(65535 << shift)) + : "memory", "cc" ); + return prev >> shift; + case 4: + asm volatile ( + " cs %0,%2,0(%3)\n" + : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) + : "memory", "cc" ); + return prev; + case 8: + asm volatile ( + " csg %0,%2,0(%3)\n" + : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) + : "memory", "cc" ); + return prev; + } + return old; +} + +/* * Force strict CPU ordering. * And yes, this is required on UP too when we're talking * to devices. @@ -142,21 +251,28 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) #define local_irq_enable() ({ \ unsigned long __dummy; \ __asm__ __volatile__ ( \ - "stosm 0(%0),0x03" : : "a" (&__dummy) : "memory"); \ + "stosm 0(%1),0x03" : "=m" (__dummy) : "a" (&__dummy) ); \ }) #define local_irq_disable() ({ \ unsigned long __flags; \ __asm__ __volatile__ ( \ - "stnsm 0(%0),0xFC" : : "a" (&__flags) : "memory"); \ + "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \ __flags; \ }) #define local_save_flags(x) \ - __asm__ __volatile__("stosm 0(%0),0" : : "a" (&x) : "memory") + __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x) ) #define local_irq_restore(x) \ - __asm__ __volatile__("ssm 0(%0)" : : "a" (&x) : "memory") + __asm__ __volatile__("ssm 0(%0)" : : "a" (&x) ) + +#define irqs_disabled() \ +({ \ + unsigned long flags; \ + local_save_flags(flags); \ + !((flags >> 56) & 3); \ +}) #define __load_psw(psw) \ __asm__ __volatile__("lpswe 0(%0)" : : "a" (&psw) : "cc" ); @@ -220,16 +336,6 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) #ifdef CONFIG_SMP -extern void __global_cli(void); -extern void __global_sti(void); - -extern unsigned long __global_save_flags(void); -extern void __global_restore_flags(unsigned long); -#define cli() __global_cli() -#define sti() __global_sti() -#define save_flags(x) ((x)=__global_save_flags()) -#define restore_flags(x) __global_restore_flags(x) - extern void smp_ctl_set_bit(int cr, int bit); extern void smp_ctl_clear_bit(int cr, int bit); #define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit) @@ -237,32 +343,16 @@ extern void smp_ctl_clear_bit(int cr, int bit); #else -#define cli() local_irq_disable() -#define sti() local_irq_enable() -#define save_flags(x) local_save_flags(x) -#define restore_flags(x) local_irq_restore(x) - #define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit) #define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit) - -#endif - -#ifdef __KERNEL__ -extern struct task_struct *resume(void *, void *); - -extern int save_fp_regs1(s390_fp_regs *fpregs); -extern void save_fp_regs(s390_fp_regs *fpregs); -extern int restore_fp_regs1(s390_fp_regs *fpregs); -extern void restore_fp_regs(s390_fp_regs *fpregs); +#endif /* CONFIG_SMP */ extern void (*_machine_restart)(char *command); extern void (*_machine_halt)(void); extern void (*_machine_power_off)(void); -#endif +#endif /* __KERNEL __ */ #endif - - diff --git a/include/asm-s390x/thread_info.h b/include/asm-s390x/thread_info.h index 788dc05c66ab..788c7e6654ce 100644 --- a/include/asm-s390x/thread_info.h +++ b/include/asm-s390x/thread_info.h @@ -25,11 +25,9 @@ struct thread_info { struct exec_domain *exec_domain; /* execution domain */ unsigned long flags; /* low level flags */ unsigned int cpu; /* current CPU */ - int preempt_count; /* 0 => preemptable, <0 => BUG */ + unsigned int preempt_count; /* 0 => preemptable */ }; -#define PREEMPT_ACTIVE 0x4000000 - /* * macros/functions for gaining access to the thread information structure */ @@ -84,4 +82,6 @@ static inline struct thread_info *current_thread_info(void) #endif /* __KERNEL__ */ +#define PREEMPT_ACTIVE 0x4000000 + #endif /* _ASM_THREAD_INFO_H */ diff --git a/include/asm-s390x/tlbflush.h b/include/asm-s390x/tlbflush.h index d064a59b0678..77b6f6dd7f21 100644 --- a/include/asm-s390x/tlbflush.h +++ b/include/asm-s390x/tlbflush.h @@ -88,8 +88,7 @@ static inline void global_flush_tlb(void) static inline void __flush_tlb_mm(struct mm_struct * mm) { - if ((smp_num_cpus > 1) && - ((atomic_read(&mm->mm_count) != 1) || + if (((atomic_read(&mm->mm_count) != 1) || (mm->cpu_vm_mask != (1UL << smp_processor_id())))) { mm->cpu_vm_mask = (1UL << smp_processor_id()); global_flush_tlb(); diff --git a/include/asm-s390x/unistd.h b/include/asm-s390x/unistd.h index cec7c863e072..a3ee3ed707da 100644 --- a/include/asm-s390x/unistd.h +++ b/include/asm-s390x/unistd.h @@ -198,6 +198,16 @@ #define __NR_futex 238 #define __NR_sched_setaffinity 239 #define __NR_sched_getaffinity 240 +#define __NR_security 241 /* syscall for security modules */ +/* + * Number 242 is reserved for tux + */ +#define __NR_io_setup 243 +#define __NR_io_destroy 244 +#define __NR_io_getevents 245 +#define __NR_io_submit 246 +#define __NR_io_cancel 247 +#define __NR_exit_group 248 /* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */ @@ -335,9 +345,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ * some others too. */ #define __NR__exit __NR_exit -static inline _syscall0(int,idle) -static inline _syscall0(int,pause) -static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -347,7 +354,6 @@ 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 _syscall1(int,close,int,fd) static inline _syscall1(int,_exit,int,exitcode) -static inline _syscall1(int,delete_module,const char *,name) static inline _syscall2(long,stat,char *,filename,struct stat *,statbuf) struct rusage; @@ -357,11 +363,6 @@ static inline pid_t waitpid(int pid, int *wait_stat, int flags) return sys_wait4(pid, wait_stat, flags, NULL); } -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} - #endif /* diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h index afebc07eaf02..f5b8fdb49b9f 100644 --- a/include/asm-sh/unistd.h +++ b/include/asm-sh/unistd.h @@ -347,8 +347,6 @@ __syscall_return(type,__sc0); \ * some others too. */ #define __NR__exit __NR_exit -static __inline__ _syscall0(int,pause) -static __inline__ _syscall0(int,sync) static __inline__ _syscall0(pid_t,setsid) static __inline__ _syscall3(int,write,int,fd,const char *,buf,off_t,count) static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -359,12 +357,7 @@ static __inline__ _syscall3(int,open,const char *,file,int,flag,int,mode) 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__ _syscall1(int,delete_module,const char *,name) -static __inline__ pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif /* diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h index f928fde5caee..b4a785dbd9cf 100644 --- a/include/asm-sparc/unistd.h +++ b/include/asm-sparc/unistd.h @@ -416,8 +416,6 @@ return -1; \ * some others too. */ #define __NR__exit __NR_exit -static __inline__ _syscall0(int,pause) -static __inline__ _syscall0(int,sync) static __inline__ _syscall0(pid_t,setsid) static __inline__ _syscall3(int,write,int,fd,__const__ char *,buf,off_t,count) static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -428,12 +426,6 @@ static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode) 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__ _syscall1(int,delete_module,const char *,name) - -static __inline__ pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif /* __KERNEL_SYSCALLS__ */ diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index 2959d9071240..588f2a577fa7 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h @@ -406,8 +406,6 @@ return -1; \ * some others too. */ #define __NR__exit __NR_exit -static __inline__ _syscall0(int,pause) -static __inline__ _syscall0(int,sync) static __inline__ _syscall0(pid_t,setsid) static __inline__ _syscall3(int,write,int,fd,__const__ char *,buf,off_t,count) static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count) @@ -418,12 +416,6 @@ static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode) 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__ _syscall1(int,delete_module,const char *,name) - -static __inline__ pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} #endif /* __KERNEL_SYSCALLS__ */ diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h index 6c5e913cbf9c..2ceb9c226c32 100644 --- a/include/asm-um/unistd.h +++ b/include/asm-um/unistd.h @@ -61,11 +61,6 @@ static inline long waitpid(pid_t pid, unsigned int *status, int options) KERNEL_CALL(pid_t, sys_wait4, pid, status, options, NULL) } -static inline pid_t wait(int *status) -{ - KERNEL_CALL(pid_t, sys_wait4, -1, status, 0, NULL) -} - static inline pid_t setsid(void) { KERNEL_CALL(pid_t, sys_setsid) diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 5b1c2bbf4f91..88450cf78c8a 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h @@ -573,18 +573,6 @@ __syscall_return(type,__res); \ */ #define __NR__exit __NR_exit -extern long sys_pause(void); -static inline long pause(void) -{ - return sys_pause(); -} - -extern long sys_sync(void); -static inline long sync(void) -{ - return sys_sync(); -} - extern pid_t sys_setsid(void); static inline pid_t setsid(void) { @@ -636,12 +624,6 @@ extern inline long exit(int error_code) sys_exit(error_code); } -extern long sys_delete_module(const char *); -static inline long delete_module(const char *name_user) -{ - return sys_delete_module(name_user); -} - struct rusage; asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru); @@ -650,11 +632,6 @@ static inline pid_t waitpid(int pid, int * wait_stat, int flags) return sys_wait4(pid, wait_stat, flags, NULL); } -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} - #endif /* __KERNEL_SYSCALLS__ */ #endif /* __NO_STUBS */ diff --git a/include/linux/amifd.h b/include/linux/amifd.h index eac36f77fa8f..346993268b45 100644 --- a/include/linux/amifd.h +++ b/include/linux/amifd.h @@ -55,7 +55,7 @@ struct amiga_floppy_struct { int busy; /* true when drive is active */ int dirty; /* true when trackbuf is not on disk */ int status; /* current error code for unit */ - struct gendisk disk; + struct gendisk *gendisk; }; #endif diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index dd8f1bfb150e..71732e1216fc 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -140,7 +140,6 @@ void end_buffer_io_sync(struct buffer_head *bh, int uptodate); void buffer_insert_list(spinlock_t *lock, struct buffer_head *, struct list_head *); void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode); -int write_mapping_buffers(struct address_space *mapping); int inode_has_buffers(struct inode *); void invalidate_inode_buffers(struct inode *); int fsync_buffers_list(spinlock_t *lock, struct list_head *); @@ -168,6 +167,9 @@ void free_buffer_head(struct buffer_head * bh); void FASTCALL(unlock_buffer(struct buffer_head *bh)); void ll_rw_block(int, int, struct buffer_head * bh[]); int submit_bh(int, struct buffer_head *); +void write_boundary_block(struct block_device *bdev, + sector_t bblock, unsigned blocksize); + extern int buffer_heads_over_limit; /* diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 5c6c7db6e97e..8a54a1c5e5af 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -73,8 +73,8 @@ typedef struct blkelv_ioctl_arg_s { #define BLKELVGET _IOR(0x12,106,sizeof(blkelv_ioctl_arg_t)) #define BLKELVSET _IOW(0x12,107,sizeof(blkelv_ioctl_arg_t)) -extern int elevator_init(request_queue_t *, elevator_t *, elevator_t); -extern void elevator_exit(request_queue_t *, elevator_t *); +extern int elevator_init(request_queue_t *, elevator_t *); +extern void elevator_exit(request_queue_t *); extern inline int bio_rq_in_between(struct bio *, struct request *, struct list_head *); extern inline int elv_rq_merge_ok(struct request *, struct bio *); extern inline int elv_try_merge(struct request *, struct bio *); diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index d4550e28f37e..3f370ab642dd 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h @@ -17,6 +17,7 @@ #define _LINUX_EXT3_FS_H #include <linux/types.h> +#include <linux/ext3_fs_sb.h> /* * The second extended filesystem constants/structures diff --git a/include/linux/fs.h b/include/linux/fs.h index f0ba1e96325c..ad6648e3fd9c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -627,9 +627,6 @@ extern int send_sigurg(struct fown_struct *fown); #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ #define MNT_DETACH 0x00000002 /* Just detach from the tree */ -#include <linux/ext3_fs_sb.h> -#include <linux/hpfs_fs_sb.h> - extern struct list_head super_blocks; extern spinlock_t sb_lock; @@ -670,8 +667,6 @@ struct super_block { char s_id[32]; /* Informational name */ union { - struct ext3_sb_info ext3_sb; - struct hpfs_sb_info hpfs_sb; void *generic_sbp; } u; /* diff --git a/include/linux/hpfs_fs_sb.h b/include/linux/hpfs_fs_sb.h index 068035e9a4bd..c6355adaf6f1 100644 --- a/include/linux/hpfs_fs_sb.h +++ b/include/linux/hpfs_fs_sb.h @@ -36,31 +36,4 @@ struct hpfs_sb_info { int sb_timeshift; }; -#define s_hpfs_root u.hpfs_sb.sb_root -#define s_hpfs_fs_size u.hpfs_sb.sb_fs_size -#define s_hpfs_bitmaps u.hpfs_sb.sb_bitmaps -#define s_hpfs_dirband_start u.hpfs_sb.sb_dirband_start -#define s_hpfs_dirband_size u.hpfs_sb.sb_dirband_size -#define s_hpfs_dmap u.hpfs_sb.sb_dmap -#define s_hpfs_uid u.hpfs_sb.sb_uid -#define s_hpfs_gid u.hpfs_sb.sb_gid -#define s_hpfs_mode u.hpfs_sb.sb_mode -#define s_hpfs_n_free u.hpfs_sb.sb_n_free -#define s_hpfs_n_free_dnodes u.hpfs_sb.sb_n_free_dnodes -#define s_hpfs_lowercase u.hpfs_sb.sb_lowercase -#define s_hpfs_conv u.hpfs_sb.sb_conv -#define s_hpfs_eas u.hpfs_sb.sb_eas -#define s_hpfs_err u.hpfs_sb.sb_err -#define s_hpfs_chk u.hpfs_sb.sb_chk -#define s_hpfs_was_error u.hpfs_sb.sb_was_error -#define s_hpfs_chkdsk u.hpfs_sb.sb_chkdsk -/*#define s_hpfs_rd_fnode u.hpfs_sb.sb_rd_fnode*/ -#define s_hpfs_rd_inode u.hpfs_sb.sb_rd_inode -#define s_hpfs_cp_table u.hpfs_sb.sb_cp_table -#define s_hpfs_bmp_dir u.hpfs_sb.sb_bmp_dir -#define s_hpfs_c_bitmap u.hpfs_sb.sb_c_bitmap -#define s_hpfs_iget_q u.hpfs_sb.sb_iget_q -/*#define s_hpfs_mounting u.hpfs_sb.sb_mounting*/ -#define s_hpfs_timeshift u.hpfs_sb.sb_timeshift - #endif diff --git a/include/linux/ide.h b/include/linux/ide.h index 74fff672eaef..7b8ebfe2c8dd 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -302,24 +302,14 @@ typedef struct ide_io_ops_s { void (*OUTB)(u8 addr, u32 port); void (*OUTW)(u16 addr, u32 port); void (*OUTL)(u32 addr, u32 port); - void (*OUTBP)(u8 addr, u32 port); - void (*OUTWP)(u16 addr, u32 port); - void (*OUTLP)(u32 addr, u32 port); void (*OUTSW)(u32 port, void *addr, u32 count); - void (*OUTSWP)(u32 port, void *addr, u32 count); void (*OUTSL)(u32 port, void *addr, u32 count); - void (*OUTSLP)(u32 port, void *addr, u32 count); u8 (*INB)(u32 port); u16 (*INW)(u32 port); u32 (*INL)(u32 port); - u8 (*INBP)(u32 port); - u16 (*INWP)(u32 port); - u32 (*INLP)(u32 port); void (*INSW)(u32 port, void *addr, u32 count); - void (*INSWP)(u32 port, void *addr, u32 count); void (*INSL)(u32 port, void *addr, u32 count); - void (*INSLP)(u32 port, void *addr, u32 count); } ide_io_ops_t; /* @@ -375,41 +365,6 @@ extern int ide_irq_lock; #endif /* IDE_ARCH_LOCK */ /* - * If the arch-dependant ide.h did not declare/define any OUT_BYTE - * or IN_BYTE functions, we make some defaults here. - */ - -#ifndef HAVE_ARCH_OUT_BYTE -# ifdef REALLY_FAST_IO -# define OUT_BYTE(b,p) outb((b),(p)) -# define OUT_WORD(w,p) outw((w),(p)) -# define OUT_LONG(l,p) outl((l),(p)) -# else -# define OUT_BYTE(b,p) outb_p((b),(p)) -# define OUT_WORD(w,p) outw_p((w),(p)) -# define OUT_LONG(l,p) outl_p((l),(p)) -# endif -# define OUT_BYTE_P(b,p) outb_p((b),(p)) -# define OUT_WORD_P(w,p) outw_p((w),(p)) -# define OUT_LONG_P(l,p) outl_p((l),(p)) -#endif - -#ifndef HAVE_ARCH_IN_BYTE -# ifdef REALLY_FAST_IO -# define IN_BYTE(p) (u8) inb(p) -# define IN_WORD(p) (u16) inw(p) -# define IN_LONG(p) (u32) inl(p) -# else -# define IN_BYTE(p) (u8) inb_p(p) -# define IN_WORD(p) (u16) inw_p(p) -# define IN_LONG(p) (u32) inl_p(p) -# endif -# define IN_BYTE_P(p) (u8) inb_p(p) -# define IN_WORD_P(p) (u16) inw_p(p) -# define IN_LONG_P(p) (u32) inl_p(p) -#endif - -/* * Now for the data we need to maintain per-drive: ide_drive_t */ @@ -1011,24 +966,14 @@ typedef struct hwif_s { void (*OUTB)(u8 addr, u32 port); void (*OUTW)(u16 addr, u32 port); void (*OUTL)(u32 addr, u32 port); - void (*OUTBP)(u8 addr, u32 port); - void (*OUTWP)(u16 addr, u32 port); - void (*OUTLP)(u32 addr, u32 port); void (*OUTSW)(u32 port, void *addr, u32 count); - void (*OUTSWP)(u32 port, void *addr, u32 count); void (*OUTSL)(u32 port, void *addr, u32 count); - void (*OUTSLP)(u32 port, void *addr, u32 count); u8 (*INB)(u32 port); u16 (*INW)(u32 port); u32 (*INL)(u32 port); - u8 (*INBP)(u32 port); - u16 (*INWP)(u32 port); - u32 (*INLP)(u32 port); void (*INSW)(u32 port, void *addr, u32 count); - void (*INSWP)(u32 port, void *addr, u32 count); void (*INSL)(u32 port, void *addr, u32 count); - void (*INSLP)(u32 port, void *addr, u32 count); #endif /* dma physical region descriptor table (cpu view) */ diff --git a/include/linux/list.h b/include/linux/list.h index bd6f0ac3fb6b..634aab6c4c94 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -86,13 +86,12 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) /** * list_del - deletes entry from list. * @entry: the element to delete from the list. - * Note: list_empty on entry does not return true after this, the entry is in an undefined state. + * Note: list_empty on entry does not return true after this, the entry is + * in an undefined state. */ static inline void list_del(struct list_head *entry) { __list_del(entry->prev, entry->next); - entry->next = (void *) 0; - entry->prev = (void *) 0; } /** diff --git a/include/linux/mm.h b/include/linux/mm.h index 4ae8eb10dcb2..a5107b5043f7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -176,7 +176,7 @@ struct page { * Architectures with slow multiplication can define * WANT_PAGE_VIRTUAL in asm/page.h */ -#if defined(CONFIG_HIGHMEM) || defined(WANT_PAGE_VIRTUAL) +#if defined(WANT_PAGE_VIRTUAL) void *virtual; /* Kernel virtual address (NULL if not kmapped, ie. highmem) */ #endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */ @@ -289,38 +289,34 @@ static inline void set_page_zone(struct page *page, unsigned long zone_num) page->flags |= zone_num << ZONE_SHIFT; } -/* - * In order to avoid #ifdefs within C code itself, we define - * set_page_address to a noop for non-highmem machines, where - * the field isn't useful. - * The same is true for page_address() in arch-dependent code. - */ -#if defined(CONFIG_HIGHMEM) || defined(WANT_PAGE_VIRTUAL) +#define lowmem_page_address(page) \ + __va( ( ((page) - page_zone(page)->zone_mem_map) \ + + page_zone(page)->zone_start_pfn) << PAGE_SHIFT) + +#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) +#define HASHED_PAGE_VIRTUAL +#endif +#if defined(WANT_PAGE_VIRTUAL) +#define page_address(page) ((page)->virtual) #define set_page_address(page, address) \ do { \ (page)->virtual = (address); \ } while(0) +#define page_address_init() do { } while(0) +#endif -#else /* CONFIG_HIGHMEM || WANT_PAGE_VIRTUAL */ -#define set_page_address(page, address) do { } while(0) -#endif /* CONFIG_HIGHMEM || WANT_PAGE_VIRTUAL */ - -/* - * Permanent address of a page. Obviously must never be - * called on a highmem page. - */ -#if defined(CONFIG_HIGHMEM) || defined(WANT_PAGE_VIRTUAL) - -#define page_address(page) ((page)->virtual) - -#else /* CONFIG_HIGHMEM || WANT_PAGE_VIRTUAL */ - -#define page_address(page) \ - __va( ( ((page) - page_zone(page)->zone_mem_map) \ - + page_zone(page)->zone_start_pfn) << PAGE_SHIFT) +#if defined(HASHED_PAGE_VIRTUAL) +void *page_address(struct page *page); +void set_page_address(struct page *page, void *virtual); +void page_address_init(void); +#endif -#endif /* CONFIG_HIGHMEM || WANT_PAGE_VIRTUAL */ +#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL) +#define page_address(page) lowmem_page_address(page) +#define set_page_address(page, address) do { } while(0) +#define page_address_init() do { } while(0) +#endif /* * Return true if this page is mapped into pagetables. Subtle: test pte.direct diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index d7d12a69f505..2b83fca9e08d 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -62,7 +62,6 @@ struct zone { spinlock_t lock; unsigned long free_pages; unsigned long pages_min, pages_low, pages_high; - int need_balance; ZONE_PADDING(_pad1_) @@ -120,7 +119,8 @@ struct zone { * rarely used fields: */ char *name; - unsigned long size; + unsigned long spanned_pages; /* total size, including holes */ + unsigned long present_pages; /* amount of memory (excluding holes) */ } ____cacheline_maxaligned_in_smp; #define ZONE_DMA 0 diff --git a/include/linux/nbd.h b/include/linux/nbd.h index 8e4b8c236e8b..b20c045dbb79 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h @@ -79,7 +79,7 @@ struct nbd_device { spinlock_t queue_lock; struct list_head queue_head; /* Requests are added here... */ struct semaphore tx_lock; - struct gendisk disk; + struct gendisk *disk; }; #endif diff --git a/include/linux/pci.h b/include/linux/pci.h index ba2e997304fd..9c12d53f9dc7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -322,15 +322,6 @@ enum pci_mmap_state { #define PCI_ANY_ID (~0) -#define pci_present pcibios_present - - -#define pci_for_each_dev_reverse(dev) \ - for(dev = pci_dev_g(pci_devices.prev); dev != pci_dev_g(&pci_devices); dev = pci_dev_g(dev->global_list.prev)) - -#define pci_for_each_bus(bus) \ -for(bus = pci_bus_b(pci_root_buses.next); bus != pci_bus_b(&pci_root_buses); bus = pci_bus_b(bus->node.next)) - /* * The pci_dev structure is used to describe both PCI and ISAPnP devices. */ @@ -503,8 +494,17 @@ struct pci_driver { /* these external functions are only available when PCI support is enabled */ #ifdef CONFIG_PCI +static inline int pci_present(void) +{ + return !list_empty(&pci_devices); +} + #define pci_for_each_dev(dev) \ for(dev = pci_dev_g(pci_devices.next); dev != pci_dev_g(&pci_devices); dev = pci_dev_g(dev->global_list.next)) +#define pci_for_each_dev_reverse(dev) \ + for(dev = pci_dev_g(pci_devices.prev); dev != pci_dev_g(&pci_devices); dev = pci_dev_g(dev->global_list.prev)) +#define pci_for_each_bus(bus) \ + for(bus = pci_bus_b(pci_root_buses.next); bus != pci_bus_b(&pci_root_buses); bus = pci_bus_b(bus->node.next)) void pcibios_fixup_bus(struct pci_bus *); int pcibios_enable_device(struct pci_dev *, int mask); @@ -520,7 +520,6 @@ void pcibios_fixup_pbus_ranges(struct pci_bus *, struct pbus_set_ranges_data *); /* Backward compatibility, don't use in new code! */ -int pcibios_present(void); int pcibios_read_config_byte (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned char *val); int pcibios_read_config_word (unsigned char bus, unsigned char dev_fn, @@ -533,10 +532,6 @@ int pcibios_write_config_word (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned short val); int pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned int val); -int pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *dev_fn); -int pcibios_find_device (unsigned short vendor, unsigned short dev_id, - unsigned short index, unsigned char *bus, - unsigned char *dev_fn); /* Generic PCI functions used internally */ @@ -660,9 +655,7 @@ void pci_pool_free (struct pci_pool *pool, void *vaddr, dma_addr_t addr); */ #ifndef CONFIG_PCI -static inline int pcibios_present(void) { return 0; } -static inline int pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *dev_fn) -{ return PCIBIOS_DEVICE_NOT_FOUND; } +static inline int pci_present(void) { return 0; } #define _PCI_NOP(o,s,t) \ static inline int pcibios_##o##_config_##s (u8 bus, u8 dfn, u8 where, t val) \ diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index be4d21956fc5..a652bbf6682d 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -288,6 +288,12 @@ #define PCI_DEVICE_ID_NS_87560_USB 0x0012 #define PCI_DEVICE_ID_NS_83815 0x0020 #define PCI_DEVICE_ID_NS_83820 0x0022 +#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 +#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 +#define PCI_DEVICE_ID_NS_SCx200_IDE 0x0502 +#define PCI_DEVICE_ID_NS_SCx200_AUDIO 0x0503 +#define PCI_DEVICE_ID_NS_SCx200_VIDEO 0x0504 +#define PCI_DEVICE_ID_NS_SCx200_XBUS 0x0505 #define PCI_DEVICE_ID_NS_87410 0xd001 #define PCI_VENDOR_ID_TSENG 0x100c diff --git a/include/linux/scx200.h b/include/linux/scx200.h new file mode 100644 index 000000000000..af7d53acad99 --- /dev/null +++ b/include/linux/scx200.h @@ -0,0 +1,56 @@ +/* linux/include/linux/scx200.h + + Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> + + Defines for the National Semiconductor SCx200 Processors +*/ + +/* Interesting stuff for the National Semiconductor SCx200 CPU */ + +/* F0 PCI Header/Bridge Configuration Registers */ +#define SCx200_DOCCS_BASE 0x78 /* DOCCS Base Address Register */ +#define SCx200_DOCCS_CTRL 0x7c /* DOCCS Control Register */ + +/* GPIO Register Block */ +#define SCx200_GPIO_SIZE 0x2c /* Size of GPIO register block */ + +/* General Configuration Block */ +#define SCx200_CB_BASE 0x9000 /* Base fixed at 0x9000 according to errata */ + +/* Watchdog Timer */ +#define SCx200_WDT_OFFSET 0x00 /* offset within configuration block */ +#define SCx200_WDT_SIZE 0x05 /* size */ + +#define SCx200_WDT_WDTO 0x00 /* Time-Out Register */ +#define SCx200_WDT_WDCNFG 0x02 /* Configuration Register */ +#define SCx200_WDT_WDSTS 0x04 /* Status Register */ +#define SCx200_WDT_WDSTS_WDOVF (1<<0) /* Overflow bit */ + +/* High Resolution Timer */ +#define SCx200_TIMER_OFFSET 0x08 +#define SCx200_TIMER_SIZE 0x05 + +/* Clock Generators */ +#define SCx200_CLOCKGEN_OFFSET 0x10 +#define SCx200_CLOCKGEN_SIZE 0x10 + +/* Pin Multiplexing and Miscellaneous Configuration Registers */ +#define SCx200_MISC_OFFSET 0x30 +#define SCx200_MISC_SIZE 0x10 + +#define SCx200_PMR 0x30 /* Pin Multiplexing Register */ +#define SCx200_MCR 0x34 /* Miscellaneous Configuration Register */ +#define SCx200_INTSEL 0x38 /* Interrupt Selection Register */ +#define SCx200_IID 0x3c /* IA On a Chip Identification Number Reg */ +#define SCx200_REV 0x3d /* Revision Register */ +#define SCx200_CBA 0x3e /* Configuration Base Address Register */ + +/* Verify that the configuration block really is there */ +#define scx200_cb_probe(base) (inw((base) + SCx200_CBA) == (base)) + +/* + Local variables: + compile-command: "make -C ../.. bzImage modules" + c-basic-offset: 8 + End: +*/ diff --git a/include/linux/scx200_gpio.h b/include/linux/scx200_gpio.h new file mode 100644 index 000000000000..2c6d739706b6 --- /dev/null +++ b/include/linux/scx200_gpio.h @@ -0,0 +1,98 @@ +#include <linux/spinlock.h> + +u32 scx200_gpio_configure(int index, u32 set, u32 clear); +void scx200_gpio_dump(unsigned index); + +extern unsigned scx200_gpio_base; +extern spinlock_t scx200_gpio_lock; +extern long scx200_gpio_shadow[2]; + +#define scx200_gpio_present() (scx200_gpio_base!=0) + +/* Definitions to make sure I do the same thing in all functions */ +#define __SCx200_GPIO_BANK unsigned bank = index>>5 +#define __SCx200_GPIO_IOADDR unsigned short ioaddr = scx200_gpio_base+0x10*bank +#define __SCx200_GPIO_SHADOW long *shadow = scx200_gpio_shadow+bank +#define __SCx200_GPIO_INDEX index &= 31 + +#define __SCx200_GPIO_OUT __asm__ __volatile__("outsl":"=mS" (shadow):"d" (ioaddr), "0" (shadow)) + +/* returns the value of the GPIO pin */ + +static inline int scx200_gpio_get(int index) { + __SCx200_GPIO_BANK; + __SCx200_GPIO_IOADDR + 0x04; + __SCx200_GPIO_INDEX; + + return (inl(ioaddr) & (1<<index)) ? 1 : 0; +} + +/* return the value driven on the GPIO signal (the value that will be + driven if the GPIO is configured as an output, it might not be the + state of the GPIO right now if the GPIO is configured as an input) */ + +static inline int scx200_gpio_current(int index) { + __SCx200_GPIO_BANK; + __SCx200_GPIO_INDEX; + + return (scx200_gpio_shadow[bank] & (1<<index)) ? 1 : 0; +} + +/* drive the GPIO signal high */ + +static inline void scx200_gpio_set_high(int index) { + __SCx200_GPIO_BANK; + __SCx200_GPIO_IOADDR; + __SCx200_GPIO_SHADOW; + __SCx200_GPIO_INDEX; + set_bit(index, shadow); + __SCx200_GPIO_OUT; +} + +/* drive the GPIO signal low */ + +static inline void scx200_gpio_set_low(int index) { + __SCx200_GPIO_BANK; + __SCx200_GPIO_IOADDR; + __SCx200_GPIO_SHADOW; + __SCx200_GPIO_INDEX; + clear_bit(index, shadow); + __SCx200_GPIO_OUT; +} + +/* drive the GPIO signal to state */ + +static inline void scx200_gpio_set(int index, int state) { + __SCx200_GPIO_BANK; + __SCx200_GPIO_IOADDR; + __SCx200_GPIO_SHADOW; + __SCx200_GPIO_INDEX; + if (state) + set_bit(index, shadow); + else + clear_bit(index, shadow); + __SCx200_GPIO_OUT; +} + +/* toggle the GPIO signal */ +static inline void scx200_gpio_change(int index) { + __SCx200_GPIO_BANK; + __SCx200_GPIO_IOADDR; + __SCx200_GPIO_SHADOW; + __SCx200_GPIO_INDEX; + change_bit(index, shadow); + __SCx200_GPIO_OUT; +} + +#undef __SCx200_GPIO_BANK +#undef __SCx200_GPIO_IOADDR +#undef __SCx200_GPIO_SHADOW +#undef __SCx200_GPIO_INDEX +#undef __SCx200_GPIO_OUT + +/* + Local variables: + compile-command: "make -C ../.. bzImage modules" + c-basic-offset: 8 + End: +*/ diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 8cf9eccab7c1..c38330747ee1 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -168,6 +168,8 @@ struct uart_port { #define UPF_BUGGY_UART (1 << 14) #define UPF_AUTOPROBE (1 << 15) #define UPF_BOOT_AUTOCONF (1 << 28) +#define UPF_RESOURCES (1 << 30) +#define UPF_IOREMAP (1 << 31) #define UPF_FLAGS (0x7fff) #define UPF_USR_MASK (UPF_SPD_MASK|UPF_LOW_LATENCY) diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index baa076bc2cbb..fd561cca76db 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -50,6 +50,7 @@ #define BTPROTO_HCI 1 #define BTPROTO_SCO 2 #define BTPROTO_RFCOMM 3 +#define BTPROTO_BNEP 4 #define SOL_HCI 0 #define SOL_L2CAP 6 @@ -199,14 +200,4 @@ int hci_sock_cleanup(void); int bterr(__u16 code); -#ifndef MODULE_LICENSE -#define MODULE_LICENSE(x) -#endif - -#ifndef list_for_each_safe -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) -#endif - #endif /* __BLUETOOTH_H */ diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 3fa7b3032c88..b58ebef5397b 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -113,10 +113,10 @@ enum { #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) /* ACL flags */ -#define ACL_CONT 0x0001 -#define ACL_START 0x0002 -#define ACL_ACTIVE_BCAST 0x0010 -#define ACL_PICO_BCAST 0x0020 +#define ACL_CONT 0x01 +#define ACL_START 0x02 +#define ACL_ACTIVE_BCAST 0x04 +#define ACL_PICO_BCAST 0x08 /* Baseband links */ #define SCO_LINK 0x00 @@ -542,7 +542,7 @@ typedef struct { bdaddr_t bdaddr; __u8 role; } __attribute__ ((packed)) evt_role_change; -#define EVT_ROLE_CHANGE_SIZE 1 +#define EVT_ROLE_CHANGE_SIZE 8 #define EVT_PIN_CODE_REQ 0x16 typedef struct { @@ -658,9 +658,15 @@ struct sockaddr_hci { #define HCI_DEV_NONE 0xffff struct hci_filter { - __u32 type_mask; - __u32 event_mask[2]; - __u16 opcode; + unsigned long type_mask; + unsigned long event_mask[2]; + __u16 opcode; +}; + +struct hci_ufilter { + __u32 type_mask; + __u32 event_mask[2]; + __u16 opcode; }; #define HCI_FLT_TYPE_BITS 31 @@ -668,20 +674,6 @@ struct hci_filter { #define HCI_FLT_OGF_BITS 63 #define HCI_FLT_OCF_BITS 127 -#if BITS_PER_LONG == 64 -static inline void hci_set_bit(int nr, void *addr) -{ - *((__u32 *) addr + (nr >> 5)) |= ((__u32) 1 << (nr & 31)); -} -static inline int hci_test_bit(int nr, void *addr) -{ - return *((__u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31)); -} -#else -#define hci_set_bit set_bit -#define hci_test_bit test_bit -#endif - /* Ioctl requests structures */ struct hci_dev_stats { __u32 err_rx; diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 15cca8727616..1740cde1287d 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -149,7 +149,7 @@ struct hci_conn { extern struct hci_proto *hci_proto[]; extern struct list_head hdev_list; -extern spinlock_t hdev_list_lock; +extern rwlock_t hdev_list_lock; /* ----- Inquiry cache ----- */ #define INQUIRY_CACHE_AGE_MAX (HZ*30) // 30 seconds @@ -339,8 +339,8 @@ static inline void hci_sched_tx(struct hci_dev *hdev) /* ----- HCI protocols ----- */ struct hci_proto { char *name; - __u32 id; - __u32 flags; + unsigned int id; + unsigned long flags; void *priv; @@ -450,12 +450,11 @@ struct hci_pinfo { #define HCI_SFLT_MAX_OGF 4 struct hci_sec_filter { - __u32 type_mask; - __u32 event_mask[2]; - __u32 ocf_mask[HCI_SFLT_MAX_OGF + 1][4]; + unsigned long type_mask; + unsigned long event_mask[2]; + unsigned long ocf_mask[HCI_SFLT_MAX_OGF + 1][4]; }; - /* ----- HCI requests ----- */ #define HCI_REQ_DONE 0 #define HCI_REQ_PEND 1 diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h new file mode 100644 index 000000000000..2efca665decf --- /dev/null +++ b/include/net/bluetooth/rfcomm.h @@ -0,0 +1,346 @@ +/* + RFCOMM implementation for Linux Bluetooth stack (BlueZ). + Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> + Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +/* + RPN support - Dirk Husemann <hud@zurich.ibm.com> +*/ + +/* + * $Id: rfcomm.h,v 1.29 2002/10/02 20:26:17 maxk Exp $ + */ + +#ifndef __RFCOMM_H +#define __RFCOMM_H + +#define RFCOMM_PSM 3 + +#define RFCOMM_CONN_TIMEOUT (HZ * 30) +#define RFCOMM_DISC_TIMEOUT (HZ * 20) + +#define RFCOMM_DEFAULT_MTU 127 +#define RFCOMM_DEFAULT_CREDITS 7 + +#define RFCOMM_MAX_L2CAP_MTU 1024 +#define RFCOMM_MAX_CREDITS 40 + +#define RFCOMM_SKB_HEAD_RESERVE 8 +#define RFCOMM_SKB_TAIL_RESERVE 2 +#define RFCOMM_SKB_RESERVE (RFCOMM_SKB_HEAD_RESERVE + RFCOMM_SKB_TAIL_RESERVE) + +#define RFCOMM_SABM 0x2f +#define RFCOMM_DISC 0x43 +#define RFCOMM_UA 0x63 +#define RFCOMM_DM 0x0f +#define RFCOMM_UIH 0xef + +#define RFCOMM_TEST 0x08 +#define RFCOMM_FCON 0x28 +#define RFCOMM_FCOFF 0x18 +#define RFCOMM_MSC 0x38 +#define RFCOMM_RPN 0x24 +#define RFCOMM_RLS 0x14 +#define RFCOMM_PN 0x20 +#define RFCOMM_NSC 0x04 + +#define RFCOMM_V24_FC 0x02 +#define RFCOMM_V24_RTC 0x04 +#define RFCOMM_V24_RTR 0x08 +#define RFCOMM_V24_IC 0x40 +#define RFCOMM_V24_DV 0x80 + +#define RFCOMM_RPN_BR_2400 0x0 +#define RFCOMM_RPN_BR_4800 0x1 +#define RFCOMM_RPN_BR_7200 0x2 +#define RFCOMM_RPN_BR_9600 0x3 +#define RFCOMM_RPN_BR_19200 0x4 +#define RFCOMM_RPN_BR_38400 0x5 +#define RFCOMM_RPN_BR_57600 0x6 +#define RFCOMM_RPN_BR_115200 0x7 +#define RFCOMM_RPN_BR_230400 0x8 + +#define RFCOMM_RPN_DATA_5 0x0 +#define RFCOMM_RPN_DATA_6 0x1 +#define RFCOMM_RPN_DATA_7 0x2 +#define RFCOMM_RPN_DATA_8 0x3 + +#define RFCOMM_RPN_STOP_1 0 +#define RFCOMM_RPN_STOP_15 1 + +#define RFCOMM_RPN_PARITY_NONE 0x0 +#define RFCOMM_RPN_PARITY_ODD 0x4 +#define RFCOMM_RPN_PARITY_EVEN 0x5 +#define RFCOMM_RPN_PARITY_MARK 0x6 +#define RFCOMM_RPN_PARITY_SPACE 0x7 + +#define RFCOMM_RPN_FLOW_NONE 0x00 + +#define RFCOMM_RPN_XON_CHAR 0x11 +#define RFCOMM_RPN_XOFF_CHAR 0x13 + +#define RFCOMM_RPN_PM_BITRATE 0x0001 +#define RFCOMM_RPN_PM_DATA 0x0002 +#define RFCOMM_RPN_PM_STOP 0x0004 +#define RFCOMM_RPN_PM_PARITY 0x0008 +#define RFCOMM_RPN_PM_PARITY_TYPE 0x0010 +#define RFCOMM_RPN_PM_XON 0x0020 +#define RFCOMM_RPN_PM_XOFF 0x0040 +#define RFCOMM_RPN_PM_FLOW 0x3F00 + +#define RFCOMM_RPN_PM_ALL 0x3F7F + +struct rfcomm_hdr { + u8 addr; + u8 ctrl; + u8 len; // Actual size can be 2 bytes +} __attribute__ ((packed)); + +struct rfcomm_cmd { + u8 addr; + u8 ctrl; + u8 len; + u8 fcs; +} __attribute__ ((packed)); + +struct rfcomm_mcc { + u8 type; + u8 len; +} __attribute__ ((packed)); + +struct rfcomm_pn { + u8 dlci; + u8 flow_ctrl; + u8 priority; + u8 ack_timer; + u16 mtu; + u8 max_retrans; + u8 credits; +} __attribute__ ((packed)); + +struct rfcomm_rpn { + u8 dlci; + u8 bit_rate; + u8 line_settings; + u8 flow_ctrl; + u8 xon_char; + u8 xoff_char; + u16 param_mask; +} __attribute__ ((packed)); + +struct rfcomm_msc { + u8 dlci; + u8 v24_sig; +} __attribute__ ((packed)); + +/* ---- Core structures, flags etc ---- */ + +struct rfcomm_session { + struct list_head list; + struct socket *sock; + unsigned long state; + unsigned long flags; + atomic_t refcnt; + int initiator; + + /* Default DLC parameters */ + uint mtu; + uint credits; + + struct list_head dlcs; +}; + +struct rfcomm_dlc { + struct list_head list; + struct rfcomm_session *session; + struct sk_buff_head tx_queue; + struct timer_list timer; + + spinlock_t lock; + unsigned long state; + unsigned long flags; + atomic_t refcnt; + u8 dlci; + u8 addr; + + uint mtu; + u8 v24_sig; + + uint credits; + uint rx_credits; + uint tx_credits; + + void *owner; + + void (*data_ready)(struct rfcomm_dlc *d, struct sk_buff *skb); + void (*state_change)(struct rfcomm_dlc *d, int err); + void (*modem_status)(struct rfcomm_dlc *d, int v24_sig); +}; + +/* DLC and session flags */ +#define RFCOMM_RX_THROTTLED 0 +#define RFCOMM_TX_THROTTLED 1 +#define RFCOMM_MSC_PENDING 2 +#define RFCOMM_TIMED_OUT 3 + +/* Scheduling flags and events */ +#define RFCOMM_SCHED_STATE 0 +#define RFCOMM_SCHED_RX 1 +#define RFCOMM_SCHED_TX 2 +#define RFCOMM_SCHED_TIMEO 3 +#define RFCOMM_SCHED_WAKEUP 31 + +extern struct task_struct *rfcomm_thread; +extern unsigned long rfcomm_event; + +static inline void rfcomm_schedule(uint event) +{ + if (!rfcomm_thread) + return; + + //set_bit(event, &rfcomm_event); + if (!test_and_set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) + wake_up_process(rfcomm_thread); +} + +extern struct semaphore rfcomm_sem; +#define rfcomm_lock() down(&rfcomm_sem); +#define rfcomm_unlock() up(&rfcomm_sem); + +/* ---- RFCOMM DLCs (channels) ---- */ +struct rfcomm_dlc *rfcomm_dlc_alloc(int prio); +void rfcomm_dlc_free(struct rfcomm_dlc *d); +int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel); +int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); +int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); +int rfcomm_dlc_modem_status(struct rfcomm_dlc *d, int v24_sig); + +#define rfcomm_dlc_lock(d) spin_lock(&d->lock) +#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) + +static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d) +{ + atomic_inc(&d->refcnt); +} + +static inline void rfcomm_dlc_put(struct rfcomm_dlc *d) +{ + if (atomic_dec_and_test(&d->refcnt)) + rfcomm_dlc_free(d); +} + +extern void FASTCALL(__rfcomm_dlc_throttle(struct rfcomm_dlc *d)); +extern void FASTCALL(__rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)); + +static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) +{ + if (!test_and_set_bit(RFCOMM_RX_THROTTLED, &d->flags)) + __rfcomm_dlc_throttle(d); +} + +static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) +{ + if (test_and_clear_bit(RFCOMM_RX_THROTTLED, &d->flags)) + __rfcomm_dlc_unthrottle(d); +} + +/* ---- RFCOMM sessions ---- */ +struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state); +struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst); +struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err); +void rfcomm_session_del(struct rfcomm_session *s); +void rfcomm_session_close(struct rfcomm_session *s, int err); + +static inline void rfcomm_session_hold(struct rfcomm_session *s) +{ + atomic_inc(&s->refcnt); +} + +static inline void rfcomm_session_put(struct rfcomm_session *s) +{ + if (atomic_dec_and_test(&s->refcnt)) + rfcomm_session_del(s); +} + +/* ---- RFCOMM chechsum ---- */ +extern u8 rfcomm_crc_table[]; + +/* ---- RFCOMM sockets ---- */ +struct sockaddr_rc { + sa_family_t rc_family; + bdaddr_t rc_bdaddr; + u8 rc_channel; +}; + +#define rfcomm_pi(sk) ((struct rfcomm_pinfo *) &sk->protinfo) + +struct rfcomm_pinfo { + struct rfcomm_dlc *dlc; + u8 channel; +}; + +int rfcomm_init_sockets(void); +void rfcomm_cleanup_sockets(void); + +int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc **d); + +/* ---- RFCOMM TTY ---- */ +#define RFCOMM_MAX_DEV 256 + +#define RFCOMMCREATEDEV _IOW('R', 200, int) +#define RFCOMMRELEASEDEV _IOW('R', 201, int) +#define RFCOMMGETDEVLIST _IOR('R', 210, int) +#define RFCOMMGETDEVINFO _IOR('R', 211, int) +#define RFCOMMSTEALDLC _IOW('R', 220, int) + +#define RFCOMM_REUSE_DLC 0 +#define RFCOMM_RELEASE_ONHUP 1 +#define RFCOMM_HANGUP_NOW 2 +#define RFCOMM_TTY_ATTACHED 3 + +struct rfcomm_dev_req { + s16 dev_id; + u32 flags; + bdaddr_t src; + bdaddr_t dst; + u8 channel; + +}; + +struct rfcomm_dev_info { + s16 id; + u32 flags; + u16 state; + bdaddr_t src; + bdaddr_t dst; + u8 channel; +}; + +struct rfcomm_dev_list_req { + u16 dev_num; + struct rfcomm_dev_info dev_info[0]; +}; + +int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg); +int rfcomm_init_ttys(void); +void rfcomm_cleanup_ttys(void); + +#endif /* __RFCOMM_H */ diff --git a/include/sound/version.h b/include/sound/version.h index bafde4fbc070..ba48af7a3099 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated automatically by configure. */ #define CONFIG_SND_VERSION "0.9.0rc3" -#define CONFIG_SND_DATE " (Tue Oct 01 14:40:23 2002 UTC)" +#define CONFIG_SND_DATE " (Fri Oct 04 13:09:13 2002 UTC)" diff --git a/include/video/font.h b/include/video/font.h index 01d3c87d4309..007d97f9b3ef 100644 --- a/include/video/font.h +++ b/include/video/font.h @@ -28,6 +28,7 @@ struct fbcon_font_desc { #define SUN8x16_IDX 4 #define SUN12x22_IDX 5 #define ACORN8x8_IDX 6 +#define MINI4x6_IDX 7 extern struct fbcon_font_desc font_vga_8x8, font_vga_8x16, @@ -35,7 +36,8 @@ extern struct fbcon_font_desc font_vga_8x8, font_vga_6x11, font_sun_8x16, font_sun_12x22, - font_acorn_8x8; + font_acorn_8x8, + font_mini_4x6; /* Find a font with a specific name */ |
