aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-h8300
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-h8300
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-h8300')
-rw-r--r--include/asm-h8300/a.out.h26
-rw-r--r--include/asm-h8300/atomic.h113
-rw-r--r--include/asm-h8300/bitops.h410
-rw-r--r--include/asm-h8300/bootinfo.h2
-rw-r--r--include/asm-h8300/bug.h4
-rw-r--r--include/asm-h8300/bugs.h16
-rw-r--r--include/asm-h8300/byteorder.h13
-rw-r--r--include/asm-h8300/cache.h12
-rw-r--r--include/asm-h8300/cachectl.h14
-rw-r--r--include/asm-h8300/cacheflush.h38
-rw-r--r--include/asm-h8300/checksum.h105
-rw-r--r--include/asm-h8300/cputime.h6
-rw-r--r--include/asm-h8300/current.h25
-rw-r--r--include/asm-h8300/dbg.h2
-rw-r--r--include/asm-h8300/delay.h38
-rw-r--r--include/asm-h8300/div64.h1
-rw-r--r--include/asm-h8300/dma-mapping.h1
-rw-r--r--include/asm-h8300/dma.h16
-rw-r--r--include/asm-h8300/elf.h107
-rw-r--r--include/asm-h8300/errno.h6
-rw-r--r--include/asm-h8300/fcntl.h87
-rw-r--r--include/asm-h8300/flat.h26
-rw-r--r--include/asm-h8300/fpu.h1
-rw-r--r--include/asm-h8300/gpio.h52
-rw-r--r--include/asm-h8300/hardirq.h27
-rw-r--r--include/asm-h8300/hdreg.h15
-rw-r--r--include/asm-h8300/hw_irq.h1
-rw-r--r--include/asm-h8300/ide.h26
-rw-r--r--include/asm-h8300/io.h333
-rw-r--r--include/asm-h8300/ioctl.h80
-rw-r--r--include/asm-h8300/ioctls.h81
-rw-r--r--include/asm-h8300/ipc.h1
-rw-r--r--include/asm-h8300/ipcbuf.h29
-rw-r--r--include/asm-h8300/irq.h75
-rw-r--r--include/asm-h8300/keyboard.h33
-rw-r--r--include/asm-h8300/kmap_types.h19
-rw-r--r--include/asm-h8300/linkage.h8
-rw-r--r--include/asm-h8300/local.h6
-rw-r--r--include/asm-h8300/mc146818rtc.h9
-rw-r--r--include/asm-h8300/md.h13
-rw-r--r--include/asm-h8300/mman.h40
-rw-r--r--include/asm-h8300/mmu.h11
-rw-r--r--include/asm-h8300/mmu_context.h32
-rw-r--r--include/asm-h8300/module.h13
-rw-r--r--include/asm-h8300/msgbuf.h31
-rw-r--r--include/asm-h8300/namei.h17
-rw-r--r--include/asm-h8300/page.h104
-rw-r--r--include/asm-h8300/page_offset.h4
-rw-r--r--include/asm-h8300/param.h23
-rw-r--r--include/asm-h8300/pci.h29
-rw-r--r--include/asm-h8300/percpu.h6
-rw-r--r--include/asm-h8300/pgalloc.h8
-rw-r--r--include/asm-h8300/pgtable.h79
-rw-r--r--include/asm-h8300/poll.h22
-rw-r--r--include/asm-h8300/posix_types.h64
-rw-r--r--include/asm-h8300/processor.h135
-rw-r--r--include/asm-h8300/ptrace.h64
-rw-r--r--include/asm-h8300/regs267x.h336
-rw-r--r--include/asm-h8300/regs306x.h212
-rw-r--r--include/asm-h8300/resource.h6
-rw-r--r--include/asm-h8300/scatterlist.h13
-rw-r--r--include/asm-h8300/sections.h6
-rw-r--r--include/asm-h8300/segment.h49
-rw-r--r--include/asm-h8300/semaphore-helper.h86
-rw-r--r--include/asm-h8300/semaphore.h194
-rw-r--r--include/asm-h8300/sembuf.h25
-rw-r--r--include/asm-h8300/setup.h6
-rw-r--r--include/asm-h8300/sh_bios.h29
-rw-r--r--include/asm-h8300/shm.h32
-rw-r--r--include/asm-h8300/shmbuf.h42
-rw-r--r--include/asm-h8300/shmparam.h6
-rw-r--r--include/asm-h8300/sigcontext.h18
-rw-r--r--include/asm-h8300/siginfo.h6
-rw-r--r--include/asm-h8300/signal.h185
-rw-r--r--include/asm-h8300/smp.h1
-rw-r--r--include/asm-h8300/socket.h50
-rw-r--r--include/asm-h8300/sockios.h12
-rw-r--r--include/asm-h8300/spinlock.h6
-rw-r--r--include/asm-h8300/stat.h78
-rw-r--r--include/asm-h8300/statfs.h6
-rw-r--r--include/asm-h8300/string.h44
-rw-r--r--include/asm-h8300/system.h149
-rw-r--r--include/asm-h8300/target_time.h4
-rw-r--r--include/asm-h8300/termbits.h175
-rw-r--r--include/asm-h8300/termios.h108
-rw-r--r--include/asm-h8300/thread_info.h109
-rw-r--r--include/asm-h8300/timex.h19
-rw-r--r--include/asm-h8300/tlb.h23
-rw-r--r--include/asm-h8300/tlbflush.h61
-rw-r--r--include/asm-h8300/topology.h6
-rw-r--r--include/asm-h8300/traps.h37
-rw-r--r--include/asm-h8300/types.h67
-rw-r--r--include/asm-h8300/uaccess.h171
-rw-r--r--include/asm-h8300/ucontext.h12
-rw-r--r--include/asm-h8300/unaligned.h16
-rw-r--r--include/asm-h8300/unistd.h555
-rw-r--r--include/asm-h8300/user.h76
-rw-r--r--include/asm-h8300/virtconvert.h23
98 files changed, 5618 insertions, 0 deletions
diff --git a/include/asm-h8300/a.out.h b/include/asm-h8300/a.out.h
new file mode 100644
index 000000000000..3c70939f9f00
--- /dev/null
+++ b/include/asm-h8300/a.out.h
@@ -0,0 +1,26 @@
1#ifndef __H8300_A_OUT_H__
2#define __H8300_A_OUT_H__
3
4struct exec
5{
6 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#ifdef __KERNEL__
21
22#define STACK_TOP TASK_SIZE
23
24#endif
25
26#endif /* __H8300_A_OUT_H__ */
diff --git a/include/asm-h8300/atomic.h b/include/asm-h8300/atomic.h
new file mode 100644
index 000000000000..7230f6507995
--- /dev/null
+++ b/include/asm-h8300/atomic.h
@@ -0,0 +1,113 @@
1#ifndef __ARCH_H8300_ATOMIC__
2#define __ARCH_H8300_ATOMIC__
3
4/*
5 * Atomic operations that C can't guarantee us. Useful for
6 * resource counting etc..
7 */
8
9typedef struct { int counter; } atomic_t;
10#define ATOMIC_INIT(i) { (i) }
11
12#define atomic_read(v) ((v)->counter)
13#define atomic_set(v, i) (((v)->counter) = i)
14
15#include <asm/system.h>
16#include <linux/kernel.h>
17
18static __inline__ int atomic_add_return(int i, atomic_t *v)
19{
20 int ret,flags;
21 local_irq_save(flags);
22 ret = v->counter += i;
23 local_irq_restore(flags);
24 return ret;
25}
26
27#define atomic_add(i, v) atomic_add_return(i, v)
28#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
29
30static __inline__ int atomic_sub_return(int i, atomic_t *v)
31{
32 int ret,flags;
33 local_irq_save(flags);
34 ret = v->counter -= i;
35 local_irq_restore(flags);
36 return ret;
37}
38
39#define atomic_sub(i, v) atomic_sub_return(i, v)
40
41static __inline__ int atomic_inc_return(atomic_t *v)
42{
43 int ret,flags;
44 local_irq_save(flags);
45 v->counter++;
46 ret = v->counter;
47 local_irq_restore(flags);
48 return ret;
49}
50
51#define atomic_inc(v) atomic_inc_return(v)
52
53/*
54 * atomic_inc_and_test - increment and test
55 * @v: pointer of type atomic_t
56 *
57 * Atomically increments @v by 1
58 * and returns true if the result is zero, or false for all
59 * other cases.
60 */
61#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
62
63static __inline__ int atomic_dec_return(atomic_t *v)
64{
65 int ret,flags;
66 local_irq_save(flags);
67 --v->counter;
68 ret = v->counter;
69 local_irq_restore(flags);
70 return ret;
71}
72
73#define atomic_dec(v) atomic_dec_return(v)
74
75static __inline__ int atomic_dec_and_test(atomic_t *v)
76{
77 int ret,flags;
78 local_irq_save(flags);
79 --v->counter;
80 ret = v->counter;
81 local_irq_restore(flags);
82 return ret == 0;
83}
84
85static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *v)
86{
87 __asm__ __volatile__("stc ccr,r1l\n\t"
88 "orc #0x80,ccr\n\t"
89 "mov.l %0,er0\n\t"
90 "and.l %1,er0\n\t"
91 "mov.l er0,%0\n\t"
92 "ldc r1l,ccr"
93 : "=m" (*v) : "g" (~(mask)) :"er0","er1");
94}
95
96static __inline__ void atomic_set_mask(unsigned long mask, unsigned long *v)
97{
98 __asm__ __volatile__("stc ccr,r1l\n\t"
99 "orc #0x80,ccr\n\t"
100 "mov.l %0,er0\n\t"
101 "or.l %1,er0\n\t"
102 "mov.l er0,%0\n\t"
103 "ldc r1l,ccr"
104 : "=m" (*v) : "g" (mask) :"er0","er1");
105}
106
107/* Atomic operations are already serializing */
108#define smp_mb__before_atomic_dec() barrier()
109#define smp_mb__after_atomic_dec() barrier()
110#define smp_mb__before_atomic_inc() barrier()
111#define smp_mb__after_atomic_inc() barrier()
112
113#endif /* __ARCH_H8300_ATOMIC __ */
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h
new file mode 100644
index 000000000000..5036f595f8c9
--- /dev/null
+++ b/include/asm-h8300/bitops.h
@@ -0,0 +1,410 @@
1#ifndef _H8300_BITOPS_H
2#define _H8300_BITOPS_H
3
4/*
5 * Copyright 1992, Linus Torvalds.
6 * Copyright 2002, Yoshinori Sato
7 */
8
9#include <linux/config.h>
10#include <linux/compiler.h>
11#include <asm/byteorder.h> /* swab32 */
12#include <asm/system.h>
13
14#ifdef __KERNEL__
15/*
16 * Function prototypes to keep gcc -Wall happy
17 */
18
19/*
20 * ffz = Find First Zero in word. Undefined if no zero exists,
21 * so code should check against ~0UL first..
22 */
23static __inline__ unsigned long ffz(unsigned long word)
24{
25 unsigned long result;
26
27 result = -1;
28 __asm__("1:\n\t"
29 "shlr.l %2\n\t"
30 "adds #1,%0\n\t"
31 "bcs 1b"
32 : "=r" (result)
33 : "0" (result),"r" (word));
34 return result;
35}
36
37#define H8300_GEN_BITOP_CONST(OP,BIT) \
38 case BIT: \
39 __asm__(OP " #" #BIT ",@%0"::"r"(b_addr):"memory"); \
40 break;
41
42#define H8300_GEN_BITOP(FNAME,OP) \
43static __inline__ void FNAME(int nr, volatile unsigned long* addr) \
44{ \
45 volatile unsigned char *b_addr; \
46 b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
47 if (__builtin_constant_p(nr)) { \
48 switch(nr & 7) { \
49 H8300_GEN_BITOP_CONST(OP,0) \
50 H8300_GEN_BITOP_CONST(OP,1) \
51 H8300_GEN_BITOP_CONST(OP,2) \
52 H8300_GEN_BITOP_CONST(OP,3) \
53 H8300_GEN_BITOP_CONST(OP,4) \
54 H8300_GEN_BITOP_CONST(OP,5) \
55 H8300_GEN_BITOP_CONST(OP,6) \
56 H8300_GEN_BITOP_CONST(OP,7) \
57 } \
58 } else { \
59 __asm__(OP " %w0,@%1"::"r"(nr),"r"(b_addr):"memory"); \
60 } \
61}
62
63/*
64 * clear_bit() doesn't provide any barrier for the compiler.
65 */
66#define smp_mb__before_clear_bit() barrier()
67#define smp_mb__after_clear_bit() barrier()
68
69H8300_GEN_BITOP(set_bit ,"bset")
70H8300_GEN_BITOP(clear_bit ,"bclr")
71H8300_GEN_BITOP(change_bit,"bnot")
72#define __set_bit(nr,addr) set_bit((nr),(addr))
73#define __clear_bit(nr,addr) clear_bit((nr),(addr))
74#define __change_bit(nr,addr) change_bit((nr),(addr))
75
76#undef H8300_GEN_BITOP
77#undef H8300_GEN_BITOP_CONST
78
79static __inline__ int test_bit(int nr, const unsigned long* addr)
80{
81 return (*((volatile unsigned char *)addr +
82 ((nr >> 3) ^ 3)) & (1UL << (nr & 7))) != 0;
83}
84
85#define __test_bit(nr, addr) test_bit(nr, addr)
86
87#define H8300_GEN_TEST_BITOP_CONST_INT(OP,BIT) \
88 case BIT: \
89 __asm__("stc ccr,%w1\n\t" \
90 "orc #0x80,ccr\n\t" \
91 "bld #" #BIT ",@%4\n\t" \
92 OP " #" #BIT ",@%4\n\t" \
93 "rotxl.l %0\n\t" \
94 "ldc %w1,ccr" \
95 : "=r"(retval),"=&r"(ccrsave),"=m"(*b_addr) \
96 : "0" (retval),"r" (b_addr) \
97 : "memory"); \
98 break;
99
100#define H8300_GEN_TEST_BITOP_CONST(OP,BIT) \
101 case BIT: \
102 __asm__("bld #" #BIT ",@%3\n\t" \
103 OP " #" #BIT ",@%3\n\t" \
104 "rotxl.l %0\n\t" \
105 : "=r"(retval),"=m"(*b_addr) \
106 : "0" (retval),"r" (b_addr) \
107 : "memory"); \
108 break;
109
110#define H8300_GEN_TEST_BITOP(FNNAME,OP) \
111static __inline__ int FNNAME(int nr, volatile void * addr) \
112{ \
113 int retval = 0; \
114 char ccrsave; \
115 volatile unsigned char *b_addr; \
116 b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
117 if (__builtin_constant_p(nr)) { \
118 switch(nr & 7) { \
119 H8300_GEN_TEST_BITOP_CONST_INT(OP,0) \
120 H8300_GEN_TEST_BITOP_CONST_INT(OP,1) \
121 H8300_GEN_TEST_BITOP_CONST_INT(OP,2) \
122 H8300_GEN_TEST_BITOP_CONST_INT(OP,3) \
123 H8300_GEN_TEST_BITOP_CONST_INT(OP,4) \
124 H8300_GEN_TEST_BITOP_CONST_INT(OP,5) \
125 H8300_GEN_TEST_BITOP_CONST_INT(OP,6) \
126 H8300_GEN_TEST_BITOP_CONST_INT(OP,7) \
127 } \
128 } else { \
129 __asm__("stc ccr,%w1\n\t" \
130 "orc #0x80,ccr\n\t" \
131 "btst %w5,@%4\n\t" \
132 OP " %w5,@%4\n\t" \
133 "beq 1f\n\t" \
134 "inc.l #1,%0\n" \
135 "1:\n\t" \
136 "ldc %w1,ccr" \
137 : "=r"(retval),"=&r"(ccrsave),"=m"(*b_addr) \
138 : "0" (retval),"r" (b_addr),"r"(nr) \
139 : "memory"); \
140 } \
141 return retval; \
142} \
143 \
144static __inline__ int __ ## FNNAME(int nr, volatile void * addr) \
145{ \
146 int retval = 0; \
147 volatile unsigned char *b_addr; \
148 b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
149 if (__builtin_constant_p(nr)) { \
150 switch(nr & 7) { \
151 H8300_GEN_TEST_BITOP_CONST(OP,0) \
152 H8300_GEN_TEST_BITOP_CONST(OP,1) \
153 H8300_GEN_TEST_BITOP_CONST(OP,2) \
154 H8300_GEN_TEST_BITOP_CONST(OP,3) \
155 H8300_GEN_TEST_BITOP_CONST(OP,4) \
156 H8300_GEN_TEST_BITOP_CONST(OP,5) \
157 H8300_GEN_TEST_BITOP_CONST(OP,6) \
158 H8300_GEN_TEST_BITOP_CONST(OP,7) \
159 } \
160 } else { \
161 __asm__("btst %w4,@%3\n\t" \
162 OP " %w4,@%3\n\t" \
163 "beq 1f\n\t" \
164 "inc.l #1,%0\n" \
165 "1:" \
166 : "=r"(retval),"=m"(*b_addr) \
167 : "0" (retval),"r" (b_addr),"r"(nr) \
168 : "memory"); \
169 } \
170 return retval; \
171}
172
173H8300_GEN_TEST_BITOP(test_and_set_bit, "bset")
174H8300_GEN_TEST_BITOP(test_and_clear_bit, "bclr")
175H8300_GEN_TEST_BITOP(test_and_change_bit,"bnot")
176#undef H8300_GEN_TEST_BITOP_CONST
177#undef H8300_GEN_TEST_BITOP_CONST_INT
178#undef H8300_GEN_TEST_BITOP
179
180#define find_first_zero_bit(addr, size) \
181 find_next_zero_bit((addr), (size), 0)
182
183#define ffs(x) generic_ffs(x)
184
185static __inline__ unsigned long __ffs(unsigned long word)
186{
187 unsigned long result;
188
189 result = -1;
190 __asm__("1:\n\t"
191 "shlr.l %2\n\t"
192 "adds #1,%0\n\t"
193 "bcc 1b"
194 : "=r" (result)
195 : "0"(result),"r"(word));
196 return result;
197}
198
199static __inline__ int find_next_zero_bit (const unsigned long * addr, int size, int offset)
200{
201 unsigned long *p = (unsigned long *)(((unsigned long)addr + (offset >> 3)) & ~3);
202 unsigned long result = offset & ~31UL;
203 unsigned long tmp;
204
205 if (offset >= size)
206 return size;
207 size -= result;
208 offset &= 31UL;
209 if (offset) {
210 tmp = *(p++);
211 tmp |= ~0UL >> (32-offset);
212 if (size < 32)
213 goto found_first;
214 if (~tmp)
215 goto found_middle;
216 size -= 32;
217 result += 32;
218 }
219 while (size & ~31UL) {
220 if (~(tmp = *(p++)))
221 goto found_middle;
222 result += 32;
223 size -= 32;
224 }
225 if (!size)
226 return result;
227 tmp = *p;
228
229found_first:
230 tmp |= ~0UL >> size;
231found_middle:
232 return result + ffz(tmp);
233}
234
235static __inline__ unsigned long find_next_bit(const unsigned long *addr,
236 unsigned long size, unsigned long offset)
237{
238 unsigned long *p = (unsigned long *)(((unsigned long)addr + (offset >> 3)) & ~3);
239 unsigned int result = offset & ~31UL;
240 unsigned int tmp;
241
242 if (offset >= size)
243 return size;
244 size -= result;
245 offset &= 31UL;
246 if (offset) {
247 tmp = *(p++);
248 tmp &= ~0UL << offset;
249 if (size < 32)
250 goto found_first;
251 if (tmp)
252 goto found_middle;
253 size -= 32;
254 result += 32;
255 }
256 while (size >= 32) {
257 if ((tmp = *p++) != 0)
258 goto found_middle;
259 result += 32;
260 size -= 32;
261 }
262 if (!size)
263 return result;
264 tmp = *p;
265
266found_first:
267 tmp &= ~0UL >> (32 - size);
268 if (tmp == 0UL)
269 return result + size;
270found_middle:
271 return result + __ffs(tmp);
272}
273
274#define find_first_bit(addr, size) find_next_bit(addr, size, 0)
275
276/*
277 * Every architecture must define this function. It's the fastest
278 * way of searching a 140-bit bitmap where the first 100 bits are
279 * unlikely to be set. It's guaranteed that at least one of the 140
280 * bits is cleared.
281 */
282static inline int sched_find_first_bit(unsigned long *b)
283{
284 if (unlikely(b[0]))
285 return __ffs(b[0]);
286 if (unlikely(b[1]))
287 return __ffs(b[1]) + 32;
288 if (unlikely(b[2]))
289 return __ffs(b[2]) + 64;
290 if (b[3])
291 return __ffs(b[3]) + 96;
292 return __ffs(b[4]) + 128;
293}
294
295/*
296 * hweightN: returns the hamming weight (i.e. the number
297 * of bits set) of a N-bit word
298 */
299
300#define hweight32(x) generic_hweight32(x)
301#define hweight16(x) generic_hweight16(x)
302#define hweight8(x) generic_hweight8(x)
303
304static __inline__ int ext2_set_bit(int nr, volatile void * addr)
305{
306 int mask, retval;
307 unsigned long flags;
308 volatile unsigned char *ADDR = (unsigned char *) addr;
309
310 ADDR += nr >> 3;
311 mask = 1 << (nr & 0x07);
312 local_irq_save(flags);
313 retval = (mask & *ADDR) != 0;
314 *ADDR |= mask;
315 local_irq_restore(flags);
316 return retval;
317}
318#define ext2_set_bit_atomic(lock, nr, addr) ext2_set_bit(nr, addr)
319
320static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
321{
322 int mask, retval;
323 unsigned long flags;
324 volatile unsigned char *ADDR = (unsigned char *) addr;
325
326 ADDR += nr >> 3;
327 mask = 1 << (nr & 0x07);
328 local_irq_save(flags);
329 retval = (mask & *ADDR) != 0;
330 *ADDR &= ~mask;
331 local_irq_restore(flags);
332 return retval;
333}
334#define ext2_clear_bit_atomic(lock, nr, addr) ext2_set_bit(nr, addr)
335
336static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
337{
338 int mask;
339 const volatile unsigned char *ADDR = (const unsigned char *) addr;
340
341 ADDR += nr >> 3;
342 mask = 1 << (nr & 0x07);
343 return ((mask & *ADDR) != 0);
344}
345
346#define ext2_find_first_zero_bit(addr, size) \
347 ext2_find_next_zero_bit((addr), (size), 0)
348
349static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
350{
351 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
352 unsigned long result = offset & ~31UL;
353 unsigned long tmp;
354
355 if (offset >= size)
356 return size;
357 size -= result;
358 offset &= 31UL;
359 if(offset) {
360 /* We hold the little endian value in tmp, but then the
361 * shift is illegal. So we could keep a big endian value
362 * in tmp, like this:
363 *
364 * tmp = __swab32(*(p++));
365 * tmp |= ~0UL >> (32-offset);
366 *
367 * but this would decrease performance, so we change the
368 * shift:
369 */
370 tmp = *(p++);
371 tmp |= __swab32(~0UL >> (32-offset));
372 if(size < 32)
373 goto found_first;
374 if(~tmp)
375 goto found_middle;
376 size -= 32;
377 result += 32;
378 }
379 while(size & ~31UL) {
380 if(~(tmp = *(p++)))
381 goto found_middle;
382 result += 32;
383 size -= 32;
384 }
385 if(!size)
386 return result;
387 tmp = *p;
388
389found_first:
390 /* tmp is little endian, so we would have to swab the shift,
391 * see above. But then we have to swab tmp below for ffz, so
392 * we might as well do this here.
393 */
394 return result + ffz(__swab32(tmp) | (~0UL << size));
395found_middle:
396 return result + ffz(__swab32(tmp));
397}
398
399/* Bitmap functions for the minix filesystem. */
400#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
401#define minix_set_bit(nr,addr) set_bit(nr,addr)
402#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
403#define minix_test_bit(nr,addr) test_bit(nr,addr)
404#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
405
406#endif /* __KERNEL__ */
407
408#define fls(x) generic_fls(x)
409
410#endif /* _H8300_BITOPS_H */
diff --git a/include/asm-h8300/bootinfo.h b/include/asm-h8300/bootinfo.h
new file mode 100644
index 000000000000..5bed7e7aac0a
--- /dev/null
+++ b/include/asm-h8300/bootinfo.h
@@ -0,0 +1,2 @@
1
2/* Nothing for h8300 */
diff --git a/include/asm-h8300/bug.h b/include/asm-h8300/bug.h
new file mode 100644
index 000000000000..edddf5b086e5
--- /dev/null
+++ b/include/asm-h8300/bug.h
@@ -0,0 +1,4 @@
1#ifndef _H8300_BUG_H
2#define _H8300_BUG_H
3#include <asm-generic/bug.h>
4#endif
diff --git a/include/asm-h8300/bugs.h b/include/asm-h8300/bugs.h
new file mode 100644
index 000000000000..1cb4afba6eb1
--- /dev/null
+++ b/include/asm-h8300/bugs.h
@@ -0,0 +1,16 @@
1/*
2 * include/asm-h8300/bugs.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 */
6
7/*
8 * This is included by init/main.c to check for architecture-dependent bugs.
9 *
10 * Needs:
11 * void check_bugs(void);
12 */
13
14static void check_bugs(void)
15{
16}
diff --git a/include/asm-h8300/byteorder.h b/include/asm-h8300/byteorder.h
new file mode 100644
index 000000000000..36e597d61619
--- /dev/null
+++ b/include/asm-h8300/byteorder.h
@@ -0,0 +1,13 @@
1#ifndef _H8300_BYTEORDER_H
2#define _H8300_BYTEORDER_H
3
4#include <asm/types.h>
5
6#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
7# define __BYTEORDER_HAS_U64__
8# define __SWAB_64_THRU_32__
9#endif
10
11#include <linux/byteorder/big_endian.h>
12
13#endif /* _H8300_BYTEORDER_H */
diff --git a/include/asm-h8300/cache.h b/include/asm-h8300/cache.h
new file mode 100644
index 000000000000..c6350283649d
--- /dev/null
+++ b/include/asm-h8300/cache.h
@@ -0,0 +1,12 @@
1#ifndef __ARCH_H8300_CACHE_H
2#define __ARCH_H8300_CACHE_H
3
4/* bytes per L1 cache line */
5#define L1_CACHE_BYTES 4
6
7/* m68k-elf-gcc 2.95.2 doesn't like these */
8
9#define __cacheline_aligned
10#define ____cacheline_aligned
11
12#endif
diff --git a/include/asm-h8300/cachectl.h b/include/asm-h8300/cachectl.h
new file mode 100644
index 000000000000..c464022d8e26
--- /dev/null
+++ b/include/asm-h8300/cachectl.h
@@ -0,0 +1,14 @@
1#ifndef _H8300_CACHECTL_H
2#define _H8300_CACHECTL_H
3
4/* Definitions for the cacheflush system call. */
5
6#define FLUSH_SCOPE_LINE 0 /* Flush a cache line */
7#define FLUSH_SCOPE_PAGE 0 /* Flush a page */
8#define FLUSH_SCOPE_ALL 0 /* Flush the whole cache -- superuser only */
9
10#define FLUSH_CACHE_DATA 0 /* Writeback and flush data cache */
11#define FLUSH_CACHE_INSN 0 /* Flush instruction cache */
12#define FLUSH_CACHE_BOTH 0 /* Flush both caches */
13
14#endif /* _H8300_CACHECTL_H */
diff --git a/include/asm-h8300/cacheflush.h b/include/asm-h8300/cacheflush.h
new file mode 100644
index 000000000000..1e4d95bb5ec9
--- /dev/null
+++ b/include/asm-h8300/cacheflush.h
@@ -0,0 +1,38 @@
1/*
2 * (C) Copyright 2002, Yoshinori Sato <ysato@users.sourceforge.jp>
3 */
4
5#ifndef _ASM_H8300_CACHEFLUSH_H
6#define _AMS_H8300_CACHEFLUSH_H
7
8/*
9 * Cache handling functions
10 * No Cache memory all dummy functions
11 */
12
13#define flush_cache_all()
14#define flush_cache_mm(mm)
15#define flush_cache_range(vma,a,b)
16#define flush_cache_page(vma,p,pfn)
17#define flush_dcache_page(page)
18#define flush_dcache_mmap_lock(mapping)
19#define flush_dcache_mmap_unlock(mapping)
20#define flush_icache()
21#define flush_icache_page(vma,page)
22#define flush_icache_range(start,len)
23#define flush_cache_vmap(start, end)
24#define flush_cache_vunmap(start, end)
25#define cache_push_v(vaddr,len)
26#define cache_push(paddr,len)
27#define cache_clear(paddr,len)
28
29#define flush_dcache_range(a,b)
30
31#define flush_icache_user_range(vma,page,addr,len)
32
33#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
34 memcpy(dst, src, len)
35#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
36 memcpy(dst, src, len)
37
38#endif /* _ASM_H8300_CACHEFLUSH_H */
diff --git a/include/asm-h8300/checksum.h b/include/asm-h8300/checksum.h
new file mode 100644
index 000000000000..3051931dd301
--- /dev/null
+++ b/include/asm-h8300/checksum.h
@@ -0,0 +1,105 @@
1#ifndef _H8300_CHECKSUM_H
2#define _H8300_CHECKSUM_H
3
4/*
5 * computes the checksum of a memory block at buff, length len,
6 * and adds in "sum" (32-bit)
7 *
8 * returns a 32-bit number suitable for feeding into itself
9 * or csum_tcpudp_magic
10 *
11 * this function must be called with even lengths, except
12 * for the last fragment, which may be odd
13 *
14 * it's best to have buff aligned on a 32-bit boundary
15 */
16unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
17
18/*
19 * the same as csum_partial, but copies from src while it
20 * checksums
21 *
22 * here even more important to align src and dst on a 32-bit (or even
23 * better 64-bit) boundary
24 */
25
26unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
27
28
29/*
30 * the same as csum_partial_copy, but copies from user space.
31 *
32 * here even more important to align src and dst on a 32-bit (or even
33 * better 64-bit) boundary
34 */
35
36extern unsigned int csum_partial_copy_from_user(const char *src, char *dst,
37 int len, int sum, int *csum_err);
38
39#define csum_partial_copy_nocheck(src, dst, len, sum) \
40 csum_partial_copy((src), (dst), (len), (sum))
41
42unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl);
43
44
45/*
46 * Fold a partial checksum
47 */
48
49static inline unsigned int csum_fold(unsigned int sum)
50{
51 __asm__("mov.l %0,er0\n\t"
52 "add.w e0,r0\n\t"
53 "xor.w e0,e0\n\t"
54 "rotxl.w e0\n\t"
55 "add.w e0,r0\n\t"
56 "sub.w e0,e0\n\t"
57 "mov.l er0,%0"
58 : "=r"(sum)
59 : "0"(sum)
60 : "er0");
61 return ~sum;
62}
63
64
65/*
66 * computes the checksum of the TCP/UDP pseudo-header
67 * returns a 16-bit checksum, already complemented
68 */
69
70static inline unsigned int
71csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
72 unsigned short proto, unsigned int sum)
73{
74 __asm__ ("sub.l er0,er0\n\t"
75 "add.l %2,%0\n\t"
76 "addx #0,r0l\n\t"
77 "add.l %3,%0\n\t"
78 "addx #0,r0l\n\t"
79 "add.l %4,%0\n\t"
80 "addx #0,r0l\n\t"
81 "add.l er0,%0\n\t"
82 "bcc 1f\n\t"
83 "inc.l #1,%0\n"
84 "1:"
85 : "=&r" (sum)
86 : "0" (sum), "r" (daddr), "r" (saddr), "r" (len + proto)
87 :"er0");
88 return sum;
89}
90
91static inline unsigned short int
92csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
93 unsigned short proto, unsigned int sum)
94{
95 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
96}
97
98/*
99 * this routine is used for miscellaneous IP-like checksums, mainly
100 * in icmp.c
101 */
102
103extern unsigned short ip_compute_csum(const unsigned char * buff, int len);
104
105#endif /* _H8300_CHECKSUM_H */
diff --git a/include/asm-h8300/cputime.h b/include/asm-h8300/cputime.h
new file mode 100644
index 000000000000..092e187c7b08
--- /dev/null
+++ b/include/asm-h8300/cputime.h
@@ -0,0 +1,6 @@
1#ifndef __H8300_CPUTIME_H
2#define __H8300_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __H8300_CPUTIME_H */
diff --git a/include/asm-h8300/current.h b/include/asm-h8300/current.h
new file mode 100644
index 000000000000..57d74ee55a14
--- /dev/null
+++ b/include/asm-h8300/current.h
@@ -0,0 +1,25 @@
1#ifndef _H8300_CURRENT_H
2#define _H8300_CURRENT_H
3/*
4 * current.h
5 * (C) Copyright 2000, Lineo, David McCullough <davidm@lineo.com>
6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
7 *
8 * rather than dedicate a register (as the m68k source does), we
9 * just keep a global, we should probably just change it all to be
10 * current and lose _current_task.
11 */
12
13#include <linux/thread_info.h>
14#include <asm/thread_info.h>
15
16struct task_struct;
17
18static inline struct task_struct *get_current(void)
19{
20 return(current_thread_info()->task);
21}
22
23#define current get_current()
24
25#endif /* _H8300_CURRENT_H */
diff --git a/include/asm-h8300/dbg.h b/include/asm-h8300/dbg.h
new file mode 100644
index 000000000000..2c6d1cbcf736
--- /dev/null
+++ b/include/asm-h8300/dbg.h
@@ -0,0 +1,2 @@
1#define DEBUG 1
2#define BREAK asm volatile ("trap #3")
diff --git a/include/asm-h8300/delay.h b/include/asm-h8300/delay.h
new file mode 100644
index 000000000000..cbccbbdd640f
--- /dev/null
+++ b/include/asm-h8300/delay.h
@@ -0,0 +1,38 @@
1#ifndef _H8300_DELAY_H
2#define _H8300_DELAY_H
3
4#include <asm/param.h>
5
6/*
7 * Copyright (C) 2002 Yoshinori Sato <ysato@sourceforge.jp>
8 *
9 * Delay routines, using a pre-computed "loops_per_second" value.
10 */
11
12extern __inline__ void __delay(unsigned long loops)
13{
14 __asm__ __volatile__ ("1:\n\t"
15 "dec.l #1,%0\n\t"
16 "bne 1b"
17 :"=r" (loops):"0"(loops));
18}
19
20/*
21 * Use only for very small delays ( < 1 msec). Should probably use a
22 * lookup table, really, as the multiplications take much too long with
23 * short delays. This is a "reasonable" implementation, though (and the
24 * first constant multiplications gets optimized away if the delay is
25 * a constant)
26 */
27
28extern unsigned long loops_per_jiffy;
29
30extern __inline__ void udelay(unsigned long usecs)
31{
32 usecs *= 4295; /* 2**32 / 1000000 */
33 usecs /= (loops_per_jiffy*HZ);
34 if (usecs)
35 __delay(usecs);
36}
37
38#endif /* _H8300_DELAY_H */
diff --git a/include/asm-h8300/div64.h b/include/asm-h8300/div64.h
new file mode 100644
index 000000000000..6cd978cefb28
--- /dev/null
+++ b/include/asm-h8300/div64.h
@@ -0,0 +1 @@
#include <asm-generic/div64.h>
diff --git a/include/asm-h8300/dma-mapping.h b/include/asm-h8300/dma-mapping.h
new file mode 100644
index 000000000000..d00e40099165
--- /dev/null
+++ b/include/asm-h8300/dma-mapping.h
@@ -0,0 +1 @@
#include <asm-generic/dma-mapping-broken.h>
diff --git a/include/asm-h8300/dma.h b/include/asm-h8300/dma.h
new file mode 100644
index 000000000000..3708681b7ddc
--- /dev/null
+++ b/include/asm-h8300/dma.h
@@ -0,0 +1,16 @@
1#ifndef _H8300_DMA_H
2#define _H8300_DMA_H
3
4#include <linux/config.h>
5
6/*
7 * Set number of channels of DMA on ColdFire for different implementations.
8 */
9#define MAX_DMA_CHANNELS 0
10#define MAX_DMA_ADDRESS PAGE_OFFSET
11
12/* These are in kernel/dma.c: */
13extern int request_dma(unsigned int dmanr, const char *device_id); /* reserve a DMA channel */
14extern void free_dma(unsigned int dmanr); /* release it again */
15
16#endif /* _H8300_DMA_H */
diff --git a/include/asm-h8300/elf.h b/include/asm-h8300/elf.h
new file mode 100644
index 000000000000..f4af1553a55f
--- /dev/null
+++ b/include/asm-h8300/elf.h
@@ -0,0 +1,107 @@
1#ifndef __ASMH8300_ELF_H
2#define __ASMH8300_ELF_H
3
4/*
5 * ELF register definitions..
6 */
7
8#include <linux/config.h>
9#include <asm/ptrace.h>
10#include <asm/user.h>
11
12typedef unsigned long elf_greg_t;
13
14#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
15typedef elf_greg_t elf_gregset_t[ELF_NGREG];
16typedef unsigned long elf_fpregset_t;
17
18/*
19 * This is used to ensure we don't load something for the wrong architecture.
20 */
21#define elf_check_arch(x) ((x)->e_machine == EM_H8_300)
22
23/*
24 * These are used to set parameters in the core dumps.
25 */
26#define ELF_CLASS ELFCLASS32
27#define ELF_DATA ELFDATA2MSB
28#define ELF_ARCH EM_H8_300
29#if defined(__H8300H__)
30#define ELF_FLAGS 0x810000
31#endif
32#if defined(__H8300S__)
33#define ELF_FLAGS 0x820000
34#endif
35
36#define ELF_PLAT_INIT(_r) _r->er1 = 0
37
38#define USE_ELF_CORE_DUMP
39#define ELF_EXEC_PAGESIZE 4096
40
41/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
42 use of this is to invoke "./ld.so someprog" to test out a new version of
43 the loader. We need to make sure that it is out of the way of the program
44 that it will "exec", and that there is sufficient room for the brk. */
45
46#define ELF_ET_DYN_BASE 0xD0000000UL
47
48/* This yields a mask that user programs can use to figure out what
49 instruction set this cpu supports. */
50
51#define ELF_HWCAP (0)
52
53/* This yields a string that ld.so will use to load implementation
54 specific libraries for optimization. This is more specific in
55 intent than poking at uname or /proc/cpuinfo. */
56
57#define ELF_PLATFORM (NULL)
58
59#ifdef __KERNEL__
60#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX)
61#endif
62
63#define R_H8_NONE 0
64#define R_H8_DIR32 1
65#define R_H8_DIR32_28 2
66#define R_H8_DIR32_24 3
67#define R_H8_DIR32_16 4
68#define R_H8_DIR32U 6
69#define R_H8_DIR32U_28 7
70#define R_H8_DIR32U_24 8
71#define R_H8_DIR32U_20 9
72#define R_H8_DIR32U_16 10
73#define R_H8_DIR24 11
74#define R_H8_DIR24_20 12
75#define R_H8_DIR24_16 13
76#define R_H8_DIR24U 14
77#define R_H8_DIR24U_20 15
78#define R_H8_DIR24U_16 16
79#define R_H8_DIR16 17
80#define R_H8_DIR16U 18
81#define R_H8_DIR16S_32 19
82#define R_H8_DIR16S_28 20
83#define R_H8_DIR16S_24 21
84#define R_H8_DIR16S_20 22
85#define R_H8_DIR16S 23
86#define R_H8_DIR8 24
87#define R_H8_DIR8U 25
88#define R_H8_DIR8Z_32 26
89#define R_H8_DIR8Z_28 27
90#define R_H8_DIR8Z_24 28
91#define R_H8_DIR8Z_20 29
92#define R_H8_DIR8Z_16 30
93#define R_H8_PCREL16 31
94#define R_H8_PCREL8 32
95#define R_H8_BPOS 33
96#define R_H8_PCREL32 34
97#define R_H8_GOT32O 35
98#define R_H8_GOT16O 36
99#define R_H8_DIR16A8 59
100#define R_H8_DIR16R8 60
101#define R_H8_DIR24A8 61
102#define R_H8_DIR24R8 62
103#define R_H8_DIR32A16 63
104#define R_H8_ABS32 65
105#define R_H8_ABS32A16 127
106
107#endif
diff --git a/include/asm-h8300/errno.h b/include/asm-h8300/errno.h
new file mode 100644
index 000000000000..0c2f5641fdcc
--- /dev/null
+++ b/include/asm-h8300/errno.h
@@ -0,0 +1,6 @@
1#ifndef _H8300_ERRNO_H
2#define _H8300_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif /* _H8300_ERRNO_H */
diff --git a/include/asm-h8300/fcntl.h b/include/asm-h8300/fcntl.h
new file mode 100644
index 000000000000..355350a57bf9
--- /dev/null
+++ b/include/asm-h8300/fcntl.h
@@ -0,0 +1,87 @@
1#ifndef _H8300_FCNTL_H
2#define _H8300_FCNTL_H
3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_ACCMODE 0003
7#define O_RDONLY 00
8#define O_WRONLY 01
9#define O_RDWR 02
10#define O_CREAT 0100 /* not fcntl */
11#define O_EXCL 0200 /* not fcntl */
12#define O_NOCTTY 0400 /* not fcntl */
13#define O_TRUNC 01000 /* not fcntl */
14#define O_APPEND 02000
15#define O_NONBLOCK 04000
16#define O_NDELAY O_NONBLOCK
17#define O_SYNC 010000
18#define FASYNC 020000 /* fcntl, for BSD compatibility */
19#define O_DIRECTORY 040000 /* must be a directory */
20#define O_NOFOLLOW 0100000 /* don't follow links */
21#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
22#define O_LARGEFILE 0400000
23#define O_NOATIME 01000000
24
25#define F_DUPFD 0 /* dup */
26#define F_GETFD 1 /* get close_on_exec */
27#define F_SETFD 2 /* set/clear close_on_exec */
28#define F_GETFL 3 /* get file->f_flags */
29#define F_SETFL 4 /* set file->f_flags */
30#define F_GETLK 5
31#define F_SETLK 6
32#define F_SETLKW 7
33
34#define F_SETOWN 8 /* for sockets. */
35#define F_GETOWN 9 /* for sockets. */
36#define F_SETSIG 10 /* for sockets. */
37#define F_GETSIG 11 /* for sockets. */
38
39#define F_GETLK64 12 /* using 'struct flock64' */
40#define F_SETLK64 13
41#define F_SETLKW64 14
42
43/* for F_[GET|SET]FL */
44#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
45
46/* for posix fcntl() and lockf() */
47#define F_RDLCK 0
48#define F_WRLCK 1
49#define F_UNLCK 2
50
51/* for old implementation of bsd flock () */
52#define F_EXLCK 4 /* or 3 */
53#define F_SHLCK 8 /* or 4 */
54
55/* for leases */
56#define F_INPROGRESS 16
57
58/* operations for bsd flock(), also used by the kernel implementation */
59#define LOCK_SH 1 /* shared lock */
60#define LOCK_EX 2 /* exclusive lock */
61#define LOCK_NB 4 /* or'd with one of the above to prevent
62 blocking */
63#define LOCK_UN 8 /* remove lock */
64
65#define LOCK_MAND 32 /* This is a mandatory flock */
66#define LOCK_READ 64 /* ... Which allows concurrent read operations */
67#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
68#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
69
70struct flock {
71 short l_type;
72 short l_whence;
73 off_t l_start;
74 off_t l_len;
75 pid_t l_pid;
76};
77
78struct flock64 {
79 short l_type;
80 short l_whence;
81 loff_t l_start;
82 loff_t l_len;
83 pid_t l_pid;
84};
85
86#define F_LINUX_SPECIFIC_BASE 1024
87#endif /* _H8300_FCNTL_H */
diff --git a/include/asm-h8300/flat.h b/include/asm-h8300/flat.h
new file mode 100644
index 000000000000..c20eee767d6f
--- /dev/null
+++ b/include/asm-h8300/flat.h
@@ -0,0 +1,26 @@
1/*
2 * include/asm-h8300/flat.h -- uClinux flat-format executables
3 */
4
5#ifndef __H8300_FLAT_H__
6#define __H8300_FLAT_H__
7
8#define flat_stack_align(sp) /* nothing needed */
9#define flat_argvp_envp_on_stack() 1
10#define flat_old_ram_flag(flags) 1
11#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
12
13/*
14 * on the H8 a couple of the relocations have an instruction in the
15 * top byte. As there can only be 24bits of address space, we just
16 * always preserve that 8bits at the top, when it isn't an instruction
17 * is is 0 (davidm@snapgear.com)
18 */
19
20#define flat_get_relocate_addr(rel) (rel)
21#define flat_get_addr_from_rp(rp, relval, flags) \
22 (get_unaligned(rp) & ((flags & FLAT_FLAG_GOTPIC) ? 0xffffffff: 0x00ffffff))
23#define flat_put_addr_at_rp(rp, addr, rel) \
24 put_unaligned (((*(char *)(rp)) << 24) | ((addr) & 0x00ffffff), rp)
25
26#endif /* __H8300_FLAT_H__ */
diff --git a/include/asm-h8300/fpu.h b/include/asm-h8300/fpu.h
new file mode 100644
index 000000000000..4fc416e80bef
--- /dev/null
+++ b/include/asm-h8300/fpu.h
@@ -0,0 +1 @@
/* Nothing do */
diff --git a/include/asm-h8300/gpio.h b/include/asm-h8300/gpio.h
new file mode 100644
index 000000000000..a714f0c0efbc
--- /dev/null
+++ b/include/asm-h8300/gpio.h
@@ -0,0 +1,52 @@
1#ifndef _H8300_GPIO_H
2#define _H8300_GPIO_H
3
4#define H8300_GPIO_P1 0
5#define H8300_GPIO_P2 1
6#define H8300_GPIO_P3 2
7#define H8300_GPIO_P4 3
8#define H8300_GPIO_P5 4
9#define H8300_GPIO_P6 5
10#define H8300_GPIO_P7 6
11#define H8300_GPIO_P8 7
12#define H8300_GPIO_P9 8
13#define H8300_GPIO_PA 9
14#define H8300_GPIO_PB 10
15#define H8300_GPIO_PC 11
16#define H8300_GPIO_PD 12
17#define H8300_GPIO_PE 13
18#define H8300_GPIO_PF 14
19#define H8300_GPIO_PG 15
20#define H8300_GPIO_PH 16
21
22#define H8300_GPIO_B7 0x80
23#define H8300_GPIO_B6 0x40
24#define H8300_GPIO_B5 0x20
25#define H8300_GPIO_B4 0x10
26#define H8300_GPIO_B3 0x08
27#define H8300_GPIO_B2 0x04
28#define H8300_GPIO_B1 0x02
29#define H8300_GPIO_B0 0x01
30
31#define H8300_GPIO_INPUT 0
32#define H8300_GPIO_OUTPUT 1
33
34#define H8300_GPIO_RESERVE(port, bits) \
35 h8300_reserved_gpio(port, bits)
36
37#define H8300_GPIO_FREE(port, bits) \
38 h8300_free_gpio(port, bits)
39
40#define H8300_GPIO_DDR(port, bit, dir) \
41 h8300_set_gpio_dir(((port) << 8) | (bit), dir)
42
43#define H8300_GPIO_GETDIR(port, bit) \
44 h8300_get_gpio_dir(((port) << 8) | (bit))
45
46extern int h8300_reserved_gpio(int port, int bits);
47extern int h8300_free_gpio(int port, int bits);
48extern int h8300_set_gpio_dir(int port_bit, int dir);
49extern int h8300_get_gpio_dir(int port_bit);
50extern int h8300_init_gpio(void);
51
52#endif
diff --git a/include/asm-h8300/hardirq.h b/include/asm-h8300/hardirq.h
new file mode 100644
index 000000000000..e961bfe201b8
--- /dev/null
+++ b/include/asm-h8300/hardirq.h
@@ -0,0 +1,27 @@
1#ifndef __H8300_HARDIRQ_H
2#define __H8300_HARDIRQ_H
3
4#include <linux/kernel.h>
5#include <linux/config.h>
6#include <linux/threads.h>
7#include <linux/interrupt.h>
8#include <linux/irq.h>
9
10typedef struct {
11 unsigned int __softirq_pending;
12} ____cacheline_aligned irq_cpustat_t;
13
14#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
15
16#define HARDIRQ_BITS 8
17
18/*
19 * The hardirq mask has to be large enough to have
20 * space for potentially all IRQ sources in the system
21 * nesting on a single CPU:
22 */
23#if (1 << HARDIRQ_BITS) < NR_IRQS
24# error HARDIRQ_BITS is too low!
25#endif
26
27#endif
diff --git a/include/asm-h8300/hdreg.h b/include/asm-h8300/hdreg.h
new file mode 100644
index 000000000000..36d0c06687d8
--- /dev/null
+++ b/include/asm-h8300/hdreg.h
@@ -0,0 +1,15 @@
1/*
2 * linux/include/asm-h8300/hdreg.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
6
7#warning this file is obsolete, please do not use it
8
9#ifndef _H8300_HDREG_H
10#define _H8300_HDREG_H
11
12typedef unsigned int q40ide_ioreg_t;
13typedef unsigned char * ide_ioreg_t;
14
15#endif /* _H8300_HDREG_H */
diff --git a/include/asm-h8300/hw_irq.h b/include/asm-h8300/hw_irq.h
new file mode 100644
index 000000000000..d75a5a1119e8
--- /dev/null
+++ b/include/asm-h8300/hw_irq.h
@@ -0,0 +1 @@
/* Do Nothing */
diff --git a/include/asm-h8300/ide.h b/include/asm-h8300/ide.h
new file mode 100644
index 000000000000..f8535ce7476e
--- /dev/null
+++ b/include/asm-h8300/ide.h
@@ -0,0 +1,26 @@
1/****************************************************************************/
2
3/*
4 * linux/include/asm-h8300/ide.h
5 *
6 * Copyright (C) 1994-1996 Linus Torvalds & authors
7 * Copyright (C) 2001 Lineo Inc., davidm@snapgear.com
8 * Copyright (C) 2002 Greg Ungerer (gerg@snapgear.com)
9 * Copyright (C) 2002 Yoshinori Sato (ysato@users.sourceforge.jp)
10 */
11
12/****************************************************************************/
13#ifndef _H8300_IDE_H
14#define _H8300_IDE_H
15/****************************************************************************/
16#ifdef __KERNEL__
17/****************************************************************************/
18
19#define MAX_HWIFS 1
20
21#include <asm-generic/ide_iops.h>
22
23/****************************************************************************/
24#endif /* __KERNEL__ */
25#endif /* _H8300_IDE_H */
26/****************************************************************************/
diff --git a/include/asm-h8300/io.h b/include/asm-h8300/io.h
new file mode 100644
index 000000000000..1773e373e9c6
--- /dev/null
+++ b/include/asm-h8300/io.h
@@ -0,0 +1,333 @@
1#ifndef _H8300_IO_H
2#define _H8300_IO_H
3
4#ifdef __KERNEL__
5
6#include <linux/config.h>
7#include <asm/virtconvert.h>
8
9#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
10#include <asm/regs306x.h>
11#elif defined(CONFIG_H8S2678)
12#include <asm/regs267x.h>
13#else
14#error UNKNOWN CPU TYPE
15#endif
16
17
18/*
19 * These are for ISA/PCI shared memory _only_ and should never be used
20 * on any other type of memory, including Zorro memory. They are meant to
21 * access the bus in the bus byte order which is little-endian!.
22 *
23 * readX/writeX() are used to access memory mapped devices. On some
24 * architectures the memory mapped IO stuff needs to be accessed
25 * differently. On the m68k architecture, we just read/write the
26 * memory location directly.
27 */
28/* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
29 * two accesses to memory, which may be undesireable for some devices.
30 */
31
32/*
33 * swap functions are sometimes needed to interface little-endian hardware
34 */
35
36static inline unsigned short _swapw(volatile unsigned short v)
37{
38#ifndef H8300_IO_NOSWAP
39 unsigned short r;
40 __asm__("xor.b %w0,%x0\n\t"
41 "xor.b %x0,%w0\n\t"
42 "xor.b %w0,%x0"
43 :"=r"(r)
44 :"0"(v));
45 return r;
46#else
47 return v;
48#endif
49}
50
51static inline unsigned long _swapl(volatile unsigned long v)
52{
53#ifndef H8300_IO_NOSWAP
54 unsigned long r;
55 __asm__("xor.b %w0,%x0\n\t"
56 "xor.b %x0,%w0\n\t"
57 "xor.b %w0,%x0\n\t"
58 "xor.w %e0,%f0\n\t"
59 "xor.w %f0,%e0\n\t"
60 "xor.w %e0,%f0\n\t"
61 "xor.b %w0,%x0\n\t"
62 "xor.b %x0,%w0\n\t"
63 "xor.b %w0,%x0"
64 :"=r"(r)
65 :"0"(v));
66 return r;
67#else
68 return v;
69#endif
70}
71
72#define readb(addr) \
73 ({ unsigned char __v = \
74 *(volatile unsigned char *)((unsigned long)(addr) & 0x00ffffff); \
75 __v; })
76#define readw(addr) \
77 ({ unsigned short __v = \
78 *(volatile unsigned short *)((unsigned long)(addr) & 0x00ffffff); \
79 __v; })
80#define readl(addr) \
81 ({ unsigned long __v = \
82 *(volatile unsigned long *)((unsigned long)(addr) & 0x00ffffff); \
83 __v; })
84
85#define writeb(b,addr) (void)((*(volatile unsigned char *) \
86 ((unsigned long)(addr) & 0x00ffffff)) = (b))
87#define writew(b,addr) (void)((*(volatile unsigned short *) \
88 ((unsigned long)(addr) & 0x00ffffff)) = (b))
89#define writel(b,addr) (void)((*(volatile unsigned long *) \
90 ((unsigned long)(addr) & 0x00ffffff)) = (b))
91#define readb_relaxed(addr) readb(addr)
92#define readw_relaxed(addr) readw(addr)
93#define readl_relaxed(addr) readl(addr)
94
95#define __raw_readb readb
96#define __raw_readw readw
97#define __raw_readl readl
98#define __raw_writeb writeb
99#define __raw_writew writew
100#define __raw_writel writel
101
102static inline int h8300_buswidth(unsigned int addr)
103{
104 return (*(volatile unsigned char *)ABWCR & (1 << ((addr >> 21) & 7))) == 0;
105}
106
107static inline void io_outsb(unsigned int addr, const void *buf, int len)
108{
109 volatile unsigned char *ap_b = (volatile unsigned char *) addr;
110 volatile unsigned short *ap_w = (volatile unsigned short *) addr;
111 unsigned char *bp = (unsigned char *) buf;
112
113 if(h8300_buswidth(addr) && (addr & 1)) {
114 while (len--)
115 *ap_w = *bp++;
116 } else {
117 while (len--)
118 *ap_b = *bp++;
119 }
120}
121
122static inline void io_outsw(unsigned int addr, const void *buf, int len)
123{
124 volatile unsigned short *ap = (volatile unsigned short *) addr;
125 unsigned short *bp = (unsigned short *) buf;
126 while (len--)
127 *ap = _swapw(*bp++);
128}
129
130static inline void io_outsl(unsigned int addr, const void *buf, int len)
131{
132 volatile unsigned long *ap = (volatile unsigned long *) addr;
133 unsigned long *bp = (unsigned long *) buf;
134 while (len--)
135 *ap = _swapl(*bp++);
136}
137
138static inline void io_outsw_noswap(unsigned int addr, const void *buf, int len)
139{
140 volatile unsigned short *ap = (volatile unsigned short *) addr;
141 unsigned short *bp = (unsigned short *) buf;
142 while (len--)
143 *ap = *bp++;
144}
145
146static inline void io_outsl_noswap(unsigned int addr, const void *buf, int len)
147{
148 volatile unsigned long *ap = (volatile unsigned long *) addr;
149 unsigned long *bp = (unsigned long *) buf;
150 while (len--)
151 *ap = *bp++;
152}
153
154static inline void io_insb(unsigned int addr, void *buf, int len)
155{
156 volatile unsigned char *ap_b;
157 volatile unsigned short *ap_w;
158 unsigned char *bp = (unsigned char *) buf;
159
160 if(h8300_buswidth(addr)) {
161 ap_w = (volatile unsigned short *)(addr & ~1);
162 while (len--)
163 *bp++ = *ap_w & 0xff;
164 } else {
165 ap_b = (volatile unsigned char *)addr;
166 while (len--)
167 *bp++ = *ap_b;
168 }
169}
170
171static inline void io_insw(unsigned int addr, void *buf, int len)
172{
173 volatile unsigned short *ap = (volatile unsigned short *) addr;
174 unsigned short *bp = (unsigned short *) buf;
175 while (len--)
176 *bp++ = _swapw(*ap);
177}
178
179static inline void io_insl(unsigned int addr, void *buf, int len)
180{
181 volatile unsigned long *ap = (volatile unsigned long *) addr;
182 unsigned long *bp = (unsigned long *) buf;
183 while (len--)
184 *bp++ = _swapl(*ap);
185}
186
187static inline void io_insw_noswap(unsigned int addr, void *buf, int len)
188{
189 volatile unsigned short *ap = (volatile unsigned short *) addr;
190 unsigned short *bp = (unsigned short *) buf;
191 while (len--)
192 *bp++ = *ap;
193}
194
195static inline void io_insl_noswap(unsigned int addr, void *buf, int len)
196{
197 volatile unsigned long *ap = (volatile unsigned long *) addr;
198 unsigned long *bp = (unsigned long *) buf;
199 while (len--)
200 *bp++ = *ap;
201}
202
203/*
204 * make the short names macros so specific devices
205 * can override them as required
206 */
207
208#define memset_io(a,b,c) memset((void *)(a),(b),(c))
209#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
210#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
211
212#define mmiowb()
213
214#define inb(addr) ((h8300_buswidth(addr))?readw((addr) & ~1) & 0xff:readb(addr))
215#define inw(addr) _swapw(readw(addr))
216#define inl(addr) _swapl(readl(addr))
217#define outb(x,addr) ((void)((h8300_buswidth(addr) && \
218 ((addr) & 1))?writew(x,(addr) & ~1):writeb(x,addr)))
219#define outw(x,addr) ((void) writew(_swapw(x),addr))
220#define outl(x,addr) ((void) writel(_swapl(x),addr))
221
222#define inb_p(addr) inb(addr)
223#define inw_p(addr) inw(addr)
224#define inl_p(addr) inl(addr)
225#define outb_p(x,addr) outb(x,addr)
226#define outw_p(x,addr) outw(x,addr)
227#define outl_p(x,addr) outl(x,addr)
228
229#define outsb(a,b,l) io_outsb(a,b,l)
230#define outsw(a,b,l) io_outsw(a,b,l)
231#define outsl(a,b,l) io_outsl(a,b,l)
232
233#define insb(a,b,l) io_insb(a,b,l)
234#define insw(a,b,l) io_insw(a,b,l)
235#define insl(a,b,l) io_insl(a,b,l)
236
237#define IO_SPACE_LIMIT 0xffffff
238
239
240/* Values for nocacheflag and cmode */
241#define IOMAP_FULL_CACHING 0
242#define IOMAP_NOCACHE_SER 1
243#define IOMAP_NOCACHE_NONSER 2
244#define IOMAP_WRITETHROUGH 3
245
246extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag);
247extern void __iounmap(void *addr, unsigned long size);
248
249static inline void *ioremap(unsigned long physaddr, unsigned long size)
250{
251 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
252}
253static inline void *ioremap_nocache(unsigned long physaddr, unsigned long size)
254{
255 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
256}
257static inline void *ioremap_writethrough(unsigned long physaddr, unsigned long size)
258{
259 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
260}
261static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size)
262{
263 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
264}
265
266extern void iounmap(void *addr);
267
268/* Nothing to do */
269
270#define dma_cache_inv(_start,_size) do { } while (0)
271#define dma_cache_wback(_start,_size) do { } while (0)
272#define dma_cache_wback_inv(_start,_size) do { } while (0)
273
274/* H8/300 internal I/O functions */
275static __inline__ unsigned char ctrl_inb(unsigned long addr)
276{
277 return *(volatile unsigned char*)addr;
278}
279
280static __inline__ unsigned short ctrl_inw(unsigned long addr)
281{
282 return *(volatile unsigned short*)addr;
283}
284
285static __inline__ unsigned long ctrl_inl(unsigned long addr)
286{
287 return *(volatile unsigned long*)addr;
288}
289
290static __inline__ void ctrl_outb(unsigned char b, unsigned long addr)
291{
292 *(volatile unsigned char*)addr = b;
293}
294
295static __inline__ void ctrl_outw(unsigned short b, unsigned long addr)
296{
297 *(volatile unsigned short*)addr = b;
298}
299
300static __inline__ void ctrl_outl(unsigned long b, unsigned long addr)
301{
302 *(volatile unsigned long*)addr = b;
303}
304
305/* Pages to physical address... */
306#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
307#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
308
309/*
310 * Macros used for converting between virtual and physical mappings.
311 */
312#define mm_ptov(vaddr) ((void *) (vaddr))
313#define mm_vtop(vaddr) ((unsigned long) (vaddr))
314#define phys_to_virt(vaddr) ((void *) (vaddr))
315#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
316
317#define virt_to_bus virt_to_phys
318#define bus_to_virt phys_to_virt
319
320/*
321 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
322 * access
323 */
324#define xlate_dev_mem_ptr(p) __va(p)
325
326/*
327 * Convert a virtual cached pointer to an uncached pointer
328 */
329#define xlate_dev_kmem_ptr(p) p
330
331#endif /* __KERNEL__ */
332
333#endif /* _H8300_IO_H */
diff --git a/include/asm-h8300/ioctl.h b/include/asm-h8300/ioctl.h
new file mode 100644
index 000000000000..031c623478b3
--- /dev/null
+++ b/include/asm-h8300/ioctl.h
@@ -0,0 +1,80 @@
1/* $Id: ioctl.h,v 1.1 2002/11/19 02:09:26 gerg Exp $
2 *
3 * linux/ioctl.h for Linux by H.H. Bergman.
4 */
5
6#ifndef _H8300_IOCTL_H
7#define _H8300_IOCTL_H
8
9/* ioctl command encoding: 32 bits total, command in lower 16 bits,
10 * size of the parameter structure in the lower 14 bits of the
11 * upper 16 bits.
12 * Encoding the size of the parameter structure in the ioctl request
13 * is useful for catching programs compiled with old versions
14 * and to avoid overwriting user space outside the user buffer area.
15 * The highest 2 bits are reserved for indicating the ``access mode''.
16 * NOTE: This limits the max parameter size to 16kB -1 !
17 */
18
19/*
20 * I don't really have any idea about what this should look like, so
21 * for the time being, this is heavily based on the PC definitions.
22 */
23
24/*
25 * The following is for compatibility across the various Linux
26 * platforms. The i386 ioctl numbering scheme doesn't really enforce
27 * a type field. De facto, however, the top 8 bits of the lower 16
28 * bits are indeed used as a type field, so we might just as well make
29 * this explicit here. Please be sure to use the decoding macros
30 * below from now on.
31 */
32#define _IOC_NRBITS 8
33#define _IOC_TYPEBITS 8
34#define _IOC_SIZEBITS 14
35#define _IOC_DIRBITS 2
36
37#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
38#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
39#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
40#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
41
42#define _IOC_NRSHIFT 0
43#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
44#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
45#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
46
47/*
48 * Direction bits.
49 */
50#define _IOC_NONE 0U
51#define _IOC_WRITE 1U
52#define _IOC_READ 2U
53
54#define _IOC(dir,type,nr,size) \
55 (((dir) << _IOC_DIRSHIFT) | \
56 ((type) << _IOC_TYPESHIFT) | \
57 ((nr) << _IOC_NRSHIFT) | \
58 ((size) << _IOC_SIZESHIFT))
59
60/* used to create numbers */
61#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
62#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
63#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
64#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
65
66/* used to decode ioctl numbers.. */
67#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
68#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
69#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
70#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
71
72/* ...and for the drivers/sound files... */
73
74#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
75#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
76#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
77#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
78#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
79
80#endif /* _H8300_IOCTL_H */
diff --git a/include/asm-h8300/ioctls.h b/include/asm-h8300/ioctls.h
new file mode 100644
index 000000000000..ac20457e5978
--- /dev/null
+++ b/include/asm-h8300/ioctls.h
@@ -0,0 +1,81 @@
1#ifndef __ARCH_H8300_IOCTLS_H__
2#define __ARCH_H8300_IOCTLS_H__
3
4#include <asm/ioctl.h>
5
6/* 0x54 is just a magic number to make these relatively unique ('T') */
7
8#define TCGETS 0x5401
9#define TCSETS 0x5402
10#define TCSETSW 0x5403
11#define TCSETSF 0x5404
12#define TCGETA 0x5405
13#define TCSETA 0x5406
14#define TCSETAW 0x5407
15#define TCSETAF 0x5408
16#define TCSBRK 0x5409
17#define TCXONC 0x540A
18#define TCFLSH 0x540B
19#define TIOCEXCL 0x540C
20#define TIOCNXCL 0x540D
21#define TIOCSCTTY 0x540E
22#define TIOCGPGRP 0x540F
23#define TIOCSPGRP 0x5410
24#define TIOCOUTQ 0x5411
25#define TIOCSTI 0x5412
26#define TIOCGWINSZ 0x5413
27#define TIOCSWINSZ 0x5414
28#define TIOCMGET 0x5415
29#define TIOCMBIS 0x5416
30#define TIOCMBIC 0x5417
31#define TIOCMSET 0x5418
32#define TIOCGSOFTCAR 0x5419
33#define TIOCSSOFTCAR 0x541A
34#define FIONREAD 0x541B
35#define TIOCINQ FIONREAD
36#define TIOCLINUX 0x541C
37#define TIOCCONS 0x541D
38#define TIOCGSERIAL 0x541E
39#define TIOCSSERIAL 0x541F
40#define TIOCPKT 0x5420
41#define FIONBIO 0x5421
42#define TIOCNOTTY 0x5422
43#define TIOCSETD 0x5423
44#define TIOCGETD 0x5424
45#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
46#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
51#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
52
53#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
54#define FIOCLEX 0x5451
55#define FIOASYNC 0x5452
56#define TIOCSERCONFIG 0x5453
57#define TIOCSERGWILD 0x5454
58#define TIOCSERSWILD 0x5455
59#define TIOCGLCKTRMIOS 0x5456
60#define TIOCSLCKTRMIOS 0x5457
61#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
62#define TIOCSERGETLSR 0x5459 /* Get line status register */
63#define TIOCSERGETMULTI 0x545A /* Get multiport config */
64#define TIOCSERSETMULTI 0x545B /* Set multiport config */
65
66#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
67#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
68#define FIOQSIZE 0x545E
69
70/* Used for packet mode */
71#define TIOCPKT_DATA 0
72#define TIOCPKT_FLUSHREAD 1
73#define TIOCPKT_FLUSHWRITE 2
74#define TIOCPKT_STOP 4
75#define TIOCPKT_START 8
76#define TIOCPKT_NOSTOP 16
77#define TIOCPKT_DOSTOP 32
78
79#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
80
81#endif /* __ARCH_H8300_IOCTLS_H__ */
diff --git a/include/asm-h8300/ipc.h b/include/asm-h8300/ipc.h
new file mode 100644
index 000000000000..a46e3d9c2a3f
--- /dev/null
+++ b/include/asm-h8300/ipc.h
@@ -0,0 +1 @@
#include <asm-generic/ipc.h>
diff --git a/include/asm-h8300/ipcbuf.h b/include/asm-h8300/ipcbuf.h
new file mode 100644
index 000000000000..2cd1ebcc109d
--- /dev/null
+++ b/include/asm-h8300/ipcbuf.h
@@ -0,0 +1,29 @@
1#ifndef __H8300_IPCBUF_H__
2#define __H8300_IPCBUF_H__
3
4/*
5 * The user_ipc_perm structure for H8/300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __H8300_IPCBUF_H__ */
diff --git a/include/asm-h8300/irq.h b/include/asm-h8300/irq.h
new file mode 100644
index 000000000000..5027181ed067
--- /dev/null
+++ b/include/asm-h8300/irq.h
@@ -0,0 +1,75 @@
1#ifndef _H8300_IRQ_H_
2#define _H8300_IRQ_H_
3
4#include <asm/ptrace.h>
5
6#if defined(__H8300H__)
7#define NR_IRQS 64
8#define EXT_IRQ0 12
9#define EXT_IRQ1 13
10#define EXT_IRQ2 14
11#define EXT_IRQ3 15
12#define EXT_IRQ4 16
13#define EXT_IRQ5 17
14#define EXT_IRQ6 18
15#define EXT_IRQ7 19
16#define EXT_IRQS 5
17
18#include <asm/regs306x.h>
19#define h8300_clear_isr(irq) \
20do { \
21 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ5) \
22 *(volatile unsigned char *)ISR &= ~(1 << (irq - EXT_IRQ0)); \
23} while(0)
24
25#define IER_REGS *(volatile unsigned char *)IER
26#endif
27#if defined(CONFIG_CPU_H8S)
28#define NR_IRQS 128
29#define EXT_IRQ0 16
30#define EXT_IRQ1 17
31#define EXT_IRQ2 18
32#define EXT_IRQ3 19
33#define EXT_IRQ4 20
34#define EXT_IRQ5 21
35#define EXT_IRQ6 22
36#define EXT_IRQ7 23
37#define EXT_IRQ8 24
38#define EXT_IRQ9 25
39#define EXT_IRQ10 26
40#define EXT_IRQ11 27
41#define EXT_IRQ12 28
42#define EXT_IRQ13 29
43#define EXT_IRQ14 30
44#define EXT_IRQ15 31
45#define EXT_IRQS 15
46
47#include <asm/regs267x.h>
48#define h8300_clear_isr(irq) \
49do { \
50 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15) \
51 *(volatile unsigned short *)ISR &= ~(1 << (irq - EXT_IRQ0)); \
52} while(0)
53
54#define IER_REGS *(volatile unsigned short *)IER
55#endif
56
57static __inline__ int irq_canonicalize(int irq)
58{
59 return irq;
60}
61
62extern void enable_irq(unsigned int);
63extern void disable_irq(unsigned int);
64
65/*
66 * Some drivers want these entry points
67 */
68#define enable_irq_nosync(x) enable_irq(x)
69#define disable_irq_nosync(x) disable_irq(x)
70
71struct irqaction;
72struct pt_regs;
73int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
74
75#endif /* _H8300_IRQ_H_ */
diff --git a/include/asm-h8300/keyboard.h b/include/asm-h8300/keyboard.h
new file mode 100644
index 000000000000..b05d11387ae5
--- /dev/null
+++ b/include/asm-h8300/keyboard.h
@@ -0,0 +1,33 @@
1/*
2 * linux/include/asm-h8300/keyboard.h
3 * Created 04 Dec 2001 by Khaled Hassounah <khassounah@mediumware.net>
4 * This file contains the Dragonball architecture specific keyboard definitions
5 */
6
7#ifndef _H8300_KEYBOARD_H
8#define _H8300_KEYBOARD_H
9
10#include <linux/config.h>
11
12/* dummy i.e. no real keyboard */
13#define kbd_setkeycode(x...) (-ENOSYS)
14#define kbd_getkeycode(x...) (-ENOSYS)
15#define kbd_translate(x...) (0)
16#define kbd_unexpected_up(x...) (1)
17#define kbd_leds(x...) do {;} while (0)
18#define kbd_init_hw(x...) do {;} while (0)
19#define kbd_enable_irq(x...) do {;} while (0)
20#define kbd_disable_irq(x...) do {;} while (0)
21
22
23/* needed if MAGIC_SYSRQ is enabled for serial console */
24#ifndef SYSRQ_KEY
25#define SYSRQ_KEY ((unsigned char)(-1))
26#define kbd_sysrq_xlate ((unsigned char *)NULL)
27#endif
28
29
30#endif /* _H8300_KEYBOARD_H */
31
32
33
diff --git a/include/asm-h8300/kmap_types.h b/include/asm-h8300/kmap_types.h
new file mode 100644
index 000000000000..82431edeb2a1
--- /dev/null
+++ b/include/asm-h8300/kmap_types.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_KMAP_TYPES_H
2#define _ASM_KMAP_TYPES_H
3
4enum km_type {
5 KM_BOUNCE_READ,
6 KM_SKB_SUNRPC_DATA,
7 KM_SKB_DATA_SOFTIRQ,
8 KM_USER0,
9 KM_USER1,
10 KM_BIO_SRC_IRQ,
11 KM_BIO_DST_IRQ,
12 KM_PTE0,
13 KM_PTE1,
14 KM_IRQ0,
15 KM_IRQ1,
16 KM_TYPE_NR
17};
18
19#endif
diff --git a/include/asm-h8300/linkage.h b/include/asm-h8300/linkage.h
new file mode 100644
index 000000000000..6f4df7d46180
--- /dev/null
+++ b/include/asm-h8300/linkage.h
@@ -0,0 +1,8 @@
1#ifndef _H8300_LINKAGE_H
2#define _H8300_LINKAGE_H
3
4#undef SYMBOL_NAME_LABEL
5#undef SYMBOL_NAME
6#define SYMBOL_NAME_LABEL(_name_) _##_name_##:
7#define SYMBOL_NAME(_name_) _##_name_
8#endif
diff --git a/include/asm-h8300/local.h b/include/asm-h8300/local.h
new file mode 100644
index 000000000000..fdd4efe437cd
--- /dev/null
+++ b/include/asm-h8300/local.h
@@ -0,0 +1,6 @@
1#ifndef _H8300_LOCAL_H_
2#define _H8300_LOCAL_H_
3
4#include <asm-generic/local.h>
5
6#endif
diff --git a/include/asm-h8300/mc146818rtc.h b/include/asm-h8300/mc146818rtc.h
new file mode 100644
index 000000000000..ab9d9646d241
--- /dev/null
+++ b/include/asm-h8300/mc146818rtc.h
@@ -0,0 +1,9 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifndef _H8300_MC146818RTC_H
5#define _H8300_MC146818RTC_H
6
7/* empty include file to satisfy the include in genrtc.c/ide-geometry.c */
8
9#endif /* _H8300_MC146818RTC_H */
diff --git a/include/asm-h8300/md.h b/include/asm-h8300/md.h
new file mode 100644
index 000000000000..1a47dc6691fb
--- /dev/null
+++ b/include/asm-h8300/md.h
@@ -0,0 +1,13 @@
1/* $Id: md.h,v 1.1 2002/11/19 02:09:26 gerg Exp $
2 * md.h: High speed xor_block operation for RAID4/5
3 *
4 */
5
6#ifndef __ASM_MD_H
7#define __ASM_MD_H
8
9/* #define HAVE_ARCH_XORBLOCK */
10
11#define MD_XORBLOCK_ALIGNMENT sizeof(long)
12
13#endif /* __ASM_MD_H */
diff --git a/include/asm-h8300/mman.h b/include/asm-h8300/mman.h
new file mode 100644
index 000000000000..abe08856c84f
--- /dev/null
+++ b/include/asm-h8300/mman.h
@@ -0,0 +1,40 @@
1#ifndef __H8300_MMAN_H__
2#define __H8300_MMAN_H__
3
4#define PROT_READ 0x1 /* page can be read */
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_NONE 0x0 /* page can not be accessed */
8#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
9#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
10
11#define MAP_SHARED 0x01 /* Share changes */
12#define MAP_PRIVATE 0x02 /* Changes are private */
13#define MAP_TYPE 0x0f /* Mask for type of mapping */
14#define MAP_FIXED 0x10 /* Interpret addr exactly */
15#define MAP_ANONYMOUS 0x20 /* don't use a file */
16
17#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
18#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
19#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
20#define MAP_LOCKED 0x2000 /* pages are locked */
21#define MAP_NORESERVE 0x4000 /* don't check for reservations */
22
23#define MS_ASYNC 1 /* sync memory asynchronously */
24#define MS_INVALIDATE 2 /* invalidate the caches */
25#define MS_SYNC 4 /* synchronous memory sync */
26
27#define MCL_CURRENT 1 /* lock all current mappings */
28#define MCL_FUTURE 2 /* lock all future mappings */
29
30#define MADV_NORMAL 0x0 /* default page-in behavior */
31#define MADV_RANDOM 0x1 /* page-in minimum required */
32#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
33#define MADV_WILLNEED 0x3 /* pre-fault pages */
34#define MADV_DONTNEED 0x4 /* discard these pages */
35
36/* compatibility flags */
37#define MAP_ANON MAP_ANONYMOUS
38#define MAP_FILE 0
39
40#endif /* __H8300_MMAN_H__ */
diff --git a/include/asm-h8300/mmu.h b/include/asm-h8300/mmu.h
new file mode 100644
index 000000000000..2ce06ea46104
--- /dev/null
+++ b/include/asm-h8300/mmu.h
@@ -0,0 +1,11 @@
1#ifndef __MMU_H
2#define __MMU_H
3
4/* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */
5
6typedef struct {
7 struct vm_list_struct *vmlist;
8 unsigned long end_brk;
9} mm_context_t;
10
11#endif
diff --git a/include/asm-h8300/mmu_context.h b/include/asm-h8300/mmu_context.h
new file mode 100644
index 000000000000..23b555b7b4b9
--- /dev/null
+++ b/include/asm-h8300/mmu_context.h
@@ -0,0 +1,32 @@
1#ifndef __H8300_MMU_CONTEXT_H
2#define __H8300_MMU_CONTEXT_H
3
4#include <linux/config.h>
5#include <asm/setup.h>
6#include <asm/page.h>
7#include <asm/pgalloc.h>
8
9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
10{
11}
12
13extern inline int
14init_new_context(struct task_struct *tsk, struct mm_struct *mm)
15{
16 // mm->context = virt_to_phys(mm->pgd);
17 return(0);
18}
19
20#define destroy_context(mm) do { } while(0)
21#define deactivate_mm(tsk,mm) do { } while(0)
22
23static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
24{
25}
26
27extern inline void activate_mm(struct mm_struct *prev_mm,
28 struct mm_struct *next_mm)
29{
30}
31
32#endif
diff --git a/include/asm-h8300/module.h b/include/asm-h8300/module.h
new file mode 100644
index 000000000000..de23231f3196
--- /dev/null
+++ b/include/asm-h8300/module.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_H8300_MODULE_H
2#define _ASM_H8300_MODULE_H
3/*
4 * This file contains the H8/300 architecture specific module code.
5 */
6struct mod_arch_specific { };
7#define Elf_Shdr Elf32_Shdr
8#define Elf_Sym Elf32_Sym
9#define Elf_Ehdr Elf32_Ehdr
10
11#define MODULE_SYMBOL_PREFIX "_"
12
13#endif /* _ASM_H8/300_MODULE_H */
diff --git a/include/asm-h8300/msgbuf.h b/include/asm-h8300/msgbuf.h
new file mode 100644
index 000000000000..6b148cd09aa5
--- /dev/null
+++ b/include/asm-h8300/msgbuf.h
@@ -0,0 +1,31 @@
1#ifndef _H8300_MSGBUF_H
2#define _H8300_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for H8/300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* _H8300_MSGBUF_H */
diff --git a/include/asm-h8300/namei.h b/include/asm-h8300/namei.h
new file mode 100644
index 000000000000..ab6f196db6e0
--- /dev/null
+++ b/include/asm-h8300/namei.h
@@ -0,0 +1,17 @@
1/*
2 * linux/include/asm-h8300/namei.h
3 *
4 * Included from linux/fs/namei.c
5 */
6
7#ifndef __H8300_NAMEI_H
8#define __H8300_NAMEI_H
9
10/* This dummy routine maybe changed to something useful
11 * for /usr/gnemul/ emulation stuff.
12 * Look at asm-sparc/namei.h for details.
13 */
14
15#define __emul_prefix() NULL
16
17#endif
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h
new file mode 100644
index 000000000000..58b053f1ef3b
--- /dev/null
+++ b/include/asm-h8300/page.h
@@ -0,0 +1,104 @@
1#ifndef _H8300_PAGE_H
2#define _H8300_PAGE_H
3
4#include <linux/config.h>
5
6/* PAGE_SHIFT determines the page size */
7
8#define PAGE_SHIFT (12)
9#define PAGE_SIZE (1UL << PAGE_SHIFT)
10#define PAGE_MASK (~(PAGE_SIZE-1))
11
12#ifdef __KERNEL__
13
14#include <asm/setup.h>
15
16#if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 13
17#define KTHREAD_SIZE (8192)
18#else
19#define KTHREAD_SIZE PAGE_SIZE
20#endif
21
22#ifndef __ASSEMBLY__
23
24#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
25#define free_user_page(page, addr) free_page(addr)
26
27#define clear_page(page) memset((page), 0, PAGE_SIZE)
28#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
29
30#define clear_user_page(page, vaddr, pg) clear_page(page)
31#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
32
33#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
34#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
35
36/*
37 * These are used to make use of C type-checking..
38 */
39typedef struct { unsigned long pte; } pte_t;
40typedef struct { unsigned long pmd[16]; } pmd_t;
41typedef struct { unsigned long pgd; } pgd_t;
42typedef struct { unsigned long pgprot; } pgprot_t;
43
44#define pte_val(x) ((x).pte)
45#define pmd_val(x) ((&x)->pmd[0])
46#define pgd_val(x) ((x).pgd)
47#define pgprot_val(x) ((x).pgprot)
48
49#define __pte(x) ((pte_t) { (x) } )
50#define __pmd(x) ((pmd_t) { (x) } )
51#define __pgd(x) ((pgd_t) { (x) } )
52#define __pgprot(x) ((pgprot_t) { (x) } )
53
54/* to align the pointer to the (next) page boundary */
55#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
56
57/* Pure 2^n version of get_order */
58extern __inline__ int get_order(unsigned long size)
59{
60 int order;
61
62 size = (size-1) >> (PAGE_SHIFT-1);
63 order = -1;
64 do {
65 size >>= 1;
66 order++;
67 } while (size);
68 return order;
69}
70
71extern unsigned long memory_start;
72extern unsigned long memory_end;
73
74#endif /* !__ASSEMBLY__ */
75
76#include <asm/page_offset.h>
77
78#define PAGE_OFFSET (PAGE_OFFSET_RAW)
79
80#ifndef __ASSEMBLY__
81
82#define __pa(vaddr) virt_to_phys((void *)vaddr)
83#define __va(paddr) phys_to_virt((unsigned long)paddr)
84
85#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
86#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
87
88#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
89#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
90#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
91#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
92#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
93
94#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
95#define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
96
97#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
98 ((void *)(kaddr) < (void *)memory_end))
99
100#endif /* __ASSEMBLY__ */
101
102#endif /* __KERNEL__ */
103
104#endif /* _H8300_PAGE_H */
diff --git a/include/asm-h8300/page_offset.h b/include/asm-h8300/page_offset.h
new file mode 100644
index 000000000000..8cc6e17218a8
--- /dev/null
+++ b/include/asm-h8300/page_offset.h
@@ -0,0 +1,4 @@
1
2#include <linux/config.h>
3#define PAGE_OFFSET_RAW 0x00000000
4
diff --git a/include/asm-h8300/param.h b/include/asm-h8300/param.h
new file mode 100644
index 000000000000..126dddf72359
--- /dev/null
+++ b/include/asm-h8300/param.h
@@ -0,0 +1,23 @@
1#ifndef _H8300_PARAM_H
2#define _H8300_PARAM_H
3
4#include <linux/config.h>
5
6#ifndef HZ
7#define HZ 100
8#endif
9
10#ifdef __KERNEL__
11#define USER_HZ HZ
12#define CLOCKS_PER_SEC (USER_HZ)
13#endif
14
15#define EXEC_PAGESIZE 4096
16
17#ifndef NOGROUP
18#define NOGROUP (-1)
19#endif
20
21#define MAXHOSTNAMELEN 64 /* max length of hostname */
22
23#endif /* _H8300_PARAM_H */
diff --git a/include/asm-h8300/pci.h b/include/asm-h8300/pci.h
new file mode 100644
index 000000000000..d032729b19df
--- /dev/null
+++ b/include/asm-h8300/pci.h
@@ -0,0 +1,29 @@
1#ifndef _ASM_H8300_PCI_H
2#define _ASM_H8300_PCI_H
3
4/*
5 * asm-h8300/pci.h - H8/300 specific PCI declarations.
6 *
7 * Yoshinori Sato <ysato@users.sourceforge.jp>
8 */
9
10#define pcibios_assign_all_busses() 0
11#define pcibios_scan_all_fns(a, b) 0
12
13extern inline void pcibios_set_master(struct pci_dev *dev)
14{
15 /* No special bus mastering setup handling */
16}
17
18extern inline void pcibios_penalize_isa_irq(int irq)
19{
20 /* We don't do dynamic PCI IRQ allocation */
21}
22
23#define PCI_DMA_BUS_IS_PHYS (1)
24
25static inline void pcibios_add_platform_entries(struct pci_dev *dev)
26{
27}
28
29#endif /* _ASM_H8300_PCI_H */
diff --git a/include/asm-h8300/percpu.h b/include/asm-h8300/percpu.h
new file mode 100644
index 000000000000..72c03e3666d8
--- /dev/null
+++ b/include/asm-h8300/percpu.h
@@ -0,0 +1,6 @@
1#ifndef __ARCH_H8300_PERCPU__
2#define __ARCH_H8300_PERCPU__
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ARCH_H8300_PERCPU__ */
diff --git a/include/asm-h8300/pgalloc.h b/include/asm-h8300/pgalloc.h
new file mode 100644
index 000000000000..c2e89a286d23
--- /dev/null
+++ b/include/asm-h8300/pgalloc.h
@@ -0,0 +1,8 @@
1#ifndef _H8300_PGALLOC_H
2#define _H8300_PGALLOC_H
3
4#include <asm/setup.h>
5
6#define check_pgt_cache() do { } while (0)
7
8#endif /* _H8300_PGALLOC_H */
diff --git a/include/asm-h8300/pgtable.h b/include/asm-h8300/pgtable.h
new file mode 100644
index 000000000000..69076eb31476
--- /dev/null
+++ b/include/asm-h8300/pgtable.h
@@ -0,0 +1,79 @@
1#ifndef _H8300_PGTABLE_H
2#define _H8300_PGTABLE_H
3
4#include <asm-generic/4level-fixup.h>
5
6#include <linux/config.h>
7#include <linux/slab.h>
8#include <asm/processor.h>
9#include <asm/page.h>
10#include <asm/io.h>
11
12#define pgd_present(pgd) (1) /* pages are always present on NO_MM */
13#define pgd_none(pgd) (0)
14#define pgd_bad(pgd) (0)
15#define pgd_clear(pgdp)
16#define kern_addr_valid(addr) (1)
17#define pmd_offset(a, b) ((void *)0)
18#define pmd_none(pmd) (1)
19#define pgd_offset_k(adrdress) ((pgd_t *)0)
20#define pte_offset_kernel(dir, address) ((pte_t *)0)
21
22#define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
23#define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
24#define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
25#define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
26#define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
27
28extern void paging_init(void);
29#define swapper_pg_dir ((pgd_t *) 0)
30
31#define __swp_type(x) (0)
32#define __swp_offset(x) (0)
33#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
34#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
35#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
36
37static inline int pte_file(pte_t pte) { return 0; }
38
39/*
40 * ZERO_PAGE is a global shared page that is always zero: used
41 * for zero-mapped memory areas etc..
42 */
43#define ZERO_PAGE(vaddr) (virt_to_page(0))
44
45/*
46 * These would be in other places but having them here reduces the diffs.
47 */
48extern unsigned int kobjsize(const void *objp);
49extern int is_in_rom(unsigned long);
50
51/*
52 * No page table caches to initialise
53 */
54#define pgtable_cache_init() do { } while (0)
55#define io_remap_page_range(vma, vaddr, paddr, size, prot) \
56 remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot)
57
58#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
59 remap_pfn_range(vma, vaddr, pfn, size, prot)
60
61#define MK_IOSPACE_PFN(space, pfn) (pfn)
62#define GET_IOSPACE(pfn) 0
63#define GET_PFN(pfn) (pfn)
64
65/*
66 * All 32bit addresses are effectively valid for vmalloc...
67 * Sort of meaningless for non-VM targets.
68 */
69#define VMALLOC_START 0
70#define VMALLOC_END 0xffffffff
71
72/*
73 * All 32bit addresses are effectively valid for vmalloc...
74 * Sort of meaningless for non-VM targets.
75 */
76#define VMALLOC_START 0
77#define VMALLOC_END 0xffffffff
78
79#endif /* _H8300_PGTABLE_H */
diff --git a/include/asm-h8300/poll.h b/include/asm-h8300/poll.h
new file mode 100644
index 000000000000..bf49ab8ad6da
--- /dev/null
+++ b/include/asm-h8300/poll.h
@@ -0,0 +1,22 @@
1#ifndef __H8300_POLL_H
2#define __H8300_POLL_H
3
4#define POLLIN 1
5#define POLLPRI 2
6#define POLLOUT 4
7#define POLLERR 8
8#define POLLHUP 16
9#define POLLNVAL 32
10#define POLLRDNORM 64
11#define POLLWRNORM POLLOUT
12#define POLLRDBAND 128
13#define POLLWRBAND 256
14#define POLLMSG 0x0400
15
16struct pollfd {
17 int fd;
18 short events;
19 short revents;
20};
21
22#endif
diff --git a/include/asm-h8300/posix_types.h b/include/asm-h8300/posix_types.h
new file mode 100644
index 000000000000..7de94b1fd0e5
--- /dev/null
+++ b/include/asm-h8300/posix_types.h
@@ -0,0 +1,64 @@
1#ifndef __ARCH_H8300_POSIX_TYPES_H
2#define __ARCH_H8300_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned long __kernel_ino_t;
11typedef unsigned short __kernel_mode_t;
12typedef unsigned short __kernel_nlink_t;
13typedef long __kernel_off_t;
14typedef int __kernel_pid_t;
15typedef unsigned short __kernel_ipc_pid_t;
16typedef unsigned short __kernel_uid_t;
17typedef unsigned short __kernel_gid_t;
18typedef unsigned int __kernel_size_t;
19typedef int __kernel_ssize_t;
20typedef int __kernel_ptrdiff_t;
21typedef long __kernel_time_t;
22typedef long __kernel_suseconds_t;
23typedef long __kernel_clock_t;
24typedef int __kernel_timer_t;
25typedef int __kernel_clockid_t;
26typedef int __kernel_daddr_t;
27typedef char * __kernel_caddr_t;
28typedef unsigned short __kernel_uid16_t;
29typedef unsigned short __kernel_gid16_t;
30typedef unsigned int __kernel_uid32_t;
31typedef unsigned int __kernel_gid32_t;
32
33typedef unsigned short __kernel_old_uid_t;
34typedef unsigned short __kernel_old_gid_t;
35
36#ifdef __GNUC__
37typedef long long __kernel_loff_t;
38#endif
39
40typedef struct {
41#if defined(__KERNEL__) || defined(__USE_ALL)
42 int val[2];
43#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
44 int __val[2];
45#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
46} __kernel_fsid_t;
47
48#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
49
50#undef __FD_SET
51#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
52
53#undef __FD_CLR
54#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
55
56#undef __FD_ISSET
57#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
58
59#undef __FD_ZERO
60#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
61
62#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
63
64#endif
diff --git a/include/asm-h8300/processor.h b/include/asm-h8300/processor.h
new file mode 100644
index 000000000000..c6f0a7108ef3
--- /dev/null
+++ b/include/asm-h8300/processor.h
@@ -0,0 +1,135 @@
1/*
2 * include/asm-h8300/processor.h
3 *
4 * Copyright (C) 2002 Yoshinori Sato
5 *
6 * Based on: linux/asm-m68nommu/processor.h
7 *
8 * Copyright (C) 1995 Hamish Macdonald
9 */
10
11#ifndef __ASM_H8300_PROCESSOR_H
12#define __ASM_H8300_PROCESSOR_H
13
14/*
15 * Default implementation of macro that returns current
16 * instruction pointer ("program counter").
17 */
18#define current_text_addr() ({ __label__ _l; _l: &&_l;})
19
20#include <linux/config.h>
21#include <asm/segment.h>
22#include <asm/fpu.h>
23#include <asm/ptrace.h>
24#include <asm/current.h>
25
26static inline unsigned long rdusp(void) {
27 extern unsigned int sw_usp;
28 return(sw_usp);
29}
30
31static inline void wrusp(unsigned long usp) {
32 extern unsigned int sw_usp;
33 sw_usp = usp;
34}
35
36/*
37 * User space process size: 3.75GB. This is hardcoded into a few places,
38 * so don't change it unless you know what you are doing.
39 */
40#define TASK_SIZE (0xFFFFFFFFUL)
41
42/*
43 * This decides where the kernel will search for a free chunk of vm
44 * space during mmap's. We won't be using it
45 */
46#define TASK_UNMAPPED_BASE 0
47
48struct thread_struct {
49 unsigned long ksp; /* kernel stack pointer */
50 unsigned long usp; /* user stack pointer */
51 unsigned long ccr; /* saved status register */
52 unsigned long esp0; /* points to SR of stack frame */
53 struct {
54 unsigned short *addr;
55 unsigned short inst;
56 } breakinfo;
57};
58
59#define INIT_THREAD { \
60 .ksp = sizeof(init_stack) + (unsigned long)init_stack, \
61 .usp = 0, \
62 .ccr = PS_S, \
63 .esp0 = 0, \
64 .breakinfo = { \
65 .addr = (unsigned short *)-1, \
66 .inst = 0 \
67 } \
68}
69
70/*
71 * Do necessary setup to start up a newly executed thread.
72 *
73 * pass the data segment into user programs if it exists,
74 * it can't hurt anything as far as I can tell
75 */
76#if defined(__H8300H__)
77#define start_thread(_regs, _pc, _usp) \
78do { \
79 set_fs(USER_DS); /* reads from user space */ \
80 (_regs)->pc = (_pc); \
81 (_regs)->ccr &= 0x00; /* clear kernel flag */ \
82 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
83 wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \
84} while(0)
85#endif
86#if defined(__H8300S__)
87#define start_thread(_regs, _pc, _usp) \
88do { \
89 set_fs(USER_DS); /* reads from user space */ \
90 (_regs)->pc = (_pc); \
91 (_regs)->ccr = 0x00; /* clear kernel flag */ \
92 (_regs)->exr = 0x78; /* enable all interrupts */ \
93 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
94 /* 14 = space for retaddr(4), vector(4), er0(4) and ext(2) on stack */ \
95 wrusp(((unsigned long)(_usp)) - 14); \
96} while(0)
97#endif
98
99/* Forward declaration, a strange C thing */
100struct task_struct;
101
102/* Free all resources held by a thread. */
103static inline void release_thread(struct task_struct *dead_task)
104{
105}
106
107extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
108
109#define prepare_to_copy(tsk) do { } while (0)
110
111/*
112 * Free current thread data structures etc..
113 */
114static inline void exit_thread(void)
115{
116}
117
118/*
119 * Return saved PC of a blocked thread.
120 */
121unsigned long thread_saved_pc(struct task_struct *tsk);
122unsigned long get_wchan(struct task_struct *p);
123
124#define KSTK_EIP(tsk) \
125 ({ \
126 unsigned long eip = 0; \
127 if ((tsk)->thread.esp0 > PAGE_SIZE && \
128 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
129 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
130 eip; })
131#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
132
133#define cpu_relax() do { } while (0)
134
135#endif
diff --git a/include/asm-h8300/ptrace.h b/include/asm-h8300/ptrace.h
new file mode 100644
index 000000000000..c2e05e4b512e
--- /dev/null
+++ b/include/asm-h8300/ptrace.h
@@ -0,0 +1,64 @@
1#ifndef _H8300_PTRACE_H
2#define _H8300_PTRACE_H
3
4#ifndef __ASSEMBLY__
5
6#define PT_ER1 0
7#define PT_ER2 1
8#define PT_ER3 2
9#define PT_ER4 3
10#define PT_ER5 4
11#define PT_ER6 5
12#define PT_ER0 6
13#define PT_ORIG_ER0 7
14#define PT_CCR 8
15#define PT_PC 9
16#define PT_USP 10
17#define PT_EXR 12
18
19/* this struct defines the way the registers are stored on the
20 stack during a system call. */
21
22struct pt_regs {
23 long retpc;
24 long er4;
25 long er5;
26 long er6;
27 long er3;
28 long er2;
29 long er1;
30 long orig_er0;
31 unsigned short ccr;
32 long er0;
33 long vector;
34#if defined(CONFIG_CPU_H8S)
35 unsigned short exr;
36#endif
37 unsigned long pc;
38} __attribute__((aligned(2),packed));
39
40#define PTRACE_GETREGS 12
41#define PTRACE_SETREGS 13
42
43#ifdef __KERNEL__
44#ifndef PS_S
45#define PS_S (0x10)
46#endif
47
48#if defined(__H8300H__)
49#define H8300_REGS_NO 11
50#endif
51#if defined(__H8300S__)
52#define H8300_REGS_NO 12
53#endif
54
55/* Find the stack offset for a register, relative to thread.esp0. */
56#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg)
57
58#define user_mode(regs) (!((regs)->ccr & PS_S))
59#define instruction_pointer(regs) ((regs)->pc)
60#define profile_pc(regs) instruction_pointer(regs)
61extern void show_regs(struct pt_regs *);
62#endif /* __KERNEL__ */
63#endif /* __ASSEMBLY__ */
64#endif /* _H8300_PTRACE_H */
diff --git a/include/asm-h8300/regs267x.h b/include/asm-h8300/regs267x.h
new file mode 100644
index 000000000000..1bff731a9f77
--- /dev/null
+++ b/include/asm-h8300/regs267x.h
@@ -0,0 +1,336 @@
1/* internal Peripherals Register address define */
2/* CPU: H8/306x */
3
4#if !defined(__REGS_H8S267x__)
5#define __REGS_H8S267x__
6
7#if defined(__KERNEL__)
8
9#define DASTCR 0xFEE01A
10#define DADR0 0xFFFFA4
11#define DADR1 0xFFFFA5
12#define DACR01 0xFFFFA6
13#define DADR2 0xFFFFA8
14#define DADR3 0xFFFFA9
15#define DACR23 0xFFFFAA
16
17#define ADDRA 0xFFFF90
18#define ADDRAH 0xFFFF90
19#define ADDRAL 0xFFFF91
20#define ADDRB 0xFFFF92
21#define ADDRBH 0xFFFF92
22#define ADDRBL 0xFFFF93
23#define ADDRC 0xFFFF94
24#define ADDRCH 0xFFFF94
25#define ADDRCL 0xFFFF95
26#define ADDRD 0xFFFF96
27#define ADDRDH 0xFFFF96
28#define ADDRDL 0xFFFF97
29#define ADDRE 0xFFFF98
30#define ADDREH 0xFFFF98
31#define ADDREL 0xFFFF99
32#define ADDRF 0xFFFF9A
33#define ADDRFH 0xFFFF9A
34#define ADDRFL 0xFFFF9B
35#define ADDRG 0xFFFF9C
36#define ADDRGH 0xFFFF9C
37#define ADDRGL 0xFFFF9D
38#define ADDRH 0xFFFF9E
39#define ADDRHH 0xFFFF9E
40#define ADDRHL 0xFFFF9F
41
42#define ADCSR 0xFFFFA0
43#define ADCR 0xFFFFA1
44
45#define ABWCR 0xFFFEC0
46#define ASTCR 0xFFFEC1
47#define WTCRAH 0xFFFEC2
48#define WTCRAL 0xFFFEC3
49#define WTCRBH 0xFFFEC4
50#define WTCRBL 0xFFFEC5
51#define RDNCR 0xFFFEC6
52#define CSACRH 0xFFFEC8
53#define CSACRL 0xFFFEC9
54#define BROMCRH 0xFFFECA
55#define BROMCRL 0xFFFECB
56#define BCR 0xFFFECC
57#define DRAMCR 0xFFFED0
58#define DRACCR 0xFFFED2
59#define REFCR 0xFFFED4
60#define RTCNT 0xFFFED6
61#define RTCOR 0xFFFED7
62
63#define MAR0AH 0xFFFEE0
64#define MAR0AL 0xFFFEE2
65#define IOAR0A 0xFFFEE4
66#define ETCR0A 0xFFFEE6
67#define MAR0BH 0xFFFEE8
68#define MAR0BL 0xFFFEEA
69#define IOAR0B 0xFFFEEC
70#define ETCR0B 0xFFFEEE
71#define MAR1AH 0xFFFEF0
72#define MAR1AL 0xFFFEF2
73#define IOAR1A 0xFFFEF4
74#define ETCR1A 0xFFFEF6
75#define MAR1BH 0xFFFEF8
76#define MAR1BL 0xFFFEFA
77#define IOAR1B 0xFFFEFC
78#define ETCR1B 0xFFFEFE
79#define DMAWER 0xFFFF20
80#define DMATCR 0xFFFF21
81#define DMACR0A 0xFFFF22
82#define DMACR0B 0xFFFF23
83#define DMACR1A 0xFFFF24
84#define DMACR1B 0xFFFF25
85#define DMABCRH 0xFFFF26
86#define DMABCRL 0xFFFF27
87
88#define EDSAR0 0xFFFDC0
89#define EDDAR0 0xFFFDC4
90#define EDTCR0 0xFFFDC8
91#define EDMDR0 0xFFFDCC
92#define EDMDR0H 0xFFFDCC
93#define EDMDR0L 0xFFFDCD
94#define EDACR0 0xFFFDCE
95#define EDSAR1 0xFFFDD0
96#define EDDAR1 0xFFFDD4
97#define EDTCR1 0xFFFDD8
98#define EDMDR1 0xFFFDDC
99#define EDMDR1H 0xFFFDDC
100#define EDMDR1L 0xFFFDDD
101#define EDACR1 0xFFFDDE
102#define EDSAR2 0xFFFDE0
103#define EDDAR2 0xFFFDE4
104#define EDTCR2 0xFFFDE8
105#define EDMDR2 0xFFFDEC
106#define EDMDR2H 0xFFFDEC
107#define EDMDR2L 0xFFFDED
108#define EDACR2 0xFFFDEE
109#define EDSAR3 0xFFFDF0
110#define EDDAR3 0xFFFDF4
111#define EDTCR3 0xFFFDF8
112#define EDMDR3 0xFFFDFC
113#define EDMDR3H 0xFFFDFC
114#define EDMDR3L 0xFFFDFD
115#define EDACR3 0xFFFDFE
116
117#define IPRA 0xFFFE00
118#define IPRB 0xFFFE02
119#define IPRC 0xFFFE04
120#define IPRD 0xFFFE06
121#define IPRE 0xFFFE08
122#define IPRF 0xFFFE0A
123#define IPRG 0xFFFE0C
124#define IPRH 0xFFFE0E
125#define IPRI 0xFFFE10
126#define IPRJ 0xFFFE12
127#define IPRK 0xFFFE14
128#define ITSR 0xFFFE16
129#define SSIER 0xFFFE18
130#define ISCRH 0xFFFE1A
131#define ISCRL 0xFFFE1C
132
133#define INTCR 0xFFFF31
134#define IER 0xFFFF32
135#define IERH 0xFFFF32
136#define IERL 0xFFFF33
137#define ISR 0xFFFF34
138#define ISRH 0xFFFF34
139#define ISRL 0xFFFF35
140
141#define P1DDR 0xFFFE20
142#define P2DDR 0xFFFE21
143#define P3DDR 0xFFFE22
144#define P4DDR 0xFFFE23
145#define P5DDR 0xFFFE24
146#define P6DDR 0xFFFE25
147#define P7DDR 0xFFFE26
148#define P8DDR 0xFFFE27
149#define P9DDR 0xFFFE28
150#define PADDR 0xFFFE29
151#define PBDDR 0xFFFE2A
152#define PCDDR 0xFFFE2B
153#define PDDDR 0xFFFE2C
154#define PEDDR 0xFFFE2D
155#define PFDDR 0xFFFE2E
156#define PGDDR 0xFFFE2F
157#define PHDDR 0xFFFF74
158
159#define PFCR0 0xFFFE32
160#define PFCR1 0xFFFE33
161#define PFCR2 0xFFFE34
162
163#define PAPCR 0xFFFE36
164#define PBPCR 0xFFFE37
165#define PCPCR 0xFFFE38
166#define PDPCR 0xFFFE39
167#define PEPCR 0xFFFE3A
168
169#define P3ODR 0xFFFE3C
170#define PAODR 0xFFFE3D
171
172#define P1DR 0xFFFF60
173#define P2DR 0xFFFF61
174#define P3DR 0xFFFF62
175#define P4DR 0xFFFF63
176#define P5DR 0xFFFF64
177#define P6DR 0xFFFF65
178#define P7DR 0xFFFF66
179#define P8DR 0xFFFF67
180#define P9DR 0xFFFF68
181#define PADR 0xFFFF69
182#define PBDR 0xFFFF6A
183#define PCDR 0xFFFF6B
184#define PDDR 0xFFFF6C
185#define PEDR 0xFFFF6D
186#define PFDR 0xFFFF6E
187#define PGDR 0xFFFF6F
188#define PHDR 0xFFFF72
189
190#define PORT1 0xFFFF50
191#define PORT2 0xFFFF51
192#define PORT3 0xFFFF52
193#define PORT4 0xFFFF53
194#define PORT5 0xFFFF54
195#define PORT6 0xFFFF55
196#define PORT7 0xFFFF56
197#define PORT8 0xFFFF57
198#define PORT9 0xFFFF58
199#define PORTA 0xFFFF59
200#define PORTB 0xFFFF5A
201#define PORTC 0xFFFF5B
202#define PORTD 0xFFFF5C
203#define PORTE 0xFFFF5D
204#define PORTF 0xFFFF5E
205#define PORTG 0xFFFF5F
206#define PORTH 0xFFFF70
207
208#define PCR 0xFFFF46
209#define PMR 0xFFFF47
210#define NDERH 0xFFFF48
211#define NDERL 0xFFFF49
212#define PODRH 0xFFFF4A
213#define PODRL 0xFFFF4B
214#define NDRH1 0xFFFF4C
215#define NDRL1 0xFFFF4D
216#define NDRH2 0xFFFF4E
217#define NDRL2 0xFFFF4F
218
219#define SMR0 0xFFFF78
220#define BRR0 0xFFFF79
221#define SCR0 0xFFFF7A
222#define TDR0 0xFFFF7B
223#define SSR0 0xFFFF7C
224#define RDR0 0xFFFF7D
225#define SCMR0 0xFFFF7E
226#define SMR1 0xFFFF80
227#define BRR1 0xFFFF81
228#define SCR1 0xFFFF82
229#define TDR1 0xFFFF83
230#define SSR1 0xFFFF84
231#define RDR1 0xFFFF85
232#define SCMR1 0xFFFF86
233#define SMR2 0xFFFF88
234#define BRR2 0xFFFF89
235#define SCR2 0xFFFF8A
236#define TDR2 0xFFFF8B
237#define SSR2 0xFFFF8C
238#define RDR2 0xFFFF8D
239#define SCMR2 0xFFFF8E
240
241#define IRCR0 0xFFFE1E
242#define SEMR 0xFFFDA8
243
244#define MDCR 0xFFFF3E
245#define SYSCR 0xFFFF3D
246#define MSTPCRH 0xFFFF40
247#define MSTPCRL 0xFFFF41
248#define FLMCR1 0xFFFFC8
249#define FLMCR2 0xFFFFC9
250#define EBR1 0xFFFFCA
251#define EBR2 0xFFFFCB
252#define CTGARC_RAMCR 0xFFFECE
253#define SBYCR 0xFFFF3A
254#define SCKCR 0xFFFF3B
255#define PLLCR 0xFFFF45
256
257#define TSTR 0xFFFFC0
258#define TSNC 0XFFFFC1
259
260#define TCR0 0xFFFFD0
261#define TMDR0 0xFFFFD1
262#define TIORH0 0xFFFFD2
263#define TIORL0 0xFFFFD3
264#define TIER0 0xFFFFD4
265#define TSR0 0xFFFFD5
266#define TCNT0 0xFFFFD6
267#define GRA0 0xFFFFD8
268#define GRB0 0xFFFFDA
269#define GRC0 0xFFFFDC
270#define GRD0 0xFFFFDE
271#define TCR1 0xFFFFE0
272#define TMDR1 0xFFFFE1
273#define TIORH1 0xFFFFE2
274#define TIORL1 0xFFFFE3
275#define TIER1 0xFFFFE4
276#define TSR1 0xFFFFE5
277#define TCNT1 0xFFFFE6
278#define GRA1 0xFFFFE8
279#define GRB1 0xFFFFEA
280#define TCR2 0xFFFFF0
281#define TMDR2 0xFFFFF1
282#define TIORH2 0xFFFFF2
283#define TIORL2 0xFFFFF3
284#define TIER2 0xFFFFF4
285#define TSR2 0xFFFFF5
286#define TCNT2 0xFFFFF6
287#define GRA2 0xFFFFF8
288#define GRB2 0xFFFFFA
289#define TCR3 0xFFFE80
290#define TMDR3 0xFFFE81
291#define TIORH3 0xFFFE82
292#define TIORL3 0xFFFE83
293#define TIER3 0xFFFE84
294#define TSR3 0xFFFE85
295#define TCNT3 0xFFFE86
296#define GRA3 0xFFFE88
297#define GRB3 0xFFFE8A
298#define GRC3 0xFFFE8C
299#define GRD3 0xFFFE8E
300#define TCR4 0xFFFE90
301#define TMDR4 0xFFFE91
302#define TIORH4 0xFFFE92
303#define TIORL4 0xFFFE93
304#define TIER4 0xFFFE94
305#define TSR4 0xFFFE95
306#define TCNT4 0xFFFE96
307#define GRA4 0xFFFE98
308#define GRB4 0xFFFE9A
309#define TCR5 0xFFFEA0
310#define TMDR5 0xFFFEA1
311#define TIORH5 0xFFFEA2
312#define TIORL5 0xFFFEA3
313#define TIER5 0xFFFEA4
314#define TSR5 0xFFFEA5
315#define TCNT5 0xFFFEA6
316#define GRA5 0xFFFEA8
317#define GRB5 0xFFFEAA
318
319#define _8TCR0 0xFFFFB0
320#define _8TCR1 0xFFFFB1
321#define _8TCSR0 0xFFFFB2
322#define _8TCSR1 0xFFFFB3
323#define _8TCORA0 0xFFFFB4
324#define _8TCORA1 0xFFFFB5
325#define _8TCORB0 0xFFFFB6
326#define _8TCORB1 0xFFFFB7
327#define _8TCNT0 0xFFFFB8
328#define _8TCNT1 0xFFFFB9
329
330#define TCSR 0xFFFFBC
331#define TCNT 0xFFFFBD
332#define RSTCSRW 0xFFFFBE
333#define RSTCSRR 0xFFFFBF
334
335#endif /* __KERNEL__ */
336#endif /* __REGS_H8S267x__ */
diff --git a/include/asm-h8300/regs306x.h b/include/asm-h8300/regs306x.h
new file mode 100644
index 000000000000..027dd633fa25
--- /dev/null
+++ b/include/asm-h8300/regs306x.h
@@ -0,0 +1,212 @@
1/* internal Peripherals Register address define */
2/* CPU: H8/306x */
3
4#if !defined(__REGS_H8306x__)
5#define __REGS_H8306x__
6
7#if defined(__KERNEL__)
8
9#define DASTCR 0xFEE01A
10#define DADR0 0xFEE09C
11#define DADR1 0xFEE09D
12#define DACR 0xFEE09E
13
14#define ADDRAH 0xFFFFE0
15#define ADDRAL 0xFFFFE1
16#define ADDRBH 0xFFFFE2
17#define ADDRBL 0xFFFFE3
18#define ADDRCH 0xFFFFE4
19#define ADDRCL 0xFFFFE5
20#define ADDRDH 0xFFFFE6
21#define ADDRDL 0xFFFFE7
22#define ADCSR 0xFFFFE8
23#define ADCR 0xFFFFE9
24
25#define BRCR 0xFEE013
26#define ADRCR 0xFEE01E
27#define CSCR 0xFEE01F
28#define ABWCR 0xFEE020
29#define ASTCR 0xFEE021
30#define WCRH 0xFEE022
31#define WCRL 0xFEE023
32#define BCR 0xFEE024
33#define DRCRA 0xFEE026
34#define DRCRB 0xFEE027
35#define RTMCSR 0xFEE028
36#define RTCNT 0xFEE029
37#define RTCOR 0xFEE02A
38
39#define MAR0AR 0xFFFF20
40#define MAR0AE 0xFFFF21
41#define MAR0AH 0xFFFF22
42#define MAR0AL 0xFFFF23
43#define ETCR0AL 0xFFFF24
44#define ETCR0AH 0xFFFF25
45#define IOAR0A 0xFFFF26
46#define DTCR0A 0xFFFF27
47#define MAR0BR 0xFFFF28
48#define MAR0BE 0xFFFF29
49#define MAR0BH 0xFFFF2A
50#define MAR0BL 0xFFFF2B
51#define ETCR0BL 0xFFFF2C
52#define ETCR0BH 0xFFFF2D
53#define IOAR0B 0xFFFF2E
54#define DTCR0B 0xFFFF2F
55#define MAR1AR 0xFFFF30
56#define MAR1AE 0xFFFF31
57#define MAR1AH 0xFFFF32
58#define MAR1AL 0xFFFF33
59#define ETCR1AL 0xFFFF34
60#define ETCR1AH 0xFFFF35
61#define IOAR1A 0xFFFF36
62#define DTCR1A 0xFFFF37
63#define MAR1BR 0xFFFF38
64#define MAR1BE 0xFFFF39
65#define MAR1BH 0xFFFF3A
66#define MAR1BL 0xFFFF3B
67#define ETCR1BL 0xFFFF3C
68#define ETCR1BH 0xFFFF3D
69#define IOAR1B 0xFFFF3E
70#define DTCR1B 0xFFFF3F
71
72#define ISCR 0xFEE014
73#define IER 0xFEE015
74#define ISR 0xFEE016
75#define IPRA 0xFEE018
76#define IPRB 0xFEE019
77
78#define P1DDR 0xFEE000
79#define P2DDR 0xFEE001
80#define P3DDR 0xFEE002
81#define P4DDR 0xFEE003
82#define P5DDR 0xFEE004
83#define P6DDR 0xFEE005
84/*#define P7DDR 0xFEE006*/
85#define P8DDR 0xFEE007
86#define P9DDR 0xFEE008
87#define PADDR 0xFEE009
88#define PBDDR 0xFEE00A
89
90#define P1DR 0xFFFFD0
91#define P2DR 0xFFFFD1
92#define P3DR 0xFFFFD2
93#define P4DR 0xFFFFD3
94#define P5DR 0xFFFFD4
95#define P6DR 0xFFFFD5
96/*#define P7DR 0xFFFFD6*/
97#define P8DR 0xFFFFD7
98#define P9DR 0xFFFFD8
99#define PADR 0xFFFFD9
100#define PBDR 0xFFFFDA
101
102#define P2CR 0xFEE03C
103#define P4CR 0xFEE03E
104#define P5CR 0xFEE03F
105
106#define SMR0 0xFFFFB0
107#define BRR0 0xFFFFB1
108#define SCR0 0xFFFFB2
109#define TDR0 0xFFFFB3
110#define SSR0 0xFFFFB4
111#define RDR0 0xFFFFB5
112#define SCMR0 0xFFFFB6
113#define SMR1 0xFFFFB8
114#define BRR1 0xFFFFB9
115#define SCR1 0xFFFFBA
116#define TDR1 0xFFFFBB
117#define SSR1 0xFFFFBC
118#define RDR1 0xFFFFBD
119#define SCMR1 0xFFFFBE
120#define SMR2 0xFFFFC0
121#define BRR2 0xFFFFC1
122#define SCR2 0xFFFFC2
123#define TDR2 0xFFFFC3
124#define SSR2 0xFFFFC4
125#define RDR2 0xFFFFC5
126#define SCMR2 0xFFFFC6
127
128#define MDCR 0xFEE011
129#define SYSCR 0xFEE012
130#define DIVCR 0xFEE01B
131#define MSTCRH 0xFEE01C
132#define MSTCRL 0xFEE01D
133#define FLMCR1 0xFEE030
134#define FLMCR2 0xFEE031
135#define EBR1 0xFEE032
136#define EBR2 0xFEE033
137#define RAMCR 0xFEE077
138
139#define TSTR 0xFFFF60
140#define TSNC 0XFFFF61
141#define TMDR 0xFFFF62
142#define TOLR 0xFFFF63
143#define TISRA 0xFFFF64
144#define TISRB 0xFFFF65
145#define TISRC 0xFFFF66
146#define TCR0 0xFFFF68
147#define TIOR0 0xFFFF69
148#define TCNT0H 0xFFFF6A
149#define TCNT0L 0xFFFF6B
150#define GRA0H 0xFFFF6C
151#define GRA0L 0xFFFF6D
152#define GRB0H 0xFFFF6E
153#define GRB0L 0xFFFF6F
154#define TCR1 0xFFFF70
155#define TIOR1 0xFFFF71
156#define TCNT1H 0xFFFF72
157#define TCNT1L 0xFFFF73
158#define GRA1H 0xFFFF74
159#define GRA1L 0xFFFF75
160#define GRB1H 0xFFFF76
161#define GRB1L 0xFFFF77
162#define TCR3 0xFFFF78
163#define TIOR3 0xFFFF79
164#define TCNT3H 0xFFFF7A
165#define TCNT3L 0xFFFF7B
166#define GRA3H 0xFFFF7C
167#define GRA3L 0xFFFF7D
168#define GRB3H 0xFFFF7E
169#define GRB3L 0xFFFF7F
170
171#define _8TCR0 0xFFFF80
172#define _8TCR1 0xFFFF81
173#define _8TCSR0 0xFFFF82
174#define _8TCSR1 0xFFFF83
175#define TCORA0 0xFFFF84
176#define TCORA1 0xFFFF85
177#define TCORB0 0xFFFF86
178#define TCORB1 0xFFFF87
179#define _8TCNT0 0xFFFF88
180#define _8TCNT1 0xFFFF89
181
182#define _8TCR2 0xFFFF90
183#define _8TCR3 0xFFFF91
184#define _8TCSR2 0xFFFF92
185#define _8TCSR3 0xFFFF93
186#define TCORA2 0xFFFF94
187#define TCORA3 0xFFFF95
188#define TCORB2 0xFFFF96
189#define TCORB3 0xFFFF97
190#define _8TCNT2 0xFFFF98
191#define _8TCNT3 0xFFFF99
192
193#define TCSR 0xFFFF8C
194#define TCNT 0xFFFF8D
195#define RSTCSR 0xFFFF8F
196
197#define TPMR 0xFFFFA0
198#define TPCR 0xFFFFA1
199#define NDERB 0xFFFFA2
200#define NDERA 0xFFFFA3
201#define NDRB1 0xFFFFA4
202#define NDRA1 0xFFFFA5
203#define NDRB2 0xFFFFA6
204#define NDRA2 0xFFFFA7
205
206#define TCSR 0xFFFF8C
207#define TCNT 0xFFFF8D
208#define RSTCSRW 0xFFFF8E
209#define RSTCSRR 0xFFFF8F
210
211#endif /* __KERNEL__ */
212#endif /* __REGS_H8306x__ */
diff --git a/include/asm-h8300/resource.h b/include/asm-h8300/resource.h
new file mode 100644
index 000000000000..46c5f4391607
--- /dev/null
+++ b/include/asm-h8300/resource.h
@@ -0,0 +1,6 @@
1#ifndef _H8300_RESOURCE_H
2#define _H8300_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif /* _H8300_RESOURCE_H */
diff --git a/include/asm-h8300/scatterlist.h b/include/asm-h8300/scatterlist.h
new file mode 100644
index 000000000000..7627f0cd1a2f
--- /dev/null
+++ b/include/asm-h8300/scatterlist.h
@@ -0,0 +1,13 @@
1#ifndef _H8300_SCATTERLIST_H
2#define _H8300_SCATTERLIST_H
3
4struct scatterlist {
5 struct page *page;
6 unsigned int offset;
7 dma_addr_t dma_address;
8 unsigned int length;
9};
10
11#define ISA_DMA_THRESHOLD (0xffffffff)
12
13#endif /* !(_H8300_SCATTERLIST_H) */
diff --git a/include/asm-h8300/sections.h b/include/asm-h8300/sections.h
new file mode 100644
index 000000000000..a81743e8b743
--- /dev/null
+++ b/include/asm-h8300/sections.h
@@ -0,0 +1,6 @@
1#ifndef _H8300_SECTIONS_H_
2#define _H8300_SECTIONS_H_
3
4#include <asm-generic/sections.h>
5
6#endif
diff --git a/include/asm-h8300/segment.h b/include/asm-h8300/segment.h
new file mode 100644
index 000000000000..b79a82d0f99d
--- /dev/null
+++ b/include/asm-h8300/segment.h
@@ -0,0 +1,49 @@
1#ifndef _H8300_SEGMENT_H
2#define _H8300_SEGMENT_H
3
4/* define constants */
5#define USER_DATA (1)
6#ifndef __USER_DS
7#define __USER_DS (USER_DATA)
8#endif
9#define USER_PROGRAM (2)
10#define SUPER_DATA (3)
11#ifndef __KERNEL_DS
12#define __KERNEL_DS (SUPER_DATA)
13#endif
14#define SUPER_PROGRAM (4)
15
16#ifndef __ASSEMBLY__
17
18typedef struct {
19 unsigned long seg;
20} mm_segment_t;
21
22#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
23#define USER_DS MAKE_MM_SEG(__USER_DS)
24#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)
25
26/*
27 * Get/set the SFC/DFC registers for MOVES instructions
28 */
29
30static inline mm_segment_t get_fs(void)
31{
32 return USER_DS;
33}
34
35static inline mm_segment_t get_ds(void)
36{
37 /* return the supervisor data space code */
38 return KERNEL_DS;
39}
40
41static inline void set_fs(mm_segment_t val)
42{
43}
44
45#define segment_eq(a,b) ((a).seg == (b).seg)
46
47#endif /* __ASSEMBLY__ */
48
49#endif /* _H8300_SEGMENT_H */
diff --git a/include/asm-h8300/semaphore-helper.h b/include/asm-h8300/semaphore-helper.h
new file mode 100644
index 000000000000..29e0fbf1acb7
--- /dev/null
+++ b/include/asm-h8300/semaphore-helper.h
@@ -0,0 +1,86 @@
1#ifndef _H8300_SEMAPHORE_HELPER_H
2#define _H8300_SEMAPHORE_HELPER_H
3
4/*
5 * SMP- and interrupt-safe semaphores helper functions.
6 *
7 * (C) Copyright 1996 Linus Torvalds
8 *
9 * based on
10 * m68k version by Andreas Schwab
11 */
12
13#include <linux/config.h>
14#include <linux/errno.h>
15
16/*
17 * These two _must_ execute atomically wrt each other.
18 */
19static inline void wake_one_more(struct semaphore * sem)
20{
21 atomic_inc((atomic_t *)&sem->sleepers);
22}
23
24static inline int waking_non_zero(struct semaphore *sem)
25{
26 int ret;
27 unsigned long flags;
28
29 spin_lock_irqsave(&semaphore_wake_lock, flags);
30 ret = 0;
31 if (sem->sleepers > 0) {
32 sem->sleepers--;
33 ret = 1;
34 }
35 spin_unlock_irqrestore(&semaphore_wake_lock, flags);
36 return ret;
37}
38
39/*
40 * waking_non_zero_interruptible:
41 * 1 got the lock
42 * 0 go to sleep
43 * -EINTR interrupted
44 */
45static inline int waking_non_zero_interruptible(struct semaphore *sem,
46 struct task_struct *tsk)
47{
48 int ret;
49 unsigned long flags;
50
51 spin_lock_irqsave(&semaphore_wake_lock, flags);
52 ret = 0;
53 if (sem->sleepers > 0) {
54 sem->sleepers--;
55 ret = 1;
56 } else if (signal_pending(tsk)) {
57 atomic_inc(&sem->count);
58 ret = -EINTR;
59 }
60 spin_unlock_irqrestore(&semaphore_wake_lock, flags);
61 return ret;
62}
63
64/*
65 * waking_non_zero_trylock:
66 * 1 failed to lock
67 * 0 got the lock
68 */
69static inline int waking_non_zero_trylock(struct semaphore *sem)
70{
71 int ret;
72 unsigned long flags;
73
74 spin_lock_irqsave(&semaphore_wake_lock, flags);
75 ret = 1;
76 if (sem->sleepers <= 0)
77 atomic_inc(&sem->count);
78 else {
79 sem->sleepers--;
80 ret = 0;
81 }
82 spin_unlock_irqrestore(&semaphore_wake_lock, flags);
83 return ret;
84}
85
86#endif
diff --git a/include/asm-h8300/semaphore.h b/include/asm-h8300/semaphore.h
new file mode 100644
index 000000000000..fe6ef3774297
--- /dev/null
+++ b/include/asm-h8300/semaphore.h
@@ -0,0 +1,194 @@
1#ifndef _H8300_SEMAPHORE_H
2#define _H8300_SEMAPHORE_H
3
4#define RW_LOCK_BIAS 0x01000000
5
6#ifndef __ASSEMBLY__
7
8#include <linux/linkage.h>
9#include <linux/wait.h>
10#include <linux/spinlock.h>
11#include <linux/rwsem.h>
12
13#include <asm/system.h>
14#include <asm/atomic.h>
15
16/*
17 * Interrupt-safe semaphores..
18 *
19 * (C) Copyright 1996 Linus Torvalds
20 *
21 * H8/300 version by Yoshinori Sato
22 */
23
24
25struct semaphore {
26 atomic_t count;
27 int sleepers;
28 wait_queue_head_t wait;
29};
30
31#define __SEMAPHORE_INITIALIZER(name, n) \
32{ \
33 .count = ATOMIC_INIT(n), \
34 .sleepers = 0, \
35 .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
36}
37
38#define __MUTEX_INITIALIZER(name) \
39 __SEMAPHORE_INITIALIZER(name,1)
40
41#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
42 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
43
44#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
45#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
46
47static inline void sema_init (struct semaphore *sem, int val)
48{
49 *sem = (struct semaphore)__SEMAPHORE_INITIALIZER(*sem, val);
50}
51
52static inline void init_MUTEX (struct semaphore *sem)
53{
54 sema_init(sem, 1);
55}
56
57static inline void init_MUTEX_LOCKED (struct semaphore *sem)
58{
59 sema_init(sem, 0);
60}
61
62asmlinkage void __down_failed(void /* special register calling convention */);
63asmlinkage int __down_failed_interruptible(void /* params in registers */);
64asmlinkage int __down_failed_trylock(void /* params in registers */);
65asmlinkage void __up_wakeup(void /* special register calling convention */);
66
67asmlinkage void __down(struct semaphore * sem);
68asmlinkage int __down_interruptible(struct semaphore * sem);
69asmlinkage int __down_trylock(struct semaphore * sem);
70asmlinkage void __up(struct semaphore * sem);
71
72extern spinlock_t semaphore_wake_lock;
73
74/*
75 * This is ugly, but we want the default case to fall through.
76 * "down_failed" is a special asm handler that calls the C
77 * routine that actually waits. See arch/m68k/lib/semaphore.S
78 */
79static inline void down(struct semaphore * sem)
80{
81 register atomic_t *count asm("er0");
82
83 might_sleep();
84
85 count = &(sem->count);
86 __asm__ __volatile__(
87 "stc ccr,r3l\n\t"
88 "orc #0x80,ccr\n\t"
89 "mov.l %2, er1\n\t"
90 "dec.l #1,er1\n\t"
91 "mov.l er1,%0\n\t"
92 "bpl 1f\n\t"
93 "ldc r3l,ccr\n\t"
94 "mov.l %1,er0\n\t"
95 "jsr @___down\n\t"
96 "bra 2f\n"
97 "1:\n\t"
98 "ldc r3l,ccr\n"
99 "2:"
100 : "=m"(*count)
101 : "g"(sem),"m"(*count)
102 : "cc", "er1", "er2", "er3");
103}
104
105static inline int down_interruptible(struct semaphore * sem)
106{
107 register atomic_t *count asm("er0");
108
109 might_sleep();
110
111 count = &(sem->count);
112 __asm__ __volatile__(
113 "stc ccr,r1l\n\t"
114 "orc #0x80,ccr\n\t"
115 "mov.l %3, er2\n\t"
116 "dec.l #1,er2\n\t"
117 "mov.l er2,%1\n\t"
118 "bpl 1f\n\t"
119 "ldc r1l,ccr\n\t"
120 "mov.l %2,er0\n\t"
121 "jsr @___down_interruptible\n\t"
122 "bra 2f\n"
123 "1:\n\t"
124 "ldc r1l,ccr\n\t"
125 "sub.l %0,%0\n\t"
126 "2:\n\t"
127 : "=r" (count),"=m" (*count)
128 : "g"(sem),"m"(*count)
129 : "cc", "er1", "er2", "er3");
130 return (int)count;
131}
132
133static inline int down_trylock(struct semaphore * sem)
134{
135 register atomic_t *count asm("er0");
136
137 count = &(sem->count);
138 __asm__ __volatile__(
139 "stc ccr,r3l\n\t"
140 "orc #0x80,ccr\n\t"
141 "mov.l %3,er2\n\t"
142 "dec.l #1,er2\n\t"
143 "mov.l er2,%0\n\t"
144 "bpl 1f\n\t"
145 "ldc r3l,ccr\n\t"
146 "jmp @3f\n\t"
147 LOCK_SECTION_START(".align 2\n\t")
148 "3:\n\t"
149 "mov.l %2,er0\n\t"
150 "jsr @___down_trylock\n\t"
151 "jmp @2f\n\t"
152 LOCK_SECTION_END
153 "1:\n\t"
154 "ldc r3l,ccr\n\t"
155 "sub.l %1,%1\n"
156 "2:"
157 : "=m" (*count),"=r"(count)
158 : "g"(sem),"m"(*count)
159 : "cc", "er1","er2", "er3");
160 return (int)count;
161}
162
163/*
164 * Note! This is subtle. We jump to wake people up only if
165 * the semaphore was negative (== somebody was waiting on it).
166 * The default case (no contention) will result in NO
167 * jumps for both down() and up().
168 */
169static inline void up(struct semaphore * sem)
170{
171 register atomic_t *count asm("er0");
172
173 count = &(sem->count);
174 __asm__ __volatile__(
175 "stc ccr,r3l\n\t"
176 "orc #0x80,ccr\n\t"
177 "mov.l %2,er1\n\t"
178 "inc.l #1,er1\n\t"
179 "mov.l er1,%0\n\t"
180 "ldc r3l,ccr\n\t"
181 "sub.l er2,er2\n\t"
182 "cmp.l er2,er1\n\t"
183 "bgt 1f\n\t"
184 "mov.l %1,er0\n\t"
185 "jsr @___up\n"
186 "1:"
187 : "=m"(*count)
188 : "g"(sem),"m"(*count)
189 : "cc", "er1", "er2", "er3");
190}
191
192#endif /* __ASSEMBLY__ */
193
194#endif
diff --git a/include/asm-h8300/sembuf.h b/include/asm-h8300/sembuf.h
new file mode 100644
index 000000000000..e04a3ec0cb92
--- /dev/null
+++ b/include/asm-h8300/sembuf.h
@@ -0,0 +1,25 @@
1#ifndef _H8300_SEMBUF_H
2#define _H8300_SEMBUF_H
3
4/*
5 * The semid64_ds structure for m68k architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* _H8300_SEMBUF_H */
diff --git a/include/asm-h8300/setup.h b/include/asm-h8300/setup.h
new file mode 100644
index 000000000000..e2c600e96733
--- /dev/null
+++ b/include/asm-h8300/setup.h
@@ -0,0 +1,6 @@
1#ifndef __H8300_SETUP_H
2#define __H8300_SETUP_H
3
4#define COMMAND_LINE_SIZE 512
5
6#endif
diff --git a/include/asm-h8300/sh_bios.h b/include/asm-h8300/sh_bios.h
new file mode 100644
index 000000000000..b6bb6e58295c
--- /dev/null
+++ b/include/asm-h8300/sh_bios.h
@@ -0,0 +1,29 @@
1/* eCos HAL interface header */
2
3#ifndef SH_BIOS_H
4#define SH_BIOS_H
5
6#define HAL_IF_VECTOR_TABLE 0xfffe20
7#define CALL_IF_SET_CONSOLE_COMM 13
8#define QUERY_CURRENT -1
9#define MANGLER -3
10
11/* Checking for GDB stub active */
12/* suggestion Jonathan Larmour */
13static int sh_bios_in_gdb_mode(void)
14{
15 static int gdb_active = -1;
16 if (gdb_active == -1) {
17 int (*set_console_comm)(int);
18 set_console_comm = ((void **)HAL_IF_VECTOR_TABLE)[CALL_IF_SET_CONSOLE_COMM];
19 gdb_active = (set_console_comm(QUERY_CURRENT) == MANGLER);
20 }
21 return gdb_active;
22}
23
24static void sh_bios_gdb_detach(void)
25{
26
27}
28
29#endif
diff --git a/include/asm-h8300/shm.h b/include/asm-h8300/shm.h
new file mode 100644
index 000000000000..bec758524839
--- /dev/null
+++ b/include/asm-h8300/shm.h
@@ -0,0 +1,32 @@
1#ifndef _H8300_SHM_H
2#define _H8300_SHM_H
3
4#include <linux/config.h>
5
6/* format of page table entries that correspond to shared memory pages
7 currently out in swap space (see also mm/swap.c):
8 bits 0-1 (PAGE_PRESENT) is = 0
9 bits 8..2 (SWP_TYPE) are = SHM_SWP_TYPE
10 bits 31..9 are used like this:
11 bits 15..9 (SHM_ID) the id of the shared memory segment
12 bits 30..16 (SHM_IDX) the index of the page within the shared memory segment
13 (actually only bits 25..16 get used since SHMMAX is so low)
14 bit 31 (SHM_READ_ONLY) flag whether the page belongs to a read-only attach
15*/
16/* on the m68k both bits 0 and 1 must be zero */
17/* format on the sun3 is similar, but bits 30, 31 are set to zero and all
18 others are reduced by 2. --m */
19
20#ifndef CONFIG_SUN3
21#define SHM_ID_SHIFT 9
22#else
23#define SHM_ID_SHIFT 7
24#endif
25#define _SHM_ID_BITS 7
26#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1)
27
28#define SHM_IDX_SHIFT (SHM_ID_SHIFT+_SHM_ID_BITS)
29#define _SHM_IDX_BITS 15
30#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1)
31
32#endif /* _H8300_SHM_H */
diff --git a/include/asm-h8300/shmbuf.h b/include/asm-h8300/shmbuf.h
new file mode 100644
index 000000000000..64e77993a7a9
--- /dev/null
+++ b/include/asm-h8300/shmbuf.h
@@ -0,0 +1,42 @@
1#ifndef _H8300_SHMBUF_H
2#define _H8300_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for m68k architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* _H8300_SHMBUF_H */
diff --git a/include/asm-h8300/shmparam.h b/include/asm-h8300/shmparam.h
new file mode 100644
index 000000000000..d1863953ec64
--- /dev/null
+++ b/include/asm-h8300/shmparam.h
@@ -0,0 +1,6 @@
1#ifndef _H8300_SHMPARAM_H
2#define _H8300_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _H8300_SHMPARAM_H */
diff --git a/include/asm-h8300/sigcontext.h b/include/asm-h8300/sigcontext.h
new file mode 100644
index 000000000000..e4b81505f8f8
--- /dev/null
+++ b/include/asm-h8300/sigcontext.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_H8300_SIGCONTEXT_H
2#define _ASM_H8300_SIGCONTEXT_H
3
4struct sigcontext {
5 unsigned long sc_mask; /* old sigmask */
6 unsigned long sc_usp; /* old user stack pointer */
7 unsigned long sc_er0;
8 unsigned long sc_er1;
9 unsigned long sc_er2;
10 unsigned long sc_er3;
11 unsigned long sc_er4;
12 unsigned long sc_er5;
13 unsigned long sc_er6;
14 unsigned short sc_ccr;
15 unsigned long sc_pc;
16};
17
18#endif
diff --git a/include/asm-h8300/siginfo.h b/include/asm-h8300/siginfo.h
new file mode 100644
index 000000000000..bc8fbea931a5
--- /dev/null
+++ b/include/asm-h8300/siginfo.h
@@ -0,0 +1,6 @@
1#ifndef _H8300_SIGINFO_H
2#define _H8300_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/include/asm-h8300/signal.h b/include/asm-h8300/signal.h
new file mode 100644
index 000000000000..3a08544a473e
--- /dev/null
+++ b/include/asm-h8300/signal.h
@@ -0,0 +1,185 @@
1#ifndef _H8300_SIGNAL_H
2#define _H8300_SIGNAL_H
3
4#include <linux/types.h>
5
6/* Avoid too many header ordering problems. */
7struct siginfo;
8
9#ifdef __KERNEL__
10/* Most things should be clean enough to redefine this at will, if care
11 is taken to make libc match. */
12
13#define _NSIG 64
14#define _NSIG_BPW 32
15#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
16
17typedef unsigned long old_sigset_t; /* at least 32 bits */
18
19typedef struct {
20 unsigned long sig[_NSIG_WORDS];
21} sigset_t;
22
23#else
24/* Here we must cater to libcs that poke about in kernel headers. */
25
26#define NSIG 32
27typedef unsigned long sigset_t;
28
29#endif /* __KERNEL__ */
30
31#define SIGHUP 1
32#define SIGINT 2
33#define SIGQUIT 3
34#define SIGILL 4
35#define SIGTRAP 5
36#define SIGABRT 6
37#define SIGIOT 6
38#define SIGBUS 7
39#define SIGFPE 8
40#define SIGKILL 9
41#define SIGUSR1 10
42#define SIGSEGV 11
43#define SIGUSR2 12
44#define SIGPIPE 13
45#define SIGALRM 14
46#define SIGTERM 15
47#define SIGSTKFLT 16
48#define SIGCHLD 17
49#define SIGCONT 18
50#define SIGSTOP 19
51#define SIGTSTP 20
52#define SIGTTIN 21
53#define SIGTTOU 22
54#define SIGURG 23
55#define SIGXCPU 24
56#define SIGXFSZ 25
57#define SIGVTALRM 26
58#define SIGPROF 27
59#define SIGWINCH 28
60#define SIGIO 29
61#define SIGPOLL SIGIO
62/*
63#define SIGLOST 29
64*/
65#define SIGPWR 30
66#define SIGSYS 31
67#define SIGUNUSED 31
68
69/* These should not be considered constants from userland. */
70#define SIGRTMIN 32
71#define SIGRTMAX _NSIG
72
73/*
74 * SA_FLAGS values:
75 *
76 * SA_ONSTACK indicates that a registered stack_t will be used.
77 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
78 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered.
81 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
82 * SA_NODEFER prevents the current signal from being masked in the handler.
83 *
84 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
85 * Unix names RESETHAND and NODEFER respectively.
86 */
87#define SA_NOCLDSTOP 0x00000001
88#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
89#define SA_SIGINFO 0x00000004
90#define SA_ONSTACK 0x08000000
91#define SA_RESTART 0x10000000
92#define SA_NODEFER 0x40000000
93#define SA_RESETHAND 0x80000000
94
95#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND
97#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
98
99#define SA_RESTORER 0x04000000
100
101/*
102 * sigaltstack controls
103 */
104#define SS_ONSTACK 1
105#define SS_DISABLE 2
106
107#define MINSIGSTKSZ 2048
108#define SIGSTKSZ 8192
109
110#ifdef __KERNEL__
111/*
112 * These values of sa_flags are used only by the kernel as part of the
113 * irq handling routines.
114 *
115 * SA_INTERRUPT is also used by the irq handling routines.
116 * SA_SHIRQ is for shared interrupt support on PCI and EISA.
117 */
118#define SA_PROBE SA_ONESHOT
119#define SA_SAMPLE_RANDOM SA_RESTART
120#define SA_SHIRQ 0x04000000
121#endif
122
123#define SIG_BLOCK 0 /* for blocking signals */
124#define SIG_UNBLOCK 1 /* for unblocking signals */
125#define SIG_SETMASK 2 /* for setting the signal mask */
126
127/* Type of a signal handler. */
128typedef void (*__sighandler_t)(int);
129
130#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
131#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
132#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
133
134#ifdef __KERNEL__
135struct old_sigaction {
136 __sighandler_t sa_handler;
137 old_sigset_t sa_mask;
138 unsigned long sa_flags;
139 void (*sa_restorer)(void);
140};
141
142struct sigaction {
143 __sighandler_t sa_handler;
144 unsigned long sa_flags;
145 void (*sa_restorer)(void);
146 sigset_t sa_mask; /* mask last for extensibility */
147};
148
149struct k_sigaction {
150 struct sigaction sa;
151};
152#else
153/* Here we must cater to libcs that poke about in kernel headers. */
154
155struct sigaction {
156 union {
157 __sighandler_t _sa_handler;
158 void (*_sa_sigaction)(int, struct siginfo *, void *);
159 } _u;
160 sigset_t sa_mask;
161 unsigned long sa_flags;
162 void (*sa_restorer)(void);
163};
164
165#define sa_handler _u._sa_handler
166#define sa_sigaction _u._sa_sigaction
167
168#endif /* __KERNEL__ */
169
170typedef struct sigaltstack {
171 void *ss_sp;
172 int ss_flags;
173 size_t ss_size;
174} stack_t;
175
176#ifdef __KERNEL__
177
178#include <asm/sigcontext.h>
179#undef __HAVE_ARCH_SIG_BITOPS
180
181#define ptrace_signal_deliver(regs, cookie) do { } while (0)
182
183#endif /* __KERNEL__ */
184
185#endif /* _H8300_SIGNAL_H */
diff --git a/include/asm-h8300/smp.h b/include/asm-h8300/smp.h
new file mode 100644
index 000000000000..9e9bd7e58922
--- /dev/null
+++ b/include/asm-h8300/smp.h
@@ -0,0 +1 @@
/* nothing required here yet */
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
new file mode 100644
index 000000000000..af33b8525dcf
--- /dev/null
+++ b/include/asm-h8300/socket.h
@@ -0,0 +1,50 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockoptions(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_KEEPALIVE 9
18#define SO_OOBINLINE 10
19#define SO_NO_CHECK 11
20#define SO_PRIORITY 12
21#define SO_LINGER 13
22#define SO_BSDCOMPAT 14
23/* To add :#define SO_REUSEPORT 15 */
24#define SO_PASSCRED 16
25#define SO_PEERCRED 17
26#define SO_RCVLOWAT 18
27#define SO_SNDLOWAT 19
28#define SO_RCVTIMEO 20
29#define SO_SNDTIMEO 21
30
31/* Security levels - as per NRL IPv6 - don't actually do anything */
32#define SO_SECURITY_AUTHENTICATION 22
33#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
34#define SO_SECURITY_ENCRYPTION_NETWORK 24
35
36#define SO_BINDTODEVICE 25
37
38/* Socket filtering */
39#define SO_ATTACH_FILTER 26
40#define SO_DETACH_FILTER 27
41
42#define SO_PEERNAME 28
43#define SO_TIMESTAMP 29
44#define SCM_TIMESTAMP SO_TIMESTAMP
45
46#define SO_ACCEPTCONN 30
47
48#define SO_PEERSEC 31
49
50#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-h8300/sockios.h b/include/asm-h8300/sockios.h
new file mode 100644
index 000000000000..d005d9594cc6
--- /dev/null
+++ b/include/asm-h8300/sockios.h
@@ -0,0 +1,12 @@
1#ifndef __ARCH_H8300_SOCKIOS__
2#define __ARCH_H8300_SOCKIOS__
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */
11
12#endif /* __ARCH_H8300_SOCKIOS__ */
diff --git a/include/asm-h8300/spinlock.h b/include/asm-h8300/spinlock.h
new file mode 100644
index 000000000000..d5407fa173e4
--- /dev/null
+++ b/include/asm-h8300/spinlock.h
@@ -0,0 +1,6 @@
1#ifndef __H8300_SPINLOCK_H
2#define __H8300_SPINLOCK_H
3
4#error "H8/300 doesn't do SMP yet"
5
6#endif
diff --git a/include/asm-h8300/stat.h b/include/asm-h8300/stat.h
new file mode 100644
index 000000000000..62c3cc24dfe6
--- /dev/null
+++ b/include/asm-h8300/stat.h
@@ -0,0 +1,78 @@
1#ifndef _H8300_STAT_H
2#define _H8300_STAT_H
3
4struct __old_kernel_stat {
5 unsigned short st_dev;
6 unsigned short st_ino;
7 unsigned short st_mode;
8 unsigned short st_nlink;
9 unsigned short st_uid;
10 unsigned short st_gid;
11 unsigned short st_rdev;
12 unsigned long st_size;
13 unsigned long st_atime;
14 unsigned long st_mtime;
15 unsigned long st_ctime;
16};
17
18struct stat {
19 unsigned short st_dev;
20 unsigned short __pad1;
21 unsigned long st_ino;
22 unsigned short st_mode;
23 unsigned short st_nlink;
24 unsigned short st_uid;
25 unsigned short st_gid;
26 unsigned short st_rdev;
27 unsigned short __pad2;
28 unsigned long st_size;
29 unsigned long st_blksize;
30 unsigned long st_blocks;
31 unsigned long st_atime;
32 unsigned long __unused1;
33 unsigned long st_mtime;
34 unsigned long __unused2;
35 unsigned long st_ctime;
36 unsigned long __unused3;
37 unsigned long __unused4;
38 unsigned long __unused5;
39};
40
41/* This matches struct stat64 in glibc2.1, hence the absolutely
42 * insane amounts of padding around dev_t's.
43 */
44struct stat64 {
45 unsigned long long st_dev;
46 unsigned char __pad1[2];
47
48#define STAT64_HAS_BROKEN_ST_INO 1
49 unsigned long __st_ino;
50
51 unsigned int st_mode;
52 unsigned int st_nlink;
53
54 unsigned long st_uid;
55 unsigned long st_gid;
56
57 unsigned long long st_rdev;
58 unsigned char __pad3[2];
59
60 long long st_size;
61 unsigned long st_blksize;
62
63 unsigned long __pad4; /* future possible st_blocks high bits */
64 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
65
66 unsigned long st_atime;
67 unsigned long st_atime_nsec;
68
69 unsigned long st_mtime;
70 unsigned long st_mtime_nsec;
71
72 unsigned long st_ctime;
73 unsigned long st_ctime_nsec;
74
75 unsigned long long st_ino;
76};
77
78#endif /* _H8300_STAT_H */
diff --git a/include/asm-h8300/statfs.h b/include/asm-h8300/statfs.h
new file mode 100644
index 000000000000..b96efa712aac
--- /dev/null
+++ b/include/asm-h8300/statfs.h
@@ -0,0 +1,6 @@
1#ifndef _H8300_STATFS_H
2#define _H8300_STATFS_H
3
4#include <asm-generic/statfs.h>
5
6#endif /* _H8300_STATFS_H */
diff --git a/include/asm-h8300/string.h b/include/asm-h8300/string.h
new file mode 100644
index 000000000000..ca5034897d87
--- /dev/null
+++ b/include/asm-h8300/string.h
@@ -0,0 +1,44 @@
1#ifndef _H8300_STRING_H_
2#define _H8300_STRING_H_
3
4#ifdef __KERNEL__ /* only set these up for kernel code */
5
6#include <asm/setup.h>
7#include <asm/page.h>
8
9#define __HAVE_ARCH_MEMSET
10extern void * memset(void * s, int c, size_t count);
11
12#define __HAVE_ARCH_MEMCPY
13extern void * memcpy(void *d, const void *s, size_t count);
14
15#else /* KERNEL */
16
17/*
18 * let user libraries deal with these,
19 * IMHO the kernel has no place defining these functions for user apps
20 */
21
22#define __HAVE_ARCH_STRCPY 1
23#define __HAVE_ARCH_STRNCPY 1
24#define __HAVE_ARCH_STRCAT 1
25#define __HAVE_ARCH_STRNCAT 1
26#define __HAVE_ARCH_STRCMP 1
27#define __HAVE_ARCH_STRNCMP 1
28#define __HAVE_ARCH_STRNICMP 1
29#define __HAVE_ARCH_STRCHR 1
30#define __HAVE_ARCH_STRRCHR 1
31#define __HAVE_ARCH_STRSTR 1
32#define __HAVE_ARCH_STRLEN 1
33#define __HAVE_ARCH_STRNLEN 1
34#define __HAVE_ARCH_MEMSET 1
35#define __HAVE_ARCH_MEMCPY 1
36#define __HAVE_ARCH_MEMMOVE 1
37#define __HAVE_ARCH_MEMSCAN 1
38#define __HAVE_ARCH_MEMCMP 1
39#define __HAVE_ARCH_MEMCHR 1
40#define __HAVE_ARCH_STRTOK 1
41
42#endif /* KERNEL */
43
44#endif /* _M68K_STRING_H_ */
diff --git a/include/asm-h8300/system.h b/include/asm-h8300/system.h
new file mode 100644
index 000000000000..dfe96c7121cf
--- /dev/null
+++ b/include/asm-h8300/system.h
@@ -0,0 +1,149 @@
1#ifndef _H8300_SYSTEM_H
2#define _H8300_SYSTEM_H
3
4#include <linux/config.h> /* get configuration macros */
5#include <linux/linkage.h>
6
7#define prepare_to_switch() do { } while(0)
8
9/*
10 * switch_to(n) should switch tasks to task ptr, first checking that
11 * ptr isn't the current task, in which case it does nothing. This
12 * also clears the TS-flag if the task we switched to has used the
13 * math co-processor latest.
14 */
15/*
16 * switch_to() saves the extra registers, that are not saved
17 * automatically by SAVE_SWITCH_STACK in resume(), ie. d0-d5 and
18 * a0-a1. Some of these are used by schedule() and its predecessors
19 * and so we might get see unexpected behaviors when a task returns
20 * with unexpected register values.
21 *
22 * syscall stores these registers itself and none of them are used
23 * by syscall after the function in the syscall has been called.
24 *
25 * Beware that resume now expects *next to be in d1 and the offset of
26 * tss to be in a1. This saves a few instructions as we no longer have
27 * to push them onto the stack and read them back right after.
28 *
29 * 02/17/96 - Jes Sorensen (jds@kom.auc.dk)
30 *
31 * Changed 96/09/19 by Andreas Schwab
32 * pass prev in a0, next in a1, offset of tss in d1, and whether
33 * the mm structures are shared in d2 (to avoid atc flushing).
34 *
35 * H8/300 Porting 2002/09/04 Yoshinori Sato
36 */
37
38asmlinkage void resume(void);
39#define switch_to(prev,next,last) { \
40 void *_last; \
41 __asm__ __volatile__( \
42 "mov.l %1, er0\n\t" \
43 "mov.l %2, er1\n\t" \
44 "mov.l %3, er2\n\t" \
45 "jsr @_resume\n\t" \
46 "mov.l er2,%0\n\t" \
47 : "=r" (_last) \
48 : "r" (&(prev->thread)), \
49 "r" (&(next->thread)), \
50 "g" (prev) \
51 : "cc", "er0", "er1", "er2", "er3"); \
52 (last) = _last; \
53}
54
55#define __sti() asm volatile ("andc #0x7f,ccr")
56#define __cli() asm volatile ("orc #0x80,ccr")
57
58#define __save_flags(x) \
59 asm volatile ("stc ccr,%w0":"=r" (x))
60
61#define __restore_flags(x) \
62 asm volatile ("ldc %w0,ccr": :"r" (x))
63
64#define irqs_disabled() \
65({ \
66 unsigned char flags; \
67 __save_flags(flags); \
68 ((flags & 0x80) == 0x80); \
69})
70
71#define iret() __asm__ __volatile__ ("rte": : :"memory", "sp", "cc")
72
73/* For spinlocks etc */
74#define local_irq_disable() __cli()
75#define local_irq_enable() __sti()
76#define local_irq_save(x) ({ __save_flags(x); local_irq_disable(); })
77#define local_irq_restore(x) __restore_flags(x)
78#define local_save_flags(x) __save_flags(x)
79
80/*
81 * Force strict CPU ordering.
82 * Not really required on H8...
83 */
84#define nop() asm volatile ("nop"::)
85#define mb() asm volatile ("" : : :"memory")
86#define rmb() asm volatile ("" : : :"memory")
87#define wmb() asm volatile ("" : : :"memory")
88#define set_rmb(var, value) do { xchg(&var, value); } while (0)
89#define set_mb(var, value) set_rmb(var, value)
90#define set_wmb(var, value) do { var = value; wmb(); } while (0)
91
92#ifdef CONFIG_SMP
93#define smp_mb() mb()
94#define smp_rmb() rmb()
95#define smp_wmb() wmb()
96#define smp_read_barrier_depends() read_barrier_depends()
97#else
98#define smp_mb() barrier()
99#define smp_rmb() barrier()
100#define smp_wmb() barrier()
101#define smp_read_barrier_depends() do { } while(0)
102#endif
103
104#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
105#define tas(ptr) (xchg((ptr),1))
106
107struct __xchg_dummy { unsigned long a[100]; };
108#define __xg(x) ((volatile struct __xchg_dummy *)(x))
109
110static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
111{
112 unsigned long tmp, flags;
113
114 local_irq_save(flags);
115
116 switch (size) {
117 case 1:
118 __asm__ __volatile__
119 ("mov.b %2,%0\n\t"
120 "mov.b %1,%2"
121 : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
122 break;
123 case 2:
124 __asm__ __volatile__
125 ("mov.w %2,%0\n\t"
126 "mov.w %1,%2"
127 : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
128 break;
129 case 4:
130 __asm__ __volatile__
131 ("mov.l %2,%0\n\t"
132 "mov.l %1,%2"
133 : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
134 break;
135 default:
136 tmp = 0;
137 }
138 local_irq_restore(flags);
139 return tmp;
140}
141
142#define HARD_RESET_NOW() ({ \
143 local_irq_disable(); \
144 asm("jmp @@0"); \
145})
146
147#define arch_align_stack(x) (x)
148
149#endif /* _H8300_SYSTEM_H */
diff --git a/include/asm-h8300/target_time.h b/include/asm-h8300/target_time.h
new file mode 100644
index 000000000000..9f2a9aa1fe6f
--- /dev/null
+++ b/include/asm-h8300/target_time.h
@@ -0,0 +1,4 @@
1extern int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *));
2extern void platform_timer_eoi(void);
3extern void platform_gettod(unsigned int *year, unsigned int *mon, unsigned int *day,
4 unsigned int *hour, unsigned int *min, unsigned int *sec);
diff --git a/include/asm-h8300/termbits.h b/include/asm-h8300/termbits.h
new file mode 100644
index 000000000000..fa69ae00eda3
--- /dev/null
+++ b/include/asm-h8300/termbits.h
@@ -0,0 +1,175 @@
1#ifndef __ARCH_H8300_TERMBITS_H__
2#define __ARCH_H8300_TERMBITS_H__
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20/* c_cc characters */
21#define VINTR 0
22#define VQUIT 1
23#define VERASE 2
24#define VKILL 3
25#define VEOF 4
26#define VTIME 5
27#define VMIN 6
28#define VSWTC 7
29#define VSTART 8
30#define VSTOP 9
31#define VSUSP 10
32#define VEOL 11
33#define VREPRINT 12
34#define VDISCARD 13
35#define VWERASE 14
36#define VLNEXT 15
37#define VEOL2 16
38
39
40/* c_iflag bits */
41#define IGNBRK 0000001
42#define BRKINT 0000002
43#define IGNPAR 0000004
44#define PARMRK 0000010
45#define INPCK 0000020
46#define ISTRIP 0000040
47#define INLCR 0000100
48#define IGNCR 0000200
49#define ICRNL 0000400
50#define IUCLC 0001000
51#define IXON 0002000
52#define IXANY 0004000
53#define IXOFF 0010000
54#define IMAXBEL 0020000
55#define IUTF8 0040000
56
57/* c_oflag bits */
58#define OPOST 0000001
59#define OLCUC 0000002
60#define ONLCR 0000004
61#define OCRNL 0000010
62#define ONOCR 0000020
63#define ONLRET 0000040
64#define OFILL 0000100
65#define OFDEL 0000200
66#define NLDLY 0000400
67#define NL0 0000000
68#define NL1 0000400
69#define CRDLY 0003000
70#define CR0 0000000
71#define CR1 0001000
72#define CR2 0002000
73#define CR3 0003000
74#define TABDLY 0014000
75#define TAB0 0000000
76#define TAB1 0004000
77#define TAB2 0010000
78#define TAB3 0014000
79#define XTABS 0014000
80#define BSDLY 0020000
81#define BS0 0000000
82#define BS1 0020000
83#define VTDLY 0040000
84#define VT0 0000000
85#define VT1 0040000
86#define FFDLY 0100000
87#define FF0 0000000
88#define FF1 0100000
89
90/* c_cflag bit meaning */
91#define CBAUD 0010017
92#define B0 0000000 /* hang up */
93#define B50 0000001
94#define B75 0000002
95#define B110 0000003
96#define B134 0000004
97#define B150 0000005
98#define B200 0000006
99#define B300 0000007
100#define B600 0000010
101#define B1200 0000011
102#define B1800 0000012
103#define B2400 0000013
104#define B4800 0000014
105#define B9600 0000015
106#define B19200 0000016
107#define B38400 0000017
108#define EXTA B19200
109#define EXTB B38400
110#define CSIZE 0000060
111#define CS5 0000000
112#define CS6 0000020
113#define CS7 0000040
114#define CS8 0000060
115#define CSTOPB 0000100
116#define CREAD 0000200
117#define PARENB 0000400
118#define PARODD 0001000
119#define HUPCL 0002000
120#define CLOCAL 0004000
121#define CBAUDEX 0010000
122#define B57600 0010001
123#define B115200 0010002
124#define B230400 0010003
125#define B460800 0010004
126#define B500000 0010005
127#define B576000 0010006
128#define B921600 0010007
129#define B1000000 0010010
130#define B1152000 0010011
131#define B1500000 0010012
132#define B2000000 0010013
133#define B2500000 0010014
134#define B3000000 0010015
135#define B3500000 0010016
136#define B4000000 0010017
137#define CIBAUD 002003600000 /* input baud rate (not used) */
138#define CMSPAR 010000000000 /* mark or space (stick) parity */
139#define CRTSCTS 020000000000 /* flow control */
140
141/* c_lflag bits */
142#define ISIG 0000001
143#define ICANON 0000002
144#define XCASE 0000004
145#define ECHO 0000010
146#define ECHOE 0000020
147#define ECHOK 0000040
148#define ECHONL 0000100
149#define NOFLSH 0000200
150#define TOSTOP 0000400
151#define ECHOCTL 0001000
152#define ECHOPRT 0002000
153#define ECHOKE 0004000
154#define FLUSHO 0010000
155#define PENDIN 0040000
156#define IEXTEN 0100000
157
158
159/* tcflow() and TCXONC use these */
160#define TCOOFF 0
161#define TCOON 1
162#define TCIOFF 2
163#define TCION 3
164
165/* tcflush() and TCFLSH use these */
166#define TCIFLUSH 0
167#define TCOFLUSH 1
168#define TCIOFLUSH 2
169
170/* tcsetattr uses these */
171#define TCSANOW 0
172#define TCSADRAIN 1
173#define TCSAFLUSH 2
174
175#endif /* __ARCH_H8300_TERMBITS_H__ */
diff --git a/include/asm-h8300/termios.h b/include/asm-h8300/termios.h
new file mode 100644
index 000000000000..e2319f992af2
--- /dev/null
+++ b/include/asm-h8300/termios.h
@@ -0,0 +1,108 @@
1#ifndef _H8300_TERMIOS_H
2#define _H8300_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24#ifdef __KERNEL__
25/* intr=^C quit=^| erase=del kill=^U
26 eof=^D vtime=\0 vmin=\1 sxtc=\0
27 start=^Q stop=^S susp=^Z eol=\0
28 reprint=^R discard=^U werase=^W lnext=^V
29 eol2=\0
30*/
31#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
32#endif
33
34/* modem lines */
35#define TIOCM_LE 0x001
36#define TIOCM_DTR 0x002
37#define TIOCM_RTS 0x004
38#define TIOCM_ST 0x008
39#define TIOCM_SR 0x010
40#define TIOCM_CTS 0x020
41#define TIOCM_CAR 0x040
42#define TIOCM_RNG 0x080
43#define TIOCM_DSR 0x100
44#define TIOCM_CD TIOCM_CAR
45#define TIOCM_RI TIOCM_RNG
46#define TIOCM_OUT1 0x2000
47#define TIOCM_OUT2 0x4000
48#define TIOCM_LOOP 0x8000
49
50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
51
52/* line disciplines */
53#define N_TTY 0
54#define N_SLIP 1
55#define N_MOUSE 2
56#define N_PPP 3
57#define N_STRIP 4
58#define N_AX25 5
59#define N_X25 6 /* X.25 async */
60#define N_6PACK 7
61#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
62#define N_R3964 9 /* Reserved for Simatic R3964 module */
63#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
64#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
65#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
66#define N_HDLC 13 /* synchronous HDLC */
67#define N_SYNC_PPP 14
68#define N_HCI 15 /* Bluetooth HCI UART */
69
70#ifdef __KERNEL__
71
72/*
73 * Translate a "termio" structure into a "termios". Ugh.
74 */
75#define user_termio_to_kernel_termios(termios, termio) \
76({ \
77 unsigned short tmp; \
78 get_user(tmp, &(termio)->c_iflag); \
79 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
80 get_user(tmp, &(termio)->c_oflag); \
81 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
82 get_user(tmp, &(termio)->c_cflag); \
83 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
84 get_user(tmp, &(termio)->c_lflag); \
85 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
86 get_user((termios)->c_line, &(termio)->c_line); \
87 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
88})
89
90/*
91 * Translate a "termios" structure into a "termio". Ugh.
92 */
93#define kernel_termios_to_user_termio(termio, termios) \
94({ \
95 put_user((termios)->c_iflag, &(termio)->c_iflag); \
96 put_user((termios)->c_oflag, &(termio)->c_oflag); \
97 put_user((termios)->c_cflag, &(termio)->c_cflag); \
98 put_user((termios)->c_lflag, &(termio)->c_lflag); \
99 put_user((termios)->c_line, &(termio)->c_line); \
100 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
101})
102
103#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
104#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
105
106#endif /* __KERNEL__ */
107
108#endif /* _H8300_TERMIOS_H */
diff --git a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h
new file mode 100644
index 000000000000..b07c9344776f
--- /dev/null
+++ b/include/asm-h8300/thread_info.h
@@ -0,0 +1,109 @@
1/* thread_info.h: h8300 low-level thread information
2 * adapted from the i386 and PPC versions by Yoshinori Sato <ysato@users.sourceforge.jp>
3 *
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 */
7
8#ifndef _ASM_THREAD_INFO_H
9#define _ASM_THREAD_INFO_H
10
11#include <asm/page.h>
12
13#ifdef __KERNEL__
14
15#ifndef __ASSEMBLY__
16
17/*
18 * low level task data.
19 * If you change this, change the TI_* offsets below to match.
20 */
21struct thread_info {
22 struct task_struct *task; /* main task structure */
23 struct exec_domain *exec_domain; /* execution domain */
24 unsigned long flags; /* low level flags */
25 int cpu; /* cpu we're on */
26 int preempt_count; /* 0 => preemptable, <0 => BUG*/
27 struct restart_block restart_block;
28};
29
30/*
31 * macros/functions for gaining access to the thread information structure
32 */
33#define INIT_THREAD_INFO(tsk) \
34{ \
35 .task = &tsk, \
36 .exec_domain = &default_exec_domain, \
37 .flags = 0, \
38 .cpu = 0, \
39 .preempt_count = 1, \
40 .restart_block = { \
41 .fn = do_no_restart_syscall, \
42 }, \
43}
44
45#define init_thread_info (init_thread_union.thread_info)
46#define init_stack (init_thread_union.stack)
47
48
49/*
50 * Size of kernel stack for each process. This must be a power of 2...
51 */
52#define THREAD_SIZE 8192 /* 2 pages */
53
54
55/* how to get the thread information struct from C */
56static inline struct thread_info *current_thread_info(void)
57{
58 struct thread_info *ti;
59 __asm__(
60 "mov.l sp, %0 \n\t"
61 "and.l %1, %0"
62 : "=&r"(ti)
63 : "i" (~(THREAD_SIZE-1))
64 );
65 return ti;
66}
67
68/* thread information allocation */
69#define alloc_thread_info(tsk) ((struct thread_info *) \
70 __get_free_pages(GFP_KERNEL, 1))
71#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
72#define get_thread_info(ti) get_task_struct((ti)->task)
73#define put_thread_info(ti) put_task_struct((ti)->task)
74#endif /* __ASSEMBLY__ */
75
76/*
77 * Offsets in thread_info structure, used in assembly code
78 */
79#define TI_TASK 0
80#define TI_EXECDOMAIN 4
81#define TI_FLAGS 8
82#define TI_CPU 12
83#define TI_PRE_COUNT 16
84
85#define PREEMPT_ACTIVE 0x4000000
86
87/*
88 * thread information flag bit numbers
89 */
90#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
91#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
92#define TIF_SIGPENDING 2 /* signal pending */
93#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
94#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
95 TIF_NEED_RESCHED */
96#define TIF_MEMDIE 5
97
98/* as above, but as bit values */
99#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
100#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
101#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
102#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
103#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
104
105#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
106
107#endif /* __KERNEL__ */
108
109#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-h8300/timex.h b/include/asm-h8300/timex.h
new file mode 100644
index 000000000000..20413145fabb
--- /dev/null
+++ b/include/asm-h8300/timex.h
@@ -0,0 +1,19 @@
1/*
2 * linux/include/asm-h8300/timex.h
3 *
4 * H8/300 architecture timex specifications
5 */
6#ifndef _ASM_H8300_TIMEX_H
7#define _ASM_H8300_TIMEX_H
8
9#define CLOCK_TICK_RATE CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
10
11typedef unsigned long cycles_t;
12extern short h8300_timer_count;
13
14static inline cycles_t get_cycles(void)
15{
16 return 0;
17}
18
19#endif
diff --git a/include/asm-h8300/tlb.h b/include/asm-h8300/tlb.h
new file mode 100644
index 000000000000..3dea80ad9e6f
--- /dev/null
+++ b/include/asm-h8300/tlb.h
@@ -0,0 +1,23 @@
1/*
2 include/asm-h8300/tlb.h
3*/
4
5#ifndef __H8300_TLB_H__
6#define __H8300_TLB_H__
7
8#define tlb_flush(tlb) do { } while(0)
9
10/*
11 include/asm-h8300/tlb.h
12*/
13
14#ifndef __H8300_TLB_H__
15#define __H8300_TLB_H__
16
17#define tlb_flush(tlb) do { } while(0)
18
19#include <asm-generic/tlb.h>
20
21#endif
22
23#endif
diff --git a/include/asm-h8300/tlbflush.h b/include/asm-h8300/tlbflush.h
new file mode 100644
index 000000000000..bbdffbeeedef
--- /dev/null
+++ b/include/asm-h8300/tlbflush.h
@@ -0,0 +1,61 @@
1#ifndef _H8300_TLBFLUSH_H
2#define _H8300_TLBFLUSH_H
3
4/*
5 * Copyright (C) 2000 Lineo, David McCullough <davidm@uclinux.org>
6 * Copyright (C) 2000-2002, Greg Ungerer <gerg@snapgear.com>
7 */
8
9#include <asm/setup.h>
10
11/*
12 * flush all user-space atc entries.
13 */
14static inline void __flush_tlb(void)
15{
16 BUG();
17}
18
19static inline void __flush_tlb_one(unsigned long addr)
20{
21 BUG();
22}
23
24#define flush_tlb() __flush_tlb()
25
26/*
27 * flush all atc entries (both kernel and user-space entries).
28 */
29static inline void flush_tlb_all(void)
30{
31 BUG();
32}
33
34static inline void flush_tlb_mm(struct mm_struct *mm)
35{
36 BUG();
37}
38
39static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
40{
41 BUG();
42}
43
44static inline void flush_tlb_range(struct mm_struct *mm,
45 unsigned long start, unsigned long end)
46{
47 BUG();
48}
49
50extern inline void flush_tlb_kernel_page(unsigned long addr)
51{
52 BUG();
53}
54
55extern inline void flush_tlb_pgtables(struct mm_struct *mm,
56 unsigned long start, unsigned long end)
57{
58 BUG();
59}
60
61#endif /* _H8300_TLBFLUSH_H */
diff --git a/include/asm-h8300/topology.h b/include/asm-h8300/topology.h
new file mode 100644
index 000000000000..fdc121924d4c
--- /dev/null
+++ b/include/asm-h8300/topology.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_H8300_TOPOLOGY_H
2#define _ASM_H8300_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_H8300_TOPOLOGY_H */
diff --git a/include/asm-h8300/traps.h b/include/asm-h8300/traps.h
new file mode 100644
index 000000000000..41cf6be02f68
--- /dev/null
+++ b/include/asm-h8300/traps.h
@@ -0,0 +1,37 @@
1/*
2 * linux/include/asm-h8300/traps.h
3 *
4 * Copyright (C) 2003 Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _H8300_TRAPS_H
12#define _H8300_TRAPS_H
13
14extern void system_call(void);
15extern void interrupt_entry(void);
16extern void trace_break(void);
17
18#define JMP_OP 0x5a000000
19#define JSR_OP 0x5e000000
20#define VECTOR(address) ((JMP_OP)|((unsigned long)address))
21#define REDIRECT(address) ((JSR_OP)|((unsigned long)address))
22
23#define TRACE_VEC 5
24
25#define TRAP0_VEC 8
26#define TRAP1_VEC 9
27#define TRAP2_VEC 10
28#define TRAP3_VEC 11
29
30#if defined(__H8300H__)
31#define NR_TRAPS 12
32#endif
33#if defined(__H8300S__)
34#define NR_TRAPS 16
35#endif
36
37#endif /* _H8300_TRAPS_H */
diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h
new file mode 100644
index 000000000000..21f4fc07ac0e
--- /dev/null
+++ b/include/asm-h8300/types.h
@@ -0,0 +1,67 @@
1#ifndef _H8300_TYPES_H
2#define _H8300_TYPES_H
3
4#if !defined(__ASSEMBLY__)
5
6/*
7 * This file is never included by application software unless
8 * explicitly requested (e.g., via linux/types.h) in which case the
9 * application is Linux specific so (user-) name space pollution is
10 * not a major issue. However, for interoperability, libraries still
11 * need to be careful to avoid a name clashes.
12 */
13
14typedef unsigned short umode_t;
15
16/*
17 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
18 * header files exported to user space
19 */
20
21typedef __signed__ char __s8;
22typedef unsigned char __u8;
23
24typedef __signed__ short __s16;
25typedef unsigned short __u16;
26
27typedef __signed__ int __s32;
28typedef unsigned int __u32;
29
30#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
31typedef __signed__ long long __s64;
32typedef unsigned long long __u64;
33#endif
34
35/*
36 * These aren't exported outside the kernel to avoid name space clashes
37 */
38#ifdef __KERNEL__
39
40typedef signed char s8;
41typedef unsigned char u8;
42
43typedef signed short s16;
44typedef unsigned short u16;
45
46typedef signed int s32;
47typedef unsigned int u32;
48
49typedef signed long long s64;
50typedef unsigned long long u64;
51
52#define BITS_PER_LONG 32
53
54/* Dma addresses are 32-bits wide. */
55
56typedef u32 dma_addr_t;
57
58#define HAVE_SECTOR_T
59typedef u64 sector_t;
60
61typedef unsigned int kmem_bufctl_t;
62
63#endif /* __KERNEL__ */
64
65#endif /* __ASSEMBLY__ */
66
67#endif /* _H8300_TYPES_H */
diff --git a/include/asm-h8300/uaccess.h b/include/asm-h8300/uaccess.h
new file mode 100644
index 000000000000..1480f307a474
--- /dev/null
+++ b/include/asm-h8300/uaccess.h
@@ -0,0 +1,171 @@
1#ifndef __H8300_UACCESS_H
2#define __H8300_UACCESS_H
3
4/*
5 * User space memory access functions
6 */
7#include <linux/sched.h>
8#include <linux/mm.h>
9#include <linux/string.h>
10
11#include <asm/segment.h>
12
13#define VERIFY_READ 0
14#define VERIFY_WRITE 1
15
16/* We let the MMU do all checking */
17#define access_ok(type, addr, size) __access_ok((unsigned long)addr,size)
18static inline int __access_ok(unsigned long addr, unsigned long size)
19{
20#define RANGE_CHECK_OK(addr, size, lower, upper) \
21 (((addr) >= (lower)) && (((addr) + (size)) < (upper)))
22
23 extern unsigned long _ramend;
24 return(RANGE_CHECK_OK(addr, size, 0L, (unsigned long)&_ramend));
25}
26
27/* this function will go away soon - use access_ok() instead */
28static inline int __deprecated verify_area(int type, const void *addr, unsigned long size)
29{
30 return access_ok(type,addr,size)?0:-EFAULT;
31}
32
33/*
34 * The exception table consists of pairs of addresses: the first is the
35 * address of an instruction that is allowed to fault, and the second is
36 * the address at which the program should continue. No registers are
37 * modified, so it is entirely up to the continuation code to figure out
38 * what to do.
39 *
40 * All the routines below use bits of fixup code that are out of line
41 * with the main instruction path. This means when everything is well,
42 * we don't even have to jump over them. Further, they do not intrude
43 * on our cache or tlb entries.
44 */
45
46struct exception_table_entry
47{
48 unsigned long insn, fixup;
49};
50
51/* Returns 0 if exception not found and fixup otherwise. */
52extern unsigned long search_exception_table(unsigned long);
53
54
55/*
56 * These are the main single-value transfer routines. They automatically
57 * use the right size if we just have the right pointer type.
58 */
59
60#define put_user(x, ptr) \
61({ \
62 int __pu_err = 0; \
63 typeof(*(ptr)) __pu_val = (x); \
64 switch (sizeof (*(ptr))) { \
65 case 1: \
66 case 2: \
67 case 4: \
68 *(ptr) = (__pu_val); \
69 break; \
70 case 8: \
71 memcpy(ptr, &__pu_val, sizeof (*(ptr))); \
72 break; \
73 default: \
74 __pu_err = __put_user_bad(); \
75 break; \
76 } \
77 __pu_err; \
78})
79#define __put_user(x, ptr) put_user(x, ptr)
80
81extern int __put_user_bad(void);
82
83/*
84 * Tell gcc we read from memory instead of writing: this is because
85 * we do not write to any memory gcc knows about, so there are no
86 * aliasing issues.
87 */
88
89#define __ptr(x) ((unsigned long *)(x))
90
91/*
92 * Tell gcc we read from memory instead of writing: this is because
93 * we do not write to any memory gcc knows about, so there are no
94 * aliasing issues.
95 */
96
97#define get_user(x, ptr) \
98({ \
99 int __gu_err = 0; \
100 typeof(*(ptr)) __gu_val = 0; \
101 switch (sizeof(*(ptr))) { \
102 case 1: \
103 case 2: \
104 case 4: \
105 __gu_val = *(ptr); \
106 break; \
107 case 8: \
108 memcpy(&__gu_val, ptr, sizeof (*(ptr))); \
109 break; \
110 default: \
111 __gu_val = 0; \
112 __gu_err = __get_user_bad(); \
113 break; \
114 } \
115 (x) = __gu_val; \
116 __gu_err; \
117})
118#define __get_user(x, ptr) get_user(x, ptr)
119
120extern int __get_user_bad(void);
121
122#define copy_from_user(to, from, n) (memcpy(to, from, n), 0)
123#define copy_to_user(to, from, n) (memcpy(to, from, n), 0)
124
125#define __copy_from_user(to, from, n) copy_from_user(to, from, n)
126#define __copy_to_user(to, from, n) copy_to_user(to, from, n)
127#define __copy_to_user_inatomic __copy_to_user
128#define __copy_from_user_inatomic __copy_from_user
129
130#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; })
131
132#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; })
133
134/*
135 * Copy a null terminated string from userspace.
136 */
137
138static inline long
139strncpy_from_user(char *dst, const char *src, long count)
140{
141 char *tmp;
142 strncpy(dst, src, count);
143 for (tmp = dst; *tmp && count > 0; tmp++, count--)
144 ;
145 return(tmp - dst); /* DAVIDM should we count a NUL ? check getname */
146}
147
148/*
149 * Return the size of a string (including the ending 0)
150 *
151 * Return 0 on exception, a value greater than N if too long
152 */
153static inline long strnlen_user(const char *src, long n)
154{
155 return(strlen(src) + 1); /* DAVIDM make safer */
156}
157
158#define strlen_user(str) strnlen_user(str, 32767)
159
160/*
161 * Zero Userspace
162 */
163
164static inline unsigned long
165clear_user(void *to, unsigned long n)
166{
167 memset(to, 0, n);
168 return 0;
169}
170
171#endif /* _H8300_UACCESS_H */
diff --git a/include/asm-h8300/ucontext.h b/include/asm-h8300/ucontext.h
new file mode 100644
index 000000000000..0bcf8f85fab9
--- /dev/null
+++ b/include/asm-h8300/ucontext.h
@@ -0,0 +1,12 @@
1#ifndef _H8300_UCONTEXT_H
2#define _H8300_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif
diff --git a/include/asm-h8300/unaligned.h b/include/asm-h8300/unaligned.h
new file mode 100644
index 000000000000..8a93961173c3
--- /dev/null
+++ b/include/asm-h8300/unaligned.h
@@ -0,0 +1,16 @@
1#ifndef __H8300_UNALIGNED_H
2#define __H8300_UNALIGNED_H
3
4#include <linux/config.h>
5
6/* Use memmove here, so gcc does not insert a __builtin_memcpy. */
7
8#define get_unaligned(ptr) \
9 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
10
11#define put_unaligned(val, ptr) \
12 ({ __typeof__(*(ptr)) __tmp = (val); \
13 memmove((ptr), &__tmp, sizeof(*(ptr))); \
14 (void)0; })
15
16#endif
diff --git a/include/asm-h8300/unistd.h b/include/asm-h8300/unistd.h
new file mode 100644
index 000000000000..48b362ff7500
--- /dev/null
+++ b/include/asm-h8300/unistd.h
@@ -0,0 +1,555 @@
1#ifndef _ASM_H8300_UNISTD_H_
2#define _ASM_H8300_UNISTD_H_
3
4/*
5 * This file contains the system call numbers.
6 */
7
8#define __NR_restart_syscall 0
9#define __NR_exit 1
10#define __NR_fork 2
11#define __NR_read 3
12#define __NR_write 4
13#define __NR_open 5
14#define __NR_close 6
15#define __NR_waitpid 7
16#define __NR_creat 8
17#define __NR_link 9
18#define __NR_unlink 10
19#define __NR_execve 11
20#define __NR_chdir 12
21#define __NR_time 13
22#define __NR_mknod 14
23#define __NR_chmod 15
24#define __NR_chown 16
25#define __NR_break 17
26#define __NR_oldstat 18
27#define __NR_lseek 19
28#define __NR_getpid 20
29#define __NR_mount 21
30#define __NR_umount 22
31#define __NR_setuid 23
32#define __NR_getuid 24
33#define __NR_stime 25
34#define __NR_ptrace 26
35#define __NR_alarm 27
36#define __NR_oldfstat 28
37#define __NR_pause 29
38#define __NR_utime 30
39#define __NR_stty 31
40#define __NR_gtty 32
41#define __NR_access 33
42#define __NR_nice 34
43#define __NR_ftime 35
44#define __NR_sync 36
45#define __NR_kill 37
46#define __NR_rename 38
47#define __NR_mkdir 39
48#define __NR_rmdir 40
49#define __NR_dup 41
50#define __NR_pipe 42
51#define __NR_times 43
52#define __NR_prof 44
53#define __NR_brk 45
54#define __NR_setgid 46
55#define __NR_getgid 47
56#define __NR_signal 48
57#define __NR_geteuid 49
58#define __NR_getegid 50
59#define __NR_acct 51
60#define __NR_umount2 52
61#define __NR_lock 53
62#define __NR_ioctl 54
63#define __NR_fcntl 55
64#define __NR_mpx 56
65#define __NR_setpgid 57
66#define __NR_ulimit 58
67#define __NR_oldolduname 59
68#define __NR_umask 60
69#define __NR_chroot 61
70#define __NR_ustat 62
71#define __NR_dup2 63
72#define __NR_getppid 64
73#define __NR_getpgrp 65
74#define __NR_setsid 66
75#define __NR_sigaction 67
76#define __NR_sgetmask 68
77#define __NR_ssetmask 69
78#define __NR_setreuid 70
79#define __NR_setregid 71
80#define __NR_sigsuspend 72
81#define __NR_sigpending 73
82#define __NR_sethostname 74
83#define __NR_setrlimit 75
84#define __NR_getrlimit 76
85#define __NR_getrusage 77
86#define __NR_gettimeofday 78
87#define __NR_settimeofday 79
88#define __NR_getgroups 80
89#define __NR_setgroups 81
90#define __NR_select 82
91#define __NR_symlink 83
92#define __NR_oldlstat 84
93#define __NR_readlink 85
94#define __NR_uselib 86
95#define __NR_swapon 87
96#define __NR_reboot 88
97#define __NR_readdir 89
98#define __NR_mmap 90
99#define __NR_munmap 91
100#define __NR_truncate 92
101#define __NR_ftruncate 93
102#define __NR_fchmod 94
103#define __NR_fchown 95
104#define __NR_getpriority 96
105#define __NR_setpriority 97
106#define __NR_profil 98
107#define __NR_statfs 99
108#define __NR_fstatfs 100
109#define __NR_ioperm 101
110#define __NR_socketcall 102
111#define __NR_syslog 103
112#define __NR_setitimer 104
113#define __NR_getitimer 105
114#define __NR_stat 106
115#define __NR_lstat 107
116#define __NR_fstat 108
117#define __NR_olduname 109
118#define __NR_iopl /* 110 */ not supported
119#define __NR_vhangup 111
120#define __NR_idle /* 112 */ Obsolete
121#define __NR_vm86 /* 113 */ not supported
122#define __NR_wait4 114
123#define __NR_swapoff 115
124#define __NR_sysinfo 116
125#define __NR_ipc 117
126#define __NR_fsync 118
127#define __NR_sigreturn 119
128#define __NR_clone 120
129#define __NR_setdomainname 121
130#define __NR_uname 122
131#define __NR_cacheflush 123
132#define __NR_adjtimex 124
133#define __NR_mprotect 125
134#define __NR_sigprocmask 126
135#define __NR_create_module 127
136#define __NR_init_module 128
137#define __NR_delete_module 129
138#define __NR_get_kernel_syms 130
139#define __NR_quotactl 131
140#define __NR_getpgid 132
141#define __NR_fchdir 133
142#define __NR_bdflush 134
143#define __NR_sysfs 135
144#define __NR_personality 136
145#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
146#define __NR_setfsuid 138
147#define __NR_setfsgid 139
148#define __NR__llseek 140
149#define __NR_getdents 141
150#define __NR__newselect 142
151#define __NR_flock 143
152#define __NR_msync 144
153#define __NR_readv 145
154#define __NR_writev 146
155#define __NR_getsid 147
156#define __NR_fdatasync 148
157#define __NR__sysctl 149
158#define __NR_mlock 150
159#define __NR_munlock 151
160#define __NR_mlockall 152
161#define __NR_munlockall 153
162#define __NR_sched_setparam 154
163#define __NR_sched_getparam 155
164#define __NR_sched_setscheduler 156
165#define __NR_sched_getscheduler 157
166#define __NR_sched_yield 158
167#define __NR_sched_get_priority_max 159
168#define __NR_sched_get_priority_min 160
169#define __NR_sched_rr_get_interval 161
170#define __NR_nanosleep 162
171#define __NR_mremap 163
172#define __NR_setresuid 164
173#define __NR_getresuid 165
174#define __NR_getpagesize 166
175#define __NR_query_module 167
176#define __NR_poll 168
177#define __NR_nfsservctl 169
178#define __NR_setresgid 170
179#define __NR_getresgid 171
180#define __NR_prctl 172
181#define __NR_rt_sigreturn 173
182#define __NR_rt_sigaction 174
183#define __NR_rt_sigprocmask 175
184#define __NR_rt_sigpending 176
185#define __NR_rt_sigtimedwait 177
186#define __NR_rt_sigqueueinfo 178
187#define __NR_rt_sigsuspend 179
188#define __NR_pread64 180
189#define __NR_pwrite64 181
190#define __NR_lchown 182
191#define __NR_getcwd 183
192#define __NR_capget 184
193#define __NR_capset 185
194#define __NR_sigaltstack 186
195#define __NR_sendfile 187
196#define __NR_getpmsg 188 /* some people actually want streams */
197#define __NR_putpmsg 189 /* some people actually want streams */
198#define __NR_vfork 190
199#define __NR_ugetrlimit 191
200#define __NR_mmap2 192
201#define __NR_truncate64 193
202#define __NR_ftruncate64 194
203#define __NR_stat64 195
204#define __NR_lstat64 196
205#define __NR_fstat64 197
206#define __NR_chown32 198
207#define __NR_getuid32 199
208#define __NR_getgid32 200
209#define __NR_geteuid32 201
210#define __NR_getegid32 202
211#define __NR_setreuid32 203
212#define __NR_setregid32 204
213#define __NR_getgroups32 205
214#define __NR_setgroups32 206
215#define __NR_fchown32 207
216#define __NR_setresuid32 208
217#define __NR_getresuid32 209
218#define __NR_setresgid32 210
219#define __NR_getresgid32 211
220#define __NR_lchown32 212
221#define __NR_setuid32 213
222#define __NR_setgid32 214
223#define __NR_setfsuid32 215
224#define __NR_setfsgid32 216
225#define __NR_pivot_root 217
226#define __NR_getdents64 220
227#define __NR_fcntl64 221
228#define __NR_security 223
229#define __NR_gettid 224
230#define __NR_readahead 225
231#define __NR_setxattr 226
232#define __NR_lsetxattr 227
233#define __NR_fsetxattr 228
234#define __NR_getxattr 229
235#define __NR_lgetxattr 230
236#define __NR_fgetxattr 231
237#define __NR_listxattr 232
238#define __NR_llistxattr 233
239#define __NR_flistxattr 234
240#define __NR_removexattr 235
241#define __NR_lremovexattr 236
242#define __NR_fremovexattr 237
243#define __NR_tkill 238
244#define __NR_sendfile64 239
245#define __NR_futex 240
246#define __NR_sched_setaffinity 241
247#define __NR_sched_getaffinity 242
248#define __NR_set_thread_area 243
249#define __NR_get_thread_area 244
250#define __NR_io_setup 245
251#define __NR_io_destroy 246
252#define __NR_io_getevents 247
253#define __NR_io_submit 248
254#define __NR_io_cancel 249
255#define __NR_alloc_hugepages 250
256#define __NR_free_hugepages 251
257#define __NR_exit_group 252
258#define __NR_lookup_dcookie 253
259#define __NR_sys_epoll_create 254
260#define __NR_sys_epoll_ctl 255
261#define __NR_sys_epoll_wait 256
262#define __NR_remap_file_pages 257
263#define __NR_set_tid_address 258
264#define __NR_timer_create 259
265#define __NR_timer_settime (__NR_timer_create+1)
266#define __NR_timer_gettime (__NR_timer_create+2)
267#define __NR_timer_getoverrun (__NR_timer_create+3)
268#define __NR_timer_delete (__NR_timer_create+4)
269#define __NR_clock_settime (__NR_timer_create+5)
270#define __NR_clock_gettime (__NR_timer_create+6)
271#define __NR_clock_getres (__NR_timer_create+7)
272#define __NR_clock_nanosleep (__NR_timer_create+8)
273#define __NR_statfs64 268
274#define __NR_fstatfs64 269
275#define __NR_tgkill 270
276#define __NR_utimes 271
277#define __NR_fadvise64_64 272
278#define __NR_vserver 273
279#define __NR_mbind 274
280#define __NR_get_mempolicy 275
281#define __NR_set_mempolicy 276
282#define __NR_mq_open 277
283#define __NR_mq_unlink (__NR_mq_open+1)
284#define __NR_mq_timedsend (__NR_mq_open+2)
285#define __NR_mq_timedreceive (__NR_mq_open+3)
286#define __NR_mq_notify (__NR_mq_open+4)
287#define __NR_mq_getsetattr (__NR_mq_open+5)
288#define __NR_sys_kexec_load 283
289#define __NR_waitid 284
290/* #define __NR_sys_setaltroot 285 */
291#define __NR_add_key 286
292#define __NR_request_key 287
293#define __NR_keyctl 288
294
295#define NR_syscalls 289
296
297
298/* user-visible error numbers are in the range -1 - -122: see
299 <asm-m68k/errno.h> */
300
301#define __syscall_return(type, res) \
302do { \
303 if ((unsigned long)(res) >= (unsigned long)(-125)) { \
304 /* avoid using res which is declared to be in register d0; \
305 errno might expand to a function call and clobber it. */ \
306 int __err = -(res); \
307 errno = __err; \
308 res = -1; \
309 } \
310 return (type) (res); \
311} while (0)
312
313#define _syscall0(type, name) \
314type name(void) \
315{ \
316 register long __res __asm__("er0"); \
317 __asm__ __volatile__ ("mov.l %1,er0\n\t" \
318 "trapa #0\n\t" \
319 : "=r" (__res) \
320 : "ir" (__NR_##name) \
321 : "cc"); \
322 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
323 errno = -__res; \
324 __res = -1; \
325 } \
326 return (type)__res; \
327}
328
329#define _syscall1(type, name, atype, a) \
330type name(atype a) \
331{ \
332 register long __res __asm__("er0"); \
333 __asm__ __volatile__ ("mov.l %2, er1\n\t" \
334 "mov.l %1, er0\n\t" \
335 "trapa #0\n\t" \
336 : "=r" (__res) \
337 : "ir" (__NR_##name), \
338 "g" ((long)a) \
339 : "cc", "er1"); \
340 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
341 errno = -__res; \
342 __res = -1; \
343 } \
344 return (type)__res; \
345}
346
347#define _syscall2(type, name, atype, a, btype, b) \
348type name(atype a, btype b) \
349{ \
350 register long __res __asm__("er0"); \
351 __asm__ __volatile__ ("mov.l %3, er2\n\t" \
352 "mov.l %2, er1\n\t" \
353 "mov.l %1, er0\n\t" \
354 "trapa #0\n\t" \
355 : "=r" (__res) \
356 : "ir" (__NR_##name), \
357 "g" ((long)a), \
358 "g" ((long)b) \
359 : "cc", "er1", "er2"); \
360 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
361 errno = -__res; \
362 __res = -1; \
363 } \
364 return (type)__res; \
365}
366
367#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
368type name(atype a, btype b, ctype c) \
369{ \
370 register long __res __asm__("er0"); \
371 __asm__ __volatile__ ("mov.l %4, er3\n\t" \
372 "mov.l %3, er2\n\t" \
373 "mov.l %2, er1\n\t" \
374 "mov.l %1, er0\n\t" \
375 "trapa #0\n\t" \
376 : "=r" (__res) \
377 : "ir" (__NR_##name), \
378 "g" ((long)a), \
379 "g" ((long)b), \
380 "g" ((long)c) \
381 : "cc", "er1", "er2", "er3"); \
382 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
383 errno = -__res; \
384 __res = -1; \
385 } \
386 return (type)__res; \
387}
388
389#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \
390type name(atype a, btype b, ctype c, dtype d) \
391{ \
392 register long __res __asm__("er0"); \
393 __asm__ __volatile__ ("mov.l %5, er4\n\t" \
394 "mov.l %4, er3\n\t" \
395 "mov.l %3, er2\n\t" \
396 "mov.l %2, er1\n\t" \
397 "mov.l %1, er0\n\t" \
398 "trapa #0\n\t" \
399 : "=r" (__res) \
400 : "ir" (__NR_##name), \
401 "g" ((long)a), \
402 "g" ((long)b), \
403 "g" ((long)c), \
404 "g" ((long)d) \
405 : "cc", "er1", "er2", "er3", "er4"); \
406 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
407 errno = -__res; \
408 __res = -1; \
409 } \
410 return (type)__res; \
411}
412
413#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e) \
414type name(atype a, btype b, ctype c, dtype d, etype e) \
415{ \
416 register long __res __asm__("er0"); \
417 __asm__ __volatile__ ("mov.l %6, er5\n\t" \
418 "mov.l %5, er4\n\t" \
419 "mov.l %4, er3\n\t" \
420 "mov.l %3, er2\n\t" \
421 "mov.l %2, er1\n\t" \
422 "mov.l %1, er0\n\t" \
423 "trapa #0\n\t" \
424 : "=r" (__res) \
425 : "ir" (__NR_##name), \
426 "g" ((long)a), \
427 "g" ((long)b), \
428 "g" ((long)c), \
429 "g" ((long)d), \
430 "m" ((long)e) \
431 : "cc", "er1", "er2", "er3", "er4", "er5"); \
432 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
433 errno = -__res; \
434 __res = -1; \
435 } \
436 return (type)__res; \
437}
438
439#define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, \
440 etype, e, ftype, f) \
441type name(atype a, btype b, ctype c, dtype d, etype e, ftype f) \
442{ \
443 register long __res __asm__("er0"); \
444 __asm__ __volatile__ ("mov.l er6,@-sp\n\t" \
445 "mov.l %7, er6\n\t" \
446 "mov.l %6, er5\n\t" \
447 "mov.l %5, er4\n\t" \
448 "mov.l %4, er3\n\t" \
449 "mov.l %3, er2\n\t" \
450 "mov.l %2, er1\n\t" \
451 "mov.l %1, er0\n\t" \
452 "trapa #0\n\t" \
453 "mov.l @sp+,er6" \
454 : "=r" (__res) \
455 : "ir" (__NR_##name), \
456 "g" ((long)a), \
457 "g" ((long)b), \
458 "g" ((long)c), \
459 "g" ((long)d), \
460 "m" ((long)e), \
461 "m" ((long)e) \
462 : "cc", "er1", "er2", "er3", "er4", "er5"); \
463 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
464 errno = -__res; \
465 __res = -1; \
466 } \
467 return (type)__res; \
468}
469
470
471#ifdef __KERNEL__
472#define __ARCH_WANT_IPC_PARSE_VERSION
473#define __ARCH_WANT_OLD_READDIR
474#define __ARCH_WANT_OLD_STAT
475#define __ARCH_WANT_STAT64
476#define __ARCH_WANT_SYS_ALARM
477#define __ARCH_WANT_SYS_GETHOSTNAME
478#define __ARCH_WANT_SYS_PAUSE
479#define __ARCH_WANT_SYS_SGETMASK
480#define __ARCH_WANT_SYS_SIGNAL
481#define __ARCH_WANT_SYS_TIME
482#define __ARCH_WANT_SYS_UTIME
483#define __ARCH_WANT_SYS_WAITPID
484#define __ARCH_WANT_SYS_SOCKETCALL
485#define __ARCH_WANT_SYS_FADVISE64
486#define __ARCH_WANT_SYS_GETPGRP
487#define __ARCH_WANT_SYS_LLSEEK
488#define __ARCH_WANT_SYS_NICE
489#define __ARCH_WANT_SYS_OLD_GETRLIMIT
490#define __ARCH_WANT_SYS_OLDUMOUNT
491#define __ARCH_WANT_SYS_SIGPENDING
492#define __ARCH_WANT_SYS_SIGPROCMASK
493#define __ARCH_WANT_SYS_RT_SIGACTION
494#endif
495
496#ifdef __KERNEL_SYSCALLS__
497
498#include <linux/compiler.h>
499#include <linux/types.h>
500
501/*
502 * we need this inline - forking from kernel space will result
503 * in NO COPY ON WRITE (!!!), until an execve is executed. This
504 * is no problem, but for the stack. This is handled by not letting
505 * main() use the stack at all after fork(). Thus, no function
506 * calls - which means inline code for fork too, as otherwise we
507 * would use the stack upon exit from 'fork()'.
508 *
509 * Actually only pause and fork are needed inline, so that there
510 * won't be any messing with the stack from main(), but we define
511 * some others too.
512 */
513#define __NR__exit __NR_exit
514static inline _syscall0(int,pause)
515static inline _syscall0(int,sync)
516static inline _syscall0(pid_t,setsid)
517static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
518static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
519static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
520static inline _syscall1(int,dup,int,fd)
521static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
522static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
523static inline _syscall1(int,close,int,fd)
524static inline _syscall1(int,_exit,int,exitcode)
525static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
526static inline _syscall1(int,delete_module,const char *,name)
527
528static inline pid_t wait(int * wait_stat)
529{
530 return waitpid(-1,wait_stat,0);
531}
532
533asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
534 unsigned long prot, unsigned long flags,
535 unsigned long fd, unsigned long pgoff);
536asmlinkage int sys_execve(char *name, char **argv, char **envp,
537 int dummy, ...);
538asmlinkage int sys_pipe(unsigned long *fildes);
539asmlinkage int sys_ptrace(long request, long pid, long addr, long data);
540struct sigaction;
541asmlinkage long sys_rt_sigaction(int sig,
542 const struct sigaction __user *act,
543 struct sigaction __user *oact,
544 size_t sigsetsize);
545
546#endif
547
548/*
549 * "Conditional" syscalls
550 */
551#define cond_syscall(name) \
552 asm (".weak\t_" #name "\n" \
553 ".set\t_" #name ",_sys_ni_syscall");
554
555#endif /* _ASM_H8300_UNISTD_H_ */
diff --git a/include/asm-h8300/user.h b/include/asm-h8300/user.h
new file mode 100644
index 000000000000..6c64f99af3e1
--- /dev/null
+++ b/include/asm-h8300/user.h
@@ -0,0 +1,76 @@
1#ifndef _H8300_USER_H
2#define _H8300_USER_H
3
4#include <asm/page.h>
5
6/* Core file format: The core file is written in such a way that gdb
7 can understand it and provide useful information to the user (under
8 linux we use the 'trad-core' bfd). There are quite a number of
9 obstacles to being able to view the contents of the floating point
10 registers, and until these are solved you will not be able to view the
11 contents of them. Actually, you can read in the core file and look at
12 the contents of the user struct to find out what the floating point
13 registers contain.
14 The actual file contents are as follows:
15 UPAGE: 1 page consisting of a user struct that tells gdb what is present
16 in the file. Directly after this is a copy of the task_struct, which
17 is currently not used by gdb, but it may come in useful at some point.
18 All of the registers are stored as part of the upage. The upage should
19 always be only one page.
20 DATA: The data area is stored. We use current->end_text to
21 current->brk to pick up all of the user variables, plus any memory
22 that may have been malloced. No attempt is made to determine if a page
23 is demand-zero or if a page is totally unused, we just cover the entire
24 range. All of the addresses are rounded in such a way that an integral
25 number of pages is written.
26 STACK: We need the stack information in order to get a meaningful
27 backtrace. We need to write the data from (esp) to
28 current->start_stack, so we round each of these off in order to be able
29 to write an integer number of pages.
30 The minimum core file size is 3 pages, or 12288 bytes.
31*/
32
33/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
34 is still the layout used by user (the new pt_regs doesn't have
35 all registers). */
36struct user_regs_struct {
37 long er1,er2,er3,er4,er5,er6;
38 long er0;
39 long usp;
40 long orig_er0;
41 short ccr;
42 long pc;
43};
44
45
46/* When the kernel dumps core, it starts by dumping the user struct -
47 this will be used by gdb to figure out where the data and stack segments
48 are within the file, and what virtual addresses to use. */
49struct user{
50/* We start with the registers, to mimic the way that "memory" is returned
51 from the ptrace(3,...) function. */
52 struct user_regs_struct regs; /* Where the registers are actually stored */
53/* ptrace does not yet supply these. Someday.... */
54/* The rest of this junk is to help gdb figure out what goes where */
55 unsigned long int u_tsize; /* Text segment size (pages). */
56 unsigned long int u_dsize; /* Data segment size (pages). */
57 unsigned long int u_ssize; /* Stack segment size (pages). */
58 unsigned long start_code; /* Starting virtual address of text. */
59 unsigned long start_stack; /* Starting virtual address of stack area.
60 This is actually the bottom of the stack,
61 the top of the stack is always found in the
62 esp register. */
63 long int signal; /* Signal that caused the core dump. */
64 int reserved; /* No longer used */
65 struct user_regs_struct *u_ar0;
66 /* Used by gdb to help find the values for */
67 /* the registers. */
68 unsigned long magic; /* To uniquely identify a core file */
69 char u_comm[32]; /* User command that was responsible */
70};
71#define NBPG PAGE_SIZE
72#define UPAGES 1
73#define HOST_TEXT_START_ADDR (u.start_code)
74#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
75
76#endif
diff --git a/include/asm-h8300/virtconvert.h b/include/asm-h8300/virtconvert.h
new file mode 100644
index 000000000000..3b344c1dfe0f
--- /dev/null
+++ b/include/asm-h8300/virtconvert.h
@@ -0,0 +1,23 @@
1#ifndef __H8300_VIRT_CONVERT__
2#define __H8300_VIRT_CONVERT__
3
4/*
5 * Macros used for converting between virtual and physical mappings.
6 */
7
8#ifdef __KERNEL__
9
10#include <linux/config.h>
11#include <asm/setup.h>
12#include <asm/page.h>
13
14#define mm_ptov(vaddr) ((void *) (vaddr))
15#define mm_vtop(vaddr) ((unsigned long) (vaddr))
16#define phys_to_virt(vaddr) ((void *) (vaddr))
17#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
18
19#define virt_to_bus virt_to_phys
20#define bus_to_virt phys_to_virt
21
22#endif
23#endif