15f0fbf9eSNicolas Pitre #ifndef _ASM_FIXMAP_H 25f0fbf9eSNicolas Pitre #define _ASM_FIXMAP_H 35f0fbf9eSNicolas Pitre 4a05e54c1SLiu Hua #define FIXADDR_START 0xffc00000UL 5836a2418SRob Herring #define FIXADDR_END 0xfff00000UL 6b615bbbfSMark Salter #define FIXADDR_TOP (FIXADDR_END - PAGE_SIZE) 75f0fbf9eSNicolas Pitre 8b615bbbfSMark Salter #include <asm/kmap_types.h> 9a5f4c561SStefan Agner #include <asm/pgtable.h> 105f0fbf9eSNicolas Pitre 11b615bbbfSMark Salter enum fixed_addresses { 12a5f4c561SStefan Agner FIX_EARLYCON_MEM_BASE, 13a5f4c561SStefan Agner __end_of_permanent_fixed_addresses, 14a5f4c561SStefan Agner 15a5f4c561SStefan Agner FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses, 16b615bbbfSMark Salter FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1, 175f0fbf9eSNicolas Pitre 18ab0615e2SRabin Vincent /* Support writing RO kernel text via kprobes, jump labels, etc. */ 19ab0615e2SRabin Vincent FIX_TEXT_POKE0, 20ab0615e2SRabin Vincent FIX_TEXT_POKE1, 21ab0615e2SRabin Vincent 222937367bSArd Biesheuvel __end_of_fixmap_region, 232937367bSArd Biesheuvel 242937367bSArd Biesheuvel /* 252937367bSArd Biesheuvel * Share the kmap() region with early_ioremap(): this is guaranteed 262937367bSArd Biesheuvel * not to clash since early_ioremap() is only available before 272937367bSArd Biesheuvel * paging_init(), and kmap() only after. 282937367bSArd Biesheuvel */ 292937367bSArd Biesheuvel #define NR_FIX_BTMAPS 32 302937367bSArd Biesheuvel #define FIX_BTMAPS_SLOTS 7 312937367bSArd Biesheuvel #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) 322937367bSArd Biesheuvel 332937367bSArd Biesheuvel FIX_BTMAP_END = __end_of_permanent_fixed_addresses, 342937367bSArd Biesheuvel FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, 352937367bSArd Biesheuvel __end_of_early_ioremap_region 36b615bbbfSMark Salter }; 375f0fbf9eSNicolas Pitre 382937367bSArd Biesheuvel static const enum fixed_addresses __end_of_fixed_addresses = 392937367bSArd Biesheuvel __end_of_fixmap_region > __end_of_early_ioremap_region ? 402937367bSArd Biesheuvel __end_of_fixmap_region : __end_of_early_ioremap_region; 412937367bSArd Biesheuvel 42a5f4c561SStefan Agner #define FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY) 43a5f4c561SStefan Agner 44*b089c31cSJon Medhurst #define FIXMAP_PAGE_NORMAL (pgprot_kernel | L_PTE_XN) 452937367bSArd Biesheuvel #define FIXMAP_PAGE_RO (FIXMAP_PAGE_NORMAL | L_PTE_RDONLY) 46a5f4c561SStefan Agner 47a5f4c561SStefan Agner /* Used by set_fixmap_(io|nocache), both meant for mapping a device */ 48a5f4c561SStefan Agner #define FIXMAP_PAGE_IO (FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | L_PTE_SHARED) 49a5f4c561SStefan Agner #define FIXMAP_PAGE_NOCACHE FIXMAP_PAGE_IO 50a5f4c561SStefan Agner 512937367bSArd Biesheuvel #define __early_set_fixmap __set_fixmap 522937367bSArd Biesheuvel 532937367bSArd Biesheuvel #ifdef CONFIG_MMU 542937367bSArd Biesheuvel 5599b4ac9aSKees Cook void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); 56a5f4c561SStefan Agner void __init early_fixmap_init(void); 5799b4ac9aSKees Cook 58b615bbbfSMark Salter #include <asm-generic/fixmap.h> 595f0fbf9eSNicolas Pitre 602937367bSArd Biesheuvel #else 612937367bSArd Biesheuvel 622937367bSArd Biesheuvel static inline void early_fixmap_init(void) { } 632937367bSArd Biesheuvel 642937367bSArd Biesheuvel #endif 655f0fbf9eSNicolas Pitre #endif 66