xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/fixmap.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * fixmap.h: compile-time virtual memory allocation
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * This file is subject to the terms and conditions of the GNU General Public
5*4882a593Smuzhiyun  * License.  See the file "COPYING" in the main directory of this archive
6*4882a593Smuzhiyun  * for more details.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * Copyright (C) 1998 Ingo Molnar
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
11*4882a593Smuzhiyun  */
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #ifndef _ASM_FIXMAP_H
14*4882a593Smuzhiyun #define _ASM_FIXMAP_H
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #include <asm/page.h>
17*4882a593Smuzhiyun #include <spaces.h>
18*4882a593Smuzhiyun #ifdef CONFIG_HIGHMEM
19*4882a593Smuzhiyun #include <linux/threads.h>
20*4882a593Smuzhiyun #include <asm/kmap_types.h>
21*4882a593Smuzhiyun #endif
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun /*
24*4882a593Smuzhiyun  * Here we define all the compile-time 'special' virtual
25*4882a593Smuzhiyun  * addresses. The point is to have a constant address at
26*4882a593Smuzhiyun  * compile time, but to set the physical address only
27*4882a593Smuzhiyun  * in the boot process. We allocate these special  addresses
28*4882a593Smuzhiyun  * from the end of virtual memory (0xfffff000) backwards.
29*4882a593Smuzhiyun  * Also this lets us do fail-safe vmalloc(), we
30*4882a593Smuzhiyun  * can guarantee that these special addresses and
31*4882a593Smuzhiyun  * vmalloc()-ed addresses never overlap.
32*4882a593Smuzhiyun  *
33*4882a593Smuzhiyun  * these 'compile-time allocated' memory buffers are
34*4882a593Smuzhiyun  * fixed-size 4k pages. (or larger if used with an increment
35*4882a593Smuzhiyun  * highger than 1) use fixmap_set(idx,phys) to associate
36*4882a593Smuzhiyun  * physical memory with fixmap indices.
37*4882a593Smuzhiyun  *
38*4882a593Smuzhiyun  * TLB entries of such buffers will not be flushed across
39*4882a593Smuzhiyun  * task switches.
40*4882a593Smuzhiyun  */
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun /*
43*4882a593Smuzhiyun  * on UP currently we will have no trace of the fixmap mechanizm,
44*4882a593Smuzhiyun  * no page table allocations, etc. This might change in the
45*4882a593Smuzhiyun  * future, say framebuffers for the console driver(s) could be
46*4882a593Smuzhiyun  * fix-mapped?
47*4882a593Smuzhiyun  */
48*4882a593Smuzhiyun enum fixed_addresses {
49*4882a593Smuzhiyun #define FIX_N_COLOURS 8
50*4882a593Smuzhiyun 	FIX_CMAP_BEGIN,
51*4882a593Smuzhiyun 	FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * 2),
52*4882a593Smuzhiyun #ifdef CONFIG_HIGHMEM
53*4882a593Smuzhiyun 	/* reserved pte's for temporary kernel mappings */
54*4882a593Smuzhiyun 	FIX_KMAP_BEGIN = FIX_CMAP_END + 1,
55*4882a593Smuzhiyun 	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
56*4882a593Smuzhiyun #endif
57*4882a593Smuzhiyun 	__end_of_fixed_addresses
58*4882a593Smuzhiyun };
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun /*
61*4882a593Smuzhiyun  * used by vmalloc.c.
62*4882a593Smuzhiyun  *
63*4882a593Smuzhiyun  * Leave one empty page between vmalloc'ed areas and
64*4882a593Smuzhiyun  * the start of the fixmap, and leave one page empty
65*4882a593Smuzhiyun  * at the top of mem..
66*4882a593Smuzhiyun  */
67*4882a593Smuzhiyun #define FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
68*4882a593Smuzhiyun #define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE)
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun #include <asm-generic/fixmap.h>
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun /*
73*4882a593Smuzhiyun  * Called from pgtable_init()
74*4882a593Smuzhiyun  */
75*4882a593Smuzhiyun extern void fixrange_init(unsigned long start, unsigned long end,
76*4882a593Smuzhiyun 	pgd_t *pgd_base);
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun #endif
80