aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc64')
-rw-r--r--include/asm-sparc64/Kbuild1
-rw-r--r--include/asm-sparc64/atomic.h53
-rw-r--r--include/asm-sparc64/const.h19
-rw-r--r--include/asm-sparc64/iommu.h1
-rw-r--r--include/asm-sparc64/kdebug.h23
-rw-r--r--include/asm-sparc64/local.h41
-rw-r--r--include/asm-sparc64/lsu.h2
-rw-r--r--include/asm-sparc64/mmu.h2
-rw-r--r--include/asm-sparc64/mmu_context.h1
-rw-r--r--include/asm-sparc64/page.h2
-rw-r--r--include/asm-sparc64/percpu.h10
-rw-r--r--include/asm-sparc64/pgalloc.h26
-rw-r--r--include/asm-sparc64/pgtable.h2
-rw-r--r--include/asm-sparc64/pstate.h2
-rw-r--r--include/asm-sparc64/scatterlist.h1
-rw-r--r--include/asm-sparc64/sfafsr.h2
-rw-r--r--include/asm-sparc64/system.h1
17 files changed, 62 insertions, 127 deletions
diff --git a/include/asm-sparc64/Kbuild b/include/asm-sparc64/Kbuild
index a7f44408c93b..854fd3a65acf 100644
--- a/include/asm-sparc64/Kbuild
+++ b/include/asm-sparc64/Kbuild
@@ -8,7 +8,6 @@ header-y += apb.h
8header-y += asi.h 8header-y += asi.h
9header-y += bbc.h 9header-y += bbc.h
10header-y += bpp.h 10header-y += bpp.h
11header-y += const.h
12header-y += display7seg.h 11header-y += display7seg.h
13header-y += envctrl.h 12header-y += envctrl.h
14header-y += ipc.h 13header-y += ipc.h
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 2f0bec26a695..3fb4e1f7f186 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -9,6 +9,7 @@
9#define __ARCH_SPARC64_ATOMIC__ 9#define __ARCH_SPARC64_ATOMIC__
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/system.h>
12 13
13typedef struct { volatile int counter; } atomic_t; 14typedef struct { volatile int counter; } atomic_t;
14typedef struct { volatile __s64 counter; } atomic64_t; 15typedef struct { volatile __s64 counter; } atomic64_t;
@@ -70,25 +71,47 @@ extern int atomic64_sub_ret(int, atomic64_t *);
70#define atomic_add_negative(i, v) (atomic_add_ret(i, v) < 0) 71#define atomic_add_negative(i, v) (atomic_add_ret(i, v) < 0)
71#define atomic64_add_negative(i, v) (atomic64_add_ret(i, v) < 0) 72#define atomic64_add_negative(i, v) (atomic64_add_ret(i, v) < 0)
72 73
73#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 74#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
74#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 75#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
75 76
76#define atomic_add_unless(v, a, u) \ 77static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
77({ \ 78{
78 int c, old; \ 79 int c, old;
79 c = atomic_read(v); \ 80 c = atomic_read(v);
80 for (;;) { \ 81 for (;;) {
81 if (unlikely(c == (u))) \ 82 if (unlikely(c == (u)))
82 break; \ 83 break;
83 old = atomic_cmpxchg((v), c, c + (a)); \ 84 old = atomic_cmpxchg((v), c, c + (a));
84 if (likely(old == c)) \ 85 if (likely(old == c))
85 break; \ 86 break;
86 c = old; \ 87 c = old;
87 } \ 88 }
88 likely(c != (u)); \ 89 return c != (u);
89}) 90}
91
90#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 92#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
91 93
94#define atomic64_cmpxchg(v, o, n) \
95 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
96#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
97
98static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
99{
100 long c, old;
101 c = atomic64_read(v);
102 for (;;) {
103 if (unlikely(c == (u)))
104 break;
105 old = atomic64_cmpxchg((v), c, c + (a));
106 if (likely(old == c))
107 break;
108 c = old;
109 }
110 return c != (u);
111}
112
113#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
114
92/* Atomic operations are already serializing */ 115/* Atomic operations are already serializing */
93#ifdef CONFIG_SMP 116#ifdef CONFIG_SMP
94#define smp_mb__before_atomic_dec() membar_storeload_loadload(); 117#define smp_mb__before_atomic_dec() membar_storeload_loadload();
diff --git a/include/asm-sparc64/const.h b/include/asm-sparc64/const.h
deleted file mode 100644
index 8ad902b2ce04..000000000000
--- a/include/asm-sparc64/const.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* const.h: Macros for dealing with constants. */
2
3#ifndef _SPARC64_CONST_H
4#define _SPARC64_CONST_H
5
6/* Some constant macros are used in both assembler and
7 * C code. Therefore we cannot annotate them always with
8 * 'UL' and other type specificers unilaterally. We
9 * use the following macros to deal with this.
10 */
11
12#ifdef __ASSEMBLY__
13#define _AC(X,Y) X
14#else
15#define _AC(X,Y) (X##Y)
16#endif
17
18
19#endif /* !(_SPARC64_CONST_H) */
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
index e199594a1e9b..0b1813f41045 100644
--- a/include/asm-sparc64/iommu.h
+++ b/include/asm-sparc64/iommu.h
@@ -32,6 +32,7 @@ struct iommu {
32 unsigned long iommu_control; 32 unsigned long iommu_control;
33 unsigned long iommu_tsbbase; 33 unsigned long iommu_tsbbase;
34 unsigned long iommu_flush; 34 unsigned long iommu_flush;
35 unsigned long iommu_flushinv;
35 unsigned long iommu_ctxflush; 36 unsigned long iommu_ctxflush;
36 unsigned long write_complete_reg; 37 unsigned long write_complete_reg;
37 unsigned long dummy_page; 38 unsigned long dummy_page;
diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h
index 11251bdd00cb..f8032e73f384 100644
--- a/include/asm-sparc64/kdebug.h
+++ b/include/asm-sparc64/kdebug.h
@@ -7,19 +7,8 @@
7 7
8struct pt_regs; 8struct pt_regs;
9 9
10struct die_args {
11 struct pt_regs *regs;
12 const char *str;
13 long err;
14 int trapnr;
15 int signr;
16};
17
18extern int register_die_notifier(struct notifier_block *);
19extern int unregister_die_notifier(struct notifier_block *);
20extern int register_page_fault_notifier(struct notifier_block *); 10extern int register_page_fault_notifier(struct notifier_block *);
21extern int unregister_page_fault_notifier(struct notifier_block *); 11extern int unregister_page_fault_notifier(struct notifier_block *);
22extern struct atomic_notifier_head sparc64die_chain;
23 12
24extern void bad_trap(struct pt_regs *, long); 13extern void bad_trap(struct pt_regs *, long);
25 14
@@ -36,16 +25,4 @@ enum die_val {
36 DIE_PAGE_FAULT, 25 DIE_PAGE_FAULT,
37}; 26};
38 27
39static inline int notify_die(enum die_val val,char *str, struct pt_regs *regs,
40 long err, int trap, int sig)
41{
42 struct die_args args = { .regs = regs,
43 .str = str,
44 .err = err,
45 .trapnr = trap,
46 .signr = sig };
47
48 return atomic_notifier_call_chain(&sparc64die_chain, val, &args);
49}
50
51#endif 28#endif
diff --git a/include/asm-sparc64/local.h b/include/asm-sparc64/local.h
index dfde115ac892..c11c530f74d0 100644
--- a/include/asm-sparc64/local.h
+++ b/include/asm-sparc64/local.h
@@ -1,40 +1 @@
1#ifndef _ARCH_SPARC64_LOCAL_H #include <asm-generic/local.h>
2#define _ARCH_SPARC64_LOCAL_H
3
4#include <linux/percpu.h>
5#include <asm/atomic.h>
6
7typedef atomic64_t local_t;
8
9#define LOCAL_INIT(i) ATOMIC64_INIT(i)
10#define local_read(v) atomic64_read(v)
11#define local_set(v,i) atomic64_set(v,i)
12
13#define local_inc(v) atomic64_inc(v)
14#define local_dec(v) atomic64_dec(v)
15#define local_add(i, v) atomic64_add(i, v)
16#define local_sub(i, v) atomic64_sub(i, v)
17
18#define __local_inc(v) ((v)->counter++)
19#define __local_dec(v) ((v)->counter--)
20#define __local_add(i,v) ((v)->counter+=(i))
21#define __local_sub(i,v) ((v)->counter-=(i))
22
23/* Use these for per-cpu local_t variables: on some archs they are
24 * much more efficient than these naive implementations. Note they take
25 * a variable, not an address.
26 */
27#define cpu_local_read(v) local_read(&__get_cpu_var(v))
28#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i))
29
30#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
31#define cpu_local_dec(v) local_dec(&__get_cpu_var(v))
32#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v))
33#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v))
34
35#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v))
36#define __cpu_local_dec(v) __local_dec(&__get_cpu_var(v))
37#define __cpu_local_add(i, v) __local_add((i), &__get_cpu_var(v))
38#define __cpu_local_sub(i, v) __local_sub((i), &__get_cpu_var(v))
39
40#endif /* _ARCH_SPARC64_LOCAL_H */
diff --git a/include/asm-sparc64/lsu.h b/include/asm-sparc64/lsu.h
index e5329c7f5833..79f109840c39 100644
--- a/include/asm-sparc64/lsu.h
+++ b/include/asm-sparc64/lsu.h
@@ -2,7 +2,7 @@
2#ifndef _SPARC64_LSU_H 2#ifndef _SPARC64_LSU_H
3#define _SPARC64_LSU_H 3#define _SPARC64_LSU_H
4 4
5#include <asm/const.h> 5#include <linux/const.h>
6 6
7/* LSU Control Register */ 7/* LSU Control Register */
8#define LSU_CONTROL_PM _AC(0x000001fe00000000,UL) /* Phys-watchpoint byte mask*/ 8#define LSU_CONTROL_PM _AC(0x000001fe00000000,UL) /* Phys-watchpoint byte mask*/
diff --git a/include/asm-sparc64/mmu.h b/include/asm-sparc64/mmu.h
index 70af4b6ce136..8abc58f0f9d7 100644
--- a/include/asm-sparc64/mmu.h
+++ b/include/asm-sparc64/mmu.h
@@ -1,8 +1,8 @@
1#ifndef __MMU_H 1#ifndef __MMU_H
2#define __MMU_H 2#define __MMU_H
3 3
4#include <linux/const.h>
4#include <asm/page.h> 5#include <asm/page.h>
5#include <asm/const.h>
6#include <asm/hypervisor.h> 6#include <asm/hypervisor.h>
7 7
8#define CTX_NR_BITS 13 8#define CTX_NR_BITS 13
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index 2337eb487719..8d129032013e 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -9,6 +9,7 @@
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <asm/system.h> 10#include <asm/system.h>
11#include <asm/spitfire.h> 11#include <asm/spitfire.h>
12#include <asm-generic/mm_hooks.h>
12 13
13static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 14static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
14{ 15{
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index ff736eafa64d..7af1077451ff 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -5,7 +5,7 @@
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8#include <asm/const.h> 8#include <linux/const.h>
9 9
10#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB) 10#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
11#define PAGE_SHIFT 13 11#define PAGE_SHIFT 13
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index 0d3df76aa47f..ced8cbde046d 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -5,16 +5,6 @@
5 5
6#ifdef CONFIG_SMP 6#ifdef CONFIG_SMP
7 7
8#ifdef CONFIG_MODULES
9# define PERCPU_MODULE_RESERVE 8192
10#else
11# define PERCPU_MODULE_RESERVE 0
12#endif
13
14#define PERCPU_ENOUGH_ROOM \
15 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
16 PERCPU_MODULE_RESERVE)
17
18extern void setup_per_cpu_areas(void); 8extern void setup_per_cpu_areas(void);
19 9
20extern unsigned long __per_cpu_base; 10extern unsigned long __per_cpu_base;
diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h
index 5891ff7ba760..5d66b858a965 100644
--- a/include/asm-sparc64/pgalloc.h
+++ b/include/asm-sparc64/pgalloc.h
@@ -6,6 +6,7 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/mm.h> 7#include <linux/mm.h>
8#include <linux/slab.h> 8#include <linux/slab.h>
9#include <linux/quicklist.h>
9 10
10#include <asm/spitfire.h> 11#include <asm/spitfire.h>
11#include <asm/cpudata.h> 12#include <asm/cpudata.h>
@@ -13,52 +14,50 @@
13#include <asm/page.h> 14#include <asm/page.h>
14 15
15/* Page table allocation/freeing. */ 16/* Page table allocation/freeing. */
16extern struct kmem_cache *pgtable_cache;
17 17
18static inline pgd_t *pgd_alloc(struct mm_struct *mm) 18static inline pgd_t *pgd_alloc(struct mm_struct *mm)
19{ 19{
20 return kmem_cache_alloc(pgtable_cache, GFP_KERNEL); 20 return quicklist_alloc(0, GFP_KERNEL, NULL);
21} 21}
22 22
23static inline void pgd_free(pgd_t *pgd) 23static inline void pgd_free(pgd_t *pgd)
24{ 24{
25 kmem_cache_free(pgtable_cache, pgd); 25 quicklist_free(0, NULL, pgd);
26} 26}
27 27
28#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) 28#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
29 29
30static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 30static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
31{ 31{
32 return kmem_cache_alloc(pgtable_cache, 32 return quicklist_alloc(0, GFP_KERNEL, NULL);
33 GFP_KERNEL|__GFP_REPEAT);
34} 33}
35 34
36static inline void pmd_free(pmd_t *pmd) 35static inline void pmd_free(pmd_t *pmd)
37{ 36{
38 kmem_cache_free(pgtable_cache, pmd); 37 quicklist_free(0, NULL, pmd);
39} 38}
40 39
41static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 40static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
42 unsigned long address) 41 unsigned long address)
43{ 42{
44 return kmem_cache_alloc(pgtable_cache, 43 return quicklist_alloc(0, GFP_KERNEL, NULL);
45 GFP_KERNEL|__GFP_REPEAT);
46} 44}
47 45
48static inline struct page *pte_alloc_one(struct mm_struct *mm, 46static inline struct page *pte_alloc_one(struct mm_struct *mm,
49 unsigned long address) 47 unsigned long address)
50{ 48{
51 return virt_to_page(pte_alloc_one_kernel(mm, address)); 49 void *pg = quicklist_alloc(0, GFP_KERNEL, NULL);
50 return pg ? virt_to_page(pg) : NULL;
52} 51}
53 52
54static inline void pte_free_kernel(pte_t *pte) 53static inline void pte_free_kernel(pte_t *pte)
55{ 54{
56 kmem_cache_free(pgtable_cache, pte); 55 quicklist_free(0, NULL, pte);
57} 56}
58 57
59static inline void pte_free(struct page *ptepage) 58static inline void pte_free(struct page *ptepage)
60{ 59{
61 pte_free_kernel(page_address(ptepage)); 60 quicklist_free_page(0, NULL, ptepage);
62} 61}
63 62
64 63
@@ -66,6 +65,9 @@ static inline void pte_free(struct page *ptepage)
66#define pmd_populate(MM,PMD,PTE_PAGE) \ 65#define pmd_populate(MM,PMD,PTE_PAGE) \
67 pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE)) 66 pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
68 67
69#define check_pgt_cache() do { } while (0) 68static inline void check_pgt_cache(void)
69{
70 quicklist_trim(0, NULL, 25, 16);
71}
70 72
71#endif /* _SPARC64_PGALLOC_H */ 73#endif /* _SPARC64_PGALLOC_H */
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 46705ef47d27..9e80ad43b29c 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -15,13 +15,13 @@
15#include <asm-generic/pgtable-nopud.h> 15#include <asm-generic/pgtable-nopud.h>
16 16
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/const.h>
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/spitfire.h> 20#include <asm/spitfire.h>
20#include <asm/asi.h> 21#include <asm/asi.h>
21#include <asm/system.h> 22#include <asm/system.h>
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/processor.h> 24#include <asm/processor.h>
24#include <asm/const.h>
25 25
26/* The kernel image occupies 0x4000000 to 0x1000000 (4MB --> 32MB). 26/* The kernel image occupies 0x4000000 to 0x1000000 (4MB --> 32MB).
27 * The page copy blockops can use 0x2000000 to 0x4000000. 27 * The page copy blockops can use 0x2000000 to 0x4000000.
diff --git a/include/asm-sparc64/pstate.h b/include/asm-sparc64/pstate.h
index 49a7924a89ab..f3c45484c636 100644
--- a/include/asm-sparc64/pstate.h
+++ b/include/asm-sparc64/pstate.h
@@ -2,7 +2,7 @@
2#ifndef _SPARC64_PSTATE_H 2#ifndef _SPARC64_PSTATE_H
3#define _SPARC64_PSTATE_H 3#define _SPARC64_PSTATE_H
4 4
5#include <asm/const.h> 5#include <linux/const.h>
6 6
7/* The V9 PSTATE Register (with SpitFire extensions). 7/* The V9 PSTATE Register (with SpitFire extensions).
8 * 8 *
diff --git a/include/asm-sparc64/scatterlist.h b/include/asm-sparc64/scatterlist.h
index ec4f3c63fe98..048fdb40e81d 100644
--- a/include/asm-sparc64/scatterlist.h
+++ b/include/asm-sparc64/scatterlist.h
@@ -3,6 +3,7 @@
3#define _SPARC64_SCATTERLIST_H 3#define _SPARC64_SCATTERLIST_H
4 4
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/types.h>
6 7
7struct scatterlist { 8struct scatterlist {
8 struct page *page; 9 struct page *page;
diff --git a/include/asm-sparc64/sfafsr.h b/include/asm-sparc64/sfafsr.h
index 2f792c20b53c..e96137b04a4f 100644
--- a/include/asm-sparc64/sfafsr.h
+++ b/include/asm-sparc64/sfafsr.h
@@ -1,7 +1,7 @@
1#ifndef _SPARC64_SFAFSR_H 1#ifndef _SPARC64_SFAFSR_H
2#define _SPARC64_SFAFSR_H 2#define _SPARC64_SFAFSR_H
3 3
4#include <asm/const.h> 4#include <linux/const.h>
5 5
6/* Spitfire Asynchronous Fault Status register, ASI=0x4C VA<63:0>=0x0 */ 6/* Spitfire Asynchronous Fault Status register, ASI=0x4C VA<63:0>=0x0 */
7 7
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 32281acb878b..8ba380ec6daa 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -253,7 +253,6 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long
253} 253}
254 254
255#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 255#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
256#define tas(ptr) (xchg((ptr),1))
257 256
258extern void __xchg_called_with_bad_pointer(void); 257extern void __xchg_called_with_bad_pointer(void);
259 258