diff options
| author | James Simmons <jsimmons@maxwell.earthlink.net> | 2002-07-23 19:16:08 -0700 |
|---|---|---|
| committer | James Simmons <jsimmons@maxwell.earthlink.net> | 2002-07-23 19:16:08 -0700 |
| commit | 89863ff414f5af7ebdd54607d7385a58bcf7dae7 (patch) | |
| tree | d5cef4d48d67f690a84b107a6781605f9594212d /include | |
| parent | 928c62247fda6febe8142bf163373746ff5e7ff3 (diff) | |
| parent | 9b4651a22d079c28f209740ce89d5d882468383a (diff) | |
Use local files for now. Then add in m68k changes
Diffstat (limited to 'include')
126 files changed, 1148 insertions, 778 deletions
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h index 594292133373..eb6ef31bf932 100644 --- a/include/asm-alpha/io.h +++ b/include/asm-alpha/io.h @@ -31,7 +31,7 @@ static inline void __set_hae(unsigned long new_hae) { unsigned long flags; - __save_and_cli(flags); + local_irq_save(flags); alpha_mv.hae_cache = new_hae; *alpha_mv.hae_register = new_hae; @@ -39,7 +39,7 @@ static inline void __set_hae(unsigned long new_hae) /* Re-read to make sure it was written. */ new_hae = *alpha_mv.hae_register; - __restore_flags(flags); + local_irq_restore(flags); } static inline void set_hae(unsigned long new_hae) diff --git a/include/asm-alpha/smplock.h b/include/asm-alpha/smplock.h index 911a06573a8e..b757693c0688 100644 --- a/include/asm-alpha/smplock.h +++ b/include/asm-alpha/smplock.h @@ -20,7 +20,7 @@ static __inline__ void release_kernel_lock(struct task_struct *task, int cpu) if (task->lock_depth >= 0) spin_unlock(&kernel_flag); release_irqlock(cpu); - __sti(); + local_irq_enable(); } /* diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index fb7496fce46f..db3f889b2463 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -303,16 +303,11 @@ extern int __min_ipl; #define getipl() (rdps() & 7) #define setipl(ipl) ((void) swpipl(ipl)) -#define __cli() do { setipl(IPL_MAX); barrier(); } while(0) -#define __sti() do { barrier(); setipl(IPL_MIN); } while(0) -#define __save_flags(flags) ((flags) = rdps()) -#define __save_and_cli(flags) do { (flags) = swpipl(IPL_MAX); barrier(); } while(0) -#define __restore_flags(flags) do { barrier(); setipl(flags); barrier(); } while(0) - -#define local_irq_save(flags) __save_and_cli(flags) -#define local_irq_restore(flags) __restore_flags(flags) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() +#define local_irq_disable() do { setipl(IPL_MAX); barrier(); } while(0) +#define local_irq_enable() do { barrier(); setipl(IPL_MIN); } while(0) +#define local_save_flags(flags) ((flags) = rdps()) +#define local_irq_save(flags) do { (flags) = swpipl(IPL_MAX); barrier(); } while(0) +#define local_irq_restore(flags) do { barrier(); setipl(flags); barrier(); } while(0) #ifdef CONFIG_SMP @@ -332,11 +327,11 @@ extern void __global_restore_flags(unsigned long flags); #else /* CONFIG_SMP */ -#define cli() __cli() -#define sti() __sti() -#define save_flags(flags) __save_flags(flags) -#define save_and_cli(flags) __save_and_cli(flags) -#define restore_flags(flags) __restore_flags(flags) +#define cli() local_irq_disable() +#define sti() local_irq_enable() +#define save_flags(flags) local_save_flags(flags) +#define save_and_cli(flags) local_irq_save(flags) +#define restore_flags(flags) local_irq_restore(flags) #endif /* CONFIG_SMP */ diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h index 1930c34e48a3..d1b48d65ff23 100644 --- a/include/asm-arm/atomic.h +++ b/include/asm-arm/atomic.h @@ -36,36 +36,36 @@ static inline void atomic_add(int i, volatile atomic_t *v) { unsigned long flags; - __save_flags_cli(flags); + local_save_flags_cli(flags); v->counter += i; - __restore_flags(flags); + local_irq_restore(flags); } static inline void atomic_sub(int i, volatile atomic_t *v) { unsigned long flags; - __save_flags_cli(flags); + local_save_flags_cli(flags); v->counter -= i; - __restore_flags(flags); + local_irq_restore(flags); } static inline void atomic_inc(volatile atomic_t *v) { unsigned long flags; - __save_flags_cli(flags); + local_save_flags_cli(flags); v->counter += 1; - __restore_flags(flags); + local_irq_restore(flags); } static inline void atomic_dec(volatile atomic_t *v) { unsigned long flags; - __save_flags_cli(flags); + local_save_flags_cli(flags); v->counter -= 1; - __restore_flags(flags); + local_irq_restore(flags); } static inline int atomic_dec_and_test(volatile atomic_t *v) @@ -73,10 +73,10 @@ static inline int atomic_dec_and_test(volatile atomic_t *v) unsigned long flags; int val; - __save_flags_cli(flags); + local_save_flags_cli(flags); val = v->counter; v->counter = val -= 1; - __restore_flags(flags); + local_irq_restore(flags); return val == 0; } @@ -86,10 +86,10 @@ static inline int atomic_add_negative(int i, volatile atomic_t *v) unsigned long flags; int val; - __save_flags_cli(flags); + local_save_flags_cli(flags); val = v->counter; v->counter = val += i; - __restore_flags(flags); + local_irq_restore(flags); return val < 0; } @@ -98,9 +98,9 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) { unsigned long flags; - __save_flags_cli(flags); + local_save_flags_cli(flags); *addr &= ~mask; - __restore_flags(flags); + local_irq_restore(flags); } /* Atomic operations are already serializing on ARM */ diff --git a/include/asm-arm/proc-armo/system.h b/include/asm-arm/proc-armo/system.h index fccc6bbff83f..23f2b96cb2d0 100644 --- a/include/asm-arm/proc-armo/system.h +++ b/include/asm-arm/proc-armo/system.h @@ -39,7 +39,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size /* * Save the current interrupt enable state & disable IRQs */ -#define __save_flags_cli(x) \ +#define local_save_flags_cli(x) \ do { \ unsigned long temp; \ __asm__ __volatile__( \ @@ -55,7 +55,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size /* * Enable IRQs */ -#define __sti() \ +#define local_irq_enable() \ do { \ unsigned long temp; \ __asm__ __volatile__( \ @@ -70,7 +70,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size /* * Disable IRQs */ -#define __cli() \ +#define local_irq_disable() \ do { \ unsigned long temp; \ __asm__ __volatile__( \ @@ -103,7 +103,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size /* * save current IRQ & FIQ state */ -#define __save_flags(x) \ +#define local_save_flags(x) \ do { \ __asm__ __volatile__( \ " mov %0, pc @ save_flags\n" \ @@ -114,7 +114,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size /* * restore saved IRQ & FIQ state */ -#define __restore_flags(x) \ +#define local_irq_restore(x) \ do { \ unsigned long temp; \ __asm__ __volatile__( \ diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h index 229513280b5a..d9647dc39f6a 100644 --- a/include/asm-arm/proc-armv/system.h +++ b/include/asm-arm/proc-armv/system.h @@ -49,7 +49,7 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ /* * Save the current interrupt enable state & disable IRQs */ -#define __save_flags_cli(x) \ +#define local_save_flags_cli(x) \ ({ \ unsigned long temp; \ __asm__ __volatile__( \ @@ -64,7 +64,7 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ /* * Enable IRQs */ -#define __sti() \ +#define local_irq_enable() \ ({ \ unsigned long temp; \ __asm__ __volatile__( \ @@ -79,7 +79,7 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ /* * Disable IRQs */ -#define __cli() \ +#define local_irq_disable() \ ({ \ unsigned long temp; \ __asm__ __volatile__( \ @@ -124,7 +124,7 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ /* * save current IRQ & FIQ state */ -#define __save_flags(x) \ +#define local_save_flags(x) \ __asm__ __volatile__( \ "mrs %0, cpsr @ save_flags\n" \ : "=r" (x) \ @@ -134,7 +134,7 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ /* * restore saved IRQ & FIQ state */ -#define __restore_flags(x) \ +#define local_irq_restore(x) \ __asm__ __volatile__( \ "msr cpsr_c, %0 @ restore_flags\n" \ : \ @@ -168,17 +168,17 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size switch (size) { #ifdef swp_is_buggy case 1: - __save_flags_cli(flags); + local_save_flags_cli(flags); ret = *(volatile unsigned char *)ptr; *(volatile unsigned char *)ptr = x; - __restore_flags(flags); + local_irq_restore(flags); break; case 4: - __save_flags_cli(flags); + local_save_flags_cli(flags); ret = *(volatile unsigned long *)ptr; *(volatile unsigned long *)ptr = x; - __restore_flags(flags); + local_irq_restore(flags); break; #else case 1: __asm__ __volatile__ ("swpb %0, %1, [%2]" diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index d35f8d91c25f..f110ae2eb76b 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -76,10 +76,7 @@ extern struct task_struct *__switch_to(struct thread_info *, struct thread_info } while (0) /* For spinlocks etc */ -#define local_irq_save(x) __save_flags_cli(x) -#define local_irq_restore(x) __restore_flags(x) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() +#define local_irq_save(x) local_save_flags_cli(x) #ifdef CONFIG_SMP #error SMP not supported @@ -94,12 +91,12 @@ extern struct task_struct *__switch_to(struct thread_info *, struct thread_info #define smp_rmb() barrier() #define smp_wmb() barrier() -#define cli() __cli() -#define sti() __sti() +#define cli() local_irq_disable() +#define sti() local_irq_enable() #define clf() __clf() #define stf() __stf() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) +#define save_flags(x) local_save_flags(x) +#define restore_flags(x) local_irq_restore(x) #endif /* CONFIG_SMP */ diff --git a/include/asm-arm/tlb.h b/include/asm-arm/tlb.h index a70a0be8c8df..a7c2473b92f5 100644 --- a/include/asm-arm/tlb.h +++ b/include/asm-arm/tlb.h @@ -11,7 +11,7 @@ #define tlb_end_vma(tlb,vma) \ flush_tlb_range(vma, vma->vm_start, vma->vm_end) -#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) +#define tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) #include <asm-generic/tlb.h> diff --git a/include/asm-cris/softirq.h b/include/asm-cris/softirq.h index eb6e178c64e3..c5b2d8873f9a 100644 --- a/include/asm-cris/softirq.h +++ b/include/asm-cris/softirq.h @@ -21,7 +21,7 @@ do { \ if (!--local_bh_count(smp_processor_id()) \ && softirq_pending(smp_processor_id())) { \ do_softirq(); \ - __sti(); \ + local_irq_enable(); \ } \ } while (0) diff --git a/include/asm-cris/sv_addr.agh b/include/asm-cris/sv_addr.agh index c9c6141eb569..ddaf91fa38cf 100644 --- a/include/asm-cris/sv_addr.agh +++ b/include/asm-cris/sv_addr.agh @@ -1142,7 +1142,7 @@ #define R_SERIAL0_CTRL__rec_stick_par__BITNR 19 #define R_SERIAL0_CTRL__rec_stick_par__WIDTH 1 #define R_SERIAL0_CTRL__rec_stick_par__normal 0 -#define R_SERIAL0_CTRL__rec_stick_par__stick 1 +#define R_SERIAL0_CTRL__rec_stick_parlocal_irq_enableck 1 #define R_SERIAL0_CTRL__rec_par__BITNR 18 #define R_SERIAL0_CTRL__rec_par__WIDTH 1 #define R_SERIAL0_CTRL__rec_par__even 0 @@ -1172,7 +1172,7 @@ #define R_SERIAL0_CTRL__tr_stick_par__BITNR 11 #define R_SERIAL0_CTRL__tr_stick_par__WIDTH 1 #define R_SERIAL0_CTRL__tr_stick_par__normal 0 -#define R_SERIAL0_CTRL__tr_stick_par__stick 1 +#define R_SERIAL0_CTRL__tr_stick_parlocal_irq_enableck 1 #define R_SERIAL0_CTRL__tr_par__BITNR 10 #define R_SERIAL0_CTRL__tr_par__WIDTH 1 #define R_SERIAL0_CTRL__tr_par__even 0 @@ -1246,7 +1246,7 @@ #define R_SERIAL0_REC_CTRL__rec_stick_par__BITNR 3 #define R_SERIAL0_REC_CTRL__rec_stick_par__WIDTH 1 #define R_SERIAL0_REC_CTRL__rec_stick_par__normal 0 -#define R_SERIAL0_REC_CTRL__rec_stick_par__stick 1 +#define R_SERIAL0_REC_CTRL__rec_stick_parlocal_irq_enableck 1 #define R_SERIAL0_REC_CTRL__rec_par__BITNR 2 #define R_SERIAL0_REC_CTRL__rec_par__WIDTH 1 #define R_SERIAL0_REC_CTRL__rec_par__even 0 @@ -1278,7 +1278,7 @@ #define R_SERIAL0_TR_CTRL__tr_stick_par__BITNR 3 #define R_SERIAL0_TR_CTRL__tr_stick_par__WIDTH 1 #define R_SERIAL0_TR_CTRL__tr_stick_par__normal 0 -#define R_SERIAL0_TR_CTRL__tr_stick_par__stick 1 +#define R_SERIAL0_TR_CTRL__tr_stick_parlocal_irq_enableck 1 #define R_SERIAL0_TR_CTRL__tr_par__BITNR 2 #define R_SERIAL0_TR_CTRL__tr_par__WIDTH 1 #define R_SERIAL0_TR_CTRL__tr_par__even 0 @@ -1434,7 +1434,7 @@ #define R_SERIAL1_CTRL__rec_stick_par__BITNR 19 #define R_SERIAL1_CTRL__rec_stick_par__WIDTH 1 #define R_SERIAL1_CTRL__rec_stick_par__normal 0 -#define R_SERIAL1_CTRL__rec_stick_par__stick 1 +#define R_SERIAL1_CTRL__rec_stick_parlocal_irq_enableck 1 #define R_SERIAL1_CTRL__rec_par__BITNR 18 #define R_SERIAL1_CTRL__rec_par__WIDTH 1 #define R_SERIAL1_CTRL__rec_par__even 0 @@ -1464,7 +1464,7 @@ #define R_SERIAL1_CTRL__tr_stick_par__BITNR 11 #define R_SERIAL1_CTRL__tr_stick_par__WIDTH 1 #define R_SERIAL1_CTRL__tr_stick_par__normal 0 -#define R_SERIAL1_CTRL__tr_stick_par__stick 1 +#define R_SERIAL1_CTRL__tr_stick_parlocal_irq_enableck 1 #define R_SERIAL1_CTRL__tr_par__BITNR 10 #define R_SERIAL1_CTRL__tr_par__WIDTH 1 #define R_SERIAL1_CTRL__tr_par__even 0 @@ -1538,7 +1538,7 @@ #define R_SERIAL1_REC_CTRL__rec_stick_par__BITNR 3 #define R_SERIAL1_REC_CTRL__rec_stick_par__WIDTH 1 #define R_SERIAL1_REC_CTRL__rec_stick_par__normal 0 -#define R_SERIAL1_REC_CTRL__rec_stick_par__stick 1 +#define R_SERIAL1_REC_CTRL__rec_stick_parlocal_irq_enableck 1 #define R_SERIAL1_REC_CTRL__rec_par__BITNR 2 #define R_SERIAL1_REC_CTRL__rec_par__WIDTH 1 #define R_SERIAL1_REC_CTRL__rec_par__even 0 @@ -1570,7 +1570,7 @@ #define R_SERIAL1_TR_CTRL__tr_stick_par__BITNR 3 #define R_SERIAL1_TR_CTRL__tr_stick_par__WIDTH 1 #define R_SERIAL1_TR_CTRL__tr_stick_par__normal 0 -#define R_SERIAL1_TR_CTRL__tr_stick_par__stick 1 +#define R_SERIAL1_TR_CTRL__tr_stick_parlocal_irq_enableck 1 #define R_SERIAL1_TR_CTRL__tr_par__BITNR 2 #define R_SERIAL1_TR_CTRL__tr_par__WIDTH 1 #define R_SERIAL1_TR_CTRL__tr_par__even 0 @@ -1726,7 +1726,7 @@ #define R_SERIAL2_CTRL__rec_stick_par__BITNR 19 #define R_SERIAL2_CTRL__rec_stick_par__WIDTH 1 #define R_SERIAL2_CTRL__rec_stick_par__normal 0 -#define R_SERIAL2_CTRL__rec_stick_par__stick 1 +#define R_SERIAL2_CTRL__rec_stick_parlocal_irq_enableck 1 #define R_SERIAL2_CTRL__rec_par__BITNR 18 #define R_SERIAL2_CTRL__rec_par__WIDTH 1 #define R_SERIAL2_CTRL__rec_par__even 0 @@ -1756,7 +1756,7 @@ #define R_SERIAL2_CTRL__tr_stick_par__BITNR 11 #define R_SERIAL2_CTRL__tr_stick_par__WIDTH 1 #define R_SERIAL2_CTRL__tr_stick_par__normal 0 -#define R_SERIAL2_CTRL__tr_stick_par__stick 1 +#define R_SERIAL2_CTRL__tr_stick_parlocal_irq_enableck 1 #define R_SERIAL2_CTRL__tr_par__BITNR 10 #define R_SERIAL2_CTRL__tr_par__WIDTH 1 #define R_SERIAL2_CTRL__tr_par__even 0 @@ -1830,7 +1830,7 @@ #define R_SERIAL2_REC_CTRL__rec_stick_par__BITNR 3 #define R_SERIAL2_REC_CTRL__rec_stick_par__WIDTH 1 #define R_SERIAL2_REC_CTRL__rec_stick_par__normal 0 -#define R_SERIAL2_REC_CTRL__rec_stick_par__stick 1 +#define R_SERIAL2_REC_CTRL__rec_stick_parlocal_irq_enableck 1 #define R_SERIAL2_REC_CTRL__rec_par__BITNR 2 #define R_SERIAL2_REC_CTRL__rec_par__WIDTH 1 #define R_SERIAL2_REC_CTRL__rec_par__even 0 @@ -1862,7 +1862,7 @@ #define R_SERIAL2_TR_CTRL__tr_stick_par__BITNR 3 #define R_SERIAL2_TR_CTRL__tr_stick_par__WIDTH 1 #define R_SERIAL2_TR_CTRL__tr_stick_par__normal 0 -#define R_SERIAL2_TR_CTRL__tr_stick_par__stick 1 +#define R_SERIAL2_TR_CTRL__tr_stick_parlocal_irq_enableck 1 #define R_SERIAL2_TR_CTRL__tr_par__BITNR 2 #define R_SERIAL2_TR_CTRL__tr_par__WIDTH 1 #define R_SERIAL2_TR_CTRL__tr_par__even 0 @@ -2018,7 +2018,7 @@ #define R_SERIAL3_CTRL__rec_stick_par__BITNR 19 #define R_SERIAL3_CTRL__rec_stick_par__WIDTH 1 #define R_SERIAL3_CTRL__rec_stick_par__normal 0 -#define R_SERIAL3_CTRL__rec_stick_par__stick 1 +#define R_SERIAL3_CTRL__rec_stick_parlocal_irq_enableck 1 #define R_SERIAL3_CTRL__rec_par__BITNR 18 #define R_SERIAL3_CTRL__rec_par__WIDTH 1 #define R_SERIAL3_CTRL__rec_par__even 0 @@ -2048,7 +2048,7 @@ #define R_SERIAL3_CTRL__tr_stick_par__BITNR 11 #define R_SERIAL3_CTRL__tr_stick_par__WIDTH 1 #define R_SERIAL3_CTRL__tr_stick_par__normal 0 -#define R_SERIAL3_CTRL__tr_stick_par__stick 1 +#define R_SERIAL3_CTRL__tr_stick_parlocal_irq_enableck 1 #define R_SERIAL3_CTRL__tr_par__BITNR 10 #define R_SERIAL3_CTRL__tr_par__WIDTH 1 #define R_SERIAL3_CTRL__tr_par__even 0 @@ -2122,7 +2122,7 @@ #define R_SERIAL3_REC_CTRL__rec_stick_par__BITNR 3 #define R_SERIAL3_REC_CTRL__rec_stick_par__WIDTH 1 #define R_SERIAL3_REC_CTRL__rec_stick_par__normal 0 -#define R_SERIAL3_REC_CTRL__rec_stick_par__stick 1 +#define R_SERIAL3_REC_CTRL__rec_stick_parlocal_irq_enableck 1 #define R_SERIAL3_REC_CTRL__rec_par__BITNR 2 #define R_SERIAL3_REC_CTRL__rec_par__WIDTH 1 #define R_SERIAL3_REC_CTRL__rec_par__even 0 @@ -2154,7 +2154,7 @@ #define R_SERIAL3_TR_CTRL__tr_stick_par__BITNR 3 #define R_SERIAL3_TR_CTRL__tr_stick_par__WIDTH 1 #define R_SERIAL3_TR_CTRL__tr_stick_par__normal 0 -#define R_SERIAL3_TR_CTRL__tr_stick_par__stick 1 +#define R_SERIAL3_TR_CTRL__tr_stick_parlocal_irq_enableck 1 #define R_SERIAL3_TR_CTRL__tr_par__BITNR 2 #define R_SERIAL3_TR_CTRL__tr_par__WIDTH 1 #define R_SERIAL3_TR_CTRL__tr_par__even 0 diff --git a/include/asm-cris/system.h b/include/asm-cris/system.h index 0674811a31c5..240f36fc57a4 100644 --- a/include/asm-cris/system.h +++ b/include/asm-cris/system.h @@ -62,10 +62,10 @@ struct __xchg_dummy { unsigned long a[100]; }; #define save_flags(x) __asm__ __volatile__ ("move $ccr,%0" : "=rm" (x) : : "memory"); #define restore_flags(x) __asm__ __volatile__ ("move %0,$ccr\n\tbtstq 5,%0\n\tbpl 1f\n\tnop\n\tpush $r0\n\tmoveq 0,$r0\n\tmove.d $r0,[0x90000000]\n\tpop $r0\n1:\n" : : "r" (x) : "memory"); #else -#define __cli() __asm__ __volatile__ ( "di"); -#define __sti() __asm__ __volatile__ ( "ei" ); -#define __save_flags(x) __asm__ __volatile__ ("move $ccr,%0" : "=rm" (x) : : "memory"); -#define __restore_flags(x) __asm__ __volatile__ ("move %0,$ccr" : : "rm" (x) : "memory"); +#define local_irq_disable() __asm__ __volatile__ ( "di"); +#define local_irq_enable() __asm__ __volatile__ ( "ei" ); +#define local_save_flags(x) __asm__ __volatile__ ("move $ccr,%0" : "=rm" (x) : : "memory"); +#define local_irq_restore(x) __asm__ __volatile__ ("move %0,$ccr" : : "rm" (x) : "memory"); /* For spinlocks etc */ #define local_irq_save(x) __asm__ __volatile__ ("move $ccr,%0\n\tdi" : "=rm" (x) : : "memory"); @@ -76,11 +76,11 @@ struct __xchg_dummy { unsigned long a[100]; }; #endif -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) -#define save_and_cli(x) do { __save_flags(x); cli(); } while(0) +#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) do { local_save_flags(x); cli(); } while(0) static inline unsigned long __xchg(unsigned long x, void * ptr, int size) { diff --git a/include/asm-generic/smplock.h b/include/asm-generic/smplock.h index d77431f2cb25..f02afc9ffd6e 100644 --- a/include/asm-generic/smplock.h +++ b/include/asm-generic/smplock.h @@ -17,7 +17,7 @@ extern spinlock_t kernel_flag; do { \ if (task->lock_depth >= 0) \ spin_unlock(&kernel_flag); \ - __sti(); \ + local_irq_enable(); \ } while (0) /* diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h index 084e6baf9b95..cdb2f1ecfc01 100644 --- a/include/asm-i386/acpi.h +++ b/include/asm-i386/acpi.h @@ -48,8 +48,8 @@ #define ACPI_ASM_MACROS #define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() __cli() -#define ACPI_ENABLE_IRQS() __sti() +#define ACPI_DISABLE_IRQS() local_irq_disable() +#define ACPI_ENABLE_IRQS() local_irq_enable() #define ACPI_FLUSH_CPU_CACHE() wbinvd() /* diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 7d9fa1282e26..d10a76223841 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -311,27 +311,24 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, #define set_wmb(var, value) do { var = value; wmb(); } while (0) /* interrupt control.. */ -#define __save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */) -#define __restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc") -#define __cli() __asm__ __volatile__("cli": : :"memory") -#define __sti() __asm__ __volatile__("sti": : :"memory") +#define local_save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */) +#define local_irq_restore(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc") +#define local_irq_disable() __asm__ __volatile__("cli": : :"memory") +#define local_irq_enable() __asm__ __volatile__("sti": : :"memory") /* used in the idle loop; sti takes one instruction cycle to complete */ #define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory") /* For spinlocks etc */ #define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory") -#define local_irq_restore(x) __restore_flags(x) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() /* * Compatibility macros - they will be removed after some time. */ #if !CONFIG_SMP -# define sti() __sti() -# define cli() __cli() -# define save_flags(flags) __save_flags(flags) -# define restore_flags(flags) __restore_flags(flags) +# define sti() local_irq_enable() +# define cli() local_irq_disable() +# define save_flags(flags) local_save_flags(flags) +# define restore_flags(flags) local_irq_restore(flags) #endif /* diff --git a/include/asm-i386/tlb.h b/include/asm-i386/tlb.h index 844c3d4c9aaa..0cd54638cc97 100644 --- a/include/asm-i386/tlb.h +++ b/include/asm-i386/tlb.h @@ -7,7 +7,7 @@ */ #define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0) -#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) +#define tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) /* * .. because we flush the whole mm when it diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h index 088e84a1b4df..9cc45e562991 100644 --- a/include/asm-ia64/system.h +++ b/include/asm-ia64/system.h @@ -169,12 +169,10 @@ do { \ #define local_irq_enable() __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory") -#define __cli() local_irq_disable () -#define __save_flags(flags) __asm__ __volatile__ ("mov %0=psr" : "=r" (flags) :: "memory") -#define __save_and_cli(flags) local_irq_save(flags) -#define save_and_cli(flags) __save_and_cli(flags) -#define __sti() local_irq_enable () -#define __restore_flags(flags) local_irq_restore(flags) +#define local_irq_disable() local_irq_disable () +#define local_save_flags(flags) __asm__ __volatile__ ("mov %0=psr" : "=r" (flags) :: "memory") +#define local_irq_save(flags) local_irq_save(flags) +#define save_and_cli(flags) local_irq_save(flags) #ifdef CONFIG_SMP extern void __global_cli (void); @@ -186,10 +184,10 @@ do { \ # define save_flags(flags) ((flags) = __global_save_flags()) # define restore_flags(flags) __global_restore_flags(flags) #else /* !CONFIG_SMP */ -# define cli() __cli() -# define sti() __sti() -# define save_flags(flags) __save_flags(flags) -# define restore_flags(flags) __restore_flags(flags) +# define cli() local_irq_disable() +# define sti() local_irq_enable() +# define save_flags(flags) local_save_flags(flags) +# define restore_flags(flags) local_irq_restore(flags) #endif /* !CONFIG_SMP */ /* diff --git a/include/asm-ia64/tlb.h b/include/asm-ia64/tlb.h index 3b85d222f5a2..d9d97ef65969 100644 --- a/include/asm-ia64/tlb.h +++ b/include/asm-ia64/tlb.h @@ -1,7 +1,7 @@ /* XXX fix me! */ #define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0) -#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) +#define tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) #include <asm-generic/tlb.h> diff --git a/include/asm-m68k/apollodma.h b/include/asm-m68k/apollodma.h index 3abef61cb67e..558dfd220f74 100644 --- a/include/asm-m68k/apollodma.h +++ b/include/asm-m68k/apollodma.h @@ -9,7 +9,7 @@ #define _ASM_APOLLO_DMA_H #include <asm/apollohw.h> /* need byte IO */ -#include <asm/spinlock.h> /* And spinlocks */ +#include <linux/spinlock.h> /* And spinlocks */ #include <linux/delay.h> diff --git a/include/asm-m68k/atarihw.h b/include/asm-m68k/atarihw.h index f53a9354db01..feb510043c50 100644 --- a/include/asm-m68k/atarihw.h +++ b/include/asm-m68k/atarihw.h @@ -133,7 +133,7 @@ extern struct atari_hw_present atari_hw_present; #include <linux/mm.h> -#include <asm/pgalloc.h> +#include <asm/cacheflush.h> static inline void dma_cache_maintenance( unsigned long paddr, unsigned long len, diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h index e702403dd027..fb9146e78ecc 100644 --- a/include/asm-m68k/bitops.h +++ b/include/asm-m68k/bitops.h @@ -8,6 +8,8 @@ * for more details. */ +#include <linux/compiler.h> + /* * Require 68020 or better. * @@ -19,7 +21,7 @@ __constant_test_and_set_bit(nr, vaddr) : \ __generic_test_and_set_bit(nr, vaddr)) -extern __inline__ int __constant_test_and_set_bit(int nr,volatile void * vaddr) +extern __inline__ int __constant_test_and_set_bit(int nr,volatile unsigned long * vaddr) { char retval; @@ -30,7 +32,7 @@ extern __inline__ int __constant_test_and_set_bit(int nr,volatile void * vaddr) return retval; } -extern __inline__ int __generic_test_and_set_bit(int nr,volatile void * vaddr) +extern __inline__ int __generic_test_and_set_bit(int nr,volatile unsigned long * vaddr) { char retval; @@ -47,13 +49,13 @@ extern __inline__ int __generic_test_and_set_bit(int nr,volatile void * vaddr) #define __set_bit(nr,vaddr) set_bit(nr,vaddr) -extern __inline__ void __constant_set_bit(int nr, volatile void * vaddr) +extern __inline__ void __constant_set_bit(int nr, volatile unsigned long * vaddr) { __asm__ __volatile__ ("bset %1,%0" : "+m" (((volatile char *)vaddr)[(nr^31) >> 3]) : "di" (nr & 7)); } -extern __inline__ void __generic_set_bit(int nr, volatile void * vaddr) +extern __inline__ void __generic_set_bit(int nr, volatile unsigned long * vaddr) { __asm__ __volatile__ ("bfset %1@{%0:#1}" : : "d" (nr^31), "a" (vaddr) : "memory"); @@ -66,7 +68,7 @@ extern __inline__ void __generic_set_bit(int nr, volatile void * vaddr) #define __test_and_clear_bit(nr,vaddr) test_and_clear_bit(nr,vaddr) -extern __inline__ int __constant_test_and_clear_bit(int nr, volatile void * vaddr) +extern __inline__ int __constant_test_and_clear_bit(int nr, volatile unsigned long * vaddr) { char retval; @@ -77,7 +79,7 @@ extern __inline__ int __constant_test_and_clear_bit(int nr, volatile void * vadd return retval; } -extern __inline__ int __generic_test_and_clear_bit(int nr, volatile void * vaddr) +extern __inline__ int __generic_test_and_clear_bit(int nr, volatile unsigned long * vaddr) { char retval; @@ -99,13 +101,13 @@ extern __inline__ int __generic_test_and_clear_bit(int nr, volatile void * vaddr __generic_clear_bit(nr, vaddr)) #define __clear_bit(nr,vaddr) clear_bit(nr,vaddr) -extern __inline__ void __constant_clear_bit(int nr, volatile void * vaddr) +extern __inline__ void __constant_clear_bit(int nr, volatile unsigned long * vaddr) { __asm__ __volatile__ ("bclr %1,%0" : "+m" (((volatile char *)vaddr)[(nr^31) >> 3]) : "di" (nr & 7)); } -extern __inline__ void __generic_clear_bit(int nr, volatile void * vaddr) +extern __inline__ void __generic_clear_bit(int nr, volatile unsigned long * vaddr) { __asm__ __volatile__ ("bfclr %1@{%0:#1}" : : "d" (nr^31), "a" (vaddr) : "memory"); @@ -119,7 +121,7 @@ extern __inline__ void __generic_clear_bit(int nr, volatile void * vaddr) #define __test_and_change_bit(nr,vaddr) test_and_change_bit(nr,vaddr) #define __change_bit(nr,vaddr) change_bit(nr,vaddr) -extern __inline__ int __constant_test_and_change_bit(int nr, volatile void * vaddr) +extern __inline__ int __constant_test_and_change_bit(int nr, volatile unsigned long * vaddr) { char retval; @@ -130,7 +132,7 @@ extern __inline__ int __constant_test_and_change_bit(int nr, volatile void * vad return retval; } -extern __inline__ int __generic_test_and_change_bit(int nr, volatile void * vaddr) +extern __inline__ int __generic_test_and_change_bit(int nr, volatile unsigned long * vaddr) { char retval; @@ -145,24 +147,24 @@ extern __inline__ int __generic_test_and_change_bit(int nr, volatile void * vadd __constant_change_bit(nr, vaddr) : \ __generic_change_bit(nr, vaddr)) -extern __inline__ void __constant_change_bit(int nr, volatile void * vaddr) +extern __inline__ void __constant_change_bit(int nr, volatile unsigned long * vaddr) { __asm__ __volatile__ ("bchg %1,%0" : "+m" (((volatile char *)vaddr)[(nr^31) >> 3]) : "di" (nr & 7)); } -extern __inline__ void __generic_change_bit(int nr, volatile void * vaddr) +extern __inline__ void __generic_change_bit(int nr, volatile unsigned long * vaddr) { __asm__ __volatile__ ("bfchg %1@{%0:#1}" : : "d" (nr^31), "a" (vaddr) : "memory"); } -extern __inline__ int test_bit(int nr, const volatile void * vaddr) +extern __inline__ int test_bit(int nr, const volatile unsigned long * vaddr) { - return ((1UL << (nr & 31)) & (((const volatile unsigned int *) vaddr)[nr >> 5])) != 0; + return ((1UL << (nr & 31)) & (((const volatile unsigned long *) vaddr)[nr >> 5])) != 0; } -extern __inline__ int find_first_zero_bit(void * vaddr, unsigned size) +extern __inline__ int find_first_zero_bit(unsigned long * vaddr, unsigned size) { unsigned long *p = vaddr, *addr = vaddr; unsigned long allones = ~0UL; @@ -185,7 +187,7 @@ extern __inline__ int find_first_zero_bit(void * vaddr, unsigned size) return ((p - addr) << 5) + (res ^ 31); } -extern __inline__ int find_next_zero_bit (void *vaddr, int size, +extern __inline__ int find_next_zero_bit (unsigned long *vaddr, int size, int offset) { unsigned long *addr = vaddr; @@ -232,16 +234,28 @@ extern __inline__ unsigned long ffz(unsigned long word) * differs in spirit from the above ffz (man ffs). */ -extern __inline__ int ffs(int x) +static inline int ffs(int x) { int cnt; - __asm__ __volatile__("bfffo %1{#0:#0},%0" : "=d" (cnt) : "dm" (x & -x)); + asm ("bfffo %1{#0:#0},%0" : "=d" (cnt) : "dm" (x & -x)); return 32 - cnt; } #define __ffs(x) (ffs(x) - 1) +/* + * fls: find last bit set. + */ + +static inline int fls(int x) +{ + int cnt; + + asm ("bfffo %1{#0,#0},%0" : "=d" (cnt) : "dm" (x)); + + return 32 - cnt; +} /* * Every architecture must define this function. It's the fastest diff --git a/include/asm-m68k/cache.h b/include/asm-m68k/cache.h index 52262e891ed8..fed3fd30de7e 100644 --- a/include/asm-m68k/cache.h +++ b/include/asm-m68k/cache.h @@ -5,6 +5,7 @@ #define __ARCH_M68K_CACHE_H /* bytes per L1 cache line */ -#define L1_CACHE_BYTES 16 +#define L1_CACHE_SHIFT 4 +#define L1_CACHE_BYTES (1<< L1_CACHE_SHIFT) #endif diff --git a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h index 089a570d552a..078523b767ba 100644 --- a/include/asm-m68k/cacheflush.h +++ b/include/asm-m68k/cacheflush.h @@ -1,6 +1,8 @@ #ifndef _M68K_CACHEFLUSH_H #define _M68K_CACHEFLUSH_H +#include <linux/mm.h> + /* * Cache handling functions */ @@ -104,15 +106,15 @@ extern inline void flush_cache_page(struct vm_area_struct *vma, /* Push the page at kernel virtual address and clear the icache */ /* RZ: use cpush %bc instead of cpush %dc, cinv %ic */ -#define flush_page_to_ram(page) __flush_page_to_ram((unsigned long) page_address(page)) -extern inline void __flush_page_to_ram(unsigned long address) +#define flush_page_to_ram(page) __flush_page_to_ram(page_address(page)) +extern inline void __flush_page_to_ram(void *vaddr) { if (CPU_IS_040_OR_060) { __asm__ __volatile__("nop\n\t" ".chip 68040\n\t" "cpushp %%bc,(%0)\n\t" ".chip 68k" - : : "a" (__pa((void *)address))); + : : "a" (__pa(vaddr))); } else { unsigned long _tmp; __asm__ __volatile__("movec %%cacr,%0\n\t" diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h index c35ec2e45aa6..ab9cd8c80af2 100644 --- a/include/asm-m68k/entry.h +++ b/include/asm-m68k/entry.h @@ -111,6 +111,7 @@ PT_DTRACE_BIT = 2 movel %sp,\reg andw #-THREAD_SIZE,\reg movel \reg,%curptr + movel %curptr@,%curptr .endm #else /* C source */ diff --git a/include/asm-m68k/hw_irq.h b/include/asm-m68k/hw_irq.h new file mode 100644 index 000000000000..eacef0951fbf --- /dev/null +++ b/include/asm-m68k/hw_irq.h @@ -0,0 +1,6 @@ +#ifndef __ASM_M68K_HW_IRQ_H +#define __ASM_M68K_HW_IRQ_H + +/* Dummy include. */ + +#endif diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h index 50340f20e135..d6fb3074ab77 100644 --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h @@ -240,7 +240,7 @@ static inline void isa_delay(void) #define readb isa_readb #define readw isa_readw #define writeb isa_writeb -#define writew isa_writeb +#define writew isa_writew #endif /* CONFIG_ISA */ #if defined(CONFIG_PCI) diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h index be2dfbd61ea1..7ed06f437f5b 100644 --- a/include/asm-m68k/irq.h +++ b/include/asm-m68k/irq.h @@ -73,6 +73,8 @@ extern void (*disable_irq)(unsigned int); #define disable_irq_nosync disable_irq #define enable_irq_nosync enable_irq +struct pt_regs; + extern int sys_request_irq(unsigned int, void (*)(int, void *, struct pt_regs *), unsigned long, const char *, void *); @@ -83,7 +85,7 @@ extern void sys_free_irq(unsigned int, void *); * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ * are your friends. */ -#ifndef CONFIG_AMIGA +#ifndef MACH_AMIGA_ONLY #define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */ #define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */ #define IRQ_FLG_FAST (0x0004) diff --git a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h index e846418408a8..120195037c9a 100644 --- a/include/asm-m68k/machw.h +++ b/include/asm-m68k/machw.h @@ -68,11 +68,11 @@ struct MAC_SCC /* hardware stuff */ -#define MACHW_DECLARE(name) unsigned name : 1 -#define MACHW_SET(name) (mac_hw_present.name = 1) -#define MACHW_PRESENT(name) (mac_hw_present.name) +#define MACHW_DECLARE(name) unsigned name : 1 +#define MACHW_SET(name) (mac_hw_present.name = 1) +#define MACHW_PRESENT(name) (mac_hw_present.name) -struct { +struct mac_hw_present { /* video hardware */ /* sound hardware */ /* disk storage interfaces */ @@ -92,9 +92,9 @@ struct { MACHW_DECLARE(RBV); /* Versatile Interface Ad. 2+ */ /* NUBUS */ MACHW_DECLARE(NUBUS); /* NUBUS */ -} mac_hw_present; +}; -/* extern struct mac_hw_present mac_hw_present; */ +extern struct mac_hw_present mac_hw_present; #endif /* __ASSEMBLY__ */ diff --git a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h index 68d1249d3cea..47ad33cc2254 100644 --- a/include/asm-m68k/macintosh.h +++ b/include/asm-m68k/macintosh.h @@ -39,9 +39,6 @@ extern void print_booter(char *ptr); * Macintosh Table */ -struct mac_model *macintosh_config; - - struct mac_model { short ident; diff --git a/include/asm-m68k/mman.h b/include/asm-m68k/mman.h index 8255e9d60879..a171fb7c7acf 100644 --- a/include/asm-m68k/mman.h +++ b/include/asm-m68k/mman.h @@ -4,6 +4,7 @@ #define PROT_READ 0x1 /* page can be read */ #define PROT_WRITE 0x2 /* page can be written */ #define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_SEM 0x8 /* page may be used for atomic ops */ #define PROT_NONE 0x0 /* page can not be accessed */ #define MAP_SHARED 0x01 /* Share changes */ diff --git a/include/asm-m68k/motorola_pgalloc.h b/include/asm-m68k/motorola_pgalloc.h index 0c75827ae0c3..6dab444dea28 100644 --- a/include/asm-m68k/motorola_pgalloc.h +++ b/include/asm-m68k/motorola_pgalloc.h @@ -14,9 +14,9 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long ad pte = (pte_t *) __get_free_page(GFP_KERNEL); if (pte) { clear_page(pte); - __flush_page_to_ram((unsigned long)pte); - flush_tlb_kernel_page((unsigned long)pte); - nocache_page((unsigned long)pte); + __flush_page_to_ram(pte); + flush_tlb_kernel_page(pte); + nocache_page(pte); } return pte; @@ -24,7 +24,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long ad static inline void pte_free_kernel(pte_t *pte) { - cache_page((unsigned long)pte); + cache_page(pte); free_page((unsigned long) pte); } @@ -39,9 +39,9 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add pte = kmap(page); if (pte) { clear_page(pte); - __flush_page_to_ram((unsigned long)pte); - flush_tlb_kernel_page((unsigned long)pte); - nocache_page((unsigned long)pte); + __flush_page_to_ram(pte); + flush_tlb_kernel_page(pte); + nocache_page(pte); } kunmap(pte); @@ -50,14 +50,14 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add static inline void pte_free(struct page *page) { - cache_page((unsigned long)kmap(page)); + cache_page(kmap(page)); kunmap(page); __free_page(page); } static inline void pte_free_tlb(mmu_gather_t *tlb, struct page *page) { - cache_page((unsigned long)kmap(page)); + cache_page(kmap(page)); kunmap(page); __free_page(page); } @@ -105,7 +105,4 @@ static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd) pgd_set(pgd, pmd); } - -#define check_pgt_cache() do { } while (0) - #endif /* _MOTOROLA_PGALLOC_H */ diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h index 7fea2e4ff2b6..57991e6da957 100644 --- a/include/asm-m68k/motorola_pgtable.h +++ b/include/asm-m68k/motorola_pgtable.h @@ -93,21 +93,7 @@ extern unsigned long mm_cachebits; * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -#define __mk_pte(page, pgprot) \ -({ \ - pte_t __pte; \ - \ - pte_val(__pte) = __pa(page) + pgprot_val(pgprot); \ - __pte; \ -}) -#define mk_pte(page, pgprot) __mk_pte(page_address(page), (pgprot)) -#define mk_pte_phys(physpage, pgprot) \ -({ \ - pte_t __pte; \ - \ - pte_val(__pte) = (physpage) + pgprot_val(pgprot); \ - __pte; \ -}) +#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } @@ -134,7 +120,10 @@ extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) #define pte_none(pte) (!pte_val(pte)) #define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_FAKE_SUPER)) #define pte_clear(ptep) ({ pte_val(*(ptep)) = 0; }) -#define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT) + +#define pte_page(pte) (mem_map + ((unsigned long)(__va(pte_val(pte)) - PAGE_OFFSET) >> PAGE_SHIFT)) +#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) +#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) ((pmd_val(pmd) & _DESCTYPE_MASK) != _PAGE_TABLE) @@ -145,16 +134,13 @@ extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) while (--__i >= 0) \ *__ptr++ = 0; \ }) +#define pmd_page(pmd) (mem_map + ((unsigned long)(__va(pmd_val(pmd)) - PAGE_OFFSET) >> PAGE_SHIFT)) #define pgd_none(pgd) (!pgd_val(pgd)) #define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) #define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) -/* Permanent address of a page. */ -#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) -#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) -#define pte_page(pte) (mem_map+pte_pagenr(pte)) #define pte_ERROR(e) \ printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) @@ -217,11 +203,15 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) } /* Find an entry in the third-level page table.. */ -extern inline pte_t * pte_offset(pmd_t * pmdp, unsigned long address) +extern inline pte_t * pte_offset_kernel(pmd_t * pmdp, unsigned long address) { return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); } +#define pte_offset_map(pmdp,address) ((pte_t *)kmap(pmd_page(*pmdp)) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) +#define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address) +#define pte_unmap(pte) kunmap(pte) +#define pte_unmap_nested(pte) kunmap(pte) /* * Allocate and free page tables. The xxx_kernel() versions are @@ -233,30 +223,34 @@ extern inline pte_t * pte_offset(pmd_t * pmdp, unsigned long address) * from both the cache and ATC, or the CPU might not notice that the * cache setting for the page has been changed. -jskov */ -static inline void nocache_page (unsigned long vaddr) +static inline void nocache_page(void *vaddr) { + unsigned long addr = (unsigned long)vaddr; + if (CPU_IS_040_OR_060) { pgd_t *dir; pmd_t *pmdp; pte_t *ptep; - dir = pgd_offset_k(vaddr); - pmdp = pmd_offset(dir,vaddr); - ptep = pte_offset(pmdp,vaddr); + dir = pgd_offset_k(addr); + pmdp = pmd_offset(dir, addr); + ptep = pte_offset_kernel(pmdp, addr); *ptep = pte_mknocache(*ptep); } } -static inline void cache_page (unsigned long vaddr) +static inline void cache_page(void *vaddr) { + unsigned long addr = (unsigned long)vaddr; + if (CPU_IS_040_OR_060) { pgd_t *dir; pmd_t *pmdp; pte_t *ptep; - dir = pgd_offset_k(vaddr); - pmdp = pmd_offset(dir,vaddr); - ptep = pte_offset(pmdp,vaddr); + dir = pgd_offset_k(addr); + pmdp = pmd_offset(dir, addr); + ptep = pte_offset_kernel(pmdp, addr); *ptep = pte_mkcache(*ptep); } } diff --git a/include/asm-m68k/nubus.h b/include/asm-m68k/nubus.h new file mode 100644 index 000000000000..b810d4c3bbe1 --- /dev/null +++ b/include/asm-m68k/nubus.h @@ -0,0 +1,46 @@ +#ifndef _ASM_M68K_NUBUS_H +#define _ASM_M68K_NUBUS_H + +#include <asm/io.h> + +#define nubus_readb raw_inb +#define nubus_readw raw_inw +#define nubus_readl raw_inl + +#define nubus_writeb raw_outb +#define nubus_writew raw_outw +#define nubus_writel raw_outl + +#define nubus_memset_io(a,b,c) memset((void *)(a),(b),(c)) +#define nubus_memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) +#define nubus_memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) + +extern inline void *nubus_remap_nocache_ser(unsigned long physaddr, + unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); +} + +extern inline void *nubus_remap_nocache_nonser(unsigned long physaddr, + unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_NOCACHE_NONSER); +} + +extern inline void *nbus_remap_writethrough(unsigned long physaddr, + unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); +} + +extern inline void *nubus_remap_fullcache(unsigned long physaddr, + unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_FULL_CACHING); +} + +#define nubus_unmap iounmap +#define nubus_iounmap iounmap +#define nubus_ioremap nubus_remap_nocache_ser + +#endif /* _ASM_NUBUS_H */ diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index 3fc192010d12..be5a7869742a 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h @@ -76,8 +76,8 @@ static inline void clear_page(void *page) #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) #endif -#define clear_user_page(page, vaddr) clear_page(page) -#define copy_user_page(to, from, vaddr) copy_page(to, from) +#define clear_user_page(page, vaddr, pg) clear_page(page) +#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) /* * These are used to make use of C type-checking.. @@ -159,10 +159,25 @@ static inline void *__va(unsigned long x) } #endif /* CONFIG_SUN3 */ -#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) +/* + * NOTE: virtual isn't really correct, actually it should be the offset into the + * memory node, but we have no highmem, so that works for now. + * TODO: implement (fast) pfn<->pgdat_idx conversion functions, this makes lots + * of the shifts unneccessary. + */ +#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) +#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) + #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT)) -#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) +#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) + +#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) +#define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) + +#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory) +#define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) +#ifdef CONFIG_DEBUG_BUGVERBOSE #ifndef CONFIG_SUN3 #define BUG() do { \ printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ @@ -174,6 +189,11 @@ static inline void *__va(unsigned long x) panic("BUG!"); \ } while (0) #endif +#else +#define BUG() do { \ + asm volatile("illegal"); \ +} while (0) +#endif #define PAGE_BUG(page) do { \ BUG(); \ diff --git a/include/asm-m68k/param.h b/include/asm-m68k/param.h index 3bff167e5309..caecfcc089c5 100644 --- a/include/asm-m68k/param.h +++ b/include/asm-m68k/param.h @@ -1,6 +1,12 @@ #ifndef _M68K_PARAM_H #define _M68K_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 @@ -17,8 +23,4 @@ #define MAXHOSTNAMELEN 64 /* max length of hostname */ -#ifdef __KERNEL__ -# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ -#endif - #endif /* _M68K_PARAM_H */ diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h index 644cf3733ee8..819a49ea8eb7 100644 --- a/include/asm-m68k/pci.h +++ b/include/asm-m68k/pci.h @@ -48,4 +48,10 @@ extern inline void pcibios_penalize_isa_irq(int irq) /* Return the index of the PCI controller for device PDEV. */ #define pci_controller_num(PDEV) (0) +/* The PCI address space does equal the physical memory + * address space. The networking and block device layers use + * this boolean for bounce buffer decisions. + */ +#define PCI_DMA_BUS_IS_PHYS (1) + #endif /* _ASM_M68K_PCI_H */ diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h index 597f08991de3..56e3311c1a89 100644 --- a/include/asm-m68k/pgtable.h +++ b/include/asm-m68k/pgtable.h @@ -6,6 +6,7 @@ #ifndef __ASSEMBLY__ #include <asm/processor.h> +#include <linux/sched.h> #include <linux/threads.h> /* @@ -88,20 +89,12 @@ extern unsigned long vmalloc_end; #endif /* CONFIG_SUN3 */ /* zero page used for uninitialized stuff */ -extern unsigned long empty_zero_page; +extern void *empty_zero_page; /* - * BAD_PAGETABLE is used when we need a bogus page-table, while - * BAD_PAGE is used for a bogus page. - * * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. */ -extern pte_t __bad_page(void); -extern pte_t * __bad_pagetable(void); - -#define BAD_PAGETABLE __bad_pagetable() -#define BAD_PAGE __bad_page() #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) /* number of bits that fit into a memory pointer */ @@ -185,4 +178,6 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, */ #define pgtable_cache_init() do { } while (0) +#define check_pgt_cache() do { } while (0) + #endif /* _M68K_PGTABLE_H */ diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h index 7ba60318ce28..864e69653644 100644 --- a/include/asm-m68k/processor.h +++ b/include/asm-m68k/processor.h @@ -59,11 +59,16 @@ extern inline void wrusp(unsigned long usp) { #define EISA_bus 0 #define MCA_bus 0 -/* - * if you change this structure, you must change the code and offsets - * in m68k/machasm.S - */ - +struct task_work { + unsigned char sigpending; + unsigned char notify_resume; /* request for notification on + userspace execution resumption */ + char need_resched; + unsigned char delayed_trace; /* single step a syscall */ + unsigned char syscall_trace; /* count of syscall interceptors */ + unsigned char pad[3]; +}; + struct thread_struct { unsigned long ksp; /* kernel stack pointer */ unsigned long usp; /* user stack pointer */ @@ -76,11 +81,13 @@ struct thread_struct { unsigned long fp[8*3]; unsigned long fpcntl[3]; /* fp control regs */ unsigned char fpstate[FPSTATESIZE]; /* floating point state */ + struct task_work work; }; -#define INIT_THREAD { \ - sizeof(init_stack) + (unsigned long) init_stack, 0, \ - PS_S, __KERNEL_DS, \ +#define INIT_THREAD { \ + ksp: sizeof(init_stack) + (unsigned long) init_stack, \ + sr: PS_S, \ + fs: __KERNEL_DS, \ } /* @@ -117,21 +124,7 @@ static inline void exit_thread(void) { } -/* - * Return saved PC of a blocked thread. - */ -extern inline unsigned long thread_saved_pc(struct thread_struct *t) -{ - extern void scheduling_functions_start_here(void); - extern void scheduling_functions_end_here(void); - struct switch_stack *sw = (struct switch_stack *)t->ksp; - /* Check whether the thread is blocked in resume() */ - if (sw->retpc > (unsigned long)scheduling_functions_start_here && - sw->retpc < (unsigned long)scheduling_functions_end_here) - return ((unsigned long *)sw->a6)[1]; - else - return sw->retpc; -} +extern unsigned long thread_saved_pc(struct task_struct *tsk); unsigned long get_wchan(struct task_struct *p); @@ -144,17 +137,6 @@ unsigned long get_wchan(struct task_struct *p); eip; }) #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) -#define THREAD_SIZE (2*PAGE_SIZE) - -/* Allocation and freeing of basic task resources. */ -#define alloc_task_struct() \ - ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) -#define free_task_struct(p) free_pages((unsigned long)(p),1) -#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count) - -#define init_task (init_task_union.task) -#define init_stack (init_task_union.stack) - #define cpu_relax() do { } while (0) #endif diff --git a/include/asm-m68k/q40_keyboard.h b/include/asm-m68k/q40_keyboard.h index 0f777bb67242..06587b6d10a4 100644 --- a/include/asm-m68k/q40_keyboard.h +++ b/include/asm-m68k/q40_keyboard.h @@ -20,7 +20,7 @@ extern int q40kbd_translate(unsigned char scancode, unsigned char *keycode, extern char q40kbd_unexpected_up(unsigned char keycode); extern void q40kbd_leds(unsigned char leds); extern int q40kbd_is_sysrq(unsigned char keycode); -extern void q40kbd_init_hw(void); +extern int q40kbd_init_hw(void); extern unsigned char q40kbd_sysrq_xlate[128]; diff --git a/include/asm-m68k/raw_io.h b/include/asm-m68k/raw_io.h index 4f4fe9572e81..d794d0f2e557 100644 --- a/include/asm-m68k/raw_io.h +++ b/include/asm-m68k/raw_io.h @@ -20,10 +20,16 @@ ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; }) #define in_be32(addr) \ ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; }) +#define in_le16(addr) \ + ({ unsigned short __v = le16_to_cpu(*(volatile unsigned short *) (addr)); __v; }) +#define in_le32(addr) \ + ({ unsigned int __v = le32_to_cpu(*(volatile unsigned int *) (addr)); __v; }) #define out_8(addr,b) (void)((*(volatile unsigned char *) (addr)) = (b)) -#define out_be16(addr,b) (void)((*(volatile unsigned short *) (addr)) = (b)) -#define out_be32(addr,b) (void)((*(volatile unsigned int *) (addr)) = (b)) +#define out_be16(addr,w) (void)((*(volatile unsigned short *) (addr)) = (w)) +#define out_be32(addr,l) (void)((*(volatile unsigned int *) (addr)) = (l)) +#define out_le16(addr,w) (void)((*(volatile unsigned short *) (addr)) = cpu_to_le16(w)) +#define out_le32(addr,l) (void)((*(volatile unsigned int *) (addr)) = cpu_to_le32(l)) #define raw_inb in_8 #define raw_inw in_be16 diff --git a/include/asm-m68k/scatterlist.h b/include/asm-m68k/scatterlist.h index 2a7bfa44832f..d7c9b5c5e6c7 100644 --- a/include/asm-m68k/scatterlist.h +++ b/include/asm-m68k/scatterlist.h @@ -2,17 +2,15 @@ #define _M68K_SCATTERLIST_H struct scatterlist { - struct page *page; - unsigned int offset; - unsigned int length; - unsigned long dvma_address; -}; + /* These two are only valid if ADDRESS member of this + * struct is NULL. + */ + struct page *page; + unsigned int offset; + + unsigned int length; -struct mmu_sglist { - char *addr; - char *__dont_touch; - unsigned int len; - unsigned long dvma_addr; + __u32 dvma_address; /* A place to hang host-specific addresses at. */ }; /* This is bogus and should go away. */ diff --git a/include/asm-m68k/semaphore-helper.h b/include/asm-m68k/semaphore-helper.h index aa38ab88eab4..1516a642f9a5 100644 --- a/include/asm-m68k/semaphore-helper.h +++ b/include/asm-m68k/semaphore-helper.h @@ -10,6 +10,7 @@ */ #include <linux/config.h> +#include <linux/errno.h> /* * These two _must_ execute atomically wrt each other. diff --git a/include/asm-m68k/serial.h b/include/asm-m68k/serial.h index b5d6fe43e6c3..a2f385829c6e 100644 --- a/include/asm-m68k/serial.h +++ b/include/asm-m68k/serial.h @@ -2,7 +2,7 @@ * include/asm-m68k/serial.h * * currently this seems useful only for a Q40, - * its an almost exact copy of ../asm-alpha/serial.h + * it's an almost exact copy of ../asm-alpha/serial.h * */ diff --git a/include/asm-m68k/smplock.h b/include/asm-m68k/smplock.h index 96565069c988..3e98a6afd154 100644 --- a/include/asm-m68k/smplock.h +++ b/include/asm-m68k/smplock.h @@ -18,7 +18,7 @@ do { \ if (task->lock_depth >= 0) \ spin_unlock(&kernel_flag); \ release_irqlock(cpu); \ - __sti(); \ + local_irq_enable(); \ } while (0) /* diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h index 3c53fe7b9cd2..d7e26cbf0532 100644 --- a/include/asm-m68k/sun3_pgtable.h +++ b/include/asm-m68k/sun3_pgtable.h @@ -99,11 +99,8 @@ * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -#define __mk_pte(page, pgprot) \ -({ pte_t __pte; pte_val(__pte) = (__pa(page) >> PAGE_SHIFT) | pgprot_val(pgprot); __pte; }) -#define mk_pte(page, pgprot) __mk_pte(page_address(page), (pgprot)) -#define mk_pte_phys(physpage, pgprot) \ -({ pte_t __pte; pte_val(__pte) = ((physpage) >> PAGE_SHIFT) | pgprot_val(pgprot); __pte; }) +#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) + extern inline pte_t pte_modify (pte_t pte, pgprot_t newprot) { pte_val(pte) = (pte_val(pte) & SUN3_PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } @@ -121,12 +118,12 @@ extern inline int pte_none (pte_t pte) { return !pte_val (pte); } extern inline int pte_present (pte_t pte) { return pte_val (pte) & SUN3_PAGE_VALID; } extern inline void pte_clear (pte_t *ptep) { pte_val (*ptep) = 0; } -/* FIXME: this is only a guess */ -#define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT) -/* Permanent address of a page. */ -#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) -#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) -#define pte_page(pte) (mem_map+pte_pagenr(pte)) +#define pte_pfn(pte) (pte_val(pte) & SUN3_PAGE_PGNUM_MASK) +#define pfn_pte(pfn, pgprot) \ +({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; }) + +#define pte_page(pte) (mem_map+((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT)) +#define pmd_page(pmd) (mem_map+((__pmd_page(pmd) - PAGE_OFFSET) >> PAGE_SHIFT)) extern inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } @@ -199,21 +196,13 @@ extern inline pmd_t *pmd_offset (pgd_t *pgd, unsigned long address) } /* Find an entry in the third-level pagetable. */ -#define pte_offset(pmd, address) \ -((pte_t *) __pmd_page (*pmd) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1))) - -/* Disable caching for page at given kernel virtual address. */ -static inline void nocache_page (unsigned long vaddr) -{ - /* Don't think this is required on sun3. --m */ -} - -/* Enable caching for page at given kernel virtual address. */ -static inline void cache_page (unsigned long vaddr) -{ - /* Don't think this is required on sun3. --m */ -} - +#define __pte_offset(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_offset_kernel(pmd, address) ((pte_t *) __pmd_page(*pmd) + __pte_offset(address)) +/* FIXME: should we bother with kmap() here? */ +#define pte_offset_map(pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + __pte_offset(address)) +#define pte_offset_map_nested(pmd, address) pte_offset_map(pmd, address) +#define pte_unmap(pte) kunmap(pte) +#define pte_unmap_nested(pte) kunmap(pte) #endif /* !__ASSEMBLY__ */ diff --git a/include/asm-m68k/suspend.h b/include/asm-m68k/suspend.h new file mode 100644 index 000000000000..57b3ddb4d269 --- /dev/null +++ b/include/asm-m68k/suspend.h @@ -0,0 +1,6 @@ +#ifndef _M68K_SUSPEND_H +#define _M68K_SUSPEND_H + +/* Dummy include. */ + +#endif /* _M68K_SUSPEND_H */ diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h index efc5ab8ff507..974db3b084b7 100644 --- a/include/asm-m68k/system.h +++ b/include/asm-m68k/system.h @@ -7,7 +7,10 @@ #include <asm/segment.h> #include <asm/entry.h> -#define prepare_to_switch() do { } while(0) +#define prepare_arch_schedule(prev) do { } while(0) +#define finish_arch_schedule(prev) do { } while(0) +#define prepare_arch_switch(rq) do { } while(0) +#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock) /* * switch_to(n) should switch tasks to task ptr, first checking that @@ -32,45 +35,39 @@ * 02/17/96 - Jes Sorensen (jds@kom.auc.dk) * * Changed 96/09/19 by Andreas Schwab - * pass prev in a0, next in a1, offset of tss in d1, and whether - * the mm structures are shared in d2 (to avoid atc flushing). + * pass prev in a0, next in a1 */ asmlinkage void resume(void); -#define switch_to(prev,next,last) { \ +#define switch_to(prev,next,last) do { \ register void *_prev __asm__ ("a0") = (prev); \ register void *_next __asm__ ("a1") = (next); \ - register void *_last __asm__ ("d1"); \ __asm__ __volatile__("jbsr resume" \ - : "=d" (_last) : "a" (_prev), "a" (_next) \ - : "d0", /* "d1", */ "d2", "d3", "d4", "d5", "a0", "a1"); \ - (last) = _last; \ -} + : : "a" (_prev), "a" (_next) \ + : "d0", "d1", "d2", "d3", "d4", "d5", "a0", "a1"); \ +} while (0) /* interrupt control.. */ #if 0 -#define __sti() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory") +#define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory") #else #include <asm/hardirq.h> -#define __sti() ({ \ +#define local_irq_enable() ({ \ if (MACH_IS_Q40 || !local_irq_count(smp_processor_id())) \ asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \ }) #endif -#define __cli() asm volatile ("oriw #0x0700,%%sr": : : "memory") -#define __save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory") -#define __restore_flags(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory") +#define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory") +#define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory") +#define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory") /* For spinlocks etc */ -#define local_irq_save(x) ({ __save_flags(x); __cli(); }) -#define local_irq_restore(x) __restore_flags(x) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() - -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) +#define local_irq_save(x) ({ local_save_flags(x); local_irq_disable(); }) + +#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(flags) do { save_flags(flags); cli(); } while(0) /* diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h new file mode 100644 index 000000000000..64c9f51e0c63 --- /dev/null +++ b/include/asm-m68k/thread_info.h @@ -0,0 +1,101 @@ +#ifndef _ASM_M68K_THREAD_INFO_H +#define _ASM_M68K_THREAD_INFO_H + +#include <asm/types.h> +#include <asm/processor.h> +#include <asm/page.h> + +struct thread_info { + struct task_struct *task; /* main task structure */ + struct exec_domain *exec_domain; /* execution domain */ + __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ + __u32 cpu; /* should always be 0 on m68k */ + + __u8 supervisor_stack[0]; +}; + +#define PREEMPT_ACTIVE 0x4000000 + +#define INIT_THREAD_INFO(tsk) \ +{ \ + task: &tsk, \ + exec_domain: &default_exec_domain, \ +} + +/* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */ +#if PAGE_SHIFT == 13 /* 8k machines */ +#define alloc_thread_info() ((struct thread_info *)__get_free_pages(GFP_KERNEL,0)) +#define free_thread_info(ti) free_pages((unsigned long)(ti),0) +#else /* otherwise assume 4k pages */ +#define alloc_thread_info() ((struct thread_info *)__get_free_pages(GFP_KERNEL,1)) +#define free_thread_info(ti) free_pages((unsigned long)(ti),1) +#endif /* PAGE_SHIFT == 13 */ + +#define init_thread_info (init_thread_union.thread_info) +#define init_stack (init_thread_union.stack) + +#define current_thread_info() (current->thread_info) + + +#define __HAVE_THREAD_FUNCTIONS + +#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ +#define TIF_DELAYED_TRACE 1 /* single step a syscall */ +#define TIF_NOTIFY_RESUME 2 /* resumption notification requested */ +#define TIF_SIGPENDING 3 /* signal pending */ +#define TIF_NEED_RESCHED 4 /* rescheduling necessary */ + +extern int thread_flag_fixme(void); + +/* + * flag set/clear/test wrappers + * - pass TIF_xxxx constants to these functions + */ + +#define __set_tsk_thread_flag(tsk, flag, val) ({ \ + switch (flag) { \ + case TIF_SIGPENDING: \ + tsk->thread.work.sigpending = val; \ + break; \ + case TIF_NEED_RESCHED: \ + tsk->thread.work.need_resched = val; \ + break; \ + default: \ + thread_flag_fixme(); \ + } \ +}) + +#define __get_tsk_thread_flag(tsk, flag) ({ \ + int ___res; \ + switch (flag) { \ + case TIF_SIGPENDING: \ + ___res = tsk->thread.work.sigpending; \ + break; \ + case TIF_NEED_RESCHED: \ + ___res = tsk->thread.work.need_resched; \ + break; \ + default: \ + ___res = thread_flag_fixme(); \ + } \ + ___res; \ +}) + +#define __get_set_tsk_thread_flag(tsk, flag, val) ({ \ + int __res = __get_tsk_thread_flag(tsk, flag); \ + __set_tsk_thread_flag(tsk, flag, val); \ + __res; \ +}) + +#define set_tsk_thread_flag(tsk, flag) __set_tsk_thread_flag(tsk, flag, ~0) +#define clear_tsk_thread_flag(tsk, flag) __set_tsk_thread_flag(tsk, flag, 0) +#define test_and_set_tsk_thread_flag(tsk, flag) __get_set_tsk_thread_flag(tsk, flag, ~0) +#define test_tsk_thread_flag(tsk, flag) __get_tsk_thread_flag(tsk, flag) + +#define set_thread_flag(flag) set_tsk_thread_flag(current, flag) +#define clear_thread_flag(flag) clear_tsk_thread_flag(current, flag) +#define test_thread_flag(flag) test_tsk_thread_flag(current, flag) + +#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) +#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) + +#endif /* _ASM_M68K_THREAD_INFO_H */ diff --git a/include/asm-m68k/tlb.h b/include/asm-m68k/tlb.h index 51cfcd3c4855..c90d49d13b74 100644 --- a/include/asm-m68k/tlb.h +++ b/include/asm-m68k/tlb.h @@ -7,7 +7,7 @@ */ #define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0) -#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) +#define tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) /* * .. because we flush the whole mm when it diff --git a/include/asm-m68k/tlbflush.h b/include/asm-m68k/tlbflush.h index 2ccbd0cf5380..503c9268b347 100644 --- a/include/asm-m68k/tlbflush.h +++ b/include/asm-m68k/tlbflush.h @@ -3,7 +3,9 @@ #ifndef CONFIG_SUN3 -extern inline void flush_tlb_kernel_page(unsigned long addr) +#include <asm/current.h> + +static inline void flush_tlb_kernel_page(void *addr) { if (CPU_IS_040_OR_060) { mm_segment_t old_fs = get_fs(); @@ -92,6 +94,13 @@ extern inline void flush_tlb_pgtables(struct mm_struct *mm, #else + +/* Reserved PMEGs. */ +extern char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; +extern unsigned long pmeg_vaddr[SUN3_PMEGS_NUM]; +extern unsigned char pmeg_alloc[SUN3_PMEGS_NUM]; +extern unsigned char pmeg_ctx[SUN3_PMEGS_NUM]; + /* Flush all userspace mappings one by one... (why no flush command, sun?) */ static inline void flush_tlb_all(void) diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h index 45d1588f28e3..92104425be80 100644 --- a/include/asm-m68k/types.h +++ b/include/asm-m68k/types.h @@ -49,9 +49,10 @@ typedef unsigned long long u64; #define BITS_PER_LONG 32 -/* DMA addresses are 32-bits wide */ +/* DMA addresses are always 32-bits wide */ typedef u32 dma_addr_t; +typedef u32 dma64_addr_t; #endif /* __KERNEL__ */ diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index f74e7052092d..9e7293d4c5f8 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h @@ -221,9 +221,23 @@ #define __NR_setgid32 214 #define __NR_setfsuid32 215 #define __NR_setfsgid32 216 +#define __NR_pivot_root 217 #define __NR_getdents64 220 #define __NR_gettid 221 #define __NR_tkill 222 +#define __NR_setxattr 223 +#define __NR_lsetxattr 224 +#define __NR_fsetxattr 225 +#define __NR_getxattr 226 +#define __NR_lgetxattr 227 +#define __NR_fgetxattr 228 +#define __NR_listxattr 229 +#define __NR_llistxattr 230 +#define __NR_flistxattr 231 +#define __NR_removexattr 232 +#define __NR_lremovexattr 233 +#define __NR_fremovexattr 234 +#define __NR_futex 235 /* user-visible error numbers are in the range -1 - -122: see <asm-m68k/errno.h> */ diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h index 4841264ab225..73a99d70a860 100644 --- a/include/asm-m68k/virtconvert.h +++ b/include/asm-m68k/virtconvert.h @@ -73,6 +73,10 @@ extern inline void * phys_to_virt(unsigned long address) } #endif +/* Permanent address of a page. */ +#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) +#define page_to_phys(page) virt_to_phys((void *)__page_address(page)) + /* * IO bus memory addresses are 1:1 with the physical address, * except on the PCI bus of the Hades. diff --git a/include/asm-m68k/zorro.h b/include/asm-m68k/zorro.h index fd5f4573631d..69a200802019 100644 --- a/include/asm-m68k/zorro.h +++ b/include/asm-m68k/zorro.h @@ -1,6 +1,7 @@ #ifndef _ASM_M68K_ZORRO_H #define _ASM_M68K_ZORRO_H -#include <asm/raw_io.h> + +#include <asm/io.h> #define z_readb raw_inb #define z_readw raw_inw @@ -14,22 +15,6 @@ #define z_memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) #define z_memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) - -/* Values for nocacheflag and cmode */ -#ifndef IOMAP_FULL_CACHING -#define IOMAP_FULL_CACHING 0 -#define IOMAP_NOCACHE_SER 1 -#define IOMAP_NOCACHE_NONSER 2 -#define IOMAP_WRITETHROUGH 3 -#endif - -extern void iounmap(void *addr); - -extern void *__ioremap(unsigned long physaddr, unsigned long size, - int cacheflag); -extern void __iounmap(void *addr, unsigned long size); - - extern inline void *z_remap_nocache_ser(unsigned long physaddr, unsigned long size) { diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index edff4c0fe86b..a8d323251189 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h @@ -29,10 +29,10 @@ * that dares to use kernel include files alive. */ #define __bi_flags unsigned long flags -#define __bi_cli() __cli() -#define __bi_save_flags(x) __save_flags(x) -#define __bi_save_and_cli(x) __save_and_cli(x) -#define __bi_restore_flags(x) __restore_flags(x) +#define __bi_cli() local_irq_disable() +#define __bi_save_flags(x) local_save_flags(x) +#define __bi_save_and_cli(x) local_irq_save(x) +#define __bi_restore_flags(x) local_irq_restore(x) #else #define __bi_flags #define __bi_cli() diff --git a/include/asm-mips/smplock.h b/include/asm-mips/smplock.h index 188c4b4c9eb3..43da07e41222 100644 --- a/include/asm-mips/smplock.h +++ b/include/asm-mips/smplock.h @@ -21,7 +21,7 @@ do { \ if (task->lock_depth >= 0) \ spin_unlock(&kernel_flag); \ release_irqlock(cpu); \ - __sti(); \ + local_irq_enable(); \ } while (0) /* diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h index 60aeb5b3bc8f..2ececd43d9c3 100644 --- a/include/asm-mips/system.h +++ b/include/asm-mips/system.h @@ -22,7 +22,7 @@ #include <linux/kernel.h> extern __inline__ void -__sti(void) +local_irq_enable(void) { __asm__ __volatile__( ".set\tpush\n\t" @@ -46,7 +46,7 @@ __sti(void) * no nops at all. */ extern __inline__ void -__cli(void) +local_irq_disable(void) { __asm__ __volatile__( ".set\tpush\n\t" @@ -66,7 +66,7 @@ __cli(void) : "$1", "memory"); } -#define __save_flags(x) \ +#define local_save_flags(x) \ __asm__ __volatile__( \ ".set\tpush\n\t" \ ".set\treorder\n\t" \ @@ -74,7 +74,7 @@ __asm__ __volatile__( \ ".set\tpop\n\t" \ : "=r" (x)) -#define __save_and_cli(x) \ +#define local_irq_save(x) \ __asm__ __volatile__( \ ".set\tpush\n\t" \ ".set\treorder\n\t" \ @@ -92,12 +92,12 @@ __asm__ __volatile__( \ : /* no inputs */ \ : "$1", "memory") -#define __restore_flags(flags) \ +#define local_irq_restore(flags) \ do { \ unsigned long __tmp1; \ \ __asm__ __volatile__( \ - ".set\tnoreorder\t\t\t# __restore_flags\n\t" \ + ".set\tnoreorder\t\t\t# local_irq_restore\n\t" \ ".set\tnoat\n\t" \ "mfc0\t$1, $12\n\t" \ "andi\t%0, 1\n\t" \ @@ -129,20 +129,14 @@ extern void __global_restore_flags(unsigned long); #else /* Single processor */ -# define sti() __sti() -# define cli() __cli() -# define save_flags(x) __save_flags(x) -# define save_and_cli(x) __save_and_cli(x) -# define restore_flags(x) __restore_flags(x) +# define sti() local_irq_enable() +# define cli() local_irq_disable() +# define save_flags(x) local_save_flags(x) +# define save_and_cli(x) local_irq_save(x) +# define restore_flags(x) local_irq_restore(x) #endif /* SMP */ -/* For spinlocks etc */ -#define local_irq_save(x) __save_and_cli(x); -#define local_irq_restore(x) __restore_flags(x); -#define local_irq_disable() __cli(); -#define local_irq_enable() __sti(); - /* * These are probably defined overly paranoid ... */ diff --git a/include/asm-mips64/smplock.h b/include/asm-mips64/smplock.h index f0b627e6a92e..68345b04d68f 100644 --- a/include/asm-mips64/smplock.h +++ b/include/asm-mips64/smplock.h @@ -22,7 +22,7 @@ static __inline__ void release_kernel_lock(struct task_struct *task, int cpu) if (task->lock_depth >= 0) spin_unlock(&kernel_flag); release_irqlock(cpu); - __sti(); + local_irq_enable(); } /* diff --git a/include/asm-mips64/system.h b/include/asm-mips64/system.h index dfb641fbff5a..908b885b1f1f 100644 --- a/include/asm-mips64/system.h +++ b/include/asm-mips64/system.h @@ -16,7 +16,7 @@ #include <linux/kernel.h> extern __inline__ void -__sti(void) +local_irq_enable(void) { __asm__ __volatile__( ".set\tnoreorder\n\t" @@ -40,7 +40,7 @@ __sti(void) * no nops at all. */ extern __inline__ void -__cli(void) +local_irq_disable(void) { __asm__ __volatile__( ".set\tnoreorder\n\t" @@ -59,14 +59,14 @@ __cli(void) : "$1", "memory"); } -#define __save_flags(x) \ +#define local_save_flags(x) \ __asm__ __volatile__( \ ".set\tnoreorder\n\t" \ "mfc0\t%0,$12\n\t" \ ".set\treorder" \ : "=r" (x)) -#define __save_and_cli(x) \ +#define local_irq_save(x) \ __asm__ __volatile__( \ ".set\tnoreorder\n\t" \ ".set\tnoat\n\t" \ @@ -83,12 +83,12 @@ __asm__ __volatile__( \ : /* no inputs */ \ : "$1", "memory") -#define __restore_flags(flags) \ +#define local_irq_restore(flags) \ do { \ unsigned long __tmp1; \ \ __asm__ __volatile__( \ - ".set\tnoreorder\t\t\t# __restore_flags\n\t" \ + ".set\tnoreorder\t\t\t# local_irq_restore\n\t" \ ".set\tnoat\n\t" \ "mfc0\t$1, $12\n\t" \ "andi\t%0, 1\n\t" \ @@ -120,20 +120,14 @@ extern void __global_restore_flags(unsigned long); #else -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) -#define save_and_cli(x) __save_and_cli(x) +#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 /* CONFIG_SMP */ -/* For spinlocks etc */ -#define local_irq_save(x) __save_and_cli(x); -#define local_irq_restore(x) __restore_flags(x); -#define local_irq_disable() __cli(); -#define local_irq_enable() __sti(); - /* * These are probably defined overly paranoid ... */ diff --git a/include/asm-parisc/smplock.h b/include/asm-parisc/smplock.h index 1590fafe9e1c..06fb015d5cb9 100644 --- a/include/asm-parisc/smplock.h +++ b/include/asm-parisc/smplock.h @@ -16,7 +16,7 @@ do { \ if (task->lock_depth >= 0) \ spin_unlock(&kernel_flag); \ release_irqlock(cpu); \ - __sti(); \ + local_irq_enable(); \ } while (0) /* diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h index 1f25634186f7..b5bfb03fe1aa 100644 --- a/include/asm-parisc/system.h +++ b/include/asm-parisc/system.h @@ -62,24 +62,22 @@ extern struct task_struct *_switch_to(struct task_struct *, struct task_struct * #endif /* interrupt control */ -#define __save_flags(x) __asm__ __volatile__("ssm 0, %0" : "=r" (x) : : "memory") -#define __restore_flags(x) __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory") -#define __cli() __asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" ) -#define __sti() __asm__ __volatile__("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory" ) +#define local_save_flags(x) __asm__ __volatile__("ssm 0, %0" : "=r" (x) : : "memory") +#define local_irq_restore(x) __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory") +#define local_irq_disable() __asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" ) +#define local_irq_enable() __asm__ __volatile__("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory" ) #define local_irq_save(x) \ __asm__ __volatile__("rsm %1,%0" : "=r" (x) :"i" (PSW_I) : "memory" ) #define local_irq_restore(x) \ __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory" ) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() #ifdef CONFIG_SMP #else -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) +#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) #endif diff --git a/include/asm-ppc/hw_irq.h b/include/asm-ppc/hw_irq.h index 71112a54a79b..e36d90289236 100644 --- a/include/asm-ppc/hw_irq.h +++ b/include/asm-ppc/hw_irq.h @@ -21,10 +21,10 @@ extern void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq); asm volatile("mfmsr %0" : "=r" (rval)); rval;}) #define mtmsr(v) asm volatile("mtmsr %0" : : "r" (v)) -#define __save_flags(flags) ((flags) = mfmsr()) -#define __restore_flags(flags) mtmsr(flags) +#define local_save_flags(flags) ((flags) = mfmsr()) +#define local_irq_restore(flags) mtmsr(flags) -static inline void __cli(void) +static inline void local_irq_disable(void) { unsigned long msr; msr = mfmsr(); @@ -32,7 +32,7 @@ static inline void __cli(void) __asm__ __volatile__("": : :"memory"); } -static inline void __sti(void) +static inline void local_irq_enable(void) { unsigned long msr; __asm__ __volatile__("": : :"memory"); @@ -49,18 +49,18 @@ static inline void __do_save_and_cli(unsigned long *flags) __asm__ __volatile__("": : :"memory"); } -#define __save_and_cli(flags) __do_save_and_cli(&flags) +#define local_irq_save(flags) __do_save_and_cli(&flags) #else -extern void __sti(void); -extern void __cli(void); -extern void __restore_flags(unsigned long); -extern void __save_flags_ptr(unsigned long *); -extern unsigned long __sti_end, __cli_end, __restore_flags_end, __save_flags_ptr_end; +extern void local_irq_enable(void); +extern void local_irq_disable(void); +extern void local_irq_restore(unsigned long); +extern void local_save_flags_ptr(unsigned long *); +extern unsigned long local_irq_enable_end, local_irq_disable_end, local_irq_restore_end, local_save_flags_ptr_end; -#define __save_flags(flags) __save_flags_ptr((unsigned long *)&flags) -#define __save_and_cli(flags) ({__save_flags(flags);__cli();}) +#define local_save_flags(flags) local_save_flags_ptr((unsigned long *)&flags) +#define local_irq_save(flags) ({local_save_flags(flags);local_irq_disable();}) #endif diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index 920752c47576..a9a6b1ac6aab 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -103,11 +103,11 @@ extern void dump_regs(struct pt_regs *); #ifndef CONFIG_SMP -#define cli() __cli() -#define sti() __sti() -#define save_flags(flags) __save_flags(flags) -#define restore_flags(flags) __restore_flags(flags) -#define save_and_cli(flags) __save_and_cli(flags) +#define cli() local_irq_disable() +#define sti() local_irq_enable() +#define save_flags(flags) local_save_flags(flags) +#define restore_flags(flags) local_irq_restore(flags) +#define save_and_cli(flags) local_irq_save(flags) #else /* CONFIG_SMP */ @@ -122,11 +122,6 @@ extern void __global_restore_flags(unsigned long); #endif /* !CONFIG_SMP */ -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() -#define local_irq_save(flags) __save_and_cli(flags) -#define local_irq_restore(flags) __restore_flags(flags) - static __inline__ unsigned long xchg_u32(volatile void *p, unsigned long val) { diff --git a/include/asm-ppc64/bitops.h b/include/asm-ppc64/bitops.h index 8c72a49b87ac..05c66df61a0a 100644 --- a/include/asm-ppc64/bitops.h +++ b/include/asm-ppc64/bitops.h @@ -43,7 +43,7 @@ static __inline__ int test_bit(unsigned long nr, __const__ volatile unsigned long *addr) { - return (1UL & (((__const__ long *) addr)[nr >> 6] >> (nr & 63))); + return (1UL & (addr[nr >> 6] >> (nr & 63))); } static __inline__ void set_bit(unsigned long nr, volatile unsigned long *addr) @@ -260,6 +260,12 @@ static __inline__ int ffs(int x) } /* + * fls: find last (most-significant) bit set. + * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. + */ +#define fls(x) generic_fls(x) + +/* * hweightN: returns the hamming weight (i.e. the number * of bits set) of a N-bit word */ diff --git a/include/asm-ppc64/cache.h b/include/asm-ppc64/cache.h index 00928de36087..cebb1eb14668 100644 --- a/include/asm-ppc64/cache.h +++ b/include/asm-ppc64/cache.h @@ -8,6 +8,9 @@ #define __ARCH_PPC64_CACHE_H /* bytes per L1 cache line */ -#define L1_CACHE_BYTES 128 +#define L1_CACHE_SHIFT 7 +#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) + +#define SMP_CACHE_BYTES L1_CACHE_BYTES #endif diff --git a/include/asm-ppc64/current.h b/include/asm-ppc64/current.h index 5b50ae7caa75..429487ddda16 100644 --- a/include/asm-ppc64/current.h +++ b/include/asm-ppc64/current.h @@ -1,6 +1,8 @@ #ifndef _PPC64_CURRENT_H #define _PPC64_CURRENT_H +#include <asm/paca.h> + /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -10,6 +12,9 @@ * Use r13 for current since the ppc64 ABI reserves it - Anton */ -register struct task_struct *current asm ("r13"); +#include <asm/thread_info.h> + +#define get_current() ((struct task_struct *)(get_paca()->xCurrent)) +#define current get_current() #endif /* !(_PPC64_CURRENT_H) */ diff --git a/include/asm-ppc64/hardirq.h b/include/asm-ppc64/hardirq.h index 29b07a4f69c2..b1eaf1f0674b 100644 --- a/include/asm-ppc64/hardirq.h +++ b/include/asm-ppc64/hardirq.h @@ -3,9 +3,6 @@ #define __ASM_HARDIRQ_H /* - * Use a brlock for the global irq lock, based on sparc64. - * Anton Blanchard <anton@au1.ibm.com> - * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -13,88 +10,38 @@ */ #include <linux/config.h> -#include <linux/brlock.h> -#include <linux/spinlock.h> - +#include <linux/preempt.h> typedef struct { unsigned long __softirq_pending; -#ifndef CONFIG_SMP - unsigned int __local_irq_count; -#else - unsigned int __unused_on_SMP; /* We use brlocks on SMP */ -#endif - unsigned int __local_bh_count; - unsigned int __syscall_count; - unsigned long idle_timestamp; + unsigned long __syscall_count; struct task_struct * __ksoftirqd_task; + unsigned long idle_timestamp; } ____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 ppc64 specific version for SMP */ -#ifndef CONFIG_SMP -#define irq_enter(cpu) (local_irq_count(cpu)++) -#define irq_exit(cpu) (local_irq_count(cpu)--) -#else -#undef local_irq_count -#define local_irq_count(cpu) (__brlock_array[cpu][BR_GLOBALIRQ_LOCK]) -#define irq_enter(cpu) br_read_lock(BR_GLOBALIRQ_LOCK) -#define irq_exit(cpu) br_read_unlock(BR_GLOBALIRQ_LOCK) -#endif +#define IRQ_OFFSET 64 /* * 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); }) - -/* This tests only the local processors hw IRQ context disposition. */ -#define in_irq() (local_irq_count(smp_processor_id()) != 0) - -#ifndef CONFIG_SMP +#define in_interrupt() \ + ((preempt_count() & ~PREEMPT_ACTIVE) >= IRQ_OFFSET) -#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) -#define hardirq_endlock(cpu) do { } while (0) +#define in_irq in_interrupt -#define synchronize_irq() barrier() -#define release_irqlock(cpu) do { } while (0) +#define hardirq_trylock() (!in_interrupt()) +#define hardirq_endlock() do { } while (0) -#else /* CONFIG_SMP */ - -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; - -static inline void release_irqlock(int cpu) -{ - /* if we didn't own the irq lock, just ignore... */ - if(global_irq_holder == (unsigned char) cpu) { - global_irq_holder = NO_PROC_ID; - br_write_unlock(BR_GLOBALIRQ_LOCK); - } -} - -static inline int hardirq_trylock(int cpu) -{ - spinlock_t *lock = &__br_write_locks[BR_GLOBALIRQ_LOCK].lock; - - return (!local_irq_count(cpu) && !spin_is_locked(lock)); -} - -#define hardirq_endlock(cpu) do { (void)(cpu); } while (0) - -extern void synchronize_irq(void); +#define irq_enter() (preempt_count() += IRQ_OFFSET) +#define irq_exit() (preempt_count() -= IRQ_OFFSET) +#ifndef CONFIG_SMP +# define synchronize_irq(irq) barrier() +#else + extern void synchronize_irq(unsigned int irq); #endif /* CONFIG_SMP */ #endif /* __KERNEL__ */ diff --git a/include/asm-ppc64/hw_irq.h b/include/asm-ppc64/hw_irq.h index 46bed74a35d4..3e030aa11ddd 100644 --- a/include/asm-ppc64/hw_irq.h +++ b/include/asm-ppc64/hw_irq.h @@ -26,18 +26,18 @@ extern unsigned long __no_use_save_flags(void); extern void __no_use_set_lost(unsigned long); extern void __no_lpq_restore_flags(unsigned long); -#define __cli() __no_use_cli() -#define __sti() __no_use_sti() -#define __save_flags(flags) ((flags) = __no_use_save_flags()) -#define __restore_flags(flags) __no_use_restore_flags((unsigned long)flags) -#define __save_and_cli(flags) ({__save_flags(flags);__cli();}) +#define local_irq_disable() __no_use_cli() +#define local_irq_enable() __no_use_sti() +#define local_save_flags(flags) ((flags) = __no_use_save_flags()) +#define local_irq_restore(flags) __no_use_restore_flags((unsigned long)flags) +#define local_irq_save(flags) ({local_save_flags(flags);local_irq_disable();}) #else -#define __save_flags(flags) ((flags) = mfmsr()) -#define __restore_flags(flags) __mtmsrd((flags), 1) +#define local_save_flags(flags) ((flags) = mfmsr()) +#define local_irq_restore(flags) __mtmsrd((flags), 1) -static inline void __cli(void) +static inline void local_irq_disable(void) { unsigned long msr; msr = mfmsr(); @@ -45,7 +45,7 @@ static inline void __cli(void) __asm__ __volatile__("": : :"memory"); } -static inline void __sti(void) +static inline void local_irq_enable(void) { unsigned long msr; __asm__ __volatile__("": : :"memory"); @@ -62,7 +62,7 @@ static inline void __do_save_and_cli(unsigned long *flags) __asm__ __volatile__("": : :"memory"); } -#define __save_and_cli(flags) __do_save_and_cli(&flags) +#define local_irq_save(flags) __do_save_and_cli(&flags) #endif /* CONFIG_PPC_ISERIES */ diff --git a/include/asm-ppc64/iSeries/HvCall.h b/include/asm-ppc64/iSeries/HvCall.h index 67bf68170f0c..dfa28eba4e51 100644 --- a/include/asm-ppc64/iSeries/HvCall.h +++ b/include/asm-ppc64/iSeries/HvCall.h @@ -130,6 +130,9 @@ enum HvCall_VaryOffChunkRc #define HvCallBaseRouter28 HvCallBase + 28 #define HvCallBaseRouter29 HvCallBase + 29 #define HvCallBaseRouter30 HvCallBase + 30 + +#define HvCallCcSetDABR HvCallCc + 7 + //===================================================================================== static inline void HvCall_setVirtualDecr(void) { @@ -197,6 +200,10 @@ static inline void HvCall_terminateMachineSrc(void) HvCall0( HvCallBaseTerminateMachineSrc ); } +static inline void HvCall_setDABR(unsigned long val) +{ + HvCall1(HvCallCcSetDABR, val); +} #endif // _HVCALL_H diff --git a/include/asm-ppc64/iSeries/HvCallHpt.h b/include/asm-ppc64/iSeries/HvCallHpt.h index 65962a5c9534..ac93fa224ceb 100644 --- a/include/asm-ppc64/iSeries/HvCallHpt.h +++ b/include/asm-ppc64/iSeries/HvCallHpt.h @@ -106,21 +106,21 @@ static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson, u8 return compressedStatus; } //============================================================================= -static inline u64 HvCallHpt_findValid( struct HPTE *hpte, u64 vpn ) +static inline u64 HvCallHpt_findValid( HPTE *hpte, u64 vpn ) { u64 retIndex = HvCall3Ret16( HvCallHptFindValid, hpte, vpn, 0, 0 ); // getPaca()->adjustHmtForNoOfSpinLocksHeld(); return retIndex; } //============================================================================= -static inline u64 HvCallHpt_findNextValid( struct HPTE *hpte, u32 hpteIndex, u8 bitson, u8 bitsoff ) +static inline u64 HvCallHpt_findNextValid( HPTE *hpte, u32 hpteIndex, u8 bitson, u8 bitsoff ) { u64 retIndex = HvCall3Ret16( HvCallHptFindNextValid, hpte, hpteIndex, bitson, bitsoff ); // getPaca()->adjustHmtForNoOfSpinLocksHeld(); return retIndex; } //============================================================================= -static inline void HvCallHpt_get( struct HPTE *hpte, u32 hpteIndex ) +static inline void HvCallHpt_get( HPTE *hpte, u32 hpteIndex ) { HvCall2Ret16( HvCallHptGet, hpte, hpteIndex, 0 ); // getPaca()->adjustHmtForNoOfSpinLocksHeld(); @@ -128,7 +128,7 @@ static inline void HvCallHpt_get( struct HPTE *hpte, u32 hpteIndex ) //============================================================================ static inline void HvCallHpt_addValidate( u32 hpteIndex, u32 hBit, - struct HPTE *hpte ) + HPTE *hpte ) { HvCall4( HvCallHptAddValidate, hpteIndex, diff --git a/include/asm-ppc64/iSeries/HvCallSc.h b/include/asm-ppc64/iSeries/HvCallSc.h index 89080ff7973a..9a2692eb5bf4 100644 --- a/include/asm-ppc64/iSeries/HvCallSc.h +++ b/include/asm-ppc64/iSeries/HvCallSc.h @@ -25,6 +25,7 @@ #define _HVCALLSC_H #define HvCallBase 0x8000000000000000 +#define HvCallCc 0x8001000000000000 #define HvCallCfg 0x8002000000000000 #define HvCallEvent 0x8003000000000000 #define HvCallHpt 0x8004000000000000 diff --git a/include/asm-ppc64/iSeries/ItExtVpdPanel.h b/include/asm-ppc64/iSeries/ItExtVpdPanel.h new file mode 100644 index 000000000000..74581194a9eb --- /dev/null +++ b/include/asm-ppc64/iSeries/ItExtVpdPanel.h @@ -0,0 +1,60 @@ +/* + * ItExtVpdPanel.h + * Copyright (C) 2002 Dave Boutcher IBM Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * + * This struct maps the panel information + * + * Warning: + * This data must match the architecture for the panel information + * + */ + + +/*------------------------------------------------------------------- + * Standard Includes + *------------------------------------------------------------------- +*/ +#ifndef _PPC_TYPES_H +#include <asm/types.h> +#endif + +#ifndef _ITEXTVPDPANEL_H +#define _ITEXTVPDPANEL_H +struct ItExtVpdPanel +{ + // Definition of the Extended Vpd On Panel Data Area + char systemSerial[8]; + char mfgID[4]; + char reserved1[24]; + char machineType[4]; + char systemID[6]; + char somUniqueCnt[4]; + char serialNumberCount; + char reserved2[7]; + u16 bbu3; + u16 bbu2; + u16 bbu1; + char xLocationLabel[8]; + u8 xRsvd1[6]; + u16 xFrameId; + u8 xRsvd2[48]; +}; + +#endif /* _ITEXTVPDPANEL_H */ diff --git a/include/asm-ppc64/iSeries/LparData.h b/include/asm-ppc64/iSeries/LparData.h index 61f7769ef2fa..46300fbc0171 100644 --- a/include/asm-ppc64/iSeries/LparData.h +++ b/include/asm-ppc64/iSeries/LparData.h @@ -37,6 +37,7 @@ #include <asm/iSeries/LparMap.h> #include <asm/iSeries/ItVpdAreas.h> #include <asm/iSeries/ItIplParmsReal.h> +#include <asm/iSeries/ItExtVpdPanel.h> #include <asm/iSeries/ItLpQueue.h> #include <asm/iSeries/IoHriProcessorVpd.h> #include <asm/page.h> @@ -45,6 +46,7 @@ extern struct LparMap xLparMap; extern struct HvReleaseData hvReleaseData; extern struct ItLpNaca itLpNaca; extern struct ItIplParmsReal xItIplParmsReal; +extern struct ItExtVpdPanel xItExtVpdPanel; extern struct IoHriProcessorVpd xIoHriProcessorVpd[]; extern struct ItLpQueue xItLpQueue; extern struct ItVpdAreas itVpdAreas; diff --git a/include/asm-ppc64/init.h b/include/asm-ppc64/init.h index e02538ba3f91..17d215574183 100644 --- a/include/asm-ppc64/init.h +++ b/include/asm-ppc64/init.h @@ -1,29 +1 @@ -#ifndef _PPC64_INIT_H -#define _PPC64_INIT_H - -#include <linux/init.h> - -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 90 /* egcs */ -/* DRENG add back in when we get section attribute support */ -#define __chrp __attribute__ ((__section__ (".text.chrp"))) -#define __chrpdata __attribute__ ((__section__ (".data.chrp"))) -#define __chrpfunc(__argchrp) \ - __argchrp __chrp; \ - __argchrp - -/* this is actually just common chrp/pmac code, not OF code -- Cort */ -#define __openfirmware __attribute__ ((__section__ (".text.openfirmware"))) -#define __openfirmwaredata __attribute__ ((__section__ (".data.openfirmware"))) -#define __openfirmwarefunc(__argopenfirmware) \ - __argopenfirmware __openfirmware; \ - __argopenfirmware - -#else /* not egcs */ - -#define __openfirmware -#define __openfirmwaredata -#define __openfirmwarefunc(x) x - -#endif /* egcs */ - -#endif /* _PPC64_INIT_H */ +#error "<asm/init.h> should never be used - use <linux/init.h> instead" diff --git a/include/asm-ppc64/lmb.h b/include/asm-ppc64/lmb.h index 549f63f62b6a..adf84395a03b 100644 --- a/include/asm-ppc64/lmb.h +++ b/include/asm-ppc64/lmb.h @@ -13,6 +13,7 @@ * 2 of the License, or (at your option) any later version. */ +#include <linux/config.h> #include <asm/prom.h> extern unsigned long reloc_offset(void); diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index f076955d5d60..5b78e41bff20 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h @@ -62,7 +62,7 @@ struct machdep_calls { int msg, unsigned long data, int wait); - int (*smp_probe)(void); + void (*smp_probe)(void); void (*smp_kick_cpu)(int nr); void (*smp_setup_cpu)(int nr); diff --git a/include/asm-ppc64/md.h b/include/asm-ppc64/md.h deleted file mode 100644 index 757fc80ecbae..000000000000 --- a/include/asm-ppc64/md.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * md.h: High speed xor_block operation for RAID4/5 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifndef __ASM_MD_H -#define __ASM_MD_H - -/* #define HAVE_ARCH_XORBLOCK */ - -#define MD_XORBLOCK_ALIGNMENT sizeof(long) - -#endif /* __ASM_MD_H */ diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h new file mode 100644 index 000000000000..544b30060eca --- /dev/null +++ b/include/asm-ppc64/mmzone.h @@ -0,0 +1,93 @@ +/* + * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99 + * + * PowerPC64 port: + * Copyright (C) 2002 Anton Blanchard, IBM Corp. + */ +#ifndef _ASM_MMZONE_H_ +#define _ASM_MMZONE_H_ + +#include <linux/config.h> + +typedef struct plat_pglist_data { + pg_data_t gendata; +} plat_pg_data_t; + +/* + * Following are macros that are specific to this numa platform. + */ + +extern plat_pg_data_t plat_node_data[]; + +#define MAX_NUMNODES 4 + +/* XXX grab this from the device tree - Anton */ +#define PHYSADDR_TO_NID(pa) ((pa) >> 36) +#define PLAT_NODE_DATA(n) (&plat_node_data[(n)]) +#define PLAT_NODE_DATA_STARTNR(n) \ + (PLAT_NODE_DATA(n)->gendata.node_start_mapnr) +#define PLAT_NODE_DATA_SIZE(n) (PLAT_NODE_DATA(n)->gendata.node_size) +#define PLAT_NODE_DATA_LOCALNR(p, n) \ + (((p) - PLAT_NODE_DATA(n)->gendata.node_start_paddr) >> PAGE_SHIFT) + +#ifdef CONFIG_DISCONTIGMEM + +/* + * Following are macros that each numa implmentation must define. + */ + +/* + * Given a kernel address, find the home node of the underlying memory. + */ +#define KVADDR_TO_NID(kaddr) PHYSADDR_TO_NID(__pa(kaddr)) + +/* + * Return a pointer to the node data for node n. + */ +#define NODE_DATA(n) (&((PLAT_NODE_DATA(n))->gendata)) + +/* + * NODE_MEM_MAP gives the kaddr for the mem_map of the node. + */ +#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map) + +/* + * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory + * and returns the mem_map of that node. + */ +#define ADDR_TO_MAPBASE(kaddr) \ + NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr))) + +/* + * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory + * and returns the kaddr corresponding to first physical page in the + * node's mem_map. + */ +#define LOCAL_BASE_ADDR(kaddr) \ + ((unsigned long)__va(NODE_DATA(KVADDR_TO_NID(kaddr))->node_start_paddr)) + +#define LOCAL_MAP_NR(kvaddr) \ + (((unsigned long)(kvaddr)-LOCAL_BASE_ADDR(kvaddr)) >> PAGE_SHIFT) + +#if 0 +/* XXX fix - Anton */ +#define kern_addr_valid(kaddr) test_bit(LOCAL_MAP_NR(kaddr), \ + NODE_DATA(KVADDR_TO_NID(kaddr))->valid_addr_bitmap) +#endif + +#define discontigmem_pfn_to_page(pfn) \ +({ \ + unsigned long kaddr = (unsigned long)__va(pfn << PAGE_SHIFT); \ + (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr)); \ +}) + +#ifdef CONFIG_NUMA + +/* XXX grab this from the device tree - Anton */ +#define cputonode(cpu) ((cpu) >> 3) + +#define numa_node_id() cputonode(smp_processor_id()) + +#endif /* CONFIG_NUMA */ +#endif /* CONFIG_DISCONTIGMEM */ +#endif /* _ASM_MMZONE_H_ */ diff --git a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h index ed28065ae2a7..082d5bfa15fe 100644 --- a/include/asm-ppc64/naca.h +++ b/include/asm-ppc64/naca.h @@ -18,7 +18,6 @@ struct naca_struct { u64 xRamDiskSize; /* In pages */ struct paca_struct *paca; /* Ptr to an array of pacas */ u64 debug_switch; /* Bits to control debug printing */ - u16 processorCount; /* # of physical processors */ u16 dCacheL1LineSize; /* Line size of L1 DCache in bytes */ u16 dCacheL1LogLineSize; /* Log-2 of DCache line size */ u16 dCacheL1LinesPerPage; /* DCache lines per page */ diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h index 32e7ba98d1f7..7d3ca6726fe0 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-ppc64/paca.h @@ -45,7 +45,8 @@ #define MAX_PACAS MAX_PROCESSORS * 2 extern struct paca_struct paca[]; -#define get_paca() ((struct paca_struct *)mfspr(SPRG3)) +register struct paca_struct *local_paca asm("r13"); +#define get_paca() local_paca /*============================================================================ * Name_______: paca @@ -71,7 +72,7 @@ struct paca_struct { struct ItLpRegSave *xLpRegSavePtr; /* Pointer to LpRegSave for PLIC 0x08 */ u64 xCurrent; /* Pointer to current 0x10 */ u16 xPacaIndex; /* Logical processor number 0x18 */ - u16 xHwProcNum; /* Actual Hardware Processor Number 0x1a */ + u16 active; /* Is this cpu active? 0x1a */ u32 default_decr; /* Default decrementer value 0x1c */ u64 xHrdIntStack; /* Stack for hardware interrupts 0x20 */ u64 xKsave; /* Saved Kernel stack addr or zero 0x28 */ diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index 8cb19727c4aa..bf0c552f61a5 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h @@ -33,24 +33,13 @@ #ifndef __ASSEMBLY__ #include <asm/naca.h> -#define STRICT_MM_TYPECHECKS +#undef STRICT_MM_TYPECHECKS #define REGION_SIZE 4UL -#define OFFSET_SIZE 60UL #define REGION_SHIFT 60UL -#define OFFSET_SHIFT 0UL #define REGION_MASK (((1UL<<REGION_SIZE)-1UL)<<REGION_SHIFT) #define REGION_STRIDE (1UL << REGION_SHIFT) -typedef union ppc64_va { - struct { - unsigned long off : OFFSET_SIZE; /* intra-region offset */ - unsigned long reg : REGION_SIZE; /* region number */ - } f; - unsigned long l; - void *p; -} ppc64_va; - static __inline__ void clear_page(void *addr) { unsigned long lines, line_size; @@ -70,8 +59,8 @@ static __inline__ void clear_page(void *addr) extern void copy_page(void *to, void *from); struct page; -extern void clear_user_page(void *page, unsigned long vaddr); -extern void copy_user_page(void *to, void *from, unsigned long vaddr); +extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); +extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *p); #ifdef STRICT_MM_TYPECHECKS /* @@ -215,8 +204,15 @@ static inline int get_order(unsigned long size) #define __a2p(x) ((void *) absolute_to_phys(x)) #define __a2v(x) ((void *) __va(absolute_to_phys(x))) +#ifdef CONFIG_DISCONTIGMEM +#define page_to_pfn(page) \ + ((page) - page_zone(page)->zone_mem_map + \ + (page_zone(page)->zone_start_paddr >> PAGE_SHIFT)) +#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) +#else #define pfn_to_page(pfn) (mem_map + (pfn)) -#define page_to_pfn(pfn) ((unsigned long)((pfn) - mem_map)) +#define page_to_pfn(page) ((unsigned long)((page) - mem_map)) +#endif #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define pfn_valid(pfn) ((pfn) < max_mapnr) diff --git a/include/asm-ppc64/param.h b/include/asm-ppc64/param.h index 96f086dcc51f..43e6f5d93b69 100644 --- a/include/asm-ppc64/param.h +++ b/include/asm-ppc64/param.h @@ -8,18 +8,14 @@ * 2 of the License, or (at your option) any later version. */ -#ifndef HZ -#define HZ 1024 #ifdef __KERNEL__ -#if HZ == 100 -/* ppc (like X86) is defined to provide userspace with a world where HZ=100 - We have to do this, (x*const)/const2 isnt optimised out because its not - a null operation as it might overflow.. */ -#define hz_to_std(a) (a) -#else -#define hz_to_std(a) ((a)*(100/HZ)+((a)*(100%HZ))/HZ) -#endif +# define HZ 1000 /* 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 @@ -34,8 +30,4 @@ #define MAXHOSTNAMELEN 64 /* max length of hostname */ -#ifdef __KERNEL__ -# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ -#endif - #endif /* _ASM_PPC64_PARAM_H */ diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h index 808c5a6c6e99..b5b445ca7fe3 100644 --- a/include/asm-ppc64/pgalloc.h +++ b/include/asm-ppc64/pgalloc.h @@ -53,6 +53,8 @@ pmd_free(pmd_t *pmd) free_page((unsigned long)pmd); } +#define pmd_free_tlb(tlb, pmd) pmd_free(pmd) + #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) #define pmd_populate(mm, pmd, pte_page) \ pmd_populate_kernel(mm, pmd, page_address(pte_page)) @@ -86,6 +88,7 @@ pte_free_kernel(pte_t *pte) } #define pte_free(pte_page) pte_free_kernel(page_address(pte_page)) +#define pte_free_tlb(tlb, pte) pte_free(pte) #define check_pgt_cache() do { } while (0) diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h index e546e3f0f88c..5eedbc705e13 100644 --- a/include/asm-ppc64/pgtable.h +++ b/include/asm-ppc64/pgtable.h @@ -12,11 +12,6 @@ #include <asm/page.h> #endif /* __ASSEMBLY__ */ -/* Certain architectures need to do special things when pte's - * within a page table are directly modified. Thus, the following - * hook is made available. - */ - /* PMD_SHIFT determines what a second-level page table entry can map */ #define PMD_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) #define PMD_SIZE (1UL << PMD_SHIFT) @@ -107,9 +102,9 @@ /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HPTEFLAGS) -#define _PAGE_BASE _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT +#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) -#define _PAGE_WRENABLE _PAGE_RW | _PAGE_DIRTY +#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY) /* __pgprot defined in asm-ppc64/page.h */ #define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) @@ -330,8 +325,6 @@ static inline void pte_clear(pte_t * ptep) pte_update(ptep, ~_PAGE_HPTEFLAGS, 0); } -extern unsigned long va_to_phys(unsigned long address); -extern pte_t *va_to_pte(unsigned long address); extern unsigned long ioremap_bot, ioremap_base; #define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT) @@ -356,6 +349,7 @@ extern void paging_init(void); * ahead of time, instead of waiting for the inevitable extra * hash-table miss exception. */ +struct vm_area_struct; extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); /* Encode and de-code a swap entry */ @@ -380,12 +374,8 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); */ #define pgtable_cache_init() do { } while (0) -extern void updateBoltedHptePP(unsigned long newpp, unsigned long ea); extern void hpte_init_pSeries(void); extern void hpte_init_iSeries(void); -extern void make_pte(HPTE * htab, unsigned long va, unsigned long pa, - int mode, unsigned long hash_mask, int large); - #endif /* __ASSEMBLY__ */ #endif /* _PPC64_PGTABLE_H */ diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h index 024cc61849f9..44181b974714 100644 --- a/include/asm-ppc64/processor.h +++ b/include/asm-ppc64/processor.h @@ -483,10 +483,12 @@ #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ /* Processor Version Numbers */ +#define PV_NORTHSTAR 0x0033 #define PV_PULSAR 0x0034 #define PV_POWER4 0x0035 #define PV_ICESTAR 0x0036 #define PV_SSTAR 0x0037 +#define PV_POWER4p 0x0038 #define PV_630 0x0040 #define PV_630p 0x0041 @@ -711,6 +713,18 @@ static inline void prefetchw(const void *x) #define spin_lock_prefetch(x) prefetchw(x) +#define cpu_has_largepage() (__is_processor(PV_POWER4) || \ + __is_processor(PV_POWER4p)) + +#define cpu_has_slb() (__is_processor(PV_POWER4) || \ + __is_processor(PV_POWER4p)) + +#define cpu_has_tlbiel() (__is_processor(PV_POWER4) || \ + __is_processor(PV_POWER4p)) + +#define cpu_has_noexecute() (__is_processor(PV_POWER4) || \ + __is_processor(PV_POWER4p)) + #endif /* ASSEMBLY */ #endif /* __ASM_PPC64_PROCESSOR_H */ diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h index f41349e35a63..8000efeb044f 100644 --- a/include/asm-ppc64/prom.h +++ b/include/asm-ppc64/prom.h @@ -195,8 +195,5 @@ extern void print_properties(struct device_node *node); extern int prom_n_addr_cells(struct device_node* np); extern int prom_n_size_cells(struct device_node* np); extern void prom_get_irq_senses(unsigned char *senses, int off, int max); -extern void prom_drawstring(const char *c); -extern void prom_drawhex(unsigned long v); -extern void prom_drawchar(char c); #endif /* _PPC64_PROM_H */ diff --git a/include/asm-ppc64/ptrace-common.h b/include/asm-ppc64/ptrace-common.h new file mode 100644 index 000000000000..68b8ee69b48f --- /dev/null +++ b/include/asm-ppc64/ptrace-common.h @@ -0,0 +1,55 @@ +/* + * linux/arch/ppc64/kernel/ptrace-common.h + * + * Copyright (c) 2002 Stephen Rothwell, IBM Coproration + * Extracted from ptrace.c and ptrace32.c + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file README.legal in the main directory of + * this archive for more details. + */ + +/* + * Set of msr bits that gdb can change on behalf of a process. + */ +#define MSR_DEBUGCHANGE (MSR_FE0 | MSR_SE | MSR_BE | MSR_FE1) + +/* + * Get contents of register REGNO in task TASK. + */ +static inline unsigned long get_reg(struct task_struct *task, int regno) +{ + if (regno < (sizeof(struct pt_regs) / sizeof(unsigned long))) + return ((unsigned long *)task->thread.regs)[regno]; + return 0; +} + +/* + * Write contents of register REGNO in task TASK. + */ +static inline int put_reg(struct task_struct *task, int regno, + unsigned long data) +{ + if (regno < PT_SOFTE) { + if (regno == PT_MSR) + data = (data & MSR_DEBUGCHANGE) + | (task->thread.regs->msr & ~MSR_DEBUGCHANGE); + ((unsigned long *)task->thread.regs)[regno] = data; + return 0; + } + return -EIO; +} + +static inline void set_single_step(struct task_struct *task) +{ + struct pt_regs *regs = task->thread.regs; + if (regs != NULL) + regs->msr |= MSR_SE; +} + +static inline void clear_single_step(struct task_struct *task) +{ + struct pt_regs *regs = task->thread.regs; + if (regs != NULL) + regs->msr &= ~MSR_SE; +} diff --git a/include/asm-ppc64/rmap.h b/include/asm-ppc64/rmap.h new file mode 100644 index 000000000000..cf58a01ecfa2 --- /dev/null +++ b/include/asm-ppc64/rmap.h @@ -0,0 +1,9 @@ +#ifndef _PPC64_RMAP_H +#define _PPC64_RMAP_H + +/* PPC64 calls pte_alloc() before mem_map[] is setup ... */ +#define BROKEN_PPC_PTE_ALLOC_ONE + +#include <asm-generic/rmap.h> + +#endif diff --git a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h index e55d2a9c6728..a41a208cd4ee 100644 --- a/include/asm-ppc64/rtas.h +++ b/include/asm-ppc64/rtas.h @@ -2,6 +2,7 @@ #define _PPC64_RTAS_H #include <linux/spinlock.h> +#include <asm/page.h> /* * Definitions for talking to the RTAS on CHRP machines. @@ -128,6 +129,29 @@ struct rtas_error_log { unsigned char buffer[1]; /* allocated by klimit bump */ }; +struct flash_block { + char *data; + unsigned long length; +}; + +/* This struct is very similar but not identical to + * that needed by the rtas flash update. + * All we need to do for rtas is rewrite num_blocks + * into a version/length and translate the pointers + * to absolute. + */ +#define FLASH_BLOCKS_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct flash_block)) +struct flash_block_list { + unsigned long num_blocks; + struct flash_block_list *next; + struct flash_block blocks[FLASH_BLOCKS_PER_NODE]; +}; +struct flash_block_list_header { /* just the header of flash_block_list */ + unsigned long num_blocks; + struct flash_block_list *next; +}; +extern struct flash_block_list_header rtas_firmware_flash_list; + extern struct rtas_t rtas; extern void enter_rtas(struct rtas_args *); @@ -140,4 +164,7 @@ extern void rtas_restart(char *cmd); extern void rtas_power_off(void); extern void rtas_halt(void); +extern struct proc_dir_entry *rtas_proc_dir; + + #endif /* _PPC64_RTAS_H */ diff --git a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h index 305b69fa3c82..d2ca9cc9cf1c 100644 --- a/include/asm-ppc64/smp.h +++ b/include/asm-ppc64/smp.h @@ -39,16 +39,27 @@ extern void smp_send_reschedule_all(void); #define NO_PROC_ID 0xFF /* No processor magic marker */ -/* 1 to 1 mapping on PPC -- Cort */ -#define cpu_logical_map(cpu) (cpu) -#define cpu_number_map(x) (x) +#define cpu_online(cpu) test_bit((cpu), &cpu_online_map) + +#define cpu_possible(cpu) paca[cpu].active + +static inline int num_online_cpus(void) +{ + int i, nr = 0; + + for (i = 0; i < NR_CPUS; i++) + nr += test_bit(i, &cpu_online_map); + + return nr; +} + extern volatile unsigned long cpu_callin_map[NR_CPUS]; #define smp_processor_id() (get_paca()->xPacaIndex) -#define hard_smp_processor_id() (get_paca()->xHwProcNum) -#define get_hard_smp_processor_id(CPU) (paca[(CPU)].xHwProcNum) - +/* remove when the boot sequence gets rewritten to use hotplug interface */ +extern int boot_cpuid; +extern int ppc64_is_smp; /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. * diff --git a/include/asm-ppc64/smplock.h b/include/asm-ppc64/smplock.h index 1aeed4e4a01b..16b0b2f72b0c 100644 --- a/include/asm-ppc64/smplock.h +++ b/include/asm-ppc64/smplock.h @@ -18,13 +18,10 @@ extern spinlock_t kernel_flag; /* * Release global kernel lock and global interrupt lock */ -#define release_kernel_lock(task, cpu) \ +#define release_kernel_lock(task) \ do { \ - if (unlikely(task->lock_depth >= 0)) { \ + if (unlikely(task->lock_depth >= 0)) \ spin_unlock(&kernel_flag); \ - if (global_irq_holder == (cpu)) \ - BUG(); \ - } \ } while (0) /* diff --git a/include/asm-ppc64/softirq.h b/include/asm-ppc64/softirq.h index 471f464061ab..e9a2a345e79a 100644 --- a/include/asm-ppc64/softirq.h +++ b/include/asm-ppc64/softirq.h @@ -8,22 +8,28 @@ * 2 of the License, or (at your option) any later version. */ -#include <asm/atomic.h> +#include <linux/preempt.h> #include <asm/hardirq.h> - -#define local_bh_disable() do { local_bh_count(smp_processor_id())++; barrier(); } while (0) -#define __local_bh_enable() do { barrier(); local_bh_count(smp_processor_id())--; } while (0) - -#define local_bh_enable() \ -do { \ - if (!--local_bh_count(smp_processor_id()) \ - && softirq_pending(smp_processor_id())) { \ - do_softirq(); \ - } \ +#define local_bh_disable() \ + do { preempt_count() += IRQ_OFFSET; barrier(); } while (0) + +#define __local_bh_enable() \ + do { barrier(); preempt_count() -= IRQ_OFFSET; } while (0) + +#define local_bh_enable() \ +do { \ + if (unlikely((preempt_count() == IRQ_OFFSET) && \ + softirq_pending(smp_processor_id()))) { \ + __local_bh_enable(); \ + do_softirq(); \ + preempt_check_resched(); \ + } else { \ + __local_bh_enable(); \ + preempt_check_resched(); \ + } \ } while (0) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) +#define in_softirq() in_interrupt() #endif /* __ASM_SOFTIRQ_H */ diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h index a6882fe53f77..c962606c6d43 100644 --- a/include/asm-ppc64/system.h +++ b/include/asm-ppc64/system.h @@ -9,20 +9,12 @@ */ #include <linux/config.h> -#include <linux/kdev_t.h> #include <asm/page.h> #include <asm/processor.h> #include <asm/hw_irq.h> #include <asm/memory.h> /* - * System defines. - */ -#define KERNEL_START_PHYS 0x800000 -#define KERNEL_START (PAGE_OFFSET+KERNEL_START_PHYS) -#define START_ADDR (PAGE_OFFSET+KERNEL_START_PHYS+0x00000) - -/* * Memory barrier. * The sync instruction guarantees that all memory accesses initiated * by this processor have been performed (with respect to all other @@ -85,28 +77,21 @@ extern void (*xmon_fault_handler)(struct pt_regs *regs); extern void print_backtrace(unsigned long *); extern void show_regs(struct pt_regs * regs); extern void flush_instruction_cache(void); -extern void hard_reset_now(void); -extern void poweroff_now(void); extern int _get_PVR(void); -extern long _get_L2CR(void); -extern void _set_L2CR(unsigned long); -extern void via_cuda_init(void); -extern void pmac_nvram_init(void); -extern void pmac_find_display(void); extern void giveup_fpu(struct task_struct *); extern void enable_kernel_fp(void); -extern void giveup_altivec(struct task_struct *); -extern void load_up_altivec(struct task_struct *); extern void cvt_fd(float *from, double *to, unsigned long *fpscr); extern void cvt_df(double *from, float *to, unsigned long *fpscr); extern int abs(int); -struct device_node; - struct task_struct; -#define prepare_to_switch() do { } while(0) -#define switch_to(prev,next) _switch_to((prev),(next)) -extern void _switch_to(struct task_struct *, struct task_struct *); +extern void __switch_to(struct task_struct *, struct task_struct *); +#define switch_to(prev, next, last) __switch_to((prev), (next)) + +#define prepare_arch_schedule(prev) do { } while(0) +#define finish_arch_schedule(prev) do { } while(0) +#define prepare_arch_switch(rq) do { } while(0) +#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock) struct thread_struct; extern void _switch(struct thread_struct *prev, struct thread_struct *next); @@ -116,30 +101,14 @@ extern void dump_regs(struct pt_regs *); #ifndef CONFIG_SMP -#define cli() __cli() -#define sti() __sti() -#define save_flags(flags) __save_flags(flags) -#define restore_flags(flags) __restore_flags(flags) -#define save_and_cli(flags) __save_and_cli(flags) - -#else /* 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) +#define cli() local_irq_disable() +#define sti() local_irq_enable() +#define save_flags(flags) local_save_flags(flags) +#define restore_flags(flags) local_irq_restore(flags) +#define save_and_cli(flags) local_irq_save(flags) #endif /* !CONFIG_SMP */ -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() -#define local_irq_save(flags) __save_and_cli(flags) -#define local_irq_restore(flags) __restore_flags(flags) - static __inline__ int __is_processor(unsigned long pv) { unsigned long pvr; diff --git a/include/asm-ppc64/time.h b/include/asm-ppc64/time.h index 64e0b8c90e86..dfa720214d89 100644 --- a/include/asm-ppc64/time.h +++ b/include/asm-ppc64/time.h @@ -14,6 +14,7 @@ #define __PPC64_TIME_H #ifdef __KERNEL__ +#include <linux/config.h> #include <linux/types.h> #include <linux/mc146818rtc.h> diff --git a/include/asm-ppc64/tlb.h b/include/asm-ppc64/tlb.h index 69c0faa93194..7e879e466ff3 100644 --- a/include/asm-ppc64/tlb.h +++ b/include/asm-ppc64/tlb.h @@ -1 +1,86 @@ +/* + * TLB shootdown specifics for PPC64 + * + * Copyright (C) 2002 Anton Blanchard, IBM Corp. + * Copyright (C) 2002 Paul Mackerras, IBM Corp. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _PPC64_TLB_H +#define _PPC64_TLB_H + +#include <asm/pgtable.h> +#include <asm/tlbflush.h> +#include <asm/page.h> +#include <asm/mmu.h> + +struct free_pte_ctx; +static inline void tlb_flush(struct free_pte_ctx *tlb); + +/* Get the generic bits... */ #include <asm-generic/tlb.h> + +/* Nothing needed here in fact... */ +#define tlb_start_vma(tlb, vma) do { } while (0) +#define tlb_end_vma(tlb, vma) do { } while (0) + +/* Should make this at least as large as the generic batch size, but it + * takes up too much space */ +#define PPC64_TLB_BATCH_NR 192 + +struct ppc64_tlb_batch { + unsigned long index; + pte_t pte[PPC64_TLB_BATCH_NR]; + unsigned long addr[PPC64_TLB_BATCH_NR]; + unsigned long vaddr[PPC64_TLB_BATCH_NR]; +}; + +extern struct ppc64_tlb_batch ppc64_tlb_batch[NR_CPUS]; + +static inline void tlb_remove_tlb_entry(mmu_gather_t *tlb, pte_t *ptep, + unsigned long address) +{ + int cpu = smp_processor_id(); + struct ppc64_tlb_batch *batch = &ppc64_tlb_batch[cpu]; + unsigned long i = batch->index; + pte_t pte; + + if (pte_val(*ptep) & _PAGE_HASHPTE) { + pte = __pte(pte_update(ptep, _PAGE_HPTEFLAGS, 0)); + if (pte_val(pte) & _PAGE_HASHPTE) { + int local = 0; + + if (tlb->mm->cpu_vm_mask == (1 << cpu)) + local = 1; + + batch->pte[i] = pte; + batch->addr[i] = address; + i++; + + if (i == PPC64_TLB_BATCH_NR) { + flush_hash_range(tlb->mm->context, i, local); + i = 0; + } + } + } + + batch->index = i; +} + +static inline void tlb_flush(struct free_pte_ctx *tlb) +{ + int cpu = smp_processor_id(); + struct ppc64_tlb_batch *batch = &ppc64_tlb_batch[cpu]; + int local = 0; + + if (tlb->mm->cpu_vm_mask == (1 << smp_processor_id())) + local = 1; + + flush_hash_range(tlb->mm->context, batch->index, local); + batch->index = 0; +} + +#endif /* _PPC64_TLB_H */ diff --git a/include/asm-ppc64/tlbflush.h b/include/asm-ppc64/tlbflush.h index b9e8a863d76b..3d9ad1ca7f7c 100644 --- a/include/asm-ppc64/tlbflush.h +++ b/include/asm-ppc64/tlbflush.h @@ -35,12 +35,4 @@ extern void flush_hash_page(unsigned long context, unsigned long ea, pte_t pte, int local); void flush_hash_range(unsigned long context, unsigned long number, int local); -/* TLB flush batching */ -#define MAX_BATCH_FLUSH 128 -struct tlb_batch_data { - pte_t pte; - unsigned long addr; -}; -extern struct tlb_batch_data tlb_batch_array[NR_CPUS][MAX_BATCH_FLUSH]; - #endif /* _PPC64_TLBFLUSH_H */ diff --git a/include/asm-ppc64/uaccess.h b/include/asm-ppc64/uaccess.h index 3c095aa93883..ceeacc2f445a 100644 --- a/include/asm-ppc64/uaccess.h +++ b/include/asm-ppc64/uaccess.h @@ -124,9 +124,6 @@ do { \ } \ } while (0) -struct __large_struct { unsigned long buf[100]; }; -#define __m(x) (*(struct __large_struct *)(x)) - /* * We don't tell gcc that we are accessing memory, but this is OK * because we do not write to any memory gcc knows about, so there diff --git a/include/asm-s390/smplock.h b/include/asm-s390/smplock.h index 1f6485fb0902..a12df4a3f882 100644 --- a/include/asm-s390/smplock.h +++ b/include/asm-s390/smplock.h @@ -21,7 +21,7 @@ do { \ if (task->lock_depth >= 0) \ spin_unlock(&kernel_flag); \ release_irqlock(cpu); \ - __sti(); \ + local_irq_enable(); \ } while (0) /* diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index cc66bc210fc0..ab7e6a28196f 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h @@ -132,23 +132,23 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) #define set_wmb(var, value) do { var = value; wmb(); } while (0) /* interrupt control.. */ -#define __sti() ({ \ +#define local_irq_enable() ({ \ __u8 __dummy; \ __asm__ __volatile__ ( \ "stosm 0(%0),0x03" : : "a" (&__dummy) : "memory"); \ }) -#define __cli() ({ \ +#define local_irq_disable() ({ \ __u32 __flags; \ __asm__ __volatile__ ( \ "stnsm 0(%0),0xFC" : : "a" (&__flags) : "memory"); \ __flags; \ }) -#define __save_flags(x) \ +#define local_save_flags(x) \ __asm__ __volatile__("stosm 0(%0),0" : : "a" (&x) : "memory") -#define __restore_flags(x) \ +#define local_irq_restore(x) \ __asm__ __volatile__("ssm 0(%0)" : : "a" (&x) : "memory") #define __load_psw(psw) \ @@ -211,10 +211,7 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) }) /* For spinlocks etc */ -#define local_irq_save(x) ((x) = __cli()) -#define local_irq_restore(x) __restore_flags(x) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() +#define local_irq_save(x) ((x) = local_irq_disable()) #ifdef CONFIG_SMP @@ -235,10 +232,10 @@ extern void smp_ctl_clear_bit(int cr, int bit); #else -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) +#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) diff --git a/include/asm-s390/tlb.h b/include/asm-s390/tlb.h index 7ac1229d2cae..91d6dd2fcf1c 100644 --- a/include/asm-s390/tlb.h +++ b/include/asm-s390/tlb.h @@ -7,7 +7,7 @@ */ #define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0) -#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) +#define tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) /* * .. because we flush the whole mm when it diff --git a/include/asm-s390x/smplock.h b/include/asm-s390x/smplock.h index 1f6485fb0902..a12df4a3f882 100644 --- a/include/asm-s390x/smplock.h +++ b/include/asm-s390x/smplock.h @@ -21,7 +21,7 @@ do { \ if (task->lock_depth >= 0) \ spin_unlock(&kernel_flag); \ release_irqlock(cpu); \ - __sti(); \ + local_irq_enable(); \ } while (0) /* diff --git a/include/asm-s390x/system.h b/include/asm-s390x/system.h index 659a63bd2cac..2454658db855 100644 --- a/include/asm-s390x/system.h +++ b/include/asm-s390x/system.h @@ -144,23 +144,23 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) #define set_wmb(var, value) do { var = value; wmb(); } while (0) /* interrupt control.. */ -#define __sti() ({ \ +#define local_irq_enable() ({ \ unsigned long __dummy; \ __asm__ __volatile__ ( \ "stosm 0(%0),0x03" : : "a" (&__dummy) : "memory"); \ }) -#define __cli() ({ \ +#define local_irq_disable() ({ \ unsigned long __flags; \ __asm__ __volatile__ ( \ "stnsm 0(%0),0xFC" : : "a" (&__flags) : "memory"); \ __flags; \ }) -#define __save_flags(x) \ +#define local_save_flags(x) \ __asm__ __volatile__("stosm 0(%0),0" : : "a" (&x) : "memory") -#define __restore_flags(x) \ +#define local_irq_restore(x) \ __asm__ __volatile__("ssm 0(%0)" : : "a" (&x) : "memory") #define __load_psw(psw) \ @@ -221,10 +221,7 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) }) /* For spinlocks etc */ -#define local_irq_save(x) ((x) = __cli()) -#define local_irq_restore(x) __restore_flags(x) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() +#define local_irq_save(x) ((x) = local_irq_disable()) #ifdef CONFIG_SMP @@ -245,10 +242,10 @@ extern void smp_ctl_clear_bit(int cr, int bit); #else -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) +#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) diff --git a/include/asm-s390x/tlb.h b/include/asm-s390x/tlb.h index e5ed8cf3ac60..84dfa35034ae 100644 --- a/include/asm-s390x/tlb.h +++ b/include/asm-s390x/tlb.h @@ -7,7 +7,7 @@ */ #define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0) -#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) +#define tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) /* * .. because we flush the whole mm when it diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h index 20d9026a427d..c68ad7770d93 100644 --- a/include/asm-sh/system.h +++ b/include/asm-sh/system.h @@ -104,7 +104,7 @@ extern void __xchg_called_with_bad_pointer(void); #define set_wmb(var, value) do { var = value; wmb(); } while (0) /* Interrupt Control */ -static __inline__ void __sti(void) +static __inline__ void local_irq_enable(void) { unsigned long __dummy0, __dummy1; @@ -118,7 +118,7 @@ static __inline__ void __sti(void) : "memory"); } -static __inline__ void __cli(void) +static __inline__ void local_irq_disable(void) { unsigned long __dummy; __asm__ __volatile__("stc sr, %0\n\t" @@ -129,10 +129,10 @@ static __inline__ void __cli(void) : "memory"); } -#define __save_flags(x) \ +#define local_save_flags(x) \ __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" ) -static __inline__ unsigned long __save_and_cli(void) +static __inline__ unsigned long local_irq_save(void) { unsigned long flags, __dummy; @@ -149,34 +149,34 @@ static __inline__ unsigned long __save_and_cli(void) } #ifdef DEBUG_CLI_STI -static __inline__ void __restore_flags(unsigned long x) +static __inline__ void local_irq_restore(unsigned long x) { if ((x & 0x000000f0) != 0x000000f0) - __sti(); + local_irq_enable(); else { unsigned long flags; - __save_flags(flags); + local_save_flags(flags); if (flags == 0) { extern void dump_stack(void); printk(KERN_ERR "BUG!\n"); dump_stack(); - __cli(); + local_irq_disable(); } } } #else -#define __restore_flags(x) do { \ +#define local_irq_restore(x) do { \ if ((x & 0x000000f0) != 0x000000f0) \ - __sti(); \ + local_irq_enable(); \ } while (0) #endif #define really_restore_flags(x) do { \ if ((x & 0x000000f0) != 0x000000f0) \ - __sti(); \ + local_irq_enable(); \ else \ - __cli(); \ + local_irq_disable(); \ } while (0) /* @@ -216,10 +216,7 @@ do { \ } while (0) /* For spinlocks etc */ -#define local_irq_save(x) x = __save_and_cli() -#define local_irq_restore(x) __restore_flags(x) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() +#define local_irq_save(x) x = local_irq_save() #ifdef CONFIG_SMP @@ -234,11 +231,11 @@ extern void __global_restore_flags(unsigned long); #else -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define save_and_cli(x) x = __save_and_cli() -#define restore_flags(x) __restore_flags(x) +#define cli() local_irq_disable() +#define sti() local_irq_enable() +#define save_flags(x) local_save_flags(x) +#define save_and_cli(x) x = local_irq_save() +#define restore_flags(x) local_irq_restore(x) #endif diff --git a/include/asm-sparc/smplock.h b/include/asm-sparc/smplock.h index dd2cc2b54267..bd931bb5c511 100644 --- a/include/asm-sparc/smplock.h +++ b/include/asm-sparc/smplock.h @@ -21,7 +21,7 @@ do { \ if (unlikely(task->lock_depth >= 0)) { \ spin_unlock(&kernel_flag); \ release_irqlock(cpu); \ - __sti(); \ + local_irq_enable(); \ } \ } while (0) diff --git a/include/asm-sparc/softirq.h b/include/asm-sparc/softirq.h index 84c523031f8a..dd486a2d3932 100644 --- a/include/asm-sparc/softirq.h +++ b/include/asm-sparc/softirq.h @@ -19,7 +19,7 @@ do { if (!--local_bh_count(smp_processor_id()) && \ softirq_pending(smp_processor_id())) { \ do_softirq(); \ - __sti(); \ + local_irq_enable(); \ } \ } while (0) #define in_softirq() (local_bh_count(smp_processor_id()) != 0) diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h index 478cec9542d4..2419711fc1e5 100644 --- a/include/asm-sparc/spinlock.h +++ b/include/asm-sparc/spinlock.h @@ -58,30 +58,30 @@ extern void _do_write_unlock(rwlock_t *rw); #define read_lock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _do_read_lock(lock, "read_lock"); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) #define read_unlock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _do_read_unlock(lock, "read_unlock"); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) #define write_lock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _do_write_lock(lock, "write_lock"); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) #define write_unlock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _do_write_unlock(lock); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) #else /* !SPIN_LOCK_DEBUG */ @@ -180,9 +180,9 @@ extern __inline__ void _read_lock(rwlock_t *rw) #define read_lock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _read_lock(lock); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) extern __inline__ void _read_unlock(rwlock_t *rw) @@ -200,9 +200,9 @@ extern __inline__ void _read_unlock(rwlock_t *rw) #define read_unlock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _read_unlock(lock); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) extern __inline__ void write_lock(rwlock_t *rw) diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h index 4725f9d31738..f44ed09e3c20 100644 --- a/include/asm-sparc/system.h +++ b/include/asm-sparc/system.h @@ -164,7 +164,7 @@ extern __inline__ void setipl(unsigned long __orig_psr) : "memory", "cc"); } -extern __inline__ void __cli(void) +extern __inline__ void local_irq_disable(void) { unsigned long tmp; @@ -179,7 +179,7 @@ extern __inline__ void __cli(void) : "memory"); } -extern __inline__ void __sti(void) +extern __inline__ void local_irq_enable(void) { unsigned long tmp; @@ -241,13 +241,9 @@ extern __inline__ unsigned long read_psr_and_cli(void) return retval; } -#define __save_flags(flags) ((flags) = getipl()) -#define __save_and_cli(flags) ((flags) = read_psr_and_cli()) -#define __restore_flags(flags) setipl((flags)) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() -#define local_irq_save(flags) __save_and_cli(flags) -#define local_irq_restore(flags) __restore_flags(flags) +#define local_save_flags(flags) ((flags) = getipl()) +#define local_irq_save(flags) ((flags) = read_psr_and_cli()) +#define local_irq_restore(flags) setipl((flags)) #ifdef CONFIG_SMP @@ -266,11 +262,11 @@ extern void __global_restore_flags(unsigned long flags); #else -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) -#define save_and_cli(x) __save_and_cli(x) +#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-sparc64/smplock.h b/include/asm-sparc64/smplock.h index d9c87542f5c6..74cfc0e990e8 100644 --- a/include/asm-sparc64/smplock.h +++ b/include/asm-sparc64/smplock.h @@ -29,7 +29,7 @@ do { \ if (unlikely(task->lock_depth >= 0)) { \ spin_unlock(&kernel_flag); \ release_irqlock(cpu); \ - __sti(); \ + local_irq_enable(); \ } \ } while (0) diff --git a/include/asm-sparc64/softirq.h b/include/asm-sparc64/softirq.h index 0239b7275cd5..822c893a5065 100644 --- a/include/asm-sparc64/softirq.h +++ b/include/asm-sparc64/softirq.h @@ -16,7 +16,7 @@ do { if (!--local_bh_count(smp_processor_id()) && \ softirq_pending(smp_processor_id())) { \ do_softirq(); \ - __sti(); \ + local_irq_enable(); \ } \ preempt_enable(); \ } while (0) diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index 55fef65608c3..34c221d282a1 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h @@ -140,30 +140,30 @@ extern void _do_write_unlock(rwlock_t *rw); #define _raw_read_lock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _do_read_lock(lock, "read_lock"); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) #define _raw_read_unlock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _do_read_unlock(lock, "read_unlock"); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) #define _raw_write_lock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _do_write_lock(lock, "write_lock"); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) #define _raw_write_unlock(lock) \ do { unsigned long flags; \ - __save_and_cli(flags); \ + local_irq_save(flags); \ _do_write_unlock(lock); \ - __restore_flags(flags); \ + local_irq_restore(flags); \ } while(0) #endif /* CONFIG_DEBUG_SPINLOCK */ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 8a8808dadc69..f98e5915e612 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -34,10 +34,10 @@ enum sparc_cpu { #define setipl(__new_ipl) \ __asm__ __volatile__("wrpr %0, %%pil" : : "r" (__new_ipl) : "memory") -#define __cli() \ +#define local_irq_disable() \ __asm__ __volatile__("wrpr 15, %%pil" : : : "memory") -#define __sti() \ +#define local_irq_enable() \ __asm__ __volatile__("wrpr 0, %%pil" : : : "memory") #define getipl() \ @@ -62,20 +62,16 @@ enum sparc_cpu { retval; \ }) -#define __save_flags(flags) ((flags) = getipl()) -#define __save_and_cli(flags) ((flags) = read_pil_and_cli()) -#define __restore_flags(flags) setipl((flags)) -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() -#define local_irq_save(flags) __save_and_cli(flags) -#define local_irq_restore(flags) __restore_flags(flags) +#define local_save_flags(flags) ((flags) = getipl()) +#define local_irq_save(flags) ((flags) = read_pil_and_cli()) +#define local_irq_restore(flags) setipl((flags)) #ifndef CONFIG_SMP -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) -#define save_and_cli(x) __save_and_cli(x) +#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) #else #ifndef __ASSEMBLY__ @@ -150,7 +146,7 @@ extern void __flushw_user(void); do { spin_unlock(&(rq)->lock); \ flushw_all(); \ } while (0) -#define finish_arch_switch(rq) __sti() +#define finish_arch_switch(rq) local_irq_enable() #ifndef CONFIG_DEBUG_SPINLOCK #define CHECK_LOCKS(PREV) do { } while(0) diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h index cffe5312e94a..2a7db43c6fd7 100644 --- a/include/asm-sparc64/tlb.h +++ b/include/asm-sparc64/tlb.h @@ -16,7 +16,7 @@ do { if (!(tlb)->fullmm) \ flush_tlb_range(vma, vma->vm_start, vma->vm_end); \ } while (0) -#define tlb_remove_tlb_entry(tlb, pte, address) \ +#define tlb_remove_tlb_entry(tlb, ptep, address) \ do { } while (0) #include <asm-generic/tlb.h> diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 9d6c6f1f48d5..c9604630f910 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h @@ -240,18 +240,16 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, #define warn_if_not_ulong(x) do { unsigned long foo; (void) (&(x) == &foo); } while (0) /* interrupt control.. */ -#define __save_flags(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0) -#define __restore_flags(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc") -#define __cli() __asm__ __volatile__("cli": : :"memory") -#define __sti() __asm__ __volatile__("sti": : :"memory") +#define local_save_flags(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0) +#define local_irq_restore(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc") +#define local_irq_disable() __asm__ __volatile__("cli": : :"memory") +#define local_irq_enable() __asm__ __volatile__("sti": : :"memory") /* used in the idle loop; sti takes one instruction cycle to complete */ #define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory") /* For spinlocks etc */ #define local_irq_save(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0) #define local_irq_restore(x) __asm__ __volatile__("# local_irq_restore \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory") -#define local_irq_disable() __cli() -#define local_irq_enable() __sti() #ifdef CONFIG_SMP @@ -266,10 +264,10 @@ extern void __global_restore_flags(unsigned long); #else -#define cli() __cli() -#define sti() __sti() -#define save_flags(x) __save_flags(x) -#define restore_flags(x) __restore_flags(x) +#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) #endif diff --git a/include/asm-x86_64/tlb.h b/include/asm-x86_64/tlb.h index f76b9061ff8c..9a549844a7ff 100644 --- a/include/asm-x86_64/tlb.h +++ b/include/asm-x86_64/tlb.h @@ -4,7 +4,7 @@ #define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0) -#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) +#define tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) diff --git a/include/linux/bio.h b/include/linux/bio.h index 1b4004652cde..fee72762ad8d 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -215,7 +215,7 @@ extern inline char *bio_kmap_irq(struct bio *bio, unsigned long *flags) { unsigned long addr; - __save_flags(*flags); + local_save_flags(*flags); /* * could be low @@ -226,7 +226,7 @@ extern inline char *bio_kmap_irq(struct bio *bio, unsigned long *flags) /* * it's a highmem page */ - __cli(); + local_irq_disable(); addr = (unsigned long) kmap_atomic(bio_page(bio), KM_BIO_SRC_IRQ); if (addr & ~PAGE_MASK) @@ -240,7 +240,7 @@ extern inline void bio_kunmap_irq(char *buffer, unsigned long *flags) unsigned long ptr = (unsigned long) buffer & PAGE_MASK; kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ); - __restore_flags(*flags); + local_irq_restore(*flags); } #else diff --git a/include/linux/dio.h b/include/linux/dio.h index 087b06ec1011..75166393b982 100644 --- a/include/linux/dio.h +++ b/include/linux/dio.h @@ -72,16 +72,16 @@ #define DIO_SCINHOLE(scode) (((scode) >= 32) && ((scode) < DIOII_SCBASE)) /* macros to read device IDs, given base address */ -#define DIO_ID(baseaddr) readb((baseaddr) + DIO_IDOFF) -#define DIO_SECID(baseaddr) readb((baseaddr) + DIO_SECIDOFF) +#define DIO_ID(baseaddr) in_8((baseaddr) + DIO_IDOFF) +#define DIO_SECID(baseaddr) in_8((baseaddr) + DIO_SECIDOFF) /* extract the interrupt level */ -#define DIO_IPL(baseaddr) (((readb((baseaddr) + DIO_IPLOFF) >> 4) & 0x03) + 3) +#define DIO_IPL(baseaddr) (((in_8((baseaddr) + DIO_IPLOFF) >> 4) & 0x03) + 3) /* find the size of a DIO-II board's address space. * DIO boards are all fixed length. */ -#define DIOII_SIZE(baseaddr) ((readb((baseaddr) + DIOII_SIZEOFF) + 1) * 0x100000) +#define DIOII_SIZE(baseaddr) ((in_8((baseaddr) + DIOII_SIZEOFF) + 1) * 0x100000) /* general purpose macro for both DIO and DIO-II */ #define DIO_SIZE(scode, base) (DIO_ISDIOII((scode)) ? DIOII_SIZE((base)) : DIO_DEVSIZE) @@ -109,7 +109,7 @@ #define DIO_ID_DCMREM 0x85 /* 98642A serial MUX */ #define DIO_DESC_DCMREM "98642A DCMREM serial MUX" #define DIO_ID_LAN 0x15 /* 98643A LAN */ -#define DIO_DESC_LAN "98643A LAN" +#define DIO_DESC_LAN "98643A LANCE ethernet" #define DIO_ID_FHPIB 0x08 /* 98625A/98625B fast HP-IB */ #define DIO_DESC_FHPIB "98625A/98625B fast HPIB" #define DIO_ID_NHPIB 0x80 /* 98624A HP-IB (normal ie slow) */ @@ -192,10 +192,10 @@ * identify them... */ -extern void dio_init(void); extern int dio_find(int deviceid); extern void *dio_scodetoviraddr(int scode); extern int dio_scodetoipl(int scode); +extern const char *dio_scodetoname(int scode); extern void dio_config_board(int scode); extern void dio_unconfig_board(int scode); diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h index 5c30fc929cab..cc5441324f3c 100644 --- a/include/linux/generic_serial.h +++ b/include/linux/generic_serial.h @@ -45,7 +45,7 @@ struct gs_port { int count; int blocked_open; struct tty_struct *tty; - int event; + unsigned long event; unsigned short closing_wait; int close_delay; struct real_driver *rd; diff --git a/include/linux/intermezzo_fs.h b/include/linux/intermezzo_fs.h index a0fe6dbc4622..07e89b41d407 100644 --- a/include/linux/intermezzo_fs.h +++ b/include/linux/intermezzo_fs.h @@ -19,6 +19,7 @@ #ifdef __KERNEL__ #include <linux/smp.h> #include <linux/fsfilter.h> +#include <linux/namei.h> /* fixups for fs.h */ #ifndef fs_down diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 3870d26066e9..09e6b86ee763 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -44,6 +44,16 @@ enum { #include <asm/hardirq.h> #include <asm/softirq.h> +/* + * Temporary defines for UP kernels, until all code gets fixed. + */ +#if !CONFIG_SMP +# define cli() local_irq_disable() +# define sti() local_irq_enable() +# define save_flags(x) local_irq_save(x) +# define restore_flags(x) local_irq_restore(x) +# define save_and_cli(x) local_irq_save_off(x) +#endif /* PLEASE, avoid to allocate new softirqs, if you need not _really_ high diff --git a/include/linux/nubus.h b/include/linux/nubus.h index 0e0ef4f73d6d..a3fd37b33fdd 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h @@ -12,6 +12,10 @@ #ifndef LINUX_NUBUS_H #define LINUX_NUBUS_H +#ifdef __KERNEL__ +#include <asm/nubus.h> +#endif + enum nubus_category { NUBUS_CAT_BOARD = 0x0001, NUBUS_CAT_DISPLAY = 0x0003, @@ -262,7 +266,6 @@ extern struct nubus_dev* nubus_devices; extern struct nubus_board* nubus_boards; /* Generic NuBus interface functions, modelled after the PCI interface */ -extern void nubus_init(void); void nubus_scan_bus(void); extern void nubus_proc_init(void); int get_nubus_list(char *buf); diff --git a/include/linux/pmu.h b/include/linux/pmu.h index b8e09e891eb9..bf0ed74e9826 100644 --- a/include/linux/pmu.h +++ b/include/linux/pmu.h @@ -75,6 +75,8 @@ enum { PMU_HEATHROW_BASED, /* PowerBook G3 series */ PMU_PADDINGTON_BASED, /* 1999 PowerBook G3 */ PMU_KEYLARGO_BASED, /* Core99 motherboard (PMU99) */ + PMU_68K_V1, /* 68K PMU, version 1 */ + PMU_68K_V2, /* 68K PMU, version 2 */ }; /* PMU PMU_POWER_EVENTS commands */ diff --git a/include/linux/serial167.h b/include/linux/serial167.h index 8886c292fcc9..2c805a1791cf 100644 --- a/include/linux/serial167.h +++ b/include/linux/serial167.h @@ -37,7 +37,7 @@ struct cyclades_port { int ignore_status_mask; int close_delay; int IER; /* Interrupt Enable Register */ - int event; + unsigned long event; unsigned long last_active; int count; /* # of fd on device */ int x_char; /* to be pushed out ASAP */ diff --git a/include/linux/smp.h b/include/linux/smp.h index 6e89d1d34bd8..fff7c165ac2d 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -95,7 +95,8 @@ static inline void smp_send_reschedule_all(void) { } #endif /* !SMP */ -#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) -#define put_cpu() preempt_enable() +#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) +#define put_cpu() preempt_enable() +#define put_cpu_no_resched() preempt_enable_no_resched() #endif /* __LINUX_SMP_H */ diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h index f91119ab066d..4df6addff7c8 100644 --- a/include/linux/trdevice.h +++ b/include/linux/trdevice.h @@ -33,6 +33,7 @@ extern int tr_header(struct sk_buff *skb, struct net_device *dev, void *saddr, unsigned len); extern int tr_rebuild_header(struct sk_buff *skb); extern unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev); +extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev); extern struct net_device *init_trdev(struct net_device *dev, int sizeof_priv); extern struct net_device *alloc_trdev(int sizeof_priv); extern int register_trdev(struct net_device *dev); diff --git a/include/linux/writeback.h b/include/linux/writeback.h index af3ec94cb2ad..7b1ae2718f3e 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -8,6 +8,8 @@ #ifndef WRITEBACK_H #define WRITEBACK_H +struct backing_dev_info; + extern spinlock_t inode_lock; extern struct list_head inode_in_use; extern struct list_head inode_unused; @@ -38,6 +40,9 @@ void wake_up_inode(struct inode *inode); void __wait_on_inode(struct inode * inode); void sync_inodes_sb(struct super_block *, int wait); void sync_inodes(int wait); +void writeback_backing_dev(struct backing_dev_info *bdi, int *nr_to_write, + enum writeback_sync_modes sync_mode, + unsigned long *older_than_this); /* writeback.h requires fs.h; it, too, is not included from here. */ static inline void wait_on_inode(struct inode *inode) diff --git a/include/linux/zorro.h b/include/linux/zorro.h index f2a191cc5b36..38d128833a76 100644 --- a/include/linux/zorro.h +++ b/include/linux/zorro.h @@ -199,7 +199,7 @@ extern struct zorro_dev *zorro_find_device(zorro_id id, * the corresponding bits. */ -extern __u32 zorro_unused_z2ram[4]; +extern bitmap_member(zorro_unused_z2ram, 128); #define Z2RAM_START (0x00200000) #define Z2RAM_END (0x00a00000) |
