1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 25f0fbf9eSNicolas Pitre #ifndef _ASM_FIXMAP_H 35f0fbf9eSNicolas Pitre #define _ASM_FIXMAP_H 45f0fbf9eSNicolas Pitre 5a05e54c1SLiu Hua #define FIXADDR_START 0xffc00000UL 6836a2418SRob Herring #define FIXADDR_END 0xfff00000UL 7b615bbbfSMark Salter #define FIXADDR_TOP (FIXADDR_END - PAGE_SIZE) 85f0fbf9eSNicolas Pitre 9ca5999fdSMike Rapoport #include <linux/pgtable.h> 10*2a15ba82SThomas Gleixner #include <asm/kmap_size.h> 115f0fbf9eSNicolas Pitre 12b615bbbfSMark Salter enum fixed_addresses { 13a5f4c561SStefan Agner FIX_EARLYCON_MEM_BASE, 14a5f4c561SStefan Agner __end_of_permanent_fixed_addresses, 15a5f4c561SStefan Agner 16a5f4c561SStefan Agner FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses, 17*2a15ba82SThomas Gleixner FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1, 185f0fbf9eSNicolas Pitre 19ab0615e2SRabin Vincent /* Support writing RO kernel text via kprobes, jump labels, etc. */ 20ab0615e2SRabin Vincent FIX_TEXT_POKE0, 21ab0615e2SRabin Vincent FIX_TEXT_POKE1, 22ab0615e2SRabin Vincent 232937367bSArd Biesheuvel __end_of_fixmap_region, 242937367bSArd Biesheuvel 252937367bSArd Biesheuvel /* 262937367bSArd Biesheuvel * Share the kmap() region with early_ioremap(): this is guaranteed 272937367bSArd Biesheuvel * not to clash since early_ioremap() is only available before 282937367bSArd Biesheuvel * paging_init(), and kmap() only after. 292937367bSArd Biesheuvel */ 302937367bSArd Biesheuvel #define NR_FIX_BTMAPS 32 312937367bSArd Biesheuvel #define FIX_BTMAPS_SLOTS 7 322937367bSArd Biesheuvel #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) 332937367bSArd Biesheuvel 342937367bSArd Biesheuvel FIX_BTMAP_END = __end_of_permanent_fixed_addresses, 352937367bSArd Biesheuvel FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, 362937367bSArd Biesheuvel __end_of_early_ioremap_region 37b615bbbfSMark Salter }; 385f0fbf9eSNicolas Pitre 392937367bSArd Biesheuvel static const enum fixed_addresses __end_of_fixed_addresses = 402937367bSArd Biesheuvel __end_of_fixmap_region > __end_of_early_ioremap_region ? 412937367bSArd Biesheuvel __end_of_fixmap_region : __end_of_early_ioremap_region; 422937367bSArd Biesheuvel 43a5f4c561SStefan Agner #define FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY) 44a5f4c561SStefan Agner 45b089c31cSJon Medhurst #define FIXMAP_PAGE_NORMAL (pgprot_kernel | L_PTE_XN) 462937367bSArd Biesheuvel #define FIXMAP_PAGE_RO (FIXMAP_PAGE_NORMAL | L_PTE_RDONLY) 47a5f4c561SStefan Agner 48a5f4c561SStefan Agner /* Used by set_fixmap_(io|nocache), both meant for mapping a device */ 49a5f4c561SStefan Agner #define FIXMAP_PAGE_IO (FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | L_PTE_SHARED) 50a5f4c561SStefan Agner #define FIXMAP_PAGE_NOCACHE FIXMAP_PAGE_IO 51a5f4c561SStefan Agner 522937367bSArd Biesheuvel #define __early_set_fixmap __set_fixmap 532937367bSArd Biesheuvel 542937367bSArd Biesheuvel #ifdef CONFIG_MMU 552937367bSArd Biesheuvel 5699b4ac9aSKees Cook void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); 57a5f4c561SStefan Agner void __init early_fixmap_init(void); 5899b4ac9aSKees Cook 59b615bbbfSMark Salter #include <asm-generic/fixmap.h> 605f0fbf9eSNicolas Pitre 612937367bSArd Biesheuvel #else 622937367bSArd Biesheuvel 632937367bSArd Biesheuvel static inline void early_fixmap_init(void) { } 642937367bSArd Biesheuvel 652937367bSArd Biesheuvel #endif 665f0fbf9eSNicolas Pitre #endif 67