diff options
Diffstat (limited to 'arch/sh/include/asm')
139 files changed, 1202 insertions, 3187 deletions
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild index 7beb42322f6..c19e47dacb3 100644 --- a/arch/sh/include/asm/Kbuild +++ b/arch/sh/include/asm/Kbuild @@ -1,11 +1,39 @@ -include include/asm-generic/Kbuild.asm -header-y += cachectl.h -header-y += cpu-features.h -header-y += hw_breakpoint.h -header-y += posix_types_32.h -header-y += posix_types_64.h -header-y += ptrace_32.h -header-y += ptrace_64.h -header-y += unistd_32.h -header-y += unistd_64.h +generic-y += bitsperlong.h +generic-y += cputime.h +generic-y += current.h +generic-y += delay.h +generic-y += div64.h +generic-y += emergency-restart.h +generic-y += errno.h +generic-y += exec.h +generic-y += fcntl.h +generic-y += hash.h +generic-y += ioctl.h +generic-y += ipcbuf.h +generic-y += irq_regs.h +generic-y += kvm_para.h +generic-y += local.h +generic-y += local64.h +generic-y += mcs_spinlock.h +generic-y += mman.h +generic-y += msgbuf.h +generic-y += param.h +generic-y += parport.h +generic-y += percpu.h +generic-y += poll.h +generic-y += preempt.h +generic-y += resource.h +generic-y += scatterlist.h +generic-y += sembuf.h +generic-y += serial.h +generic-y += shmbuf.h +generic-y += siginfo.h +generic-y += sizes.h +generic-y += socket.h +generic-y += statfs.h +generic-y += termbits.h +generic-y += termios.h +generic-y += trace_clock.h +generic-y += ucontext.h +generic-y += xor.h diff --git a/arch/sh/include/asm/atomic-irq.h b/arch/sh/include/asm/atomic-irq.h index 467d9415a32..9f7c56609e5 100644 --- a/arch/sh/include/asm/atomic-irq.h +++ b/arch/sh/include/asm/atomic-irq.h @@ -1,6 +1,8 @@  #ifndef __ASM_SH_ATOMIC_IRQ_H  #define __ASM_SH_ATOMIC_IRQ_H +#include <linux/irqflags.h> +  /*   * To get proper branch prediction for the main line, we must branch   * forward to code at the end of this object's .text section, then diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h index c7983124d99..f57b8a6743b 100644 --- a/arch/sh/include/asm/atomic.h +++ b/arch/sh/include/asm/atomic.h @@ -9,9 +9,10 @@  #include <linux/compiler.h>  #include <linux/types.h> -#include <asm/system.h> +#include <asm/cmpxchg.h> +#include <asm/barrier.h> -#define ATOMIC_INIT(i)	( (atomic_t) { (i) } ) +#define ATOMIC_INIT(i)	{ (i) }  #define atomic_read(v)		(*(volatile int *)&(v)->counter)  #define atomic_set(v,i)		((v)->counter = (i)) @@ -30,7 +31,6 @@  #define atomic_inc_and_test(v)		(atomic_inc_return(v) == 0)  #define atomic_sub_and_test(i,v)	(atomic_sub_return((i), (v)) == 0)  #define atomic_dec_and_test(v)		(atomic_sub_return(1, (v)) == 0) -#define atomic_inc_not_zero(v)		atomic_add_unless((v), 1, 0)  #define atomic_inc(v)			atomic_add(1, (v))  #define atomic_dec(v)			atomic_sub(1, (v)) @@ -39,15 +39,15 @@  #define atomic_cmpxchg(v, o, n)		(cmpxchg(&((v)->counter), (o), (n)))  /** - * atomic_add_unless - add unless the number is a given value + * __atomic_add_unless - add unless the number is a given value   * @v: pointer of type atomic_t   * @a: the amount to add to v...   * @u: ...unless v is equal to u.   *   * Atomically adds @a to @v, so long as it was not @u. - * Returns non-zero if @v was not @u, and zero otherwise. + * Returns the old value of @v.   */ -static inline int atomic_add_unless(atomic_t *v, int a, int u) +static inline int __atomic_add_unless(atomic_t *v, int a, int u)  {  	int c, old;  	c = atomic_read(v); @@ -60,15 +60,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)  		c = old;  	} -	return c != (u); +	return c;  } -#define smp_mb__before_atomic_dec()	smp_mb() -#define smp_mb__after_atomic_dec()	smp_mb() -#define smp_mb__before_atomic_inc()	smp_mb() -#define smp_mb__after_atomic_inc()	smp_mb() - -#include <asm-generic/atomic-long.h> -#include <asm-generic/atomic64.h> -  #endif /* __ASM_SH_ATOMIC_H */ diff --git a/arch/sh/include/asm/auxvec.h b/arch/sh/include/asm/auxvec.h deleted file mode 100644 index 483effd65e0..00000000000 --- a/arch/sh/include/asm/auxvec.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __ASM_SH_AUXVEC_H -#define __ASM_SH_AUXVEC_H - -/* - * Architecture-neutral AT_ values in 0-17, leave some room - * for more of them. - */ - -/* - * This entry gives some information about the FPU initialization - * performed by the kernel. - */ -#define AT_FPUCW		18	/* Used FPU control word.  */ - -#if defined(CONFIG_VSYSCALL) || !defined(__KERNEL__) -/* - * Only define this in the vsyscall case, the entry point to - * the vsyscall page gets placed here. The kernel will attempt - * to build a gate VMA we don't care about otherwise.. - */ -#define AT_SYSINFO_EHDR		33 -#endif - -/* - * More complete cache descriptions than AT_[DIU]CACHEBSIZE.  If the - * value is -1, then the cache doesn't exist.  Otherwise: - * - *    bit 0-3:	  Cache set-associativity; 0 means fully associative. - *    bit 4-7:	  Log2 of cacheline size. - *    bit 8-31:	  Size of the entire cache >> 8. - */ -#define AT_L1I_CACHESHAPE	34 -#define AT_L1D_CACHESHAPE	35 -#define AT_L2_CACHESHAPE	36 - -#endif /* __ASM_SH_AUXVEC_H */ diff --git a/arch/sh/include/asm/barrier.h b/arch/sh/include/asm/barrier.h new file mode 100644 index 00000000000..43715308b06 --- /dev/null +++ b/arch/sh/include/asm/barrier.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 1999, 2000  Niibe Yutaka  &  Kaz Kojima + * Copyright (C) 2002 Paul Mundt + */ +#ifndef __ASM_SH_BARRIER_H +#define __ASM_SH_BARRIER_H + +#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5) +#include <asm/cache_insns.h> +#endif + +/* + * A brief note on ctrl_barrier(), the control register write barrier. + * + * Legacy SH cores typically require a sequence of 8 nops after + * modification of a control register in order for the changes to take + * effect. On newer cores (like the sh4a and sh5) this is accomplished + * with icbi. + * + * Also note that on sh4a in the icbi case we can forego a synco for the + * write barrier, as it's not necessary for control registers. + * + * Historically we have only done this type of barrier for the MMUCR, but + * it's also necessary for the CCR, so we make it generic here instead. + */ +#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5) +#define mb()		__asm__ __volatile__ ("synco": : :"memory") +#define rmb()		mb() +#define wmb()		mb() +#define ctrl_barrier()	__icbi(PAGE_OFFSET) +#else +#define ctrl_barrier()	__asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop") +#endif + +#define set_mb(var, value) do { (void)xchg(&var, value); } while (0) + +#include <asm-generic/barrier.h> + +#endif /* __ASM_SH_BARRIER_H */ diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h index 98511e4d28c..fc8e652cf17 100644 --- a/arch/sh/include/asm/bitops.h +++ b/arch/sh/include/asm/bitops.h @@ -7,9 +7,9 @@  #error only <linux/bitops.h> can be included directly  #endif -#include <asm/system.h>  /* For __swab32 */  #include <asm/byteorder.h> +#include <asm/barrier.h>  #ifdef CONFIG_GUSA_RB  #include <asm/bitops-grb.h> @@ -23,12 +23,6 @@  #include <asm-generic/bitops/non-atomic.h>  #endif -/* - * clear_bit() doesn't provide any barrier for the compiler. - */ -#define smp_mb__before_clear_bit()	smp_mb() -#define smp_mb__after_clear_bit()	smp_mb() -  #ifdef CONFIG_SUPERH32  static inline unsigned long ffz(unsigned long word)  { @@ -94,9 +88,8 @@ static inline unsigned long ffz(unsigned long word)  #include <asm-generic/bitops/hweight.h>  #include <asm-generic/bitops/lock.h>  #include <asm-generic/bitops/sched.h> -#include <asm-generic/bitops/ext2-non-atomic.h> +#include <asm-generic/bitops/le.h>  #include <asm-generic/bitops/ext2-atomic.h> -#include <asm-generic/bitops/minix.h>  #include <asm-generic/bitops/fls.h>  #include <asm-generic/bitops/__fls.h>  #include <asm-generic/bitops/fls64.h> diff --git a/arch/sh/include/asm/bitsperlong.h b/arch/sh/include/asm/bitsperlong.h deleted file mode 100644 index 6dc0bb0c13b..00000000000 --- a/arch/sh/include/asm/bitsperlong.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/bitsperlong.h> diff --git a/arch/sh/include/asm/bl_bit.h b/arch/sh/include/asm/bl_bit.h new file mode 100644 index 00000000000..06e4163c674 --- /dev/null +++ b/arch/sh/include/asm/bl_bit.h @@ -0,0 +1,10 @@ +#ifndef __ASM_SH_BL_BIT_H +#define __ASM_SH_BL_BIT_H + +#ifdef CONFIG_SUPERH32 +# include <asm/bl_bit_32.h> +#else +# include <asm/bl_bit_64.h> +#endif + +#endif /* __ASM_SH_BL_BIT_H */ diff --git a/arch/sh/include/asm/bl_bit_32.h b/arch/sh/include/asm/bl_bit_32.h new file mode 100644 index 00000000000..fd21eee6214 --- /dev/null +++ b/arch/sh/include/asm/bl_bit_32.h @@ -0,0 +1,33 @@ +#ifndef __ASM_SH_BL_BIT_32_H +#define __ASM_SH_BL_BIT_32_H + +static inline void set_bl_bit(void) +{ +	unsigned long __dummy0, __dummy1; + +	__asm__ __volatile__ ( +		"stc	sr, %0\n\t" +		"or	%2, %0\n\t" +		"and	%3, %0\n\t" +		"ldc	%0, sr\n\t" +		: "=&r" (__dummy0), "=r" (__dummy1) +		: "r" (0x10000000), "r" (0xffffff0f) +		: "memory" +	); +} + +static inline void clear_bl_bit(void) +{ +	unsigned long __dummy0, __dummy1; + +	__asm__ __volatile__ ( +		"stc	sr, %0\n\t" +		"and	%2, %0\n\t" +		"ldc	%0, sr\n\t" +		: "=&r" (__dummy0), "=r" (__dummy1) +		: "1" (~0x10000000) +		: "memory" +	); +} + +#endif /* __ASM_SH_BL_BIT_32_H */ diff --git a/arch/sh/include/asm/bl_bit_64.h b/arch/sh/include/asm/bl_bit_64.h new file mode 100644 index 00000000000..6cc8711af43 --- /dev/null +++ b/arch/sh/include/asm/bl_bit_64.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2000, 2001  Paolo Alberelli + * Copyright (C) 2003  Paul Mundt + * Copyright (C) 2004  Richard Curnow + * + * This file is subject to the terms and conditions of the GNU General Public + * License.  See the file "COPYING" in the main directory of this archive + * for more details. + */ +#ifndef __ASM_SH_BL_BIT_64_H +#define __ASM_SH_BL_BIT_64_H + +#include <asm/processor.h> + +#define SR_BL_LL	0x0000000010000000LL + +static inline void set_bl_bit(void) +{ +	unsigned long long __dummy0, __dummy1 = SR_BL_LL; + +	__asm__ __volatile__("getcon	" __SR ", %0\n\t" +			     "or	%0, %1, %0\n\t" +			     "putcon	%0, " __SR "\n\t" +			     : "=&r" (__dummy0) +			     : "r" (__dummy1)); + +} + +static inline void clear_bl_bit(void) +{ +	unsigned long long __dummy0, __dummy1 = ~SR_BL_LL; + +	__asm__ __volatile__("getcon	" __SR ", %0\n\t" +			     "and	%0, %1, %0\n\t" +			     "putcon	%0, " __SR "\n\t" +			     : "=&r" (__dummy0) +			     : "r" (__dummy1)); +} + +#endif /* __ASM_SH_BL_BIT_64_H */ diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h index 6323f864d11..dcf27807542 100644 --- a/arch/sh/include/asm/bug.h +++ b/arch/sh/include/asm/bug.h @@ -1,6 +1,8 @@  #ifndef __ASM_SH_BUG_H  #define __ASM_SH_BUG_H +#include <linux/linkage.h> +  #define TRAPA_BUG_OPCODE	0xc33e	/* trapa #0x3e */  #define BUGFLAG_UNWINDER	(1 << 1) @@ -107,4 +109,11 @@ do {							\  #include <asm-generic/bug.h> +struct pt_regs; + +/* arch/sh/kernel/traps.c */ +extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn)); +extern void die_if_kernel(const char *str, struct pt_regs *regs, long err); +extern void die_if_no_fixup(const char *str, struct pt_regs *regs, long err); +  #endif /* __ASM_SH_BUG_H */ diff --git a/arch/sh/include/asm/byteorder.h b/arch/sh/include/asm/byteorder.h deleted file mode 100644 index db2f5d7cb17..00000000000 --- a/arch/sh/include/asm/byteorder.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __ASM_SH_BYTEORDER_H -#define __ASM_SH_BYTEORDER_H - -#ifdef __LITTLE_ENDIAN__ -#include <linux/byteorder/little_endian.h> -#else -#include <linux/byteorder/big_endian.h> -#endif - -#endif /* __ASM_SH_BYTEORDER_H */ diff --git a/arch/sh/include/asm/cache_insns.h b/arch/sh/include/asm/cache_insns.h new file mode 100644 index 00000000000..355cb06b7a3 --- /dev/null +++ b/arch/sh/include/asm/cache_insns.h @@ -0,0 +1,11 @@ +#ifndef __ASM_SH_CACHE_INSNS_H +#define __ASM_SH_CACHE_INSNS_H + + +#ifdef CONFIG_SUPERH32 +# include <asm/cache_insns_32.h> +#else +# include <asm/cache_insns_64.h> +#endif + +#endif /* __ASM_SH_CACHE_INSNS_H */ diff --git a/arch/sh/include/asm/cache_insns_32.h b/arch/sh/include/asm/cache_insns_32.h new file mode 100644 index 00000000000..b92fe541609 --- /dev/null +++ b/arch/sh/include/asm/cache_insns_32.h @@ -0,0 +1,21 @@ +#ifndef __ASM_SH_CACHE_INSNS_32_H +#define __ASM_SH_CACHE_INSNS_32_H + +#include <linux/types.h> + +#if defined(CONFIG_CPU_SH4A) +#define __icbi(addr)	__asm__ __volatile__ ( "icbi @%0\n\t" : : "r" (addr)) +#else +#define __icbi(addr)	mb() +#endif + +#define __ocbp(addr)	__asm__ __volatile__ ( "ocbp @%0\n\t" : : "r" (addr)) +#define __ocbi(addr)	__asm__ __volatile__ ( "ocbi @%0\n\t" : : "r" (addr)) +#define __ocbwb(addr)	__asm__ __volatile__ ( "ocbwb @%0\n\t" : : "r" (addr)) + +static inline reg_size_t register_align(void *val) +{ +	return (unsigned long)(signed long)val; +} + +#endif /* __ASM_SH_CACHE_INSNS_32_H */ diff --git a/arch/sh/include/asm/cache_insns_64.h b/arch/sh/include/asm/cache_insns_64.h new file mode 100644 index 00000000000..70b6357eaf1 --- /dev/null +++ b/arch/sh/include/asm/cache_insns_64.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2000, 2001  Paolo Alberelli + * Copyright (C) 2003  Paul Mundt + * Copyright (C) 2004  Richard Curnow + * + * This file is subject to the terms and conditions of the GNU General Public + * License.  See the file "COPYING" in the main directory of this archive + * for more details. + */ +#ifndef __ASM_SH_CACHE_INSNS_64_H +#define __ASM_SH_CACHE_INSNS_64_H + +#define __icbi(addr)	__asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr)) +#define __ocbp(addr)	__asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr)) +#define __ocbi(addr)	__asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr)) +#define __ocbwb(addr)	__asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr)) + +static inline reg_size_t register_align(void *val) +{ +	return (unsigned long long)(signed long long)(signed long)val; +} + +#endif /* __ASM_SH_CACHE_INSNS_64_H */ diff --git a/arch/sh/include/asm/cachectl.h b/arch/sh/include/asm/cachectl.h deleted file mode 100644 index 6ffb4b7a212..00000000000 --- a/arch/sh/include/asm/cachectl.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _SH_CACHECTL_H -#define _SH_CACHECTL_H - -/* Definitions for the cacheflush system call.  */ - -#define CACHEFLUSH_D_INVAL	0x1	/* invalidate (without write back) */ -#define CACHEFLUSH_D_WB		0x2	/* write back (without invalidate) */ -#define CACHEFLUSH_D_PURGE	0x3	/* writeback and invalidate */ - -#define CACHEFLUSH_I		0x4 - -/* - * Options for cacheflush system call - */ -#define ICACHE	CACHEFLUSH_I		/* flush instruction cache */ -#define DCACHE	CACHEFLUSH_D_PURGE	/* writeback and flush data cache */ -#define BCACHE	(ICACHE|DCACHE)		/* flush both caches */ - -#endif /* _SH_CACHECTL_H */ diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h index 1f4e562c5e8..82e1eabeac9 100644 --- a/arch/sh/include/asm/cacheflush.h +++ b/arch/sh/include/asm/cacheflush.h @@ -96,7 +96,7 @@ void kmap_coherent_init(void);  void *kmap_coherent(struct page *page, unsigned long addr);  void kunmap_coherent(void *kvaddr); -#define PG_dcache_dirty	PG_arch_1 +#define PG_dcache_clean	PG_arch_1  void cpu_cache_init(void); diff --git a/arch/sh/include/asm/checksum.h b/arch/sh/include/asm/checksum.h index fc26d1f4b59..34ae2620452 100644 --- a/arch/sh/include/asm/checksum.h +++ b/arch/sh/include/asm/checksum.h @@ -1,5 +1,5 @@  #ifdef CONFIG_SUPERH32 -# include "checksum_32.h" +# include <asm/checksum_32.h>  #else  # include <asm-generic/checksum.h>  #endif diff --git a/arch/sh/include/asm/clkdev.h b/arch/sh/include/asm/clkdev.h index 5645f358128..c41901465fb 100644 --- a/arch/sh/include/asm/clkdev.h +++ b/arch/sh/include/asm/clkdev.h @@ -1,9 +1,5 @@  /* - *  arch/sh/include/asm/clkdev.h - * - * Cloned from arch/arm/include/asm/clkdev.h: - * - *  Copyright (C) 2008 Russell King. + *  Copyright (C) 2010 Paul Mundt <lethal@linux-sh.org>   *   * This program is free software; you can redistribute it and/or modify   * it under the terms of the GNU General Public License version 2 as @@ -11,25 +7,27 @@   *   * Helper for the clk API to assist looking up a struct clk.   */ -#ifndef __ASM_CLKDEV_H -#define __ASM_CLKDEV_H -struct clk; +#ifndef __CLKDEV__H_ +#define __CLKDEV__H_ -struct clk_lookup { -	struct list_head	node; -	const char		*dev_id; -	const char		*con_id; -	struct clk		*clk; -}; +#include <linux/bootmem.h> +#include <linux/mm.h> +#include <linux/slab.h> -struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, -	const char *dev_fmt, ...); +#include <asm/clock.h> -void clkdev_add(struct clk_lookup *cl); -void clkdev_drop(struct clk_lookup *cl); - -void clkdev_add_table(struct clk_lookup *, size_t); -int clk_add_alias(const char *, const char *, char *, struct device *); +static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) +{ +	if (!slab_is_available()) +		return alloc_bootmem_low_pages(size); +	else +		return kzalloc(size, GFP_KERNEL); +} +#ifndef CONFIG_COMMON_CLK +#define __clk_put(clk) +#define __clk_get(clk) ({ 1; })  #endif + +#endif /* __CLKDEV_H__ */ diff --git a/arch/sh/include/asm/clock.h b/arch/sh/include/asm/clock.h index 803d4c7f09d..0390a07e7e3 100644 --- a/arch/sh/include/asm/clock.h +++ b/arch/sh/include/asm/clock.h @@ -4,7 +4,7 @@  #include <linux/sh_clk.h>  /* Should be defined by processor-specific code */ -void __deprecated arch_init_clk_ops(struct clk_ops **, int type); +void __deprecated arch_init_clk_ops(struct sh_clk_ops **, int type);  int __init arch_clk_init(void);  /* arch/sh/kernel/cpu/clock-cpg.c */ diff --git a/arch/sh/include/asm/cmpxchg-grb.h b/arch/sh/include/asm/cmpxchg-grb.h index 4676bf57693..f848dec9e48 100644 --- a/arch/sh/include/asm/cmpxchg-grb.h +++ b/arch/sh/include/asm/cmpxchg-grb.h @@ -15,8 +15,9 @@ static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)  		"   mov.l   %2,   @%1     \n\t" /* store new value */  		"1: mov     r1,   r15     \n\t" /* LOGOUT */  		: "=&r" (retval), -		  "+r"  (m) -		: "r"   (val) +		  "+r"  (m), +		  "+r"  (val)		/* inhibit r15 overloading */ +		:  		: "memory", "r0", "r1");  	return retval; @@ -36,8 +37,9 @@ static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val)  		"   mov.b   %2,   @%1     \n\t" /* store new value */  		"1: mov     r1,   r15     \n\t" /* LOGOUT */  		: "=&r" (retval), -		  "+r"  (m) -		: "r"   (val) +		  "+r"  (m), +		  "+r"  (val)		/* inhibit r15 overloading */ +		:  		: "memory" , "r0", "r1");  	return retval; @@ -54,13 +56,14 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,  		"   nop                   \n\t"  		"   mov    r15,   r1      \n\t" /* r1 = saved sp */  		"   mov    #-8,   r15     \n\t" /* LOGIN */ -		"   mov.l  @%1,   %0      \n\t" /* load  old value */ -		"   cmp/eq  %0,   %2      \n\t" +		"   mov.l  @%3,   %0      \n\t" /* load  old value */ +		"   cmp/eq  %0,   %1      \n\t"  		"   bf            1f      \n\t" /* if not equal */ -		"   mov.l   %3,   @%1     \n\t" /* store new value */ +		"   mov.l   %2,   @%3     \n\t" /* store new value */  		"1: mov     r1,   r15     \n\t" /* LOGOUT */ -		: "=&r" (retval) -		:  "r"  (m), "r"  (old), "r"  (new) +		: "=&r" (retval), +		  "+r"  (old), "+r"  (new) /* old or new can be r15 */ +		:  "r"  (m)  		: "memory" , "r0", "r1", "t");  	return retval; diff --git a/arch/sh/include/asm/cmpxchg-irq.h b/arch/sh/include/asm/cmpxchg-irq.h index 43049ec0554..bd11f630414 100644 --- a/arch/sh/include/asm/cmpxchg-irq.h +++ b/arch/sh/include/asm/cmpxchg-irq.h @@ -1,6 +1,8 @@  #ifndef __ASM_SH_CMPXCHG_IRQ_H  #define __ASM_SH_CMPXCHG_IRQ_H +#include <linux/irqflags.h> +  static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)  {  	unsigned long flags, retval; diff --git a/arch/sh/include/asm/cmpxchg.h b/arch/sh/include/asm/cmpxchg.h new file mode 100644 index 00000000000..f6bd1406b89 --- /dev/null +++ b/arch/sh/include/asm/cmpxchg.h @@ -0,0 +1,70 @@ +#ifndef __ASM_SH_CMPXCHG_H +#define __ASM_SH_CMPXCHG_H + +/* + * Atomic operations that C can't guarantee us.  Useful for + * resource counting etc.. + */ + +#include <linux/compiler.h> +#include <linux/types.h> + +#if defined(CONFIG_GUSA_RB) +#include <asm/cmpxchg-grb.h> +#elif defined(CONFIG_CPU_SH4A) +#include <asm/cmpxchg-llsc.h> +#else +#include <asm/cmpxchg-irq.h> +#endif + +extern void __xchg_called_with_bad_pointer(void); + +#define __xchg(ptr, x, size)				\ +({							\ +	unsigned long __xchg__res;			\ +	volatile void *__xchg_ptr = (ptr);		\ +	switch (size) {					\ +	case 4:						\ +		__xchg__res = xchg_u32(__xchg_ptr, x);	\ +		break;					\ +	case 1:						\ +		__xchg__res = xchg_u8(__xchg_ptr, x);	\ +		break;					\ +	default:					\ +		__xchg_called_with_bad_pointer();	\ +		__xchg__res = x;			\ +		break;					\ +	}						\ +							\ +	__xchg__res;					\ +}) + +#define xchg(ptr,x)	\ +	((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)))) + +/* This function doesn't exist, so you'll get a linker error + * if something tries to do an invalid cmpxchg(). */ +extern void __cmpxchg_called_with_bad_pointer(void); + +#define __HAVE_ARCH_CMPXCHG 1 + +static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old, +		unsigned long new, int size) +{ +	switch (size) { +	case 4: +		return __cmpxchg_u32(ptr, old, new); +	} +	__cmpxchg_called_with_bad_pointer(); +	return old; +} + +#define cmpxchg(ptr,o,n)						 \ +  ({									 \ +     __typeof__(*(ptr)) _o_ = (o);					 \ +     __typeof__(*(ptr)) _n_ = (n);					 \ +     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,		 \ +				    (unsigned long)_n_, sizeof(*(ptr))); \ +  }) + +#endif /* __ASM_SH_CMPXCHG_H */ diff --git a/arch/sh/include/asm/cpu-features.h b/arch/sh/include/asm/cpu-features.h deleted file mode 100644 index 694abe490ed..00000000000 --- a/arch/sh/include/asm/cpu-features.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __ASM_SH_CPU_FEATURES_H -#define __ASM_SH_CPU_FEATURES_H - -/* - * Processor flags - * - * Note: When adding a new flag, keep cpu_flags[] in - * arch/sh/kernel/setup.c in sync so symbolic name - * mapping of the processor flags has a chance of being - * reasonably accurate. - * - * These flags are also available through the ELF - * auxiliary vector as AT_HWCAP. - */ -#define CPU_HAS_FPU		0x0001	/* Hardware FPU support */ -#define CPU_HAS_P2_FLUSH_BUG	0x0002	/* Need to flush the cache in P2 area */ -#define CPU_HAS_MMU_PAGE_ASSOC	0x0004	/* SH3: TLB way selection bit support */ -#define CPU_HAS_DSP		0x0008	/* SH-DSP: DSP support */ -#define CPU_HAS_PERF_COUNTER	0x0010	/* Hardware performance counters */ -#define CPU_HAS_PTEA		0x0020	/* PTEA register */ -#define CPU_HAS_LLSC		0x0040	/* movli.l/movco.l */ -#define CPU_HAS_L2_CACHE	0x0080	/* Secondary cache / URAM */ -#define CPU_HAS_OP32		0x0100	/* 32-bit instruction support */ -#define CPU_HAS_PTEAEX		0x0200	/* PTE ASID Extension support */ - -#endif /* __ASM_SH_CPU_FEATURES_H */ diff --git a/arch/sh/include/asm/cputime.h b/arch/sh/include/asm/cputime.h deleted file mode 100644 index 6ca395d1393..00000000000 --- a/arch/sh/include/asm/cputime.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __SH_CPUTIME_H -#define __SH_CPUTIME_H - -#include <asm-generic/cputime.h> - -#endif /* __SH_CPUTIME_H */ diff --git a/arch/sh/include/asm/current.h b/arch/sh/include/asm/current.h deleted file mode 100644 index 4c51401b553..00000000000 --- a/arch/sh/include/asm/current.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/current.h> diff --git a/arch/sh/include/asm/delay.h b/arch/sh/include/asm/delay.h deleted file mode 100644 index 4b16bf9b56b..00000000000 --- a/arch/sh/include/asm/delay.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __ASM_SH_DELAY_H -#define __ASM_SH_DELAY_H - -/* - * Copyright (C) 1993 Linus Torvalds - * - * Delay routines calling functions in arch/sh/lib/delay.c - */ - -extern void __bad_udelay(void); -extern void __bad_ndelay(void); - -extern void __udelay(unsigned long usecs); -extern void __ndelay(unsigned long nsecs); -extern void __const_udelay(unsigned long xloops); -extern void __delay(unsigned long loops); - -#define udelay(n) (__builtin_constant_p(n) ? \ -	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \ -	__udelay(n)) - -#define ndelay(n) (__builtin_constant_p(n) ? \ -	((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ -	__ndelay(n)) - -#endif /* __ASM_SH_DELAY_H */ diff --git a/arch/sh/include/asm/device.h b/arch/sh/include/asm/device.h index b16debfe8c1..071bcb4d4bf 100644 --- a/arch/sh/include/asm/device.h +++ b/arch/sh/include/asm/device.h @@ -3,9 +3,10 @@   *   * This file is released under the GPLv2   */ +#ifndef __ASM_SH_DEVICE_H +#define __ASM_SH_DEVICE_H -struct dev_archdata { -}; +#include <asm-generic/device.h>  struct platform_device;  /* allocate contiguous memory chunk and fill in struct resource */ @@ -14,15 +15,4 @@ int platform_resource_setup_memory(struct platform_device *pdev,  void plat_early_device_setup(void); -#define PDEV_ARCHDATA_FLAG_INIT 0 -#define PDEV_ARCHDATA_FLAG_IDLE 1 -#define PDEV_ARCHDATA_FLAG_SUSP 2 - -struct pdev_archdata { -	int hwblk_id; -#ifdef CONFIG_PM_RUNTIME -	unsigned long flags; -	struct list_head entry; -	struct mutex mutex; -#endif -}; +#endif /* __ASM_SH_DEVICE_H */ diff --git a/arch/sh/include/asm/div64.h b/arch/sh/include/asm/div64.h deleted file mode 100644 index 6cd978cefb2..00000000000 --- a/arch/sh/include/asm/div64.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/div64.h> diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h index 1a73c3e759a..b437f2c780b 100644 --- a/arch/sh/include/asm/dma-mapping.h +++ b/arch/sh/include/asm/dma-mapping.h @@ -46,31 +46,38 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)  {  	struct dma_map_ops *ops = get_dma_ops(dev); +	debug_dma_mapping_error(dev, dma_addr);  	if (ops->mapping_error)  		return ops->mapping_error(dev, dma_addr);  	return dma_addr == 0;  } -static inline void *dma_alloc_coherent(struct device *dev, size_t size, -				       dma_addr_t *dma_handle, gfp_t gfp) +#define dma_alloc_coherent(d,s,h,f)	dma_alloc_attrs(d,s,h,f,NULL) + +static inline void *dma_alloc_attrs(struct device *dev, size_t size, +				    dma_addr_t *dma_handle, gfp_t gfp, +				    struct dma_attrs *attrs)  {  	struct dma_map_ops *ops = get_dma_ops(dev);  	void *memory;  	if (dma_alloc_from_coherent(dev, size, dma_handle, &memory))  		return memory; -	if (!ops->alloc_coherent) +	if (!ops->alloc)  		return NULL; -	memory = ops->alloc_coherent(dev, size, dma_handle, gfp); +	memory = ops->alloc(dev, size, dma_handle, gfp, attrs);  	debug_dma_alloc_coherent(dev, size, *dma_handle, memory);  	return memory;  } -static inline void dma_free_coherent(struct device *dev, size_t size, -				     void *vaddr, dma_addr_t dma_handle) +#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) + +static inline void dma_free_attrs(struct device *dev, size_t size, +				  void *vaddr, dma_addr_t dma_handle, +				  struct dma_attrs *attrs)  {  	struct dma_map_ops *ops = get_dma_ops(dev); @@ -78,14 +85,16 @@ static inline void dma_free_coherent(struct device *dev, size_t size,  		return;  	debug_dma_free_coherent(dev, size, vaddr, dma_handle); -	if (ops->free_coherent) -		ops->free_coherent(dev, size, vaddr, dma_handle); +	if (ops->free) +		ops->free(dev, size, vaddr, dma_handle, attrs);  }  /* arch/sh/mm/consistent.c */  extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, -					dma_addr_t *dma_addr, gfp_t flag); +					dma_addr_t *dma_addr, gfp_t flag, +					struct dma_attrs *attrs);  extern void dma_generic_free_coherent(struct device *dev, size_t size, -				      void *vaddr, dma_addr_t dma_handle); +				      void *vaddr, dma_addr_t dma_handle, +				      struct dma_attrs *attrs);  #endif /* __ASM_SH_DMA_MAPPING_H */ diff --git a/arch/sh/include/asm/dma-sh.h b/arch/sh/include/asm/dma-sh.h deleted file mode 100644 index f3acb8e34c6..00000000000 --- a/arch/sh/include/asm/dma-sh.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * arch/sh/include/asm/dma-sh.h - * - * Copyright (C) 2000  Takashi YOSHII - * Copyright (C) 2003  Paul Mundt - * - * This file is subject to the terms and conditions of the GNU General Public - * License.  See the file "COPYING" in the main directory of this archive - * for more details. - */ -#ifndef __DMA_SH_H -#define __DMA_SH_H - -#include <asm/dma-register.h> -#include <cpu/dma-register.h> -#include <cpu/dma.h> - -/* DMAOR contorl: The DMAOR access size is different by CPU.*/ -#if defined(CONFIG_CPU_SUBTYPE_SH7723)	|| \ -    defined(CONFIG_CPU_SUBTYPE_SH7724)	|| \ -    defined(CONFIG_CPU_SUBTYPE_SH7780)	|| \ -    defined(CONFIG_CPU_SUBTYPE_SH7785) -#define dmaor_read_reg(n) \ -    (n ? __raw_readw(SH_DMAC_BASE1 + DMAOR) \ -	: __raw_readw(SH_DMAC_BASE0 + DMAOR)) -#define dmaor_write_reg(n, data) \ -    (n ? __raw_writew(data, SH_DMAC_BASE1 + DMAOR) \ -    : __raw_writew(data, SH_DMAC_BASE0 + DMAOR)) -#else /* Other CPU */ -#define dmaor_read_reg(n) __raw_readw(SH_DMAC_BASE0 + DMAOR) -#define dmaor_write_reg(n, data) __raw_writew(data, SH_DMAC_BASE0 + DMAOR) -#endif - -static int dmte_irq_map[] __maybe_unused = { -#if (MAX_DMA_CHANNELS >= 4) -    DMTE0_IRQ, -    DMTE0_IRQ + 1, -    DMTE0_IRQ + 2, -    DMTE0_IRQ + 3, -#endif -#if (MAX_DMA_CHANNELS >= 6) -    DMTE4_IRQ, -    DMTE4_IRQ + 1, -#endif -#if (MAX_DMA_CHANNELS >= 8) -    DMTE6_IRQ, -    DMTE6_IRQ + 1, -#endif -#if (MAX_DMA_CHANNELS >= 12) -    DMTE8_IRQ, -    DMTE9_IRQ, -    DMTE10_IRQ, -    DMTE11_IRQ, -#endif -}; - -/* - * Define the default configuration for dual address memory-memory transfer. - * The 0x400 value represents auto-request, external->external. - */ -#define RS_DUAL	(DM_INC | SM_INC | 0x400 | TS_INDEX2VAL(XMIT_SZ_32BIT)) - -/* DMA base address */ -static u32 dma_base_addr[] __maybe_unused = { -#if (MAX_DMA_CHANNELS >= 4) -	SH_DMAC_BASE0 + 0x00,	/* channel 0 */ -	SH_DMAC_BASE0 + 0x10, -	SH_DMAC_BASE0 + 0x20, -	SH_DMAC_BASE0 + 0x30, -#endif -#if (MAX_DMA_CHANNELS >= 6) -	SH_DMAC_BASE0 + 0x50, -	SH_DMAC_BASE0 + 0x60, -#endif -#if (MAX_DMA_CHANNELS >= 8) -	SH_DMAC_BASE1 + 0x00, -	SH_DMAC_BASE1 + 0x10, -#endif -#if (MAX_DMA_CHANNELS >= 12) -	SH_DMAC_BASE1 + 0x20, -	SH_DMAC_BASE1 + 0x30, -	SH_DMAC_BASE1 + 0x50, -	SH_DMAC_BASE1 + 0x60, /* channel 11 */ -#endif -}; - -#endif /* __DMA_SH_H */ diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h index 07373a07409..fb6e4f7b00a 100644 --- a/arch/sh/include/asm/dma.h +++ b/arch/sh/include/asm/dma.h @@ -14,18 +14,9 @@  #include <linux/spinlock.h>  #include <linux/wait.h>  #include <linux/sched.h> -#include <linux/sysdev.h> -#include <cpu/dma.h> +#include <linux/device.h>  #include <asm-generic/dma.h> -#ifdef CONFIG_NR_DMA_CHANNELS -#  define MAX_DMA_CHANNELS	(CONFIG_NR_DMA_CHANNELS) -#elif defined(CONFIG_NR_ONCHIP_DMA_CHANNELS) -#  define MAX_DMA_CHANNELS	(CONFIG_NR_ONCHIP_DMA_CHANNELS) -#else -#  define MAX_DMA_CHANNELS	0 -#endif -  /*   * Read and write modes can mean drastically different things depending on the   * channel configuration. Consult your DMAC documentation and module @@ -91,7 +82,7 @@ struct dma_channel {  	wait_queue_head_t wait_queue; -	struct sys_device dev; +	struct device dev;  	void *priv_data;  }; diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h index f38112be67d..bf9f44f17c2 100644 --- a/arch/sh/include/asm/elf.h +++ b/arch/sh/include/asm/elf.h @@ -183,7 +183,8 @@ do {									\  } while (0)  #endif -#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) +#define SET_PERSONALITY(ex) \ +	set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK)))  #ifdef CONFIG_VSYSCALL  /* vDSO has arch_setup_additional_pages */ @@ -202,9 +203,9 @@ extern void __kernel_vsyscall;  	if (vdso_enabled)					\  		NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE);	\  	else							\ -		NEW_AUX_ENT(AT_IGNORE, 0); +		NEW_AUX_ENT(AT_IGNORE, 0)  #else -#define VSYSCALL_AUX_ENT +#define VSYSCALL_AUX_ENT	NEW_AUX_ENT(AT_IGNORE, 0)  #endif /* CONFIG_VSYSCALL */  #ifdef CONFIG_SH_FPU diff --git a/arch/sh/include/asm/emergency-restart.h b/arch/sh/include/asm/emergency-restart.h deleted file mode 100644 index 108d8c48e42..00000000000 --- a/arch/sh/include/asm/emergency-restart.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_EMERGENCY_RESTART_H -#define _ASM_EMERGENCY_RESTART_H - -#include <asm-generic/emergency-restart.h> - -#endif /* _ASM_EMERGENCY_RESTART_H */ diff --git a/arch/sh/include/asm/errno.h b/arch/sh/include/asm/errno.h deleted file mode 100644 index 51cf6f9cebb..00000000000 --- a/arch/sh/include/asm/errno.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_SH_ERRNO_H -#define __ASM_SH_ERRNO_H - -#include <asm-generic/errno.h> - -#endif /* __ASM_SH_ERRNO_H */ diff --git a/arch/sh/include/asm/fcntl.h b/arch/sh/include/asm/fcntl.h deleted file mode 100644 index 46ab12db573..00000000000 --- a/arch/sh/include/asm/fcntl.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/fcntl.h> diff --git a/arch/sh/include/asm/fixmap.h b/arch/sh/include/asm/fixmap.h index bd7e79a1265..4daf91c3b72 100644 --- a/arch/sh/include/asm/fixmap.h +++ b/arch/sh/include/asm/fixmap.h @@ -79,13 +79,6 @@ extern void __set_fixmap(enum fixed_addresses idx,  			 unsigned long phys, pgprot_t flags);  extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags); -#define set_fixmap(idx, phys) \ -		__set_fixmap(idx, phys, PAGE_KERNEL) -/* - * Some hardware wants to get fixmapped without caching. - */ -#define set_fixmap_nocache(idx, phys) \ -		__set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)  /*   * used by vmalloc.c.   * @@ -96,41 +89,13 @@ extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags);  #ifdef CONFIG_SUPERH32  #define FIXADDR_TOP	(P4SEG - PAGE_SIZE)  #else -#define FIXADDR_TOP	(0xff000000 - PAGE_SIZE) +#define FIXADDR_TOP	((unsigned long)(-PAGE_SIZE))  #endif  #define FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)  #define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE) -#define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix(x)	((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist(void); - -/* - * 'index to address' translation. If anyone tries to use the idx - * directly without tranlation, we catch the bug with a NULL-deference - * kernel oops. Illegal ranges of incoming indices are caught too. - */ -static inline unsigned long fix_to_virt(const unsigned int idx) -{ -	/* -	 * this branch gets completely eliminated after inlining, -	 * except when someone tries to use fixaddr indices in an -	 * illegal way. (such as mixing up address types or using -	 * out-of-range indices). -	 * -	 * If it doesn't get removed, the linker will complain -	 * loudly with a reasonably clear error message.. -	 */ -	if (idx >= __end_of_fixed_addresses) -		__this_fixmap_does_not_exist(); +#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE -        return __fix_to_virt(idx); -} +#include <asm-generic/fixmap.h> -static inline unsigned long virt_to_fix(const unsigned long vaddr) -{ -	BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); -	return __virt_to_fix(vaddr); -}  #endif diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h index 06c4281aab6..09fc2bc8a79 100644 --- a/arch/sh/include/asm/fpu.h +++ b/arch/sh/include/asm/fpu.h @@ -46,7 +46,7 @@ static inline void __unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)  		save_fpu(tsk);  		release_fpu(regs);  	} else -		tsk->fpu_counter = 0; +		tsk->thread.fpu_counter = 0;  }  static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs) diff --git a/arch/sh/include/asm/ftrace.h b/arch/sh/include/asm/ftrace.h index 13e9966464c..e79fb6ebaa4 100644 --- a/arch/sh/include/asm/ftrace.h +++ b/arch/sh/include/asm/ftrace.h @@ -40,15 +40,7 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)  /* arch/sh/kernel/return_address.c */  extern void *return_address(unsigned int); -#define HAVE_ARCH_CALLER_ADDR - -#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) -#define CALLER_ADDR1 ((unsigned long)return_address(1)) -#define CALLER_ADDR2 ((unsigned long)return_address(2)) -#define CALLER_ADDR3 ((unsigned long)return_address(3)) -#define CALLER_ADDR4 ((unsigned long)return_address(4)) -#define CALLER_ADDR5 ((unsigned long)return_address(5)) -#define CALLER_ADDR6 ((unsigned long)return_address(6)) +#define ftrace_return_address(n) return_address(n)  #endif /* __ASSEMBLY__ */ diff --git a/arch/sh/include/asm/futex-irq.h b/arch/sh/include/asm/futex-irq.h index a9f16a7f9ae..63d33129ea2 100644 --- a/arch/sh/include/asm/futex-irq.h +++ b/arch/sh/include/asm/futex-irq.h @@ -1,9 +1,8 @@  #ifndef __ASM_SH_FUTEX_IRQ_H  #define __ASM_SH_FUTEX_IRQ_H -#include <asm/system.h> -static inline int atomic_futex_op_xchg_set(int oparg, int __user *uaddr, +static inline int atomic_futex_op_xchg_set(int oparg, u32 __user *uaddr,  					   int *oldval)  {  	unsigned long flags; @@ -20,7 +19,7 @@ static inline int atomic_futex_op_xchg_set(int oparg, int __user *uaddr,  	return ret;  } -static inline int atomic_futex_op_xchg_add(int oparg, int __user *uaddr, +static inline int atomic_futex_op_xchg_add(int oparg, u32 __user *uaddr,  					   int *oldval)  {  	unsigned long flags; @@ -37,7 +36,7 @@ static inline int atomic_futex_op_xchg_add(int oparg, int __user *uaddr,  	return ret;  } -static inline int atomic_futex_op_xchg_or(int oparg, int __user *uaddr, +static inline int atomic_futex_op_xchg_or(int oparg, u32 __user *uaddr,  					  int *oldval)  {  	unsigned long flags; @@ -54,7 +53,7 @@ static inline int atomic_futex_op_xchg_or(int oparg, int __user *uaddr,  	return ret;  } -static inline int atomic_futex_op_xchg_and(int oparg, int __user *uaddr, +static inline int atomic_futex_op_xchg_and(int oparg, u32 __user *uaddr,  					   int *oldval)  {  	unsigned long flags; @@ -71,7 +70,7 @@ static inline int atomic_futex_op_xchg_and(int oparg, int __user *uaddr,  	return ret;  } -static inline int atomic_futex_op_xchg_xor(int oparg, int __user *uaddr, +static inline int atomic_futex_op_xchg_xor(int oparg, u32 __user *uaddr,  					   int *oldval)  {  	unsigned long flags; @@ -88,11 +87,13 @@ static inline int atomic_futex_op_xchg_xor(int oparg, int __user *uaddr,  	return ret;  } -static inline int atomic_futex_op_cmpxchg_inatomic(int __user *uaddr, -						   int oldval, int newval) +static inline int atomic_futex_op_cmpxchg_inatomic(u32 *uval, +						   u32 __user *uaddr, +						   u32 oldval, u32 newval)  {  	unsigned long flags; -	int ret, prev = 0; +	int ret; +	u32 prev = 0;  	local_irq_save(flags); @@ -102,10 +103,8 @@ static inline int atomic_futex_op_cmpxchg_inatomic(int __user *uaddr,  	local_irq_restore(flags); -	if (ret) -		return ret; - -	return prev; +	*uval = prev; +	return ret;  }  #endif /* __ASM_SH_FUTEX_IRQ_H */ diff --git a/arch/sh/include/asm/futex.h b/arch/sh/include/asm/futex.h index 68256ec5fa3..7be39a646fb 100644 --- a/arch/sh/include/asm/futex.h +++ b/arch/sh/include/asm/futex.h @@ -10,7 +10,7 @@  /* XXX: UP variants, fix for SH-4A and SMP.. */  #include <asm/futex-irq.h> -static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr) +static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)  {  	int op = (encoded_op >> 28) & 7;  	int cmp = (encoded_op >> 24) & 15; @@ -21,7 +21,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)  	if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))  		oparg = 1 << oparg; -	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) +	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))  		return -EFAULT;  	pagefault_disable(); @@ -65,12 +65,13 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)  }  static inline int -futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) +futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, +			      u32 oldval, u32 newval)  { -	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) +	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))  		return -EFAULT; -	return atomic_futex_op_cmpxchg_inatomic(uaddr, oldval, newval); +	return atomic_futex_op_cmpxchg_inatomic(uval, uaddr, oldval, newval);  }  #endif /* __KERNEL__ */ diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h index 04f53d31489..7dfe15e2e99 100644 --- a/arch/sh/include/asm/gpio.h +++ b/arch/sh/include/asm/gpio.h @@ -20,7 +20,7 @@  #endif  #define ARCH_NR_GPIOS 512 -#include <linux/sh_pfc.h> +#include <asm-generic/gpio.h>  #ifdef CONFIG_GPIOLIB diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index 967068fb79a..699255d6d1c 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -1,7 +1,9 @@  #ifndef _ASM_SH_HUGETLB_H  #define _ASM_SH_HUGETLB_H +#include <asm/cacheflush.h>  #include <asm/page.h> +#include <asm-generic/hugetlb.h>  static inline int is_hugepage_only_range(struct mm_struct *mm, @@ -89,4 +91,9 @@ static inline void arch_release_hugepage(struct page *page)  {  } +static inline void arch_clear_hugepage_flags(struct page *page) +{ +	clear_bit(PG_dcache_clean, &page->flags); +} +  #endif /* _ASM_SH_HUGETLB_H */ diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h index 89890f61a7b..ec9ad593c3d 100644 --- a/arch/sh/include/asm/hw_breakpoint.h +++ b/arch/sh/include/asm/hw_breakpoint.h @@ -1,7 +1,8 @@  #ifndef __ASM_SH_HW_BREAKPOINT_H  #define __ASM_SH_HW_BREAKPOINT_H -#ifdef __KERNEL__ +#include <uapi/asm/hw_breakpoint.h> +  #define __ARCH_HW_BREAKPOINT_H  #include <linux/kdebug.h> @@ -66,5 +67,4 @@ extern int register_sh_ubc(struct sh_ubc *);  extern struct pmu perf_ops_bp; -#endif /* __KERNEL__ */  #endif /* __ASM_SH_HW_BREAKPOINT_H */ diff --git a/arch/sh/include/asm/hw_irq.h b/arch/sh/include/asm/hw_irq.h index 603cdde813d..693d4418405 100644 --- a/arch/sh/include/asm/hw_irq.h +++ b/arch/sh/include/asm/hw_irq.h @@ -3,7 +3,7 @@  #include <linux/init.h>  #include <linux/sh_intc.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  extern atomic_t irq_err_count; diff --git a/arch/sh/include/asm/hwblk.h b/arch/sh/include/asm/hwblk.h deleted file mode 100644 index 855e945c619..00000000000 --- a/arch/sh/include/asm/hwblk.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __ASM_SH_HWBLK_H -#define __ASM_SH_HWBLK_H - -#include <asm/clock.h> -#include <asm/io.h> - -#define HWBLK_CNT_USAGE 0 -#define HWBLK_CNT_IDLE 1 -#define HWBLK_CNT_DEVICES 2 -#define HWBLK_CNT_NR 3 - -#define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */ - -#define HWBLK_AREA(_flags, _parent)		\ -{						\ -	.flags = _flags,			\ -	.parent = _parent,			\ -} - -struct hwblk_area { -	int cnt[HWBLK_CNT_NR]; -	unsigned char parent; -	unsigned char flags; -}; - -#define HWBLK(_mstp, _bit, _area)		\ -{						\ -	.mstp = (void __iomem *)_mstp,		\ -	.bit = _bit,				\ -	.area = _area,				\ -} - -struct hwblk { -	void __iomem *mstp; -	unsigned char bit; -	unsigned char area; -	int cnt[HWBLK_CNT_NR]; -}; - -struct hwblk_info { -	struct hwblk_area *areas; -	int nr_areas; -	struct hwblk *hwblks; -	int nr_hwblks; -}; - -/* Should be defined by processor-specific code */ -int arch_hwblk_init(void); -int arch_hwblk_sleep_mode(void); - -int hwblk_register(struct hwblk_info *info); -int hwblk_init(void); - -void hwblk_enable(struct hwblk_info *info, int hwblk); -void hwblk_disable(struct hwblk_info *info, int hwblk); - -void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt); -void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt); - -/* allow clocks to enable and disable hardware blocks */ -#define SH_HWBLK_CLK(_hwblk, _parent, _flags)	\ -[_hwblk] = {					\ -	.parent		= _parent,		\ -	.arch_flags	= _hwblk,		\ -	.flags		= _flags,		\ -} - -int sh_hwblk_clk_register(struct clk *clks, int nr); - -#endif /* __ASM_SH_HWBLK_H */ diff --git a/arch/sh/include/asm/i2c-sh7760.h b/arch/sh/include/asm/i2c-sh7760.h index 24182116711..69fee1239b0 100644 --- a/arch/sh/include/asm/i2c-sh7760.h +++ b/arch/sh/include/asm/i2c-sh7760.h @@ -9,11 +9,9 @@  #define SH7760_I2C0_MMIO	0xFE140000  #define SH7760_I2C0_MMIOEND	0xFE14003B -#define SH7760_I2C0_IRQ		62  #define SH7760_I2C1_MMIO	0xFE150000  #define SH7760_I2C1_MMIOEND	0xFE15003B -#define SH7760_I2C1_IRQ		63  struct sh7760_i2c_platdata {  	unsigned int speed_khz; diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index b237d525d59..728c4c571f4 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -1,5 +1,6 @@  #ifndef __ASM_SH_IO_H  #define __ASM_SH_IO_H +  /*   * Convention:   *    read{b,w,l,q}/write{b,w,l,q} are for PCI, @@ -10,59 +11,19 @@   *   * While read{b,w,l,q} and write{b,w,l,q} contain memory barriers   * automatically, there are also __raw versions, which do not. - * - * Historically, we have also had ctrl_in{b,w,l,q}/ctrl_out{b,w,l,q} for - * SuperH specific I/O (raw I/O to on-chip CPU peripherals). In practice - * these have the same semantics as the __raw variants, and as such, all - * new code should be using the __raw versions. - * - * All ISA I/O routines are wrapped through the machine vector. If a - * board does not provide overrides, a generic set that are copied in - * from the default machine vector are used instead. These are largely - * for old compat code for I/O offseting to SuperIOs, all of which are - * better handled through the machvec ioport mapping routines these days.   */  #include <linux/errno.h>  #include <asm/cache.h> -#include <asm/system.h>  #include <asm/addrspace.h>  #include <asm/machvec.h>  #include <asm/pgtable.h>  #include <asm-generic/iomap.h>  #ifdef __KERNEL__ -/* - * Depending on which platform we are running on, we need different - * I/O functions. - */ -#define __IO_PREFIX	generic +#define __IO_PREFIX     generic  #include <asm/io_generic.h>  #include <asm/io_trapped.h> - -#ifdef CONFIG_HAS_IOPORT - -#define inb(p)			sh_mv.mv_inb((p)) -#define inw(p)			sh_mv.mv_inw((p)) -#define inl(p)			sh_mv.mv_inl((p)) -#define outb(x,p)		sh_mv.mv_outb((x),(p)) -#define outw(x,p)		sh_mv.mv_outw((x),(p)) -#define outl(x,p)		sh_mv.mv_outl((x),(p)) - -#define inb_p(p)		sh_mv.mv_inb_p((p)) -#define inw_p(p)		sh_mv.mv_inw_p((p)) -#define inl_p(p)		sh_mv.mv_inl_p((p)) -#define outb_p(x,p)		sh_mv.mv_outb_p((x),(p)) -#define outw_p(x,p)		sh_mv.mv_outw_p((x),(p)) -#define outl_p(x,p)		sh_mv.mv_outl_p((x),(p)) - -#define insb(p,b,c)		sh_mv.mv_insb((p), (b), (c)) -#define insw(p,b,c)		sh_mv.mv_insw((p), (b), (c)) -#define insl(p,b,c)		sh_mv.mv_insl((p), (b), (c)) -#define outsb(p,b,c)		sh_mv.mv_outsb((p), (b), (c)) -#define outsw(p,b,c)		sh_mv.mv_outsw((p), (b), (c)) -#define outsl(p,b,c)		sh_mv.mv_outsl((p), (b), (c)) - -#endif +#include <mach/mangle-port.h>  #define __raw_writeb(v,a)	(__chk_io_ptr(a), *(volatile u8  __force *)(a) = (v))  #define __raw_writew(v,a)	(__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v)) @@ -74,68 +35,33 @@  #define __raw_readl(a)		(__chk_io_ptr(a), *(volatile u32 __force *)(a))  #define __raw_readq(a)		(__chk_io_ptr(a), *(volatile u64 __force *)(a)) -#define readb(a)		({ u8  r_ = __raw_readb(a); mb(); r_; }) -#define readw(a)		({ u16 r_ = __raw_readw(a); mb(); r_; }) -#define readl(a)		({ u32 r_ = __raw_readl(a); mb(); r_; }) -#define readq(a)		({ u64 r_ = __raw_readq(a); mb(); r_; }) - -#define writeb(v,a)		({ __raw_writeb((v),(a)); mb(); }) -#define writew(v,a)		({ __raw_writew((v),(a)); mb(); }) -#define writel(v,a)		({ __raw_writel((v),(a)); mb(); }) -#define writeq(v,a)		({ __raw_writeq((v),(a)); mb(); }) - -/* - * Legacy SuperH on-chip I/O functions - * - * These are all deprecated, all new (and especially cross-platform) code - * should be using the __raw_xxx() routines directly. - */ -static inline u8 __deprecated ctrl_inb(unsigned long addr) -{ -	return __raw_readb(addr); -} - -static inline u16 __deprecated ctrl_inw(unsigned long addr) -{ -	return __raw_readw(addr); -} - -static inline u32 __deprecated ctrl_inl(unsigned long addr) -{ -	return __raw_readl(addr); -} - -static inline u64 __deprecated ctrl_inq(unsigned long addr) -{ -	return __raw_readq(addr); -} - -static inline void __deprecated ctrl_outb(u8 v, unsigned long addr) -{ -	__raw_writeb(v, addr); -} +#define readb_relaxed(c)	({ u8  __v = ioswabb(__raw_readb(c)); __v; }) +#define readw_relaxed(c)	({ u16 __v = ioswabw(__raw_readw(c)); __v; }) +#define readl_relaxed(c)	({ u32 __v = ioswabl(__raw_readl(c)); __v; }) +#define readq_relaxed(c)	({ u64 __v = ioswabq(__raw_readq(c)); __v; }) -static inline void __deprecated ctrl_outw(u16 v, unsigned long addr) -{ -	__raw_writew(v, addr); -} +#define writeb_relaxed(v,c)	((void)__raw_writeb((__force  u8)ioswabb(v),c)) +#define writew_relaxed(v,c)	((void)__raw_writew((__force u16)ioswabw(v),c)) +#define writel_relaxed(v,c)	((void)__raw_writel((__force u32)ioswabl(v),c)) +#define writeq_relaxed(v,c)	((void)__raw_writeq((__force u64)ioswabq(v),c)) -static inline void __deprecated ctrl_outl(u32 v, unsigned long addr) -{ -	__raw_writel(v, addr); -} +#define readb(a)		({ u8  r_ = readb_relaxed(a); rmb(); r_; }) +#define readw(a)		({ u16 r_ = readw_relaxed(a); rmb(); r_; }) +#define readl(a)		({ u32 r_ = readl_relaxed(a); rmb(); r_; }) +#define readq(a)		({ u64 r_ = readq_relaxed(a); rmb(); r_; }) -static inline void __deprecated ctrl_outq(u64 v, unsigned long addr) -{ -	__raw_writeq(v, addr); -} +#define writeb(v,a)		({ wmb(); writeb_relaxed((v),(a)); }) +#define writew(v,a)		({ wmb(); writew_relaxed((v),(a)); }) +#define writel(v,a)		({ wmb(); writel_relaxed((v),(a)); }) +#define writeq(v,a)		({ wmb(); writeq_relaxed((v),(a)); }) -extern unsigned long generic_io_base; +#define readsb(p,d,l)		__raw_readsb(p,d,l) +#define readsw(p,d,l)		__raw_readsw(p,d,l) +#define readsl(p,d,l)		__raw_readsl(p,d,l) -static inline void ctrl_delay(void) -{ -	__raw_readw(generic_io_base); -} +#define writesb(p,d,l)		__raw_writesb(p,d,l) +#define writesw(p,d,l)		__raw_writesw(p,d,l) +#define writesl(p,d,l)		__raw_writesl(p,d,l)  #define __BUILD_UNCACHED_IO(bwlq, type)					\  static inline type read##bwlq##_uncached(unsigned long addr)		\ @@ -159,10 +85,11 @@ __BUILD_UNCACHED_IO(w, u16)  __BUILD_UNCACHED_IO(l, u32)  __BUILD_UNCACHED_IO(q, u64) -#define __BUILD_MEMORY_STRING(bwlq, type)				\ +#define __BUILD_MEMORY_STRING(pfx, bwlq, type)				\  									\ -static inline void __raw_writes##bwlq(volatile void __iomem *mem,	\ -				const void *addr, unsigned int count)	\ +static inline void							\ +pfx##writes##bwlq(volatile void __iomem *mem, const void *addr,		\ +		  unsigned int count)					\  {									\  	const volatile type *__addr = addr;				\  									\ @@ -172,8 +99,8 @@ static inline void __raw_writes##bwlq(volatile void __iomem *mem,	\  	}								\  }									\  									\ -static inline void __raw_reads##bwlq(volatile void __iomem *mem,	\ -			       void *addr, unsigned int count)		\ +static inline void pfx##reads##bwlq(volatile void __iomem *mem,		\ +				    void *addr, unsigned int count)	\  {									\  	volatile type *__addr = addr;					\  									\ @@ -183,86 +110,126 @@ static inline void __raw_reads##bwlq(volatile void __iomem *mem,	\  	}								\  } -__BUILD_MEMORY_STRING(b, u8) -__BUILD_MEMORY_STRING(w, u16) +__BUILD_MEMORY_STRING(__raw_, b, u8) +__BUILD_MEMORY_STRING(__raw_, w, u16)  #ifdef CONFIG_SUPERH32  void __raw_writesl(void __iomem *addr, const void *data, int longlen);  void __raw_readsl(const void __iomem *addr, void *data, int longlen);  #else -__BUILD_MEMORY_STRING(l, u32) +__BUILD_MEMORY_STRING(__raw_, l, u32)  #endif -__BUILD_MEMORY_STRING(q, u64) - -#define writesb			__raw_writesb -#define writesw			__raw_writesw -#define writesl			__raw_writesl - -#define readsb			__raw_readsb -#define readsw			__raw_readsw -#define readsl			__raw_readsl - -#define readb_relaxed(a)	readb(a) -#define readw_relaxed(a)	readw(a) -#define readl_relaxed(a)	readl(a) -#define readq_relaxed(a)	readq(a) - -#ifndef CONFIG_GENERIC_IOMAP -/* Simple MMIO */ -#define ioread8(a)		__raw_readb(a) -#define ioread16(a)		__raw_readw(a) -#define ioread16be(a)		be16_to_cpu(__raw_readw((a))) -#define ioread32(a)		__raw_readl(a) -#define ioread32be(a)		be32_to_cpu(__raw_readl((a))) - -#define iowrite8(v,a)		__raw_writeb((v),(a)) -#define iowrite16(v,a)		__raw_writew((v),(a)) -#define iowrite16be(v,a)	__raw_writew(cpu_to_be16((v)),(a)) -#define iowrite32(v,a)		__raw_writel((v),(a)) -#define iowrite32be(v,a)	__raw_writel(cpu_to_be32((v)),(a)) - -#define ioread8_rep(a, d, c)	__raw_readsb((a), (d), (c)) -#define ioread16_rep(a, d, c)	__raw_readsw((a), (d), (c)) -#define ioread32_rep(a, d, c)	__raw_readsl((a), (d), (c)) - -#define iowrite8_rep(a, s, c)	__raw_writesb((a), (s), (c)) -#define iowrite16_rep(a, s, c)	__raw_writesw((a), (s), (c)) -#define iowrite32_rep(a, s, c)	__raw_writesl((a), (s), (c)) -#endif - -#define mmio_insb(p,d,c)	__raw_readsb(p,d,c) -#define mmio_insw(p,d,c)	__raw_readsw(p,d,c) -#define mmio_insl(p,d,c)	__raw_readsl(p,d,c) - -#define mmio_outsb(p,s,c)	__raw_writesb(p,s,c) -#define mmio_outsw(p,s,c)	__raw_writesw(p,s,c) -#define mmio_outsl(p,s,c)	__raw_writesl(p,s,c) +__BUILD_MEMORY_STRING(__raw_, q, u64) -/* synco on SH-4A, otherwise a nop */ -#define mmiowb()		wmb() +#ifdef CONFIG_HAS_IOPORT_MAP -#define IO_SPACE_LIMIT 0xffffffff - -#ifdef CONFIG_HAS_IOPORT +/* + * Slowdown I/O port space accesses for antique hardware. + */ +#undef CONF_SLOWDOWN_IO  /* - * This function provides a method for the generic case where a - * board-specific ioport_map simply needs to return the port + some - * arbitrary port base. - * - * We use this at board setup time to implicitly set the port base, and - * as a result, we can use the generic ioport_map. + * On SuperH I/O ports are memory mapped, so we access them using normal + * load/store instructions. sh_io_port_base is the virtual address to + * which all ports are being mapped.   */ +extern unsigned long sh_io_port_base; +  static inline void __set_io_port_base(unsigned long pbase)  { -	generic_io_base = pbase; +	*(unsigned long *)&sh_io_port_base = pbase; +	barrier();  } -#define __ioport_map(p, n) sh_mv.mv_ioport_map((p), (n)) +#ifdef CONFIG_GENERIC_IOMAP +#define __ioport_map ioport_map +#else +extern void __iomem *__ioport_map(unsigned long addr, unsigned int size); +#endif +#ifdef CONF_SLOWDOWN_IO +#define SLOW_DOWN_IO __raw_readw(sh_io_port_base) +#else +#define SLOW_DOWN_IO  #endif +#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow)			\ +									\ +static inline void pfx##out##bwlq##p(type val, unsigned long port)	\ +{									\ +	volatile type *__addr;						\ +									\ +	__addr = __ioport_map(port, sizeof(type));			\ +	*__addr = val;							\ +	slow;								\ +}									\ +									\ +static inline type pfx##in##bwlq##p(unsigned long port)			\ +{									\ +	volatile type *__addr;						\ +	type __val;							\ +									\ +	__addr = __ioport_map(port, sizeof(type));			\ +	__val = *__addr;						\ +	slow;								\ +									\ +	return __val;							\ +} + +#define __BUILD_IOPORT_PFX(bus, bwlq, type)				\ +	__BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)			\ +	__BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) + +#define BUILDIO_IOPORT(bwlq, type)					\ +	__BUILD_IOPORT_PFX(, bwlq, type) + +BUILDIO_IOPORT(b, u8) +BUILDIO_IOPORT(w, u16) +BUILDIO_IOPORT(l, u32) +BUILDIO_IOPORT(q, u64) + +#define __BUILD_IOPORT_STRING(bwlq, type)				\ +									\ +static inline void outs##bwlq(unsigned long port, const void *addr,	\ +			      unsigned int count)			\ +{									\ +	const volatile type *__addr = addr;				\ +									\ +	while (count--) {						\ +		out##bwlq(*__addr, port);				\ +		__addr++;						\ +	}								\ +}									\ +									\ +static inline void ins##bwlq(unsigned long port, void *addr,		\ +			     unsigned int count)			\ +{									\ +	volatile type *__addr = addr;					\ +									\ +	while (count--) {						\ +		*__addr = in##bwlq(port);				\ +		__addr++;						\ +	}								\ +} + +__BUILD_IOPORT_STRING(b, u8) +__BUILD_IOPORT_STRING(w, u16) +__BUILD_IOPORT_STRING(l, u32) +__BUILD_IOPORT_STRING(q, u64) + +#else /* !CONFIG_HAS_IOPORT_MAP */ + +#include <asm/io_noioport.h> + +#endif + + +#define IO_SPACE_LIMIT 0xffffffff + +/* synco on SH-4A, otherwise a nop */ +#define mmiowb()		wmb() +  /* We really want to try and get these to memcpy etc */  void memcpy_fromio(void *, const volatile void __iomem *, unsigned long);  void memcpy_toio(volatile void __iomem *, const void *, unsigned long); @@ -322,7 +289,15 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)  	 * mapping must be done by the PMB or by using page tables.  	 */  	if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) { -		if (unlikely(pgprot_val(prot) & _PAGE_CACHABLE)) +		u64 flags = pgprot_val(prot); + +		/* +		 * Anything using the legacy PTEA space attributes needs +		 * to be kicked down to page table mappings. +		 */ +		if (unlikely(flags & _PAGE_PCC_MASK)) +			return NULL; +		if (unlikely(flags & _PAGE_CACHABLE))  			return (void __iomem *)P1SEGADDR(offset);  		return (void __iomem *)P2SEGADDR(offset); @@ -395,10 +370,6 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }  #define ioremap_nocache	ioremap  #define iounmap		__iounmap -#define maybebadio(port) \ -	printk(KERN_ERR "bad PC-like io %s:%u for port 0x%lx at 0x%08x\n", \ -	       __func__, __LINE__, (port), (u32)__builtin_return_address(0)) -  /*   * Convert a physical pointer to a virtual kernel pointer for /dev/mem   * access @@ -411,7 +382,7 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }  #define xlate_dev_kmem_ptr(p)	p  #define ARCH_HAS_VALID_PHYS_ADDR_RANGE -int valid_phys_addr_range(unsigned long addr, size_t size); +int valid_phys_addr_range(phys_addr_t addr, size_t size);  int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);  #endif /* __KERNEL__ */ diff --git a/arch/sh/include/asm/io_generic.h b/arch/sh/include/asm/io_generic.h index 491df93cbf8..b5f6956f19c 100644 --- a/arch/sh/include/asm/io_generic.h +++ b/arch/sh/include/asm/io_generic.h @@ -11,31 +11,6 @@  #error "Don't include this header without a valid system prefix"  #endif -u8 IO_CONCAT(__IO_PREFIX,inb)(unsigned long); -u16 IO_CONCAT(__IO_PREFIX,inw)(unsigned long); -u32 IO_CONCAT(__IO_PREFIX,inl)(unsigned long); - -void IO_CONCAT(__IO_PREFIX,outb)(u8, unsigned long); -void IO_CONCAT(__IO_PREFIX,outw)(u16, unsigned long); -void IO_CONCAT(__IO_PREFIX,outl)(u32, unsigned long); - -u8 IO_CONCAT(__IO_PREFIX,inb_p)(unsigned long); -u16 IO_CONCAT(__IO_PREFIX,inw_p)(unsigned long); -u32 IO_CONCAT(__IO_PREFIX,inl_p)(unsigned long); -void IO_CONCAT(__IO_PREFIX,outb_p)(u8, unsigned long); -void IO_CONCAT(__IO_PREFIX,outw_p)(u16, unsigned long); -void IO_CONCAT(__IO_PREFIX,outl_p)(u32, unsigned long); - -void IO_CONCAT(__IO_PREFIX,insb)(unsigned long, void *dst, unsigned long count); -void IO_CONCAT(__IO_PREFIX,insw)(unsigned long, void *dst, unsigned long count); -void IO_CONCAT(__IO_PREFIX,insl)(unsigned long, void *dst, unsigned long count); -void IO_CONCAT(__IO_PREFIX,outsb)(unsigned long, const void *src, unsigned long count); -void IO_CONCAT(__IO_PREFIX,outsw)(unsigned long, const void *src, unsigned long count); -void IO_CONCAT(__IO_PREFIX,outsl)(unsigned long, const void *src, unsigned long count); - -void *IO_CONCAT(__IO_PREFIX,ioremap)(unsigned long offset, unsigned long size); -void IO_CONCAT(__IO_PREFIX,iounmap)(void *addr); -  void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size);  void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr);  void IO_CONCAT(__IO_PREFIX,mem_init)(void); diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h new file mode 100644 index 00000000000..4d48f1436a6 --- /dev/null +++ b/arch/sh/include/asm/io_noioport.h @@ -0,0 +1,52 @@ +#ifndef __ASM_SH_IO_NOIOPORT_H +#define __ASM_SH_IO_NOIOPORT_H + +static inline u8 inb(unsigned long addr) +{ +	BUG(); +	return -1; +} + +static inline u16 inw(unsigned long addr) +{ +	BUG(); +	return -1; +} + +static inline u32 inl(unsigned long addr) +{ +	BUG(); +	return -1; +} + +static inline void outb(unsigned char x, unsigned long port) +{ +	BUG(); +} + +static inline void outw(unsigned short x, unsigned long port) +{ +	BUG(); +} + +static inline void outl(unsigned int x, unsigned long port) +{ +	BUG(); +} + +#define inb_p(addr)	inb(addr) +#define inw_p(addr)	inw(addr) +#define inl_p(addr)	inl(addr) +#define outb_p(x, addr)	outb((x), (addr)) +#define outw_p(x, addr)	outw((x), (addr)) +#define outl_p(x, addr)	outl((x), (addr)) + +#define insb(a, b, c)	BUG() +#define insw(a, b, c)	BUG() +#define insl(a, b, c)	BUG() + +#define outsb(a, b, c)	BUG() +#define outsw(a, b, c)	BUG() +#define outsl(a, b, c)	BUG() + +#endif /* __ASM_SH_IO_NOIOPORT_H */ diff --git a/arch/sh/include/asm/io_trapped.h b/arch/sh/include/asm/io_trapped.h index f1251d4f0ba..4ab94ef5107 100644 --- a/arch/sh/include/asm/io_trapped.h +++ b/arch/sh/include/asm/io_trapped.h @@ -36,7 +36,7 @@ __ioremap_trapped(unsigned long offset, unsigned long size)  #define __ioremap_trapped(offset, size) NULL  #endif -#ifdef CONFIG_HAS_IOPORT +#ifdef CONFIG_HAS_IOPORT_MAP  extern struct list_head trapped_io;  static inline void __iomem * diff --git a/arch/sh/include/asm/ioctl.h b/arch/sh/include/asm/ioctl.h deleted file mode 100644 index b279fe06dfe..00000000000 --- a/arch/sh/include/asm/ioctl.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/ioctl.h> diff --git a/arch/sh/include/asm/ioctls.h b/arch/sh/include/asm/ioctls.h deleted file mode 100644 index eb6c4c68797..00000000000 --- a/arch/sh/include/asm/ioctls.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef __ASM_SH_IOCTLS_H -#define __ASM_SH_IOCTLS_H - -#include <asm/ioctl.h> - -#define FIOCLEX		_IO('f', 1) -#define FIONCLEX	_IO('f', 2) -#define FIOASYNC	_IOW('f', 125, int) -#define FIONBIO		_IOW('f', 126, int) -#define FIONREAD	_IOR('f', 127, int) -#define TIOCINQ		FIONREAD -#define FIOQSIZE	_IOR('f', 128, loff_t) - -#define TCGETS		0x5401 -#define TCSETS		0x5402 -#define TCSETSW		0x5403 -#define TCSETSF		0x5404 - -#define TCGETA		0x80127417	/* _IOR('t', 23, struct termio) */ -#define TCSETA		0x40127418	/* _IOW('t', 24, struct termio) */ -#define TCSETAW		0x40127419	/* _IOW('t', 25, struct termio) */ -#define TCSETAF		0x4012741C	/* _IOW('t', 28, struct termio) */ - -#define TCSBRK		_IO('t', 29) -#define TCXONC		_IO('t', 30) -#define TCFLSH		_IO('t', 31) - -#define TIOCSWINSZ	0x40087467	/* _IOW('t', 103, struct winsize) */ -#define TIOCGWINSZ	0x80087468	/* _IOR('t', 104, struct winsize) */ -#define	TIOCSTART	_IO('t', 110)		/* start output, like ^Q */ -#define	TIOCSTOP	_IO('t', 111)		/* stop output, like ^S */ -#define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */ - -#define TIOCSPGRP	_IOW('t', 118, int) -#define TIOCGPGRP	_IOR('t', 119, int) - -#define TIOCEXCL	_IO('T', 12) /* 0x540C */ -#define TIOCNXCL	_IO('T', 13) /* 0x540D */ -#define TIOCSCTTY	_IO('T', 14) /* 0x540E */ - -#define TIOCSTI		_IOW('T', 18, char) /* 0x5412 */ -#define TIOCMGET	_IOR('T', 21, unsigned int) /* 0x5415 */ -#define TIOCMBIS	_IOW('T', 22, unsigned int) /* 0x5416 */ -#define TIOCMBIC	_IOW('T', 23, unsigned int) /* 0x5417 */ -#define TIOCMSET	_IOW('T', 24, unsigned int) /* 0x5418 */ -# define TIOCM_LE	0x001 -# define TIOCM_DTR	0x002 -# define TIOCM_RTS	0x004 -# define TIOCM_ST	0x008 -# define TIOCM_SR	0x010 -# define TIOCM_CTS	0x020 -# define TIOCM_CAR	0x040 -# define TIOCM_RNG	0x080 -# define TIOCM_DSR	0x100 -# define TIOCM_CD	TIOCM_CAR -# define TIOCM_RI	TIOCM_RNG - -#define TIOCGSOFTCAR	_IOR('T', 25, unsigned int) /* 0x5419 */ -#define TIOCSSOFTCAR	_IOW('T', 26, unsigned int) /* 0x541A */ -#define TIOCLINUX	_IOW('T', 28, char) /* 0x541C */ -#define TIOCCONS	_IO('T', 29) /* 0x541D */ -#define TIOCGSERIAL	0x803C541E	/* _IOR('T', 30, struct serial_struct) 0x541E */ -#define TIOCSSERIAL	0x403C541F	/* _IOW('T', 31, struct serial_struct) 0x541F */ -#define TIOCPKT		_IOW('T', 32, int) /* 0x5420 */ -# define TIOCPKT_DATA		 0 -# define TIOCPKT_FLUSHREAD	 1 -# define TIOCPKT_FLUSHWRITE	 2 -# define TIOCPKT_STOP		 4 -# define TIOCPKT_START		 8 -# define TIOCPKT_NOSTOP		16 -# define TIOCPKT_DOSTOP		32 -# define TIOCPKT_IOCTL		64 - - -#define TIOCNOTTY	_IO('T', 34) /* 0x5422 */ -#define TIOCSETD	_IOW('T', 35, int) /* 0x5423 */ -#define TIOCGETD	_IOR('T', 36, int) /* 0x5424 */ -#define TCSBRKP		_IOW('T', 37, int) /* 0x5425 */	/* Needed for POSIX tcsendbreak() */ -#define TIOCSBRK	_IO('T', 39) /* 0x5427 */ /* BSD compatibility */ -#define TIOCCBRK	_IO('T', 40) /* 0x5428 */ /* BSD compatibility */ -#define TIOCGSID	_IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */ -#define TCGETS2		_IOR('T', 42, struct termios2) -#define TCSETS2		_IOW('T', 43, struct termios2) -#define TCSETSW2	_IOW('T', 44, struct termios2) -#define TCSETSF2	_IOW('T', 45, struct termios2) -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */ -#define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */ - -#define TIOCSERCONFIG	_IO('T', 83) /* 0x5453 */ -#define TIOCSERGWILD	_IOR('T', 84,  int) /* 0x5454 */ -#define TIOCSERSWILD	_IOW('T', 85,  int) /* 0x5455 */ -#define TIOCGLCKTRMIOS	0x5456 -#define TIOCSLCKTRMIOS	0x5457 -#define TIOCSERGSTRUCT	0x80d85458	/* _IOR('T', 88, struct async_struct) 0x5458 */ /* For debugging only */ -#define TIOCSERGETLSR   _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */ -  /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -# define TIOCSER_TEMT    0x01	/* Transmitter physically empty */ -#define TIOCSERGETMULTI 0x80A8545A	/* _IOR('T', 90, struct serial_multiport_struct) 0x545A */ /* Get multiport config */ -#define TIOCSERSETMULTI 0x40A8545B	/* _IOW('T', 91, struct serial_multiport_struct) 0x545B */ /* Set multiport config */ - -#define TIOCMIWAIT	_IO('T', 92) /* 0x545C */	/* wait for a change on serial input line(s) */ -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */ - -#endif /* __ASM_SH_IOCTLS_H */ diff --git a/arch/sh/include/asm/ipcbuf.h b/arch/sh/include/asm/ipcbuf.h deleted file mode 100644 index 84c7e51cb6d..00000000000 --- a/arch/sh/include/asm/ipcbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/ipcbuf.h> diff --git a/arch/sh/include/asm/irq.h b/arch/sh/include/asm/irq.h index 45d08b6a5ef..0e4f532e473 100644 --- a/arch/sh/include/asm/irq.h +++ b/arch/sh/include/asm/irq.h @@ -5,12 +5,15 @@  #include <asm/machvec.h>  /* - * A sane default based on a reasonable vector table size, platforms are - * advised to cap this at the hard limit that they're interested in - * through the machvec. + * Only legacy non-sparseirq platforms have to set a reasonably sane + * value here. sparseirq platforms allocate their irq_descs on the fly, + * so will expand automatically based on the number of registered IRQs.   */ -#define NR_IRQS			512 -#define NR_IRQS_LEGACY		8	/* Legacy external IRQ0-7 */ +#ifdef CONFIG_SPARSE_IRQ +# define NR_IRQS		8 +#else +# define NR_IRQS		512 +#endif  /*   * This is a special IRQ number for indicating that no IRQ has been @@ -21,17 +24,6 @@  #define NO_IRQ_IGNORE		((unsigned int)-1)  /* - * Convert back and forth between INTEVT and IRQ values. - */ -#ifdef CONFIG_CPU_HAS_INTEVT -#define evt2irq(evt)		(((evt) >> 5) - 16) -#define irq2evt(irq)		(((irq) + 16) << 5) -#else -#define evt2irq(evt)		(evt) -#define irq2evt(irq)		(irq) -#endif - -/*   * Simple Mask Register Support   */  extern void make_maskreg_irq(unsigned int irq); diff --git a/arch/sh/include/asm/irq_regs.h b/arch/sh/include/asm/irq_regs.h deleted file mode 100644 index 3dd9c0b7027..00000000000 --- a/arch/sh/include/asm/irq_regs.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/irq_regs.h> diff --git a/arch/sh/include/asm/kdebug.h b/arch/sh/include/asm/kdebug.h index 5f6d2e9ccb7..8d6a831e7ba 100644 --- a/arch/sh/include/asm/kdebug.h +++ b/arch/sh/include/asm/kdebug.h @@ -10,4 +10,8 @@ enum die_val {  	DIE_SSTEP,  }; +/* arch/sh/kernel/dumpstack.c */ +extern void printk_address(unsigned long address, int reliable); +extern void dump_mem(const char *str, unsigned long bottom, unsigned long top); +  #endif /* __ASM_SH_KDEBUG_H */ diff --git a/arch/sh/include/asm/kgdb.h b/arch/sh/include/asm/kgdb.h index 4235e228d92..9e7d2d1b03e 100644 --- a/arch/sh/include/asm/kgdb.h +++ b/arch/sh/include/asm/kgdb.h @@ -4,18 +4,6 @@  #include <asm/cacheflush.h>  #include <asm/ptrace.h> -/* Same as pt_regs but has vbr in place of syscall_nr */ -struct kgdb_regs { -        unsigned long regs[16]; -        unsigned long pc; -        unsigned long pr; -        unsigned long sr; -        unsigned long gbr; -        unsigned long mach; -        unsigned long macl; -        unsigned long vbr; -}; -  enum regnames {  	GDB_R0, GDB_R1, GDB_R2, GDB_R3, GDB_R4, GDB_R5, GDB_R6, GDB_R7,  	GDB_R8, GDB_R9, GDB_R10, GDB_R11, GDB_R12, GDB_R13, GDB_R14, GDB_R15, @@ -23,16 +11,27 @@ enum regnames {  	GDB_PC, GDB_PR, GDB_SR, GDB_GBR, GDB_MACH, GDB_MACL, GDB_VBR,  }; -#define NUMREGBYTES    ((GDB_VBR + 1) * 4) +#define _GP_REGS	16 +#define _EXTRA_REGS	7 +#define GDB_SIZEOF_REG	sizeof(u32) + +#define DBG_MAX_REG_NUM	(_GP_REGS + _EXTRA_REGS) +#define NUMREGBYTES	(DBG_MAX_REG_NUM * sizeof(GDB_SIZEOF_REG))  static inline void arch_kgdb_breakpoint(void)  {  	__asm__ __volatile__ ("trapa #0x3c\n");  } -#define BUFMAX                 2048 - -#define CACHE_FLUSH_IS_SAFE	1  #define BREAK_INSTR_SIZE	2 +#define BUFMAX			2048 + +#ifdef CONFIG_SMP +# define CACHE_FLUSH_IS_SAFE	0 +#else +# define CACHE_FLUSH_IS_SAFE	1 +#endif + +#define GDB_ADJUSTS_BREAK_OFFSET  #endif /* __ASM_SH_KGDB_H */ diff --git a/arch/sh/include/asm/local.h b/arch/sh/include/asm/local.h deleted file mode 100644 index 9ed9b9cb459..00000000000 --- a/arch/sh/include/asm/local.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __ASM_SH_LOCAL_H -#define __ASM_SH_LOCAL_H - -#include <asm-generic/local.h> - -#endif /* __ASM_SH_LOCAL_H */ - diff --git a/arch/sh/include/asm/local64.h b/arch/sh/include/asm/local64.h deleted file mode 100644 index 36c93b5cc23..00000000000 --- a/arch/sh/include/asm/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/local64.h> diff --git a/arch/sh/include/asm/machvec.h b/arch/sh/include/asm/machvec.h index a0b0cf79cf8..d3324e4f372 100644 --- a/arch/sh/include/asm/machvec.h +++ b/arch/sh/include/asm/machvec.h @@ -17,33 +17,11 @@  struct sh_machine_vector {  	void (*mv_setup)(char **cmdline_p);  	const char *mv_name; -	int mv_nr_irqs;  	int (*mv_irq_demux)(int irq);  	void (*mv_init_irq)(void); -#ifdef CONFIG_HAS_IOPORT -	u8 (*mv_inb)(unsigned long); -	u16 (*mv_inw)(unsigned long); -	u32 (*mv_inl)(unsigned long); -	void (*mv_outb)(u8, unsigned long); -	void (*mv_outw)(u16, unsigned long); -	void (*mv_outl)(u32, unsigned long); - -	u8 (*mv_inb_p)(unsigned long); -	u16 (*mv_inw_p)(unsigned long); -	u32 (*mv_inl_p)(unsigned long); -	void (*mv_outb_p)(u8, unsigned long); -	void (*mv_outw_p)(u16, unsigned long); -	void (*mv_outl_p)(u32, unsigned long); - -	void (*mv_insb)(unsigned long, void *dst, unsigned long count); -	void (*mv_insw)(unsigned long, void *dst, unsigned long count); -	void (*mv_insl)(unsigned long, void *dst, unsigned long count); -	void (*mv_outsb)(unsigned long, const void *src, unsigned long count); -	void (*mv_outsw)(unsigned long, const void *src, unsigned long count); -	void (*mv_outsl)(unsigned long, const void *src, unsigned long count); - +#ifdef CONFIG_HAS_IOPORT_MAP  	void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size);  	void (*mv_ioport_unmap)(void __iomem *);  #endif @@ -52,6 +30,7 @@ struct sh_machine_vector {  	int (*mv_mode_pins)(void);  	void (*mv_mem_init)(void); +	void (*mv_mem_reserve)(void);  };  extern struct sh_machine_vector sh_mv; diff --git a/arch/sh/include/asm/memblock.h b/arch/sh/include/asm/memblock.h deleted file mode 100644 index e87063fad2e..00000000000 --- a/arch/sh/include/asm/memblock.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __ASM_SH_MEMBLOCK_H -#define __ASM_SH_MEMBLOCK_H - -#endif /* __ASM_SH_MEMBLOCK_H */ diff --git a/arch/sh/include/asm/mman.h b/arch/sh/include/asm/mman.h deleted file mode 100644 index 8eebf89f5ab..00000000000 --- a/arch/sh/include/asm/mman.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/mman.h> diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h index 384c7471a37..b9d9489a501 100644 --- a/arch/sh/include/asm/mmu_context.h +++ b/arch/sh/include/asm/mmu_context.h @@ -46,9 +46,9 @@  #define MMU_VPN_MASK	0xfffff000  #if defined(CONFIG_SUPERH32) -#include "mmu_context_32.h" +#include <asm/mmu_context_32.h>  #else -#include "mmu_context_64.h" +#include <asm/mmu_context_64.h>  #endif  /* @@ -81,7 +81,7 @@ static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)  		/*  		 * Fix version; Note that we avoid version #0 -		 * to distingush NO_CONTEXT. +		 * to distinguish NO_CONTEXT.  		 */  		if (!asid)  			asid = MMU_CONTEXT_FIRST_VERSION; diff --git a/arch/sh/include/asm/mmzone.h b/arch/sh/include/asm/mmzone.h index 8887baff5ef..15a8496960e 100644 --- a/arch/sh/include/asm/mmzone.h +++ b/arch/sh/include/asm/mmzone.h @@ -9,10 +9,6 @@  extern struct pglist_data *node_data[];  #define NODE_DATA(nid)		(node_data[nid]) -#define node_start_pfn(nid)	(NODE_DATA(nid)->node_start_pfn) -#define node_end_pfn(nid)	(NODE_DATA(nid)->node_start_pfn + \ -				 NODE_DATA(nid)->node_spanned_pages) -  static inline int pfn_to_nid(unsigned long pfn)  {  	int nid; diff --git a/arch/sh/include/asm/module.h b/arch/sh/include/asm/module.h index b7927de86f9..81300d8b544 100644 --- a/arch/sh/include/asm/module.h +++ b/arch/sh/include/asm/module.h @@ -1,21 +1,13 @@  #ifndef _ASM_SH_MODULE_H  #define _ASM_SH_MODULE_H -struct mod_arch_specific { +#include <asm-generic/module.h> +  #ifdef CONFIG_DWARF_UNWINDER +struct mod_arch_specific {  	struct list_head fde_list;  	struct list_head cie_list; -#endif  }; - -#ifdef CONFIG_64BIT -#define Elf_Shdr Elf64_Shdr -#define Elf_Sym Elf64_Sym -#define Elf_Ehdr Elf64_Ehdr -#else -#define Elf_Shdr Elf32_Shdr -#define Elf_Sym Elf32_Sym -#define Elf_Ehdr Elf32_Ehdr  #endif  #ifdef CONFIG_CPU_LITTLE_ENDIAN diff --git a/arch/sh/include/asm/msgbuf.h b/arch/sh/include/asm/msgbuf.h deleted file mode 100644 index 809134c644a..00000000000 --- a/arch/sh/include/asm/msgbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/msgbuf.h> diff --git a/arch/sh/include/asm/mutex-llsc.h b/arch/sh/include/asm/mutex-llsc.h index 090358a7e1b..dad29b687bd 100644 --- a/arch/sh/include/asm/mutex-llsc.h +++ b/arch/sh/include/asm/mutex-llsc.h @@ -37,7 +37,7 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))  }  static inline int -__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) +__mutex_fastpath_lock_retval(atomic_t *count)  {  	int __done, __res; @@ -51,7 +51,7 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))  		: "t");  	if (unlikely(!__done || __res != 0)) -		__res = fail_fn(count); +		__res = -1;  	return __res;  } diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h index c4e0b3d472b..15d970328f7 100644 --- a/arch/sh/include/asm/page.h +++ b/arch/sh/include/asm/page.h @@ -113,6 +113,16 @@ typedef struct page *pgtable_t;  #define __MEMORY_SIZE		CONFIG_MEMORY_SIZE  /* + * PHYSICAL_OFFSET is the offset in physical memory where the base + * of the kernel is loaded. + */ +#ifdef CONFIG_PHYSICAL_START +#define PHYSICAL_OFFSET (CONFIG_PHYSICAL_START - __MEMORY_START) +#else +#define PHYSICAL_OFFSET 0 +#endif + +/*   * PAGE_OFFSET is the virtual address of the start of kernel address   * space.   */ @@ -141,8 +151,13 @@ typedef struct page *pgtable_t;  #endif /* !__ASSEMBLY__ */  #ifdef CONFIG_UNCACHED_MAPPING +#if defined(CONFIG_29BIT) +#define UNCAC_ADDR(addr)	P2SEGADDR(addr) +#define CAC_ADDR(addr)		P1SEGADDR(addr) +#else  #define UNCAC_ADDR(addr)	((addr) - PAGE_OFFSET + uncached_start)  #define CAC_ADDR(addr)		((addr) - uncached_start + PAGE_OFFSET) +#endif  #else  #define UNCAC_ADDR(addr)	((addr))  #define CAC_ADDR(addr)		((addr)) @@ -186,7 +201,7 @@ typedef struct page *pgtable_t;  /*   * While BYTES_PER_WORD == 4 on the current sh64 ABI, GCC will still   * happily generate {ld/st}.q pairs, requiring us to have 8-byte - * alignment to avoid traps. The kmalloc alignment is gauranteed by + * alignment to avoid traps. The kmalloc alignment is guaranteed by   * virtue of L1_CACHE_BYTES, requiring this to only be special cased   * for slab caches.   */ diff --git a/arch/sh/include/asm/param.h b/arch/sh/include/asm/param.h deleted file mode 100644 index 965d4542797..00000000000 --- a/arch/sh/include/asm/param.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/param.h> diff --git a/arch/sh/include/asm/parport.h b/arch/sh/include/asm/parport.h deleted file mode 100644 index cf252af6459..00000000000 --- a/arch/sh/include/asm/parport.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/parport.h> diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h index f0efe97f175..5b451155299 100644 --- a/arch/sh/include/asm/pci.h +++ b/arch/sh/include/asm/pci.h @@ -70,11 +70,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,  	enum pci_mmap_state mmap_state, int write_combine);  extern void pcibios_set_master(struct pci_dev *dev); -static inline void pcibios_penalize_isa_irq(int irq, int active) -{ -	/* We don't do dynamic PCI IRQ allocation */ -} -  /* Dynamic DMA mapping stuff.   * SuperH has everything mapped statically like x86.   */ @@ -112,13 +107,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,  #endif  /* Board-specific fixup routines. */ -int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin); - -extern void pcibios_resource_to_bus(struct pci_dev *dev, -	struct pci_bus_region *region, struct resource *res); - -extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, -				    struct pci_bus_region *region); +int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);  #define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index diff --git a/arch/sh/include/asm/percpu.h b/arch/sh/include/asm/percpu.h deleted file mode 100644 index 4db4b39a439..00000000000 --- a/arch/sh/include/asm/percpu.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ARCH_SH_PERCPU -#define __ARCH_SH_PERCPU - -#include <asm-generic/percpu.h> - -#endif /* __ARCH_SH_PERCPU */ diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h index 8c00785c60d..a33673b3687 100644 --- a/arch/sh/include/asm/pgalloc.h +++ b/arch/sh/include/asm/pgalloc.h @@ -47,7 +47,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,  	if (!pg)  		return NULL;  	page = virt_to_page(pg); -	pgtable_page_ctor(page); +	if (!pgtable_page_ctor(page)) { +		quicklist_free(QUICK_PT, NULL, pg); +		return NULL; +	}  	return page;  } diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h index 083ea068e81..cf434c64408 100644 --- a/arch/sh/include/asm/pgtable.h +++ b/arch/sh/include/asm/pgtable.h @@ -18,6 +18,7 @@  #include <asm/pgtable-2level.h>  #endif  #include <asm/page.h> +#include <asm/mmu.h>  #ifndef __ASSEMBLY__  #include <asm/addrspace.h> @@ -123,9 +124,6 @@ typedef pte_t *pte_addr_t;  #define kern_addr_valid(addr)	(1) -#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)		\ -		remap_pfn_range(vma, vaddr, pfn, size, prot) -  #define pte_pfn(x)		((unsigned long)(((x).pte_low >> PAGE_SHIFT)))  /* @@ -134,6 +132,7 @@ typedef pte_t *pte_addr_t;  extern void pgtable_cache_init(void);  struct vm_area_struct; +struct mm_struct;  extern void __update_cache(struct vm_area_struct *vma,  			   unsigned long address, pte_t pte); diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h index 43528ec656b..0bce3d81569 100644 --- a/arch/sh/include/asm/pgtable_32.h +++ b/arch/sh/include/asm/pgtable_32.h @@ -76,6 +76,10 @@  /* Wrapper for extended mode pgprot twiddling */  #define _PAGE_EXT(x)		((unsigned long long)(x) << 32) +#ifdef CONFIG_X2TLB +#define _PAGE_PCC_MASK	0x00000000	/* No legacy PTEA support */ +#else +  /* software: moves to PTEA.TC (Timing Control) */  #define _PAGE_PCC_AREA5	0x00000000	/* use BSC registers for area5 */  #define _PAGE_PCC_AREA6	0x80000000	/* use BSC registers for area6 */ @@ -89,7 +93,8 @@  #define _PAGE_PCC_ATR8	0x60000000	/* Attribute Memory space, 8 bit bus */  #define _PAGE_PCC_ATR16	0x60000001	/* Attribute Memory space, 6 bit bus */ -#ifndef CONFIG_X2TLB +#define _PAGE_PCC_MASK	0xe0000001 +  /* copy the ptea attributes */  static inline unsigned long copy_ptea_attributes(unsigned long x)  { @@ -162,7 +167,7 @@ static inline unsigned long copy_ptea_attributes(unsigned long x)  #endif  /* - * Mask of bits that are to be preserved accross pgprot changes. + * Mask of bits that are to be preserved across pgprot changes.   */  #define _PAGE_CHG_MASK \  	(PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | \ @@ -231,13 +236,7 @@ static inline unsigned long copy_ptea_attributes(unsigned long x)  					   _PAGE_EXT_KERN_EXEC))  #define PAGE_KERNEL_PCC(slot, type) \ -			__pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \ -				 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \ -				 _PAGE_EXT(_PAGE_EXT_KERN_READ | \ -					   _PAGE_EXT_KERN_WRITE | \ -					   _PAGE_EXT_KERN_EXEC) \ -				 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \ -				 (type)) +			__pgprot(0)  #elif defined(CONFIG_MMU) /* SH-X TLB */  #define PAGE_NONE	__pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \ diff --git a/arch/sh/include/asm/pgtable_64.h b/arch/sh/include/asm/pgtable_64.h index 42cb9dd5216..dda8c82601b 100644 --- a/arch/sh/include/asm/pgtable_64.h +++ b/arch/sh/include/asm/pgtable_64.h @@ -87,9 +87,6 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval)  #define pte_unmap(pte)		do { } while (0)  #ifndef __ASSEMBLY__ -#define IOBASE_VADDR	0xff000000 -#define IOBASE_END	0xffffffff -  /*   * PTEL coherent flags.   * See Chapter 17 ST50 CPU Core Volume 1, Architecture. diff --git a/arch/sh/include/asm/poll.h b/arch/sh/include/asm/poll.h deleted file mode 100644 index c98509d3149..00000000000 --- a/arch/sh/include/asm/poll.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/poll.h> diff --git a/arch/sh/include/asm/posix_types.h b/arch/sh/include/asm/posix_types.h index 4eeb723aee7..1aa781079b1 100644 --- a/arch/sh/include/asm/posix_types.h +++ b/arch/sh/include/asm/posix_types.h @@ -1,13 +1,5 @@ -#ifdef __KERNEL__  # ifdef CONFIG_SUPERH32 -#  include "posix_types_32.h" +#  include <asm/posix_types_32.h>  # else -#  include "posix_types_64.h" +#  include <asm/posix_types_64.h>  # endif -#else -# ifdef __SH5__ -#  include "posix_types_64.h" -# else -#  include "posix_types_32.h" -# endif -#endif /* __KERNEL__ */ diff --git a/arch/sh/include/asm/posix_types_32.h b/arch/sh/include/asm/posix_types_32.h deleted file mode 100644 index 6a9ceaaf1ae..00000000000 --- a/arch/sh/include/asm/posix_types_32.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __ASM_SH_POSIX_TYPES_32_H -#define __ASM_SH_POSIX_TYPES_32_H - -typedef unsigned short	__kernel_mode_t; -#define __kernel_mode_t __kernel_mode_t -typedef unsigned short	__kernel_nlink_t; -#define __kernel_nlink_t __kernel_nlink_t -typedef unsigned short	__kernel_ipc_pid_t; -#define __kernel_ipc_pid_t __kernel_ipc_pid_t -typedef unsigned short	__kernel_uid_t; -#define __kernel_uid_t __kernel_uid_t -typedef unsigned short	__kernel_gid_t; -#define __kernel_gid_t __kernel_gid_t - -typedef unsigned int	__kernel_uid32_t; -#define __kernel_uid32_t __kernel_uid32_t -typedef unsigned int	__kernel_gid32_t; -#define __kernel_gid32_t __kernel_gid32_t - -typedef unsigned short	__kernel_old_uid_t; -#define __kernel_old_uid_t __kernel_old_uid_t -typedef unsigned short	__kernel_old_gid_t; -#define __kernel_old_gid_t __kernel_old_gid_t -typedef unsigned short	__kernel_old_dev_t; -#define __kernel_old_dev_t __kernel_old_dev_t - -#include <asm-generic/posix_types.h> - -#endif /* __ASM_SH_POSIX_TYPES_32_H */ diff --git a/arch/sh/include/asm/posix_types_64.h b/arch/sh/include/asm/posix_types_64.h deleted file mode 100644 index 8cd11485c06..00000000000 --- a/arch/sh/include/asm/posix_types_64.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __ASM_SH_POSIX_TYPES_64_H -#define __ASM_SH_POSIX_TYPES_64_H - -typedef unsigned short	__kernel_mode_t; -#define __kernel_mode_t __kernel_mode_t -typedef unsigned short	__kernel_nlink_t; -#define __kernel_nlink_t __kernel_nlink_t -typedef unsigned short	__kernel_ipc_pid_t; -#define __kernel_ipc_pid_t __kernel_ipc_pid_t -typedef unsigned short	__kernel_uid_t; -#define __kernel_uid_t __kernel_uid_t -typedef unsigned short	__kernel_gid_t; -#define __kernel_gid_t __kernel_gid_t -typedef long unsigned int	__kernel_size_t; -#define __kernel_size_t __kernel_size_t -typedef int		__kernel_ssize_t; -#define __kernel_ssize_t __kernel_ssize_t -typedef int		__kernel_ptrdiff_t; -#define __kernel_ptrdiff_t __kernel_ptrdiff_t -typedef unsigned int	__kernel_uid32_t; -#define __kernel_uid32_t __kernel_uid32_t -typedef unsigned int	__kernel_gid32_t; -#define __kernel_gid32_t __kernel_gid32_t - -typedef unsigned short	__kernel_old_uid_t; -#define __kernel_old_uid_t __kernel_old_uid_t -typedef unsigned short	__kernel_old_gid_t; -#define __kernel_old_gid_t __kernel_old_gid_t -typedef unsigned short	__kernel_old_dev_t; -#define __kernel_old_dev_t __kernel_old_dev_t - -#include <asm-generic/posix_types.h> - -#endif /* __ASM_SH_POSIX_TYPES_64_H */ diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h index c9e7cbc4768..5448f9bbf4a 100644 --- a/arch/sh/include/asm/processor.h +++ b/arch/sh/include/asm/processor.h @@ -18,7 +18,8 @@ enum cpu_type {  	CPU_SH7619,  	/* SH-2A types */ -	CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG, +	CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_SH7264, CPU_SH7269, +	CPU_MXG,  	/* SH-3 types */  	CPU_SH7705, CPU_SH7706, CPU_SH7707, @@ -32,10 +33,10 @@ enum cpu_type {  	/* SH-4A types */  	CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786, -	CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SHX3, +	CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SH7734, CPU_SHX3,  	/* SH4AL-DSP types */ -	CPU_SH7343, CPU_SH7722, CPU_SH7366, +	CPU_SH7343, CPU_SH7722, CPU_SH7366, CPU_SH7372,  	/* SH-5 types */          CPU_SH5_101, CPU_SH5_103, @@ -85,10 +86,6 @@ struct sh_cpuinfo {  	struct tlb_info itlb;  	struct tlb_info dtlb; -#ifdef CONFIG_SMP -	struct task_struct *idle; -#endif -  	unsigned int phys_bits;  	unsigned long flags;  } __attribute__ ((aligned(L1_CACHE_BYTES))); @@ -101,6 +98,9 @@ extern struct sh_cpuinfo cpu_data[];  #define cpu_sleep()	__asm__ __volatile__ ("sleep" : : : "memory")  #define cpu_relax()	barrier() +void default_idle(void); +void stop_this_cpu(void *); +  /* Forward decl */  struct seq_operations;  struct task_struct; @@ -161,12 +161,23 @@ int vsyscall_init(void);  #define vsyscall_init() do { } while (0)  #endif +/* + * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks. + */ +#ifdef CONFIG_CPU_SH2A +extern unsigned int instruction_size(unsigned int insn); +#elif defined(CONFIG_SUPERH32) +#define instruction_size(insn)	(2) +#else +#define instruction_size(insn)	(4) +#endif +  #endif /* __ASSEMBLY__ */  #ifdef CONFIG_SUPERH32 -# include "processor_32.h" +# include <asm/processor_32.h>  #else -# include "processor_64.h" +# include <asm/processor_64.h>  #endif  #endif /* __ASM_SH_PROCESSOR_H */ diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h index 46d5179c9f4..18e0377f72b 100644 --- a/arch/sh/include/asm/processor_32.h +++ b/arch/sh/include/asm/processor_32.h @@ -39,7 +39,7 @@  /* This decides where the kernel will search for a free chunk of vm   * space during mmap's.   */ -#define TASK_UNMAPPED_BASE	(TASK_SIZE / 3) +#define TASK_UNMAPPED_BASE	PAGE_ALIGN(TASK_SIZE / 3)  /*   * Bit of SR register @@ -111,6 +111,16 @@ struct thread_struct {  	/* Extended processor state */  	union thread_xstate *xstate; + +	/* +	 * fpu_counter contains the number of consecutive context switches +	 * that the FPU is used. If this is over a threshold, the lazy fpu +	 * saving becomes unlazy to save the trap. This is an unsigned char +	 * so that after 256 times the counter wraps and the behavior turns +	 * lazy again; this to deal with bursty apps that only use FPU for +	 * a short time +	 */ +	unsigned char fpu_counter;  };  #define INIT_THREAD  {						\ @@ -126,14 +136,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned lo  /* Free all resources held by a thread. */  extern void release_thread(struct task_struct *); -/* Prepare to copy thread state - unlazy all lazy status */ -void prepare_to_copy(struct task_struct *tsk); - -/* - * create a kernel thread without removing it from tasklists - */ -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); -  /* Copy and release all segment info associated with a VM */  #define copy_segments(p, mm)	do { } while(0)  #define release_segments(mm)	do { } while(0) @@ -194,15 +196,20 @@ extern unsigned long get_wchan(struct task_struct *p);  #define KSTK_ESP(tsk)  (task_pt_regs(tsk)->regs[15])  #if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH4) +  #define PREFETCH_STRIDE		L1_CACHE_BYTES  #define ARCH_HAS_PREFETCH  #define ARCH_HAS_PREFETCHW -static inline void prefetch(void *x) + +static inline void prefetch(const void *x)  { -	__asm__ __volatile__ ("pref @%0\n\t" : : "r" (x) : "memory"); +	__builtin_prefetch(x, 0, 3);  } -#define prefetchw(x)	prefetch(x) +static inline void prefetchw(const void *x) +{ +	__builtin_prefetch(x, 1, 3); +}  #endif  #endif /* __KERNEL__ */ diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h index 2a541ddb5a1..eedd4f625d0 100644 --- a/arch/sh/include/asm/processor_64.h +++ b/arch/sh/include/asm/processor_64.h @@ -47,7 +47,7 @@ pc; })  /* This decides where the kernel will search for a free chunk of vm   * space during mmap's.   */ -#define TASK_UNMAPPED_BASE	(TASK_SIZE / 3) +#define TASK_UNMAPPED_BASE	PAGE_ALIGN(TASK_SIZE / 3)  /*   * Bit of SR register @@ -121,12 +121,21 @@ struct thread_struct {  	   NULL for a kernel thread. */  	struct pt_regs *uregs; -	unsigned long trap_no, error_code;  	unsigned long address;  	/* Hardware debugging registers may come here */  	/* floating point info */  	union thread_xstate *xstate; + +	/* +	 * fpu_counter contains the number of consecutive context switches +	 * that the FPU is used. If this is over a threshold, the lazy fpu +	 * saving becomes unlazy to save the trap. This is an unsigned char +	 * so that after 256 times the counter wraps and the behavior turns +	 * lazy again; this to deal with bursty apps that only use FPU for +	 * a short time +	 */ +	unsigned char fpu_counter;  };  #define INIT_MMAP \ @@ -138,8 +147,6 @@ struct thread_struct {  	.pc		= 0,			\          .kregs		= &fake_swapper_regs,	\  	.uregs	        = NULL,			\ -	.trap_no	= 0,			\ -	.error_code	= 0,			\  	.address	= 0,			\  	.flags		= 0,			\  } @@ -150,7 +157,6 @@ struct thread_struct {  #define SR_USER (SR_MMU | SR_FD)  #define start_thread(_regs, new_pc, new_sp)			\ -	set_fs(USER_DS);					\  	_regs->sr = SR_USER;	/* User mode. */		\  	_regs->pc = new_pc - 4;	/* Compensate syscall exit */	\  	_regs->pc |= 1;		/* Set SHmedia ! */		\ @@ -163,17 +169,11 @@ struct mm_struct;  /* Free all resources held by a thread. */  extern void release_thread(struct task_struct *); -/* - * create a kernel thread without removing it from tasklists - */ -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); -  /* Copy and release all segment info associated with a VM */  #define copy_segments(p, mm)	do { } while (0)  #define release_segments(mm)	do { } while (0)  #define forget_segments()	do { } while (0) -#define prepare_to_copy(tsk)	do { } while (0)  /*   * FPU lazy state save handling.   */ diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h index f6edc10aa0d..2506c7db76b 100644 --- a/arch/sh/include/asm/ptrace.h +++ b/arch/sh/include/asm/ptrace.h @@ -1,50 +1,22 @@ -#ifndef __ASM_SH_PTRACE_H -#define __ASM_SH_PTRACE_H -  /*   * Copyright (C) 1999, 2000  Niibe Yutaka   */ +#ifndef __ASM_SH_PTRACE_H +#define __ASM_SH_PTRACE_H -#define PTRACE_GETREGS		12	/* General registers */ -#define PTRACE_SETREGS		13 - -#define PTRACE_GETFPREGS	14	/* FPU registers */ -#define PTRACE_SETFPREGS	15 - -#define PTRACE_GETFDPIC		31	/* get the ELF fdpic loadmap address */ - -#define PTRACE_GETFDPIC_EXEC	0	/* [addr] request the executable loadmap */ -#define PTRACE_GETFDPIC_INTERP	1	/* [addr] request the interpreter loadmap */ - -#define	PTRACE_GETDSPREGS	55	/* DSP registers */ -#define	PTRACE_SETDSPREGS	56 - -#define PT_TEXT_END_ADDR	240 -#define PT_TEXT_ADDR		244	/* &(struct user)->start_code */ -#define PT_DATA_ADDR		248	/* &(struct user)->start_data */ -#define PT_TEXT_LEN		252 - -#if defined(__SH5__) || defined(CONFIG_CPU_SH5) -#include "ptrace_64.h" -#else -#include "ptrace_32.h" -#endif - -#ifdef __KERNEL__  #include <linux/stringify.h>  #include <linux/stddef.h>  #include <linux/thread_info.h>  #include <asm/addrspace.h>  #include <asm/page.h> -#include <asm/system.h> +#include <uapi/asm/ptrace.h>  #define user_mode(regs)			(((regs)->sr & 0x40000000)==0) -#define user_stack_pointer(regs)	((unsigned long)(regs)->regs[15]) -#define kernel_stack_pointer(regs)	((unsigned long)(regs)->regs[15]) -#define instruction_pointer(regs)	((unsigned long)(regs)->pc) +#define kernel_stack_pointer(_regs)	((unsigned long)(_regs)->regs[15]) -extern void show_regs(struct pt_regs *); +#define GET_FP(regs)	((regs)->regs[14]) +#define GET_USP(regs)	((regs)->regs[15])  #define arch_has_single_step()	(1) @@ -124,7 +96,7 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,  struct perf_event;  struct perf_sample_data; -extern void ptrace_triggered(struct perf_event *bp, int nmi, +extern void ptrace_triggered(struct perf_event *bp,  		      struct perf_sample_data *data, struct pt_regs *regs);  #define task_pt_regs(task) \ @@ -132,13 +104,14 @@ extern void ptrace_triggered(struct perf_event *bp, int nmi,  static inline unsigned long profile_pc(struct pt_regs *regs)  { -	unsigned long pc = instruction_pointer(regs); +	unsigned long pc = regs->pc;  	if (virt_addr_uncached(pc))  		return CAC_ADDR(pc);  	return pc;  } -#endif /* __KERNEL__ */ +#define profile_pc profile_pc +#include <asm-generic/ptrace.h>  #endif /* __ASM_SH_PTRACE_H */ diff --git a/arch/sh/include/asm/ptrace_32.h b/arch/sh/include/asm/ptrace_32.h index 35d9e257558..1dd4480c536 100644 --- a/arch/sh/include/asm/ptrace_32.h +++ b/arch/sh/include/asm/ptrace_32.h @@ -1,83 +1,13 @@  #ifndef __ASM_SH_PTRACE_32_H  #define __ASM_SH_PTRACE_32_H -/* - * GCC defines register number like this: - * ----------------------------- - *	 0 - 15 are integer registers - *	17 - 22 are control/special registers - *	24 - 39 fp registers - *	40 - 47 xd registers - *	48 -    fpscr register - * ----------------------------- - * - * We follows above, except: - *	16 --- program counter (PC) - *	22 --- syscall # - *	23 --- floating point communication register - */ -#define REG_REG0	 0 -#define REG_REG15	15 +#include <uapi/asm/ptrace_32.h> -#define REG_PC		16 - -#define REG_PR		17 -#define REG_SR		18 -#define REG_GBR		19 -#define REG_MACH	20 -#define REG_MACL	21 - -#define REG_SYSCALL	22 - -#define REG_FPREG0	23 -#define REG_FPREG15	38 -#define REG_XFREG0	39 -#define REG_XFREG15	54 - -#define REG_FPSCR	55 -#define REG_FPUL	56 - -/* - * This struct defines the way the registers are stored on the - * kernel stack during a system call or other kernel entry. - */ -struct pt_regs { -	unsigned long regs[16]; -	unsigned long pc; -	unsigned long pr; -	unsigned long sr; -	unsigned long gbr; -	unsigned long mach; -	unsigned long macl; -	long tra; -}; - -/* - * This struct defines the way the DSP registers are stored on the - * kernel stack during a system call or other kernel entry. - */ -struct pt_dspregs { -	unsigned long	a1; -	unsigned long	a0g; -	unsigned long	a1g; -	unsigned long	m0; -	unsigned long	m1; -	unsigned long	a0; -	unsigned long	x0; -	unsigned long	x1; -	unsigned long	y0; -	unsigned long	y1; -	unsigned long	dsr; -	unsigned long	rs; -	unsigned long	re; -	unsigned long	mod; -}; - -#ifdef __KERNEL__  #define MAX_REG_OFFSET		offsetof(struct pt_regs, tra) -#define regs_return_value(regs)	((regs)->regs[0]) - -#endif /* __KERNEL__ */ +static inline long regs_return_value(struct pt_regs *regs) +{ +	return regs->regs[0]; +}  #endif /* __ASM_SH_PTRACE_32_H */ diff --git a/arch/sh/include/asm/ptrace_64.h b/arch/sh/include/asm/ptrace_64.h index d43c1cb0bbe..97f4b5660f2 100644 --- a/arch/sh/include/asm/ptrace_64.h +++ b/arch/sh/include/asm/ptrace_64.h @@ -1,20 +1,13 @@  #ifndef __ASM_SH_PTRACE_64_H  #define __ASM_SH_PTRACE_64_H -struct pt_regs { -	unsigned long long pc; -	unsigned long long sr; -	long long syscall_nr; -	unsigned long long regs[63]; -	unsigned long long tregs[8]; -	unsigned long long pad[2]; -}; +#include <uapi/asm/ptrace_64.h> -#ifdef __KERNEL__  #define MAX_REG_OFFSET		offsetof(struct pt_regs, tregs[7]) -#define regs_return_value(regs)	((regs)->regs[3]) - -#endif /* __KERNEL__ */ +static inline long regs_return_value(struct pt_regs *regs) +{ +	return regs->regs[3]; +}  #endif /* __ASM_SH_PTRACE_64_H */ diff --git a/arch/sh/include/asm/resource.h b/arch/sh/include/asm/resource.h deleted file mode 100644 index 9c2499a86ec..00000000000 --- a/arch/sh/include/asm/resource.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_SH_RESOURCE_H -#define __ASM_SH_RESOURCE_H - -#include <asm-generic/resource.h> - -#endif /* __ASM_SH_RESOURCE_H */ diff --git a/arch/sh/include/asm/rwsem.h b/arch/sh/include/asm/rwsem.h index 06e2251a5e4..edab5726529 100644 --- a/arch/sh/include/asm/rwsem.h +++ b/arch/sh/include/asm/rwsem.h @@ -11,64 +11,13 @@  #endif  #ifdef __KERNEL__ -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/atomic.h> -#include <asm/system.h> -/* - * the semaphore definition - */ -struct rw_semaphore { -	long		count;  #define RWSEM_UNLOCKED_VALUE		0x00000000  #define RWSEM_ACTIVE_BIAS		0x00000001  #define RWSEM_ACTIVE_MASK		0x0000ffff  #define RWSEM_WAITING_BIAS		(-0x00010000)  #define RWSEM_ACTIVE_READ_BIAS		RWSEM_ACTIVE_BIAS  #define RWSEM_ACTIVE_WRITE_BIAS		(RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -	spinlock_t		wait_lock; -	struct list_head	wait_list; -#ifdef CONFIG_DEBUG_LOCK_ALLOC -	struct lockdep_map	dep_map; -#endif -}; - -#ifdef CONFIG_DEBUG_LOCK_ALLOC -# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } -#else -# define __RWSEM_DEP_MAP_INIT(lockname) -#endif - -#define __RWSEM_INITIALIZER(name) \ -	{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ -	  LIST_HEAD_INIT((name).wait_list) \ -	  __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM(name)		\ -	struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); - -extern void __init_rwsem(struct rw_semaphore *sem, const char *name, -			 struct lock_class_key *key); - -#define init_rwsem(sem)				\ -do {						\ -	static struct lock_class_key __key;	\ -						\ -	__init_rwsem((sem), #sem, &__key);	\ -} while (0) - -static inline void init_rwsem(struct rw_semaphore *sem) -{ -	sem->count = RWSEM_UNLOCKED_VALUE; -	spin_lock_init(&sem->wait_lock); -	INIT_LIST_HEAD(&sem->wait_list); -}  /*   * lock for reading @@ -179,10 +128,5 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)  	return atomic_add_return(delta, (atomic_t *)(&sem->count));  } -static inline int rwsem_is_locked(struct rw_semaphore *sem) -{ -	return (sem->count != 0); -} -  #endif /* __KERNEL__ */  #endif /* _ASM_SH_RWSEM_H */ diff --git a/arch/sh/include/asm/scatterlist.h b/arch/sh/include/asm/scatterlist.h deleted file mode 100644 index 98dfc3510f1..00000000000 --- a/arch/sh/include/asm/scatterlist.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_SH_SCATTERLIST_H -#define __ASM_SH_SCATTERLIST_H - -#include <asm-generic/scatterlist.h> - -#endif /* __ASM_SH_SCATTERLIST_H */ diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h index a78701da775..1b6199740e9 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h @@ -3,10 +3,9 @@  #include <asm-generic/sections.h> -extern void __nosave_begin, __nosave_end; +extern long __nosave_begin, __nosave_end;  extern long __machvec_start, __machvec_end;  extern char __uncached_start, __uncached_end; -extern char _ebss[];  extern char __start_eh_frame[], __stop_eh_frame[];  #endif /* __ASM_SH_SECTIONS_H */ diff --git a/arch/sh/include/asm/sembuf.h b/arch/sh/include/asm/sembuf.h deleted file mode 100644 index 7673b83cfef..00000000000 --- a/arch/sh/include/asm/sembuf.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/sembuf.h> diff --git a/arch/sh/include/asm/serial.h b/arch/sh/include/asm/serial.h deleted file mode 100644 index a0cb0caff15..00000000000 --- a/arch/sh/include/asm/serial.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/serial.h> diff --git a/arch/sh/include/asm/setup.h b/arch/sh/include/asm/setup.h index 01fa17a3d75..99238108e7a 100644 --- a/arch/sh/include/asm/setup.h +++ b/arch/sh/include/asm/setup.h @@ -1,9 +1,8 @@  #ifndef _SH_SETUP_H  #define _SH_SETUP_H -#include <asm-generic/setup.h> +#include <uapi/asm/setup.h> -#ifdef __KERNEL__  /*   * This is set up by the setup-routine at boot-time   */ @@ -20,7 +19,6 @@  void sh_mv_setup(void);  void check_for_initrd(void); - -#endif /* __KERNEL__ */ +void per_cpu_trap_init(void);  #endif /* _SH_SETUP_H */ diff --git a/arch/sh/include/asm/sh_eth.h b/arch/sh/include/asm/sh_eth.h deleted file mode 100644 index f739061e2ee..00000000000 --- a/arch/sh/include/asm/sh_eth.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ASM_SH_ETH_H__ -#define __ASM_SH_ETH_H__ - -enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; - -struct sh_eth_plat_data { -	int phy; -	int edmac_endian; - -	unsigned char mac_addr[6]; -	unsigned no_ether_link:1; -	unsigned ether_link_active_low:1; -}; - -#endif diff --git a/arch/sh/include/asm/shmbuf.h b/arch/sh/include/asm/shmbuf.h deleted file mode 100644 index 83c05fc2de3..00000000000 --- a/arch/sh/include/asm/shmbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/shmbuf.h> diff --git a/arch/sh/include/asm/sigcontext.h b/arch/sh/include/asm/sigcontext.h deleted file mode 100644 index 8ce1435bc0b..00000000000 --- a/arch/sh/include/asm/sigcontext.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __ASM_SH_SIGCONTEXT_H -#define __ASM_SH_SIGCONTEXT_H - -struct sigcontext { -	unsigned long	oldmask; - -#if defined(__SH5__) || defined(CONFIG_CPU_SH5) -	/* CPU registers */ -	unsigned long long sc_regs[63]; -	unsigned long long sc_tregs[8]; -	unsigned long long sc_pc; -	unsigned long long sc_sr; - -	/* FPU registers */ -	unsigned long long sc_fpregs[32]; -	unsigned int sc_fpscr; -	unsigned int sc_fpvalid; -#else -	/* CPU registers */ -	unsigned long sc_regs[16]; -	unsigned long sc_pc; -	unsigned long sc_pr; -	unsigned long sc_sr; -	unsigned long sc_gbr; -	unsigned long sc_mach; -	unsigned long sc_macl; - -#if defined(__SH4__) || defined(CONFIG_CPU_SH4) || \ -    defined(__SH2A__) || defined(CONFIG_CPU_SH2A) -	/* FPU registers */ -	unsigned long sc_fpregs[16]; -	unsigned long sc_xfpregs[16]; -	unsigned int sc_fpscr; -	unsigned int sc_fpul; -	unsigned int sc_ownedfp; -#endif -#endif -}; - -#endif /* __ASM_SH_SIGCONTEXT_H */ diff --git a/arch/sh/include/asm/siginfo.h b/arch/sh/include/asm/siginfo.h deleted file mode 100644 index 813040ed68a..00000000000 --- a/arch/sh/include/asm/siginfo.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_SH_SIGINFO_H -#define __ASM_SH_SIGINFO_H - -#include <asm-generic/siginfo.h> - -#endif /* __ASM_SH_SIGINFO_H */ diff --git a/arch/sh/include/asm/signal.h b/arch/sh/include/asm/signal.h deleted file mode 100644 index 9ac530a90bc..00000000000 --- a/arch/sh/include/asm/signal.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ASM_SH_SIGNAL_H -#define __ASM_SH_SIGNAL_H - -#define SA_RESTORER	0x04000000 - -#include <asm-generic/signal.h> - -struct old_sigaction { -	__sighandler_t sa_handler; -	old_sigset_t sa_mask; -	unsigned long sa_flags; -	void (*sa_restorer)(void); -}; - -#endif /* __ASM_SH_SIGNAL_H */ diff --git a/arch/sh/include/asm/siu.h b/arch/sh/include/asm/siu.h index 1d95c78808d..580b7ac228b 100644 --- a/arch/sh/include/asm/siu.h +++ b/arch/sh/include/asm/siu.h @@ -14,7 +14,6 @@  struct device;  struct siu_platform { -	struct device *dma_dev;  	unsigned int dma_slave_tx_a;  	unsigned int dma_slave_rx_a;  	unsigned int dma_slave_tx_b; diff --git a/arch/sh/include/asm/sizes.h b/arch/sh/include/asm/sizes.h deleted file mode 100644 index 0b9fe2d5c36..00000000000 --- a/arch/sh/include/asm/sizes.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 - */ -/* DO NOT EDIT!! - this file automatically generated - *                 from .s file by awk -f s2h.awk - */ -/*  Size definitions - *  Copyright (C) ARM Limited 1998. All rights reserved. - */ - -#ifndef __sizes_h -#define __sizes_h                       1 - -/* handy sizes */ -#define SZ_16				0x00000010 -#define SZ_32				0x00000020 -#define SZ_64				0x00000040 -#define SZ_128				0x00000080 -#define SZ_256				0x00000100 -#define SZ_512				0x00000200 - -#define SZ_1K                           0x00000400 -#define SZ_2K                           0x00000800 -#define SZ_4K                           0x00001000 -#define SZ_8K                           0x00002000 -#define SZ_16K                          0x00004000 -#define SZ_32K				0x00008000 -#define SZ_64K                          0x00010000 -#define SZ_128K                         0x00020000 -#define SZ_256K                         0x00040000 -#define SZ_512K                         0x00080000 - -#define SZ_1M                           0x00100000 -#define SZ_2M                           0x00200000 -#define SZ_4M                           0x00400000 -#define SZ_8M                           0x00800000 -#define SZ_16M                          0x01000000 -#define SZ_26M				0x01a00000 -#define SZ_32M                          0x02000000 -#define SZ_64M                          0x04000000 -#define SZ_128M                         0x08000000 -#define SZ_256M                         0x10000000 -#define SZ_512M                         0x20000000 - -#define SZ_1G                           0x40000000 -#define SZ_2G                           0x80000000 - -#endif - -/*         END */ diff --git a/arch/sh/include/asm/smp.h b/arch/sh/include/asm/smp.h index 9070d943ddd..78b0d0f4b24 100644 --- a/arch/sh/include/asm/smp.h +++ b/arch/sh/include/asm/smp.h @@ -8,7 +8,7 @@  #ifdef CONFIG_SMP  #include <linux/spinlock.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/current.h>  #include <asm/percpu.h> diff --git a/arch/sh/include/asm/socket.h b/arch/sh/include/asm/socket.h deleted file mode 100644 index 6b71384b9d8..00000000000 --- a/arch/sh/include/asm/socket.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/socket.h> diff --git a/arch/sh/include/asm/sockios.h b/arch/sh/include/asm/sockios.h deleted file mode 100644 index cf8b96b1f9a..00000000000 --- a/arch/sh/include/asm/sockios.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASM_SH_SOCKIOS_H -#define __ASM_SH_SOCKIOS_H - -/* Socket-level I/O control calls. */ -#define FIOGETOWN	_IOR('f', 123, int) -#define FIOSETOWN 	_IOW('f', 124, int) - -#define SIOCATMARK	_IOR('s', 7, int) -#define SIOCSPGRP	_IOW('s', 8, pid_t) -#define SIOCGPGRP	_IOR('s', 9, pid_t) - -#define SIOCGSTAMP	_IOR('s', 100, struct timeval) /* Get stamp (timeval) */ -#define SIOCGSTAMPNS	_IOR('s', 101, struct timespec) /* Get stamp (timespec) */ -#endif /* __ASM_SH_SOCKIOS_H */ diff --git a/arch/sh/include/asm/stackprotector.h b/arch/sh/include/asm/stackprotector.h new file mode 100644 index 00000000000..d9df3a76847 --- /dev/null +++ b/arch/sh/include/asm/stackprotector.h @@ -0,0 +1,27 @@ +#ifndef __ASM_SH_STACKPROTECTOR_H +#define __ASM_SH_STACKPROTECTOR_H + +#include <linux/random.h> +#include <linux/version.h> + +extern unsigned long __stack_chk_guard; + +/* + * Initialize the stackprotector canary value. + * + * NOTE: this must only be called from functions that never return, + * and it must always be inlined. + */ +static __always_inline void boot_init_stack_canary(void) +{ +	unsigned long canary; + +	/* Try to get a semi random initial value. */ +	get_random_bytes(&canary, sizeof(canary)); +	canary ^= LINUX_VERSION_CODE; + +	current->stack_canary = canary; +	__stack_chk_guard = current->stack_canary; +} + +#endif /* __ASM_SH_STACKPROTECTOR_H */ diff --git a/arch/sh/include/asm/stacktrace.h b/arch/sh/include/asm/stacktrace.h index 79701821371..a7e2d4dfd08 100644 --- a/arch/sh/include/asm/stacktrace.h +++ b/arch/sh/include/asm/stacktrace.h @@ -10,9 +10,6 @@  /* Generic stack tracer with callbacks */  struct stacktrace_ops { -	void (*warning)(void *data, char *msg); -	/* msg must contain %s for the symbol */ -	void (*warning_symbol)(void *data, char *msg, unsigned long symbol);  	void (*address)(void *data, unsigned long address, int reliable);  	/* On negative return stop dumping */  	int (*stack)(void *data, char *name); diff --git a/arch/sh/include/asm/stat.h b/arch/sh/include/asm/stat.h deleted file mode 100644 index e1810cc6e3d..00000000000 --- a/arch/sh/include/asm/stat.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef __ASM_SH_STAT_H -#define __ASM_SH_STAT_H - -struct __old_kernel_stat { -	unsigned short st_dev; -	unsigned short st_ino; -	unsigned short st_mode; -	unsigned short st_nlink; -	unsigned short st_uid; -	unsigned short st_gid; -	unsigned short st_rdev; -	unsigned long  st_size; -	unsigned long  st_atime; -	unsigned long  st_mtime; -	unsigned long  st_ctime; -}; - -#if defined(__SH5__) || defined(CONFIG_CPU_SH5) -struct stat { -	unsigned short st_dev; -	unsigned short __pad1; -	unsigned long st_ino; -	unsigned short st_mode; -	unsigned short st_nlink; -	unsigned short st_uid; -	unsigned short st_gid; -	unsigned short st_rdev; -	unsigned short __pad2; -	unsigned long  st_size; -	unsigned long  st_blksize; -	unsigned long  st_blocks; -	unsigned long  st_atime; -	unsigned long  st_atime_nsec; -	unsigned long  st_mtime; -	unsigned long  st_mtime_nsec; -	unsigned long  st_ctime; -	unsigned long  st_ctime_nsec; -	unsigned long  __unused4; -	unsigned long  __unused5; -}; - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat64 { -	unsigned short	st_dev; -	unsigned char	__pad0[10]; - -	unsigned long	st_ino; -	unsigned int	st_mode; -	unsigned int	st_nlink; - -	unsigned long	st_uid; -	unsigned long	st_gid; - -	unsigned short	st_rdev; -	unsigned char	__pad3[10]; - -	long long	st_size; -	unsigned long	st_blksize; - -	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */ -	unsigned long	__pad4;		/* future possible st_blocks high bits */ - -	unsigned long	st_atime; -	unsigned long	st_atime_nsec; - -	unsigned long	st_mtime; -	unsigned long	st_mtime_nsec; - -	unsigned long	st_ctime; -	unsigned long	st_ctime_nsec;	/* will be high 32 bits of ctime someday */ - -	unsigned long	__unused1; -	unsigned long	__unused2; -}; -#else -struct stat { -	unsigned long  st_dev; -	unsigned long  st_ino; -	unsigned short st_mode; -	unsigned short st_nlink; -	unsigned short st_uid; -	unsigned short st_gid; -	unsigned long  st_rdev; -	unsigned long  st_size; -	unsigned long  st_blksize; -	unsigned long  st_blocks; -	unsigned long  st_atime; -	unsigned long  st_atime_nsec; -	unsigned long  st_mtime; -	unsigned long  st_mtime_nsec; -	unsigned long  st_ctime; -	unsigned long  st_ctime_nsec; -	unsigned long  __unused4; -	unsigned long  __unused5; -}; - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat64 { -	unsigned long long	st_dev; -	unsigned char	__pad0[4]; - -#define STAT64_HAS_BROKEN_ST_INO	1 -	unsigned long	__st_ino; - -	unsigned int	st_mode; -	unsigned int	st_nlink; - -	unsigned long	st_uid; -	unsigned long	st_gid; - -	unsigned long long	st_rdev; -	unsigned char	__pad3[4]; - -	long long	st_size; -	unsigned long	st_blksize; - -	unsigned long long	st_blocks;	/* Number 512-byte blocks allocated. */ - -	unsigned long	st_atime; -	unsigned long	st_atime_nsec; - -	unsigned long	st_mtime; -	unsigned long	st_mtime_nsec; - -	unsigned long	st_ctime; -	unsigned long	st_ctime_nsec; - -	unsigned long long	st_ino; -}; - -#define STAT_HAVE_NSEC 1 -#endif - -#endif /* __ASM_SH_STAT_H */ diff --git a/arch/sh/include/asm/statfs.h b/arch/sh/include/asm/statfs.h deleted file mode 100644 index 9202a023328..00000000000 --- a/arch/sh/include/asm/statfs.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_SH_STATFS_H -#define __ASM_SH_STATFS_H - -#include <asm-generic/statfs.h> - -#endif /* __ASM_SH_STATFS_H */ diff --git a/arch/sh/include/asm/string.h b/arch/sh/include/asm/string.h index 8c1ea21dc0a..114011fa08a 100644 --- a/arch/sh/include/asm/string.h +++ b/arch/sh/include/asm/string.h @@ -1,5 +1,5 @@  #ifdef CONFIG_SUPERH32 -# include "string_32.h" +# include <asm/string_32.h>  #else -# include "string_64.h" +# include <asm/string_64.h>  #endif diff --git a/arch/sh/include/asm/suspend.h b/arch/sh/include/asm/suspend.h index 64eb41a063e..70ae0b2888a 100644 --- a/arch/sh/include/asm/suspend.h +++ b/arch/sh/include/asm/suspend.h @@ -3,7 +3,6 @@  #ifndef __ASSEMBLY__  #include <linux/notifier.h> -static inline int arch_prepare_suspend(void) { return 0; }  #include <asm/ptrace.h> @@ -15,9 +14,9 @@ struct swsusp_arch_regs {  void sh_mobile_call_standby(unsigned long mode);  #ifdef CONFIG_CPU_IDLE -void sh_mobile_setup_cpuidle(void); +int sh_mobile_setup_cpuidle(void);  #else -static inline void sh_mobile_setup_cpuidle(void) {} +static inline int sh_mobile_setup_cpuidle(void) { return 0; }  #endif  /* notifier chains for pre/post sleep hooks */ diff --git a/arch/sh/include/asm/swab.h b/arch/sh/include/asm/swab.h deleted file mode 100644 index 1cd09767a7a..00000000000 --- a/arch/sh/include/asm/swab.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __ASM_SH_SWAB_H -#define __ASM_SH_SWAB_H - -/* - * Copyright (C) 1999  Niibe Yutaka - * Copyright (C) 2000, 2001  Paolo Alberelli - */ -#include <linux/compiler.h> -#include <linux/types.h> -#include <asm-generic/swab.h> - -static inline __attribute_const__ __u32 __arch_swab32(__u32 x) -{ -	__asm__( -#ifdef __SH5__ -		"byterev	%1, %0\n\t" -		"shari		%0, 32, %0" -#else -		"swap.b		%1, %0\n\t" -		"swap.w		%0, %0\n\t" -		"swap.b		%0, %0" -#endif -		: "=r" (x) -		: "r" (x)); - -	return x; -} -#define __arch_swab32 __arch_swab32 - -static inline __attribute_const__ __u16 __arch_swab16(__u16 x) -{ -	__asm__( -#ifdef __SH5__ -		"byterev	%1, %0\n\t" -		"shari		%0, 32, %0" -#else -		"swap.b		%1, %0" -#endif -		: "=r" (x) -		:  "r" (x)); - -	return x; -} -#define __arch_swab16 __arch_swab16 - -static inline __u64 __arch_swab64(__u64 val) -{ -	union { -		struct { __u32 a,b; } s; -		__u64 u; -	} v, w; -	v.u = val; -	w.s.b = __arch_swab32(v.s.a); -	w.s.a = __arch_swab32(v.s.b); -	return w.u; -} -#define __arch_swab64 __arch_swab64 - -#endif /* __ASM_SH_SWAB_H */ diff --git a/arch/sh/include/asm/switch_to.h b/arch/sh/include/asm/switch_to.h new file mode 100644 index 00000000000..bcd722fc834 --- /dev/null +++ b/arch/sh/include/asm/switch_to.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2000, 2001  Paolo Alberelli + * Copyright (C) 2003  Paul Mundt + * Copyright (C) 2004  Richard Curnow + * + * This file is subject to the terms and conditions of the GNU General Public + * License.  See the file "COPYING" in the main directory of this archive + * for more details. + */ +#ifndef __ASM_SH_SWITCH_TO_H +#define __ASM_SH_SWITCH_TO_H + +#ifdef CONFIG_SUPERH32 +# include <asm/switch_to_32.h> +#else +# include <asm/switch_to_64.h> +#endif + +#endif /* __ASM_SH_SWITCH_TO_H */ diff --git a/arch/sh/include/asm/system_32.h b/arch/sh/include/asm/switch_to_32.h index a4ad1cd9bc4..0c065513e7a 100644 --- a/arch/sh/include/asm/system_32.h +++ b/arch/sh/include/asm/switch_to_32.h @@ -1,8 +1,5 @@ -#ifndef __ASM_SH_SYSTEM_32_H -#define __ASM_SH_SYSTEM_32_H - -#include <linux/types.h> -#include <asm/mmu.h> +#ifndef __ASM_SH_SWITCH_TO_32_H +#define __ASM_SH_SWITCH_TO_32_H  #ifdef CONFIG_SH_DSP @@ -32,7 +29,6 @@ do {									\  		: : "r" (__ts2));					\  } while (0) -  #define __save_dsp(tsk)							\  do {									\  	register u32 *__ts2 __asm__ ("r2") =				\ @@ -64,16 +60,6 @@ do {									\  #define __restore_dsp(tsk)	do { } while (0)  #endif -#if defined(CONFIG_CPU_SH4A) -#define __icbi(addr)	__asm__ __volatile__ ( "icbi @%0\n\t" : : "r" (addr)) -#else -#define __icbi(addr)	mb() -#endif - -#define __ocbp(addr)	__asm__ __volatile__ ( "ocbp @%0\n\t" : : "r" (addr)) -#define __ocbi(addr)	__asm__ __volatile__ ( "ocbi @%0\n\t" : : "r" (addr)) -#define __ocbwb(addr)	__asm__ __volatile__ ( "ocbwb @%0\n\t" : : "r" (addr)) -  struct task_struct *__switch_to(struct task_struct *prev,  				struct task_struct *next); @@ -145,92 +131,4 @@ do {								\  		__restore_dsp(prev);				\  } while (0) -#ifdef CONFIG_CPU_HAS_SR_RB -#define lookup_exception_vector()	\ -({					\ -	unsigned long _vec;		\ -					\ -	__asm__ __volatile__ (		\ -		"stc r2_bank, %0\n\t"	\ -		: "=r" (_vec)		\ -	);				\ -					\ -	_vec;				\ -}) -#else -#define lookup_exception_vector()	\ -({					\ -	unsigned long _vec;		\ -	__asm__ __volatile__ (		\ -		"mov r4, %0\n\t"	\ -		: "=r" (_vec)		\ -	);				\ -					\ -	_vec;				\ -}) -#endif - -static inline reg_size_t register_align(void *val) -{ -	return (unsigned long)(signed long)val; -} - -int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, -			    struct mem_access *ma, int, unsigned long address); - -static inline void trigger_address_error(void) -{ -	__asm__ __volatile__ ( -		"ldc %0, sr\n\t" -		"mov.l @%1, %0" -		: -		: "r" (0x10000000), "r" (0x80000001) -	); -} - -asmlinkage void do_address_error(struct pt_regs *regs, -				 unsigned long writeaccess, -				 unsigned long address); -asmlinkage void do_divide_error(unsigned long r4, unsigned long r5, -				unsigned long r6, unsigned long r7, -				struct pt_regs __regs); -asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5, -				unsigned long r6, unsigned long r7, -				struct pt_regs __regs); -asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5, -				unsigned long r6, unsigned long r7, -				struct pt_regs __regs); -asmlinkage void do_exception_error(unsigned long r4, unsigned long r5, -				   unsigned long r6, unsigned long r7, -				   struct pt_regs __regs); - -static inline void set_bl_bit(void) -{ -	unsigned long __dummy0, __dummy1; - -	__asm__ __volatile__ ( -		"stc	sr, %0\n\t" -		"or	%2, %0\n\t" -		"and	%3, %0\n\t" -		"ldc	%0, sr\n\t" -		: "=&r" (__dummy0), "=r" (__dummy1) -		: "r" (0x10000000), "r" (0xffffff0f) -		: "memory" -	); -} - -static inline void clear_bl_bit(void) -{ -	unsigned long __dummy0, __dummy1; - -	__asm__ __volatile__ ( -		"stc	sr, %0\n\t" -		"and	%2, %0\n\t" -		"ldc	%0, sr\n\t" -		: "=&r" (__dummy0), "=r" (__dummy1) -		: "1" (~0x10000000) -		: "memory" -	); -} - -#endif /* __ASM_SH_SYSTEM_32_H */ +#endif /* __ASM_SH_SWITCH_TO_32_H */ diff --git a/arch/sh/include/asm/switch_to_64.h b/arch/sh/include/asm/switch_to_64.h new file mode 100644 index 00000000000..ba3129d6bc2 --- /dev/null +++ b/arch/sh/include/asm/switch_to_64.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2000, 2001  Paolo Alberelli + * Copyright (C) 2003  Paul Mundt + * Copyright (C) 2004  Richard Curnow + * + * This file is subject to the terms and conditions of the GNU General Public + * License.  See the file "COPYING" in the main directory of this archive + * for more details. + */ +#ifndef __ASM_SH_SWITCH_TO_64_H +#define __ASM_SH_SWITCH_TO_64_H + +struct thread_struct; +struct task_struct; + +/* + *	switch_to() should switch tasks to task nr n, first + */ +struct task_struct *sh64_switch_to(struct task_struct *prev, +				   struct thread_struct *prev_thread, +				   struct task_struct *next, +				   struct thread_struct *next_thread); + +#define switch_to(prev,next,last)				\ +do {								\ +	if (last_task_used_math != next) {			\ +		struct pt_regs *regs = next->thread.uregs;	\ +		if (regs) regs->sr |= SR_FD;			\ +	}							\ +	last = sh64_switch_to(prev, &prev->thread, next,	\ +			      &next->thread);			\ +} while (0) + + +#endif /* __ASM_SH_SWITCH_TO_64_H */ diff --git a/arch/sh/include/asm/syscall.h b/arch/sh/include/asm/syscall.h index aa7777bdc37..847128da6ea 100644 --- a/arch/sh/include/asm/syscall.h +++ b/arch/sh/include/asm/syscall.h @@ -4,9 +4,9 @@  extern const unsigned long sys_call_table[];  #ifdef CONFIG_SUPERH32 -# include "syscall_32.h" +# include <asm/syscall_32.h>  #else -# include "syscall_64.h" +# include <asm/syscall_64.h>  #endif  #endif /* __ASM_SH_SYSCALL_H */ diff --git a/arch/sh/include/asm/syscalls.h b/arch/sh/include/asm/syscalls.h index 507725af2e5..3dbfef06f6b 100644 --- a/arch/sh/include/asm/syscalls.h +++ b/arch/sh/include/asm/syscalls.h @@ -11,9 +11,9 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,  			  unsigned long fd, unsigned long pgoff);  #ifdef CONFIG_SUPERH32 -# include "syscalls_32.h" +# include <asm/syscalls_32.h>  #else -# include "syscalls_64.h" +# include <asm/syscalls_64.h>  #endif  #endif /* __KERNEL__ */ diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h index ae717e3c26d..4f643aa718e 100644 --- a/arch/sh/include/asm/syscalls_32.h +++ b/arch/sh/include/asm/syscalls_32.h @@ -9,37 +9,9 @@  struct pt_regs; -asmlinkage int sys_fork(unsigned long r4, unsigned long r5, -			unsigned long r6, unsigned long r7, -			struct pt_regs __regs); -asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, -			 unsigned long parent_tidptr, -			 unsigned long child_tidptr, -			 struct pt_regs __regs); -asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, -			 unsigned long r6, unsigned long r7, -			 struct pt_regs __regs); -asmlinkage int sys_execve(const char __user *ufilename, -			  const char __user *const __user *uargv, -			  const char __user *const __user *uenvp, -			  unsigned long r7, struct pt_regs __regs); -asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5, -			      unsigned long r6, unsigned long r7, -			      struct pt_regs __regs); -asmlinkage int sys_sigaction(int sig, const struct old_sigaction __user *act, -			     struct old_sigaction __user *oact); -asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, -			       unsigned long r6, unsigned long r7, -			       struct pt_regs __regs); -asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, -			     unsigned long r6, unsigned long r7, -			     struct pt_regs __regs); -asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, -				unsigned long r6, unsigned long r7, -				struct pt_regs __regs); -asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5, -			   unsigned long r6, unsigned long r7, -			   struct pt_regs __regs); +asmlinkage int sys_sigreturn(void); +asmlinkage int sys_rt_sigreturn(void); +asmlinkage int sys_sh_pipe(void);  asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,  				     size_t count, long dummy, loff_t pos);  asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf, diff --git a/arch/sh/include/asm/syscalls_64.h b/arch/sh/include/asm/syscalls_64.h index ee519f41d95..d62e8eb22f7 100644 --- a/arch/sh/include/asm/syscalls_64.h +++ b/arch/sh/include/asm/syscalls_64.h @@ -9,23 +9,6 @@  struct pt_regs; -asmlinkage int sys_fork(unsigned long r2, unsigned long r3, -			unsigned long r4, unsigned long r5, -			unsigned long r6, unsigned long r7, -			struct pt_regs *pregs); -asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, -			 unsigned long r4, unsigned long r5, -			 unsigned long r6, unsigned long r7, -			 struct pt_regs *pregs); -asmlinkage int sys_vfork(unsigned long r2, unsigned long r3, -			 unsigned long r4, unsigned long r5, -			 unsigned long r6, unsigned long r7, -			 struct pt_regs *pregs); -asmlinkage int sys_execve(const char *ufilename, char **uargv, -			  char **uenvp, unsigned long r5, -			  unsigned long r6, unsigned long r7, -			  struct pt_regs *pregs); -  /* Misc syscall related bits */  asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs);  asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h deleted file mode 100644 index 10c8b1823a1..00000000000 --- a/arch/sh/include/asm/system.h +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef __ASM_SH_SYSTEM_H -#define __ASM_SH_SYSTEM_H - -/* - * Copyright (C) 1999, 2000  Niibe Yutaka  &  Kaz Kojima - * Copyright (C) 2002 Paul Mundt - */ - -#include <linux/irqflags.h> -#include <linux/compiler.h> -#include <linux/linkage.h> -#include <asm/types.h> -#include <asm/uncached.h> - -#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */ - -/* - * A brief note on ctrl_barrier(), the control register write barrier. - * - * Legacy SH cores typically require a sequence of 8 nops after - * modification of a control register in order for the changes to take - * effect. On newer cores (like the sh4a and sh5) this is accomplished - * with icbi. - * - * Also note that on sh4a in the icbi case we can forego a synco for the - * write barrier, as it's not necessary for control registers. - * - * Historically we have only done this type of barrier for the MMUCR, but - * it's also necessary for the CCR, so we make it generic here instead. - */ -#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5) -#define mb()		__asm__ __volatile__ ("synco": : :"memory") -#define rmb()		mb() -#define wmb()		__asm__ __volatile__ ("synco": : :"memory") -#define ctrl_barrier()	__icbi(PAGE_OFFSET) -#define read_barrier_depends()	do { } while(0) -#else -#define mb()		__asm__ __volatile__ ("": : :"memory") -#define rmb()		mb() -#define wmb()		__asm__ __volatile__ ("": : :"memory") -#define ctrl_barrier()	__asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop") -#define read_barrier_depends()	do { } while(0) -#endif - -#ifdef CONFIG_SMP -#define smp_mb()	mb() -#define smp_rmb()	rmb() -#define smp_wmb()	wmb() -#define smp_read_barrier_depends()	read_barrier_depends() -#else -#define smp_mb()	barrier() -#define smp_rmb()	barrier() -#define smp_wmb()	barrier() -#define smp_read_barrier_depends()	do { } while(0) -#endif - -#define set_mb(var, value) do { (void)xchg(&var, value); } while (0) - -#ifdef CONFIG_GUSA_RB -#include <asm/cmpxchg-grb.h> -#elif defined(CONFIG_CPU_SH4A) -#include <asm/cmpxchg-llsc.h> -#else -#include <asm/cmpxchg-irq.h> -#endif - -extern void __xchg_called_with_bad_pointer(void); - -#define __xchg(ptr, x, size)				\ -({							\ -	unsigned long __xchg__res;			\ -	volatile void *__xchg_ptr = (ptr);		\ -	switch (size) {					\ -	case 4:						\ -		__xchg__res = xchg_u32(__xchg_ptr, x);	\ -		break;					\ -	case 1:						\ -		__xchg__res = xchg_u8(__xchg_ptr, x);	\ -		break;					\ -	default:					\ -		__xchg_called_with_bad_pointer();	\ -		__xchg__res = x;			\ -		break;					\ -	}						\ -							\ -	__xchg__res;					\ -}) - -#define xchg(ptr,x)	\ -	((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)))) - -/* This function doesn't exist, so you'll get a linker error - * if something tries to do an invalid cmpxchg(). */ -extern void __cmpxchg_called_with_bad_pointer(void); - -#define __HAVE_ARCH_CMPXCHG 1 - -static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old, -		unsigned long new, int size) -{ -	switch (size) { -	case 4: -		return __cmpxchg_u32(ptr, old, new); -	} -	__cmpxchg_called_with_bad_pointer(); -	return old; -} - -#define cmpxchg(ptr,o,n)						 \ -  ({									 \ -     __typeof__(*(ptr)) _o_ = (o);					 \ -     __typeof__(*(ptr)) _n_ = (n);					 \ -     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,		 \ -				    (unsigned long)_n_, sizeof(*(ptr))); \ -  }) - -struct pt_regs; - -extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn)); -void free_initmem(void); -void free_initrd_mem(unsigned long start, unsigned long end); - -extern void *set_exception_table_vec(unsigned int vec, void *handler); - -static inline void *set_exception_table_evt(unsigned int evt, void *handler) -{ -	return set_exception_table_vec(evt >> 5, handler); -} - -/* - * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks. - */ -#ifdef CONFIG_CPU_SH2A -extern unsigned int instruction_size(unsigned int insn); -#elif defined(CONFIG_SUPERH32) -#define instruction_size(insn)	(2) -#else -#define instruction_size(insn)	(4) -#endif - -void per_cpu_trap_init(void); -void default_idle(void); -void cpu_idle_wait(void); -void stop_this_cpu(void *); - -#ifdef CONFIG_SUPERH32 -#define BUILD_TRAP_HANDLER(name)					\ -asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5,	\ -				    unsigned long r6, unsigned long r7,	\ -				    struct pt_regs __regs) - -#define TRAP_HANDLER_DECL				\ -	struct pt_regs *regs = RELOC_HIDE(&__regs, 0);	\ -	unsigned int vec = regs->tra;			\ -	(void)vec; -#else -#define BUILD_TRAP_HANDLER(name)	\ -asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs) -#define TRAP_HANDLER_DECL -#endif - -BUILD_TRAP_HANDLER(address_error); -BUILD_TRAP_HANDLER(debug); -BUILD_TRAP_HANDLER(bug); -BUILD_TRAP_HANDLER(breakpoint); -BUILD_TRAP_HANDLER(singlestep); -BUILD_TRAP_HANDLER(fpu_error); -BUILD_TRAP_HANDLER(fpu_state_restore); -BUILD_TRAP_HANDLER(nmi); - -#define arch_align_stack(x) (x) - -struct mem_access { -	unsigned long (*from)(void *dst, const void __user *src, unsigned long cnt); -	unsigned long (*to)(void __user *dst, const void *src, unsigned long cnt); -}; - -#ifdef CONFIG_SUPERH32 -# include "system_32.h" -#else -# include "system_64.h" -#endif - -#endif diff --git a/arch/sh/include/asm/system_64.h b/arch/sh/include/asm/system_64.h deleted file mode 100644 index 8593bc8d1a4..00000000000 --- a/arch/sh/include/asm/system_64.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef __ASM_SH_SYSTEM_64_H -#define __ASM_SH_SYSTEM_64_H - -/* - * include/asm-sh/system_64.h - * - * Copyright (C) 2000, 2001  Paolo Alberelli - * Copyright (C) 2003  Paul Mundt - * Copyright (C) 2004  Richard Curnow - * - * This file is subject to the terms and conditions of the GNU General Public - * License.  See the file "COPYING" in the main directory of this archive - * for more details. - */ -#include <cpu/registers.h> -#include <asm/processor.h> - -/* - *	switch_to() should switch tasks to task nr n, first - */ -struct thread_struct; -struct task_struct *sh64_switch_to(struct task_struct *prev, -				   struct thread_struct *prev_thread, -				   struct task_struct *next, -				   struct thread_struct *next_thread); - -#define switch_to(prev,next,last)				\ -do {								\ -	if (last_task_used_math != next) {			\ -		struct pt_regs *regs = next->thread.uregs;	\ -		if (regs) regs->sr |= SR_FD;			\ -	}							\ -	last = sh64_switch_to(prev, &prev->thread, next,	\ -			      &next->thread);			\ -} while (0) - -#define __icbi(addr)	__asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr)) -#define __ocbp(addr)	__asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr)) -#define __ocbi(addr)	__asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr)) -#define __ocbwb(addr)	__asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr)) - -static inline reg_size_t register_align(void *val) -{ -	return (unsigned long long)(signed long long)(signed long)val; -} - -extern void phys_stext(void); - -static inline void trigger_address_error(void) -{ -	phys_stext(); -} - -#define SR_BL_LL	0x0000000010000000LL - -static inline void set_bl_bit(void) -{ -	unsigned long long __dummy0, __dummy1 = SR_BL_LL; - -	__asm__ __volatile__("getcon	" __SR ", %0\n\t" -			     "or	%0, %1, %0\n\t" -			     "putcon	%0, " __SR "\n\t" -			     : "=&r" (__dummy0) -			     : "r" (__dummy1)); - -} - -static inline void clear_bl_bit(void) -{ -	unsigned long long __dummy0, __dummy1 = ~SR_BL_LL; - -	__asm__ __volatile__("getcon	" __SR ", %0\n\t" -			     "and	%0, %1, %0\n\t" -			     "putcon	%0, " __SR "\n\t" -			     : "=&r" (__dummy0) -			     : "r" (__dummy1)); -} - -#endif /* __ASM_SH_SYSTEM_64_H */ diff --git a/arch/sh/include/asm/termbits.h b/arch/sh/include/asm/termbits.h deleted file mode 100644 index 3935b106de7..00000000000 --- a/arch/sh/include/asm/termbits.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/termbits.h> diff --git a/arch/sh/include/asm/termios.h b/arch/sh/include/asm/termios.h deleted file mode 100644 index 280d78a9d96..00000000000 --- a/arch/sh/include/asm/termios.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/termios.h> diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h index c228946926e..ad27ffa65e2 100644 --- a/arch/sh/include/asm/thread_info.h +++ b/arch/sh/include/asm/thread_info.h @@ -10,8 +10,18 @@   *  - Incorporating suggestions made by Linus Torvalds and Dave Miller   */  #ifdef __KERNEL__ +  #include <asm/page.h> +/* + * Page fault error code bits + */ +#define FAULT_CODE_WRITE	(1 << 0)	/* write access */ +#define FAULT_CODE_INITIAL	(1 << 1)	/* initial page write */ +#define FAULT_CODE_ITLB		(1 << 2)	/* ITLB miss */ +#define FAULT_CODE_PROT		(1 << 3)	/* protection fault */ +#define FAULT_CODE_USER		(1 << 4)	/* user-mode access */ +  #ifndef __ASSEMBLY__  #include <asm/processor.h> @@ -31,8 +41,6 @@ struct thread_info {  #endif -#define PREEMPT_ACTIVE		0x10000000 -  #if defined(CONFIG_4KSTACKS)  #define THREAD_SHIFT	12  #else @@ -88,29 +96,23 @@ static inline struct thread_info *current_thread_info(void)  	return ti;  } -/* thread information allocation */ -#if THREAD_SHIFT >= PAGE_SHIFT -  #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT) -#endif - -extern struct thread_info *alloc_thread_info(struct task_struct *tsk); -extern void free_thread_info(struct thread_info *ti);  extern void arch_task_cache_init(void); -#define arch_task_cache_init arch_task_cache_init  extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); +extern void arch_release_task_struct(struct task_struct *tsk);  extern void init_thread_xstate(void); -#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR -  #endif /* __ASSEMBLY__ */  /* - * thread information flags - * - these are process state flags that various assembly files may need to access - * - pending work-to-be-done flags are in LSW - * - other flags in MSW + * Thread information flags + * + * - Limited to 24 bits, upper byte used for fault code encoding. + * + * - _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within 2 bytes, or + *   we blow the tst immediate size constraints and need to fix up + *   arch/sh/kernel/entry-common.S.   */  #define TIF_SYSCALL_TRACE	0	/* syscall trace active */  #define TIF_SIGPENDING		1	/* signal pending */ @@ -122,7 +124,6 @@ extern void init_thread_xstate(void);  #define TIF_SYSCALL_TRACEPOINT	8	/* for ftrace syscall instrumentation */  #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */  #define TIF_MEMDIE		18	/* is terminating due to OOM killer */ -#define TIF_FREEZE		19	/* Freezing for suspend */  #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)  #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING) @@ -133,13 +134,6 @@ extern void init_thread_xstate(void);  #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)  #define _TIF_SYSCALL_TRACEPOINT	(1 << TIF_SYSCALL_TRACEPOINT)  #define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG) -#define _TIF_FREEZE		(1 << TIF_FREEZE) - -/* - * _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within 2 bytes, or we - * blow the tst immediate size constraints and need to fix up - * arch/sh/kernel/entry-common.S. - */  /* work to do in syscall trace */  #define _TIF_WORK_SYSCALL_MASK	(_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ @@ -167,13 +161,50 @@ extern void init_thread_xstate(void);  #define TS_USEDFPU		0x0002	/* FPU used by this task this quantum */  #ifndef __ASSEMBLY__ +  #define HAVE_SET_RESTORE_SIGMASK	1  static inline void set_restore_sigmask(void)  {  	struct thread_info *ti = current_thread_info();  	ti->status |= TS_RESTORE_SIGMASK; -	set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags); +	WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags));  } + +#define TI_FLAG_FAULT_CODE_SHIFT	24 + +/* + * Additional thread flag encoding + */ +static inline void set_thread_fault_code(unsigned int val) +{ +	struct thread_info *ti = current_thread_info(); +	ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT))) +		| (val << TI_FLAG_FAULT_CODE_SHIFT); +} + +static inline unsigned int get_thread_fault_code(void) +{ +	struct thread_info *ti = current_thread_info(); +	return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT; +} + +static inline void clear_restore_sigmask(void) +{ +	current_thread_info()->status &= ~TS_RESTORE_SIGMASK; +} +static inline bool test_restore_sigmask(void) +{ +	return current_thread_info()->status & TS_RESTORE_SIGMASK; +} +static inline bool test_and_clear_restore_sigmask(void) +{ +	struct thread_info *ti = current_thread_info(); +	if (!(ti->status & TS_RESTORE_SIGMASK)) +		return false; +	ti->status &= ~TS_RESTORE_SIGMASK; +	return true; +} +  #endif	/* !__ASSEMBLY__ */  #endif /* __KERNEL__ */ diff --git a/arch/sh/include/asm/tlb.h b/arch/sh/include/asm/tlb.h index 75abb38dffd..62f80d2a9df 100644 --- a/arch/sh/include/asm/tlb.h +++ b/arch/sh/include/asm/tlb.h @@ -2,13 +2,14 @@  #define __ASM_SH_TLB_H  #ifdef CONFIG_SUPERH64 -# include "tlb_64.h" +# include <asm/tlb_64.h>  #endif  #ifndef __ASSEMBLY__  #include <linux/pagemap.h>  #ifdef CONFIG_MMU +#include <linux/swap.h>  #include <asm/pgalloc.h>  #include <asm/tlbflush.h>  #include <asm/mmu_context.h> @@ -23,8 +24,6 @@ struct mmu_gather {  	unsigned long		start, end;  }; -DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); -  static inline void init_tlb_gather(struct mmu_gather *tlb)  {  	tlb->start = TASK_SIZE; @@ -36,17 +35,15 @@ static inline void init_tlb_gather(struct mmu_gather *tlb)  	}  } -static inline struct mmu_gather * -tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) +static inline void +tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)  { -	struct mmu_gather *tlb = &get_cpu_var(mmu_gathers); -  	tlb->mm = mm; -	tlb->fullmm = full_mm_flush; +	tlb->start = start; +	tlb->end = end; +	tlb->fullmm = !(start | (end+1));  	init_tlb_gather(tlb); - -	return tlb;  }  static inline void @@ -57,8 +54,6 @@ tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)  	/* keep the page table cache within bounds */  	check_pgt_cache(); - -	put_cpu_var(mmu_gathers);  }  static inline void @@ -91,7 +86,29 @@ tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)  	}  } -#define tlb_remove_page(tlb,page)	free_page_and_swap_cache(page) +static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) +{ +} + +static inline void tlb_flush_mmu_free(struct mmu_gather *tlb) +{ +} + +static inline void tlb_flush_mmu(struct mmu_gather *tlb) +{ +} + +static inline int __tlb_remove_page(struct mmu_gather *tlb, struct page *page) +{ +	free_page_and_swap_cache(page); +	return 1; /* avoid calling tlb_flush_mmu */ +} + +static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) +{ +	__tlb_remove_page(tlb, page); +} +  #define pte_free_tlb(tlb, ptep, addr)	pte_free((tlb)->mm, ptep)  #define pmd_free_tlb(tlb, pmdp, addr)	pmd_free((tlb)->mm, pmdp)  #define pud_free_tlb(tlb, pudp, addr)	pud_free((tlb)->mm, pudp) diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h index 88e734069fa..b0a282d65f6 100644 --- a/arch/sh/include/asm/topology.h +++ b/arch/sh/include/asm/topology.h @@ -3,31 +3,6 @@  #ifdef CONFIG_NUMA -/* sched_domains SD_NODE_INIT for sh machines */ -#define SD_NODE_INIT (struct sched_domain) {		\ -	.parent			= NULL,			\ -	.child			= NULL,			\ -	.groups			= NULL,			\ -	.min_interval		= 8,			\ -	.max_interval		= 32,			\ -	.busy_factor		= 32,			\ -	.imbalance_pct		= 125,			\ -	.cache_nice_tries	= 2,			\ -	.busy_idx		= 3,			\ -	.idle_idx		= 2,			\ -	.newidle_idx		= 0,			\ -	.wake_idx		= 0,			\ -	.forkexec_idx		= 0,			\ -	.flags			= SD_LOAD_BALANCE	\ -				| SD_BALANCE_FORK	\ -				| SD_BALANCE_EXEC	\ -				| SD_BALANCE_NEWIDLE	\ -				| SD_SERIALIZE,		\ -	.last_balance		= jiffies,		\ -	.balance_interval	= 1,			\ -	.nr_balance_failed	= 0,			\ -} -  #define cpu_to_node(cpu)	((void)(cpu),0)  #define parent_node(node)	((void)(node),0) diff --git a/arch/sh/include/asm/traps.h b/arch/sh/include/asm/traps.h new file mode 100644 index 00000000000..9cc149a0dbd --- /dev/null +++ b/arch/sh/include/asm/traps.h @@ -0,0 +1,21 @@ +#ifndef __ASM_SH_TRAPS_H +#define __ASM_SH_TRAPS_H + +#include <linux/compiler.h> + +#ifdef CONFIG_SUPERH32 +# include <asm/traps_32.h> +#else +# include <asm/traps_64.h> +#endif + +BUILD_TRAP_HANDLER(address_error); +BUILD_TRAP_HANDLER(debug); +BUILD_TRAP_HANDLER(bug); +BUILD_TRAP_HANDLER(breakpoint); +BUILD_TRAP_HANDLER(singlestep); +BUILD_TRAP_HANDLER(fpu_error); +BUILD_TRAP_HANDLER(fpu_state_restore); +BUILD_TRAP_HANDLER(nmi); + +#endif /* __ASM_SH_TRAPS_H */ diff --git a/arch/sh/include/asm/traps_32.h b/arch/sh/include/asm/traps_32.h new file mode 100644 index 00000000000..17e129fe459 --- /dev/null +++ b/arch/sh/include/asm/traps_32.h @@ -0,0 +1,60 @@ +#ifndef __ASM_SH_TRAPS_32_H +#define __ASM_SH_TRAPS_32_H + +#include <linux/types.h> +#include <asm/mmu.h> + +#ifdef CONFIG_CPU_HAS_SR_RB +#define lookup_exception_vector()	\ +({					\ +	unsigned long _vec;		\ +					\ +	__asm__ __volatile__ (		\ +		"stc r2_bank, %0\n\t"	\ +		: "=r" (_vec)		\ +	);				\ +					\ +	_vec;				\ +}) +#else +#define lookup_exception_vector()	\ +({					\ +	unsigned long _vec;		\ +	__asm__ __volatile__ (		\ +		"mov r4, %0\n\t"	\ +		: "=r" (_vec)		\ +	);				\ +					\ +	_vec;				\ +}) +#endif + +static inline void trigger_address_error(void) +{ +	__asm__ __volatile__ ( +		"ldc %0, sr\n\t" +		"mov.l @%1, %0" +		: +		: "r" (0x10000000), "r" (0x80000001) +	); +} + +asmlinkage void do_address_error(struct pt_regs *regs, +				 unsigned long writeaccess, +				 unsigned long address); +asmlinkage void do_divide_error(unsigned long r4); +asmlinkage void do_reserved_inst(void); +asmlinkage void do_illegal_slot_inst(void); +asmlinkage void do_exception_error(void); + +#define BUILD_TRAP_HANDLER(name)					\ +asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5,	\ +				    unsigned long r6, unsigned long r7,	\ +				    struct pt_regs __regs) + +#define TRAP_HANDLER_DECL				\ +	struct pt_regs *regs = RELOC_HIDE(&__regs, 0);	\ +	unsigned int vec = regs->tra;			\ +	(void)vec; + +#endif /* __ASM_SH_TRAPS_32_H */ diff --git a/arch/sh/include/asm/traps_64.h b/arch/sh/include/asm/traps_64.h new file mode 100644 index 00000000000..ef5eff91944 --- /dev/null +++ b/arch/sh/include/asm/traps_64.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2000, 2001  Paolo Alberelli + * Copyright (C) 2003  Paul Mundt + * Copyright (C) 2004  Richard Curnow + * + * This file is subject to the terms and conditions of the GNU General Public + * License.  See the file "COPYING" in the main directory of this archive + * for more details. + */ +#ifndef __ASM_SH_TRAPS_64_H +#define __ASM_SH_TRAPS_64_H + +#include <cpu/registers.h> + +extern void phys_stext(void); + +#define lookup_exception_vector()		\ +({						\ +	unsigned long _vec;			\ +						\ +	__asm__ __volatile__ (			\ +		"getcon " __EXPEVT ", %0\n\t"	\ +		: "=r" (_vec)			\ +	);					\ +						\ +	_vec;					\ +}) + +static inline void trigger_address_error(void) +{ +	phys_stext(); +} + +#define BUILD_TRAP_HANDLER(name)	\ +asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs) +#define TRAP_HANDLER_DECL + +#endif /* __ASM_SH_TRAPS_64_H */ diff --git a/arch/sh/include/asm/types.h b/arch/sh/include/asm/types.h index f8421f7ad63..6a31053fa5e 100644 --- a/arch/sh/include/asm/types.h +++ b/arch/sh/include/asm/types.h @@ -1,12 +1,11 @@  #ifndef __ASM_SH_TYPES_H  #define __ASM_SH_TYPES_H -#include <asm-generic/types.h> +#include <uapi/asm/types.h>  /*   * These aren't exported outside the kernel to avoid name space clashes   */ -#ifdef __KERNEL__  #ifndef __ASSEMBLY__  #ifdef CONFIG_SUPERH32 @@ -18,6 +17,4 @@ typedef u64 reg_size_t;  #endif  #endif /* __ASSEMBLY__ */ -#endif /* __KERNEL__ */ -  #endif /* __ASM_SH_TYPES_H */ diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 075848f43b6..9486376605f 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h @@ -25,6 +25,8 @@  	(__chk_user_ptr(addr),		\  	 __access_ok((unsigned long __force)(addr), (size))) +#define user_addr_max()	(current_thread_info()->addr_limit.seg) +  /*   * Uh, these should become the main single-value transfer routines ...   * They automatically use the right size if we just have the right @@ -95,11 +97,16 @@ struct __large_struct { unsigned long buf[100]; };  })  #ifdef CONFIG_SUPERH32 -# include "uaccess_32.h" +# include <asm/uaccess_32.h>  #else -# include "uaccess_64.h" +# include <asm/uaccess_64.h>  #endif +extern long strncpy_from_user(char *dest, const char __user *src, long count); + +extern __must_check long strlen_user(const char __user *str); +extern __must_check long strnlen_user(const char __user *str, long n); +  /* Generic arbitrary sized copy.  */  /* Return the number of bytes NOT copied */  __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); @@ -137,37 +144,6 @@ __kernel_size_t __clear_user(void *addr, __kernel_size_t size);  	__cl_size;							\  }) -/** - * strncpy_from_user: - Copy a NUL terminated string from userspace. - * @dst:   Destination address, in kernel space.  This buffer must be at - *         least @count bytes long. - * @src:   Source address, in user space. - * @count: Maximum number of bytes to copy, including the trailing NUL. - * - * Copies a NUL-terminated string from userspace to kernel space. - * - * On success, returns the length of the string (not including the trailing - * NUL). - * - * If access to userspace fails, returns -EFAULT (some data may have been - * copied). - * - * If @count is smaller than the length of the string, copies @count bytes - * and returns @count. - */ -#define strncpy_from_user(dest,src,count)				\ -({									\ -	unsigned long __sfu_src = (unsigned long)(src);			\ -	int __sfu_count = (int)(count);					\ -	long __sfu_res = -EFAULT;					\ -									\ -	if (__access_ok(__sfu_src, __sfu_count))			\ -		__sfu_res = __strncpy_from_user((unsigned long)(dest),	\ -				__sfu_src, __sfu_count);		\ -									\ -	__sfu_res;							\ -}) -  static inline unsigned long  copy_from_user(void *to, const void __user *from, unsigned long n)  { @@ -192,43 +168,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n)  	return __copy_size;  } -/** - * strnlen_user: - Get the size of a string in user space. - * @s: The string to measure. - * @n: The maximum valid length - * - * Context: User context only.  This function may sleep. - * - * Get the size of a NUL-terminated string in user space. - * - * Returns the size of the string INCLUDING the terminating NUL. - * On exception, returns 0. - * If the string is too long, returns a value greater than @n. - */ -static inline long strnlen_user(const char __user *s, long n) -{ -	if (!__addr_ok(s)) -		return 0; -	else -		return __strnlen_user(s, n); -} - -/** - * strlen_user: - Get the size of a string in user space. - * @str: The string to measure. - * - * Context: User context only.  This function may sleep. - * - * Get the size of a NUL-terminated string in user space. - * - * Returns the size of the string INCLUDING the terminating NUL. - * On exception, returns 0. - * - * If there is a limit on the length of a valid string, you may wish to - * consider using strnlen_user() instead. - */ -#define strlen_user(str)	strnlen_user(str, ~0UL >> 1) -  /*   * The exception table consists of pairs of addresses: the first is the   * address of an instruction that is allowed to fault, and the second is @@ -254,5 +193,19 @@ int fixup_exception(struct pt_regs *regs);  unsigned long search_exception_table(unsigned long addr);  const struct exception_table_entry *search_exception_tables(unsigned long addr); +extern void *set_exception_table_vec(unsigned int vec, void *handler); + +static inline void *set_exception_table_evt(unsigned int evt, void *handler) +{ +	return set_exception_table_vec(evt >> 5, handler); +} + +struct mem_access { +	unsigned long (*from)(void *dst, const void __user *src, unsigned long cnt); +	unsigned long (*to)(void __user *dst, const void *src, unsigned long cnt); +}; + +int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, +			    struct mem_access *ma, int, unsigned long address);  #endif /* __ASM_SH_UACCESS_H */ diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h index ae0d24f6653..c0de7ee35ab 100644 --- a/arch/sh/include/asm/uaccess_32.h +++ b/arch/sh/include/asm/uaccess_32.h @@ -170,79 +170,4 @@ __asm__ __volatile__( \  extern void __put_user_unknown(void); -static inline int -__strncpy_from_user(unsigned long __dest, unsigned long __user __src, int __count) -{ -	__kernel_size_t res; -	unsigned long __dummy, _d, _s, _c; - -	__asm__ __volatile__( -		"9:\n" -		"mov.b	@%2+, %1\n\t" -		"cmp/eq	#0, %1\n\t" -		"bt/s	2f\n" -		"1:\n" -		"mov.b	%1, @%3\n\t" -		"dt	%4\n\t" -		"bf/s	9b\n\t" -		" add	#1, %3\n\t" -		"2:\n\t" -		"sub	%4, %0\n" -		"3:\n" -		".section .fixup,\"ax\"\n" -		"4:\n\t" -		"mov.l	5f, %1\n\t" -		"jmp	@%1\n\t" -		" mov	%9, %0\n\t" -		".balign 4\n" -		"5:	.long 3b\n" -		".previous\n" -		".section __ex_table,\"a\"\n" -		"	.balign 4\n" -		"	.long 9b,4b\n" -		".previous" -		: "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d), "=r"(_c) -		: "0" (__count), "2" (__src), "3" (__dest), "4" (__count), -		  "i" (-EFAULT) -		: "memory", "t"); - -	return res; -} - -/* - * Return the size of a string (including the ending 0 even when we have - * exceeded the maximum string length). - */ -static inline long __strnlen_user(const char __user *__s, long __n) -{ -	unsigned long res; -	unsigned long __dummy; - -	__asm__ __volatile__( -		"1:\t" -		"mov.b	@(%0,%3), %1\n\t" -		"cmp/eq	%4, %0\n\t" -		"bt/s	2f\n\t" -		" add	#1, %0\n\t" -		"tst	%1, %1\n\t" -		"bf	1b\n\t" -		"2:\n" -		".section .fixup,\"ax\"\n" -		"3:\n\t" -		"mov.l	4f, %1\n\t" -		"jmp	@%1\n\t" -		" mov	#0, %0\n" -		".balign 4\n" -		"4:	.long 2b\n" -		".previous\n" -		".section __ex_table,\"a\"\n" -		"	.balign 4\n" -		"	.long 1b,3b\n" -		".previous" -		: "=z" (res), "=&r" (__dummy) -		: "0" (0), "r" (__s), "r" (__n) -		: "t"); -	return res; -} -  #endif /* __ASM_SH_UACCESS_32_H */ diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h index 56fd20b8cdc..2e07e0f40c6 100644 --- a/arch/sh/include/asm/uaccess_64.h +++ b/arch/sh/include/asm/uaccess_64.h @@ -84,8 +84,4 @@ extern long __put_user_asm_l(void *, long);  extern long __put_user_asm_q(void *, long);  extern void __put_user_unknown(void); -extern long __strnlen_user(const char *__s, long __n); -extern int __strncpy_from_user(unsigned long __dest, -	       unsigned long __user __src, int __count); -  #endif /* __ASM_SH_UACCESS_64_H */ diff --git a/arch/sh/include/asm/ucontext.h b/arch/sh/include/asm/ucontext.h deleted file mode 100644 index 9bc07b9f30f..00000000000 --- a/arch/sh/include/asm/ucontext.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/ucontext.h> diff --git a/arch/sh/include/asm/unaligned-sh4a.h b/arch/sh/include/asm/unaligned-sh4a.h index 9f4dd252c98..95adc500cab 100644 --- a/arch/sh/include/asm/unaligned-sh4a.h +++ b/arch/sh/include/asm/unaligned-sh4a.h @@ -9,7 +9,7 @@   * struct.   *   * The same note as with the movli.l/movco.l pair applies here, as long - * as the load is gauranteed to be inlined, nothing else will hook in to + * as the load is guaranteed to be inlined, nothing else will hook in to   * r0 and we get the return value for free.   *   * NOTE: Due to the fact we require r0 encoding, care should be taken to @@ -18,10 +18,20 @@   * of spill registers and blowing up when building at low optimization   * levels. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34777.   */ +#include <linux/unaligned/packed_struct.h>  #include <linux/types.h>  #include <asm/byteorder.h> -static __always_inline u32 __get_unaligned_cpu32(const u8 *p) +static inline u16 sh4a_get_unaligned_cpu16(const u8 *p) +{ +#ifdef __LITTLE_ENDIAN +	return p[0] | p[1] << 8; +#else +	return p[0] << 8 | p[1]; +#endif +} + +static __always_inline u32 sh4a_get_unaligned_cpu32(const u8 *p)  {  	unsigned long unaligned; @@ -34,218 +44,148 @@ static __always_inline u32 __get_unaligned_cpu32(const u8 *p)  	return unaligned;  } -struct __una_u16 { u16 x __attribute__((packed)); }; -struct __una_u32 { u32 x __attribute__((packed)); }; -struct __una_u64 { u64 x __attribute__((packed)); }; - -static inline u16 __get_unaligned_cpu16(const u8 *p) -{ -#ifdef __LITTLE_ENDIAN -	return p[0] | p[1] << 8; -#else -	return p[0] << 8 | p[1]; -#endif -} -  /*   * Even though movua.l supports auto-increment on the read side, it can   * only store to r0 due to instruction encoding constraints, so just let   * the compiler sort it out on its own.   */ -static inline u64 __get_unaligned_cpu64(const u8 *p) +static inline u64 sh4a_get_unaligned_cpu64(const u8 *p)  {  #ifdef __LITTLE_ENDIAN -	return (u64)__get_unaligned_cpu32(p + 4) << 32 | -		    __get_unaligned_cpu32(p); +	return (u64)sh4a_get_unaligned_cpu32(p + 4) << 32 | +		    sh4a_get_unaligned_cpu32(p);  #else -	return (u64)__get_unaligned_cpu32(p) << 32 | -		    __get_unaligned_cpu32(p + 4); +	return (u64)sh4a_get_unaligned_cpu32(p) << 32 | +		    sh4a_get_unaligned_cpu32(p + 4);  #endif  }  static inline u16 get_unaligned_le16(const void *p)  { -	return le16_to_cpu(__get_unaligned_cpu16(p)); +	return le16_to_cpu(sh4a_get_unaligned_cpu16(p));  }  static inline u32 get_unaligned_le32(const void *p)  { -	return le32_to_cpu(__get_unaligned_cpu32(p)); +	return le32_to_cpu(sh4a_get_unaligned_cpu32(p));  }  static inline u64 get_unaligned_le64(const void *p)  { -	return le64_to_cpu(__get_unaligned_cpu64(p)); +	return le64_to_cpu(sh4a_get_unaligned_cpu64(p));  }  static inline u16 get_unaligned_be16(const void *p)  { -	return be16_to_cpu(__get_unaligned_cpu16(p)); +	return be16_to_cpu(sh4a_get_unaligned_cpu16(p));  }  static inline u32 get_unaligned_be32(const void *p)  { -	return be32_to_cpu(__get_unaligned_cpu32(p)); +	return be32_to_cpu(sh4a_get_unaligned_cpu32(p));  }  static inline u64 get_unaligned_be64(const void *p)  { -	return be64_to_cpu(__get_unaligned_cpu64(p)); +	return be64_to_cpu(sh4a_get_unaligned_cpu64(p));  } -static inline void __put_le16_noalign(u8 *p, u16 val) +static inline void nonnative_put_le16(u16 val, u8 *p)  {  	*p++ = val;  	*p++ = val >> 8;  } -static inline void __put_le32_noalign(u8 *p, u32 val) +static inline void nonnative_put_le32(u32 val, u8 *p)  { -	__put_le16_noalign(p, val); -	__put_le16_noalign(p + 2, val >> 16); +	nonnative_put_le16(val, p); +	nonnative_put_le16(val >> 16, p + 2);  } -static inline void __put_le64_noalign(u8 *p, u64 val) +static inline void nonnative_put_le64(u64 val, u8 *p)  { -	__put_le32_noalign(p, val); -	__put_le32_noalign(p + 4, val >> 32); +	nonnative_put_le32(val, p); +	nonnative_put_le32(val >> 32, p + 4);  } -static inline void __put_be16_noalign(u8 *p, u16 val) +static inline void nonnative_put_be16(u16 val, u8 *p)  {  	*p++ = val >> 8;  	*p++ = val;  } -static inline void __put_be32_noalign(u8 *p, u32 val) +static inline void nonnative_put_be32(u32 val, u8 *p)  { -	__put_be16_noalign(p, val >> 16); -	__put_be16_noalign(p + 2, val); +	nonnative_put_be16(val >> 16, p); +	nonnative_put_be16(val, p + 2);  } -static inline void __put_be64_noalign(u8 *p, u64 val) +static inline void nonnative_put_be64(u64 val, u8 *p)  { -	__put_be32_noalign(p, val >> 32); -	__put_be32_noalign(p + 4, val); +	nonnative_put_be32(val >> 32, p); +	nonnative_put_be32(val, p + 4);  }  static inline void put_unaligned_le16(u16 val, void *p)  {  #ifdef __LITTLE_ENDIAN -	((struct __una_u16 *)p)->x = val; +	__put_unaligned_cpu16(val, p);  #else -	__put_le16_noalign(p, val); +	nonnative_put_le16(val, p);  #endif  }  static inline void put_unaligned_le32(u32 val, void *p)  {  #ifdef __LITTLE_ENDIAN -	((struct __una_u32 *)p)->x = val; +	__put_unaligned_cpu32(val, p);  #else -	__put_le32_noalign(p, val); +	nonnative_put_le32(val, p);  #endif  }  static inline void put_unaligned_le64(u64 val, void *p)  {  #ifdef __LITTLE_ENDIAN -	((struct __una_u64 *)p)->x = val; +	__put_unaligned_cpu64(val, p);  #else -	__put_le64_noalign(p, val); +	nonnative_put_le64(val, p);  #endif  }  static inline void put_unaligned_be16(u16 val, void *p)  {  #ifdef __BIG_ENDIAN -	((struct __una_u16 *)p)->x = val; +	__put_unaligned_cpu16(val, p);  #else -	__put_be16_noalign(p, val); +	nonnative_put_be16(val, p);  #endif  }  static inline void put_unaligned_be32(u32 val, void *p)  {  #ifdef __BIG_ENDIAN -	((struct __una_u32 *)p)->x = val; +	__put_unaligned_cpu32(val, p);  #else -	__put_be32_noalign(p, val); +	nonnative_put_be32(val, p);  #endif  }  static inline void put_unaligned_be64(u64 val, void *p)  {  #ifdef __BIG_ENDIAN -	((struct __una_u64 *)p)->x = val; +	__put_unaligned_cpu64(val, p);  #else -	__put_be64_noalign(p, val); +	nonnative_put_be64(val, p);  #endif  }  /* - * Cause a link-time error if we try an unaligned access other than - * 1,2,4 or 8 bytes long + * While it's a bit non-obvious, even though the generic le/be wrappers + * use the __get/put_xxx prefixing, they actually wrap in to the + * non-prefixed get/put_xxx variants as provided above.   */ -extern void __bad_unaligned_access_size(void); - -#define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({			\ -	__builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr),			\ -	__builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)),	\ -	__builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)),	\ -	__builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)),	\ -	__bad_unaligned_access_size()))));					\ -	})) - -#define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({			\ -	__builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr),			\ -	__builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)),	\ -	__builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)),	\ -	__builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)),	\ -	__bad_unaligned_access_size()))));					\ -	})) - -#define __put_unaligned_le(val, ptr) ({					\ -	void *__gu_p = (ptr);						\ -	switch (sizeof(*(ptr))) {					\ -	case 1:								\ -		*(u8 *)__gu_p = (__force u8)(val);			\ -		break;							\ -	case 2:								\ -		put_unaligned_le16((__force u16)(val), __gu_p);		\ -		break;							\ -	case 4:								\ -		put_unaligned_le32((__force u32)(val), __gu_p);		\ -		break;							\ -	case 8:								\ -		put_unaligned_le64((__force u64)(val), __gu_p);		\ -		break;							\ -	default:							\ -		__bad_unaligned_access_size();				\ -		break;							\ -	}								\ -	(void)0; }) - -#define __put_unaligned_be(val, ptr) ({					\ -	void *__gu_p = (ptr);						\ -	switch (sizeof(*(ptr))) {					\ -	case 1:								\ -		*(u8 *)__gu_p = (__force u8)(val);			\ -		break;							\ -	case 2:								\ -		put_unaligned_be16((__force u16)(val), __gu_p);		\ -		break;							\ -	case 4:								\ -		put_unaligned_be32((__force u32)(val), __gu_p);		\ -		break;							\ -	case 8:								\ -		put_unaligned_be64((__force u64)(val), __gu_p);		\ -		break;							\ -	default:							\ -		__bad_unaligned_access_size();				\ -		break;							\ -	}								\ -	(void)0; }) +#include <linux/unaligned/generic.h>  #ifdef __LITTLE_ENDIAN  # define get_unaligned __get_unaligned_le diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h index 65be656ead7..126fe8340b2 100644 --- a/arch/sh/include/asm/unistd.h +++ b/arch/sh/include/asm/unistd.h @@ -1,13 +1,32 @@ -#ifdef __KERNEL__  # ifdef CONFIG_SUPERH32 -#  include "unistd_32.h" +#  include <asm/unistd_32.h>  # else -#  include "unistd_64.h" +#  include <asm/unistd_64.h>  # endif -#else -# ifdef __SH5__ -#  include "unistd_64.h" -# else -#  include "unistd_32.h" -# endif -#endif + +# define __ARCH_WANT_OLD_READDIR +# define __ARCH_WANT_OLD_STAT +# define __ARCH_WANT_STAT64 +# define __ARCH_WANT_SYS_ALARM +# define __ARCH_WANT_SYS_GETHOSTNAME +# define __ARCH_WANT_SYS_IPC +# define __ARCH_WANT_SYS_PAUSE +# define __ARCH_WANT_SYS_SIGNAL +# define __ARCH_WANT_SYS_TIME +# define __ARCH_WANT_SYS_UTIME +# define __ARCH_WANT_SYS_WAITPID +# define __ARCH_WANT_SYS_SOCKETCALL +# define __ARCH_WANT_SYS_FADVISE64 +# define __ARCH_WANT_SYS_GETPGRP +# define __ARCH_WANT_SYS_LLSEEK +# define __ARCH_WANT_SYS_NICE +# define __ARCH_WANT_SYS_OLD_GETRLIMIT +# define __ARCH_WANT_SYS_OLD_UNAME +# define __ARCH_WANT_SYS_OLDUMOUNT +# define __ARCH_WANT_SYS_SIGPENDING +# define __ARCH_WANT_SYS_SIGPROCMASK +# define __ARCH_WANT_SYS_FORK +# define __ARCH_WANT_SYS_VFORK +# define __ARCH_WANT_SYS_CLONE + +#include <uapi/asm/unistd.h> diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h deleted file mode 100644 index 903cd618eb7..00000000000 --- a/arch/sh/include/asm/unistd_32.h +++ /dev/null @@ -1,413 +0,0 @@ -#ifndef __ASM_SH_UNISTD_H -#define __ASM_SH_UNISTD_H - -/* - * Copyright (C) 1999  Niibe Yutaka - */ - -/* - * This file contains the system call numbers. - */ - -#define __NR_restart_syscall	  0 -#define __NR_exit		  1 -#define __NR_fork		  2 -#define __NR_read		  3 -#define __NR_write		  4 -#define __NR_open		  5 -#define __NR_close		  6 -#define __NR_waitpid		  7 -#define __NR_creat		  8 -#define __NR_link		  9 -#define __NR_unlink		 10 -#define __NR_execve		 11 -#define __NR_chdir		 12 -#define __NR_time		 13 -#define __NR_mknod		 14 -#define __NR_chmod		 15 -#define __NR_lchown		 16 -#define __NR_break		 17 -#define __NR_oldstat		 18 -#define __NR_lseek		 19 -#define __NR_getpid		 20 -#define __NR_mount		 21 -#define __NR_umount		 22 -#define __NR_setuid		 23 -#define __NR_getuid		 24 -#define __NR_stime		 25 -#define __NR_ptrace		 26 -#define __NR_alarm		 27 -#define __NR_oldfstat		 28 -#define __NR_pause		 29 -#define __NR_utime		 30 -#define __NR_stty		 31 -#define __NR_gtty		 32 -#define __NR_access		 33 -#define __NR_nice		 34 -#define __NR_ftime		 35 -#define __NR_sync		 36 -#define __NR_kill		 37 -#define __NR_rename		 38 -#define __NR_mkdir		 39 -#define __NR_rmdir		 40 -#define __NR_dup		 41 -#define __NR_pipe		 42 -#define __NR_times		 43 -#define __NR_prof		 44 -#define __NR_brk		 45 -#define __NR_setgid		 46 -#define __NR_getgid		 47 -#define __NR_signal		 48 -#define __NR_geteuid		 49 -#define __NR_getegid		 50 -#define __NR_acct		 51 -#define __NR_umount2		 52 -#define __NR_lock		 53 -#define __NR_ioctl		 54 -#define __NR_fcntl		 55 -#define __NR_mpx		 56 -#define __NR_setpgid		 57 -#define __NR_ulimit		 58 -#define __NR_oldolduname	 59 -#define __NR_umask		 60 -#define __NR_chroot		 61 -#define __NR_ustat		 62 -#define __NR_dup2		 63 -#define __NR_getppid		 64 -#define __NR_getpgrp		 65 -#define __NR_setsid		 66 -#define __NR_sigaction		 67 -#define __NR_sgetmask		 68 -#define __NR_ssetmask		 69 -#define __NR_setreuid		 70 -#define __NR_setregid		 71 -#define __NR_sigsuspend		 72 -#define __NR_sigpending		 73 -#define __NR_sethostname	 74 -#define __NR_setrlimit		 75 -#define __NR_getrlimit		 76	/* Back compatible 2Gig limited rlimit */ -#define __NR_getrusage		 77 -#define __NR_gettimeofday	 78 -#define __NR_settimeofday	 79 -#define __NR_getgroups		 80 -#define __NR_setgroups		 81 -#define __NR_select		 82 -#define __NR_symlink		 83 -#define __NR_oldlstat		 84 -#define __NR_readlink		 85 -#define __NR_uselib		 86 -#define __NR_swapon		 87 -#define __NR_reboot		 88 -#define __NR_readdir		 89 -#define __NR_mmap		 90 -#define __NR_munmap		 91 -#define __NR_truncate		 92 -#define __NR_ftruncate		 93 -#define __NR_fchmod		 94 -#define __NR_fchown		 95 -#define __NR_getpriority	 96 -#define __NR_setpriority	 97 -#define __NR_profil		 98 -#define __NR_statfs		 99 -#define __NR_fstatfs		100 -#define __NR_ioperm		101 -#define __NR_socketcall		102 -#define __NR_syslog		103 -#define __NR_setitimer		104 -#define __NR_getitimer		105 -#define __NR_stat		106 -#define __NR_lstat		107 -#define __NR_fstat		108 -#define __NR_olduname		109 -#define __NR_iopl		110 -#define __NR_vhangup		111 -#define __NR_idle		112 -#define __NR_vm86old		113 -#define __NR_wait4		114 -#define __NR_swapoff		115 -#define __NR_sysinfo		116 -#define __NR_ipc		117 -#define __NR_fsync		118 -#define __NR_sigreturn		119 -#define __NR_clone		120 -#define __NR_setdomainname	121 -#define __NR_uname		122 -#define __NR_cacheflush		123 -#define __NR_adjtimex		124 -#define __NR_mprotect		125 -#define __NR_sigprocmask	126 -#define __NR_create_module	127 -#define __NR_init_module	128 -#define __NR_delete_module	129 -#define __NR_get_kernel_syms	130 -#define __NR_quotactl		131 -#define __NR_getpgid		132 -#define __NR_fchdir		133 -#define __NR_bdflush		134 -#define __NR_sysfs		135 -#define __NR_personality	136 -#define __NR_afs_syscall	137 /* Syscall for Andrew File System */ -#define __NR_setfsuid		138 -#define __NR_setfsgid		139 -#define __NR__llseek		140 -#define __NR_getdents		141 -#define __NR__newselect		142 -#define __NR_flock		143 -#define __NR_msync		144 -#define __NR_readv		145 -#define __NR_writev		146 -#define __NR_getsid		147 -#define __NR_fdatasync		148 -#define __NR__sysctl		149 -#define __NR_mlock		150 -#define __NR_munlock		151 -#define __NR_mlockall		152 -#define __NR_munlockall		153 -#define __NR_sched_setparam		154 -#define __NR_sched_getparam		155 -#define __NR_sched_setscheduler		156 -#define __NR_sched_getscheduler		157 -#define __NR_sched_yield		158 -#define __NR_sched_get_priority_max	159 -#define __NR_sched_get_priority_min	160 -#define __NR_sched_rr_get_interval	161 -#define __NR_nanosleep		162 -#define __NR_mremap		163 -#define __NR_setresuid		164 -#define __NR_getresuid		165 -#define __NR_vm86		166 -#define __NR_query_module	167 -#define __NR_poll		168 -#define __NR_nfsservctl		169 -#define __NR_setresgid		170 -#define __NR_getresgid		171 -#define __NR_prctl              172 -#define __NR_rt_sigreturn	173 -#define __NR_rt_sigaction	174 -#define __NR_rt_sigprocmask	175 -#define __NR_rt_sigpending	176 -#define __NR_rt_sigtimedwait	177 -#define __NR_rt_sigqueueinfo	178 -#define __NR_rt_sigsuspend	179 -#define __NR_pread64		180 -#define __NR_pwrite64		181 -#define __NR_chown		182 -#define __NR_getcwd		183 -#define __NR_capget		184 -#define __NR_capset		185 -#define __NR_sigaltstack	186 -#define __NR_sendfile		187 -#define __NR_streams1		188	/* some people actually want it */ -#define __NR_streams2		189	/* some people actually want it */ -#define __NR_vfork		190 -#define __NR_ugetrlimit		191	/* SuS compliant getrlimit */ -#define __NR_mmap2		192 -#define __NR_truncate64		193 -#define __NR_ftruncate64	194 -#define __NR_stat64		195 -#define __NR_lstat64		196 -#define __NR_fstat64		197 -#define __NR_lchown32		198 -#define __NR_getuid32		199 -#define __NR_getgid32		200 -#define __NR_geteuid32		201 -#define __NR_getegid32		202 -#define __NR_setreuid32		203 -#define __NR_setregid32		204 -#define __NR_getgroups32	205 -#define __NR_setgroups32	206 -#define __NR_fchown32		207 -#define __NR_setresuid32	208 -#define __NR_getresuid32	209 -#define __NR_setresgid32	210 -#define __NR_getresgid32	211 -#define __NR_chown32		212 -#define __NR_setuid32		213 -#define __NR_setgid32		214 -#define __NR_setfsuid32		215 -#define __NR_setfsgid32		216 -#define __NR_pivot_root		217 -#define __NR_mincore		218 -#define __NR_madvise		219 -#define __NR_getdents64		220 -#define __NR_fcntl64		221 -/* 223 is unused */ -#define __NR_gettid		224 -#define __NR_readahead		225 -#define __NR_setxattr		226 -#define __NR_lsetxattr		227 -#define __NR_fsetxattr		228 -#define __NR_getxattr		229 -#define __NR_lgetxattr		230 -#define __NR_fgetxattr		231 -#define __NR_listxattr		232 -#define __NR_llistxattr		233 -#define __NR_flistxattr		234 -#define __NR_removexattr	235 -#define __NR_lremovexattr	236 -#define __NR_fremovexattr	237 -#define __NR_tkill		238 -#define __NR_sendfile64		239 -#define __NR_futex		240 -#define __NR_sched_setaffinity	241 -#define __NR_sched_getaffinity	242 -#define __NR_set_thread_area	243 -#define __NR_get_thread_area	244 -#define __NR_io_setup		245 -#define __NR_io_destroy		246 -#define __NR_io_getevents	247 -#define __NR_io_submit		248 -#define __NR_io_cancel		249 -#define __NR_fadvise64		250 - -#define __NR_exit_group		252 -#define __NR_lookup_dcookie	253 -#define __NR_epoll_create	254 -#define __NR_epoll_ctl		255 -#define __NR_epoll_wait		256 -#define __NR_remap_file_pages	257 -#define __NR_set_tid_address	258 -#define __NR_timer_create	259 -#define __NR_timer_settime	(__NR_timer_create+1) -#define __NR_timer_gettime	(__NR_timer_create+2) -#define __NR_timer_getoverrun	(__NR_timer_create+3) -#define __NR_timer_delete	(__NR_timer_create+4) -#define __NR_clock_settime	(__NR_timer_create+5) -#define __NR_clock_gettime	(__NR_timer_create+6) -#define __NR_clock_getres	(__NR_timer_create+7) -#define __NR_clock_nanosleep	(__NR_timer_create+8) -#define __NR_statfs64		268 -#define __NR_fstatfs64		269 -#define __NR_tgkill		270 -#define __NR_utimes		271 -#define __NR_fadvise64_64	272 -#define __NR_vserver		273 -#define __NR_mbind              274 -#define __NR_get_mempolicy      275 -#define __NR_set_mempolicy      276 -#define __NR_mq_open            277 -#define __NR_mq_unlink          (__NR_mq_open+1) -#define __NR_mq_timedsend       (__NR_mq_open+2) -#define __NR_mq_timedreceive    (__NR_mq_open+3) -#define __NR_mq_notify          (__NR_mq_open+4) -#define __NR_mq_getsetattr      (__NR_mq_open+5) -#define __NR_kexec_load		283 -#define __NR_waitid		284 -#define __NR_add_key		285 -#define __NR_request_key	286 -#define __NR_keyctl		287 -#define __NR_ioprio_set		288 -#define __NR_ioprio_get		289 -#define __NR_inotify_init	290 -#define __NR_inotify_add_watch	291 -#define __NR_inotify_rm_watch	292 -/* 293 is unused */ -#define __NR_migrate_pages	294 -#define __NR_openat		295 -#define __NR_mkdirat		296 -#define __NR_mknodat		297 -#define __NR_fchownat		298 -#define __NR_futimesat		299 -#define __NR_fstatat64		300 -#define __NR_unlinkat		301 -#define __NR_renameat		302 -#define __NR_linkat		303 -#define __NR_symlinkat		304 -#define __NR_readlinkat		305 -#define __NR_fchmodat		306 -#define __NR_faccessat		307 -#define __NR_pselect6		308 -#define __NR_ppoll		309 -#define __NR_unshare		310 -#define __NR_set_robust_list	311 -#define __NR_get_robust_list	312 -#define __NR_splice		313 -#define __NR_sync_file_range	314 -#define __NR_tee		315 -#define __NR_vmsplice		316 -#define __NR_move_pages		317 -#define __NR_getcpu		318 -#define __NR_epoll_pwait	319 -#define __NR_utimensat		320 -#define __NR_signalfd		321 -#define __NR_timerfd_create	322 -#define __NR_eventfd		323 -#define __NR_fallocate		324 -#define __NR_timerfd_settime	325 -#define __NR_timerfd_gettime	326 -#define __NR_signalfd4		327 -#define __NR_eventfd2		328 -#define __NR_epoll_create1	329 -#define __NR_dup3		330 -#define __NR_pipe2		331 -#define __NR_inotify_init1	332 -#define __NR_preadv		333 -#define __NR_pwritev		334 -#define __NR_rt_tgsigqueueinfo	335 -#define __NR_perf_event_open	336 -#define __NR_fanotify_init	337 -#define __NR_fanotify_mark	338 -#define __NR_prlimit64		339 - -/* Non-multiplexed socket family */ -#define __NR_socket		340 -#define __NR_bind		341 -#define __NR_connect		342 -#define __NR_listen		343 -#define __NR_accept		344 -#define __NR_getsockname	345 -#define __NR_getpeername	346 -#define __NR_socketpair		347 -#define __NR_send		348 -#define __NR_sendto		349 -#define __NR_recv		350 -#define __NR_recvfrom		351 -#define __NR_shutdown		352 -#define __NR_setsockopt		353 -#define __NR_getsockopt		354 -#define __NR_sendmsg		355 -#define __NR_recvmsg		356 -#define __NR_recvmmsg		357 - -#define NR_syscalls 358 - -#ifdef __KERNEL__ - -#define __ARCH_WANT_IPC_PARSE_VERSION -#define __ARCH_WANT_OLD_READDIR -#define __ARCH_WANT_OLD_STAT -#define __ARCH_WANT_STAT64 -#define __ARCH_WANT_SYS_ALARM -#define __ARCH_WANT_SYS_GETHOSTNAME -#define __ARCH_WANT_SYS_IPC -#define __ARCH_WANT_SYS_PAUSE -#define __ARCH_WANT_SYS_SGETMASK -#define __ARCH_WANT_SYS_SIGNAL -#define __ARCH_WANT_SYS_TIME -#define __ARCH_WANT_SYS_UTIME -#define __ARCH_WANT_SYS_WAITPID -#define __ARCH_WANT_SYS_SOCKETCALL -#define __ARCH_WANT_SYS_FADVISE64 -#define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK -#define __ARCH_WANT_SYS_NICE -#define __ARCH_WANT_SYS_OLD_GETRLIMIT -#define __ARCH_WANT_SYS_OLD_UNAME -#define __ARCH_WANT_SYS_OLDUMOUNT -#define __ARCH_WANT_SYS_SIGPENDING -#define __ARCH_WANT_SYS_SIGPROCMASK -#define __ARCH_WANT_SYS_RT_SIGACTION -#define __ARCH_WANT_SYS_RT_SIGSUSPEND - -/* - * "Conditional" syscalls - * - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), - * but it doesn't work on all toolchains, so we just do it by hand - */ -#ifndef cond_syscall -#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") -#endif - -#endif /* __KERNEL__ */ -#endif /* __ASM_SH_UNISTD_H */ diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h deleted file mode 100644 index 09aa93f9eb7..00000000000 --- a/arch/sh/include/asm/unistd_64.h +++ /dev/null @@ -1,434 +0,0 @@ -#ifndef __ASM_SH_UNISTD_64_H -#define __ASM_SH_UNISTD_64_H - -/* - * include/asm-sh/unistd_64.h - * - * This file contains the system call numbers. - * - * Copyright (C) 2000, 2001  Paolo Alberelli - * Copyright (C) 2003 - 2007 Paul Mundt - * Copyright (C) 2004  Sean McGoogan - * - * This file is subject to the terms and conditions of the GNU General Public - * License.  See the file "COPYING" in the main directory of this archive - * for more details. - */ -#define __NR_restart_syscall	  0 -#define __NR_exit		  1 -#define __NR_fork		  2 -#define __NR_read		  3 -#define __NR_write		  4 -#define __NR_open		  5 -#define __NR_close		  6 -#define __NR_waitpid		  7 -#define __NR_creat		  8 -#define __NR_link		  9 -#define __NR_unlink		 10 -#define __NR_execve		 11 -#define __NR_chdir		 12 -#define __NR_time		 13 -#define __NR_mknod		 14 -#define __NR_chmod		 15 -#define __NR_lchown		 16 -#define __NR_break		 17 -#define __NR_oldstat		 18 -#define __NR_lseek		 19 -#define __NR_getpid		 20 -#define __NR_mount		 21 -#define __NR_umount		 22 -#define __NR_setuid		 23 -#define __NR_getuid		 24 -#define __NR_stime		 25 -#define __NR_ptrace		 26 -#define __NR_alarm		 27 -#define __NR_oldfstat		 28 -#define __NR_pause		 29 -#define __NR_utime		 30 -#define __NR_stty		 31 -#define __NR_gtty		 32 -#define __NR_access		 33 -#define __NR_nice		 34 -#define __NR_ftime		 35 -#define __NR_sync		 36 -#define __NR_kill		 37 -#define __NR_rename		 38 -#define __NR_mkdir		 39 -#define __NR_rmdir		 40 -#define __NR_dup		 41 -#define __NR_pipe		 42 -#define __NR_times		 43 -#define __NR_prof		 44 -#define __NR_brk		 45 -#define __NR_setgid		 46 -#define __NR_getgid		 47 -#define __NR_signal		 48 -#define __NR_geteuid		 49 -#define __NR_getegid		 50 -#define __NR_acct		 51 -#define __NR_umount2		 52 -#define __NR_lock		 53 -#define __NR_ioctl		 54 -#define __NR_fcntl		 55 -#define __NR_mpx		 56 -#define __NR_setpgid		 57 -#define __NR_ulimit		 58 -#define __NR_oldolduname	 59 -#define __NR_umask		 60 -#define __NR_chroot		 61 -#define __NR_ustat		 62 -#define __NR_dup2		 63 -#define __NR_getppid		 64 -#define __NR_getpgrp		 65 -#define __NR_setsid		 66 -#define __NR_sigaction		 67 -#define __NR_sgetmask		 68 -#define __NR_ssetmask		 69 -#define __NR_setreuid		 70 -#define __NR_setregid		 71 -#define __NR_sigsuspend		 72 -#define __NR_sigpending		 73 -#define __NR_sethostname	 74 -#define __NR_setrlimit		 75 -#define __NR_getrlimit		 76	/* Back compatible 2Gig limited rlimit */ -#define __NR_getrusage		 77 -#define __NR_gettimeofday	 78 -#define __NR_settimeofday	 79 -#define __NR_getgroups		 80 -#define __NR_setgroups		 81 -#define __NR_select		 82 -#define __NR_symlink		 83 -#define __NR_oldlstat		 84 -#define __NR_readlink		 85 -#define __NR_uselib		 86 -#define __NR_swapon		 87 -#define __NR_reboot		 88 -#define __NR_readdir		 89 -#define __NR_mmap		 90 -#define __NR_munmap		 91 -#define __NR_truncate		 92 -#define __NR_ftruncate		 93 -#define __NR_fchmod		 94 -#define __NR_fchown		 95 -#define __NR_getpriority	 96 -#define __NR_setpriority	 97 -#define __NR_profil		 98 -#define __NR_statfs		 99 -#define __NR_fstatfs		100 -#define __NR_ioperm		101 -#define __NR_socketcall		102	/* old implementation of socket systemcall */ -#define __NR_syslog		103 -#define __NR_setitimer		104 -#define __NR_getitimer		105 -#define __NR_stat		106 -#define __NR_lstat		107 -#define __NR_fstat		108 -#define __NR_olduname		109 -#define __NR_iopl		110 -#define __NR_vhangup		111 -#define __NR_idle		112 -#define __NR_vm86old		113 -#define __NR_wait4		114 -#define __NR_swapoff		115 -#define __NR_sysinfo		116 -#define __NR_ipc		117 -#define __NR_fsync		118 -#define __NR_sigreturn		119 -#define __NR_clone		120 -#define __NR_setdomainname	121 -#define __NR_uname		122 -#define __NR_cacheflush		123 -#define __NR_adjtimex		124 -#define __NR_mprotect		125 -#define __NR_sigprocmask	126 -#define __NR_create_module	127 -#define __NR_init_module	128 -#define __NR_delete_module	129 -#define __NR_get_kernel_syms	130 -#define __NR_quotactl		131 -#define __NR_getpgid		132 -#define __NR_fchdir		133 -#define __NR_bdflush		134 -#define __NR_sysfs		135 -#define __NR_personality	136 -#define __NR_afs_syscall	137 /* Syscall for Andrew File System */ -#define __NR_setfsuid		138 -#define __NR_setfsgid		139 -#define __NR__llseek		140 -#define __NR_getdents		141 -#define __NR__newselect		142 -#define __NR_flock		143 -#define __NR_msync		144 -#define __NR_readv		145 -#define __NR_writev		146 -#define __NR_getsid		147 -#define __NR_fdatasync		148 -#define __NR__sysctl		149 -#define __NR_mlock		150 -#define __NR_munlock		151 -#define __NR_mlockall		152 -#define __NR_munlockall		153 -#define __NR_sched_setparam		154 -#define __NR_sched_getparam		155 -#define __NR_sched_setscheduler		156 -#define __NR_sched_getscheduler		157 -#define __NR_sched_yield		158 -#define __NR_sched_get_priority_max	159 -#define __NR_sched_get_priority_min	160 -#define __NR_sched_rr_get_interval	161 -#define __NR_nanosleep		162 -#define __NR_mremap		163 -#define __NR_setresuid		164 -#define __NR_getresuid		165 -#define __NR_vm86		166 -#define __NR_query_module	167 -#define __NR_poll		168 -#define __NR_nfsservctl		169 -#define __NR_setresgid		170 -#define __NR_getresgid		171 -#define __NR_prctl              172 -#define __NR_rt_sigreturn	173 -#define __NR_rt_sigaction	174 -#define __NR_rt_sigprocmask	175 -#define __NR_rt_sigpending	176 -#define __NR_rt_sigtimedwait	177 -#define __NR_rt_sigqueueinfo	178 -#define __NR_rt_sigsuspend	179 -#define __NR_pread64		180 -#define __NR_pwrite64		181 -#define __NR_chown		182 -#define __NR_getcwd		183 -#define __NR_capget		184 -#define __NR_capset		185 -#define __NR_sigaltstack	186 -#define __NR_sendfile		187 -#define __NR_streams1		188	/* some people actually want it */ -#define __NR_streams2		189	/* some people actually want it */ -#define __NR_vfork		190 -#define __NR_ugetrlimit		191	/* SuS compliant getrlimit */ -#define __NR_mmap2		192 -#define __NR_truncate64		193 -#define __NR_ftruncate64	194 -#define __NR_stat64		195 -#define __NR_lstat64		196 -#define __NR_fstat64		197 -#define __NR_lchown32		198 -#define __NR_getuid32		199 -#define __NR_getgid32		200 -#define __NR_geteuid32		201 -#define __NR_getegid32		202 -#define __NR_setreuid32		203 -#define __NR_setregid32		204 -#define __NR_getgroups32	205 -#define __NR_setgroups32	206 -#define __NR_fchown32		207 -#define __NR_setresuid32	208 -#define __NR_getresuid32	209 -#define __NR_setresgid32	210 -#define __NR_getresgid32	211 -#define __NR_chown32		212 -#define __NR_setuid32		213 -#define __NR_setgid32		214 -#define __NR_setfsuid32		215 -#define __NR_setfsgid32		216 -#define __NR_pivot_root		217 -#define __NR_mincore		218 -#define __NR_madvise		219 - -/* Non-multiplexed socket family */ -#define __NR_socket		220 -#define __NR_bind		221 -#define __NR_connect		222 -#define __NR_listen		223 -#define __NR_accept		224 -#define __NR_getsockname	225 -#define __NR_getpeername	226 -#define __NR_socketpair		227 -#define __NR_send		228 -#define __NR_sendto		229 -#define __NR_recv		230 -#define __NR_recvfrom		231 -#define __NR_shutdown		232 -#define __NR_setsockopt		233 -#define __NR_getsockopt		234 -#define __NR_sendmsg		235 -#define __NR_recvmsg		236 - -/* Non-multiplexed IPC family */ -#define __NR_semop		237 -#define __NR_semget		238 -#define __NR_semctl		239 -#define __NR_msgsnd		240 -#define __NR_msgrcv		241 -#define __NR_msgget		242 -#define __NR_msgctl		243 -#if 0 -#define __NR_shmatcall		244 -#endif -#define __NR_shmdt		245 -#define __NR_shmget		246 -#define __NR_shmctl		247 - -#define __NR_getdents64		248 -#define __NR_fcntl64		249 -/* 223 is unused */ -#define __NR_gettid		252 -#define __NR_readahead		253 -#define __NR_setxattr		254 -#define __NR_lsetxattr		255 -#define __NR_fsetxattr		256 -#define __NR_getxattr		257 -#define __NR_lgetxattr		258 -#define __NR_fgetxattr		269 -#define __NR_listxattr		260 -#define __NR_llistxattr		261 -#define __NR_flistxattr		262 -#define __NR_removexattr	263 -#define __NR_lremovexattr	264 -#define __NR_fremovexattr	265 -#define __NR_tkill		266 -#define __NR_sendfile64		267 -#define __NR_futex		268 -#define __NR_sched_setaffinity	269 -#define __NR_sched_getaffinity	270 -#define __NR_set_thread_area	271 -#define __NR_get_thread_area	272 -#define __NR_io_setup		273 -#define __NR_io_destroy		274 -#define __NR_io_getevents	275 -#define __NR_io_submit		276 -#define __NR_io_cancel		277 -#define __NR_fadvise64		278 -#define __NR_exit_group		280 - -#define __NR_lookup_dcookie	281 -#define __NR_epoll_create	282 -#define __NR_epoll_ctl		283 -#define __NR_epoll_wait		284 -#define __NR_remap_file_pages	285 -#define __NR_set_tid_address	286 -#define __NR_timer_create	287 -#define __NR_timer_settime	(__NR_timer_create+1) -#define __NR_timer_gettime	(__NR_timer_create+2) -#define __NR_timer_getoverrun	(__NR_timer_create+3) -#define __NR_timer_delete	(__NR_timer_create+4) -#define __NR_clock_settime	(__NR_timer_create+5) -#define __NR_clock_gettime	(__NR_timer_create+6) -#define __NR_clock_getres	(__NR_timer_create+7) -#define __NR_clock_nanosleep	(__NR_timer_create+8) -#define __NR_statfs64		296 -#define __NR_fstatfs64		297 -#define __NR_tgkill		298 -#define __NR_utimes		299 -#define __NR_fadvise64_64	300 -#define __NR_vserver		301 -#define __NR_mbind              302 -#define __NR_get_mempolicy      303 -#define __NR_set_mempolicy      304 -#define __NR_mq_open            305 -#define __NR_mq_unlink          (__NR_mq_open+1) -#define __NR_mq_timedsend       (__NR_mq_open+2) -#define __NR_mq_timedreceive    (__NR_mq_open+3) -#define __NR_mq_notify          (__NR_mq_open+4) -#define __NR_mq_getsetattr      (__NR_mq_open+5) -#define __NR_kexec_load		311 -#define __NR_waitid		312 -#define __NR_add_key		313 -#define __NR_request_key	314 -#define __NR_keyctl		315 -#define __NR_ioprio_set		316 -#define __NR_ioprio_get		317 -#define __NR_inotify_init	318 -#define __NR_inotify_add_watch	319 -#define __NR_inotify_rm_watch	320 -/* 321 is unused */ -#define __NR_migrate_pages	322 -#define __NR_openat		323 -#define __NR_mkdirat		324 -#define __NR_mknodat		325 -#define __NR_fchownat		326 -#define __NR_futimesat		327 -#define __NR_fstatat64		328 -#define __NR_unlinkat		329 -#define __NR_renameat		330 -#define __NR_linkat		331 -#define __NR_symlinkat		332 -#define __NR_readlinkat		333 -#define __NR_fchmodat		334 -#define __NR_faccessat		335 -#define __NR_pselect6		336 -#define __NR_ppoll		337 -#define __NR_unshare		338 -#define __NR_set_robust_list	339 -#define __NR_get_robust_list	340 -#define __NR_splice		341 -#define __NR_sync_file_range	342 -#define __NR_tee		343 -#define __NR_vmsplice		344 -#define __NR_move_pages		345 -#define __NR_getcpu		346 -#define __NR_epoll_pwait	347 -#define __NR_utimensat		348 -#define __NR_signalfd		349 -#define __NR_timerfd_create	350 -#define __NR_eventfd		351 -#define __NR_fallocate		352 -#define __NR_timerfd_settime	353 -#define __NR_timerfd_gettime	354 -#define __NR_signalfd4		355 -#define __NR_eventfd2		356 -#define __NR_epoll_create1	357 -#define __NR_dup3		358 -#define __NR_pipe2		359 -#define __NR_inotify_init1	360 -#define __NR_preadv		361 -#define __NR_pwritev		362 -#define __NR_rt_tgsigqueueinfo	363 -#define __NR_perf_event_open	364 -#define __NR_recvmmsg		365 -#define __NR_accept4		366 -#define __NR_fanotify_init	367 -#define __NR_fanotify_mark	368 -#define __NR_prlimit64		369 - -#ifdef __KERNEL__ - -#define NR_syscalls 370 - -#define __ARCH_WANT_IPC_PARSE_VERSION -#define __ARCH_WANT_OLD_READDIR -#define __ARCH_WANT_OLD_STAT -#define __ARCH_WANT_STAT64 -#define __ARCH_WANT_SYS_ALARM -#define __ARCH_WANT_SYS_GETHOSTNAME -#define __ARCH_WANT_SYS_IPC -#define __ARCH_WANT_SYS_PAUSE -#define __ARCH_WANT_SYS_SGETMASK -#define __ARCH_WANT_SYS_SIGNAL -#define __ARCH_WANT_SYS_TIME -#define __ARCH_WANT_SYS_UTIME -#define __ARCH_WANT_SYS_WAITPID -#define __ARCH_WANT_SYS_SOCKETCALL -#define __ARCH_WANT_SYS_FADVISE64 -#define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK -#define __ARCH_WANT_SYS_NICE -#define __ARCH_WANT_SYS_OLD_GETRLIMIT -#define __ARCH_WANT_SYS_OLD_UNAME -#define __ARCH_WANT_SYS_OLDUMOUNT -#define __ARCH_WANT_SYS_SIGPENDING -#define __ARCH_WANT_SYS_SIGPROCMASK -#define __ARCH_WANT_SYS_RT_SIGACTION - -/* - * "Conditional" syscalls - * - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), - * but it doesn't work on all toolchains, so we just do it by hand - */ -#ifndef cond_syscall -#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") -#endif - -#endif /* __KERNEL__ */ -#endif /* __ASM_SH_UNISTD_64_H */ diff --git a/arch/sh/include/asm/word-at-a-time.h b/arch/sh/include/asm/word-at-a-time.h new file mode 100644 index 00000000000..6e38953ff7f --- /dev/null +++ b/arch/sh/include/asm/word-at-a-time.h @@ -0,0 +1,53 @@ +#ifndef __ASM_SH_WORD_AT_A_TIME_H +#define __ASM_SH_WORD_AT_A_TIME_H + +#ifdef CONFIG_CPU_BIG_ENDIAN +# include <asm-generic/word-at-a-time.h> +#else +/* + * Little-endian version cribbed from x86. + */ +struct word_at_a_time { +	const unsigned long one_bits, high_bits; +}; + +#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) } + +/* Carl Chatfield / Jan Achrenius G+ version for 32-bit */ +static inline long count_masked_bytes(long mask) +{ +	/* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */ +	long a = (0x0ff0001+mask) >> 23; +	/* Fix the 1 for 00 case */ +	return a & mask; +} + +/* Return nonzero if it has a zero */ +static inline unsigned long has_zero(unsigned long a, unsigned long *bits, const struct word_at_a_time *c) +{ +	unsigned long mask = ((a - c->one_bits) & ~a) & c->high_bits; +	*bits = mask; +	return mask; +} + +static inline unsigned long prep_zero_mask(unsigned long a, unsigned long bits, const struct word_at_a_time *c) +{ +	return bits; +} + +static inline unsigned long create_zero_mask(unsigned long bits) +{ +	bits = (bits - 1) & ~bits; +	return bits >> 7; +} + +/* The mask we created is directly usable as a bytemask */ +#define zero_bytemask(mask) (mask) + +static inline unsigned long find_zero(unsigned long mask) +{ +	return count_masked_bytes(mask); +} +#endif + +#endif diff --git a/arch/sh/include/asm/xor.h b/arch/sh/include/asm/xor.h deleted file mode 100644 index c82eb12a5b1..00000000000 --- a/arch/sh/include/asm/xor.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/xor.h>  | 
