diff options
Diffstat (limited to 'arch/mn10300/include/asm')
65 files changed, 513 insertions, 1801 deletions
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild index c68e1680da0..654d5ba6e31 100644 --- a/arch/mn10300/include/asm/Kbuild +++ b/arch/mn10300/include/asm/Kbuild @@ -1 +1,9 @@ -include include/asm-generic/Kbuild.asm + +generic-y += barrier.h +generic-y += clkdev.h +generic-y += cputime.h +generic-y += exec.h +generic-y += hash.h +generic-y += mcs_spinlock.h +generic-y += preempt.h +generic-y += trace_clock.h diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h index 92d2f9298e3..cadeb1e2cdf 100644 --- a/arch/mn10300/include/asm/atomic.h +++ b/arch/mn10300/include/asm/atomic.h @@ -12,112 +12,8 @@  #define _ASM_ATOMIC_H  #include <asm/irqflags.h> - -#ifndef __ASSEMBLY__ - -#ifdef CONFIG_SMP -#ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT -static inline -unsigned long __xchg(volatile unsigned long *m, unsigned long val) -{ -	unsigned long status; -	unsigned long oldval; - -	asm volatile( -		"1:	mov	%4,(_AAR,%3)	\n" -		"	mov	(_ADR,%3),%1	\n" -		"	mov	%5,(_ADR,%3)	\n" -		"	mov	(_ADR,%3),%0	\n"	/* flush */ -		"	mov	(_ASR,%3),%0	\n" -		"	or	%0,%0		\n" -		"	bne	1b		\n" -		: "=&r"(status), "=&r"(oldval), "=m"(*m) -		: "a"(ATOMIC_OPS_BASE_ADDR), "r"(m), "r"(val) -		: "memory", "cc"); - -	return oldval; -} - -static inline unsigned long __cmpxchg(volatile unsigned long *m, -				      unsigned long old, unsigned long new) -{ -	unsigned long status; -	unsigned long oldval; - -	asm volatile( -		"1:	mov	%4,(_AAR,%3)	\n" -		"	mov	(_ADR,%3),%1	\n" -		"	cmp	%5,%1		\n" -		"	bne	2f		\n" -		"	mov	%6,(_ADR,%3)	\n" -		"2:	mov	(_ADR,%3),%0	\n"	/* flush */ -		"	mov	(_ASR,%3),%0	\n" -		"	or	%0,%0		\n" -		"	bne	1b		\n" -		: "=&r"(status), "=&r"(oldval), "=m"(*m) -		: "a"(ATOMIC_OPS_BASE_ADDR), "r"(m), -		  "r"(old), "r"(new) -		: "memory", "cc"); - -	return oldval; -} -#else  /* CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT */ -#error "No SMP atomic operation support!" -#endif /* CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT */ - -#else  /* CONFIG_SMP */ - -/* - * Emulate xchg for non-SMP MN10300 - */ -struct __xchg_dummy { unsigned long a[100]; }; -#define __xg(x) ((struct __xchg_dummy *)(x)) - -static inline -unsigned long __xchg(volatile unsigned long *m, unsigned long val) -{ -	unsigned long oldval; -	unsigned long flags; - -	flags = arch_local_cli_save(); -	oldval = *m; -	*m = val; -	arch_local_irq_restore(flags); -	return oldval; -} - -/* - * Emulate cmpxchg for non-SMP MN10300 - */ -static inline unsigned long __cmpxchg(volatile unsigned long *m, -				      unsigned long old, unsigned long new) -{ -	unsigned long oldval; -	unsigned long flags; - -	flags = arch_local_cli_save(); -	oldval = *m; -	if (oldval == old) -		*m = new; -	arch_local_irq_restore(flags); -	return oldval; -} - -#endif /* CONFIG_SMP */ - -#define xchg(ptr, v)						\ -	((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr),	\ -				     (unsigned long)(v))) - -#define cmpxchg(ptr, o, n)					\ -	((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \ -					(unsigned long)(o),	\ -					(unsigned long)(n))) - -#define atomic_xchg(ptr, v)		(xchg(&(ptr)->counter, (v))) -#define atomic_cmpxchg(v, old, new)	(cmpxchg(&((v)->counter), (old), (new))) - -#endif /* !__ASSEMBLY__ */ +#include <asm/cmpxchg.h> +#include <asm/barrier.h>  #ifndef CONFIG_SMP  #include <asm-generic/atomic.h> @@ -139,7 +35,7 @@ static inline unsigned long __cmpxchg(volatile unsigned long *m,   * Atomically reads the value of @v.  Note that the guaranteed   * useful range of an atomic_t is only 24 bits.   */ -#define atomic_read(v)	((v)->counter) +#define atomic_read(v)	(ACCESS_ONCE((v)->counter))  /**   * atomic_set - set atomic variable @@ -260,16 +156,17 @@ static inline void atomic_dec(atomic_t *v)  #define atomic_dec_and_test(v)		(atomic_sub_return(1, (v)) == 0)  #define atomic_inc_and_test(v)		(atomic_add_return(1, (v)) == 0) -#define atomic_add_unless(v, a, u)				\ +#define __atomic_add_unless(v, a, u)				\  ({								\  	int c, old;						\  	c = atomic_read(v);					\  	while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \  		c = old;					\ -	c != (u);						\ +	c;							\  }) -#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_xchg(ptr, v)		(xchg(&(ptr)->counter, (v))) +#define atomic_cmpxchg(v, old, new)	(cmpxchg(&((v)->counter), (old), (new)))  /**   * atomic_clear_mask - Atomically clear bits in memory @@ -338,14 +235,6 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *addr)  #endif  } -/* Atomic operations are already serializing on MN10300??? */ -#define smp_mb__before_atomic_dec()	barrier() -#define smp_mb__after_atomic_dec()	barrier() -#define smp_mb__before_atomic_inc()	barrier() -#define smp_mb__after_atomic_inc()	barrier() - -#include <asm-generic/atomic-long.h> -  #endif /* __KERNEL__ */  #endif /* CONFIG_SMP */  #endif /* _ASM_ATOMIC_H */ diff --git a/arch/mn10300/include/asm/auxvec.h b/arch/mn10300/include/asm/auxvec.h deleted file mode 100644 index 4fdb60b2ae3..00000000000 --- a/arch/mn10300/include/asm/auxvec.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _ASM_AUXVEC_H -#define _ASM_AUXVEC_H - -#endif diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h index 3b8a868188f..fe6f8e2c361 100644 --- a/arch/mn10300/include/asm/bitops.h +++ b/arch/mn10300/include/asm/bitops.h @@ -18,9 +18,7 @@  #define __ASM_BITOPS_H  #include <asm/cpu-regs.h> - -#define smp_mb__before_clear_bit()	barrier() -#define smp_mb__after_clear_bit()	barrier() +#include <asm/barrier.h>  /*   * set bit @@ -227,14 +225,8 @@ int ffs(int x)  #include <asm-generic/bitops/find.h>  #include <asm-generic/bitops/sched.h>  #include <asm-generic/bitops/hweight.h> - -#define ext2_set_bit_atomic(lock, nr, addr) \ -	test_and_set_bit((nr), (addr)) -#define ext2_clear_bit_atomic(lock, nr, addr) \ -	test_and_clear_bit((nr), (addr)) - -#include <asm-generic/bitops/ext2-non-atomic.h> -#include <asm-generic/bitops/minix-le.h> +#include <asm-generic/bitops/ext2-atomic-setbit.h> +#include <asm-generic/bitops/le.h>  #endif /* __KERNEL__ */  #endif /* __ASM_BITOPS_H */ diff --git a/arch/mn10300/include/asm/bitsperlong.h b/arch/mn10300/include/asm/bitsperlong.h deleted file mode 100644 index 6dc0bb0c13b..00000000000 --- a/arch/mn10300/include/asm/bitsperlong.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/bitsperlong.h> diff --git a/arch/mn10300/include/asm/byteorder.h b/arch/mn10300/include/asm/byteorder.h deleted file mode 100644 index 5dd0bdd9fee..00000000000 --- a/arch/mn10300/include/asm/byteorder.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_BYTEORDER_H -#define _ASM_BYTEORDER_H - -#include <linux/byteorder/little_endian.h> - -#endif /* _ASM_BYTEORDER_H */ diff --git a/arch/mn10300/include/asm/cmpxchg.h b/arch/mn10300/include/asm/cmpxchg.h new file mode 100644 index 00000000000..97a4aaf387a --- /dev/null +++ b/arch/mn10300/include/asm/cmpxchg.h @@ -0,0 +1,115 @@ +/* MN10300 Atomic xchg/cmpxchg operations + * + * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence + * as published by the Free Software Foundation; either version + * 2 of the Licence, or (at your option) any later version. + */ +#ifndef _ASM_CMPXCHG_H +#define _ASM_CMPXCHG_H + +#include <asm/irqflags.h> + +#ifdef CONFIG_SMP +#ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT +static inline +unsigned long __xchg(volatile unsigned long *m, unsigned long val) +{ +	unsigned long status; +	unsigned long oldval; + +	asm volatile( +		"1:	mov	%4,(_AAR,%3)	\n" +		"	mov	(_ADR,%3),%1	\n" +		"	mov	%5,(_ADR,%3)	\n" +		"	mov	(_ADR,%3),%0	\n"	/* flush */ +		"	mov	(_ASR,%3),%0	\n" +		"	or	%0,%0		\n" +		"	bne	1b		\n" +		: "=&r"(status), "=&r"(oldval), "=m"(*m) +		: "a"(ATOMIC_OPS_BASE_ADDR), "r"(m), "r"(val) +		: "memory", "cc"); + +	return oldval; +} + +static inline unsigned long __cmpxchg(volatile unsigned long *m, +				      unsigned long old, unsigned long new) +{ +	unsigned long status; +	unsigned long oldval; + +	asm volatile( +		"1:	mov	%4,(_AAR,%3)	\n" +		"	mov	(_ADR,%3),%1	\n" +		"	cmp	%5,%1		\n" +		"	bne	2f		\n" +		"	mov	%6,(_ADR,%3)	\n" +		"2:	mov	(_ADR,%3),%0	\n"	/* flush */ +		"	mov	(_ASR,%3),%0	\n" +		"	or	%0,%0		\n" +		"	bne	1b		\n" +		: "=&r"(status), "=&r"(oldval), "=m"(*m) +		: "a"(ATOMIC_OPS_BASE_ADDR), "r"(m), +		  "r"(old), "r"(new) +		: "memory", "cc"); + +	return oldval; +} +#else  /* CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT */ +#error "No SMP atomic operation support!" +#endif /* CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT */ + +#else  /* CONFIG_SMP */ + +/* + * Emulate xchg for non-SMP MN10300 + */ +struct __xchg_dummy { unsigned long a[100]; }; +#define __xg(x) ((struct __xchg_dummy *)(x)) + +static inline +unsigned long __xchg(volatile unsigned long *m, unsigned long val) +{ +	unsigned long oldval; +	unsigned long flags; + +	flags = arch_local_cli_save(); +	oldval = *m; +	*m = val; +	arch_local_irq_restore(flags); +	return oldval; +} + +/* + * Emulate cmpxchg for non-SMP MN10300 + */ +static inline unsigned long __cmpxchg(volatile unsigned long *m, +				      unsigned long old, unsigned long new) +{ +	unsigned long oldval; +	unsigned long flags; + +	flags = arch_local_cli_save(); +	oldval = *m; +	if (oldval == old) +		*m = new; +	arch_local_irq_restore(flags); +	return oldval; +} + +#endif /* CONFIG_SMP */ + +#define xchg(ptr, v)						\ +	((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr),	\ +				     (unsigned long)(v))) + +#define cmpxchg(ptr, o, n)					\ +	((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \ +					(unsigned long)(o),	\ +					(unsigned long)(n))) + +#endif /* _ASM_CMPXCHG_H */ diff --git a/arch/mn10300/include/asm/cpu-regs.h b/arch/mn10300/include/asm/cpu-regs.h index 90ed4a365c9..c54effae220 100644 --- a/arch/mn10300/include/asm/cpu-regs.h +++ b/arch/mn10300/include/asm/cpu-regs.h @@ -49,7 +49,7 @@ asm(" .am33_2\n");  #define EPSW_IM_6		0x00000600	/* interrupt mode 6 */  #define EPSW_IM_7		0x00000700	/* interrupt mode 7 */  #define EPSW_IE			0x00000800	/* interrupt enable */ -#define EPSW_S			0x00003000	/* software auxilliary bits */ +#define EPSW_S			0x00003000	/* software auxiliary bits */  #define EPSW_T			0x00008000	/* trace enable */  #define EPSW_nSL		0x00010000	/* not supervisor level */  #define EPSW_NMID		0x00020000	/* nonmaskable interrupt disable */ diff --git a/arch/mn10300/include/asm/cputime.h b/arch/mn10300/include/asm/cputime.h deleted file mode 100644 index 6d68ad7e0ea..00000000000 --- a/arch/mn10300/include/asm/cputime.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/cputime.h> diff --git a/arch/mn10300/include/asm/debugger.h b/arch/mn10300/include/asm/debugger.h new file mode 100644 index 00000000000..e1d3b083696 --- /dev/null +++ b/arch/mn10300/include/asm/debugger.h @@ -0,0 +1,43 @@ +/* Kernel debugger for MN10300 + * + * Copyright (C) 2011 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence + * as published by the Free Software Foundation; either version + * 2 of the Licence, or (at your option) any later version. + */ + +#ifndef _ASM_DEBUGGER_H +#define _ASM_DEBUGGER_H + +#if defined(CONFIG_KERNEL_DEBUGGER) + +extern int debugger_intercept(enum exception_code, int, int, struct pt_regs *); +extern int at_debugger_breakpoint(struct pt_regs *); + +#ifndef CONFIG_MN10300_DEBUGGER_CACHE_NO_FLUSH +extern void debugger_local_cache_flushinv(void); +extern void debugger_local_cache_flushinv_one(u8 *); +#else +static inline void debugger_local_cache_flushinv(void) {} +static inline void debugger_local_cache_flushinv_one(u8 *addr) {} +#endif + +#else /* CONFIG_KERNEL_DEBUGGER */ + +static inline int debugger_intercept(enum exception_code excep, +				     int signo, int si_code, +				     struct pt_regs *regs) +{ +	return 0; +} + +static inline int at_debugger_breakpoint(struct pt_regs *regs) +{ +	return 0; +} + +#endif /* CONFIG_KERNEL_DEBUGGER */ +#endif /* _ASM_DEBUGGER_H */ diff --git a/arch/mn10300/include/asm/div64.h b/arch/mn10300/include/asm/div64.h index 34dcb8e6830..503efab2a51 100644 --- a/arch/mn10300/include/asm/div64.h +++ b/arch/mn10300/include/asm/div64.h @@ -16,6 +16,19 @@  extern void ____unhandled_size_in_do_div___(void);  /* + * Beginning with gcc 4.6, the MDR register is represented explicitly.  We + * must, therefore, at least explicitly clobber the register when we make + * changes to it.  The following assembly fragments *could* be rearranged in + * order to leave the moves to/from the MDR register to the compiler, but the + * gains would be minimal at best. + */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +# define CLOBBER_MDR_CC		"mdr", "cc" +#else +# define CLOBBER_MDR_CC		"cc" +#endif + +/*   * divide n by base, leaving the result in n and returning the remainder   * - we can do this quite efficiently on the MN10300 by cascading the divides   *   through the MDR register @@ -29,7 +42,7 @@ extern void ____unhandled_size_in_do_div___(void);  		    "mov	mdr,%1	\n"				\  		    : "+r"(n), "=d"(__rem)				\  		    : "r"(base), "1"(__rem)				\ -		    : "cc"						\ +		    : CLOBBER_MDR_CC					\  		    );							\  	} else if (sizeof(n) <= 8) {					\  		union {							\ @@ -48,7 +61,7 @@ extern void ____unhandled_size_in_do_div___(void);  		    : "=d"(__rem), "=r"(__quot.w[1]), "=r"(__quot.w[0])	\  		    : "r"(base), "0"(__rem), "1"(__quot.w[1]),		\  		      "2"(__quot.w[0])					\ -		    : "cc"						\ +		    : CLOBBER_MDR_CC					\  		    );							\  		n = __quot.l;						\  	} else {							\ @@ -72,7 +85,7 @@ unsigned __muldiv64u(unsigned val, unsigned mult, unsigned div)  					 * MDR = MDR:val%div */  	    : "=r"(result)  	    : "0"(val), "ir"(mult), "r"(div) -	    : "cc" +	    : CLOBBER_MDR_CC  	    );  	return result; @@ -93,7 +106,7 @@ signed __muldiv64s(signed val, signed mult, signed div)  					 * MDR = MDR:val%div */  	    : "=r"(result)  	    : "0"(val), "ir"(mult), "r"(div) -	    : "cc" +	    : CLOBBER_MDR_CC  	    );  	return result; diff --git a/arch/mn10300/include/asm/dma-mapping.h b/arch/mn10300/include/asm/dma-mapping.h index c1be4397b1e..a18abfc558e 100644 --- a/arch/mn10300/include/asm/dma-mapping.h +++ b/arch/mn10300/include/asm/dma-mapping.h @@ -168,4 +168,19 @@ void dma_cache_sync(void *vaddr, size_t size,  	mn10300_dcache_flush_inv();  } +/* Not supported for now */ +static inline int dma_mmap_coherent(struct device *dev, +				    struct vm_area_struct *vma, void *cpu_addr, +				    dma_addr_t dma_addr, size_t size) +{ +	return -EINVAL; +} + +static inline int dma_get_sgtable(struct device *dev, struct sg_table *sgt, +				  void *cpu_addr, dma_addr_t dma_addr, +				  size_t size) +{ +	return -EINVAL; +} +  #endif diff --git a/arch/mn10300/include/asm/dma.h b/arch/mn10300/include/asm/dma.h index 098df2e617a..10b77d4628c 100644 --- a/arch/mn10300/include/asm/dma.h +++ b/arch/mn10300/include/asm/dma.h @@ -11,7 +11,6 @@  #ifndef _ASM_DMA_H  #define _ASM_DMA_H -#include <asm/system.h>  #include <linux/spinlock.h>  #include <asm/io.h>  #include <linux/delay.h> diff --git a/arch/mn10300/include/asm/elf.h b/arch/mn10300/include/asm/elf.h index 8157c9267f4..f592d7a9f03 100644 --- a/arch/mn10300/include/asm/elf.h +++ b/arch/mn10300/include/asm/elf.h @@ -150,8 +150,4 @@ do {						\   */  #define ELF_PLATFORM  (NULL) -#ifdef __KERNEL__ -#define SET_PERSONALITY(ex) set_personality(PER_LINUX) -#endif -  #endif /* _ASM_ELF_H */ diff --git a/arch/mn10300/include/asm/errno.h b/arch/mn10300/include/asm/errno.h deleted file mode 100644 index 4c82b503d92..00000000000 --- a/arch/mn10300/include/asm/errno.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/errno.h> diff --git a/arch/mn10300/include/asm/exceptions.h b/arch/mn10300/include/asm/exceptions.h index ca3e20508c7..95a4d42c3a0 100644 --- a/arch/mn10300/include/asm/exceptions.h +++ b/arch/mn10300/include/asm/exceptions.h @@ -110,7 +110,7 @@ extern asmlinkage void nmi_handler(void);  extern asmlinkage void misalignment(struct pt_regs *, enum exception_code);  extern void die(const char *, struct pt_regs *, enum exception_code) -	ATTRIB_NORET; +	__noreturn;  extern int die_if_no_fixup(const char *, struct pt_regs *, enum exception_code); diff --git a/arch/mn10300/include/asm/fcntl.h b/arch/mn10300/include/asm/fcntl.h deleted file mode 100644 index 46ab12db573..00000000000 --- a/arch/mn10300/include/asm/fcntl.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/fcntl.h> diff --git a/arch/mn10300/include/asm/fpu.h b/arch/mn10300/include/asm/fpu.h index b7625de8ead..738ff72659d 100644 --- a/arch/mn10300/include/asm/fpu.h +++ b/arch/mn10300/include/asm/fpu.h @@ -55,7 +55,6 @@ static inline void clear_using_fpu(struct task_struct *tsk)  extern asmlinkage void fpu_kill_state(struct task_struct *);  extern asmlinkage void fpu_exception(struct pt_regs *, enum exception_code); -extern asmlinkage void fpu_invalid_op(struct pt_regs *, enum exception_code);  extern asmlinkage void fpu_init_state(void);  extern asmlinkage void fpu_save(struct fpu_state_struct *);  extern int fpu_setup_sigcontext(struct fpucontext *buf); @@ -113,7 +112,6 @@ static inline void flush_fpu(void)  extern asmlinkage  void unexpected_fpu_exception(struct pt_regs *, enum exception_code); -#define fpu_invalid_op unexpected_fpu_exception  #define fpu_exception unexpected_fpu_exception  struct task_struct; diff --git a/arch/mn10300/include/asm/frame.inc b/arch/mn10300/include/asm/frame.inc index 2ee58e3eb6b..1c3eb4fda95 100644 --- a/arch/mn10300/include/asm/frame.inc +++ b/arch/mn10300/include/asm/frame.inc @@ -61,7 +61,7 @@  ###############################################################################  .macro RESTORE_ALL  	# peel back the stack to the calling frame -	# - this permits execve() to discard extra frames due to kernel syscalls +	# - we need that when returning from interrupts to kernel mode  	GET_THREAD_INFO a0  	mov	(TI_frame,a0),fp  	mov	fp,sp diff --git a/arch/mn10300/include/asm/highmem.h b/arch/mn10300/include/asm/highmem.h index bfe2d88604d..2fbbe4d920a 100644 --- a/arch/mn10300/include/asm/highmem.h +++ b/arch/mn10300/include/asm/highmem.h @@ -70,7 +70,7 @@ static inline void kunmap(struct page *page)   * be used in IRQ contexts, so in some (very limited) cases we need   * it.   */ -static inline unsigned long __kmap_atomic(struct page *page) +static inline void *kmap_atomic(struct page *page)  {  	unsigned long vaddr;  	int idx, type; @@ -89,7 +89,7 @@ static inline unsigned long __kmap_atomic(struct page *page)  	set_pte(kmap_pte - idx, mk_pte(page, kmap_prot));  	local_flush_tlb_one(vaddr); -	return vaddr; +	return (void *)vaddr;  }  static inline void __kunmap_atomic(unsigned long vaddr) diff --git a/arch/mn10300/include/asm/intctl-regs.h b/arch/mn10300/include/asm/intctl-regs.h index 585b708c2bc..d65bbeebe50 100644 --- a/arch/mn10300/include/asm/intctl-regs.h +++ b/arch/mn10300/include/asm/intctl-regs.h @@ -60,11 +60,6 @@  #ifndef __ASSEMBLY__  extern void set_intr_level(int irq, u16 level); -extern void mn10300_intc_set_level(unsigned int irq, unsigned int level); -extern void mn10300_intc_clear(unsigned int irq); -extern void mn10300_intc_set(unsigned int irq); -extern void mn10300_intc_enable(unsigned int irq); -extern void mn10300_intc_disable(unsigned int irq);  extern void mn10300_set_lateack_irq_type(int irq);  #endif diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h index 787255da744..e6ed0d897cc 100644 --- a/arch/mn10300/include/asm/io.h +++ b/arch/mn10300/include/asm/io.h @@ -14,6 +14,7 @@  #include <asm/page.h> /* I/O is all done through memory accesses */  #include <asm/cpu-regs.h>  #include <asm/cacheflush.h> +#include <asm-generic/pci_iomap.h>  #define mmiowb() do {} while (0) @@ -229,7 +230,6 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)  /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */  struct pci_dev; -extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);  static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)  {  } @@ -251,15 +251,15 @@ static inline void *phys_to_virt(unsigned long address)  /*   * Change "struct page" to physical address.   */ -static inline void *__ioremap(unsigned long offset, unsigned long size, -			      unsigned long flags) +static inline void __iomem *__ioremap(unsigned long offset, unsigned long size, +				      unsigned long flags)  { -	return (void *) offset; +	return (void __iomem *) offset;  } -static inline void *ioremap(unsigned long offset, unsigned long size) +static inline void __iomem *ioremap(unsigned long offset, unsigned long size)  { -	return (void *) offset; +	return (void __iomem *)(offset & ~0x20000000);  }  /* @@ -267,14 +267,14 @@ static inline void *ioremap(unsigned long offset, unsigned long size)   * area.  it's useful if some control registers are in such an area and write   * combining or read caching is not desirable:   */ -static inline void *ioremap_nocache(unsigned long offset, unsigned long size) +static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long size)  { -	return (void *) (offset | 0x20000000); +	return (void __iomem *) (offset | 0x20000000);  }  #define ioremap_wc ioremap_nocache -static inline void iounmap(void *addr) +static inline void iounmap(void __iomem *addr)  {  } diff --git a/arch/mn10300/include/asm/ioctl.h b/arch/mn10300/include/asm/ioctl.h deleted file mode 100644 index b279fe06dfe..00000000000 --- a/arch/mn10300/include/asm/ioctl.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/ioctl.h> diff --git a/arch/mn10300/include/asm/ioctls.h b/arch/mn10300/include/asm/ioctls.h deleted file mode 100644 index 0212f4b2255..00000000000 --- a/arch/mn10300/include/asm/ioctls.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_IOCTLS_H -#define _ASM_IOCTLS_H - -#include <asm-generic/ioctls.h> - -#endif /* _ASM_IOCTLS_H */ diff --git a/arch/mn10300/include/asm/ipc.h b/arch/mn10300/include/asm/ipc.h deleted file mode 100644 index a46e3d9c2a3..00000000000 --- a/arch/mn10300/include/asm/ipc.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/ipc.h> diff --git a/arch/mn10300/include/asm/ipcbuf.h b/arch/mn10300/include/asm/ipcbuf.h deleted file mode 100644 index f6f63d44827..00000000000 --- a/arch/mn10300/include/asm/ipcbuf.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _ASM_IPCBUF_H -#define _ASM_IPCBUF_H - -/* - * The ipc64_perm structure for MN10300 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 32-bit mode_t and seq - * - 2 miscellaneous 32-bit values - */ - -struct ipc64_perm -{ -	__kernel_key_t		key; -	__kernel_uid32_t	uid; -	__kernel_gid32_t	gid; -	__kernel_uid32_t	cuid; -	__kernel_gid32_t	cgid; -	__kernel_mode_t		mode; -	unsigned short		__pad1; -	unsigned short		seq; -	unsigned short		__pad2; -	unsigned long		__unused1; -	unsigned long		__unused2; -}; - -#endif /* _ASM_IPCBUF_H */ diff --git a/arch/mn10300/include/asm/irqflags.h b/arch/mn10300/include/asm/irqflags.h index 7a7ae12c711..8730c0a3c37 100644 --- a/arch/mn10300/include/asm/irqflags.h +++ b/arch/mn10300/include/asm/irqflags.h @@ -13,14 +13,13 @@  #define _ASM_IRQFLAGS_H  #include <asm/cpu-regs.h> -#ifndef __ASSEMBLY__ -#include <linux/smp.h> -#endif +/* linux/smp.h <- linux/irqflags.h needs asm/smp.h first */ +#include <asm/smp.h>  /*   * interrupt control   * - "disabled": run in IM1/2 - *   - level 0 - GDB stub + *   - level 0 - kernel debugger   *   - level 1 - virtual serial DMA (if present)   *   - level 5 - normal interrupt priority   *   - level 6 - timer interrupt diff --git a/arch/mn10300/include/asm/kgdb.h b/arch/mn10300/include/asm/kgdb.h new file mode 100644 index 00000000000..eb245f18a70 --- /dev/null +++ b/arch/mn10300/include/asm/kgdb.h @@ -0,0 +1,81 @@ +/* Kernel debugger for MN10300 + * + * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence + * as published by the Free Software Foundation; either version + * 2 of the Licence, or (at your option) any later version. + */ + +#ifndef _ASM_KGDB_H +#define _ASM_KGDB_H + +/* + * BUFMAX defines the maximum number of characters in inbound/outbound + * buffers at least NUMREGBYTES*2 are needed for register packets + * Longer buffer is needed to list all threads + */ +#define BUFMAX			1024 + +/* + * Note that this register image is in a different order than the register + * image that Linux produces at interrupt time. + */ +enum regnames { +	GDB_FR_D0		= 0, +	GDB_FR_D1		= 1, +	GDB_FR_D2		= 2, +	GDB_FR_D3		= 3, +	GDB_FR_A0		= 4, +	GDB_FR_A1		= 5, +	GDB_FR_A2		= 6, +	GDB_FR_A3		= 7, + +	GDB_FR_SP		= 8, +	GDB_FR_PC		= 9, +	GDB_FR_MDR		= 10, +	GDB_FR_EPSW		= 11, +	GDB_FR_LIR		= 12, +	GDB_FR_LAR		= 13, +	GDB_FR_MDRQ		= 14, + +	GDB_FR_E0		= 15, +	GDB_FR_E1		= 16, +	GDB_FR_E2		= 17, +	GDB_FR_E3		= 18, +	GDB_FR_E4		= 19, +	GDB_FR_E5		= 20, +	GDB_FR_E6		= 21, +	GDB_FR_E7		= 22, + +	GDB_FR_SSP		= 23, +	GDB_FR_MSP		= 24, +	GDB_FR_USP		= 25, +	GDB_FR_MCRH		= 26, +	GDB_FR_MCRL		= 27, +	GDB_FR_MCVF		= 28, + +	GDB_FR_FPCR		= 29, +	GDB_FR_DUMMY0		= 30, +	GDB_FR_DUMMY1		= 31, + +	GDB_FR_FS0		= 32, + +	GDB_FR_SIZE		= 64, +}; + +#define GDB_ORIG_D0		41 +#define NUMREGBYTES		(GDB_FR_SIZE*4) + +static inline void arch_kgdb_breakpoint(void) +{ +	asm(".globl __arch_kgdb_breakpoint; __arch_kgdb_breakpoint: break"); +} +extern u8 __arch_kgdb_breakpoint; + +#define BREAK_INSTR_SIZE	1 +#define CACHE_FLUSH_IS_SAFE	1 + +#endif /* _ASM_KGDB_H */ diff --git a/arch/mn10300/include/asm/mman.h b/arch/mn10300/include/asm/mman.h deleted file mode 100644 index db5c53da73c..00000000000 --- a/arch/mn10300/include/asm/mman.h +++ /dev/null @@ -1,6 +0,0 @@ -#include <asm-generic/mman.h> - -#define MIN_MAP_ADDR	PAGE_SIZE	/* minimum fixed mmap address */ - -#define arch_mmap_check(addr, len, flags) \ -	(((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0) diff --git a/arch/mn10300/include/asm/mmu_context.h b/arch/mn10300/include/asm/mmu_context.h index c8f6c82672a..75dbe696f83 100644 --- a/arch/mn10300/include/asm/mmu_context.h +++ b/arch/mn10300/include/asm/mmu_context.h @@ -22,7 +22,7 @@  #ifndef _ASM_MMU_CONTEXT_H  #define _ASM_MMU_CONTEXT_H -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/pgalloc.h>  #include <asm/tlbflush.h>  #include <asm-generic/mm_hooks.h> @@ -71,7 +71,7 @@ static inline unsigned long allocate_mmu_context(struct mm_struct *mm)  		local_flush_tlb_all();  		/* fix the TLB version if needed (we avoid version #0 so as to -		 * distingush MMU_NO_CONTEXT) */ +		 * distinguish MMU_NO_CONTEXT) */  		if (!mc)  			*pmc = mc = MMU_CONTEXT_FIRST_VERSION;  	} diff --git a/arch/mn10300/include/asm/module.h b/arch/mn10300/include/asm/module.h index 5d7057d0149..6571103b051 100644 --- a/arch/mn10300/include/asm/module.h +++ b/arch/mn10300/include/asm/module.h @@ -12,12 +12,7 @@  #ifndef _ASM_MODULE_H  #define _ASM_MODULE_H -struct mod_arch_specific { -}; - -#define Elf_Shdr	Elf32_Shdr -#define Elf_Sym		Elf32_Sym -#define Elf_Ehdr	Elf32_Ehdr +#include <asm-generic/module.h>  /*   * Include the MN10300 architecture version. diff --git a/arch/mn10300/include/asm/msgbuf.h b/arch/mn10300/include/asm/msgbuf.h deleted file mode 100644 index 8b602450cc4..00000000000 --- a/arch/mn10300/include/asm/msgbuf.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _ASM_MSGBUF_H -#define _ASM_MSGBUF_H - -/* - * The msqid64_ds structure for MN10300 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -struct msqid64_ds { -	struct ipc64_perm	msg_perm; -	__kernel_time_t		msg_stime;	/* last msgsnd time */ -	unsigned long		__unused1; -	__kernel_time_t		msg_rtime;	/* last msgrcv time */ -	unsigned long		__unused2; -	__kernel_time_t		msg_ctime;	/* last change time */ -	unsigned long		__unused3; -	unsigned long		msg_cbytes;	/* current number of bytes on queue */ -	unsigned long		msg_qnum;	/* number of messages in queue */ -	unsigned long		msg_qbytes;	/* max number of bytes on queue */ -	__kernel_pid_t		msg_lspid;	/* pid of last msgsnd */ -	__kernel_pid_t		msg_lrpid;	/* last receive pid */ -	unsigned long		__unused4; -	unsigned long		__unused5; -}; - -#endif /* _ASM_MSGBUF_H */ diff --git a/arch/mn10300/include/asm/param.h b/arch/mn10300/include/asm/param.h deleted file mode 100644 index 789b1df41fc..00000000000 --- a/arch/mn10300/include/asm/param.h +++ /dev/null @@ -1,34 +0,0 @@ -/* MN10300 Kernel parameters - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PARAM_H -#define _ASM_PARAM_H - -#ifdef __KERNEL__ -#define HZ		CONFIG_HZ	/* Internal kernel timer frequency */ -#define USER_HZ		100		/* .. some user interfaces are in -					 * "ticks" */ -#define CLOCKS_PER_SEC	(USER_HZ)	/* like times() */ -#endif - -#ifndef HZ -#define HZ		100 -#endif - -#define EXEC_PAGESIZE	4096 - -#ifndef NOGROUP -#define NOGROUP		(-1) -#endif - -#define MAXHOSTNAMELEN	64	/* max length of hostname */ -#define COMMAND_LINE_SIZE 256 - -#endif /* _ASM_PARAM_H */ diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h index 6095a28561d..5f70af25c7d 100644 --- a/arch/mn10300/include/asm/pci.h +++ b/arch/mn10300/include/asm/pci.h @@ -44,12 +44,10 @@ extern void unit_pci_init(void);  #define pcibios_assign_all_busses()	0  #endif -extern unsigned long pci_mem_start;  #define PCIBIOS_MIN_IO		0xBE000004  #define PCIBIOS_MIN_MEM		0xB8000000  void pcibios_set_master(struct pci_dev *dev); -void pcibios_penalize_isa_irq(int irq);  /* Dynamic DMA mapping stuff.   * i386 has everything mapped statically. @@ -85,22 +83,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,  /* implement the pci_ DMA API in terms of the generic device dma_ one */  #include <asm-generic/pci-dma-compat.h> -/** - * pcibios_resource_to_bus - convert resource to PCI bus address - * @dev: device which owns this resource - * @region: converted bus-centric region (start,end) - * @res: resource to convert - * - * Convert a resource to a PCI device bus address or bus window. - */ -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); -  static inline struct resource *  pcibios_select_root(struct pci_dev *pdev, struct resource *res)  { @@ -119,4 +101,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)  	return channel ? 15 : 14;  } +#include <asm-generic/pci_iomap.h> +  #endif /* _ASM_PCI_H */ diff --git a/arch/mn10300/include/asm/pgalloc.h b/arch/mn10300/include/asm/pgalloc.h index 146bacf193e..0f25d5fa86f 100644 --- a/arch/mn10300/include/asm/pgalloc.h +++ b/arch/mn10300/include/asm/pgalloc.h @@ -46,6 +46,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)  static inline void pte_free(struct mm_struct *mm, struct page *pte)  { +	pgtable_page_dtor(pte);  	__free_page(pte);  } diff --git a/arch/mn10300/include/asm/pgtable.h b/arch/mn10300/include/asm/pgtable.h index a1e894b5f65..2ddaa67e798 100644 --- a/arch/mn10300/include/asm/pgtable.h +++ b/arch/mn10300/include/asm/pgtable.h @@ -486,9 +486,6 @@ extern void update_mmu_cache(struct vm_area_struct *vma,  #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 MK_IOSPACE_PFN(space, pfn)	(pfn)  #define GET_IOSPACE(pfn)		0  #define GET_PFN(pfn)			(pfn) diff --git a/arch/mn10300/include/asm/poll.h b/arch/mn10300/include/asm/poll.h deleted file mode 100644 index c98509d3149..00000000000 --- a/arch/mn10300/include/asm/poll.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/poll.h> diff --git a/arch/mn10300/include/asm/posix_types.h b/arch/mn10300/include/asm/posix_types.h deleted file mode 100644 index 56ffbc15879..00000000000 --- a/arch/mn10300/include/asm/posix_types.h +++ /dev/null @@ -1,137 +0,0 @@ -/* MN10300 POSIX types - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_POSIX_TYPES_H -#define _ASM_POSIX_TYPES_H - -/* - * This file is generally used by user-level software, so you need to - * be a little careful about namespace pollution etc.  Also, we cannot - * assume GCC is being used. - */ - -typedef unsigned long	__kernel_ino_t; -typedef unsigned short	__kernel_mode_t; -typedef unsigned short	__kernel_nlink_t; -typedef long		__kernel_off_t; -typedef int		__kernel_pid_t; -typedef unsigned short	__kernel_ipc_pid_t; -typedef unsigned short	__kernel_uid_t; -typedef unsigned short	__kernel_gid_t; -#if __GNUC__ == 4 -typedef unsigned int	__kernel_size_t; -typedef signed int	__kernel_ssize_t; -#else -typedef unsigned long	__kernel_size_t; -typedef signed long	__kernel_ssize_t; -#endif -typedef int		__kernel_ptrdiff_t; -typedef long		__kernel_time_t; -typedef long		__kernel_suseconds_t; -typedef long		__kernel_clock_t; -typedef int		__kernel_timer_t; -typedef int		__kernel_clockid_t; -typedef int		__kernel_daddr_t; -typedef char *		__kernel_caddr_t; -typedef unsigned short	__kernel_uid16_t; -typedef unsigned short	__kernel_gid16_t; -typedef unsigned int	__kernel_uid32_t; -typedef unsigned int	__kernel_gid32_t; - -typedef unsigned short	__kernel_old_uid_t; -typedef unsigned short	__kernel_old_gid_t; -typedef unsigned short	__kernel_old_dev_t; - -#ifdef __GNUC__ -typedef long long	__kernel_loff_t; -#endif - -typedef struct { -#if defined(__KERNEL__) || defined(__USE_ALL) -	int	val[2]; -#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ -	int	__val[2]; -#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ -} __kernel_fsid_t; - -#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) - -#undef	__FD_SET -static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp) -{ -	unsigned long __tmp = __fd / __NFDBITS; -	unsigned long __rem = __fd % __NFDBITS; -	__fdsetp->fds_bits[__tmp] |= (1UL<<__rem); -} - -#undef	__FD_CLR -static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp) -{ -	unsigned long __tmp = __fd / __NFDBITS; -	unsigned long __rem = __fd % __NFDBITS; -	__fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem); -} - - -#undef	__FD_ISSET -static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p) -{ -	unsigned long __tmp = __fd / __NFDBITS; -	unsigned long __rem = __fd % __NFDBITS; -	return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0; -} - -/* - * This will unroll the loop for the normal constant case (8 ints, - * for a 256-bit fd_set) - */ -#undef	__FD_ZERO -static inline void __FD_ZERO(__kernel_fd_set *__p) -{ -	unsigned long *__tmp = __p->fds_bits; -	int __i; - -	if (__builtin_constant_p(__FDSET_LONGS)) { -		switch (__FDSET_LONGS) { -		case 16: -			__tmp[ 0] = 0; __tmp[ 1] = 0; -			__tmp[ 2] = 0; __tmp[ 3] = 0; -			__tmp[ 4] = 0; __tmp[ 5] = 0; -			__tmp[ 6] = 0; __tmp[ 7] = 0; -			__tmp[ 8] = 0; __tmp[ 9] = 0; -			__tmp[10] = 0; __tmp[11] = 0; -			__tmp[12] = 0; __tmp[13] = 0; -			__tmp[14] = 0; __tmp[15] = 0; -			return; - -		case 8: -			__tmp[ 0] = 0; __tmp[ 1] = 0; -			__tmp[ 2] = 0; __tmp[ 3] = 0; -			__tmp[ 4] = 0; __tmp[ 5] = 0; -			__tmp[ 6] = 0; __tmp[ 7] = 0; -			return; - -		case 4: -			__tmp[ 0] = 0; __tmp[ 1] = 0; -			__tmp[ 2] = 0; __tmp[ 3] = 0; -			return; -		} -	} -	__i = __FDSET_LONGS; -	while (__i) { -		__i--; -		*__tmp = 0; -		__tmp++; -	} -} - -#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ - -#endif /* _ASM_POSIX_TYPES_H */ diff --git a/arch/mn10300/include/asm/processor.h b/arch/mn10300/include/asm/processor.h index 4c1b5cc14c1..8b80b19d0c8 100644 --- a/arch/mn10300/include/asm/processor.h +++ b/arch/mn10300/include/asm/processor.h @@ -119,35 +119,19 @@ struct thread_struct {  /*   * do necessary setup to start up a newly executed thread - * - need to discard the frame stacked by the kernel thread invoking the execve - *   syscall (see RESTORE_ALL macro)   */  static inline void start_thread(struct pt_regs *regs,  				unsigned long new_pc, unsigned long new_sp)  { -	struct thread_info *ti = current_thread_info(); -	struct pt_regs *frame0; -	set_fs(USER_DS); - -	frame0 = thread_info_to_uregs(ti); -	frame0->epsw = EPSW_nSL | EPSW_IE | EPSW_IM; -	frame0->pc = new_pc; -	frame0->sp = new_sp; -	ti->frame = frame0; +	regs->epsw = EPSW_nSL | EPSW_IE | EPSW_IM; +	regs->pc = new_pc; +	regs->sp = new_sp;  }  /* Free all resources held by a thread. */  extern void release_thread(struct task_struct *); -/* Prepare to copy thread state - unlazy all lazy status */ -extern 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); -  /*   * Return saved PC of a blocked thread.   */ diff --git a/arch/mn10300/include/asm/ptrace.h b/arch/mn10300/include/asm/ptrace.h index b6961811d44..838a3830010 100644 --- a/arch/mn10300/include/asm/ptrace.h +++ b/arch/mn10300/include/asm/ptrace.h @@ -11,89 +11,16 @@  #ifndef _ASM_PTRACE_H  #define _ASM_PTRACE_H -#define PT_A3		0 -#define PT_A2		1 -#define PT_D3		2 -#define	PT_D2		3 -#define PT_MCVF		4 -#define	PT_MCRL		5 -#define PT_MCRH		6 -#define	PT_MDRQ		7 -#define	PT_E1		8 -#define	PT_E0		9 -#define	PT_E7		10 -#define	PT_E6		11 -#define	PT_E5		12 -#define	PT_E4		13 -#define	PT_E3		14 -#define	PT_E2		15 -#define	PT_SP		16 -#define	PT_LAR		17 -#define	PT_LIR		18 -#define	PT_MDR		19 -#define	PT_A1		20 -#define	PT_A0		21 -#define	PT_D1		22 -#define	PT_D0		23 -#define PT_ORIG_D0	24 -#define	PT_EPSW		25 -#define	PT_PC		26 -#define NR_PTREGS	27 +#include <uapi/asm/ptrace.h> -/* - * This defines the way registers are stored in the event of an exception - * - the strange order is due to the MOVM instruction - */ -struct pt_regs { -	unsigned long		a3;		/* syscall arg 3 */ -	unsigned long		a2;		/* syscall arg 4 */ -	unsigned long		d3;		/* syscall arg 5 */ -	unsigned long		d2;		/* syscall arg 6 */ -	unsigned long		mcvf; -	unsigned long		mcrl; -	unsigned long		mcrh; -	unsigned long		mdrq; -	unsigned long		e1; -	unsigned long		e0; -	unsigned long		e7; -	unsigned long		e6; -	unsigned long		e5; -	unsigned long		e4; -	unsigned long		e3; -	unsigned long		e2; -	unsigned long		sp; -	unsigned long		lar; -	unsigned long		lir; -	unsigned long		mdr; -	unsigned long		a1; -	unsigned long		a0;		/* syscall arg 1 */ -	unsigned long		d1;		/* syscall arg 2 */ -	unsigned long		d0;		/* syscall ret */ -	struct pt_regs		*next;		/* next frame pointer */ -	unsigned long		orig_d0;	/* syscall number */ -	unsigned long		epsw; -	unsigned long		pc; -}; - -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS            12 -#define PTRACE_SETREGS            13 -#define PTRACE_GETFPREGS          14 -#define PTRACE_SETFPREGS          15 - -/* options set using PTRACE_SETOPTIONS */ -#define PTRACE_O_TRACESYSGOOD     0x00000001 - -#ifdef __KERNEL__  #define user_mode(regs)			(((regs)->epsw & EPSW_nSL) == EPSW_nSL)  #define instruction_pointer(regs)	((regs)->pc)  #define user_stack_pointer(regs)	((regs)->sp) -extern void show_regs(struct pt_regs *); +#define current_pt_regs()		current_frame()  #define arch_has_single_step()	(1)  #define profile_pc(regs) ((regs)->pc) -#endif /* __KERNEL__  */  #endif /* _ASM_PTRACE_H */ diff --git a/arch/mn10300/include/asm/reset-regs.h b/arch/mn10300/include/asm/reset-regs.h index 10c7502a113..8ca2a42d365 100644 --- a/arch/mn10300/include/asm/reset-regs.h +++ b/arch/mn10300/include/asm/reset-regs.h @@ -17,10 +17,6 @@  #ifdef __KERNEL__ -#ifdef CONFIG_MN10300_WD_TIMER -#define ARCH_HAS_NMI_WATCHDOG		/* See include/linux/nmi.h */ -#endif -  /*   * watchdog timer registers   */ diff --git a/arch/mn10300/include/asm/resource.h b/arch/mn10300/include/asm/resource.h deleted file mode 100644 index 04bc4db8921..00000000000 --- a/arch/mn10300/include/asm/resource.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/resource.h> diff --git a/arch/mn10300/include/asm/sembuf.h b/arch/mn10300/include/asm/sembuf.h deleted file mode 100644 index 301f3f9d8aa..00000000000 --- a/arch/mn10300/include/asm/sembuf.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _ASM_SEMBUF_H -#define _ASM_SEMBUF_H - -/* - * The semid64_ds structure for MN10300 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -struct semid64_ds { -	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */ -	__kernel_time_t	sem_otime;		/* last semop time */ -	unsigned long	__unused1; -	__kernel_time_t	sem_ctime;		/* last change time */ -	unsigned long	__unused2; -	unsigned long	sem_nsems;		/* no. of semaphores in array */ -	unsigned long	__unused3; -	unsigned long	__unused4; -}; - -#endif /* _ASM_SEMBUF_H */ diff --git a/arch/mn10300/include/asm/setup.h b/arch/mn10300/include/asm/setup.h index c229d1e3f99..fb024555d2a 100644 --- a/arch/mn10300/include/asm/setup.h +++ b/arch/mn10300/include/asm/setup.h @@ -11,8 +11,8 @@  #ifndef _ASM_SETUP_H  #define _ASM_SETUP_H -#ifdef __KERNEL__ +#include <uapi/asm/setup.h> +  extern void __init unit_setup(void);  extern void __init unit_init_IRQ(void); -#endif  #endif /* _ASM_SETUP_H */ diff --git a/arch/mn10300/include/asm/shmbuf.h b/arch/mn10300/include/asm/shmbuf.h deleted file mode 100644 index 8f300cc35d6..00000000000 --- a/arch/mn10300/include/asm/shmbuf.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _ASM_SHMBUF_H -#define _ASM_SHMBUF_H - -/* - * The shmid64_ds structure for MN10300 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -struct shmid64_ds { -	struct ipc64_perm	shm_perm;	/* operation perms */ -	size_t			shm_segsz;	/* size of segment (bytes) */ -	__kernel_time_t		shm_atime;	/* last attach time */ -	unsigned long		__unused1; -	__kernel_time_t		shm_dtime;	/* last detach time */ -	unsigned long		__unused2; -	__kernel_time_t		shm_ctime;	/* last change time */ -	unsigned long		__unused3; -	__kernel_pid_t		shm_cpid;	/* pid of creator */ -	__kernel_pid_t		shm_lpid;	/* pid of last operator */ -	unsigned long		shm_nattch;	/* no. of current attaches */ -	unsigned long		__unused4; -	unsigned long		__unused5; -}; - -struct shminfo64 { -	unsigned long	shmmax; -	unsigned long	shmmin; -	unsigned long	shmmni; -	unsigned long	shmseg; -	unsigned long	shmall; -	unsigned long	__unused1; -	unsigned long	__unused2; -	unsigned long	__unused3; -	unsigned long	__unused4; -}; - -#endif /* _ASM_SHMBUF_H */ diff --git a/arch/mn10300/include/asm/sigcontext.h b/arch/mn10300/include/asm/sigcontext.h deleted file mode 100644 index 4de3afff4ad..00000000000 --- a/arch/mn10300/include/asm/sigcontext.h +++ /dev/null @@ -1,52 +0,0 @@ -/* MN10300 Userspace signal context - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SIGCONTEXT_H -#define _ASM_SIGCONTEXT_H - -struct fpucontext { -	/* Regular FPU environment */ -	unsigned long	fs[32];		/* fpu registers */ -	unsigned long	fpcr;		/* fpu control register */ -}; - -struct sigcontext { -	unsigned long	d0; -	unsigned long	d1; -	unsigned long	d2; -	unsigned long	d3; -	unsigned long	a0; -	unsigned long	a1; -	unsigned long	a2; -	unsigned long	a3; -	unsigned long	e0; -	unsigned long	e1; -	unsigned long	e2; -	unsigned long	e3; -	unsigned long	e4; -	unsigned long	e5; -	unsigned long	e6; -	unsigned long	e7; -	unsigned long	lar; -	unsigned long	lir; -	unsigned long	mdr; -	unsigned long	mcvf; -	unsigned long	mcrl; -	unsigned long	mcrh; -	unsigned long	mdrq; -	unsigned long	sp; -	unsigned long	epsw; -	unsigned long	pc; -	struct fpucontext *fpucontext; -	unsigned long	oldmask; -}; - - -#endif /* _ASM_SIGCONTEXT_H */ diff --git a/arch/mn10300/include/asm/siginfo.h b/arch/mn10300/include/asm/siginfo.h deleted file mode 100644 index 0815d29d82e..00000000000 --- a/arch/mn10300/include/asm/siginfo.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/siginfo.h> diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h index 1865d72a86f..214ff5e9fe6 100644 --- a/arch/mn10300/include/asm/signal.h +++ b/arch/mn10300/include/asm/signal.h @@ -11,12 +11,8 @@  #ifndef _ASM_SIGNAL_H  #define _ASM_SIGNAL_H -#include <linux/types.h> +#include <uapi/asm/signal.h> -/* Avoid too many header ordering problems.  */ -struct siginfo; - -#ifdef __KERNEL__  /* Most things should be clean enough to redefine this at will, if care     is taken to make libc match.  */ @@ -30,142 +26,8 @@ typedef struct {  	unsigned long	sig[_NSIG_WORDS];  } sigset_t; -#else -/* Here we must cater to libcs that poke about in kernel headers.  */ - -#define NSIG		32 -typedef unsigned long sigset_t; - -#endif /* __KERNEL__ */ - -#define SIGHUP		 1 -#define SIGINT		 2 -#define SIGQUIT		 3 -#define SIGILL		 4 -#define SIGTRAP		 5 -#define SIGABRT		 6 -#define SIGIOT		 6 -#define SIGBUS		 7 -#define SIGFPE		 8 -#define SIGKILL		 9 -#define SIGUSR1		10 -#define SIGSEGV		11 -#define SIGUSR2		12 -#define SIGPIPE		13 -#define SIGALRM		14 -#define SIGTERM		15 -#define SIGSTKFLT	16 -#define SIGCHLD		17 -#define SIGCONT		18 -#define SIGSTOP		19 -#define SIGTSTP		20 -#define SIGTTIN		21 -#define SIGTTOU		22 -#define SIGURG		23 -#define SIGXCPU		24 -#define SIGXFSZ		25 -#define SIGVTALRM	26 -#define SIGPROF		27 -#define SIGWINCH	28 -#define SIGIO		29 -#define SIGPOLL		SIGIO -/* -#define SIGLOST		29 -*/ -#define SIGPWR		30 -#define SIGSYS		31 -#define	SIGUNUSED	31 - -/* These should not be considered constants from userland.  */ -#define SIGRTMIN	32 -#define SIGRTMAX	_NSIG - -/* - * SA_FLAGS values: - * - * SA_ONSTACK indicates that a registered stack_t will be used. - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. - * SA_RESETHAND clears the handler when the signal is delivered. - * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. - * SA_NODEFER prevents the current signal from being masked in the handler. - * - * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single - * Unix names RESETHAND and NODEFER respectively. - */ -#define SA_NOCLDSTOP	0x00000001U -#define SA_NOCLDWAIT	0x00000002U -#define SA_SIGINFO	0x00000004U -#define SA_ONSTACK	0x08000000U -#define SA_RESTART	0x10000000U -#define SA_NODEFER	0x40000000U -#define SA_RESETHAND	0x80000000U - -#define SA_NOMASK	SA_NODEFER -#define SA_ONESHOT	SA_RESETHAND - -#define SA_RESTORER	0x04000000 - -/* - * sigaltstack controls - */ -#define SS_ONSTACK	1 -#define SS_DISABLE	2 +#define __ARCH_HAS_SA_RESTORER -#define MINSIGSTKSZ	2048 -#define SIGSTKSZ	8192 - -#include <asm-generic/signal-defs.h> - -#ifdef __KERNEL__ -struct old_sigaction { -	__sighandler_t sa_handler; -	old_sigset_t sa_mask; -	unsigned long sa_flags; -	__sigrestore_t sa_restorer; -}; - -struct sigaction { -	__sighandler_t sa_handler; -	unsigned long sa_flags; -	__sigrestore_t sa_restorer; -	sigset_t sa_mask;		/* mask last for extensibility */ -}; - -struct k_sigaction { -	struct sigaction sa; -}; -#else -/* Here we must cater to libcs that poke about in kernel headers.  */ - -struct sigaction { -	union { -	  __sighandler_t _sa_handler; -	  void (*_sa_sigaction)(int, struct siginfo *, void *); -	} _u; -	sigset_t sa_mask; -	unsigned long sa_flags; -	void (*sa_restorer)(void); -}; - -#define sa_handler	_u._sa_handler -#define sa_sigaction	_u._sa_sigaction - -#endif /* __KERNEL__ */ - -typedef struct sigaltstack { -	void __user	*ss_sp; -	int		ss_flags; -	size_t		ss_size; -} stack_t; - -#ifdef __KERNEL__  #include <asm/sigcontext.h> - -struct pt_regs; -#define ptrace_signal_deliver(regs, cookie) do { } while (0) - -#endif /* __KERNEL__ */ -  #endif /* _ASM_SIGNAL_H */ diff --git a/arch/mn10300/include/asm/smp.h b/arch/mn10300/include/asm/smp.h index a3930e43a95..56c42417d42 100644 --- a/arch/mn10300/include/asm/smp.h +++ b/arch/mn10300/include/asm/smp.h @@ -24,6 +24,7 @@  #ifndef __ASSEMBLY__  #include <linux/threads.h>  #include <linux/cpumask.h> +#include <linux/thread_info.h>  #endif  #ifdef CONFIG_SMP @@ -34,7 +35,7 @@  #define LOCAL_TIMER_IPI		193  #define FLUSH_CACHE_IPI		194  #define CALL_FUNCTION_NMI_IPI	195 -#define GDB_NMI_IPI		196 +#define DEBUGGER_NMI_IPI	196  #define SMP_BOOT_IRQ		195 @@ -43,6 +44,7 @@  #define LOCAL_TIMER_GxICR_LV	GxICR_LEVEL_4  #define FLUSH_CACHE_GxICR_LV	GxICR_LEVEL_0  #define SMP_BOOT_GxICR_LV	GxICR_LEVEL_0 +#define DEBUGGER_GxICR_LV	CONFIG_DEBUGGER_IRQ_LEVEL  #define TIME_OUT_COUNT_BOOT_IPI	100  #define DELAY_TIME_BOOT_IPI	75000 @@ -61,8 +63,9 @@   * An alternate way of dealing with this could be to use the EPSW.S bits to   * cache this information for systems with up to four CPUs.   */ +#define arch_smp_processor_id()	(CPUID)  #if 0 -#define raw_smp_processor_id()	(CPUID) +#define raw_smp_processor_id()	(arch_smp_processor_id())  #else  #define raw_smp_processor_id()	(current_thread_info()->cpu)  #endif @@ -83,7 +86,7 @@ extern cpumask_t cpu_boot_map;  extern void smp_init_cpus(void);  extern void smp_cache_interrupt(void);  extern void send_IPI_allbutself(int irq); -extern int smp_nmi_call_function(smp_call_func_t func, void *info, int wait); +extern int smp_nmi_call_function(void (*func)(void *), void *info, int wait);  extern void arch_send_call_function_single_ipi(int cpu);  extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); @@ -98,6 +101,7 @@ extern void __cpu_die(unsigned int cpu);  #ifndef __ASSEMBLY__  static inline void smp_init_cpus(void) {} +#define raw_smp_processor_id() 0  #endif /* __ASSEMBLY__ */  #endif /* CONFIG_SMP */ diff --git a/arch/mn10300/include/asm/socket.h b/arch/mn10300/include/asm/socket.h deleted file mode 100644 index 4e60c428128..00000000000 --- a/arch/mn10300/include/asm/socket.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _ASM_SOCKET_H -#define _ASM_SOCKET_H - -#include <asm/sockios.h> - -/* For setsockopt(2) */ -#define SOL_SOCKET	1 - -#define SO_DEBUG	1 -#define SO_REUSEADDR	2 -#define SO_TYPE		3 -#define SO_ERROR	4 -#define SO_DONTROUTE	5 -#define SO_BROADCAST	6 -#define SO_SNDBUF	7 -#define SO_RCVBUF	8 -#define SO_SNDBUFFORCE	32 -#define SO_RCVBUFFORCE	33 -#define SO_KEEPALIVE	9 -#define SO_OOBINLINE	10 -#define SO_NO_CHECK	11 -#define SO_PRIORITY	12 -#define SO_LINGER	13 -#define SO_BSDCOMPAT	14 -/* To add :#define SO_REUSEPORT 15 */ -#define SO_PASSCRED	16 -#define SO_PEERCRED	17 -#define SO_RCVLOWAT	18 -#define SO_SNDLOWAT	19 -#define SO_RCVTIMEO	20 -#define SO_SNDTIMEO	21 - -/* Security levels - as per NRL IPv6 - don't actually do anything */ -#define SO_SECURITY_AUTHENTICATION		22 -#define SO_SECURITY_ENCRYPTION_TRANSPORT	23 -#define SO_SECURITY_ENCRYPTION_NETWORK		24 - -#define SO_BINDTODEVICE	25 - -/* Socket filtering */ -#define SO_ATTACH_FILTER        26 -#define SO_DETACH_FILTER        27 - -#define SO_PEERNAME		28 -#define SO_TIMESTAMP		29 -#define SCM_TIMESTAMP		SO_TIMESTAMP - -#define SO_ACCEPTCONN		30 - -#define SO_PEERSEC		31 -#define SO_PASSSEC		34 -#define SO_TIMESTAMPNS		35 -#define SCM_TIMESTAMPNS		SO_TIMESTAMPNS - -#define SO_MARK			36 - -#define SO_TIMESTAMPING		37 -#define SCM_TIMESTAMPING	SO_TIMESTAMPING - -#define SO_PROTOCOL		38 -#define SO_DOMAIN		39 - -#define SO_RXQ_OVFL             40 - -#endif /* _ASM_SOCKET_H */ diff --git a/arch/mn10300/include/asm/sockios.h b/arch/mn10300/include/asm/sockios.h deleted file mode 100644 index b03043a1c56..00000000000 --- a/arch/mn10300/include/asm/sockios.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _ASM_SOCKIOS_H -#define _ASM_SOCKIOS_H - -/* Socket-level I/O control calls. */ -#define FIOSETOWN 	0x8901 -#define SIOCSPGRP	0x8902 -#define FIOGETOWN	0x8903 -#define SIOCGPGRP	0x8904 -#define SIOCATMARK	0x8905 -#define SIOCGSTAMP	0x8906		/* Get stamp */ -#define SIOCGSTAMPNS	0x8907		/* Get stamp (timespec) */ - -#endif /* _ASM_SOCKIOS_H */ diff --git a/arch/mn10300/include/asm/spinlock.h b/arch/mn10300/include/asm/spinlock.h index 93429154e89..1ae580f3893 100644 --- a/arch/mn10300/include/asm/spinlock.h +++ b/arch/mn10300/include/asm/spinlock.h @@ -11,7 +11,7 @@  #ifndef _ASM_SPINLOCK_H  #define _ASM_SPINLOCK_H -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/rwlock.h>  #include <asm/page.h> diff --git a/arch/mn10300/include/asm/stat.h b/arch/mn10300/include/asm/stat.h deleted file mode 100644 index 63ff8371cf2..00000000000 --- a/arch/mn10300/include/asm/stat.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef _ASM_STAT_H -#define _ASM_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; -}; - -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	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 int	st_mtime_nsec; - -	unsigned long	st_ctime; -	unsigned long	st_ctime_nsec; - -	unsigned long long	st_ino; -}; - -#define STAT_HAVE_NSEC 1 - -#endif /* _ASM_STAT_H */ diff --git a/arch/mn10300/include/asm/statfs.h b/arch/mn10300/include/asm/statfs.h deleted file mode 100644 index 0b91fe198c2..00000000000 --- a/arch/mn10300/include/asm/statfs.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/statfs.h> diff --git a/arch/mn10300/include/asm/swab.h b/arch/mn10300/include/asm/swab.h deleted file mode 100644 index bd818a820ca..00000000000 --- a/arch/mn10300/include/asm/swab.h +++ /dev/null @@ -1,42 +0,0 @@ -/* MN10300 Byte-order primitive construction - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SWAB_H -#define _ASM_SWAB_H - -#include <linux/types.h> - -#ifdef __GNUC__ - -static inline __attribute__((const)) -__u32 __arch_swab32(__u32 x) -{ -	__u32 ret; -	asm("swap %1,%0" : "=r" (ret) : "r" (x)); -	return ret; -} -#define __arch_swab32 __arch_swab32 - -static inline __attribute__((const)) -__u16 __arch_swab16(__u16 x) -{ -	__u16 ret; -	asm("swaph %1,%0" : "=r" (ret) : "r" (x)); -	return ret; -} -#define __arch_swab32 __arch_swab32 - -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -#  define __SWAB_64_THRU_32__ -#endif - -#endif /* __GNUC__ */ - -#endif /* _ASM_SWAB_H */ diff --git a/arch/mn10300/include/asm/switch_to.h b/arch/mn10300/include/asm/switch_to.h new file mode 100644 index 00000000000..393d311735c --- /dev/null +++ b/arch/mn10300/include/asm/switch_to.h @@ -0,0 +1,49 @@ +/* MN10300 task switching definitions + * + * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence + * as published by the Free Software Foundation; either version + * 2 of the Licence, or (at your option) any later version. + */ +#ifndef _ASM_SWITCH_TO_H +#define _ASM_SWITCH_TO_H + +#include <asm/barrier.h> + +struct task_struct; +struct thread_struct; + +#if !defined(CONFIG_LAZY_SAVE_FPU) +struct fpu_state_struct; +extern asmlinkage void fpu_save(struct fpu_state_struct *); +#define switch_fpu(prev, next)						\ +	do {								\ +		if ((prev)->thread.fpu_flags & THREAD_HAS_FPU) {	\ +			(prev)->thread.fpu_flags &= ~THREAD_HAS_FPU;	\ +			(prev)->thread.uregs->epsw &= ~EPSW_FE;		\ +			fpu_save(&(prev)->thread.fpu_state);		\ +		}							\ +	} while (0) +#else +#define switch_fpu(prev, next) do {} while (0) +#endif + +/* context switching is now performed out-of-line in switch_to.S */ +extern asmlinkage +struct task_struct *__switch_to(struct thread_struct *prev, +				struct thread_struct *next, +				struct task_struct *prev_task); + +#define switch_to(prev, next, last)					\ +do {									\ +	switch_fpu(prev, next);						\ +	current->thread.wchan = (u_long) __builtin_return_address(0);	\ +	(last) = __switch_to(&(prev)->thread, &(next)->thread, (prev));	\ +	mb();								\ +	current->thread.wchan = 0;					\ +} while (0) + +#endif /* _ASM_SWITCH_TO_H */ diff --git a/arch/mn10300/include/asm/syscall.h b/arch/mn10300/include/asm/syscall.h new file mode 100644 index 00000000000..b44b0bb75a0 --- /dev/null +++ b/arch/mn10300/include/asm/syscall.h @@ -0,0 +1,117 @@ +/* Access to user system call parameters and results + * + * See asm-generic/syscall.h for function descriptions. + * + * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence + * as published by the Free Software Foundation; either version + * 2 of the Licence, or (at your option) any later version. + */ + +#ifndef _ASM_SYSCALL_H +#define _ASM_SYSCALL_H + +#include <linux/sched.h> +#include <linux/err.h> + +extern const unsigned long sys_call_table[]; + +static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) +{ +	return regs->orig_d0; +} + +static inline void syscall_rollback(struct task_struct *task, +				    struct pt_regs *regs) +{ +	regs->d0 = regs->orig_d0; +} + +static inline long syscall_get_error(struct task_struct *task, +				     struct pt_regs *regs) +{ +	unsigned long error = regs->d0; +	return IS_ERR_VALUE(error) ? error : 0; +} + +static inline long syscall_get_return_value(struct task_struct *task, +					    struct pt_regs *regs) +{ +	return regs->d0; +} + +static inline void syscall_set_return_value(struct task_struct *task, +					    struct pt_regs *regs, +					    int error, long val) +{ +	regs->d0 = (long) error ?: val; +} + +static inline void syscall_get_arguments(struct task_struct *task, +					 struct pt_regs *regs, +					 unsigned int i, unsigned int n, +					 unsigned long *args) +{ +	switch (i) { +	case 0: +		if (!n--) break; +		*args++ = regs->a0; +	case 1: +		if (!n--) break; +		*args++ = regs->d1; +	case 2: +		if (!n--) break; +		*args++ = regs->a3; +	case 3: +		if (!n--) break; +		*args++ = regs->a2; +	case 4: +		if (!n--) break; +		*args++ = regs->d3; +	case 5: +		if (!n--) break; +		*args++ = regs->d2; +	case 6: +		if (!n--) break; +	default: +		BUG(); +		break; +	} +} + +static inline void syscall_set_arguments(struct task_struct *task, +					 struct pt_regs *regs, +					 unsigned int i, unsigned int n, +					 const unsigned long *args) +{ +	switch (i) { +	case 0: +		if (!n--) break; +		regs->a0 = *args++; +	case 1: +		if (!n--) break; +		regs->d1 = *args++; +	case 2: +		if (!n--) break; +		regs->a3 = *args++; +	case 3: +		if (!n--) break; +		regs->a2 = *args++; +	case 4: +		if (!n--) break; +		regs->d3 = *args++; +	case 5: +		if (!n--) break; +		regs->d2 = *args++; +	case 6: +		if (!n--) break; +	default: +		BUG(); +		break; +	} +} + +#endif /* _ASM_SYSCALL_H */ diff --git a/arch/mn10300/include/asm/system.h b/arch/mn10300/include/asm/system.h deleted file mode 100644 index 8ff3e5aaca4..00000000000 --- a/arch/mn10300/include/asm/system.h +++ /dev/null @@ -1,102 +0,0 @@ -/* MN10300 System definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SYSTEM_H -#define _ASM_SYSTEM_H - -#include <asm/cpu-regs.h> -#include <asm/intctl-regs.h> - -#ifdef __KERNEL__ -#ifndef __ASSEMBLY__ - -#include <linux/kernel.h> -#include <linux/irqflags.h> -#include <asm/atomic.h> - -#if !defined(CONFIG_LAZY_SAVE_FPU) -struct fpu_state_struct; -extern asmlinkage void fpu_save(struct fpu_state_struct *); -#define switch_fpu(prev, next)						\ -	do {								\ -		if ((prev)->thread.fpu_flags & THREAD_HAS_FPU) {	\ -			(prev)->thread.fpu_flags &= ~THREAD_HAS_FPU;	\ -			(prev)->thread.uregs->epsw &= ~EPSW_FE;		\ -			fpu_save(&(prev)->thread.fpu_state);		\ -		}							\ -	} while (0) -#else -#define switch_fpu(prev, next) do {} while (0) -#endif - -struct task_struct; -struct thread_struct; - -extern asmlinkage -struct task_struct *__switch_to(struct thread_struct *prev, -				struct thread_struct *next, -				struct task_struct *prev_task); - -/* context switching is now performed out-of-line in switch_to.S */ -#define switch_to(prev, next, last)					\ -do {									\ -	switch_fpu(prev, next);						\ -	current->thread.wchan = (u_long) __builtin_return_address(0);	\ -	(last) = __switch_to(&(prev)->thread, &(next)->thread, (prev));	\ -	mb();								\ -	current->thread.wchan = 0;					\ -} while (0) - -#define arch_align_stack(x) (x) - -#define nop() asm volatile ("nop") - -/* - * Force strict CPU ordering. - * And yes, this is required on UP too when we're talking - * to devices. - * - * For now, "wmb()" doesn't actually do anything, as all - * Intel CPU's follow what Intel calls a *Processor Order*, - * in which all writes are seen in the program order even - * outside the CPU. - * - * I expect future Intel CPU's to have a weaker ordering, - * but I'd also expect them to finally get their act together - * and add some real memory barriers if so. - * - * Some non intel clones support out of order store. wmb() ceases to be a - * nop for these. - */ - -#define mb()	asm volatile ("": : :"memory") -#define rmb()	mb() -#define wmb()	asm volatile ("": : :"memory") - -#ifdef CONFIG_SMP -#define smp_mb()	mb() -#define smp_rmb()	rmb() -#define smp_wmb()	wmb() -#define set_mb(var, value)  do { xchg(&var, value); } while (0) -#else  /* CONFIG_SMP */ -#define smp_mb()	barrier() -#define smp_rmb()	barrier() -#define smp_wmb()	barrier() -#define set_mb(var, value)  do { var = value;  mb(); } while (0) -#endif /* CONFIG_SMP */ - -#define set_wmb(var, value) do { var = value; wmb(); } while (0) - -#define read_barrier_depends()		do {} while (0) -#define smp_read_barrier_depends()	do {} while (0) - -#endif /* !__ASSEMBLY__ */ -#endif /* __KERNEL__ */ -#endif /* _ASM_SYSTEM_H */ diff --git a/arch/mn10300/include/asm/termbits.h b/arch/mn10300/include/asm/termbits.h deleted file mode 100644 index 130d4249597..00000000000 --- a/arch/mn10300/include/asm/termbits.h +++ /dev/null @@ -1,201 +0,0 @@ -#ifndef _ASM_TERMBITS_H -#define _ASM_TERMBITS_H - -#include <linux/posix_types.h> - -typedef unsigned char	cc_t; -typedef unsigned int	speed_t; -typedef unsigned int	tcflag_t; - -#define NCCS 19 -struct termios { -	tcflag_t c_iflag;		/* input mode flags */ -	tcflag_t c_oflag;		/* output mode flags */ -	tcflag_t c_cflag;		/* control mode flags */ -	tcflag_t c_lflag;		/* local mode flags */ -	cc_t c_line;			/* line discipline */ -	cc_t c_cc[NCCS];		/* control characters */ -}; - -struct termios2 { -	tcflag_t c_iflag;		/* input mode flags */ -	tcflag_t c_oflag;		/* output mode flags */ -	tcflag_t c_cflag;		/* control mode flags */ -	tcflag_t c_lflag;		/* local mode flags */ -	cc_t c_line;			/* line discipline */ -	cc_t c_cc[NCCS];		/* control characters */ -	speed_t c_ispeed;		/* input speed */ -	speed_t c_ospeed;		/* output speed */ -}; - -struct ktermios { -	tcflag_t c_iflag;		/* input mode flags */ -	tcflag_t c_oflag;		/* output mode flags */ -	tcflag_t c_cflag;		/* control mode flags */ -	tcflag_t c_lflag;		/* local mode flags */ -	cc_t c_line;			/* line discipline */ -	cc_t c_cc[NCCS];		/* control characters */ -	speed_t c_ispeed;		/* input speed */ -	speed_t c_ospeed;		/* output speed */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - - -/* c_iflag bits */ -#define IGNBRK	0000001 -#define BRKINT	0000002 -#define IGNPAR	0000004 -#define PARMRK	0000010 -#define INPCK	0000020 -#define ISTRIP	0000040 -#define INLCR	0000100 -#define IGNCR	0000200 -#define ICRNL	0000400 -#define IUCLC	0001000 -#define IXON	0002000 -#define IXANY	0004000 -#define IXOFF	0010000 -#define IMAXBEL	0020000 -#define IUTF8	0040000 - -/* c_oflag bits */ -#define OPOST	0000001 -#define OLCUC	0000002 -#define ONLCR	0000004 -#define OCRNL	0000010 -#define ONOCR	0000020 -#define ONLRET	0000040 -#define OFILL	0000100 -#define OFDEL	0000200 -#define NLDLY	0000400 -#define   NL0	0000000 -#define   NL1	0000400 -#define CRDLY	0003000 -#define   CR0	0000000 -#define   CR1	0001000 -#define   CR2	0002000 -#define   CR3	0003000 -#define TABDLY	0014000 -#define   TAB0	0000000 -#define   TAB1	0004000 -#define   TAB2	0010000 -#define   TAB3	0014000 -#define   XTABS	0014000 -#define BSDLY	0020000 -#define   BS0	0000000 -#define   BS1	0020000 -#define VTDLY	0040000 -#define   VT0	0000000 -#define   VT1	0040000 -#define FFDLY	0100000 -#define   FF0	0000000 -#define   FF1	0100000 - -/* c_cflag bit meaning */ -#define CBAUD	0010017 -#define  B0	0000000		/* hang up */ -#define  B50	0000001 -#define  B75	0000002 -#define  B110	0000003 -#define  B134	0000004 -#define  B150	0000005 -#define  B200	0000006 -#define  B300	0000007 -#define  B600	0000010 -#define  B1200	0000011 -#define  B1800	0000012 -#define  B2400	0000013 -#define  B4800	0000014 -#define  B9600	0000015 -#define  B19200	0000016 -#define  B38400	0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE	0000060 -#define   CS5	0000000 -#define   CS6	0000020 -#define   CS7	0000040 -#define   CS8	0000060 -#define CSTOPB	0000100 -#define CREAD	0000200 -#define PARENB	0000400 -#define PARODD	0001000 -#define HUPCL	0002000 -#define CLOCAL	0004000 -#define CBAUDEX 0010000 -#define   BOTHER  0010000 -#define    B57600 0010001 -#define   B115200 0010002 -#define   B230400 0010003 -#define   B460800 0010004 -#define   B500000 0010005 -#define   B576000 0010006 -#define   B921600 0010007 -#define  B1000000 0010010 -#define  B1152000 0010011 -#define  B1500000 0010012 -#define  B2000000 0010013 -#define  B2500000 0010014 -#define  B3000000 0010015 -#define  B3500000 0010016 -#define  B4000000 0010017 -#define CIBAUD	  002003600000	/* input baud rate (not used) */ -#define CTVB	  004000000000		/* VisioBraille Terminal flow control */ -#define CMSPAR	  010000000000		/* mark or space (stick) parity */ -#define CRTSCTS	  020000000000		/* flow control */ - -#define IBSHIFT	  16		/* Shift from CBAUD to CIBAUD */ - -/* c_lflag bits */ -#define ISIG	0000001 -#define ICANON	0000002 -#define XCASE	0000004 -#define ECHO	0000010 -#define ECHOE	0000020 -#define ECHOK	0000040 -#define ECHONL	0000100 -#define NOFLSH	0000200 -#define TOSTOP	0000400 -#define ECHOCTL	0001000 -#define ECHOPRT	0002000 -#define ECHOKE	0004000 -#define FLUSHO	0010000 -#define PENDIN	0040000 -#define IEXTEN	0100000 -#define EXTPROC	0200000 - -/* tcflow() and TCXONC use these */ -#define	TCOOFF		0 -#define	TCOON		1 -#define	TCIOFF		2 -#define	TCION		3 - -/* tcflush() and TCFLSH use these */ -#define	TCIFLUSH	0 -#define	TCOFLUSH	1 -#define	TCIOFLUSH	2 - -/* tcsetattr uses these */ -#define	TCSANOW		0 -#define	TCSADRAIN	1 -#define	TCSAFLUSH	2 - -#endif /* _ASM_TERMBITS_H */ diff --git a/arch/mn10300/include/asm/termios.h b/arch/mn10300/include/asm/termios.h index dd7cf617e11..c2e29c75dfa 100644 --- a/arch/mn10300/include/asm/termios.h +++ b/arch/mn10300/include/asm/termios.h @@ -1,27 +1,8 @@  #ifndef _ASM_TERMIOS_H  #define _ASM_TERMIOS_H -#include <asm/termbits.h> -#include <asm/ioctls.h> +#include <uapi/asm/termios.h> -struct winsize { -	unsigned short ws_row; -	unsigned short ws_col; -	unsigned short ws_xpixel; -	unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { -	unsigned short c_iflag;		/* input mode flags */ -	unsigned short c_oflag;		/* output mode flags */ -	unsigned short c_cflag;		/* control mode flags */ -	unsigned short c_lflag;		/* local mode flags */ -	unsigned char c_line;		/* line discipline */ -	unsigned char c_cc[NCC];	/* control characters */ -}; - -#ifdef __KERNEL__  /*	intr=^C		quit=^|		erase=del	kill=^U  	eof=^D		vtime=\0	vmin=\1		sxtc=\0  	start=^Q	stop=^S		susp=^Z		eol=\0 @@ -29,64 +10,4 @@ struct termio {  	eol2=\0  */  #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" -#endif - -/* modem lines */ -#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 TIOCM_OUT1	0x2000 -#define TIOCM_OUT2	0x4000 -#define TIOCM_LOOP	0x8000 - -#define TIOCM_MODEM_BITS       TIOCM_OUT2      /* IRDA support */ - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ -#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ -	unsigned short __tmp; \ -	get_user(__tmp, &(termio)->x); \ -	*(unsigned short *) &(termios)->x = __tmp; \ -} - -#define user_termio_to_kernel_termios(termios, termio) \ -({ \ -	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ -	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ -	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ -	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ -	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -}) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -({ \ -	put_user((termios)->c_iflag, &(termio)->c_iflag); \ -	put_user((termios)->c_oflag, &(termio)->c_oflag); \ -	put_user((termios)->c_cflag, &(termio)->c_cflag); \ -	put_user((termios)->c_lflag, &(termio)->c_lflag); \ -	put_user((termios)->c_line,  &(termio)->c_line); \ -	copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -}) - -#define user_termios_to_kernel_termios(k, u) \ -	copy_from_user(k, u, sizeof(struct termios2)) -#define kernel_termios_to_user_termios(u, k) \ -	copy_to_user(u, k, sizeof(struct termios2)) -#define user_termios_to_kernel_termios_1(k, u) \ -	copy_from_user(k, u, sizeof(struct termios)) -#define kernel_termios_to_user_termios_1(u, k) \ -	copy_to_user(u, k, sizeof(struct termios)) -  #endif	/* _ASM_TERMIOS_H */ diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h index aa07a4a5d79..bf280eaccd3 100644 --- a/arch/mn10300/include/asm/thread_info.h +++ b/arch/mn10300/include/asm/thread_info.h @@ -16,12 +16,12 @@  #include <asm/page.h> -#define PREEMPT_ACTIVE		0x10000000 -  #ifdef CONFIG_4KSTACKS  #define THREAD_SIZE		(4096) +#define THREAD_SIZE_ORDER	(0)  #else  #define THREAD_SIZE		(8192) +#define THREAD_SIZE_ORDER	(1)  #endif  #define STACK_WARN		(THREAD_SIZE / 8) @@ -120,16 +120,9 @@ static inline unsigned long current_stack_pointer(void)  	return sp;  } -#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR - -/* thread information allocation */ -#ifdef CONFIG_DEBUG_STACK_USAGE -#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL) -#else -#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) +#ifndef CONFIG_KGDB +void arch_release_thread_info(struct thread_info *ti);  #endif - -#define free_thread_info(ti)	kfree((ti))  #define get_thread_info(ti)	get_task_struct((ti)->task)  #define put_thread_info(ti)	put_task_struct((ti)->task) @@ -159,16 +152,13 @@ static inline unsigned long current_stack_pointer(void)  #define TIF_RESTORE_SIGMASK	5	/* restore signal mask in do_signal() */  #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */  #define TIF_MEMDIE		17	/* is terminating due to OOM killer */ -#define TIF_FREEZE		18	/* freezing for suspend */  #define _TIF_SYSCALL_TRACE	+(1 << TIF_SYSCALL_TRACE)  #define _TIF_NOTIFY_RESUME	+(1 << TIF_NOTIFY_RESUME)  #define _TIF_SIGPENDING		+(1 << TIF_SIGPENDING)  #define _TIF_NEED_RESCHED	+(1 << TIF_NEED_RESCHED)  #define _TIF_SINGLESTEP		+(1 << TIF_SINGLESTEP) -#define _TIF_RESTORE_SIGMASK	+(1 << TIF_RESTORE_SIGMASK)  #define _TIF_POLLING_NRFLAG	+(1 << TIF_POLLING_NRFLAG) -#define _TIF_FREEZE		+(1 << TIF_FREEZE)  #define _TIF_WORK_MASK		0x0000FFFE	/* work to do on interrupt/exception return */  #define _TIF_ALLWORK_MASK	0x0000FFFF	/* work to do on any return to u-space */ diff --git a/arch/mn10300/include/asm/timex.h b/arch/mn10300/include/asm/timex.h index bd4e90dfe6c..f8e66425cbf 100644 --- a/arch/mn10300/include/asm/timex.h +++ b/arch/mn10300/include/asm/timex.h @@ -11,7 +11,6 @@  #ifndef _ASM_TIMEX_H  #define _ASM_TIMEX_H -#include <asm/hardirq.h>  #include <unit/timex.h>  #define TICK_SIZE (tick_nsec / 1000) @@ -30,16 +29,6 @@ static inline cycles_t get_cycles(void)  extern int init_clockevents(void);  extern int init_clocksource(void); -static inline void setup_jiffies_interrupt(int irq, -					   struct irqaction *action) -{ -	u16 tmp; -	setup_irq(irq, action); -	set_intr_level(irq, NUM2GxICR_LEVEL(CONFIG_TIMER_IRQ_LEVEL)); -	GxICR(irq) |= GxICR_ENABLE | GxICR_DETECT | GxICR_REQUEST; -	tmp = GxICR(irq); -} -  #endif /* __KERNEL__ */  #endif /* _ASM_TIMEX_H */ diff --git a/arch/mn10300/include/asm/types.h b/arch/mn10300/include/asm/types.h index 7b9f01042fd..3d6e48311be 100644 --- a/arch/mn10300/include/asm/types.h +++ b/arch/mn10300/include/asm/types.h @@ -11,28 +11,12 @@  #ifndef _ASM_TYPES_H  #define _ASM_TYPES_H -#include <asm-generic/int-ll64.h> - -#ifndef __ASSEMBLY__ - -typedef unsigned short umode_t; - -#endif /* __ASSEMBLY__ */ +#include <uapi/asm/types.h>  /*   * These aren't exported outside the kernel to avoid name space clashes   */ -#ifdef __KERNEL__  #define BITS_PER_LONG 32 -#ifndef __ASSEMBLY__ - -/* Dma addresses are 32-bits wide.  */ -typedef u32 dma_addr_t; - -#endif /* __ASSEMBLY__ */ - -#endif /* __KERNEL__ */ -  #endif /* _ASM_TYPES_H */ diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 679dee0bbd0..537278746a1 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h @@ -15,6 +15,7 @@   * User space memory access functions   */  #include <linux/thread_info.h> +#include <linux/kernel.h>  #include <asm/page.h>  #include <asm/errno.h> @@ -160,9 +161,10 @@ struct __large_struct { unsigned long buf[100]; };  #define __get_user_check(x, ptr, size)					\  ({									\ +	const __typeof__(*(ptr))* __guc_ptr = (ptr);			\  	int _e;								\ -	if (likely(__access_ok((unsigned long) (ptr), (size))))		\ -		_e = __get_user_nocheck((x), (ptr), (size));		\ +	if (likely(__access_ok((unsigned long) __guc_ptr, (size))))	\ +		_e = __get_user_nocheck((x), __guc_ptr, (size));	\  	else {								\  		_e = -EFAULT;						\  		(x) = (__typeof__(x))0;					\ @@ -469,13 +471,13 @@ extern unsigned long __generic_copy_from_user(void *, const void __user *,  #define __copy_to_user(to, from, n)			\  ({							\ -	might_sleep();					\ +	might_fault();					\  	__copy_to_user_inatomic((to), (from), (n));	\  })  #define __copy_from_user(to, from, n)			\  ({							\ -	might_sleep();					\ +	might_fault();					\  	__copy_from_user_inatomic((to), (from), (n));	\  }) diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h index 9d056f51592..0522468f488 100644 --- a/arch/mn10300/include/asm/unistd.h +++ b/arch/mn10300/include/asm/unistd.h @@ -11,353 +11,14 @@  #ifndef _ASM_UNISTD_H  #define _ASM_UNISTD_H -#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_modify_ldt		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_getpmsg		188	/* some people actually want streams */ -#define __NR_putpmsg		189	/* some people actually want streams */ -#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_madvise1		219	/* delete when C lib stub is removed */ -#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 +#include <uapi/asm/unistd.h> -#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		286 -#define __NR_request_key	287 -#define __NR_keyctl		288 -#define __NR_cacheflush		289 -#define __NR_ioprio_set		290 -#define __NR_ioprio_get		291 -#define __NR_inotify_init	292 -#define __NR_inotify_add_watch	293 -#define __NR_inotify_rm_watch	294 -#define __NR_migrate_pages	295 -#define __NR_openat		296 -#define __NR_mkdirat		297 -#define __NR_mknodat		298 -#define __NR_fchownat		299 -#define __NR_futimesat		300 -#define __NR_fstatat64		301 -#define __NR_unlinkat		302 -#define __NR_renameat		303 -#define __NR_linkat		304 -#define __NR_symlinkat		305 -#define __NR_readlinkat		306 -#define __NR_fchmodat		307 -#define __NR_faccessat		308 -#define __NR_pselect6		309 -#define __NR_ppoll		310 -#define __NR_unshare		311 -#define __NR_set_robust_list	312 -#define __NR_get_robust_list	313 -#define __NR_splice		314 -#define __NR_sync_file_range	315 -#define __NR_tee		316 -#define __NR_vmsplice		317 -#define __NR_move_pages		318 -#define __NR_getcpu		319 -#define __NR_epoll_pwait	320 -#define __NR_utimensat		321 -#define __NR_signalfd		322 -#define __NR_timerfd_create	323 -#define __NR_eventfd		324 -#define __NR_fallocate		325 -#define __NR_timerfd_settime	326 -#define __NR_timerfd_gettime	327 -#define __NR_signalfd4		328 -#define __NR_eventfd2		329 -#define __NR_epoll_create1	330 -#define __NR_dup3		331 -#define __NR_pipe2		332 -#define __NR_inotify_init1	333 -#define __NR_preadv		334 -#define __NR_pwritev		335 -#define __NR_rt_tgsigqueueinfo	336 -#define __NR_perf_event_open	337 -#define __NR_recvmmsg		338 -#ifdef __KERNEL__ - -#define NR_syscalls 339 +#define NR_syscalls 340  /*   * specify the deprecated syscalls we want to support on this arch   */ -#define __ARCH_WANT_IPC_PARSE_VERSION  #define __ARCH_WANT_OLD_READDIR  #define __ARCH_WANT_OLD_STAT  #define __ARCH_WANT_STAT64 @@ -365,7 +26,6 @@  #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 @@ -380,18 +40,8 @@  #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 +#define __ARCH_WANT_SYS_FORK +#define __ARCH_WANT_SYS_VFORK +#define __ARCH_WANT_SYS_CLONE -#endif /* __KERNEL__ */  #endif /* _ASM_UNISTD_H */  | 
