ia64/xen-unstable

view xen/include/asm-x86/fixmap.h @ 6552:a9873d384da4

Merge.
author adsharma@los-vmm.sc.intel.com
date Thu Aug 25 12:24:48 2005 -0700 (2005-08-25)
parents 112d44270733 fa0754a9f64f
children dfaf788ab18c
line source
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 * Modifications for Xen are copyright (c) 2002-2004, K A Fraser
10 */
12 #ifndef _ASM_FIXMAP_H
13 #define _ASM_FIXMAP_H
15 #include <xen/config.h>
16 #include <asm/apicdef.h>
17 #include <asm/acpi.h>
18 #include <asm/page.h>
20 /*
21 * Here we define all the compile-time 'special' virtual
22 * addresses. The point is to have a constant address at
23 * compile time, but to set the physical address only
24 * in the boot process. We allocate these special addresses
25 * from the end of virtual memory backwards.
26 */
27 enum fixed_addresses {
28 FIX_APIC_BASE,
29 FIX_IO_APIC_BASE_0,
30 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
31 FIX_ACPI_BEGIN,
32 FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
33 FIX_HPET_BASE,
34 FIX_CYCLONE_TIMER,
35 __end_of_fixed_addresses
36 };
38 #define FIXADDR_TOP (IOREMAP_VIRT_END - PAGE_SIZE)
39 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
40 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
42 extern void __set_fixmap(
43 enum fixed_addresses idx, unsigned long p, unsigned long flags);
45 #define set_fixmap(idx, phys) \
46 __set_fixmap(idx, phys, PAGE_HYPERVISOR)
48 #define set_fixmap_nocache(idx, phys) \
49 __set_fixmap(idx, phys, PAGE_HYPERVISOR_NOCACHE)
51 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
52 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
54 #define fix_to_virt(x) (__fix_to_virt(x))
56 static inline unsigned long virt_to_fix(const unsigned long vaddr)
57 {
58 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
59 return __virt_to_fix(vaddr);
60 }
62 #endif