diff options
Diffstat (limited to 'include/asm-sparc')
-rw-r--r-- | include/asm-sparc/atomic.h | 13 | ||||
-rw-r--r-- | include/asm-sparc/audioio.h | 1 | ||||
-rw-r--r-- | include/asm-sparc/bitops.h | 5 | ||||
-rw-r--r-- | include/asm-sparc/fcntl.h | 9 | ||||
-rw-r--r-- | include/asm-sparc/floppy.h | 2 | ||||
-rw-r--r-- | include/asm-sparc/hardirq.h | 76 | ||||
-rw-r--r-- | include/asm-sparc/io.h | 6 | ||||
-rw-r--r-- | include/asm-sparc/irq.h | 14 | ||||
-rw-r--r-- | include/asm-sparc/oplib.h | 6 | ||||
-rw-r--r-- | include/asm-sparc/resource.h | 4 | ||||
-rw-r--r-- | include/asm-sparc/smp.h | 6 | ||||
-rw-r--r-- | include/asm-sparc/system.h | 5 | ||||
-rw-r--r-- | include/asm-sparc/uaccess.h | 37 |
13 files changed, 77 insertions, 107 deletions
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h index dc29a13cd..4a55a8929 100644 --- a/include/asm-sparc/atomic.h +++ b/include/asm-sparc/atomic.h @@ -8,21 +8,12 @@ #include <linux/config.h> -#ifdef CONFIG_SMP -/* This is a temporary measure. -DaveM */ typedef struct { volatile int counter; } atomic_t; -#define ATOMIC_INIT(i) { (i << 8) } -#else -typedef struct { int counter; } atomic_t; -#define ATOMIC_INIT(i) { (i) } -#endif #ifdef __KERNEL__ -#include <asm/system.h> -#include <asm/psr.h> - #ifndef CONFIG_SMP +#define ATOMIC_INIT(i) { (i) } #define atomic_read(v) ((v)->counter) #define atomic_set(v, i) (((v)->counter) = i) @@ -41,6 +32,8 @@ typedef struct { int counter; } atomic_t; * 31 8 7 0 */ +#define ATOMIC_INIT(i) { (i << 8) } + static __inline__ int atomic_read(atomic_t *v) { int ret = v->counter; diff --git a/include/asm-sparc/audioio.h b/include/asm-sparc/audioio.h index fc5458949..ed50485d2 100644 --- a/include/asm-sparc/audioio.h +++ b/include/asm-sparc/audioio.h @@ -431,6 +431,7 @@ extern void sparcaudio_input_done(struct sparcaudio_driver *, int); extern int sparcaudio_init(void); extern int amd7930_init(void); extern int cs4231_init(void); +extern int dbri_init(void); #endif diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h index 8ab8bdaf0..b10853490 100644 --- a/include/asm-sparc/bitops.h +++ b/include/asm-sparc/bitops.h @@ -1,4 +1,4 @@ -/* $Id: bitops.h,v 1.60 2000/08/10 23:49:16 davem Exp $ +/* $Id: bitops.h,v 1.61 2000/09/23 02:11:22 davem Exp $ * bitops.h: Bit string operations on the Sparc. * * Copyright 1995 David S. Miller (davem@caip.rutgers.edu) @@ -156,6 +156,9 @@ extern __inline__ void change_bit(unsigned long nr, volatile void *addr) #endif /* __KERNEL__ */ +#define smp_mb__before_clear_bit() do { } while(0) +#define smp_mb__after_clear_bit() do { } while(0) + /* The following routine need not be atomic. */ extern __inline__ int test_bit(int nr, __const__ void *addr) { diff --git a/include/asm-sparc/fcntl.h b/include/asm-sparc/fcntl.h index 344765930..d481e7b27 100644 --- a/include/asm-sparc/fcntl.h +++ b/include/asm-sparc/fcntl.h @@ -50,6 +50,9 @@ #define F_EXLCK 4 /* or 3 */ #define F_SHLCK 8 /* or 4 */ +/* for leases */ +#define F_INPROGRESS 16 + /* operations for bsd flock(), also used by the kernel implementation */ #define LOCK_SH 1 /* shared lock */ #define LOCK_EX 2 /* exclusive lock */ @@ -57,6 +60,11 @@ blocking */ #define LOCK_UN 8 /* remove lock */ +#define LOCK_MAND 32 /* This is a mandatory flock */ +#define LOCK_READ 64 /* ... Which allows concurrent read operations */ +#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ +#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ + struct flock { short l_type; short l_whence; @@ -75,4 +83,5 @@ struct flock64 { short __unused; }; +#define F_LINUX_SPECIFIC_BASE 1024 #endif diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h index 0c54061f9..5a8422926 100644 --- a/include/asm-sparc/floppy.h +++ b/include/asm-sparc/floppy.h @@ -21,7 +21,7 @@ #undef request_region #define release_region(X, Y) do { } while(0) #define check_region(X, Y) (0) -#define request_region(X, Y, Z) do { } while(0) +#define request_region(X, Y, Z) (1) /* References: * 1) Netbsd Sun floppy driver. diff --git a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h index cfee071dc..00205d6ef 100644 --- a/include/asm-sparc/hardirq.h +++ b/include/asm-sparc/hardirq.h @@ -1,7 +1,7 @@ /* hardirq.h: 32-bit Sparc hard IRQ support. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1998-99 Anton Blanchard (anton@progsoc.uts.edu.au) + * Copyright (C) 1998-2000 Anton Blanchard (anton@linuxcare.com) */ #ifndef __SPARC_HARDIRQ_H @@ -9,77 +9,83 @@ #include <linux/config.h> #include <linux/threads.h> +#include <linux/brlock.h> +#include <linux/spinlock.h> /* entry.S is sensitive to the offsets of these fields */ typedef struct { unsigned int __softirq_active; unsigned int __softirq_mask; +#ifndef CONFIG_SMP unsigned int __local_irq_count; +#else + unsigned int __unused_on_SMP; /* DaveM says use brlock for SMP irq. KAO */ +#endif unsigned int __local_bh_count; unsigned int __syscall_count; } ____cacheline_aligned irq_cpustat_t; #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ +/* Note that local_irq_count() is replaced by sparc64 specific version for SMP */ + +#ifndef CONFIG_SMP +#define irq_enter(cpu, irq) ((void)(irq), local_irq_count(cpu)++) +#define irq_exit(cpu, irq) ((void)(irq), local_irq_count(cpu)--) +#else +#undef local_irq_count +#define local_irq_count(cpu) (__brlock_array[cpu][BR_GLOBALIRQ_LOCK]) +#define irq_enter(cpu, irq) br_read_lock(BR_GLOBALIRQ_LOCK) +#define irq_exit(cpu, irq) br_read_unlock(BR_GLOBALIRQ_LOCK) +#endif /* * Are we in an interrupt context? Either doing bottom half * or hardware interrupt processing? */ -#define in_interrupt() ({ int __cpu = smp_processor_id(); \ - (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); }) +#define in_interrupt() ((local_irq_count(smp_processor_id()) + \ + local_bh_count(smp_processor_id())) != 0) -#define in_irq() ({ int __cpu = smp_processor_id(); \ - (local_irq_count(__cpu) != 0); }) +/* This tests only the local processors hw IRQ context disposition. */ +#define in_irq() (local_irq_count(smp_processor_id()) != 0) #ifndef CONFIG_SMP -#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) -#define hardirq_endlock(cpu) do { (void)(cpu); } while (0) - -#define hardirq_enter(cpu) (++local_irq_count(cpu)) -#define hardirq_exit(cpu) (--local_irq_count(cpu)) +#define hardirq_trylock(cpu) ((void)(cpu), local_irq_count(smp_processor_id()) == 0) +#define hardirq_endlock(cpu) do { (void)(cpu); } while(0) #define synchronize_irq() barrier() -#else +#else /* (CONFIG_SMP) */ -#include <asm/atomic.h> -#include <linux/spinlock.h> -#include <asm/system.h> -#include <asm/smp.h> +static __inline__ int irqs_running(void) +{ + int i; + + for (i = 0; i < smp_num_cpus; i++) + if (local_irq_count(cpu_logical_map(i))) + return 1; + return 0; +} extern unsigned char global_irq_holder; -extern spinlock_t global_irq_lock; -extern atomic_t global_irq_count; static inline void release_irqlock(int cpu) { - /* if we didn't own the irq lock, just ignore.. */ - if (global_irq_holder == (unsigned char) cpu) { + /* if we didn't own the irq lock, just ignore... */ + if(global_irq_holder == (unsigned char) cpu) { global_irq_holder = NO_PROC_ID; - spin_unlock(&global_irq_lock); + br_write_unlock(BR_GLOBALIRQ_LOCK); } } -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); -} - static inline int hardirq_trylock(int cpu) { - return (! atomic_read(&global_irq_count) && - ! spin_is_locked (&global_irq_lock)); + spinlock_t *lock = &__br_write_locks[BR_GLOBALIRQ_LOCK].lock; + + return (!local_irq_count(cpu) && !spin_is_locked(lock)); } -#define hardirq_endlock(cpu) do { } while (0) +#define hardirq_endlock(cpu) do { (void)(cpu); } while (0) extern void synchronize_irq(void); diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h index a32ce08fe..7c9bfa8e9 100644 --- a/include/asm-sparc/io.h +++ b/include/asm-sparc/io.h @@ -1,5 +1,5 @@ /* - * $Id: io.h,v 1.27 2000/04/13 04:45:59 davem Exp $ + * $Id: io.h,v 1.28 2000/09/17 05:12:00 davem Exp $ */ #ifndef __SPARC_IO_H #define __SPARC_IO_H @@ -164,6 +164,8 @@ static inline void *sbus_memset_io(void *__dst, int c, __kernel_size_t n) return (void *) dst; } +#ifdef __KERNEL__ + /* * Bus number may be embedded in the higher bits of the physical address. * This is why we have no bus number argument to ioremap(). @@ -200,4 +202,6 @@ extern void sbus_iounmap(unsigned long vaddr, unsigned long size); #define dma_cache_wback(_start,_size) do { } while (0) #define dma_cache_wback_inv(_start,_size) do { } while (0) +#endif + #endif /* !(__SPARC_IO_H) */ diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h index a58a80810..6008023a5 100644 --- a/include/asm-sparc/irq.h +++ b/include/asm-sparc/irq.h @@ -1,4 +1,4 @@ -/* $Id: irq.h,v 1.31 2000/08/05 10:48:41 davem Exp $ +/* $Id: irq.h,v 1.32 2000/08/26 02:42:28 anton Exp $ * irq.h: IRQ registers on the Sparc. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -21,18 +21,6 @@ BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int) #define NR_IRQS 15 -/* IRQ handler dispatch entry and exit. */ -#ifdef CONFIG_SMP -#define irq_enter(cpu, irq) \ -do { hardirq_enter(cpu); \ - spin_unlock_wait(&global_irq_lock); \ - } while(0) -#define irq_exit(cpu, irq) hardirq_exit(cpu) -#else -#define irq_enter(cpu, irq) (++local_irq_count(cpu)) -#define irq_exit(cpu, irq) (--local_irq_count(cpu)) -#endif - /* Dave Redman (djhr@tadpole.co.uk) * changed these to function pointers.. it saves cycles and will allow * the irq dependencies to be split into different files at a later date diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h index 396f9ef07..4e2e60157 100644 --- a/include/asm-sparc/oplib.h +++ b/include/asm-sparc/oplib.h @@ -1,4 +1,4 @@ -/* $Id: oplib.h,v 1.20 1998/09/17 11:05:25 jj Exp $ +/* $Id: oplib.h,v 1.21 2000/08/26 02:38:04 anton Exp $ * oplib.h: Describes the interface and available routines in the * Linux Prom library. * @@ -9,6 +9,7 @@ #define __SPARC_OPLIB_H #include <asm/openprom.h> +#include <linux/spinlock.h> /* The master romvec pointer... */ extern struct linux_romvec *romvec; @@ -311,6 +312,7 @@ extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nr /* Apply ranges of any prom node (and optionally parent node as well) to registers. */ extern void prom_apply_generic_ranges(int node, int parent, struct linux_prom_registers *sbusregs, int nregs); - + +extern spinlock_t prom_lock; #endif /* !(__SPARC_OPLIB_H) */ diff --git a/include/asm-sparc/resource.h b/include/asm-sparc/resource.h index 5b654cdf9..24cca3ba1 100644 --- a/include/asm-sparc/resource.h +++ b/include/asm-sparc/resource.h @@ -21,8 +21,9 @@ #define RLIMIT_NPROC 7 /* max number of processes */ #define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ #define RLIMIT_AS 9 /* address space limit */ +#define RLIMIT_LOCKS 10 /* maximum file locks held */ -#define RLIM_NLIMITS 10 +#define RLIM_NLIMITS 11 /* * SuS says limits have to be unsigned. @@ -42,6 +43,7 @@ {RLIM_INFINITY, RLIM_INFINITY}, \ {INR_OPEN, INR_OPEN}, {0, 0}, \ {RLIM_INFINITY, RLIM_INFINITY}, \ + {RLIM_INFINITY, RLIM_INFINITY}, \ {RLIM_INFINITY, RLIM_INFINITY} \ } diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h index f6504165d..5f7040345 100644 --- a/include/asm-sparc/smp.h +++ b/include/asm-sparc/smp.h @@ -93,12 +93,6 @@ extern __inline__ void xc5(smpfunc_t func, unsigned long arg1, unsigned long arg unsigned long arg3, unsigned long arg4, unsigned long arg5) { smp_cross_call(func, arg1, arg2, arg3, arg4, arg5); } -extern __inline__ int smp_call_function(void (*func)(void *info), void *info, int nonatomic, int wait) -{ - xc1((smpfunc_t)func, (unsigned long)info); - return 0; -} - extern __volatile__ int __cpu_number_map[NR_CPUS]; extern __volatile__ int __cpu_logical_map[NR_CPUS]; extern unsigned long smp_proc_in_lock[NR_CPUS]; diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h index 0a101cacd..28b07675f 100644 --- a/include/asm-sparc/system.h +++ b/include/asm-sparc/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.83 2000/08/04 05:35:55 davem Exp $ */ +/* $Id: system.h,v 1.84 2000/09/23 02:11:22 davem Exp $ */ #include <linux/config.h> #ifndef __SPARC_SYSTEM_H @@ -280,6 +280,9 @@ extern void __global_restore_flags(unsigned long flags); #define wmb() mb() #define set_mb(__var, __value) do { __var = __value; mb(); } while(0) #define set_wmb(__var, __value) set_mb(__var, __value) +#define smp_mb() __asm__ __volatile__("":::"memory"); +#define smp_rmb() __asm__ __volatile__("":::"memory"); +#define smp_wmb() __asm__ __volatile__("":::"memory"); #define nop() __asm__ __volatile__ ("nop"); diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h index c026a21fa..1587f92f9 100644 --- a/include/asm-sparc/uaccess.h +++ b/include/asm-sparc/uaccess.h @@ -1,4 +1,4 @@ -/* $Id: uaccess.h,v 1.21 2000/01/08 16:38:23 anton Exp $ +/* $Id: uaccess.h,v 1.22 2000/08/29 07:01:58 davem Exp $ * uaccess.h: User space memore access functions. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -94,27 +94,17 @@ extern void __ret_efault(void); unsigned long __pu_addr = (unsigned long)(ptr); \ __put_user_check((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); }) -#define put_user_ret(x,ptr,retval) ({ \ -unsigned long __pu_addr = (unsigned long)(ptr); \ -__put_user_check_ret((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr)),retval); }) - #define get_user(x,ptr) ({ \ unsigned long __gu_addr = (unsigned long)(ptr); \ __get_user_check((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); }) -#define get_user_ret(x,ptr,retval) ({ \ -unsigned long __gu_addr = (unsigned long)(ptr); \ -__get_user_check_ret((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr)),retval); }) - /* * The "__xxx" versions do not do address space checking, useful when * doing multiple accesses to the same area (the user has to do the * checks by hand with "access_ok()") */ #define __put_user(x,ptr) __put_user_nocheck((x),(ptr),sizeof(*(ptr))) -#define __put_user_ret(x,ptr,retval) __put_user_nocheck_ret((x),(ptr),sizeof(*(ptr)),retval) #define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr)),__typeof__(*(ptr))) -#define __get_user_ret(x,ptr,retval) __get_user_nocheck_ret((x),(ptr),sizeof(*(ptr)),__typeof__(*(ptr)),retval) struct __large_struct { unsigned long buf[100]; }; #define __m(x) ((struct __large_struct *)(x)) @@ -303,20 +293,10 @@ __copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \ } else __copy_res = __copy_size; \ __copy_res; }) -#define copy_to_user_ret(to,from,n,retval) ({ \ -if (copy_to_user(to,from,n)) \ - return retval; \ -}) - #define __copy_to_user(to,from,n) \ __copy_user((void *)(to), \ (void *)(from), n) -#define __copy_to_user_ret(to,from,n,retval) ({ \ -if (__copy_to_user(to,from,n)) \ - return retval; \ -}) - #define copy_from_user(to,from,n) ({ \ void *__copy_to = (void *) (to); \ void *__copy_from = (void *) (from); \ @@ -327,20 +307,10 @@ __copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \ } else __copy_res = __copy_size; \ __copy_res; }) -#define copy_from_user_ret(to,from,n,retval) ({ \ -if (copy_from_user(to,from,n)) \ - return retval; \ -}) - #define __copy_from_user(to,from,n) \ __copy_user((void *)(to), \ (void *)(from), n) -#define __copy_from_user_ret(to,from,n,retval) ({ \ -if (__copy_from_user(to,from,n)) \ - return retval; \ -}) - extern __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size) { __kernel_size_t ret; @@ -368,11 +338,6 @@ __clear_res = __clear_user(__clear_addr, __clear_size); \ } else __clear_res = __clear_size; \ __clear_res; }) -#define clear_user_ret(addr,size,retval) ({ \ -if (clear_user(addr,size)) \ - return retval; \ -}) - extern int __strncpy_from_user(unsigned long dest, unsigned long src, int count); #define strncpy_from_user(dest,src,count) ({ \ |