diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2002-09-13 04:05:50 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-09-13 04:05:50 -0700 |
| commit | d1a75a97b0d3b9bc4e6a95f4e7854e7a7a986976 (patch) | |
| tree | 323f2436f538f9ea43593259529280331b8ee732 /include | |
| parent | 2c66151cbc2cc68465489fdf64d16bd1c6ca4d0e (diff) | |
| parent | 4be8d6018dc67c03d5118a280e27859bd55164d3 (diff) | |
Merge master.kernel.org:/home/davem/BK/sparc-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-sparc/hardirq.h | 8 | ||||
| -rw-r--r-- | include/asm-sparc/highmem.h | 13 | ||||
| -rw-r--r-- | include/asm-sparc/ide.h | 102 | ||||
| -rw-r--r-- | include/asm-sparc/irq.h | 2 | ||||
| -rw-r--r-- | include/asm-sparc/kmap_types.h | 2 | ||||
| -rw-r--r-- | include/asm-sparc/spinlock.h | 2 | ||||
| -rw-r--r-- | include/asm-sparc/system.h | 24 | ||||
| -rw-r--r-- | include/asm-sparc/unistd.h | 2 | ||||
| -rw-r--r-- | include/asm-sparc64/hardirq.h | 2 | ||||
| -rw-r--r-- | include/asm-sparc64/ide.h | 131 | ||||
| -rw-r--r-- | include/asm-sparc64/spinlock.h | 2 | ||||
| -rw-r--r-- | include/asm-sparc64/unistd.h | 2 |
12 files changed, 112 insertions, 180 deletions
diff --git a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h index f77ee7e415cf..8057289e0f3e 100644 --- a/include/asm-sparc/hardirq.h +++ b/include/asm-sparc/hardirq.h @@ -39,8 +39,8 @@ typedef struct { * - ( bit 26 is the PREEMPT_ACTIVE flag. ) * * PREEMPT_MASK: 0x000000ff - * HARDIRQ_MASK: 0x0000ff00 - * SOFTIRQ_MASK: 0x00ff0000 + * SOFTIRQ_MASK: 0x0000ff00 + * HARDIRQ_MASK: 0x00ff0000 */ #define PREEMPT_BITS 8 @@ -90,8 +90,10 @@ typedef struct { #define irq_enter() (preempt_count() += HARDIRQ_OFFSET) #if CONFIG_PREEMPT +# define in_atomic() (preempt_count() != kernel_locked()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else +# define in_atomic() (preempt_count() != 0) # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endif #define irq_exit() \ @@ -121,7 +123,7 @@ do { \ #ifndef CONFIG_SMP -#define synchronize_irq() barrier() +#define synchronize_irq(irq) barrier() #else /* (CONFIG_SMP) */ diff --git a/include/asm-sparc/highmem.h b/include/asm-sparc/highmem.h index 2ba438ea6111..e9bf972142f8 100644 --- a/include/asm-sparc/highmem.h +++ b/include/asm-sparc/highmem.h @@ -148,6 +148,19 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type) dec_preempt_count(); } +static inline struct page *kmap_atomic_to_page(void *ptr) +{ + unsigned long idx, vaddr = (unsigned long)ptr; + pte_t *pte; + + if (vaddr < FIX_KMAP_BEGIN) + return virt_to_page(ptr); + + idx = ((vaddr - FIX_KMAP_BEGIN) >> PAGE_SHIFT); + pte = kmap_pte + idx; + return pte_page(*pte); +} + #endif /* __KERNEL__ */ #endif /* _ASM_HIGHMEM_H */ diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h index b2b585d3ca35..c8a97fd7ef6a 100644 --- a/include/asm-sparc/ide.h +++ b/include/asm-sparc/ide.h @@ -81,92 +81,30 @@ static __inline__ void ide_init_default_hwifs(void) * The following are not needed for the non-m68k ports */ #define ide_ack_intr(hwif) (1) -#define ide_fix_driveid(id) do {} while (0) #define ide_release_lock(lock) do {} while (0) #define ide_get_lock(lock, hdlr, data) do {} while (0) -/* From m68k code... */ - -#ifdef insl -#undef insl -#endif -#ifdef outsl -#undef outsl -#endif -#ifdef insw -#undef insw -#endif -#ifdef outsw -#undef outsw -#endif - -#define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1) -#define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1) - -#define insw(port, buf, nr) ide_insw((port), (buf), (nr)) -#define outsw(port, buf, nr) ide_outsw((port), (buf), (nr)) - -static __inline__ void ide_insw(unsigned long port, - void *dst, - unsigned long count) -{ - volatile unsigned short *data_port; - /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */ - u16 *ps = dst; - u32 *pi; - - data_port = (volatile unsigned short *)port; - - if(((unsigned long)ps) & 0x2) { - *ps++ = *data_port; - count--; - } - pi = (u32 *)ps; - while(count >= 2) { - u32 w; - - w = (*data_port) << 16; - w |= (*data_port); - *pi++ = w; - count -= 2; - } - ps = (u16 *)pi; - if(count) - *ps++ = *data_port; - - /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */ -} - -static __inline__ void ide_outsw(unsigned long port, - const void *src, - unsigned long count) -{ - volatile unsigned short *data_port; - /* unsigned long end = (unsigned long)src + (count << 1); */ - const u16 *ps = src; - const u32 *pi; - - data_port = (volatile unsigned short *)port; - - if(((unsigned long)src) & 0x2) { - *data_port = *ps++; - count--; - } - pi = (const u32 *)ps; - while(count >= 2) { - u32 w; - - w = *pi++; - *data_port = (w >> 16); - *data_port = w; - count -= 2; - } - ps = (const u16 *)pi; - if(count) - *data_port = *ps; +/* XXX Known to be broken. Axboe will fix the problems this + * XXX has by making seperate IN/OUT macros for IDE_DATA + * XXX register and rest of IDE regs and also using + * XXX ide_ioreg_t instead of u32 for ports. -DaveM + */ - /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */ -} +#define HAVE_ARCH_IN_BYTE +#define IN_BYTE(p) (*((volatile u8 *)(p))) +#define IN_WORD(p) (*((volatile u16 *)(p))) +#define IN_LONG(p) (*((volatile u32 *)(p))) +#define IN_BYTE_P IN_BYTE +#define IN_WORD_P IN_WORD +#define IN_LONG_P IN_LONG + +#define HAVE_ARCH_OUT_BYTE +#define OUT_BYTE(b,p) ((*((volatile u8 *)(p))) = (b)) +#define OUT_WORD(w,p) ((*((volatile u16 *)(p))) = (w)) +#define OUT_LONG(l,p) ((*((volatile u32 *)(p))) = (l)) +#define OUT_BYTE_P OUT_BYTE +#define OUT_WORD_P OUT_WORD +#define OUT_LONG_P OUT_LONG #endif /* __KERNEL__ */ diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h index 6008023a5651..0e8693264787 100644 --- a/include/asm-sparc/irq.h +++ b/include/asm-sparc/irq.h @@ -21,6 +21,8 @@ BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int) #define NR_IRQS 15 +#define irq_cannonicalize(irq) (irq) + /* 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/kmap_types.h b/include/asm-sparc/kmap_types.h index c5bb34018e95..82431edeb2a1 100644 --- a/include/asm-sparc/kmap_types.h +++ b/include/asm-sparc/kmap_types.h @@ -11,6 +11,8 @@ enum km_type { KM_BIO_DST_IRQ, KM_PTE0, KM_PTE1, + KM_IRQ0, + KM_IRQ1, KM_TYPE_NR }; diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h index ae9016d0d7f4..99ee46411786 100644 --- a/include/asm-sparc/spinlock.h +++ b/include/asm-sparc/spinlock.h @@ -42,6 +42,7 @@ typedef struct _rwlock_debug rwlock_t; #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, {0} } #define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0) +#define rwlock_is_locked(lp) ((lp)->lock != 0) extern void _do_read_lock(rwlock_t *rw, char *str); extern void _do_read_unlock(rwlock_t *rw, char *str); @@ -141,6 +142,7 @@ typedef struct { volatile unsigned int lock; } rwlock_t; #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } #define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0) +#define rwlock_is_locked(lp) ((lp)->lock != 0) /* Sort of like atomic_t's on Sparc, but even more clever. diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h index b9599127fad1..07e3a99188a2 100644 --- a/include/asm-sparc/system.h +++ b/include/asm-sparc/system.h @@ -56,6 +56,17 @@ extern unsigned long empty_zero_page; extern struct linux_romvec *romvec; #define halt() romvec->pv_halt() +extern void sun_do_break(void); +extern int serial_console; +extern int stop_a_enabled; + +static __inline__ int con_is_present(void) +{ + return serial_console ? 0 : 1; +} + +extern struct pt_regs *kbd_pt_regs; + /* When a context switch happens we must flush all user windows so that * the windows of the current process are flushed onto its stack. This * way the windows are all clean for the next process and the stack @@ -113,6 +124,7 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, "restore; restore; restore; restore; restore; restore; restore"); \ } while(0) #define finish_arch_switch(rq, next) do{ }while(0) +#define task_running(rq, p) ((rq)->curr == (p)) /* Much care has gone into this code, do not touch it. * @@ -263,6 +275,15 @@ extern __inline__ unsigned long read_psr_and_cli(void) #define local_irq_save(flags) ((flags) = read_psr_and_cli()) #define local_irq_restore(flags) setipl((flags)) +/* On sparc32 IRQ flags are the PSR register in the PSR_PIL + * field. + */ +#define irqs_disabled() \ +({ unsigned long flags; \ + local_save_flags(flags);\ + (flags & PSR_PIL) != 0; \ +}) + #ifdef CONFIG_SMP extern unsigned char global_irq_holder; @@ -282,9 +303,6 @@ extern void __global_restore_flags(unsigned long flags); #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 save_and_cli(x) local_irq_save(x) #endif diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h index e89bb817c80f..5d3ba06ceb4c 100644 --- a/include/asm-sparc/unistd.h +++ b/include/asm-sparc/unistd.h @@ -203,7 +203,7 @@ #define __NR_setpgid 185 /* Common */ #define __NR_fremovexattr 186 /* SunOS: pathconf */ #define __NR_tkill 187 /* SunOS: fpathconf */ -/* #define __NR_sysconf 188 SunOS Specific */ +#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */ #define __NR_uname 189 /* Linux Specific */ #define __NR_init_module 190 /* Linux Specific */ #define __NR_personality 191 /* Linux Specific */ diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h index 88e27b030c6d..6b6e67e52372 100644 --- a/include/asm-sparc64/hardirq.h +++ b/include/asm-sparc64/hardirq.h @@ -85,8 +85,10 @@ typedef struct { #define irq_enter() (preempt_count() += HARDIRQ_OFFSET) #if CONFIG_PREEMPT +# define in_atomic() (preempt_count() != kernel_locked()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else +# define in_atomic() (preempt_count() != 0) # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endif #define irq_exit() \ diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h index fd1d19740f4b..8adfd4967c1c 100644 --- a/include/asm-sparc64/ide.h +++ b/include/asm-sparc64/ide.h @@ -78,112 +78,63 @@ static __inline__ void ide_init_default_hwifs(void) * The following are not needed for the non-m68k ports */ #define ide_ack_intr(hwif) (1) -#define ide_fix_driveid(id) do {} while (0) #define ide_release_lock(lock) do {} while (0) #define ide_get_lock(lock, hdlr, data) do {} while (0) -/* From m68k code... */ - -#ifdef insl -#undef insl -#endif -#ifdef outsl -#undef outsl -#endif -#ifdef insw -#undef insw -#endif -#ifdef outsw -#undef outsw -#endif - -#define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1) -#define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1) - -#define insw(port, buf, nr) ide_insw((port), (buf), (nr)) -#define outsw(port, buf, nr) ide_outsw((port), (buf), (nr)) - -static __inline__ unsigned int inw_be(unsigned long addr) -{ - unsigned int ret; +/* XXX Known to be broken. Axboe will fix the problems this + * XXX has by making seperate IN/OUT macros for IDE_DATA + * XXX register and rest of IDE regs and also using + * XXX ide_ioreg_t instead of u32 for ports. -DaveM + */ - __asm__ __volatile__("lduha [%1] %2, %0" +#define HAVE_ARCH_IN_BYTE +static __inline__ u8 IN_BYTE(ide_ioreg_t addr) +{ u8 ret; + __asm__ __volatile__("lduba [%1] %2, %0\t/* ide_in_byte */" : "=r" (ret) : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); - return ret; } +static __inline__ u16 IN_WORD(ide_ioreg_t addr) +{ u16 ret; + __asm__ __volatile__("lduha [%1] %2, %0\t/* ide_in_word */" + : "=r" (ret) + : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); + return ret; +} +static __inline__ u16 IN_LONG(ide_ioreg_t addr) +{ u32 ret; + __asm__ __volatile__("lduwa [%1] %2, %0\t/* ide_in_long */" + : "=r" (ret) + : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); + return ret; +} +#define IN_BYTE_P IN_BYTE +#define IN_WORD_P IN_WORD +#define IN_LONG_P IN_LONG -static __inline__ void ide_insw(unsigned long port, - void *dst, - unsigned long count) +#define HAVE_ARCH_OUT_BYTE +static __inline__ void OUT_BYTE(u8 byte, ide_ioreg_t addr) { -#if (L1DCACHE_SIZE > PAGE_SIZE) /* is there D$ aliasing problem */ - unsigned long end = (unsigned long)dst + (count << 1); -#endif - u16 *ps = dst; - u32 *pi; - - if(((u64)ps) & 0x2) { - *ps++ = inw_be(port); - count--; - } - pi = (u32 *)ps; - while(count >= 2) { - u32 w; - - w = inw_be(port) << 16; - w |= inw_be(port); - *pi++ = w; - count -= 2; - } - ps = (u16 *)pi; - if(count) - *ps++ = inw_be(port); - -#if (L1DCACHE_SIZE > PAGE_SIZE) /* is there D$ aliasing problem */ - __flush_dcache_range((unsigned long)dst, end); -#endif + __asm__ __volatile__("stba %r0, [%1] %2\t/* ide_out_byte */" + : /* no outputs */ + : "Jr" (byte), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } - -static __inline__ void outw_be(unsigned short w, unsigned long addr) +static __inline__ void OUT_WORD(u16 word, ide_ioreg_t addr) { - __asm__ __volatile__("stha %0, [%1] %2" + __asm__ __volatile__("stha %r0, [%1] %2\t/* ide_out_word */" : /* no outputs */ - : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); + : "Jr" (word), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } - -static __inline__ void ide_outsw(unsigned long port, - const void *src, - unsigned long count) +static __inline__ void OUT_LONG(u32 _long, ide_ioreg_t addr) { -#if (L1DCACHE_SIZE > PAGE_SIZE) /* is there D$ aliasing problem */ - unsigned long end = (unsigned long)src + (count << 1); -#endif - const u16 *ps = src; - const u32 *pi; - - if(((u64)src) & 0x2) { - outw_be(*ps++, port); - count--; - } - pi = (const u32 *)ps; - while(count >= 2) { - u32 w; - - w = *pi++; - outw_be((w >> 16), port); - outw_be(w, port); - count -= 2; - } - ps = (const u16 *)pi; - if(count) - outw_be(*ps, port); - -#if (L1DCACHE_SIZE > PAGE_SIZE) /* is there D$ aliasing problem */ - __flush_dcache_range((unsigned long)src, end); -#endif + __asm__ __volatile__("stwa %r0, [%1] %2\t/* ide_out_long */" + : /* no outputs */ + : "Jr" (_long), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } +#define OUT_BYTE_P OUT_BYTE +#define OUT_WORD_P OUT_WORD +#define OUT_LONG_P OUT_LONG #endif /* __KERNEL__ */ diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index 34c221d282a1..48c93f17bb4f 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h @@ -112,6 +112,7 @@ extern int _spin_trylock (spinlock_t *lock); typedef unsigned int rwlock_t; #define RW_LOCK_UNLOCKED 0 #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) +#define rwlock_is_locked(x) (*(x) != RW_LOCK_UNLOCKED) extern void __read_lock(rwlock_t *); extern void __read_unlock(rwlock_t *); @@ -132,6 +133,7 @@ typedef struct { } rwlock_t; #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { 0, 0, 0, 0 } } #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) +#define rwlock_is_locked(x) ((x)->lock != 0) extern void _do_read_lock(rwlock_t *rw, char *str); extern void _do_read_unlock(rwlock_t *rw, char *str); diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index 2b09e8888220..d7eb4d220b79 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h @@ -203,7 +203,7 @@ #define __NR_setpgid 185 /* Common */ #define __NR_fremovexattr 186 /* SunOS: pathconf */ #define __NR_tkill 187 /* SunOS: fpathconf */ -/* #define __NR_sysconf 188 SunOS Specific */ +#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */ #define __NR_uname 189 /* Linux Specific */ #define __NR_init_module 190 /* Linux Specific */ #define __NR_personality 191 /* Linux Specific */ |
