ia64/xen-unstable

view xen/include/asm-x86/fixmap.h @ 15907:ca495837a722

Generic and VT-d specific Xen header changes for PCI passthru.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: Guy Zana <guy@neocleus.com>
author kfraser@localhost.localdomain
date Wed Sep 12 15:42:39 2007 +0100 (2007-09-12)
parents 2b43fb3afb3e
children 844e507d56b8
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>
19 #include <xen/kexec.h>
20 #include <asm/iommu.h>
22 /*
23 * Here we define all the compile-time 'special' virtual
24 * addresses. The point is to have a constant address at
25 * compile time, but to set the physical address only
26 * in the boot process. We allocate these special addresses
27 * from the end of virtual memory backwards.
28 */
29 enum fixed_addresses {
30 #ifdef CONFIG_X86_PAE
31 FIX_PAE_HIGHMEM_0,
32 FIX_PAE_HIGHMEM_END = FIX_PAE_HIGHMEM_0 + NR_CPUS-1,
33 #endif
34 FIX_APIC_BASE,
35 FIX_IO_APIC_BASE_0,
36 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
37 FIX_ACPI_BEGIN,
38 FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
39 FIX_HPET_BASE,
40 FIX_CYCLONE_TIMER,
41 FIX_KEXEC_BASE_0,
42 FIX_KEXEC_BASE_END = FIX_KEXEC_BASE_0 \
43 + ((KEXEC_XEN_NO_PAGES >> 1) * KEXEC_IMAGE_NR) - 1,
44 FIX_IOMMU_REGS_BASE_0,
45 FIX_IOMMU_REGS_END = FIX_IOMMU_REGS_BASE_0 + MAX_IOMMUS-1,
46 __end_of_fixed_addresses
47 };
49 #define FIXADDR_TOP (IOREMAP_VIRT_END - PAGE_SIZE)
50 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
51 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
53 extern void __set_fixmap(
54 enum fixed_addresses idx, unsigned long mfn, unsigned long flags);
56 #define set_fixmap(idx, phys) \
57 __set_fixmap(idx, (phys)>>PAGE_SHIFT, PAGE_HYPERVISOR)
59 #define set_fixmap_nocache(idx, phys) \
60 __set_fixmap(idx, (phys)>>PAGE_SHIFT, PAGE_HYPERVISOR_NOCACHE)
62 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
63 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
65 #define fix_to_virt(x) (__fix_to_virt(x))
67 static inline unsigned long virt_to_fix(const unsigned long vaddr)
68 {
69 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
70 return __virt_to_fix(vaddr);
71 }
73 #endif