source: GPL/include/asm/fixmap.h@ 1

Last change on this file since 1 was 1, checked in by vladest, 20 years ago

initial import

File size: 3.4 KB
Line 
1/*
2 * fixmap.h: compile-time virtual memory allocation
3 *
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.
7 *
8 * Copyright (C) 1998 Ingo Molnar
9 *
10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
11 */
12
13#ifndef _ASM_FIXMAP_H
14#define _ASM_FIXMAP_H
15
16#include <linux/config.h>
17#include <linux/kernel.h>
18#include <asm/apic.h>
19#include <asm/page.h>
20#ifdef CONFIG_HIGHMEM
21#include <linux/threads.h>
22#include <asm/kmap_types.h>
23#endif
24
25/*
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.
34 *
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.
39 *
40 * TLB entries of such buffers will not be flushed across
41 * task switches.
42 */
43
44/*
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?
49 */
50enum 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
69};
70
71extern void set_fixmap (enum fixed_addresses idx, unsigned long phys);
72
73/*
74 * used by vmalloc.c.
75 *
76 * Leave one empty page between vmalloc'ed areas and
77 * the start of the fixmap, and leave one page empty
78 * at the top of mem..
79 */
80#define FIXADDR_TOP (0xffffe000UL)
81#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
82#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
83
84#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
85
86extern void __this_fixmap_does_not_exist(void);
87
88#if 0
89/*
90 * 'index to address' translation. If anyone tries to use the idx
91 * directly without tranlation, we catch the bug with a NULL-deference
92 * kernel oops. Illegal ranges of incoming indices are caught too.
93 */
94extern inline unsigned long fix_to_virt(const unsigned int idx)
95{
96 /*
97 * this branch gets completely eliminated after inlining,
98 * except when someone tries to use fixaddr indices in an
99 * illegal way. (such as mixing up address types or using
100 * out-of-range indices).
101 *
102 * If it doesn't get removed, the linker will complain
103 * loudly with a reasonably clear error message..
104 */
105 if (idx >= __end_of_fixed_addresses)
106 __this_fixmap_does_not_exist();
107
108 return __fix_to_virt(idx);
109}
110#endif
111
112#endif
Note: See TracBrowser for help on using the repository browser.