diff options
Diffstat (limited to 'include/asm-m32r')
-rw-r--r-- | include/asm-m32r/ide.h | 10 | ||||
-rw-r--r-- | include/asm-m32r/kvm.h | 6 | ||||
-rw-r--r-- | include/asm-m32r/pgtable.h | 10 | ||||
-rw-r--r-- | include/asm-m32r/semaphore.h | 145 |
4 files changed, 17 insertions, 154 deletions
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h index 5d2044e529ab..1e7f6474d130 100644 --- a/include/asm-m32r/ide.h +++ b/include/asm-m32r/ide.h | |||
@@ -23,8 +23,6 @@ | |||
23 | # endif | 23 | # endif |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #define IDE_ARCH_OBSOLETE_DEFAULTS | ||
27 | |||
28 | static __inline__ int ide_default_irq(unsigned long base) | 26 | static __inline__ int ide_default_irq(unsigned long base) |
29 | { | 27 | { |
30 | switch (base) { | 28 | switch (base) { |
@@ -65,14 +63,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
65 | } | 63 | } |
66 | } | 64 | } |
67 | 65 | ||
68 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
69 | |||
70 | #ifdef CONFIG_BLK_DEV_IDEPCI | ||
71 | #define ide_init_default_irq(base) (0) | ||
72 | #else | ||
73 | #define ide_init_default_irq(base) ide_default_irq(base) | ||
74 | #endif | ||
75 | |||
76 | #include <asm-generic/ide_iops.h> | 66 | #include <asm-generic/ide_iops.h> |
77 | 67 | ||
78 | #endif /* __KERNEL__ */ | 68 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-m32r/kvm.h b/include/asm-m32r/kvm.h new file mode 100644 index 000000000000..99a40515b77e --- /dev/null +++ b/include/asm-m32r/kvm.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __LINUX_KVM_M32R_H | ||
2 | #define __LINUX_KVM_M32R_H | ||
3 | |||
4 | /* m32r does not support KVM */ | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h index 86505387be08..e6359c566b50 100644 --- a/include/asm-m32r/pgtable.h +++ b/include/asm-m32r/pgtable.h | |||
@@ -214,6 +214,11 @@ static inline int pte_file(pte_t pte) | |||
214 | return pte_val(pte) & _PAGE_FILE; | 214 | return pte_val(pte) & _PAGE_FILE; |
215 | } | 215 | } |
216 | 216 | ||
217 | static inline int pte_special(pte_t pte) | ||
218 | { | ||
219 | return 0; | ||
220 | } | ||
221 | |||
217 | static inline pte_t pte_mkclean(pte_t pte) | 222 | static inline pte_t pte_mkclean(pte_t pte) |
218 | { | 223 | { |
219 | pte_val(pte) &= ~_PAGE_DIRTY; | 224 | pte_val(pte) &= ~_PAGE_DIRTY; |
@@ -250,6 +255,11 @@ static inline pte_t pte_mkwrite(pte_t pte) | |||
250 | return pte; | 255 | return pte; |
251 | } | 256 | } |
252 | 257 | ||
258 | static inline pte_t pte_mkspecial(pte_t pte) | ||
259 | { | ||
260 | return pte; | ||
261 | } | ||
262 | |||
253 | static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) | 263 | static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) |
254 | { | 264 | { |
255 | return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); | 265 | return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); |
diff --git a/include/asm-m32r/semaphore.h b/include/asm-m32r/semaphore.h index b5bf95a6f2b4..d9b2034ed1d2 100644 --- a/include/asm-m32r/semaphore.h +++ b/include/asm-m32r/semaphore.h | |||
@@ -1,144 +1 @@ | |||
1 | #ifndef _ASM_M32R_SEMAPHORE_H | #include <linux/semaphore.h> | |
2 | #define _ASM_M32R_SEMAPHORE_H | ||
3 | |||
4 | #include <linux/linkage.h> | ||
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | |||
8 | /* | ||
9 | * SMP- and interrupt-safe semaphores.. | ||
10 | * | ||
11 | * Copyright (C) 1996 Linus Torvalds | ||
12 | * Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org> | ||
13 | */ | ||
14 | |||
15 | #include <linux/wait.h> | ||
16 | #include <linux/rwsem.h> | ||
17 | #include <asm/assembler.h> | ||
18 | #include <asm/system.h> | ||
19 | #include <asm/atomic.h> | ||
20 | |||
21 | struct semaphore { | ||
22 | atomic_t count; | ||
23 | int sleepers; | ||
24 | wait_queue_head_t wait; | ||
25 | }; | ||
26 | |||
27 | #define __SEMAPHORE_INITIALIZER(name, n) \ | ||
28 | { \ | ||
29 | .count = ATOMIC_INIT(n), \ | ||
30 | .sleepers = 0, \ | ||
31 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ | ||
32 | } | ||
33 | |||
34 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ | ||
35 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) | ||
36 | |||
37 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) | ||
38 | |||
39 | static inline void sema_init (struct semaphore *sem, int val) | ||
40 | { | ||
41 | /* | ||
42 | * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); | ||
43 | * | ||
44 | * i'd rather use the more flexible initialization above, but sadly | ||
45 | * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well. | ||
46 | */ | ||
47 | atomic_set(&sem->count, val); | ||
48 | sem->sleepers = 0; | ||
49 | init_waitqueue_head(&sem->wait); | ||
50 | } | ||
51 | |||
52 | static inline void init_MUTEX (struct semaphore *sem) | ||
53 | { | ||
54 | sema_init(sem, 1); | ||
55 | } | ||
56 | |||
57 | static inline void init_MUTEX_LOCKED (struct semaphore *sem) | ||
58 | { | ||
59 | sema_init(sem, 0); | ||
60 | } | ||
61 | |||
62 | asmlinkage void __down_failed(void /* special register calling convention */); | ||
63 | asmlinkage int __down_failed_interruptible(void /* params in registers */); | ||
64 | asmlinkage int __down_failed_trylock(void /* params in registers */); | ||
65 | asmlinkage void __up_wakeup(void /* special register calling convention */); | ||
66 | |||
67 | asmlinkage void __down(struct semaphore * sem); | ||
68 | asmlinkage int __down_interruptible(struct semaphore * sem); | ||
69 | asmlinkage int __down_trylock(struct semaphore * sem); | ||
70 | asmlinkage void __up(struct semaphore * sem); | ||
71 | |||
72 | /* | ||
73 | * Atomically decrement the semaphore's count. If it goes negative, | ||
74 | * block the calling thread in the TASK_UNINTERRUPTIBLE state. | ||
75 | */ | ||
76 | static inline void down(struct semaphore * sem) | ||
77 | { | ||
78 | might_sleep(); | ||
79 | if (unlikely(atomic_dec_return(&sem->count) < 0)) | ||
80 | __down(sem); | ||
81 | } | ||
82 | |||
83 | /* | ||
84 | * Interruptible try to acquire a semaphore. If we obtained | ||
85 | * it, return zero. If we were interrupted, returns -EINTR | ||
86 | */ | ||
87 | static inline int down_interruptible(struct semaphore * sem) | ||
88 | { | ||
89 | int result = 0; | ||
90 | |||
91 | might_sleep(); | ||
92 | if (unlikely(atomic_dec_return(&sem->count) < 0)) | ||
93 | result = __down_interruptible(sem); | ||
94 | |||
95 | return result; | ||
96 | } | ||
97 | |||
98 | /* | ||
99 | * Non-blockingly attempt to down() a semaphore. | ||
100 | * Returns zero if we acquired it | ||
101 | */ | ||
102 | static inline int down_trylock(struct semaphore * sem) | ||
103 | { | ||
104 | unsigned long flags; | ||
105 | long count; | ||
106 | int result = 0; | ||
107 | |||
108 | local_irq_save(flags); | ||
109 | __asm__ __volatile__ ( | ||
110 | "# down_trylock \n\t" | ||
111 | DCACHE_CLEAR("%0", "r4", "%1") | ||
112 | M32R_LOCK" %0, @%1; \n\t" | ||
113 | "addi %0, #-1; \n\t" | ||
114 | M32R_UNLOCK" %0, @%1; \n\t" | ||
115 | : "=&r" (count) | ||
116 | : "r" (&sem->count) | ||
117 | : "memory" | ||
118 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
119 | , "r4" | ||
120 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
121 | ); | ||
122 | local_irq_restore(flags); | ||
123 | |||
124 | if (unlikely(count < 0)) | ||
125 | result = __down_trylock(sem); | ||
126 | |||
127 | return result; | ||
128 | } | ||
129 | |||
130 | /* | ||
131 | * Note! This is subtle. We jump to wake people up only if | ||
132 | * the semaphore was negative (== somebody was waiting on it). | ||
133 | * The default case (no contention) will result in NO | ||
134 | * jumps for both down() and up(). | ||
135 | */ | ||
136 | static inline void up(struct semaphore * sem) | ||
137 | { | ||
138 | if (unlikely(atomic_inc_return(&sem->count) <= 0)) | ||
139 | __up(sem); | ||
140 | } | ||
141 | |||
142 | #endif /* __KERNEL__ */ | ||
143 | |||
144 | #endif /* _ASM_M32R_SEMAPHORE_H */ | ||