0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _ASM_X86_FIXMAP_H
0015 #define _ASM_X86_FIXMAP_H
0016
0017 #include <asm/kmap_size.h>
0018
0019
0020
0021
0022
0023
0024
0025 #ifndef CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP
0026 # define FIXMAP_PMD_NUM 2
0027 #else
0028 # define KM_PMDS (KM_MAX_IDX * ((CONFIG_NR_CPUS + 511) / 512))
0029 # define FIXMAP_PMD_NUM (KM_PMDS + 2)
0030 #endif
0031
0032 #define FIXMAP_PMD_TOP 507
0033
0034 #ifndef __ASSEMBLY__
0035 #include <linux/kernel.h>
0036 #include <asm/apicdef.h>
0037 #include <asm/page.h>
0038 #include <asm/pgtable_types.h>
0039 #ifdef CONFIG_X86_32
0040 #include <linux/threads.h>
0041 #else
0042 #include <uapi/asm/vsyscall.h>
0043 #endif
0044
0045
0046
0047
0048
0049
0050 #ifdef CONFIG_X86_32
0051
0052
0053
0054
0055 extern unsigned long __FIXADDR_TOP;
0056 #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
0057 #else
0058 #define FIXADDR_TOP (round_up(VSYSCALL_ADDR + PAGE_SIZE, 1<<PMD_SHIFT) - \
0059 PAGE_SIZE)
0060 #endif
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 enum fixed_addresses {
0082 #ifdef CONFIG_X86_32
0083 FIX_HOLE,
0084 #else
0085 #ifdef CONFIG_X86_VSYSCALL_EMULATION
0086 VSYSCALL_PAGE = (FIXADDR_TOP - VSYSCALL_ADDR) >> PAGE_SHIFT,
0087 #endif
0088 #endif
0089 FIX_DBGP_BASE,
0090 FIX_EARLYCON_MEM_BASE,
0091 #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
0092 FIX_OHCI1394_BASE,
0093 #endif
0094 #ifdef CONFIG_X86_LOCAL_APIC
0095 FIX_APIC_BASE,
0096 #endif
0097 #ifdef CONFIG_X86_IO_APIC
0098 FIX_IO_APIC_BASE_0,
0099 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1,
0100 #endif
0101 #ifdef CONFIG_KMAP_LOCAL
0102 FIX_KMAP_BEGIN,
0103 FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,
0104 #ifdef CONFIG_PCI_MMCONFIG
0105 FIX_PCIE_MCFG,
0106 #endif
0107 #endif
0108 #ifdef CONFIG_PARAVIRT_XXL
0109 FIX_PARAVIRT_BOOTMAP,
0110 #endif
0111
0112 #ifdef CONFIG_ACPI_APEI_GHES
0113
0114 FIX_APEI_GHES_IRQ,
0115 FIX_APEI_GHES_NMI,
0116 #endif
0117
0118 __end_of_permanent_fixed_addresses,
0119
0120
0121
0122
0123
0124
0125
0126
0127 #define NR_FIX_BTMAPS 64
0128 #define FIX_BTMAPS_SLOTS 8
0129 #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
0130 FIX_BTMAP_END =
0131 (__end_of_permanent_fixed_addresses ^
0132 (__end_of_permanent_fixed_addresses + TOTAL_FIX_BTMAPS - 1)) &
0133 -PTRS_PER_PTE
0134 ? __end_of_permanent_fixed_addresses + TOTAL_FIX_BTMAPS -
0135 (__end_of_permanent_fixed_addresses & (TOTAL_FIX_BTMAPS - 1))
0136 : __end_of_permanent_fixed_addresses,
0137 FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
0138 #ifdef CONFIG_X86_32
0139 FIX_WP_TEST,
0140 #endif
0141 #ifdef CONFIG_INTEL_TXT
0142 FIX_TBOOT_BASE,
0143 #endif
0144 __end_of_fixed_addresses
0145 };
0146
0147
0148 extern void reserve_top_address(unsigned long reserve);
0149
0150 #define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
0151 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
0152 #define FIXADDR_TOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
0153 #define FIXADDR_TOT_START (FIXADDR_TOP - FIXADDR_TOT_SIZE)
0154
0155 extern int fixmaps_set;
0156
0157 extern pte_t *pkmap_page_table;
0158
0159 void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
0160 void native_set_fixmap(unsigned idx,
0161 phys_addr_t phys, pgprot_t flags);
0162
0163 #ifndef CONFIG_PARAVIRT_XXL
0164 static inline void __set_fixmap(enum fixed_addresses idx,
0165 phys_addr_t phys, pgprot_t flags)
0166 {
0167 native_set_fixmap(idx, phys, flags);
0168 }
0169 #endif
0170
0171
0172
0173
0174
0175
0176 #define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_IO_NOCACHE
0177
0178
0179
0180
0181
0182 void __init *early_memremap_encrypted(resource_size_t phys_addr,
0183 unsigned long size);
0184 void __init *early_memremap_encrypted_wp(resource_size_t phys_addr,
0185 unsigned long size);
0186 void __init *early_memremap_decrypted(resource_size_t phys_addr,
0187 unsigned long size);
0188 void __init *early_memremap_decrypted_wp(resource_size_t phys_addr,
0189 unsigned long size);
0190
0191 #include <asm-generic/fixmap.h>
0192
0193 #define __late_set_fixmap(idx, phys, flags) __set_fixmap(idx, phys, flags)
0194 #define __late_clear_fixmap(idx) __set_fixmap(idx, 0, __pgprot(0))
0195
0196 void __early_set_fixmap(enum fixed_addresses idx,
0197 phys_addr_t phys, pgprot_t flags);
0198
0199 #endif
0200 #endif