forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disintegrate asm/system.h for SH. Signed-off-by: David Howells <[email protected]> cc: [email protected]
- Loading branch information
Showing
56 changed files
with
503 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* 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() __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) | ||
|
||
#endif /* __ASM_SH_BARRIER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef __ASM_SH_BL_BIT_H | ||
#define __ASM_SH_BL_BIT_H | ||
|
||
#ifdef CONFIG_SUPERH32 | ||
# include "bl_bit_32.h" | ||
#else | ||
# include "bl_bit_64.h" | ||
#endif | ||
|
||
#endif /* __ASM_SH_BL_BIT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef __ASM_SH_CACHE_INSNS_H | ||
#define __ASM_SH_CACHE_INSNS_H | ||
|
||
|
||
#ifdef CONFIG_SUPERH32 | ||
# include "cache_insns_32.h" | ||
#else | ||
# include "cache_insns_64.h" | ||
#endif | ||
|
||
#endif /* __ASM_SH_CACHE_INSNS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima | ||
* Copyright (C) 2002 Paul Mundt | ||
*/ | ||
#ifndef __ASM_SH_EXEC_H | ||
#define __ASM_SH_EXEC_H | ||
|
||
#define arch_align_stack(x) (x) | ||
|
||
#endif /* __ASM_SH_EXEC_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.