diff options
Diffstat (limited to 'include/asm-x86/fixmap_64.h')
-rw-r--r-- | include/asm-x86/fixmap_64.h | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/include/asm-x86/fixmap_64.h b/include/asm-x86/fixmap_64.h index 355d26a75a82..1a0b61eb02ff 100644 --- a/include/asm-x86/fixmap_64.h +++ b/include/asm-x86/fixmap_64.h | |||
@@ -46,23 +46,28 @@ enum fixed_addresses { | |||
46 | FIX_EFI_IO_MAP_LAST_PAGE, | 46 | FIX_EFI_IO_MAP_LAST_PAGE, |
47 | FIX_EFI_IO_MAP_FIRST_PAGE = FIX_EFI_IO_MAP_LAST_PAGE | 47 | FIX_EFI_IO_MAP_FIRST_PAGE = FIX_EFI_IO_MAP_LAST_PAGE |
48 | + MAX_EFI_IO_PAGES - 1, | 48 | + MAX_EFI_IO_PAGES - 1, |
49 | #ifdef CONFIG_PARAVIRT | ||
50 | FIX_PARAVIRT_BOOTMAP, | ||
51 | #endif | ||
49 | #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT | 52 | #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT |
50 | FIX_OHCI1394_BASE, | 53 | FIX_OHCI1394_BASE, |
51 | #endif | 54 | #endif |
55 | __end_of_permanent_fixed_addresses, | ||
56 | /* | ||
57 | * 256 temporary boot-time mappings, used by early_ioremap(), | ||
58 | * before ioremap() is functional. | ||
59 | * | ||
60 | * We round it up to the next 512 pages boundary so that we | ||
61 | * can have a single pgd entry and a single pte table: | ||
62 | */ | ||
63 | #define NR_FIX_BTMAPS 64 | ||
64 | #define FIX_BTMAPS_NESTING 4 | ||
65 | FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 512 - | ||
66 | (__end_of_permanent_fixed_addresses & 511), | ||
67 | FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_NESTING - 1, | ||
52 | __end_of_fixed_addresses | 68 | __end_of_fixed_addresses |
53 | }; | 69 | }; |
54 | 70 | ||
55 | extern void __set_fixmap(enum fixed_addresses idx, | ||
56 | unsigned long phys, pgprot_t flags); | ||
57 | |||
58 | #define set_fixmap(idx, phys) \ | ||
59 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
60 | /* | ||
61 | * Some hardware wants to get fixmapped without caching. | ||
62 | */ | ||
63 | #define set_fixmap_nocache(idx, phys) \ | ||
64 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
65 | |||
66 | #define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE) | 71 | #define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE) |
67 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | 72 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
68 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | 73 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) |
@@ -71,30 +76,4 @@ extern void __set_fixmap(enum fixed_addresses idx, | |||
71 | #define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL) | 76 | #define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL) |
72 | #define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE) | 77 | #define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE) |
73 | 78 | ||
74 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
75 | |||
76 | extern void __this_fixmap_does_not_exist(void); | ||
77 | |||
78 | /* | ||
79 | * 'index to address' translation. If anyone tries to use the idx | ||
80 | * directly without translation, we catch the bug with a NULL-deference | ||
81 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
82 | */ | ||
83 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
84 | { | ||
85 | /* | ||
86 | * this branch gets completely eliminated after inlining, | ||
87 | * except when someone tries to use fixaddr indices in an | ||
88 | * illegal way. (such as mixing up address types or using | ||
89 | * out-of-range indices). | ||
90 | * | ||
91 | * If it doesn't get removed, the linker will complain | ||
92 | * loudly with a reasonably clear error message.. | ||
93 | */ | ||
94 | if (idx >= __end_of_fixed_addresses) | ||
95 | __this_fixmap_does_not_exist(); | ||
96 | |||
97 | return __fix_to_virt(idx); | ||
98 | } | ||
99 | |||
100 | #endif | 79 | #endif |