diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-17 13:11:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-17 13:11:25 -0400 |
commit | 7b7adc4a016a1decb806eb71ecab98721fa7f146 (patch) | |
tree | 0a6f9a6e5659faa94604fbc575382a18f143c657 /arch/unicore32/include/asm | |
parent | 31598e8713ef501c8f6aad2e2ec8a9457e8877c1 (diff) | |
parent | 289d6b0e287e0acd85f3e6b7ea6c2cb5c234909a (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32: (40 commits)
unicore32: rewrite arch-specific tlb.h to use asm-generic version
unicore32: modify io_p2v and io_v2p macros, and adjust PKUNITY_mmio_BASEs
unicore32: replace unicore32-specific iomap functions with generic lib implementation
unicore32 machine related: add frame buffer driver for pkunity-v3 soc
unicore32 machine related files: add i2c bus drivers for pkunity-v3 soc
unicore32 io: redefine __REG(x) and re-use readl/writel funcs
unicore32 i8042 upgrade and bugfix: adjust resource request region type
unicore32 upgrade to v2.6.38-rc5: add one more paramter for pte_alloc_map call
unicore32 i8042: adjust io funcs of i8042-unicore32io.h
unicore32: rename PKUNITY_IOSPACE_BASE to PKUNITY_MMIO_BASE
unicore32: modify function names and parameters for irq_chips
unicore32: remove unused lines in arch/unicore32/include/asm/irq.h
unicore32 time.c: change calculate method for clock_event_device
unicore32: ADD MAINTAINER for unicore32 architecture
unicore32 machine related files: ps2 driver
unicore32 machine related files: pci bus handling
unicore32 machine related files: hardware registers
unicore32 machine related files: core files
unicore32 additional architecture files: boot process
unicore32 additional architecture files: low-level lib: misc
...
Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/unicore32/include/asm')
46 files changed, 3359 insertions, 0 deletions
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild new file mode 100644 index 00000000000..b200fdaca44 --- /dev/null +++ b/arch/unicore32/include/asm/Kbuild | |||
@@ -0,0 +1,2 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | |||
diff --git a/arch/unicore32/include/asm/assembler.h b/arch/unicore32/include/asm/assembler.h new file mode 100644 index 00000000000..8e87ed7faeb --- /dev/null +++ b/arch/unicore32/include/asm/assembler.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/assembler.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * Do not include any C declarations in this file - it is included by | ||
13 | * assembler source. | ||
14 | */ | ||
15 | #ifndef __ASSEMBLY__ | ||
16 | #error "Only include this from assembly code" | ||
17 | #endif | ||
18 | |||
19 | #include <asm/ptrace.h> | ||
20 | |||
21 | /* | ||
22 | * Little Endian independent macros for shifting bytes within registers. | ||
23 | */ | ||
24 | #define pull >> | ||
25 | #define push << | ||
26 | #define get_byte_0 << #0 | ||
27 | #define get_byte_1 >> #8 | ||
28 | #define get_byte_2 >> #16 | ||
29 | #define get_byte_3 >> #24 | ||
30 | #define put_byte_0 << #0 | ||
31 | #define put_byte_1 << #8 | ||
32 | #define put_byte_2 << #16 | ||
33 | #define put_byte_3 << #24 | ||
34 | |||
35 | #define cadd cmpadd | ||
36 | #define cand cmpand | ||
37 | #define csub cmpsub | ||
38 | #define cxor cmpxor | ||
39 | |||
40 | /* | ||
41 | * Enable and disable interrupts | ||
42 | */ | ||
43 | .macro disable_irq, temp | ||
44 | mov \temp, asr | ||
45 | andn \temp, \temp, #0xFF | ||
46 | or \temp, \temp, #PSR_I_BIT | PRIV_MODE | ||
47 | mov.a asr, \temp | ||
48 | .endm | ||
49 | |||
50 | .macro enable_irq, temp | ||
51 | mov \temp, asr | ||
52 | andn \temp, \temp, #0xFF | ||
53 | or \temp, \temp, #PRIV_MODE | ||
54 | mov.a asr, \temp | ||
55 | .endm | ||
56 | |||
57 | #define USER(x...) \ | ||
58 | 9999: x; \ | ||
59 | .pushsection __ex_table, "a"; \ | ||
60 | .align 3; \ | ||
61 | .long 9999b, 9001f; \ | ||
62 | .popsection | ||
63 | |||
64 | .macro notcond, cond, nexti = .+8 | ||
65 | .ifc \cond, eq | ||
66 | bne \nexti | ||
67 | .else; .ifc \cond, ne | ||
68 | beq \nexti | ||
69 | .else; .ifc \cond, ea | ||
70 | bub \nexti | ||
71 | .else; .ifc \cond, ub | ||
72 | bea \nexti | ||
73 | .else; .ifc \cond, fs | ||
74 | bns \nexti | ||
75 | .else; .ifc \cond, ns | ||
76 | bfs \nexti | ||
77 | .else; .ifc \cond, fv | ||
78 | bnv \nexti | ||
79 | .else; .ifc \cond, nv | ||
80 | bfv \nexti | ||
81 | .else; .ifc \cond, ua | ||
82 | beb \nexti | ||
83 | .else; .ifc \cond, eb | ||
84 | bua \nexti | ||
85 | .else; .ifc \cond, eg | ||
86 | bsl \nexti | ||
87 | .else; .ifc \cond, sl | ||
88 | beg \nexti | ||
89 | .else; .ifc \cond, sg | ||
90 | bel \nexti | ||
91 | .else; .ifc \cond, el | ||
92 | bsg \nexti | ||
93 | .else; .ifnc \cond, al | ||
94 | .error "Unknown cond in notcond macro argument" | ||
95 | .endif; .endif; .endif; .endif; .endif; .endif; .endif | ||
96 | .endif; .endif; .endif; .endif; .endif; .endif; .endif | ||
97 | .endif | ||
98 | .endm | ||
99 | |||
100 | .macro usracc, instr, reg, ptr, inc, cond, rept, abort | ||
101 | .rept \rept | ||
102 | notcond \cond, .+8 | ||
103 | 9999 : | ||
104 | .if \inc == 1 | ||
105 | \instr\()b.u \reg, [\ptr], #\inc | ||
106 | .elseif \inc == 4 | ||
107 | \instr\()w.u \reg, [\ptr], #\inc | ||
108 | .else | ||
109 | .error "Unsupported inc macro argument" | ||
110 | .endif | ||
111 | |||
112 | .pushsection __ex_table, "a" | ||
113 | .align 3 | ||
114 | .long 9999b, \abort | ||
115 | .popsection | ||
116 | .endr | ||
117 | .endm | ||
118 | |||
119 | .macro strusr, reg, ptr, inc, cond = al, rept = 1, abort = 9001f | ||
120 | usracc st, \reg, \ptr, \inc, \cond, \rept, \abort | ||
121 | .endm | ||
122 | |||
123 | .macro ldrusr, reg, ptr, inc, cond = al, rept = 1, abort = 9001f | ||
124 | usracc ld, \reg, \ptr, \inc, \cond, \rept, \abort | ||
125 | .endm | ||
126 | |||
127 | .macro nop8 | ||
128 | .rept 8 | ||
129 | nop | ||
130 | .endr | ||
131 | .endm | ||
diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h new file mode 100644 index 00000000000..1628a632899 --- /dev/null +++ b/arch/unicore32/include/asm/bitops.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/bitops.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_BITOPS_H__ | ||
14 | #define __UNICORE_BITOPS_H__ | ||
15 | |||
16 | #define find_next_bit __uc32_find_next_bit | ||
17 | #define find_next_zero_bit __uc32_find_next_zero_bit | ||
18 | |||
19 | #define find_first_bit __uc32_find_first_bit | ||
20 | #define find_first_zero_bit __uc32_find_first_zero_bit | ||
21 | |||
22 | #define _ASM_GENERIC_BITOPS_FLS_H_ | ||
23 | #define _ASM_GENERIC_BITOPS___FLS_H_ | ||
24 | #define _ASM_GENERIC_BITOPS_FFS_H_ | ||
25 | #define _ASM_GENERIC_BITOPS___FFS_H_ | ||
26 | /* | ||
27 | * On UNICORE, those functions can be implemented around | ||
28 | * the cntlz instruction for much better code efficiency. | ||
29 | */ | ||
30 | |||
31 | static inline int fls(int x) | ||
32 | { | ||
33 | int ret; | ||
34 | |||
35 | asm("cntlz\t%0, %1" : "=r" (ret) : "r" (x) : "cc"); | ||
36 | ret = 32 - ret; | ||
37 | |||
38 | return ret; | ||
39 | } | ||
40 | |||
41 | #define __fls(x) (fls(x) - 1) | ||
42 | #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) | ||
43 | #define __ffs(x) (ffs(x) - 1) | ||
44 | |||
45 | #include <asm-generic/bitops.h> | ||
46 | |||
47 | #endif /* __UNICORE_BITOPS_H__ */ | ||
diff --git a/arch/unicore32/include/asm/byteorder.h b/arch/unicore32/include/asm/byteorder.h new file mode 100644 index 00000000000..ebe1b3fef3e --- /dev/null +++ b/arch/unicore32/include/asm/byteorder.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/byteorder.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * UniCore ONLY support Little Endian mode, the data bus is connected such | ||
13 | * that byte accesses appear as: | ||
14 | * 0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31 | ||
15 | * and word accesses (data or instruction) appear as: | ||
16 | * d0...d31 | ||
17 | */ | ||
18 | #ifndef __UNICORE_BYTEORDER_H__ | ||
19 | #define __UNICORE_BYTEORDER_H__ | ||
20 | |||
21 | #include <linux/byteorder/little_endian.h> | ||
22 | |||
23 | #endif | ||
24 | |||
diff --git a/arch/unicore32/include/asm/cache.h b/arch/unicore32/include/asm/cache.h new file mode 100644 index 00000000000..ad8f795d86c --- /dev/null +++ b/arch/unicore32/include/asm/cache.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/cache.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_CACHE_H__ | ||
13 | #define __UNICORE_CACHE_H__ | ||
14 | |||
15 | #define L1_CACHE_SHIFT (5) | ||
16 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
17 | |||
18 | /* | ||
19 | * Memory returned by kmalloc() may be used for DMA, so we must make | ||
20 | * sure that all such allocations are cache aligned. Otherwise, | ||
21 | * unrelated code may cause parts of the buffer to be read into the | ||
22 | * cache before the transfer is done, causing old data to be seen by | ||
23 | * the CPU. | ||
24 | */ | ||
25 | #define ARCH_DMA_MINALIGN L1_CACHE_BYTES | ||
26 | |||
27 | #endif | ||
diff --git a/arch/unicore32/include/asm/cacheflush.h b/arch/unicore32/include/asm/cacheflush.h new file mode 100644 index 00000000000..c0301e6c8b8 --- /dev/null +++ b/arch/unicore32/include/asm/cacheflush.h | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/cacheflush.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_CACHEFLUSH_H__ | ||
13 | #define __UNICORE_CACHEFLUSH_H__ | ||
14 | |||
15 | #include <linux/mm.h> | ||
16 | |||
17 | #include <asm/shmparam.h> | ||
18 | |||
19 | #define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT) | ||
20 | |||
21 | /* | ||
22 | * This flag is used to indicate that the page pointed to by a pte is clean | ||
23 | * and does not require cleaning before returning it to the user. | ||
24 | */ | ||
25 | #define PG_dcache_clean PG_arch_1 | ||
26 | |||
27 | /* | ||
28 | * MM Cache Management | ||
29 | * =================== | ||
30 | * | ||
31 | * The arch/unicore32/mm/cache.S files implement these methods. | ||
32 | * | ||
33 | * Start addresses are inclusive and end addresses are exclusive; | ||
34 | * start addresses should be rounded down, end addresses up. | ||
35 | * | ||
36 | * See Documentation/cachetlb.txt for more information. | ||
37 | * Please note that the implementation of these, and the required | ||
38 | * effects are cache-type (VIVT/VIPT/PIPT) specific. | ||
39 | * | ||
40 | * flush_icache_all() | ||
41 | * | ||
42 | * Unconditionally clean and invalidate the entire icache. | ||
43 | * Currently only needed for cache-v6.S and cache-v7.S, see | ||
44 | * __flush_icache_all for the generic implementation. | ||
45 | * | ||
46 | * flush_kern_all() | ||
47 | * | ||
48 | * Unconditionally clean and invalidate the entire cache. | ||
49 | * | ||
50 | * flush_user_all() | ||
51 | * | ||
52 | * Clean and invalidate all user space cache entries | ||
53 | * before a change of page tables. | ||
54 | * | ||
55 | * flush_user_range(start, end, flags) | ||
56 | * | ||
57 | * Clean and invalidate a range of cache entries in the | ||
58 | * specified address space before a change of page tables. | ||
59 | * - start - user start address (inclusive, page aligned) | ||
60 | * - end - user end address (exclusive, page aligned) | ||
61 | * - flags - vma->vm_flags field | ||
62 | * | ||
63 | * coherent_kern_range(start, end) | ||
64 | * | ||
65 | * Ensure coherency between the Icache and the Dcache in the | ||
66 | * region described by start, end. If you have non-snooping | ||
67 | * Harvard caches, you need to implement this function. | ||
68 | * - start - virtual start address | ||
69 | * - end - virtual end address | ||
70 | * | ||
71 | * coherent_user_range(start, end) | ||
72 | * | ||
73 | * Ensure coherency between the Icache and the Dcache in the | ||
74 | * region described by start, end. If you have non-snooping | ||
75 | * Harvard caches, you need to implement this function. | ||
76 | * - start - virtual start address | ||
77 | * - end - virtual end address | ||
78 | * | ||
79 | * flush_kern_dcache_area(kaddr, size) | ||
80 | * | ||
81 | * Ensure that the data held in page is written back. | ||
82 | * - kaddr - page address | ||
83 | * - size - region size | ||
84 | * | ||
85 | * DMA Cache Coherency | ||
86 | * =================== | ||
87 | * | ||
88 | * dma_flush_range(start, end) | ||
89 | * | ||
90 | * Clean and invalidate the specified virtual address range. | ||
91 | * - start - virtual start address | ||
92 | * - end - virtual end address | ||
93 | */ | ||
94 | |||
95 | extern void __cpuc_flush_icache_all(void); | ||
96 | extern void __cpuc_flush_kern_all(void); | ||
97 | extern void __cpuc_flush_user_all(void); | ||
98 | extern void __cpuc_flush_user_range(unsigned long, unsigned long, unsigned int); | ||
99 | extern void __cpuc_coherent_kern_range(unsigned long, unsigned long); | ||
100 | extern void __cpuc_coherent_user_range(unsigned long, unsigned long); | ||
101 | extern void __cpuc_flush_dcache_area(void *, size_t); | ||
102 | extern void __cpuc_flush_kern_dcache_area(void *addr, size_t size); | ||
103 | |||
104 | /* | ||
105 | * These are private to the dma-mapping API. Do not use directly. | ||
106 | * Their sole purpose is to ensure that data held in the cache | ||
107 | * is visible to DMA, or data written by DMA to system memory is | ||
108 | * visible to the CPU. | ||
109 | */ | ||
110 | extern void __cpuc_dma_clean_range(unsigned long, unsigned long); | ||
111 | extern void __cpuc_dma_flush_range(unsigned long, unsigned long); | ||
112 | |||
113 | /* | ||
114 | * Copy user data from/to a page which is mapped into a different | ||
115 | * processes address space. Really, we want to allow our "user | ||
116 | * space" model to handle this. | ||
117 | */ | ||
118 | extern void copy_to_user_page(struct vm_area_struct *, struct page *, | ||
119 | unsigned long, void *, const void *, unsigned long); | ||
120 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
121 | do { \ | ||
122 | memcpy(dst, src, len); \ | ||
123 | } while (0) | ||
124 | |||
125 | /* | ||
126 | * Convert calls to our calling convention. | ||
127 | */ | ||
128 | /* Invalidate I-cache */ | ||
129 | static inline void __flush_icache_all(void) | ||
130 | { | ||
131 | asm("movc p0.c5, %0, #20;\n" | ||
132 | "nop; nop; nop; nop; nop; nop; nop; nop\n" | ||
133 | : | ||
134 | : "r" (0)); | ||
135 | } | ||
136 | |||
137 | #define flush_cache_all() __cpuc_flush_kern_all() | ||
138 | |||
139 | extern void flush_cache_mm(struct mm_struct *mm); | ||
140 | extern void flush_cache_range(struct vm_area_struct *vma, | ||
141 | unsigned long start, unsigned long end); | ||
142 | extern void flush_cache_page(struct vm_area_struct *vma, | ||
143 | unsigned long user_addr, unsigned long pfn); | ||
144 | |||
145 | #define flush_cache_dup_mm(mm) flush_cache_mm(mm) | ||
146 | |||
147 | /* | ||
148 | * flush_cache_user_range is used when we want to ensure that the | ||
149 | * Harvard caches are synchronised for the user space address range. | ||
150 | * This is used for the UniCore private sys_cacheflush system call. | ||
151 | */ | ||
152 | #define flush_cache_user_range(vma, start, end) \ | ||
153 | __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end)) | ||
154 | |||
155 | /* | ||
156 | * Perform necessary cache operations to ensure that data previously | ||
157 | * stored within this range of addresses can be executed by the CPU. | ||
158 | */ | ||
159 | #define flush_icache_range(s, e) __cpuc_coherent_kern_range(s, e) | ||
160 | |||
161 | /* | ||
162 | * Perform necessary cache operations to ensure that the TLB will | ||
163 | * see data written in the specified area. | ||
164 | */ | ||
165 | #define clean_dcache_area(start, size) cpu_dcache_clean_area(start, size) | ||
166 | |||
167 | /* | ||
168 | * flush_dcache_page is used when the kernel has written to the page | ||
169 | * cache page at virtual address page->virtual. | ||
170 | * | ||
171 | * If this page isn't mapped (ie, page_mapping == NULL), or it might | ||
172 | * have userspace mappings, then we _must_ always clean + invalidate | ||
173 | * the dcache entries associated with the kernel mapping. | ||
174 | * | ||
175 | * Otherwise we can defer the operation, and clean the cache when we are | ||
176 | * about to change to user space. This is the same method as used on SPARC64. | ||
177 | * See update_mmu_cache for the user space part. | ||
178 | */ | ||
179 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||
180 | extern void flush_dcache_page(struct page *); | ||
181 | |||
182 | #define flush_dcache_mmap_lock(mapping) \ | ||
183 | spin_lock_irq(&(mapping)->tree_lock) | ||
184 | #define flush_dcache_mmap_unlock(mapping) \ | ||
185 | spin_unlock_irq(&(mapping)->tree_lock) | ||
186 | |||
187 | #define flush_icache_user_range(vma, page, addr, len) \ | ||
188 | flush_dcache_page(page) | ||
189 | |||
190 | /* | ||
191 | * We don't appear to need to do anything here. In fact, if we did, we'd | ||
192 | * duplicate cache flushing elsewhere performed by flush_dcache_page(). | ||
193 | */ | ||
194 | #define flush_icache_page(vma, page) do { } while (0) | ||
195 | |||
196 | /* | ||
197 | * flush_cache_vmap() is used when creating mappings (eg, via vmap, | ||
198 | * vmalloc, ioremap etc) in kernel space for pages. On non-VIPT | ||
199 | * caches, since the direct-mappings of these pages may contain cached | ||
200 | * data, we need to do a full cache flush to ensure that writebacks | ||
201 | * don't corrupt data placed into these pages via the new mappings. | ||
202 | */ | ||
203 | static inline void flush_cache_vmap(unsigned long start, unsigned long end) | ||
204 | { | ||
205 | } | ||
206 | |||
207 | static inline void flush_cache_vunmap(unsigned long start, unsigned long end) | ||
208 | { | ||
209 | } | ||
210 | |||
211 | #endif | ||
diff --git a/arch/unicore32/include/asm/checksum.h b/arch/unicore32/include/asm/checksum.h new file mode 100644 index 00000000000..f55c3f937c3 --- /dev/null +++ b/arch/unicore32/include/asm/checksum.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/checksum.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * IP checksum routines | ||
13 | */ | ||
14 | #ifndef __UNICORE_CHECKSUM_H__ | ||
15 | #define __UNICORE_CHECKSUM_H__ | ||
16 | |||
17 | /* | ||
18 | * computes the checksum of the TCP/UDP pseudo-header | ||
19 | * returns a 16-bit checksum, already complemented | ||
20 | */ | ||
21 | |||
22 | static inline __wsum | ||
23 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | ||
24 | unsigned short proto, __wsum sum) | ||
25 | { | ||
26 | __asm__( | ||
27 | "add.a %0, %1, %2\n" | ||
28 | "addc.a %0, %0, %3\n" | ||
29 | "addc.a %0, %0, %4 << #8\n" | ||
30 | "addc.a %0, %0, %5\n" | ||
31 | "addc %0, %0, #0\n" | ||
32 | : "=&r"(sum) | ||
33 | : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto)) | ||
34 | : "cc"); | ||
35 | return sum; | ||
36 | } | ||
37 | #define csum_tcpudp_nofold csum_tcpudp_nofold | ||
38 | |||
39 | #include <asm-generic/checksum.h> | ||
40 | |||
41 | #endif | ||
diff --git a/arch/unicore32/include/asm/cpu-single.h b/arch/unicore32/include/asm/cpu-single.h new file mode 100644 index 00000000000..0f55d182343 --- /dev/null +++ b/arch/unicore32/include/asm/cpu-single.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/cpu-single.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_CPU_SINGLE_H__ | ||
13 | #define __UNICORE_CPU_SINGLE_H__ | ||
14 | |||
15 | #include <asm/page.h> | ||
16 | #include <asm/memory.h> | ||
17 | |||
18 | #ifdef __KERNEL__ | ||
19 | #ifndef __ASSEMBLY__ | ||
20 | |||
21 | #define cpu_switch_mm(pgd, mm) cpu_do_switch_mm(virt_to_phys(pgd), mm) | ||
22 | |||
23 | #define cpu_get_pgd() \ | ||
24 | ({ \ | ||
25 | unsigned long pg; \ | ||
26 | __asm__("movc %0, p0.c2, #0" \ | ||
27 | : "=r" (pg) : : "cc"); \ | ||
28 | pg &= ~0x0fff; \ | ||
29 | (pgd_t *)phys_to_virt(pg); \ | ||
30 | }) | ||
31 | |||
32 | struct mm_struct; | ||
33 | |||
34 | /* declare all the functions as extern */ | ||
35 | extern void cpu_proc_fin(void); | ||
36 | extern int cpu_do_idle(void); | ||
37 | extern void cpu_dcache_clean_area(void *, int); | ||
38 | extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm); | ||
39 | extern void cpu_set_pte(pte_t *ptep, pte_t pte); | ||
40 | extern void cpu_reset(unsigned long addr) __attribute__((noreturn)); | ||
41 | |||
42 | #endif /* __ASSEMBLY__ */ | ||
43 | #endif /* __KERNEL__ */ | ||
44 | |||
45 | #endif /* __UNICORE_CPU_SINGLE_H__ */ | ||
diff --git a/arch/unicore32/include/asm/cputype.h b/arch/unicore32/include/asm/cputype.h new file mode 100644 index 00000000000..ec1a30f9807 --- /dev/null +++ b/arch/unicore32/include/asm/cputype.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/cputype.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_CPUTYPE_H__ | ||
13 | #define __UNICORE_CPUTYPE_H__ | ||
14 | |||
15 | #include <linux/stringify.h> | ||
16 | |||
17 | #define CPUID_CPUID 0 | ||
18 | #define CPUID_CACHETYPE 1 | ||
19 | |||
20 | #define read_cpuid(reg) \ | ||
21 | ({ \ | ||
22 | unsigned int __val; \ | ||
23 | asm("movc %0, p0.c0, #" __stringify(reg) \ | ||
24 | : "=r" (__val) \ | ||
25 | : \ | ||
26 | : "cc"); \ | ||
27 | __val; \ | ||
28 | }) | ||
29 | |||
30 | #define uc32_cpuid read_cpuid(CPUID_CPUID) | ||
31 | #define uc32_cachetype read_cpuid(CPUID_CACHETYPE) | ||
32 | |||
33 | #endif | ||
diff --git a/arch/unicore32/include/asm/delay.h b/arch/unicore32/include/asm/delay.h new file mode 100644 index 00000000000..164ae61cd6f --- /dev/null +++ b/arch/unicore32/include/asm/delay.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/delay.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * Delay routines, using a pre-computed "loops_per_second" value. | ||
13 | */ | ||
14 | #ifndef __UNICORE_DELAY_H__ | ||
15 | #define __UNICORE_DELAY_H__ | ||
16 | |||
17 | #include <asm/param.h> /* HZ */ | ||
18 | |||
19 | extern void __delay(int loops); | ||
20 | |||
21 | /* | ||
22 | * This function intentionally does not exist; if you see references to | ||
23 | * it, it means that you're calling udelay() with an out of range value. | ||
24 | * | ||
25 | * With currently imposed limits, this means that we support a max delay | ||
26 | * of 2000us. Further limits: HZ<=1000 and bogomips<=3355 | ||
27 | */ | ||
28 | extern void __bad_udelay(void); | ||
29 | |||
30 | /* | ||
31 | * division by multiplication: you don't have to worry about | ||
32 | * loss of precision. | ||
33 | * | ||
34 | * Use only for very small delays ( < 1 msec). Should probably use a | ||
35 | * lookup table, really, as the multiplications take much too long with | ||
36 | * short delays. This is a "reasonable" implementation, though (and the | ||
37 | * first constant multiplications gets optimized away if the delay is | ||
38 | * a constant) | ||
39 | */ | ||
40 | extern void __udelay(unsigned long usecs); | ||
41 | extern void __const_udelay(unsigned long); | ||
42 | |||
43 | #define MAX_UDELAY_MS 2 | ||
44 | |||
45 | #define udelay(n) \ | ||
46 | (__builtin_constant_p(n) ? \ | ||
47 | ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ | ||
48 | __const_udelay((n) * ((2199023U*HZ)>>11))) : \ | ||
49 | __udelay(n)) | ||
50 | |||
51 | #endif /* __UNICORE_DELAY_H__ */ | ||
52 | |||
diff --git a/arch/unicore32/include/asm/dma-mapping.h b/arch/unicore32/include/asm/dma-mapping.h new file mode 100644 index 00000000000..9258e592f41 --- /dev/null +++ b/arch/unicore32/include/asm/dma-mapping.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/dma-mapping.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_DMA_MAPPING_H__ | ||
13 | #define __UNICORE_DMA_MAPPING_H__ | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/mm_types.h> | ||
18 | #include <linux/scatterlist.h> | ||
19 | #include <linux/swiotlb.h> | ||
20 | |||
21 | #include <asm-generic/dma-coherent.h> | ||
22 | |||
23 | #include <asm/memory.h> | ||
24 | #include <asm/cacheflush.h> | ||
25 | |||
26 | extern struct dma_map_ops swiotlb_dma_map_ops; | ||
27 | |||
28 | static inline struct dma_map_ops *get_dma_ops(struct device *dev) | ||
29 | { | ||
30 | return &swiotlb_dma_map_ops; | ||
31 | } | ||
32 | |||
33 | static inline int dma_supported(struct device *dev, u64 mask) | ||
34 | { | ||
35 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
36 | |||
37 | if (unlikely(dma_ops == NULL)) | ||
38 | return 0; | ||
39 | |||
40 | return dma_ops->dma_supported(dev, mask); | ||
41 | } | ||
42 | |||
43 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | ||
44 | { | ||
45 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
46 | |||
47 | if (dma_ops->mapping_error) | ||
48 | return dma_ops->mapping_error(dev, dma_addr); | ||
49 | |||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | #include <asm-generic/dma-mapping-common.h> | ||
54 | |||
55 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | ||
56 | { | ||
57 | if (dev && dev->dma_mask) | ||
58 | return addr + size - 1 <= *dev->dma_mask; | ||
59 | |||
60 | return 1; | ||
61 | } | ||
62 | |||
63 | static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) | ||
64 | { | ||
65 | return paddr; | ||
66 | } | ||
67 | |||
68 | static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) | ||
69 | { | ||
70 | return daddr; | ||
71 | } | ||
72 | |||
73 | static inline void dma_mark_clean(void *addr, size_t size) {} | ||
74 | |||
75 | static inline int dma_set_mask(struct device *dev, u64 dma_mask) | ||
76 | { | ||
77 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | ||
78 | return -EIO; | ||
79 | |||
80 | *dev->dma_mask = dma_mask; | ||
81 | |||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | ||
86 | dma_addr_t *dma_handle, gfp_t flag) | ||
87 | { | ||
88 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
89 | |||
90 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); | ||
91 | } | ||
92 | |||
93 | static inline void dma_free_coherent(struct device *dev, size_t size, | ||
94 | void *cpu_addr, dma_addr_t dma_handle) | ||
95 | { | ||
96 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
97 | |||
98 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | ||
99 | } | ||
100 | |||
101 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
102 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
103 | |||
104 | static inline void dma_cache_sync(struct device *dev, void *vaddr, | ||
105 | size_t size, enum dma_data_direction direction) | ||
106 | { | ||
107 | unsigned long start = (unsigned long)vaddr; | ||
108 | unsigned long end = start + size; | ||
109 | |||
110 | switch (direction) { | ||
111 | case DMA_NONE: | ||
112 | BUG(); | ||
113 | case DMA_FROM_DEVICE: | ||
114 | case DMA_BIDIRECTIONAL: /* writeback and invalidate */ | ||
115 | __cpuc_dma_flush_range(start, end); | ||
116 | break; | ||
117 | case DMA_TO_DEVICE: /* writeback only */ | ||
118 | __cpuc_dma_clean_range(start, end); | ||
119 | break; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | #endif /* __KERNEL__ */ | ||
124 | #endif | ||
diff --git a/arch/unicore32/include/asm/dma.h b/arch/unicore32/include/asm/dma.h new file mode 100644 index 00000000000..38dfff9df32 --- /dev/null +++ b/arch/unicore32/include/asm/dma.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/dma.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_DMA_H__ | ||
14 | #define __UNICORE_DMA_H__ | ||
15 | |||
16 | #include <asm/memory.h> | ||
17 | #include <asm-generic/dma.h> | ||
18 | |||
19 | #ifdef CONFIG_PCI | ||
20 | extern int isa_dma_bridge_buggy; | ||
21 | #endif | ||
22 | |||
23 | #endif /* __UNICORE_DMA_H__ */ | ||
diff --git a/arch/unicore32/include/asm/elf.h b/arch/unicore32/include/asm/elf.h new file mode 100644 index 00000000000..829042d0772 --- /dev/null +++ b/arch/unicore32/include/asm/elf.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/elf.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_ELF_H__ | ||
14 | #define __UNICORE_ELF_H__ | ||
15 | |||
16 | #include <asm/hwcap.h> | ||
17 | |||
18 | /* | ||
19 | * ELF register definitions.. | ||
20 | */ | ||
21 | #include <asm/ptrace.h> | ||
22 | |||
23 | typedef unsigned long elf_greg_t; | ||
24 | typedef unsigned long elf_freg_t[3]; | ||
25 | |||
26 | #define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t)) | ||
27 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
28 | |||
29 | typedef struct fp_state elf_fpregset_t; | ||
30 | |||
31 | #define EM_UNICORE 110 | ||
32 | |||
33 | #define R_UNICORE_NONE 0 | ||
34 | #define R_UNICORE_PC24 1 | ||
35 | #define R_UNICORE_ABS32 2 | ||
36 | #define R_UNICORE_CALL 28 | ||
37 | #define R_UNICORE_JUMP24 29 | ||
38 | |||
39 | /* | ||
40 | * These are used to set parameters in the core dumps. | ||
41 | */ | ||
42 | #define ELF_CLASS ELFCLASS32 | ||
43 | #define ELF_DATA ELFDATA2LSB | ||
44 | #define ELF_ARCH EM_UNICORE | ||
45 | |||
46 | /* | ||
47 | * This yields a string that ld.so will use to load implementation | ||
48 | * specific libraries for optimization. This is more specific in | ||
49 | * intent than poking at uname or /proc/cpuinfo. | ||
50 | * | ||
51 | */ | ||
52 | #define ELF_PLATFORM_SIZE 8 | ||
53 | #define ELF_PLATFORM (elf_platform) | ||
54 | |||
55 | extern char elf_platform[]; | ||
56 | |||
57 | struct elf32_hdr; | ||
58 | |||
59 | /* | ||
60 | * This is used to ensure we don't load something for the wrong architecture. | ||
61 | */ | ||
62 | extern int elf_check_arch(const struct elf32_hdr *); | ||
63 | #define elf_check_arch elf_check_arch | ||
64 | |||
65 | struct task_struct; | ||
66 | int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs); | ||
67 | #define ELF_CORE_COPY_TASK_REGS dump_task_regs | ||
68 | |||
69 | #define ELF_EXEC_PAGESIZE 4096 | ||
70 | |||
71 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
72 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
73 | the loader. We need to make sure that it is out of the way of the program | ||
74 | that it will "exec", and that there is sufficient room for the brk. */ | ||
75 | |||
76 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
77 | |||
78 | /* When the program starts, a1 contains a pointer to a function to be | ||
79 | registered with atexit, as per the SVR4 ABI. A value of 0 means we | ||
80 | have no such handler. */ | ||
81 | #define ELF_PLAT_INIT(_r, load_addr) {(_r)->UCreg_00 = 0; } | ||
82 | |||
83 | extern void elf_set_personality(const struct elf32_hdr *); | ||
84 | #define SET_PERSONALITY(ex) elf_set_personality(&(ex)) | ||
85 | |||
86 | struct mm_struct; | ||
87 | extern unsigned long arch_randomize_brk(struct mm_struct *mm); | ||
88 | #define arch_randomize_brk arch_randomize_brk | ||
89 | |||
90 | extern int vectors_user_mapping(void); | ||
91 | #define arch_setup_additional_pages(bprm, uses_interp) vectors_user_mapping() | ||
92 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES | ||
93 | |||
94 | #endif | ||
diff --git a/arch/unicore32/include/asm/fpstate.h b/arch/unicore32/include/asm/fpstate.h new file mode 100644 index 00000000000..ba97fac6220 --- /dev/null +++ b/arch/unicore32/include/asm/fpstate.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/fpstate.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_FPSTATE_H__ | ||
14 | #define __UNICORE_FPSTATE_H__ | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | |||
18 | #define FP_REGS_NUMBER 33 | ||
19 | |||
20 | struct fp_state { | ||
21 | unsigned int regs[FP_REGS_NUMBER]; | ||
22 | } __attribute__((aligned(8))); | ||
23 | |||
24 | #endif | ||
25 | |||
26 | #endif | ||
diff --git a/arch/unicore32/include/asm/fpu-ucf64.h b/arch/unicore32/include/asm/fpu-ucf64.h new file mode 100644 index 00000000000..16c1457882e --- /dev/null +++ b/arch/unicore32/include/asm/fpu-ucf64.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/fpu-ucf64.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Maintained by GUAN Xue-tao <gxt@mprc.pku.edu.cn> | ||
7 | * Copyright (C) 2001-2010 Guan Xuetao | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #define FPSCR s31 | ||
14 | |||
15 | /* FPSCR bits */ | ||
16 | #define FPSCR_DEFAULT_NAN (1<<25) | ||
17 | |||
18 | #define FPSCR_CMPINSTR_BIT (1<<31) | ||
19 | |||
20 | #define FPSCR_CON (1<<29) | ||
21 | #define FPSCR_TRAP (1<<27) | ||
22 | |||
23 | /* RND mode */ | ||
24 | #define FPSCR_ROUND_NEAREST (0<<0) | ||
25 | #define FPSCR_ROUND_PLUSINF (2<<0) | ||
26 | #define FPSCR_ROUND_MINUSINF (3<<0) | ||
27 | #define FPSCR_ROUND_TOZERO (1<<0) | ||
28 | #define FPSCR_RMODE_BIT (0) | ||
29 | #define FPSCR_RMODE_MASK (7 << FPSCR_RMODE_BIT) | ||
30 | |||
31 | /* trap enable */ | ||
32 | #define FPSCR_IOE (1<<16) | ||
33 | #define FPSCR_OFE (1<<14) | ||
34 | #define FPSCR_UFE (1<<13) | ||
35 | #define FPSCR_IXE (1<<12) | ||
36 | #define FPSCR_HIE (1<<11) | ||
37 | #define FPSCR_NDE (1<<10) /* non denomal */ | ||
38 | |||
39 | /* flags */ | ||
40 | #define FPSCR_IDC (1<<24) | ||
41 | #define FPSCR_HIC (1<<23) | ||
42 | #define FPSCR_IXC (1<<22) | ||
43 | #define FPSCR_OFC (1<<21) | ||
44 | #define FPSCR_UFC (1<<20) | ||
45 | #define FPSCR_IOC (1<<19) | ||
46 | |||
47 | /* stick bits */ | ||
48 | #define FPSCR_IOS (1<<9) | ||
49 | #define FPSCR_OFS (1<<7) | ||
50 | #define FPSCR_UFS (1<<6) | ||
51 | #define FPSCR_IXS (1<<5) | ||
52 | #define FPSCR_HIS (1<<4) | ||
53 | #define FPSCR_NDS (1<<3) /*non denomal */ | ||
diff --git a/arch/unicore32/include/asm/futex.h b/arch/unicore32/include/asm/futex.h new file mode 100644 index 00000000000..07dea617055 --- /dev/null +++ b/arch/unicore32/include/asm/futex.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/futex.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_FUTEX_H__ | ||
14 | #define __UNICORE_FUTEX_H__ | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <linux/futex.h> | ||
19 | #include <linux/preempt.h> | ||
20 | #include <linux/uaccess.h> | ||
21 | #include <linux/errno.h> | ||
22 | |||
23 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ | ||
24 | __asm__ __volatile__( \ | ||
25 | "1: ldw.u %1, [%2]\n" \ | ||
26 | " " insn "\n" \ | ||
27 | "2: stw.u %0, [%2]\n" \ | ||
28 | " mov %0, #0\n" \ | ||
29 | "3:\n" \ | ||
30 | " .pushsection __ex_table,\"a\"\n" \ | ||
31 | " .align 3\n" \ | ||
32 | " .long 1b, 4f, 2b, 4f\n" \ | ||
33 | " .popsection\n" \ | ||
34 | " .pushsection .fixup,\"ax\"\n" \ | ||
35 | "4: mov %0, %4\n" \ | ||
36 | " b 3b\n" \ | ||
37 | " .popsection" \ | ||
38 | : "=&r" (ret), "=&r" (oldval) \ | ||
39 | : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \ | ||
40 | : "cc", "memory") | ||
41 | |||
42 | static inline int | ||
43 | futex_atomic_op_inuser(int encoded_op, int __user *uaddr) | ||
44 | { | ||
45 | int op = (encoded_op >> 28) & 7; | ||
46 | int cmp = (encoded_op >> 24) & 15; | ||
47 | int oparg = (encoded_op << 8) >> 20; | ||
48 | int cmparg = (encoded_op << 20) >> 20; | ||
49 | int oldval = 0, ret; | ||
50 | |||
51 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | ||
52 | oparg = 1 << oparg; | ||
53 | |||
54 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | ||
55 | return -EFAULT; | ||
56 | |||
57 | pagefault_disable(); /* implies preempt_disable() */ | ||
58 | |||
59 | switch (op) { | ||
60 | case FUTEX_OP_SET: | ||
61 | __futex_atomic_op("mov %0, %3", ret, oldval, uaddr, oparg); | ||
62 | break; | ||
63 | case FUTEX_OP_ADD: | ||
64 | __futex_atomic_op("add %0, %1, %3", ret, oldval, uaddr, oparg); | ||
65 | break; | ||
66 | case FUTEX_OP_OR: | ||
67 | __futex_atomic_op("or %0, %1, %3", ret, oldval, uaddr, oparg); | ||
68 | break; | ||
69 | case FUTEX_OP_ANDN: | ||
70 | __futex_atomic_op("and %0, %1, %3", | ||
71 | ret, oldval, uaddr, ~oparg); | ||
72 | break; | ||
73 | case FUTEX_OP_XOR: | ||
74 | __futex_atomic_op("xor %0, %1, %3", ret, oldval, uaddr, oparg); | ||
75 | break; | ||
76 | default: | ||
77 | ret = -ENOSYS; | ||
78 | } | ||
79 | |||
80 | pagefault_enable(); /* subsumes preempt_enable() */ | ||
81 | |||
82 | if (!ret) { | ||
83 | switch (cmp) { | ||
84 | case FUTEX_OP_CMP_EQ: | ||
85 | ret = (oldval == cmparg); | ||
86 | break; | ||
87 | case FUTEX_OP_CMP_NE: | ||
88 | ret = (oldval != cmparg); | ||
89 | break; | ||
90 | case FUTEX_OP_CMP_LT: | ||
91 | ret = (oldval < cmparg); | ||
92 | break; | ||
93 | case FUTEX_OP_CMP_GE: | ||
94 | ret = (oldval >= cmparg); | ||
95 | break; | ||
96 | case FUTEX_OP_CMP_LE: | ||
97 | ret = (oldval <= cmparg); | ||
98 | break; | ||
99 | case FUTEX_OP_CMP_GT: | ||
100 | ret = (oldval > cmparg); | ||
101 | break; | ||
102 | default: | ||
103 | ret = -ENOSYS; | ||
104 | } | ||
105 | } | ||
106 | return ret; | ||
107 | } | ||
108 | |||
109 | static inline int | ||
110 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | ||
111 | { | ||
112 | int val; | ||
113 | |||
114 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | ||
115 | return -EFAULT; | ||
116 | |||
117 | pagefault_disable(); /* implies preempt_disable() */ | ||
118 | |||
119 | __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" | ||
120 | "1: ldw.u %0, [%3]\n" | ||
121 | " cmpxor.a %0, %1\n" | ||
122 | " bne 3f\n" | ||
123 | "2: stw.u %2, [%3]\n" | ||
124 | "3:\n" | ||
125 | " .pushsection __ex_table,\"a\"\n" | ||
126 | " .align 3\n" | ||
127 | " .long 1b, 4f, 2b, 4f\n" | ||
128 | " .popsection\n" | ||
129 | " .pushsection .fixup,\"ax\"\n" | ||
130 | "4: mov %0, %4\n" | ||
131 | " b 3b\n" | ||
132 | " .popsection" | ||
133 | : "=&r" (val) | ||
134 | : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT) | ||
135 | : "cc", "memory"); | ||
136 | |||
137 | pagefault_enable(); /* subsumes preempt_enable() */ | ||
138 | |||
139 | return val; | ||
140 | } | ||
141 | |||
142 | #endif /* __KERNEL__ */ | ||
143 | #endif /* __UNICORE_FUTEX_H__ */ | ||
diff --git a/arch/unicore32/include/asm/gpio.h b/arch/unicore32/include/asm/gpio.h new file mode 100644 index 00000000000..2716f14e3ff --- /dev/null +++ b/arch/unicore32/include/asm/gpio.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/gpio.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_GPIO_H__ | ||
14 | #define __UNICORE_GPIO_H__ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <asm/irq.h> | ||
18 | #include <mach/hardware.h> | ||
19 | #include <asm-generic/gpio.h> | ||
20 | |||
21 | #define GPI_OTP_INT 0 | ||
22 | #define GPI_PCI_INTA 1 | ||
23 | #define GPI_PCI_INTB 2 | ||
24 | #define GPI_PCI_INTC 3 | ||
25 | #define GPI_PCI_INTD 4 | ||
26 | #define GPI_BAT_DET 5 | ||
27 | #define GPI_SD_CD 6 | ||
28 | #define GPI_SOFF_REQ 7 | ||
29 | #define GPI_SD_WP 8 | ||
30 | #define GPI_LCD_CASE_OFF 9 | ||
31 | #define GPO_WIFI_EN 10 | ||
32 | #define GPO_HDD_LED 11 | ||
33 | #define GPO_VGA_EN 12 | ||
34 | #define GPO_LCD_EN 13 | ||
35 | #define GPO_LED_DATA 14 | ||
36 | #define GPO_LED_CLK 15 | ||
37 | #define GPO_CAM_PWR_EN 16 | ||
38 | #define GPO_LCD_VCC_EN 17 | ||
39 | #define GPO_SOFT_OFF 18 | ||
40 | #define GPO_BT_EN 19 | ||
41 | #define GPO_FAN_ON 20 | ||
42 | #define GPO_SPKR 21 | ||
43 | #define GPO_SET_V1 23 | ||
44 | #define GPO_SET_V2 24 | ||
45 | #define GPO_CPU_HEALTH 25 | ||
46 | #define GPO_LAN_SEL 26 | ||
47 | |||
48 | #ifdef CONFIG_PUV3_NB0916 | ||
49 | #define GPI_BTN_TOUCH 14 | ||
50 | #define GPIO_IN 0x000043ff /* 1 for input */ | ||
51 | #define GPIO_OUT 0x0fffbc00 /* 1 for output */ | ||
52 | #endif /* CONFIG_PUV3_NB0916 */ | ||
53 | |||
54 | #ifdef CONFIG_PUV3_SMW0919 | ||
55 | #define GPIO_IN 0x000003ff /* 1 for input */ | ||
56 | #define GPIO_OUT 0x0ffffc00 /* 1 for output */ | ||
57 | #endif /* CONFIG_PUV3_SMW0919 */ | ||
58 | |||
59 | #ifdef CONFIG_PUV3_DB0913 | ||
60 | #define GPIO_IN 0x000001df /* 1 for input */ | ||
61 | #define GPIO_OUT 0x03fee800 /* 1 for output */ | ||
62 | #endif /* CONFIG_PUV3_DB0913 */ | ||
63 | |||
64 | #define GPIO_DIR (~((GPIO_IN) | 0xf0000000)) | ||
65 | /* 0 input, 1 output */ | ||
66 | |||
67 | static inline int gpio_get_value(unsigned gpio) | ||
68 | { | ||
69 | if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) | ||
70 | return readl(GPIO_GPLR) & GPIO_GPIO(gpio); | ||
71 | else | ||
72 | return __gpio_get_value(gpio); | ||
73 | } | ||
74 | |||
75 | static inline void gpio_set_value(unsigned gpio, int value) | ||
76 | { | ||
77 | if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) | ||
78 | if (value) | ||
79 | writel(GPIO_GPIO(gpio), GPIO_GPSR); | ||
80 | else | ||
81 | writel(GPIO_GPIO(gpio), GPIO_GPCR); | ||
82 | else | ||
83 | __gpio_set_value(gpio, value); | ||
84 | } | ||
85 | |||
86 | #define gpio_cansleep __gpio_cansleep | ||
87 | |||
88 | static inline unsigned gpio_to_irq(unsigned gpio) | ||
89 | { | ||
90 | if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & readl(GPIO_GPIR))) | ||
91 | return IRQ_GPIOLOW0 + gpio; | ||
92 | else | ||
93 | return IRQ_GPIO0 + gpio; | ||
94 | } | ||
95 | |||
96 | static inline unsigned irq_to_gpio(unsigned irq) | ||
97 | { | ||
98 | if (irq < IRQ_GPIOHIGH) | ||
99 | return irq - IRQ_GPIOLOW0; | ||
100 | else | ||
101 | return irq - IRQ_GPIO0; | ||
102 | } | ||
103 | |||
104 | #endif /* __UNICORE_GPIO_H__ */ | ||
diff --git a/arch/unicore32/include/asm/hwcap.h b/arch/unicore32/include/asm/hwcap.h new file mode 100644 index 00000000000..97bd40fdd4a --- /dev/null +++ b/arch/unicore32/include/asm/hwcap.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/hwcap.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_HWCAP_H__ | ||
13 | #define __UNICORE_HWCAP_H__ | ||
14 | |||
15 | /* | ||
16 | * HWCAP flags | ||
17 | */ | ||
18 | #define HWCAP_MSP 1 | ||
19 | #define HWCAP_UNICORE16 2 | ||
20 | #define HWCAP_CMOV 4 | ||
21 | #define HWCAP_UNICORE_F64 8 | ||
22 | #define HWCAP_TLS 0x80 | ||
23 | |||
24 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | ||
25 | /* | ||
26 | * This yields a mask that user programs can use to figure out what | ||
27 | * instruction set this cpu supports. | ||
28 | */ | ||
29 | #define ELF_HWCAP (HWCAP_CMOV | HWCAP_UNICORE_F64) | ||
30 | #endif | ||
31 | |||
32 | #endif | ||
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h new file mode 100644 index 00000000000..4bd87f3d13d --- /dev/null +++ b/arch/unicore32/include/asm/io.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/io.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_IO_H__ | ||
13 | #define __UNICORE_IO_H__ | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <asm/byteorder.h> | ||
18 | #include <asm/memory.h> | ||
19 | #include <asm/system.h> | ||
20 | |||
21 | #define PCI_IOBASE PKUNITY_PCILIO_BASE | ||
22 | #include <asm-generic/io.h> | ||
23 | |||
24 | /* | ||
25 | * __uc32_ioremap and __uc32_ioremap_cached takes CPU physical address. | ||
26 | */ | ||
27 | extern void __iomem *__uc32_ioremap(unsigned long, size_t); | ||
28 | extern void __iomem *__uc32_ioremap_cached(unsigned long, size_t); | ||
29 | extern void __uc32_iounmap(volatile void __iomem *addr); | ||
30 | |||
31 | /* | ||
32 | * ioremap and friends. | ||
33 | * | ||
34 | * ioremap takes a PCI memory address, as specified in | ||
35 | * Documentation/IO-mapping.txt. | ||
36 | * | ||
37 | */ | ||
38 | #define ioremap(cookie, size) __uc32_ioremap(cookie, size) | ||
39 | #define ioremap_cached(cookie, size) __uc32_ioremap_cached(cookie, size) | ||
40 | #define iounmap(cookie) __uc32_iounmap(cookie) | ||
41 | |||
42 | /* | ||
43 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
44 | * access | ||
45 | */ | ||
46 | #undef xlate_dev_mem_ptr | ||
47 | #define xlate_dev_mem_ptr(p) __va(p) | ||
48 | |||
49 | #define HAVE_ARCH_PIO_SIZE | ||
50 | #define PIO_OFFSET (unsigned int)(PCI_IOBASE) | ||
51 | #define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) | ||
52 | #define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1) | ||
53 | |||
54 | #endif /* __KERNEL__ */ | ||
55 | #endif /* __UNICORE_IO_H__ */ | ||
diff --git a/arch/unicore32/include/asm/irq.h b/arch/unicore32/include/asm/irq.h new file mode 100644 index 00000000000..baea93e2a6e --- /dev/null +++ b/arch/unicore32/include/asm/irq.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/irq.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_IRQ_H__ | ||
13 | #define __UNICORE_IRQ_H__ | ||
14 | |||
15 | #include <asm-generic/irq.h> | ||
16 | |||
17 | #define IRQ_GPIOLOW0 0x00 | ||
18 | #define IRQ_GPIOLOW1 0x01 | ||
19 | #define IRQ_GPIOLOW2 0x02 | ||
20 | #define IRQ_GPIOLOW3 0x03 | ||
21 | #define IRQ_GPIOLOW4 0x04 | ||
22 | #define IRQ_GPIOLOW5 0x05 | ||
23 | #define IRQ_GPIOLOW6 0x06 | ||
24 | #define IRQ_GPIOLOW7 0x07 | ||
25 | #define IRQ_GPIOHIGH 0x08 | ||
26 | #define IRQ_USB 0x09 | ||
27 | #define IRQ_SDC 0x0a | ||
28 | #define IRQ_AC97 0x0b | ||
29 | #define IRQ_SATA 0x0c | ||
30 | #define IRQ_MME 0x0d | ||
31 | #define IRQ_PCI_BRIDGE 0x0e | ||
32 | #define IRQ_DDR 0x0f | ||
33 | #define IRQ_SPI 0x10 | ||
34 | #define IRQ_UNIGFX 0x11 | ||
35 | #define IRQ_I2C 0x11 | ||
36 | #define IRQ_UART1 0x12 | ||
37 | #define IRQ_UART0 0x13 | ||
38 | #define IRQ_UMAL 0x14 | ||
39 | #define IRQ_NAND 0x15 | ||
40 | #define IRQ_PS2_KBD 0x16 | ||
41 | #define IRQ_PS2_AUX 0x17 | ||
42 | #define IRQ_DMA 0x18 | ||
43 | #define IRQ_DMAERR 0x19 | ||
44 | #define IRQ_TIMER0 0x1a | ||
45 | #define IRQ_TIMER1 0x1b | ||
46 | #define IRQ_TIMER2 0x1c | ||
47 | #define IRQ_TIMER3 0x1d | ||
48 | #define IRQ_RTC 0x1e | ||
49 | #define IRQ_RTCAlarm 0x1f | ||
50 | |||
51 | #define IRQ_GPIO0 0x20 | ||
52 | #define IRQ_GPIO1 0x21 | ||
53 | #define IRQ_GPIO2 0x22 | ||
54 | #define IRQ_GPIO3 0x23 | ||
55 | #define IRQ_GPIO4 0x24 | ||
56 | #define IRQ_GPIO5 0x25 | ||
57 | #define IRQ_GPIO6 0x26 | ||
58 | #define IRQ_GPIO7 0x27 | ||
59 | #define IRQ_GPIO8 0x28 | ||
60 | #define IRQ_GPIO9 0x29 | ||
61 | #define IRQ_GPIO10 0x2a | ||
62 | #define IRQ_GPIO11 0x2b | ||
63 | #define IRQ_GPIO12 0x2c | ||
64 | #define IRQ_GPIO13 0x2d | ||
65 | #define IRQ_GPIO14 0x2e | ||
66 | #define IRQ_GPIO15 0x2f | ||
67 | #define IRQ_GPIO16 0x30 | ||
68 | #define IRQ_GPIO17 0x31 | ||
69 | #define IRQ_GPIO18 0x32 | ||
70 | #define IRQ_GPIO19 0x33 | ||
71 | #define IRQ_GPIO20 0x34 | ||
72 | #define IRQ_GPIO21 0x35 | ||
73 | #define IRQ_GPIO22 0x36 | ||
74 | #define IRQ_GPIO23 0x37 | ||
75 | #define IRQ_GPIO24 0x38 | ||
76 | #define IRQ_GPIO25 0x39 | ||
77 | #define IRQ_GPIO26 0x3a | ||
78 | #define IRQ_GPIO27 0x3b | ||
79 | |||
80 | #ifdef CONFIG_ARCH_FPGA | ||
81 | #define IRQ_PCIINTA IRQ_GPIOLOW2 | ||
82 | #define IRQ_PCIINTB IRQ_GPIOLOW1 | ||
83 | #define IRQ_PCIINTC IRQ_GPIOLOW0 | ||
84 | #define IRQ_PCIINTD IRQ_GPIOLOW6 | ||
85 | #endif | ||
86 | |||
87 | #if defined(CONFIG_PUV3_DB0913) || defined(CONFIG_PUV3_NB0916) \ | ||
88 | || defined(CONFIG_PUV3_SMW0919) | ||
89 | #define IRQ_PCIINTA IRQ_GPIOLOW1 | ||
90 | #define IRQ_PCIINTB IRQ_GPIOLOW2 | ||
91 | #define IRQ_PCIINTC IRQ_GPIOLOW3 | ||
92 | #define IRQ_PCIINTD IRQ_GPIOLOW4 | ||
93 | #endif | ||
94 | |||
95 | #define IRQ_SD_CD IRQ_GPIO6 /* falling or rising trigger */ | ||
96 | |||
97 | #ifndef __ASSEMBLY__ | ||
98 | struct pt_regs; | ||
99 | |||
100 | extern void asm_do_IRQ(unsigned int, struct pt_regs *); | ||
101 | |||
102 | #endif | ||
103 | |||
104 | #endif | ||
105 | |||
diff --git a/arch/unicore32/include/asm/irqflags.h b/arch/unicore32/include/asm/irqflags.h new file mode 100644 index 00000000000..6d8a28dfdba --- /dev/null +++ b/arch/unicore32/include/asm/irqflags.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/irqflags.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_IRQFLAGS_H__ | ||
13 | #define __UNICORE_IRQFLAGS_H__ | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <asm/ptrace.h> | ||
18 | |||
19 | #define ARCH_IRQ_DISABLED (PRIV_MODE | PSR_I_BIT) | ||
20 | #define ARCH_IRQ_ENABLED (PRIV_MODE) | ||
21 | |||
22 | /* | ||
23 | * Save the current interrupt enable state. | ||
24 | */ | ||
25 | static inline unsigned long arch_local_save_flags(void) | ||
26 | { | ||
27 | unsigned long temp; | ||
28 | |||
29 | asm volatile("mov %0, asr" : "=r" (temp) : : "memory", "cc"); | ||
30 | |||
31 | return temp & PSR_c; | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * restore saved IRQ state | ||
36 | */ | ||
37 | static inline void arch_local_irq_restore(unsigned long flags) | ||
38 | { | ||
39 | unsigned long temp; | ||
40 | |||
41 | asm volatile( | ||
42 | "mov %0, asr\n" | ||
43 | "mov.a asr, %1\n" | ||
44 | "mov.f asr, %0" | ||
45 | : "=&r" (temp) | ||
46 | : "r" (flags) | ||
47 | : "memory", "cc"); | ||
48 | } | ||
49 | |||
50 | #include <asm-generic/irqflags.h> | ||
51 | |||
52 | #endif | ||
53 | #endif | ||
diff --git a/arch/unicore32/include/asm/linkage.h b/arch/unicore32/include/asm/linkage.h new file mode 100644 index 00000000000..d1618bd35b6 --- /dev/null +++ b/arch/unicore32/include/asm/linkage.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/linkage.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_LINKAGE_H__ | ||
13 | #define __UNICORE_LINKAGE_H__ | ||
14 | |||
15 | #define __ALIGN .align 0 | ||
16 | #define __ALIGN_STR ".align 0" | ||
17 | |||
18 | #define ENDPROC(name) \ | ||
19 | .type name, %function; \ | ||
20 | END(name) | ||
21 | |||
22 | #endif | ||
diff --git a/arch/unicore32/include/asm/memblock.h b/arch/unicore32/include/asm/memblock.h new file mode 100644 index 00000000000..a8a5d8d0a26 --- /dev/null +++ b/arch/unicore32/include/asm/memblock.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/memblock.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_MEMBLOCK_H__ | ||
14 | #define __UNICORE_MEMBLOCK_H__ | ||
15 | |||
16 | /* | ||
17 | * Memory map description | ||
18 | */ | ||
19 | # define NR_BANKS 8 | ||
20 | |||
21 | struct membank { | ||
22 | unsigned long start; | ||
23 | unsigned long size; | ||
24 | unsigned int highmem; | ||
25 | }; | ||
26 | |||
27 | struct meminfo { | ||
28 | int nr_banks; | ||
29 | struct membank bank[NR_BANKS]; | ||
30 | }; | ||
31 | |||
32 | extern struct meminfo meminfo; | ||
33 | |||
34 | #define for_each_bank(iter, mi) \ | ||
35 | for (iter = 0; iter < (mi)->nr_banks; iter++) | ||
36 | |||
37 | #define bank_pfn_start(bank) __phys_to_pfn((bank)->start) | ||
38 | #define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size) | ||
39 | #define bank_pfn_size(bank) ((bank)->size >> PAGE_SHIFT) | ||
40 | #define bank_phys_start(bank) ((bank)->start) | ||
41 | #define bank_phys_end(bank) ((bank)->start + (bank)->size) | ||
42 | #define bank_phys_size(bank) ((bank)->size) | ||
43 | |||
44 | extern void uc32_memblock_init(struct meminfo *); | ||
45 | |||
46 | #endif | ||
diff --git a/arch/unicore32/include/asm/memory.h b/arch/unicore32/include/asm/memory.h new file mode 100644 index 00000000000..5eddb997def --- /dev/null +++ b/arch/unicore32/include/asm/memory.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/memory.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * Note: this file should not be included by non-asm/.h files | ||
13 | */ | ||
14 | #ifndef __UNICORE_MEMORY_H__ | ||
15 | #define __UNICORE_MEMORY_H__ | ||
16 | |||
17 | #include <linux/compiler.h> | ||
18 | #include <linux/const.h> | ||
19 | #include <asm/sizes.h> | ||
20 | #include <mach/memory.h> | ||
21 | |||
22 | /* | ||
23 | * Allow for constants defined here to be used from assembly code | ||
24 | * by prepending the UL suffix only with actual C code compilation. | ||
25 | */ | ||
26 | #define UL(x) _AC(x, UL) | ||
27 | |||
28 | /* | ||
29 | * PAGE_OFFSET - the virtual address of the start of the kernel image | ||
30 | * TASK_SIZE - the maximum size of a user space task. | ||
31 | * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area | ||
32 | */ | ||
33 | #define PAGE_OFFSET UL(0xC0000000) | ||
34 | #define TASK_SIZE (PAGE_OFFSET - UL(0x41000000)) | ||
35 | #define TASK_UNMAPPED_BASE (PAGE_OFFSET / 3) | ||
36 | |||
37 | /* | ||
38 | * The module space lives between the addresses given by TASK_SIZE | ||
39 | * and PAGE_OFFSET - it must be within 32MB of the kernel text. | ||
40 | */ | ||
41 | #define MODULES_VADDR (PAGE_OFFSET - 16*1024*1024) | ||
42 | #if TASK_SIZE > MODULES_VADDR | ||
43 | #error Top of user space clashes with start of module space | ||
44 | #endif | ||
45 | |||
46 | #define MODULES_END (PAGE_OFFSET) | ||
47 | |||
48 | /* | ||
49 | * Allow 16MB-aligned ioremap pages | ||
50 | */ | ||
51 | #define IOREMAP_MAX_ORDER 24 | ||
52 | |||
53 | /* | ||
54 | * Physical vs virtual RAM address space conversion. These are | ||
55 | * private definitions which should NOT be used outside memory.h | ||
56 | * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. | ||
57 | */ | ||
58 | #ifndef __virt_to_phys | ||
59 | #define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET) | ||
60 | #define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET) | ||
61 | #endif | ||
62 | |||
63 | /* | ||
64 | * Convert a physical address to a Page Frame Number and back | ||
65 | */ | ||
66 | #define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT) | ||
67 | #define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) | ||
68 | |||
69 | /* | ||
70 | * Convert a page to/from a physical address | ||
71 | */ | ||
72 | #define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page))) | ||
73 | #define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys))) | ||
74 | |||
75 | #ifndef __ASSEMBLY__ | ||
76 | |||
77 | #ifndef arch_adjust_zones | ||
78 | #define arch_adjust_zones(size, holes) do { } while (0) | ||
79 | #endif | ||
80 | |||
81 | /* | ||
82 | * PFNs are used to describe any physical page; this means | ||
83 | * PFN 0 == physical address 0. | ||
84 | * | ||
85 | * This is the PFN of the first RAM page in the kernel | ||
86 | * direct-mapped view. We assume this is the first page | ||
87 | * of RAM in the mem_map as well. | ||
88 | */ | ||
89 | #define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT) | ||
90 | |||
91 | /* | ||
92 | * Drivers should NOT use these either. | ||
93 | */ | ||
94 | #define __pa(x) __virt_to_phys((unsigned long)(x)) | ||
95 | #define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) | ||
96 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | ||
97 | |||
98 | /* | ||
99 | * Conversion between a struct page and a physical address. | ||
100 | * | ||
101 | * Note: when converting an unknown physical address to a | ||
102 | * struct page, the resulting pointer must be validated | ||
103 | * using VALID_PAGE(). It must return an invalid struct page | ||
104 | * for any physical address not corresponding to a system | ||
105 | * RAM address. | ||
106 | * | ||
107 | * page_to_pfn(page) convert a struct page * to a PFN number | ||
108 | * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * | ||
109 | * | ||
110 | * virt_to_page(k) convert a _valid_ virtual address to struct page * | ||
111 | * virt_addr_valid(k) indicates whether a virtual address is valid | ||
112 | */ | ||
113 | #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET | ||
114 | |||
115 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
116 | #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && \ | ||
117 | (unsigned long)(kaddr) < (unsigned long)high_memory) | ||
118 | |||
119 | #endif | ||
120 | |||
121 | #include <asm-generic/memory_model.h> | ||
122 | |||
123 | #endif | ||
diff --git a/arch/unicore32/include/asm/mmu.h b/arch/unicore32/include/asm/mmu.h new file mode 100644 index 00000000000..66fa341dc2c --- /dev/null +++ b/arch/unicore32/include/asm/mmu.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/mmu.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_MMU_H__ | ||
13 | #define __UNICORE_MMU_H__ | ||
14 | |||
15 | typedef unsigned long mm_context_t; | ||
16 | |||
17 | #endif | ||
diff --git a/arch/unicore32/include/asm/mmu_context.h b/arch/unicore32/include/asm/mmu_context.h new file mode 100644 index 00000000000..fb5e4c658f7 --- /dev/null +++ b/arch/unicore32/include/asm/mmu_context.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/mmu_context.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_MMU_CONTEXT_H__ | ||
13 | #define __UNICORE_MMU_CONTEXT_H__ | ||
14 | |||
15 | #include <linux/compiler.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/io.h> | ||
18 | |||
19 | #include <asm/cacheflush.h> | ||
20 | #include <asm/cpu-single.h> | ||
21 | |||
22 | #define init_new_context(tsk, mm) 0 | ||
23 | |||
24 | #define destroy_context(mm) do { } while (0) | ||
25 | |||
26 | /* | ||
27 | * This is called when "tsk" is about to enter lazy TLB mode. | ||
28 | * | ||
29 | * mm: describes the currently active mm context | ||
30 | * tsk: task which is entering lazy tlb | ||
31 | * cpu: cpu number which is entering lazy tlb | ||
32 | * | ||
33 | * tsk->mm will be NULL | ||
34 | */ | ||
35 | static inline void | ||
36 | enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
37 | { | ||
38 | } | ||
39 | |||
40 | /* | ||
41 | * This is the actual mm switch as far as the scheduler | ||
42 | * is concerned. No registers are touched. We avoid | ||
43 | * calling the CPU specific function when the mm hasn't | ||
44 | * actually changed. | ||
45 | */ | ||
46 | static inline void | ||
47 | switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
48 | struct task_struct *tsk) | ||
49 | { | ||
50 | unsigned int cpu = smp_processor_id(); | ||
51 | |||
52 | if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) | ||
53 | cpu_switch_mm(next->pgd, next); | ||
54 | } | ||
55 | |||
56 | #define deactivate_mm(tsk, mm) do { } while (0) | ||
57 | #define activate_mm(prev, next) switch_mm(prev, next, NULL) | ||
58 | |||
59 | /* | ||
60 | * We are inserting a "fake" vma for the user-accessible vector page so | ||
61 | * gdb and friends can get to it through ptrace and /proc/<pid>/mem. | ||
62 | * But we also want to remove it before the generic code gets to see it | ||
63 | * during process exit or the unmapping of it would cause total havoc. | ||
64 | * (the macro is used as remove_vma() is static to mm/mmap.c) | ||
65 | */ | ||
66 | #define arch_exit_mmap(mm) \ | ||
67 | do { \ | ||
68 | struct vm_area_struct *high_vma = find_vma(mm, 0xffff0000); \ | ||
69 | if (high_vma) { \ | ||
70 | BUG_ON(high_vma->vm_next); /* it should be last */ \ | ||
71 | if (high_vma->vm_prev) \ | ||
72 | high_vma->vm_prev->vm_next = NULL; \ | ||
73 | else \ | ||
74 | mm->mmap = NULL; \ | ||
75 | rb_erase(&high_vma->vm_rb, &mm->mm_rb); \ | ||
76 | mm->mmap_cache = NULL; \ | ||
77 | mm->map_count--; \ | ||
78 | remove_vma(high_vma); \ | ||
79 | } \ | ||
80 | } while (0) | ||
81 | |||
82 | static inline void arch_dup_mmap(struct mm_struct *oldmm, | ||
83 | struct mm_struct *mm) | ||
84 | { | ||
85 | } | ||
86 | |||
87 | #endif | ||
diff --git a/arch/unicore32/include/asm/mutex.h b/arch/unicore32/include/asm/mutex.h new file mode 100644 index 00000000000..fab7d0e8adf --- /dev/null +++ b/arch/unicore32/include/asm/mutex.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/mutex.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * UniCore optimized mutex locking primitives | ||
13 | * | ||
14 | * Please look into asm-generic/mutex-xchg.h for a formal definition. | ||
15 | */ | ||
16 | #ifndef __UNICORE_MUTEX_H__ | ||
17 | #define __UNICORE_MUTEX_H__ | ||
18 | |||
19 | # include <asm-generic/mutex-xchg.h> | ||
20 | #endif | ||
diff --git a/arch/unicore32/include/asm/page.h b/arch/unicore32/include/asm/page.h new file mode 100644 index 00000000000..594b3226250 --- /dev/null +++ b/arch/unicore32/include/asm/page.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/page.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_PAGE_H__ | ||
13 | #define __UNICORE_PAGE_H__ | ||
14 | |||
15 | /* PAGE_SHIFT determines the page size */ | ||
16 | #define PAGE_SHIFT 12 | ||
17 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) | ||
18 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
19 | |||
20 | #ifndef __ASSEMBLY__ | ||
21 | |||
22 | struct page; | ||
23 | struct vm_area_struct; | ||
24 | |||
25 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | ||
26 | extern void copy_page(void *to, const void *from); | ||
27 | |||
28 | #define clear_user_page(page, vaddr, pg) clear_page(page) | ||
29 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
30 | |||
31 | #undef STRICT_MM_TYPECHECKS | ||
32 | |||
33 | #ifdef STRICT_MM_TYPECHECKS | ||
34 | /* | ||
35 | * These are used to make use of C type-checking.. | ||
36 | */ | ||
37 | typedef struct { unsigned long pte; } pte_t; | ||
38 | typedef struct { unsigned long pgd; } pgd_t; | ||
39 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
40 | |||
41 | #define pte_val(x) ((x).pte) | ||
42 | #define pgd_val(x) ((x).pgd) | ||
43 | #define pgprot_val(x) ((x).pgprot) | ||
44 | |||
45 | #define __pte(x) ((pte_t) { (x) }) | ||
46 | #define __pgd(x) ((pgd_t) { (x) }) | ||
47 | #define __pgprot(x) ((pgprot_t) { (x) }) | ||
48 | |||
49 | #else | ||
50 | /* | ||
51 | * .. while these make it easier on the compiler | ||
52 | */ | ||
53 | typedef unsigned long pte_t; | ||
54 | typedef unsigned long pgd_t; | ||
55 | typedef unsigned long pgprot_t; | ||
56 | |||
57 | #define pte_val(x) (x) | ||
58 | #define pgd_val(x) (x) | ||
59 | #define pgprot_val(x) (x) | ||
60 | |||
61 | #define __pte(x) (x) | ||
62 | #define __pgd(x) (x) | ||
63 | #define __pgprot(x) (x) | ||
64 | |||
65 | #endif /* STRICT_MM_TYPECHECKS */ | ||
66 | |||
67 | typedef struct page *pgtable_t; | ||
68 | |||
69 | extern int pfn_valid(unsigned long); | ||
70 | |||
71 | #include <asm/memory.h> | ||
72 | |||
73 | #endif /* !__ASSEMBLY__ */ | ||
74 | |||
75 | #define VM_DATA_DEFAULT_FLAGS \ | ||
76 | (VM_READ | VM_WRITE | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
77 | |||
78 | #include <asm-generic/getorder.h> | ||
79 | |||
80 | #endif | ||
diff --git a/arch/unicore32/include/asm/pci.h b/arch/unicore32/include/asm/pci.h new file mode 100644 index 00000000000..c5b28b45953 --- /dev/null +++ b/arch/unicore32/include/asm/pci.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/pci.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_PCI_H__ | ||
13 | #define __UNICORE_PCI_H__ | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | #include <asm-generic/pci-dma-compat.h> | ||
17 | #include <asm-generic/pci.h> | ||
18 | #include <mach/hardware.h> /* for PCIBIOS_MIN_* */ | ||
19 | |||
20 | static inline void pcibios_set_master(struct pci_dev *dev) | ||
21 | { | ||
22 | /* No special bus mastering setup handling */ | ||
23 | } | ||
24 | |||
25 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
26 | { | ||
27 | /* We don't do dynamic PCI IRQ allocation */ | ||
28 | } | ||
29 | |||
30 | #ifdef CONFIG_PCI | ||
31 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
32 | enum pci_dma_burst_strategy *strat, | ||
33 | unsigned long *strategy_parameter) | ||
34 | { | ||
35 | *strat = PCI_DMA_BURST_INFINITY; | ||
36 | *strategy_parameter = ~0UL; | ||
37 | } | ||
38 | #endif | ||
39 | |||
40 | #define HAVE_PCI_MMAP | ||
41 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | ||
42 | enum pci_mmap_state mmap_state, int write_combine); | ||
43 | |||
44 | #endif /* __KERNEL__ */ | ||
45 | |||
46 | #endif | ||
diff --git a/arch/unicore32/include/asm/pgalloc.h b/arch/unicore32/include/asm/pgalloc.h new file mode 100644 index 00000000000..0213e373a89 --- /dev/null +++ b/arch/unicore32/include/asm/pgalloc.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/pgalloc.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_PGALLOC_H__ | ||
13 | #define __UNICORE_PGALLOC_H__ | ||
14 | |||
15 | #include <asm/pgtable-hwdef.h> | ||
16 | #include <asm/processor.h> | ||
17 | #include <asm/cacheflush.h> | ||
18 | #include <asm/tlbflush.h> | ||
19 | |||
20 | #define check_pgt_cache() do { } while (0) | ||
21 | |||
22 | #define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_PRESENT) | ||
23 | #define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_PRESENT) | ||
24 | |||
25 | extern pgd_t *get_pgd_slow(struct mm_struct *mm); | ||
26 | extern void free_pgd_slow(struct mm_struct *mm, pgd_t *pgd); | ||
27 | |||
28 | #define pgd_alloc(mm) get_pgd_slow(mm) | ||
29 | #define pgd_free(mm, pgd) free_pgd_slow(mm, pgd) | ||
30 | |||
31 | #define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO) | ||
32 | |||
33 | /* | ||
34 | * Allocate one PTE table. | ||
35 | */ | ||
36 | static inline pte_t * | ||
37 | pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr) | ||
38 | { | ||
39 | pte_t *pte; | ||
40 | |||
41 | pte = (pte_t *)__get_free_page(PGALLOC_GFP); | ||
42 | if (pte) | ||
43 | clean_dcache_area(pte, PTRS_PER_PTE * sizeof(pte_t)); | ||
44 | |||
45 | return pte; | ||
46 | } | ||
47 | |||
48 | static inline pgtable_t | ||
49 | pte_alloc_one(struct mm_struct *mm, unsigned long addr) | ||
50 | { | ||
51 | struct page *pte; | ||
52 | |||
53 | pte = alloc_pages(PGALLOC_GFP, 0); | ||
54 | if (pte) { | ||
55 | if (!PageHighMem(pte)) { | ||
56 | void *page = page_address(pte); | ||
57 | clean_dcache_area(page, PTRS_PER_PTE * sizeof(pte_t)); | ||
58 | } | ||
59 | pgtable_page_ctor(pte); | ||
60 | } | ||
61 | |||
62 | return pte; | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | * Free one PTE table. | ||
67 | */ | ||
68 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
69 | { | ||
70 | if (pte) | ||
71 | free_page((unsigned long)pte); | ||
72 | } | ||
73 | |||
74 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) | ||
75 | { | ||
76 | pgtable_page_dtor(pte); | ||
77 | __free_page(pte); | ||
78 | } | ||
79 | |||
80 | static inline void __pmd_populate(pmd_t *pmdp, unsigned long pmdval) | ||
81 | { | ||
82 | set_pmd(pmdp, __pmd(pmdval)); | ||
83 | flush_pmd_entry(pmdp); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * Populate the pmdp entry with a pointer to the pte. This pmd is part | ||
88 | * of the mm address space. | ||
89 | */ | ||
90 | static inline void | ||
91 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) | ||
92 | { | ||
93 | unsigned long pte_ptr = (unsigned long)ptep; | ||
94 | |||
95 | /* | ||
96 | * The pmd must be loaded with the physical | ||
97 | * address of the PTE table | ||
98 | */ | ||
99 | __pmd_populate(pmdp, __pa(pte_ptr) | _PAGE_KERNEL_TABLE); | ||
100 | } | ||
101 | |||
102 | static inline void | ||
103 | pmd_populate(struct mm_struct *mm, pmd_t *pmdp, pgtable_t ptep) | ||
104 | { | ||
105 | __pmd_populate(pmdp, | ||
106 | page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE); | ||
107 | } | ||
108 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
109 | |||
110 | #endif | ||
diff --git a/arch/unicore32/include/asm/pgtable-hwdef.h b/arch/unicore32/include/asm/pgtable-hwdef.h new file mode 100644 index 00000000000..7314e859cca --- /dev/null +++ b/arch/unicore32/include/asm/pgtable-hwdef.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/pgtable-hwdef.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_PGTABLE_HWDEF_H__ | ||
13 | #define __UNICORE_PGTABLE_HWDEF_H__ | ||
14 | |||
15 | /* | ||
16 | * Hardware page table definitions. | ||
17 | * | ||
18 | * + Level 1 descriptor (PMD) | ||
19 | * - common | ||
20 | */ | ||
21 | #define PMD_TYPE_MASK (3 << 0) | ||
22 | #define PMD_TYPE_TABLE (0 << 0) | ||
23 | /*#define PMD_TYPE_LARGE (1 << 0) */ | ||
24 | #define PMD_TYPE_INVALID (2 << 0) | ||
25 | #define PMD_TYPE_SECT (3 << 0) | ||
26 | |||
27 | #define PMD_PRESENT (1 << 2) | ||
28 | #define PMD_YOUNG (1 << 3) | ||
29 | |||
30 | /*#define PMD_SECT_DIRTY (1 << 4) */ | ||
31 | #define PMD_SECT_CACHEABLE (1 << 5) | ||
32 | #define PMD_SECT_EXEC (1 << 6) | ||
33 | #define PMD_SECT_WRITE (1 << 7) | ||
34 | #define PMD_SECT_READ (1 << 8) | ||
35 | |||
36 | /* | ||
37 | * + Level 2 descriptor (PTE) | ||
38 | * - common | ||
39 | */ | ||
40 | #define PTE_TYPE_MASK (3 << 0) | ||
41 | #define PTE_TYPE_SMALL (0 << 0) | ||
42 | #define PTE_TYPE_MIDDLE (1 << 0) | ||
43 | #define PTE_TYPE_LARGE (2 << 0) | ||
44 | #define PTE_TYPE_INVALID (3 << 0) | ||
45 | |||
46 | #define PTE_PRESENT (1 << 2) | ||
47 | #define PTE_FILE (1 << 3) /* only when !PRESENT */ | ||
48 | #define PTE_YOUNG (1 << 3) | ||
49 | #define PTE_DIRTY (1 << 4) | ||
50 | #define PTE_CACHEABLE (1 << 5) | ||
51 | #define PTE_EXEC (1 << 6) | ||
52 | #define PTE_WRITE (1 << 7) | ||
53 | #define PTE_READ (1 << 8) | ||
54 | |||
55 | #endif | ||
diff --git a/arch/unicore32/include/asm/pgtable.h b/arch/unicore32/include/asm/pgtable.h new file mode 100644 index 00000000000..68b2f297ac9 --- /dev/null +++ b/arch/unicore32/include/asm/pgtable.h | |||
@@ -0,0 +1,317 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/pgtable.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_PGTABLE_H__ | ||
13 | #define __UNICORE_PGTABLE_H__ | ||
14 | |||
15 | #include <asm-generic/pgtable-nopmd.h> | ||
16 | #include <asm/cpu-single.h> | ||
17 | |||
18 | #include <asm/memory.h> | ||
19 | #include <asm/pgtable-hwdef.h> | ||
20 | |||
21 | /* | ||
22 | * Just any arbitrary offset to the start of the vmalloc VM area: the | ||
23 | * current 8MB value just means that there will be a 8MB "hole" after the | ||
24 | * physical memory until the kernel virtual memory starts. That means that | ||
25 | * any out-of-bounds memory accesses will hopefully be caught. | ||
26 | * The vmalloc() routines leaves a hole of 4kB between each vmalloced | ||
27 | * area for the same reason. ;) | ||
28 | * | ||
29 | * Note that platforms may override VMALLOC_START, but they must provide | ||
30 | * VMALLOC_END. VMALLOC_END defines the (exclusive) limit of this space, | ||
31 | * which may not overlap IO space. | ||
32 | */ | ||
33 | #ifndef VMALLOC_START | ||
34 | #define VMALLOC_OFFSET SZ_8M | ||
35 | #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) \ | ||
36 | & ~(VMALLOC_OFFSET-1)) | ||
37 | #define VMALLOC_END (0xff000000UL) | ||
38 | #endif | ||
39 | |||
40 | #define PTRS_PER_PTE 1024 | ||
41 | #define PTRS_PER_PGD 1024 | ||
42 | |||
43 | /* | ||
44 | * PGDIR_SHIFT determines what a third-level page table entry can map | ||
45 | */ | ||
46 | #define PGDIR_SHIFT 22 | ||
47 | |||
48 | #ifndef __ASSEMBLY__ | ||
49 | extern void __pte_error(const char *file, int line, unsigned long val); | ||
50 | extern void __pgd_error(const char *file, int line, unsigned long val); | ||
51 | |||
52 | #define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte_val(pte)) | ||
53 | #define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd_val(pgd)) | ||
54 | #endif /* !__ASSEMBLY__ */ | ||
55 | |||
56 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
57 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
58 | |||
59 | /* | ||
60 | * This is the lowest virtual address we can permit any user space | ||
61 | * mapping to be mapped at. This is particularly important for | ||
62 | * non-high vector CPUs. | ||
63 | */ | ||
64 | #define FIRST_USER_ADDRESS PAGE_SIZE | ||
65 | |||
66 | #define FIRST_USER_PGD_NR 1 | ||
67 | #define USER_PTRS_PER_PGD ((TASK_SIZE/PGDIR_SIZE) - FIRST_USER_PGD_NR) | ||
68 | |||
69 | /* | ||
70 | * section address mask and size definitions. | ||
71 | */ | ||
72 | #define SECTION_SHIFT 22 | ||
73 | #define SECTION_SIZE (1UL << SECTION_SHIFT) | ||
74 | #define SECTION_MASK (~(SECTION_SIZE-1)) | ||
75 | |||
76 | #ifndef __ASSEMBLY__ | ||
77 | |||
78 | /* | ||
79 | * The pgprot_* and protection_map entries will be fixed up in runtime | ||
80 | * to include the cachable bits based on memory policy, as well as any | ||
81 | * architecture dependent bits. | ||
82 | */ | ||
83 | #define _PTE_DEFAULT (PTE_PRESENT | PTE_YOUNG | PTE_CACHEABLE) | ||
84 | |||
85 | extern pgprot_t pgprot_user; | ||
86 | extern pgprot_t pgprot_kernel; | ||
87 | |||
88 | #define PAGE_NONE pgprot_user | ||
89 | #define PAGE_SHARED __pgprot(pgprot_val(pgprot_user | PTE_READ \ | ||
90 | | PTE_WRITE) | ||
91 | #define PAGE_SHARED_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ | ||
92 | | PTE_WRITE \ | ||
93 | | PTE_EXEC) | ||
94 | #define PAGE_COPY __pgprot(pgprot_val(pgprot_user | PTE_READ) | ||
95 | #define PAGE_COPY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ | ||
96 | | PTE_EXEC) | ||
97 | #define PAGE_READONLY __pgprot(pgprot_val(pgprot_user | PTE_READ) | ||
98 | #define PAGE_READONLY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ | ||
99 | | PTE_EXEC) | ||
100 | #define PAGE_KERNEL pgprot_kernel | ||
101 | #define PAGE_KERNEL_EXEC __pgprot(pgprot_val(pgprot_kernel | PTE_EXEC)) | ||
102 | |||
103 | #define __PAGE_NONE __pgprot(_PTE_DEFAULT) | ||
104 | #define __PAGE_SHARED __pgprot(_PTE_DEFAULT | PTE_READ \ | ||
105 | | PTE_WRITE) | ||
106 | #define __PAGE_SHARED_EXEC __pgprot(_PTE_DEFAULT | PTE_READ \ | ||
107 | | PTE_WRITE \ | ||
108 | | PTE_EXEC) | ||
109 | #define __PAGE_COPY __pgprot(_PTE_DEFAULT | PTE_READ) | ||
110 | #define __PAGE_COPY_EXEC __pgprot(_PTE_DEFAULT | PTE_READ \ | ||
111 | | PTE_EXEC) | ||
112 | #define __PAGE_READONLY __pgprot(_PTE_DEFAULT | PTE_READ) | ||
113 | #define __PAGE_READONLY_EXEC __pgprot(_PTE_DEFAULT | PTE_READ \ | ||
114 | | PTE_EXEC) | ||
115 | |||
116 | #endif /* __ASSEMBLY__ */ | ||
117 | |||
118 | /* | ||
119 | * The table below defines the page protection levels that we insert into our | ||
120 | * Linux page table version. These get translated into the best that the | ||
121 | * architecture can perform. Note that on UniCore hardware: | ||
122 | * 1) We cannot do execute protection | ||
123 | * 2) If we could do execute protection, then read is implied | ||
124 | * 3) write implies read permissions | ||
125 | */ | ||
126 | #define __P000 __PAGE_NONE | ||
127 | #define __P001 __PAGE_READONLY | ||
128 | #define __P010 __PAGE_COPY | ||
129 | #define __P011 __PAGE_COPY | ||
130 | #define __P100 __PAGE_READONLY_EXEC | ||
131 | #define __P101 __PAGE_READONLY_EXEC | ||
132 | #define __P110 __PAGE_COPY_EXEC | ||
133 | #define __P111 __PAGE_COPY_EXEC | ||
134 | |||
135 | #define __S000 __PAGE_NONE | ||
136 | #define __S001 __PAGE_READONLY | ||
137 | #define __S010 __PAGE_SHARED | ||
138 | #define __S011 __PAGE_SHARED | ||
139 | #define __S100 __PAGE_READONLY_EXEC | ||
140 | #define __S101 __PAGE_READONLY_EXEC | ||
141 | #define __S110 __PAGE_SHARED_EXEC | ||
142 | #define __S111 __PAGE_SHARED_EXEC | ||
143 | |||
144 | #ifndef __ASSEMBLY__ | ||
145 | /* | ||
146 | * ZERO_PAGE is a global shared page that is always zero: used | ||
147 | * for zero-mapped memory areas etc.. | ||
148 | */ | ||
149 | extern struct page *empty_zero_page; | ||
150 | #define ZERO_PAGE(vaddr) (empty_zero_page) | ||
151 | |||
152 | #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) | ||
153 | #define pfn_pte(pfn, prot) (__pte(((pfn) << PAGE_SHIFT) \ | ||
154 | | pgprot_val(prot))) | ||
155 | |||
156 | #define pte_none(pte) (!pte_val(pte)) | ||
157 | #define pte_clear(mm, addr, ptep) set_pte(ptep, __pte(0)) | ||
158 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) | ||
159 | #define pte_offset_kernel(dir, addr) (pmd_page_vaddr(*(dir)) \ | ||
160 | + __pte_index(addr)) | ||
161 | |||
162 | #define pte_offset_map(dir, addr) (pmd_page_vaddr(*(dir)) \ | ||
163 | + __pte_index(addr)) | ||
164 | #define pte_unmap(pte) do { } while (0) | ||
165 | |||
166 | #define set_pte(ptep, pte) cpu_set_pte(ptep, pte) | ||
167 | |||
168 | #define set_pte_at(mm, addr, ptep, pteval) \ | ||
169 | do { \ | ||
170 | set_pte(ptep, pteval); \ | ||
171 | } while (0) | ||
172 | |||
173 | /* | ||
174 | * The following only work if pte_present() is true. | ||
175 | * Undefined behaviour if not.. | ||
176 | */ | ||
177 | #define pte_present(pte) (pte_val(pte) & PTE_PRESENT) | ||
178 | #define pte_write(pte) (pte_val(pte) & PTE_WRITE) | ||
179 | #define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY) | ||
180 | #define pte_young(pte) (pte_val(pte) & PTE_YOUNG) | ||
181 | #define pte_exec(pte) (pte_val(pte) & PTE_EXEC) | ||
182 | #define pte_special(pte) (0) | ||
183 | |||
184 | #define PTE_BIT_FUNC(fn, op) \ | ||
185 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } | ||
186 | |||
187 | PTE_BIT_FUNC(wrprotect, &= ~PTE_WRITE); | ||
188 | PTE_BIT_FUNC(mkwrite, |= PTE_WRITE); | ||
189 | PTE_BIT_FUNC(mkclean, &= ~PTE_DIRTY); | ||
190 | PTE_BIT_FUNC(mkdirty, |= PTE_DIRTY); | ||
191 | PTE_BIT_FUNC(mkold, &= ~PTE_YOUNG); | ||
192 | PTE_BIT_FUNC(mkyoung, |= PTE_YOUNG); | ||
193 | |||
194 | static inline pte_t pte_mkspecial(pte_t pte) { return pte; } | ||
195 | |||
196 | /* | ||
197 | * Mark the prot value as uncacheable. | ||
198 | */ | ||
199 | #define pgprot_noncached(prot) \ | ||
200 | __pgprot(pgprot_val(prot) & ~PTE_CACHEABLE) | ||
201 | #define pgprot_writecombine(prot) \ | ||
202 | __pgprot(pgprot_val(prot) & ~PTE_CACHEABLE) | ||
203 | #define pgprot_dmacoherent(prot) \ | ||
204 | __pgprot(pgprot_val(prot) & ~PTE_CACHEABLE) | ||
205 | |||
206 | #define pmd_none(pmd) (!pmd_val(pmd)) | ||
207 | #define pmd_present(pmd) (pmd_val(pmd) & PMD_PRESENT) | ||
208 | #define pmd_bad(pmd) (((pmd_val(pmd) & \ | ||
209 | (PMD_PRESENT | PMD_TYPE_MASK)) \ | ||
210 | != (PMD_PRESENT | PMD_TYPE_TABLE))) | ||
211 | |||
212 | #define set_pmd(pmdpd, pmdval) \ | ||
213 | do { \ | ||
214 | *(pmdpd) = pmdval; \ | ||
215 | } while (0) | ||
216 | |||
217 | #define pmd_clear(pmdp) \ | ||
218 | do { \ | ||
219 | set_pmd(pmdp, __pmd(0));\ | ||
220 | clean_pmd_entry(pmdp); \ | ||
221 | } while (0) | ||
222 | |||
223 | #define pmd_page_vaddr(pmd) ((pte_t *)__va(pmd_val(pmd) & PAGE_MASK)) | ||
224 | #define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd))) | ||
225 | |||
226 | /* | ||
227 | * Conversion functions: convert a page and protection to a page entry, | ||
228 | * and a page entry and page directory to the page they refer to. | ||
229 | */ | ||
230 | #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) | ||
231 | |||
232 | /* to find an entry in a page-table-directory */ | ||
233 | #define pgd_index(addr) ((addr) >> PGDIR_SHIFT) | ||
234 | |||
235 | #define pgd_offset(mm, addr) ((mm)->pgd+pgd_index(addr)) | ||
236 | |||
237 | /* to find an entry in a kernel page-table-directory */ | ||
238 | #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) | ||
239 | |||
240 | /* Find an entry in the third-level page table.. */ | ||
241 | #define __pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
242 | |||
243 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
244 | { | ||
245 | const unsigned long mask = PTE_EXEC | PTE_WRITE | PTE_READ; | ||
246 | pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); | ||
247 | return pte; | ||
248 | } | ||
249 | |||
250 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | ||
251 | |||
252 | /* | ||
253 | * Encode and decode a swap entry. Swap entries are stored in the Linux | ||
254 | * page tables as follows: | ||
255 | * | ||
256 | * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 | ||
257 | * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 | ||
258 | * <--------------- offset --------------> <--- type --> 0 0 0 0 0 | ||
259 | * | ||
260 | * This gives us up to 127 swap files and 32GB per swap file. Note that | ||
261 | * the offset field is always non-zero. | ||
262 | */ | ||
263 | #define __SWP_TYPE_SHIFT 5 | ||
264 | #define __SWP_TYPE_BITS 7 | ||
265 | #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) | ||
266 | #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) | ||
267 | |||
268 | #define __swp_type(x) (((x).val >> __SWP_TYPE_SHIFT) \ | ||
269 | & __SWP_TYPE_MASK) | ||
270 | #define __swp_offset(x) ((x).val >> __SWP_OFFSET_SHIFT) | ||
271 | #define __swp_entry(type, offset) ((swp_entry_t) { \ | ||
272 | ((type) << __SWP_TYPE_SHIFT) | \ | ||
273 | ((offset) << __SWP_OFFSET_SHIFT) }) | ||
274 | |||
275 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
276 | #define __swp_entry_to_pte(swp) ((pte_t) { (swp).val }) | ||
277 | |||
278 | /* | ||
279 | * It is an error for the kernel to have more swap files than we can | ||
280 | * encode in the PTEs. This ensures that we know when MAX_SWAPFILES | ||
281 | * is increased beyond what we presently support. | ||
282 | */ | ||
283 | #define MAX_SWAPFILES_CHECK() \ | ||
284 | BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS) | ||
285 | |||
286 | /* | ||
287 | * Encode and decode a file entry. File entries are stored in the Linux | ||
288 | * page tables as follows: | ||
289 | * | ||
290 | * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 | ||
291 | * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 | ||
292 | * <----------------------- offset ----------------------> 1 0 0 0 | ||
293 | */ | ||
294 | #define pte_file(pte) (pte_val(pte) & PTE_FILE) | ||
295 | #define pte_to_pgoff(x) (pte_val(x) >> 4) | ||
296 | #define pgoff_to_pte(x) __pte(((x) << 4) | PTE_FILE) | ||
297 | |||
298 | #define PTE_FILE_MAX_BITS 28 | ||
299 | |||
300 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ | ||
301 | /* FIXME: this is not correct */ | ||
302 | #define kern_addr_valid(addr) (1) | ||
303 | |||
304 | #include <asm-generic/pgtable.h> | ||
305 | |||
306 | /* | ||
307 | * remap a physical page `pfn' of size `size' with page protection `prot' | ||
308 | * into virtual address `from' | ||
309 | */ | ||
310 | #define io_remap_pfn_range(vma, from, pfn, size, prot) \ | ||
311 | remap_pfn_range(vma, from, pfn, size, prot) | ||
312 | |||
313 | #define pgtable_cache_init() do { } while (0) | ||
314 | |||
315 | #endif /* !__ASSEMBLY__ */ | ||
316 | |||
317 | #endif /* __UNICORE_PGTABLE_H__ */ | ||
diff --git a/arch/unicore32/include/asm/processor.h b/arch/unicore32/include/asm/processor.h new file mode 100644 index 00000000000..e11cb078657 --- /dev/null +++ b/arch/unicore32/include/asm/processor.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/processor.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_PROCESSOR_H__ | ||
14 | #define __UNICORE_PROCESSOR_H__ | ||
15 | |||
16 | /* | ||
17 | * Default implementation of macro that returns current | ||
18 | * instruction pointer ("program counter"). | ||
19 | */ | ||
20 | #define current_text_addr() ({ __label__ _l; _l: &&_l; }) | ||
21 | |||
22 | #ifdef __KERNEL__ | ||
23 | |||
24 | #include <asm/ptrace.h> | ||
25 | #include <asm/types.h> | ||
26 | |||
27 | #ifdef __KERNEL__ | ||
28 | #define STACK_TOP TASK_SIZE | ||
29 | #define STACK_TOP_MAX TASK_SIZE | ||
30 | #endif | ||
31 | |||
32 | struct debug_entry { | ||
33 | u32 address; | ||
34 | u32 insn; | ||
35 | }; | ||
36 | |||
37 | struct debug_info { | ||
38 | int nsaved; | ||
39 | struct debug_entry bp[2]; | ||
40 | }; | ||
41 | |||
42 | struct thread_struct { | ||
43 | /* fault info */ | ||
44 | unsigned long address; | ||
45 | unsigned long trap_no; | ||
46 | unsigned long error_code; | ||
47 | /* debugging */ | ||
48 | struct debug_info debug; | ||
49 | }; | ||
50 | |||
51 | #define INIT_THREAD { } | ||
52 | |||
53 | #define start_thread(regs, pc, sp) \ | ||
54 | ({ \ | ||
55 | unsigned long *stack = (unsigned long *)sp; \ | ||
56 | set_fs(USER_DS); \ | ||
57 | memset(regs->uregs, 0, sizeof(regs->uregs)); \ | ||
58 | regs->UCreg_asr = USER_MODE; \ | ||
59 | regs->UCreg_pc = pc & ~1; /* pc */ \ | ||
60 | regs->UCreg_sp = sp; /* sp */ \ | ||
61 | regs->UCreg_02 = stack[2]; /* r2 (envp) */ \ | ||
62 | regs->UCreg_01 = stack[1]; /* r1 (argv) */ \ | ||
63 | regs->UCreg_00 = stack[0]; /* r0 (argc) */ \ | ||
64 | }) | ||
65 | |||
66 | /* Forward declaration, a strange C thing */ | ||
67 | struct task_struct; | ||
68 | |||
69 | /* Free all resources held by a thread. */ | ||
70 | extern void release_thread(struct task_struct *); | ||
71 | |||
72 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
73 | #define prepare_to_copy(tsk) do { } while (0) | ||
74 | |||
75 | unsigned long get_wchan(struct task_struct *p); | ||
76 | |||
77 | #define cpu_relax() barrier() | ||
78 | |||
79 | /* | ||
80 | * Create a new kernel thread | ||
81 | */ | ||
82 | extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | ||
83 | |||
84 | #define task_pt_regs(p) \ | ||
85 | ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) | ||
86 | |||
87 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->UCreg_pc) | ||
88 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->UCreg_sp) | ||
89 | |||
90 | #endif | ||
91 | |||
92 | #endif /* __UNICORE_PROCESSOR_H__ */ | ||
diff --git a/arch/unicore32/include/asm/ptrace.h b/arch/unicore32/include/asm/ptrace.h new file mode 100644 index 00000000000..b9caf9b0997 --- /dev/null +++ b/arch/unicore32/include/asm/ptrace.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/ptrace.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_PTRACE_H__ | ||
13 | #define __UNICORE_PTRACE_H__ | ||
14 | |||
15 | #define PTRACE_GET_THREAD_AREA 22 | ||
16 | |||
17 | /* | ||
18 | * PSR bits | ||
19 | */ | ||
20 | #define USER_MODE 0x00000010 | ||
21 | #define REAL_MODE 0x00000011 | ||
22 | #define INTR_MODE 0x00000012 | ||
23 | #define PRIV_MODE 0x00000013 | ||
24 | #define ABRT_MODE 0x00000017 | ||
25 | #define EXTN_MODE 0x0000001b | ||
26 | #define SUSR_MODE 0x0000001f | ||
27 | #define MODE_MASK 0x0000001f | ||
28 | #define PSR_R_BIT 0x00000040 | ||
29 | #define PSR_I_BIT 0x00000080 | ||
30 | #define PSR_V_BIT 0x10000000 | ||
31 | #define PSR_C_BIT 0x20000000 | ||
32 | #define PSR_Z_BIT 0x40000000 | ||
33 | #define PSR_S_BIT 0x80000000 | ||
34 | |||
35 | /* | ||
36 | * Groups of PSR bits | ||
37 | */ | ||
38 | #define PSR_f 0xff000000 /* Flags */ | ||
39 | #define PSR_c 0x000000ff /* Control */ | ||
40 | |||
41 | #ifndef __ASSEMBLY__ | ||
42 | |||
43 | /* | ||
44 | * This struct defines the way the registers are stored on the | ||
45 | * stack during a system call. Note that sizeof(struct pt_regs) | ||
46 | * has to be a multiple of 8. | ||
47 | */ | ||
48 | struct pt_regs { | ||
49 | unsigned long uregs[34]; | ||
50 | }; | ||
51 | |||
52 | #define UCreg_asr uregs[32] | ||
53 | #define UCreg_pc uregs[31] | ||
54 | #define UCreg_lr uregs[30] | ||
55 | #define UCreg_sp uregs[29] | ||
56 | #define UCreg_ip uregs[28] | ||
57 | #define UCreg_fp uregs[27] | ||
58 | #define UCreg_26 uregs[26] | ||
59 | #define UCreg_25 uregs[25] | ||
60 | #define UCreg_24 uregs[24] | ||
61 | #define UCreg_23 uregs[23] | ||
62 | #define UCreg_22 uregs[22] | ||
63 | #define UCreg_21 uregs[21] | ||
64 | #define UCreg_20 uregs[20] | ||
65 | #define UCreg_19 uregs[19] | ||
66 | #define UCreg_18 uregs[18] | ||
67 | #define UCreg_17 uregs[17] | ||
68 | #define UCreg_16 uregs[16] | ||
69 | #define UCreg_15 uregs[15] | ||
70 | #define UCreg_14 uregs[14] | ||
71 | #define UCreg_13 uregs[13] | ||
72 | #define UCreg_12 uregs[12] | ||
73 | #define UCreg_11 uregs[11] | ||
74 | #define UCreg_10 uregs[10] | ||
75 | #define UCreg_09 uregs[9] | ||
76 | #define UCreg_08 uregs[8] | ||
77 | #define UCreg_07 uregs[7] | ||
78 | #define UCreg_06 uregs[6] | ||
79 | #define UCreg_05 uregs[5] | ||
80 | #define UCreg_04 uregs[4] | ||
81 | #define UCreg_03 uregs[3] | ||
82 | #define UCreg_02 uregs[2] | ||
83 | #define UCreg_01 uregs[1] | ||
84 | #define UCreg_00 uregs[0] | ||
85 | #define UCreg_ORIG_00 uregs[33] | ||
86 | |||
87 | #ifdef __KERNEL__ | ||
88 | |||
89 | #define user_mode(regs) \ | ||
90 | (processor_mode(regs) == USER_MODE) | ||
91 | |||
92 | #define processor_mode(regs) \ | ||
93 | ((regs)->UCreg_asr & MODE_MASK) | ||
94 | |||
95 | #define interrupts_enabled(regs) \ | ||
96 | (!((regs)->UCreg_asr & PSR_I_BIT)) | ||
97 | |||
98 | #define fast_interrupts_enabled(regs) \ | ||
99 | (!((regs)->UCreg_asr & PSR_R_BIT)) | ||
100 | |||
101 | /* Are the current registers suitable for user mode? | ||
102 | * (used to maintain security in signal handlers) | ||
103 | */ | ||
104 | static inline int valid_user_regs(struct pt_regs *regs) | ||
105 | { | ||
106 | unsigned long mode = regs->UCreg_asr & MODE_MASK; | ||
107 | |||
108 | /* | ||
109 | * Always clear the R (REAL) bits | ||
110 | */ | ||
111 | regs->UCreg_asr &= ~(PSR_R_BIT); | ||
112 | |||
113 | if ((regs->UCreg_asr & PSR_I_BIT) == 0) { | ||
114 | if (mode == USER_MODE) | ||
115 | return 1; | ||
116 | } | ||
117 | |||
118 | /* | ||
119 | * Force ASR to something logical... | ||
120 | */ | ||
121 | regs->UCreg_asr &= PSR_f | USER_MODE; | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | #define instruction_pointer(regs) ((regs)->UCreg_pc) | ||
127 | |||
128 | #endif /* __KERNEL__ */ | ||
129 | |||
130 | #endif /* __ASSEMBLY__ */ | ||
131 | |||
132 | #endif | ||
133 | |||
diff --git a/arch/unicore32/include/asm/sigcontext.h b/arch/unicore32/include/asm/sigcontext.h new file mode 100644 index 00000000000..6a2d7671c05 --- /dev/null +++ b/arch/unicore32/include/asm/sigcontext.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/sigcontext.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_SIGCONTEXT_H__ | ||
13 | #define __UNICORE_SIGCONTEXT_H__ | ||
14 | |||
15 | #include <asm/ptrace.h> | ||
16 | /* | ||
17 | * Signal context structure - contains all info to do with the state | ||
18 | * before the signal handler was invoked. Note: only add new entries | ||
19 | * to the end of the structure. | ||
20 | */ | ||
21 | struct sigcontext { | ||
22 | unsigned long trap_no; | ||
23 | unsigned long error_code; | ||
24 | unsigned long oldmask; | ||
25 | unsigned long fault_address; | ||
26 | struct pt_regs regs; | ||
27 | }; | ||
28 | |||
29 | #endif | ||
diff --git a/arch/unicore32/include/asm/stacktrace.h b/arch/unicore32/include/asm/stacktrace.h new file mode 100644 index 00000000000..76edc65a587 --- /dev/null +++ b/arch/unicore32/include/asm/stacktrace.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/stacktrace.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_STACKTRACE_H__ | ||
14 | #define __UNICORE_STACKTRACE_H__ | ||
15 | |||
16 | struct stackframe { | ||
17 | unsigned long fp; | ||
18 | unsigned long sp; | ||
19 | unsigned long lr; | ||
20 | unsigned long pc; | ||
21 | }; | ||
22 | |||
23 | #ifdef CONFIG_FRAME_POINTER | ||
24 | extern int unwind_frame(struct stackframe *frame); | ||
25 | #else | ||
26 | #define unwind_frame(f) (-EINVAL) | ||
27 | #endif | ||
28 | extern void walk_stackframe(struct stackframe *frame, | ||
29 | int (*fn)(struct stackframe *, void *), void *data); | ||
30 | |||
31 | #endif /* __UNICORE_STACKTRACE_H__ */ | ||
diff --git a/arch/unicore32/include/asm/string.h b/arch/unicore32/include/asm/string.h new file mode 100644 index 00000000000..55264c84369 --- /dev/null +++ b/arch/unicore32/include/asm/string.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/string.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_STRING_H__ | ||
13 | #define __UNICORE_STRING_H__ | ||
14 | |||
15 | /* | ||
16 | * We don't do inline string functions, since the | ||
17 | * optimised inline asm versions are not small. | ||
18 | */ | ||
19 | |||
20 | #define __HAVE_ARCH_STRRCHR | ||
21 | extern char *strrchr(const char *s, int c); | ||
22 | |||
23 | #define __HAVE_ARCH_STRCHR | ||
24 | extern char *strchr(const char *s, int c); | ||
25 | |||
26 | #define __HAVE_ARCH_MEMCPY | ||
27 | extern void *memcpy(void *, const void *, __kernel_size_t); | ||
28 | |||
29 | #define __HAVE_ARCH_MEMMOVE | ||
30 | extern void *memmove(void *, const void *, __kernel_size_t); | ||
31 | |||
32 | #define __HAVE_ARCH_MEMCHR | ||
33 | extern void *memchr(const void *, int, __kernel_size_t); | ||
34 | |||
35 | #define __HAVE_ARCH_MEMSET | ||
36 | extern void *memset(void *, int, __kernel_size_t); | ||
37 | |||
38 | #endif | ||
diff --git a/arch/unicore32/include/asm/suspend.h b/arch/unicore32/include/asm/suspend.h new file mode 100644 index 00000000000..88a9c0f32b2 --- /dev/null +++ b/arch/unicore32/include/asm/suspend.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/suspend.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_SUSPEND_H__ | ||
14 | #define __UNICORE_SUSPEND_H__ | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | static inline int arch_prepare_suspend(void) { return 0; } | ||
18 | |||
19 | #include <asm/ptrace.h> | ||
20 | |||
21 | struct swsusp_arch_regs { | ||
22 | struct cpu_context_save cpu_context; /* cpu context */ | ||
23 | #ifdef CONFIG_UNICORE_FPU_F64 | ||
24 | struct fp_state fpstate __attribute__((aligned(8))); | ||
25 | #endif | ||
26 | }; | ||
27 | #endif | ||
28 | |||
29 | #endif /* __UNICORE_SUSPEND_H__ */ | ||
30 | |||
diff --git a/arch/unicore32/include/asm/system.h b/arch/unicore32/include/asm/system.h new file mode 100644 index 00000000000..246b71c17fd --- /dev/null +++ b/arch/unicore32/include/asm/system.h | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/system.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_SYSTEM_H__ | ||
13 | #define __UNICORE_SYSTEM_H__ | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | /* | ||
18 | * CR1 bits (CP#0 CR1) | ||
19 | */ | ||
20 | #define CR_M (1 << 0) /* MMU enable */ | ||
21 | #define CR_A (1 << 1) /* Alignment abort enable */ | ||
22 | #define CR_D (1 << 2) /* Dcache enable */ | ||
23 | #define CR_I (1 << 3) /* Icache enable */ | ||
24 | #define CR_B (1 << 4) /* Dcache write mechanism: write back */ | ||
25 | #define CR_T (1 << 5) /* Burst enable */ | ||
26 | #define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */ | ||
27 | |||
28 | #ifndef __ASSEMBLY__ | ||
29 | |||
30 | #include <linux/linkage.h> | ||
31 | #include <linux/irqflags.h> | ||
32 | |||
33 | struct thread_info; | ||
34 | struct task_struct; | ||
35 | |||
36 | struct pt_regs; | ||
37 | |||
38 | void die(const char *msg, struct pt_regs *regs, int err); | ||
39 | |||
40 | struct siginfo; | ||
41 | void uc32_notify_die(const char *str, struct pt_regs *regs, | ||
42 | struct siginfo *info, unsigned long err, unsigned long trap); | ||
43 | |||
44 | void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, | ||
45 | struct pt_regs *), | ||
46 | int sig, int code, const char *name); | ||
47 | |||
48 | #define xchg(ptr, x) \ | ||
49 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
50 | |||
51 | extern asmlinkage void __backtrace(void); | ||
52 | extern asmlinkage void c_backtrace(unsigned long fp, int pmode); | ||
53 | |||
54 | struct mm_struct; | ||
55 | extern void show_pte(struct mm_struct *mm, unsigned long addr); | ||
56 | extern void __show_regs(struct pt_regs *); | ||
57 | |||
58 | extern int cpu_architecture(void); | ||
59 | extern void cpu_init(void); | ||
60 | |||
61 | #define vectors_high() (cr_alignment & CR_V) | ||
62 | |||
63 | #define isb() __asm__ __volatile__ ("" : : : "memory") | ||
64 | #define dsb() __asm__ __volatile__ ("" : : : "memory") | ||
65 | #define dmb() __asm__ __volatile__ ("" : : : "memory") | ||
66 | |||
67 | #define mb() barrier() | ||
68 | #define rmb() barrier() | ||
69 | #define wmb() barrier() | ||
70 | #define smp_mb() barrier() | ||
71 | #define smp_rmb() barrier() | ||
72 | #define smp_wmb() barrier() | ||
73 | #define read_barrier_depends() do { } while (0) | ||
74 | #define smp_read_barrier_depends() do { } while (0) | ||
75 | |||
76 | #define set_mb(var, value) do { var = value; smp_mb(); } while (0) | ||
77 | #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); | ||
78 | |||
79 | extern unsigned long cr_no_alignment; /* defined in entry-unicore.S */ | ||
80 | extern unsigned long cr_alignment; /* defined in entry-unicore.S */ | ||
81 | |||
82 | static inline unsigned int get_cr(void) | ||
83 | { | ||
84 | unsigned int val; | ||
85 | asm("movc %0, p0.c1, #0" : "=r" (val) : : "cc"); | ||
86 | return val; | ||
87 | } | ||
88 | |||
89 | static inline void set_cr(unsigned int val) | ||
90 | { | ||
91 | asm volatile("movc p0.c1, %0, #0 @set CR" | ||
92 | : : "r" (val) : "cc"); | ||
93 | isb(); | ||
94 | } | ||
95 | |||
96 | extern void adjust_cr(unsigned long mask, unsigned long set); | ||
97 | |||
98 | /* | ||
99 | * switch_to(prev, next) should switch from task `prev' to `next' | ||
100 | * `prev' will never be the same as `next'. schedule() itself | ||
101 | * contains the memory barrier to tell GCC not to cache `current'. | ||
102 | */ | ||
103 | extern struct task_struct *__switch_to(struct task_struct *, | ||
104 | struct thread_info *, struct thread_info *); | ||
105 | extern void panic(const char *fmt, ...); | ||
106 | |||
107 | #define switch_to(prev, next, last) \ | ||
108 | do { \ | ||
109 | last = __switch_to(prev, \ | ||
110 | task_thread_info(prev), task_thread_info(next)); \ | ||
111 | } while (0) | ||
112 | |||
113 | static inline unsigned long | ||
114 | __xchg(unsigned long x, volatile void *ptr, int size) | ||
115 | { | ||
116 | unsigned long ret; | ||
117 | |||
118 | switch (size) { | ||
119 | case 1: | ||
120 | asm volatile("@ __xchg1\n" | ||
121 | " swapb %0, %1, [%2]" | ||
122 | : "=&r" (ret) | ||
123 | : "r" (x), "r" (ptr) | ||
124 | : "memory", "cc"); | ||
125 | break; | ||
126 | case 4: | ||
127 | asm volatile("@ __xchg4\n" | ||
128 | " swapw %0, %1, [%2]" | ||
129 | : "=&r" (ret) | ||
130 | : "r" (x), "r" (ptr) | ||
131 | : "memory", "cc"); | ||
132 | break; | ||
133 | default: | ||
134 | panic("xchg: bad data size: ptr 0x%p, size %d\n", | ||
135 | ptr, size); | ||
136 | } | ||
137 | |||
138 | return ret; | ||
139 | } | ||
140 | |||
141 | #include <asm-generic/cmpxchg-local.h> | ||
142 | |||
143 | /* | ||
144 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
145 | * them available. | ||
146 | */ | ||
147 | #define cmpxchg_local(ptr, o, n) \ | ||
148 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), \ | ||
149 | (unsigned long)(o), (unsigned long)(n), sizeof(*(ptr)))) | ||
150 | #define cmpxchg64_local(ptr, o, n) \ | ||
151 | __cmpxchg64_local_generic((ptr), (o), (n)) | ||
152 | |||
153 | #include <asm-generic/cmpxchg.h> | ||
154 | |||
155 | #endif /* __ASSEMBLY__ */ | ||
156 | |||
157 | #define arch_align_stack(x) (x) | ||
158 | |||
159 | #endif /* __KERNEL__ */ | ||
160 | |||
161 | #endif | ||
diff --git a/arch/unicore32/include/asm/thread_info.h b/arch/unicore32/include/asm/thread_info.h new file mode 100644 index 00000000000..c270e9e0486 --- /dev/null +++ b/arch/unicore32/include/asm/thread_info.h | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/thread_info.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_THREAD_INFO_H__ | ||
13 | #define __UNICORE_THREAD_INFO_H__ | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/compiler.h> | ||
18 | #include <asm/fpstate.h> | ||
19 | |||
20 | #define THREAD_SIZE_ORDER 1 | ||
21 | #define THREAD_SIZE 8192 | ||
22 | #define THREAD_START_SP (THREAD_SIZE - 8) | ||
23 | |||
24 | #ifndef __ASSEMBLY__ | ||
25 | |||
26 | struct task_struct; | ||
27 | struct exec_domain; | ||
28 | |||
29 | #include <asm/types.h> | ||
30 | |||
31 | typedef struct { | ||
32 | unsigned long seg; | ||
33 | } mm_segment_t; | ||
34 | |||
35 | struct cpu_context_save { | ||
36 | __u32 r4; | ||
37 | __u32 r5; | ||
38 | __u32 r6; | ||
39 | __u32 r7; | ||
40 | __u32 r8; | ||
41 | __u32 r9; | ||
42 | __u32 r10; | ||
43 | __u32 r11; | ||
44 | __u32 r12; | ||
45 | __u32 r13; | ||
46 | __u32 r14; | ||
47 | __u32 r15; | ||
48 | __u32 r16; | ||
49 | __u32 r17; | ||
50 | __u32 r18; | ||
51 | __u32 r19; | ||
52 | __u32 r20; | ||
53 | __u32 r21; | ||
54 | __u32 r22; | ||
55 | __u32 r23; | ||
56 | __u32 r24; | ||
57 | __u32 r25; | ||
58 | __u32 r26; | ||
59 | __u32 fp; | ||
60 | __u32 sp; | ||
61 | __u32 pc; | ||
62 | }; | ||
63 | |||
64 | /* | ||
65 | * low level task data that entry.S needs immediate access to. | ||
66 | * __switch_to() assumes cpu_context follows immediately after cpu_domain. | ||
67 | */ | ||
68 | struct thread_info { | ||
69 | unsigned long flags; /* low level flags */ | ||
70 | int preempt_count; /* 0 => preemptable */ | ||
71 | /* <0 => bug */ | ||
72 | mm_segment_t addr_limit; /* address limit */ | ||
73 | struct task_struct *task; /* main task structure */ | ||
74 | struct exec_domain *exec_domain; /* execution domain */ | ||
75 | __u32 cpu; /* cpu */ | ||
76 | struct cpu_context_save cpu_context; /* cpu context */ | ||
77 | __u32 syscall; /* syscall number */ | ||
78 | __u8 used_cp[16]; /* thread used copro */ | ||
79 | #ifdef CONFIG_UNICORE_FPU_F64 | ||
80 | struct fp_state fpstate __attribute__((aligned(8))); | ||
81 | #endif | ||
82 | struct restart_block restart_block; | ||
83 | }; | ||
84 | |||
85 | #define INIT_THREAD_INFO(tsk) \ | ||
86 | { \ | ||
87 | .task = &tsk, \ | ||
88 | .exec_domain = &default_exec_domain, \ | ||
89 | .flags = 0, \ | ||
90 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
91 | .addr_limit = KERNEL_DS, \ | ||
92 | .restart_block = { \ | ||
93 | .fn = do_no_restart_syscall, \ | ||
94 | }, \ | ||
95 | } | ||
96 | |||
97 | #define init_thread_info (init_thread_union.thread_info) | ||
98 | #define init_stack (init_thread_union.stack) | ||
99 | |||
100 | /* | ||
101 | * how to get the thread information struct from C | ||
102 | */ | ||
103 | static inline struct thread_info *current_thread_info(void) __attribute_const__; | ||
104 | |||
105 | static inline struct thread_info *current_thread_info(void) | ||
106 | { | ||
107 | register unsigned long sp asm ("sp"); | ||
108 | return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); | ||
109 | } | ||
110 | |||
111 | #define thread_saved_pc(tsk) \ | ||
112 | ((unsigned long)(task_thread_info(tsk)->cpu_context.pc)) | ||
113 | #define thread_saved_sp(tsk) \ | ||
114 | ((unsigned long)(task_thread_info(tsk)->cpu_context.sp)) | ||
115 | #define thread_saved_fp(tsk) \ | ||
116 | ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) | ||
117 | |||
118 | #endif | ||
119 | |||
120 | /* | ||
121 | * We use bit 30 of the preempt_count to indicate that kernel | ||
122 | * preemption is occurring. See <asm/hardirq.h>. | ||
123 | */ | ||
124 | #define PREEMPT_ACTIVE 0x40000000 | ||
125 | |||
126 | /* | ||
127 | * thread information flags: | ||
128 | * TIF_SYSCALL_TRACE - syscall trace active | ||
129 | * TIF_SIGPENDING - signal pending | ||
130 | * TIF_NEED_RESCHED - rescheduling necessary | ||
131 | * TIF_NOTIFY_RESUME - callback before returning to user | ||
132 | */ | ||
133 | #define TIF_SIGPENDING 0 | ||
134 | #define TIF_NEED_RESCHED 1 | ||
135 | #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ | ||
136 | #define TIF_SYSCALL_TRACE 8 | ||
137 | #define TIF_MEMDIE 18 | ||
138 | #define TIF_FREEZE 19 | ||
139 | #define TIF_RESTORE_SIGMASK 20 | ||
140 | |||
141 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | ||
142 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | ||
143 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | ||
144 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | ||
145 | #define _TIF_FREEZE (1 << TIF_FREEZE) | ||
146 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
147 | |||
148 | /* | ||
149 | * Change these and you break ASM code in entry-common.S | ||
150 | */ | ||
151 | #define _TIF_WORK_MASK 0x000000ff | ||
152 | |||
153 | #endif /* __KERNEL__ */ | ||
154 | #endif /* __UNICORE_THREAD_INFO_H__ */ | ||
diff --git a/arch/unicore32/include/asm/timex.h b/arch/unicore32/include/asm/timex.h new file mode 100644 index 00000000000..faf16ba4654 --- /dev/null +++ b/arch/unicore32/include/asm/timex.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/timex.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __UNICORE_TIMEX_H__ | ||
14 | #define __UNICORE_TIMEX_H__ | ||
15 | |||
16 | #ifdef CONFIG_ARCH_FPGA | ||
17 | |||
18 | /* in FPGA, APB clock is 33M, and OST clock is 32K, */ | ||
19 | /* so, 1M is selected for timer interrupt correctly */ | ||
20 | #define CLOCK_TICK_RATE (32*1024) | ||
21 | |||
22 | #endif | ||
23 | |||
24 | #if defined(CONFIG_PUV3_DB0913) \ | ||
25 | || defined(CONFIG_PUV3_NB0916) \ | ||
26 | || defined(CONFIG_PUV3_SMW0919) | ||
27 | |||
28 | #define CLOCK_TICK_RATE (14318000) | ||
29 | |||
30 | #endif | ||
31 | |||
32 | #include <asm-generic/timex.h> | ||
33 | |||
34 | #endif | ||
diff --git a/arch/unicore32/include/asm/tlb.h b/arch/unicore32/include/asm/tlb.h new file mode 100644 index 00000000000..9cca15cdae9 --- /dev/null +++ b/arch/unicore32/include/asm/tlb.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/tlb.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_TLB_H__ | ||
13 | #define __UNICORE_TLB_H__ | ||
14 | |||
15 | #define tlb_start_vma(tlb, vma) do { } while (0) | ||
16 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
17 | #define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) | ||
18 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
19 | |||
20 | #define __pte_free_tlb(tlb, pte, addr) \ | ||
21 | do { \ | ||
22 | pgtable_page_dtor(pte); \ | ||
23 | tlb_remove_page((tlb), (pte)); \ | ||
24 | } while (0) | ||
25 | |||
26 | #include <asm-generic/tlb.h> | ||
27 | |||
28 | #endif | ||
diff --git a/arch/unicore32/include/asm/tlbflush.h b/arch/unicore32/include/asm/tlbflush.h new file mode 100644 index 00000000000..e446ac8bb9e --- /dev/null +++ b/arch/unicore32/include/asm/tlbflush.h | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/tlbflush.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_TLBFLUSH_H__ | ||
13 | #define __UNICORE_TLBFLUSH_H__ | ||
14 | |||
15 | #ifndef __ASSEMBLY__ | ||
16 | |||
17 | #include <linux/sched.h> | ||
18 | |||
19 | extern void __cpu_flush_user_tlb_range(unsigned long, unsigned long, | ||
20 | struct vm_area_struct *); | ||
21 | extern void __cpu_flush_kern_tlb_range(unsigned long, unsigned long); | ||
22 | |||
23 | /* | ||
24 | * TLB Management | ||
25 | * ============== | ||
26 | * | ||
27 | * The arch/unicore/mm/tlb-*.S files implement these methods. | ||
28 | * | ||
29 | * The TLB specific code is expected to perform whatever tests it | ||
30 | * needs to determine if it should invalidate the TLB for each | ||
31 | * call. Start addresses are inclusive and end addresses are | ||
32 | * exclusive; it is safe to round these addresses down. | ||
33 | * | ||
34 | * flush_tlb_all() | ||
35 | * | ||
36 | * Invalidate the entire TLB. | ||
37 | * | ||
38 | * flush_tlb_mm(mm) | ||
39 | * | ||
40 | * Invalidate all TLB entries in a particular address | ||
41 | * space. | ||
42 | * - mm - mm_struct describing address space | ||
43 | * | ||
44 | * flush_tlb_range(mm,start,end) | ||
45 | * | ||
46 | * Invalidate a range of TLB entries in the specified | ||
47 | * address space. | ||
48 | * - mm - mm_struct describing address space | ||
49 | * - start - start address (may not be aligned) | ||
50 | * - end - end address (exclusive, may not be aligned) | ||
51 | * | ||
52 | * flush_tlb_page(vaddr,vma) | ||
53 | * | ||
54 | * Invalidate the specified page in the specified address range. | ||
55 | * - vaddr - virtual address (may not be aligned) | ||
56 | * - vma - vma_struct describing address range | ||
57 | * | ||
58 | * flush_kern_tlb_page(kaddr) | ||
59 | * | ||
60 | * Invalidate the TLB entry for the specified page. The address | ||
61 | * will be in the kernels virtual memory space. Current uses | ||
62 | * only require the D-TLB to be invalidated. | ||
63 | * - kaddr - Kernel virtual memory address | ||
64 | */ | ||
65 | |||
66 | static inline void local_flush_tlb_all(void) | ||
67 | { | ||
68 | const int zero = 0; | ||
69 | |||
70 | /* TLB invalidate all */ | ||
71 | asm("movc p0.c6, %0, #6; nop; nop; nop; nop; nop; nop; nop; nop" | ||
72 | : : "r" (zero) : "cc"); | ||
73 | } | ||
74 | |||
75 | static inline void local_flush_tlb_mm(struct mm_struct *mm) | ||
76 | { | ||
77 | const int zero = 0; | ||
78 | |||
79 | if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) { | ||
80 | /* TLB invalidate all */ | ||
81 | asm("movc p0.c6, %0, #6; nop; nop; nop; nop; nop; nop; nop; nop" | ||
82 | : : "r" (zero) : "cc"); | ||
83 | } | ||
84 | put_cpu(); | ||
85 | } | ||
86 | |||
87 | static inline void | ||
88 | local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | ||
89 | { | ||
90 | if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) { | ||
91 | #ifndef CONFIG_CPU_TLB_SINGLE_ENTRY_DISABLE | ||
92 | /* iTLB invalidate page */ | ||
93 | asm("movc p0.c6, %0, #5; nop; nop; nop; nop; nop; nop; nop; nop" | ||
94 | : : "r" (uaddr & PAGE_MASK) : "cc"); | ||
95 | /* dTLB invalidate page */ | ||
96 | asm("movc p0.c6, %0, #3; nop; nop; nop; nop; nop; nop; nop; nop" | ||
97 | : : "r" (uaddr & PAGE_MASK) : "cc"); | ||
98 | #else | ||
99 | /* TLB invalidate all */ | ||
100 | asm("movc p0.c6, %0, #6; nop; nop; nop; nop; nop; nop; nop; nop" | ||
101 | : : "r" (uaddr & PAGE_MASK) : "cc"); | ||
102 | #endif | ||
103 | } | ||
104 | } | ||
105 | |||
106 | static inline void local_flush_tlb_kernel_page(unsigned long kaddr) | ||
107 | { | ||
108 | #ifndef CONFIG_CPU_TLB_SINGLE_ENTRY_DISABLE | ||
109 | /* iTLB invalidate page */ | ||
110 | asm("movc p0.c6, %0, #5; nop; nop; nop; nop; nop; nop; nop; nop" | ||
111 | : : "r" (kaddr & PAGE_MASK) : "cc"); | ||
112 | /* dTLB invalidate page */ | ||
113 | asm("movc p0.c6, %0, #3; nop; nop; nop; nop; nop; nop; nop; nop" | ||
114 | : : "r" (kaddr & PAGE_MASK) : "cc"); | ||
115 | #else | ||
116 | /* TLB invalidate all */ | ||
117 | asm("movc p0.c6, %0, #6; nop; nop; nop; nop; nop; nop; nop; nop" | ||
118 | : : "r" (kaddr & PAGE_MASK) : "cc"); | ||
119 | #endif | ||
120 | } | ||
121 | |||
122 | /* | ||
123 | * flush_pmd_entry | ||
124 | * | ||
125 | * Flush a PMD entry (word aligned, or double-word aligned) to | ||
126 | * RAM if the TLB for the CPU we are running on requires this. | ||
127 | * This is typically used when we are creating PMD entries. | ||
128 | * | ||
129 | * clean_pmd_entry | ||
130 | * | ||
131 | * Clean (but don't drain the write buffer) if the CPU requires | ||
132 | * these operations. This is typically used when we are removing | ||
133 | * PMD entries. | ||
134 | */ | ||
135 | static inline void flush_pmd_entry(pmd_t *pmd) | ||
136 | { | ||
137 | #ifndef CONFIG_CPU_DCACHE_LINE_DISABLE | ||
138 | /* flush dcache line, see dcacheline_flush in proc-macros.S */ | ||
139 | asm("mov r1, %0 << #20\n" | ||
140 | "ldw r2, =_stext\n" | ||
141 | "add r2, r2, r1 >> #20\n" | ||
142 | "ldw r1, [r2+], #0x0000\n" | ||
143 | "ldw r1, [r2+], #0x1000\n" | ||
144 | "ldw r1, [r2+], #0x2000\n" | ||
145 | "ldw r1, [r2+], #0x3000\n" | ||
146 | : : "r" (pmd) : "r1", "r2"); | ||
147 | #else | ||
148 | /* flush dcache all */ | ||
149 | asm("movc p0.c5, %0, #14; nop; nop; nop; nop; nop; nop; nop; nop" | ||
150 | : : "r" (pmd) : "cc"); | ||
151 | #endif | ||
152 | } | ||
153 | |||
154 | static inline void clean_pmd_entry(pmd_t *pmd) | ||
155 | { | ||
156 | #ifndef CONFIG_CPU_DCACHE_LINE_DISABLE | ||
157 | /* clean dcache line */ | ||
158 | asm("movc p0.c5, %0, #11; nop; nop; nop; nop; nop; nop; nop; nop" | ||
159 | : : "r" (__pa(pmd) & ~(L1_CACHE_BYTES - 1)) : "cc"); | ||
160 | #else | ||
161 | /* clean dcache all */ | ||
162 | asm("movc p0.c5, %0, #10; nop; nop; nop; nop; nop; nop; nop; nop" | ||
163 | : : "r" (pmd) : "cc"); | ||
164 | #endif | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * Convert calls to our calling convention. | ||
169 | */ | ||
170 | #define local_flush_tlb_range(vma, start, end) \ | ||
171 | __cpu_flush_user_tlb_range(start, end, vma) | ||
172 | #define local_flush_tlb_kernel_range(s, e) \ | ||
173 | __cpu_flush_kern_tlb_range(s, e) | ||
174 | |||
175 | #define flush_tlb_all local_flush_tlb_all | ||
176 | #define flush_tlb_mm local_flush_tlb_mm | ||
177 | #define flush_tlb_page local_flush_tlb_page | ||
178 | #define flush_tlb_kernel_page local_flush_tlb_kernel_page | ||
179 | #define flush_tlb_range local_flush_tlb_range | ||
180 | #define flush_tlb_kernel_range local_flush_tlb_kernel_range | ||
181 | |||
182 | /* | ||
183 | * if PG_dcache_clean is not set for the page, we need to ensure that any | ||
184 | * cache entries for the kernels virtual memory range are written | ||
185 | * back to the page. | ||
186 | */ | ||
187 | extern void update_mmu_cache(struct vm_area_struct *vma, | ||
188 | unsigned long addr, pte_t *ptep); | ||
189 | |||
190 | extern void do_bad_area(unsigned long addr, unsigned int fsr, | ||
191 | struct pt_regs *regs); | ||
192 | |||
193 | #endif | ||
194 | |||
195 | #endif | ||
diff --git a/arch/unicore32/include/asm/traps.h b/arch/unicore32/include/asm/traps.h new file mode 100644 index 00000000000..66e17a724bf --- /dev/null +++ b/arch/unicore32/include/asm/traps.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/traps.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_TRAP_H__ | ||
13 | #define __UNICORE_TRAP_H__ | ||
14 | |||
15 | extern void __init early_trap_init(void); | ||
16 | extern void dump_backtrace_entry(unsigned long where, | ||
17 | unsigned long from, unsigned long frame); | ||
18 | |||
19 | extern void do_DataAbort(unsigned long addr, unsigned int fsr, | ||
20 | struct pt_regs *regs); | ||
21 | #endif | ||
diff --git a/arch/unicore32/include/asm/uaccess.h b/arch/unicore32/include/asm/uaccess.h new file mode 100644 index 00000000000..2acda503a6d --- /dev/null +++ b/arch/unicore32/include/asm/uaccess.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/uaccess.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_UACCESS_H__ | ||
13 | #define __UNICORE_UACCESS_H__ | ||
14 | |||
15 | #include <linux/thread_info.h> | ||
16 | #include <linux/errno.h> | ||
17 | |||
18 | #include <asm/memory.h> | ||
19 | #include <asm/system.h> | ||
20 | |||
21 | #define __copy_from_user __copy_from_user | ||
22 | #define __copy_to_user __copy_to_user | ||
23 | #define __strncpy_from_user __strncpy_from_user | ||
24 | #define __strnlen_user __strnlen_user | ||
25 | #define __clear_user __clear_user | ||
26 | |||
27 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) | ||
28 | #define __user_ok(addr, size) (((size) <= TASK_SIZE) \ | ||
29 | && ((addr) <= TASK_SIZE - (size))) | ||
30 | #define __access_ok(addr, size) (__kernel_ok || __user_ok((addr), (size))) | ||
31 | |||
32 | extern unsigned long __must_check | ||
33 | __copy_from_user(void *to, const void __user *from, unsigned long n); | ||
34 | extern unsigned long __must_check | ||
35 | __copy_to_user(void __user *to, const void *from, unsigned long n); | ||
36 | extern unsigned long __must_check | ||
37 | __clear_user(void __user *addr, unsigned long n); | ||
38 | extern unsigned long __must_check | ||
39 | __strncpy_from_user(char *to, const char __user *from, unsigned long count); | ||
40 | extern unsigned long | ||
41 | __strnlen_user(const char __user *s, long n); | ||
42 | |||
43 | #include <asm-generic/uaccess.h> | ||
44 | |||
45 | extern int fixup_exception(struct pt_regs *regs); | ||
46 | |||
47 | #endif /* __UNICORE_UACCESS_H__ */ | ||
diff --git a/arch/unicore32/include/asm/unistd.h b/arch/unicore32/include/asm/unistd.h new file mode 100644 index 00000000000..9b242801996 --- /dev/null +++ b/arch/unicore32/include/asm/unistd.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/include/asm/unistd.h | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #if !defined(__UNICORE_UNISTD_H__) || defined(__SYSCALL) | ||
13 | #define __UNICORE_UNISTD_H__ | ||
14 | |||
15 | /* Use the standard ABI for syscalls. */ | ||
16 | #include <asm-generic/unistd.h> | ||
17 | |||
18 | #endif /* __UNICORE_UNISTD_H__ */ | ||