ia64/xen-unstable

annotate linux-2.6-xen-sparse/include/asm-i386/fixmap.h @ 9036:e480a5db8abb

Fix non-xen build for: Make the fixmap area moveable in kernel address space.

From: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Feb 27 10:34:03 2006 +0000 (2006-02-27)
parents 55f597e929f3
children
rev   line source
cl349@9033 1 /*
cl349@9033 2 * fixmap.h: compile-time virtual memory allocation
cl349@9033 3 *
cl349@9033 4 * This file is subject to the terms and conditions of the GNU General Public
cl349@9033 5 * License. See the file "COPYING" in the main directory of this archive
cl349@9033 6 * for more details.
cl349@9033 7 *
cl349@9033 8 * Copyright (C) 1998 Ingo Molnar
cl349@9033 9 *
cl349@9033 10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
cl349@9033 11 */
cl349@9033 12
cl349@9033 13 #ifndef _ASM_FIXMAP_H
cl349@9033 14 #define _ASM_FIXMAP_H
cl349@9033 15
cl349@9033 16 #include <linux/config.h>
cl349@9033 17
cl349@9033 18 /* used by vmalloc.c, vsyscall.lds.S.
cl349@9033 19 *
cl349@9033 20 * Leave one empty page between vmalloc'ed areas and
cl349@9033 21 * the start of the fixmap.
cl349@9033 22 */
cl349@9036 23 extern unsigned long __FIXADDR_TOP;
cl349@9033 24
cl349@9033 25 #ifndef __ASSEMBLY__
cl349@9033 26 #include <linux/kernel.h>
cl349@9033 27 #include <asm/acpi.h>
cl349@9033 28 #include <asm/apicdef.h>
cl349@9033 29 #include <asm/page.h>
cl349@9033 30 #ifdef CONFIG_HIGHMEM
cl349@9033 31 #include <linux/threads.h>
cl349@9033 32 #include <asm/kmap_types.h>
cl349@9033 33 #endif
cl349@9033 34
cl349@9033 35 /*
cl349@9033 36 * Here we define all the compile-time 'special' virtual
cl349@9033 37 * addresses. The point is to have a constant address at
cl349@9033 38 * compile time, but to set the physical address only
cl349@9033 39 * in the boot process. We allocate these special addresses
cl349@9033 40 * from the end of virtual memory (0xfffff000) backwards.
cl349@9033 41 * Also this lets us do fail-safe vmalloc(), we
cl349@9033 42 * can guarantee that these special addresses and
cl349@9033 43 * vmalloc()-ed addresses never overlap.
cl349@9033 44 *
cl349@9033 45 * these 'compile-time allocated' memory buffers are
cl349@9033 46 * fixed-size 4k pages. (or larger if used with an increment
cl349@9033 47 * highger than 1) use fixmap_set(idx,phys) to associate
cl349@9033 48 * physical memory with fixmap indices.
cl349@9033 49 *
cl349@9033 50 * TLB entries of such buffers will not be flushed across
cl349@9033 51 * task switches.
cl349@9033 52 */
cl349@9033 53 enum fixed_addresses {
cl349@9033 54 FIX_HOLE,
cl349@9033 55 #ifdef CONFIG_X86_LOCAL_APIC
cl349@9033 56 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
cl349@9033 57 #endif
cl349@9033 58 #ifdef CONFIG_X86_IO_APIC
cl349@9033 59 FIX_IO_APIC_BASE_0,
cl349@9033 60 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
cl349@9033 61 #endif
cl349@9033 62 #ifdef CONFIG_X86_VISWS_APIC
cl349@9033 63 FIX_CO_CPU, /* Cobalt timer */
cl349@9033 64 FIX_CO_APIC, /* Cobalt APIC Redirection Table */
cl349@9033 65 FIX_LI_PCIA, /* Lithium PCI Bridge A */
cl349@9033 66 FIX_LI_PCIB, /* Lithium PCI Bridge B */
cl349@9033 67 #endif
cl349@9033 68 #ifdef CONFIG_X86_F00F_BUG
cl349@9033 69 FIX_F00F_IDT, /* Virtual mapping for IDT */
cl349@9033 70 #endif
cl349@9033 71 #ifdef CONFIG_X86_CYCLONE_TIMER
cl349@9033 72 FIX_CYCLONE_TIMER, /*cyclone timer register*/
cl349@9033 73 #endif
cl349@9033 74 #ifdef CONFIG_HIGHMEM
cl349@9033 75 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
cl349@9033 76 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
cl349@9033 77 #endif
cl349@9033 78 #ifdef CONFIG_ACPI
cl349@9033 79 FIX_ACPI_BEGIN,
cl349@9033 80 FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
cl349@9033 81 #endif
cl349@9033 82 #ifdef CONFIG_PCI_MMCONFIG
cl349@9033 83 FIX_PCIE_MCFG,
cl349@9033 84 #endif
cl349@9033 85 __end_of_permanent_fixed_addresses,
cl349@9033 86 /* temporary boot-time mappings, used before ioremap() is functional */
cl349@9033 87 #define NR_FIX_BTMAPS 16
cl349@9033 88 FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
cl349@9033 89 FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS - 1,
cl349@9033 90 FIX_WP_TEST,
cl349@9033 91 __end_of_fixed_addresses
cl349@9033 92 };
cl349@9033 93
cl349@9033 94 extern void __set_fixmap (enum fixed_addresses idx,
cl349@9033 95 unsigned long phys, pgprot_t flags);
cl349@9033 96
cl349@9036 97 extern void set_fixaddr_top(unsigned long top);
cl349@9036 98
cl349@9033 99 #define set_fixmap(idx, phys) \
cl349@9033 100 __set_fixmap(idx, phys, PAGE_KERNEL)
cl349@9033 101 /*
cl349@9033 102 * Some hardware wants to get fixmapped without caching.
cl349@9033 103 */
cl349@9033 104 #define set_fixmap_nocache(idx, phys) \
cl349@9033 105 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
cl349@9033 106
cl349@9033 107 #define clear_fixmap(idx) \
cl349@9033 108 __set_fixmap(idx, 0, __pgprot(0))
cl349@9033 109
cl349@9033 110 #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
cl349@9033 111
cl349@9033 112 #define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
cl349@9033 113 #define __FIXADDR_BOOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
cl349@9033 114 #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
cl349@9033 115 #define FIXADDR_BOOT_START (FIXADDR_TOP - __FIXADDR_BOOT_SIZE)
cl349@9033 116
cl349@9033 117 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
cl349@9033 118 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
cl349@9033 119
cl349@9033 120 extern void __this_fixmap_does_not_exist(void);
cl349@9033 121
cl349@9033 122 /*
cl349@9033 123 * 'index to address' translation. If anyone tries to use the idx
cl349@9033 124 * directly without tranlation, we catch the bug with a NULL-deference
cl349@9033 125 * kernel oops. Illegal ranges of incoming indices are caught too.
cl349@9033 126 */
cl349@9033 127 static __always_inline unsigned long fix_to_virt(const unsigned int idx)
cl349@9033 128 {
cl349@9033 129 /*
cl349@9033 130 * this branch gets completely eliminated after inlining,
cl349@9033 131 * except when someone tries to use fixaddr indices in an
cl349@9033 132 * illegal way. (such as mixing up address types or using
cl349@9033 133 * out-of-range indices).
cl349@9033 134 *
cl349@9033 135 * If it doesn't get removed, the linker will complain
cl349@9033 136 * loudly with a reasonably clear error message..
cl349@9033 137 */
cl349@9033 138 if (idx >= __end_of_fixed_addresses)
cl349@9033 139 __this_fixmap_does_not_exist();
cl349@9033 140
cl349@9033 141 return __fix_to_virt(idx);
cl349@9033 142 }
cl349@9033 143
cl349@9033 144 static inline unsigned long virt_to_fix(const unsigned long vaddr)
cl349@9033 145 {
cl349@9033 146 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
cl349@9033 147 return __virt_to_fix(vaddr);
cl349@9033 148 }
cl349@9033 149
cl349@9033 150 #endif /* !__ASSEMBLY__ */
cl349@9033 151 #endif