ARM: mmp: fix potential NULL dereference
[linux/fpc-iii.git] / arch / score / include / asm / fixmap.h
blobee1676694024625a66b2d2a1969d813af0d8de34
1 #ifndef _ASM_SCORE_FIXMAP_H
2 #define _ASM_SCORE_FIXMAP_H
4 #include <asm/page.h>
6 #define PHY_RAM_BASE 0x00000000
7 #define PHY_IO_BASE 0x10000000
9 #define VIRTUAL_RAM_BASE 0xa0000000
10 #define VIRTUAL_IO_BASE 0xb0000000
12 #define RAM_SPACE_SIZE 0x10000000
13 #define IO_SPACE_SIZE 0x10000000
15 /* Kernel unmapped, cached 512MB */
16 #define KSEG1 0xa0000000
19 * Here we define all the compile-time 'special' virtual
20 * addresses. The point is to have a constant address at
21 * compile time, but to set the physical address only
22 * in the boot process. We allocate these special addresses
23 * from the end of virtual memory (0xfffff000) backwards.
24 * Also this lets us do fail-safe vmalloc(), we
25 * can guarantee that these special addresses and
26 * vmalloc()-ed addresses never overlap.
28 * these 'compile-time allocated' memory buffers are
29 * fixed-size 4k pages. (or larger if used with an increment
30 * highger than 1) use fixmap_set(idx,phys) to associate
31 * physical memory with fixmap indices.
33 * TLB entries of such buffers will not be flushed across
34 * task switches.
38 * on UP currently we will have no trace of the fixmap mechanizm,
39 * no page table allocations, etc. This might change in the
40 * future, say framebuffers for the console driver(s) could be
41 * fix-mapped?
43 enum fixed_addresses {
44 #define FIX_N_COLOURS 8
45 FIX_CMAP_BEGIN,
46 FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
47 __end_of_fixed_addresses
51 * used by vmalloc.c.
53 * Leave one empty page between vmalloc'ed areas and
54 * the start of the fixmap, and leave one page empty
55 * at the top of mem..
57 #define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000)
58 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
59 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
61 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
62 #define __virt_to_fix(x) \
63 ((FIXADDR_TOP - ((x) & PAGE_MASK)) >> PAGE_SHIFT)
65 extern void __this_fixmap_does_not_exist(void);
68 * 'index to address' translation. If anyone tries to use the idx
69 * directly without tranlation, we catch the bug with a NULL-deference
70 * kernel oops. Illegal ranges of incoming indices are caught too.
72 static inline unsigned long fix_to_virt(const unsigned int idx)
74 return __fix_to_virt(idx);
77 static inline unsigned long virt_to_fix(const unsigned long vaddr)
79 return __virt_to_fix(vaddr);
82 #endif /* _ASM_SCORE_FIXMAP_H */