adapted driver to latest fbcon changes
[linux-2.6/linux-mips.git] / include / asm-i386 / fixmap.h
blobc259a45ee837cf2be579099e358cf96576938fa0
1 /*
2 * fixmap.h: compile-time virtual memory allocation
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
8 * Copyright (C) 1998 Ingo Molnar
9 */
11 #ifndef _ASM_FIXMAP_H
12 #define _ASM_FIXMAP_H
14 #include <linux/config.h>
15 #include <linux/kernel.h>
16 #include <asm/page.h>
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 * bigger 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 #ifdef CONFIG_X86_LOCAL_APIC
45 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
46 #endif
47 #ifdef CONFIG_X86_IO_APIC
48 FIX_IO_APIC_BASE,
49 #endif
50 #ifdef CONFIG_X86_VISWS_APIC
51 FIX_CO_CPU, /* Cobalt timer */
52 FIX_CO_APIC, /* Cobalt APIC Redirection Table */
53 FIX_LI_PCIA, /* Lithium PCI Bridge A */
54 FIX_LI_PCIB, /* Lithium PCI Bridge B */
55 #endif
56 __end_of_fixed_addresses
59 extern void set_fixmap (enum fixed_addresses idx, unsigned long phys);
62 * used by vmalloc.c.
64 * Leave one empty page between vmalloc'ed areas and
65 * the start of the fixmap, and leave one page empty
66 * at the top of mem..
68 #define FIXADDR_TOP (0xffffe000UL)
69 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
70 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
72 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
74 extern void __this_fixmap_does_not_exist(void);
77 * 'index to address' translation. If anyone tries to use the idx
78 * directly without tranlation, we catch the bug with a NULL-deference
79 * kernel oops. Illegal ranges of incoming indices are caught too.
81 extern inline unsigned long fix_to_virt(const unsigned int idx)
84 * this branch gets completely eliminated after inlining,
85 * except when someone tries to use fixaddr indices in an
86 * illegal way. (such as mixing up address types or using
87 * out-of-range indices).
89 * If it doesn't get removed, the linker will complain
90 * loudly with a reasonably clear error message..
92 if (idx >= __end_of_fixed_addresses)
93 __this_fixmap_does_not_exist();
95 return __fix_to_virt(idx);
98 #endif