- Linus: drop support for old-style Makefiles entirely. Big.
[davej-history.git] / include / asm-i386 / fixmap.h
blob9a906bcff280ccfce72099b4eae91db060bf6cde
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
10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
13 #ifndef _ASM_FIXMAP_H
14 #define _ASM_FIXMAP_H
16 #include <linux/config.h>
17 #include <linux/kernel.h>
18 #include <asm/apicdef.h>
19 #include <asm/page.h>
20 #ifdef CONFIG_HIGHMEM
21 #include <linux/threads.h>
22 #include <asm/kmap_types.h>
23 #endif
26 * Here we define all the compile-time 'special' virtual
27 * addresses. The point is to have a constant address at
28 * compile time, but to set the physical address only
29 * in the boot process. We allocate these special addresses
30 * from the end of virtual memory (0xfffff000) backwards.
31 * Also this lets us do fail-safe vmalloc(), we
32 * can guarantee that these special addresses and
33 * vmalloc()-ed addresses never overlap.
35 * these 'compile-time allocated' memory buffers are
36 * fixed-size 4k pages. (or larger if used with an increment
37 * highger than 1) use fixmap_set(idx,phys) to associate
38 * physical memory with fixmap indices.
40 * TLB entries of such buffers will not be flushed across
41 * task switches.
45 * on UP currently we will have no trace of the fixmap mechanizm,
46 * no page table allocations, etc. This might change in the
47 * future, say framebuffers for the console driver(s) could be
48 * fix-mapped?
50 enum fixed_addresses {
51 #ifdef CONFIG_X86_LOCAL_APIC
52 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
53 #endif
54 #ifdef CONFIG_X86_IO_APIC
55 FIX_IO_APIC_BASE_0,
56 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
57 #endif
58 #ifdef CONFIG_X86_VISWS_APIC
59 FIX_CO_CPU, /* Cobalt timer */
60 FIX_CO_APIC, /* Cobalt APIC Redirection Table */
61 FIX_LI_PCIA, /* Lithium PCI Bridge A */
62 FIX_LI_PCIB, /* Lithium PCI Bridge B */
63 #endif
64 #ifdef CONFIG_HIGHMEM
65 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
66 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
67 #endif
68 __end_of_fixed_addresses
71 extern void __set_fixmap (enum fixed_addresses idx,
72 unsigned long phys, pgprot_t flags);
74 #define set_fixmap(idx, phys) \
75 __set_fixmap(idx, phys, PAGE_KERNEL)
77 * Some hardware wants to get fixmapped without caching.
79 #define set_fixmap_nocache(idx, phys) \
80 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
82 * used by vmalloc.c.
84 * Leave one empty page between vmalloc'ed areas and
85 * the start of the fixmap, and leave one page empty
86 * at the top of mem..
88 #define FIXADDR_TOP (0xffffe000UL)
89 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
90 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
92 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
94 extern void __this_fixmap_does_not_exist(void);
97 * 'index to address' translation. If anyone tries to use the idx
98 * directly without tranlation, we catch the bug with a NULL-deference
99 * kernel oops. Illegal ranges of incoming indices are caught too.
101 extern inline unsigned long fix_to_virt(const unsigned int idx)
104 * this branch gets completely eliminated after inlining,
105 * except when someone tries to use fixaddr indices in an
106 * illegal way. (such as mixing up address types or using
107 * out-of-range indices).
109 * If it doesn't get removed, the linker will complain
110 * loudly with a reasonably clear error message..
112 if (idx >= __end_of_fixed_addresses)
113 __this_fixmap_does_not_exist();
115 return __fix_to_virt(idx);
118 #endif