162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ASM_FIXMAP_H 362306a36Sopenharmony_ci#define _ASM_FIXMAP_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#define FIXADDR_START 0xffc80000UL 662306a36Sopenharmony_ci#define FIXADDR_END 0xfff00000UL 762306a36Sopenharmony_ci#define FIXADDR_TOP (FIXADDR_END - PAGE_SIZE) 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/pgtable.h> 1062306a36Sopenharmony_ci#include <asm/kmap_size.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_cienum fixed_addresses { 1362306a36Sopenharmony_ci FIX_EARLYCON_MEM_BASE, 1462306a36Sopenharmony_ci __end_of_permanent_fixed_addresses, 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses, 1762306a36Sopenharmony_ci FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1, 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci /* Support writing RO kernel text via kprobes, jump labels, etc. */ 2062306a36Sopenharmony_ci FIX_TEXT_POKE0, 2162306a36Sopenharmony_ci FIX_TEXT_POKE1, 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci __end_of_fixmap_region, 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci /* 2662306a36Sopenharmony_ci * Share the kmap() region with early_ioremap(): this is guaranteed 2762306a36Sopenharmony_ci * not to clash since early_ioremap() is only available before 2862306a36Sopenharmony_ci * paging_init(), and kmap() only after. 2962306a36Sopenharmony_ci */ 3062306a36Sopenharmony_ci#define NR_FIX_BTMAPS 32 3162306a36Sopenharmony_ci#define FIX_BTMAPS_SLOTS 7 3262306a36Sopenharmony_ci#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci FIX_BTMAP_END = __end_of_permanent_fixed_addresses, 3562306a36Sopenharmony_ci FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, 3662306a36Sopenharmony_ci __end_of_early_ioremap_region 3762306a36Sopenharmony_ci}; 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_cistatic const enum fixed_addresses __end_of_fixed_addresses = 4062306a36Sopenharmony_ci __end_of_fixmap_region > __end_of_early_ioremap_region ? 4162306a36Sopenharmony_ci __end_of_fixmap_region : __end_of_early_ioremap_region; 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define FIXMAP_PAGE_NORMAL (pgprot_kernel | L_PTE_XN) 4662306a36Sopenharmony_ci#define FIXMAP_PAGE_RO (FIXMAP_PAGE_NORMAL | L_PTE_RDONLY) 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/* Used by set_fixmap_(io|nocache), both meant for mapping a device */ 4962306a36Sopenharmony_ci#define FIXMAP_PAGE_IO (FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | L_PTE_SHARED) 5062306a36Sopenharmony_ci#define FIXMAP_PAGE_NOCACHE FIXMAP_PAGE_IO 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#define __early_set_fixmap __set_fixmap 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#ifdef CONFIG_MMU 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_civoid __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); 5762306a36Sopenharmony_civoid __init early_fixmap_init(void); 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#include <asm-generic/fixmap.h> 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#else 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_cistatic inline void early_fixmap_init(void) { } 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#endif 6662306a36Sopenharmony_ci#endif 67