Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_FIXMAP_H
0003 #define _ASM_FIXMAP_H
0004 
0005 #define FIXADDR_START       0xffc80000UL
0006 #define FIXADDR_END     0xfff00000UL
0007 #define FIXADDR_TOP     (FIXADDR_END - PAGE_SIZE)
0008 
0009 #include <linux/pgtable.h>
0010 #include <asm/kmap_size.h>
0011 
0012 enum fixed_addresses {
0013     FIX_EARLYCON_MEM_BASE,
0014     __end_of_permanent_fixed_addresses,
0015 
0016     FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses,
0017     FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,
0018 
0019     /* Support writing RO kernel text via kprobes, jump labels, etc. */
0020     FIX_TEXT_POKE0,
0021     FIX_TEXT_POKE1,
0022 
0023     __end_of_fixmap_region,
0024 
0025     /*
0026      * Share the kmap() region with early_ioremap(): this is guaranteed
0027      * not to clash since early_ioremap() is only available before
0028      * paging_init(), and kmap() only after.
0029      */
0030 #define NR_FIX_BTMAPS       32
0031 #define FIX_BTMAPS_SLOTS    7
0032 #define TOTAL_FIX_BTMAPS    (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
0033 
0034     FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
0035     FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
0036     __end_of_early_ioremap_region
0037 };
0038 
0039 static const enum fixed_addresses __end_of_fixed_addresses =
0040     __end_of_fixmap_region > __end_of_early_ioremap_region ?
0041     __end_of_fixmap_region : __end_of_early_ioremap_region;
0042 
0043 #define FIXMAP_PAGE_COMMON  (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY)
0044 
0045 #define FIXMAP_PAGE_NORMAL  (pgprot_kernel | L_PTE_XN)
0046 #define FIXMAP_PAGE_RO      (FIXMAP_PAGE_NORMAL | L_PTE_RDONLY)
0047 
0048 /* Used by set_fixmap_(io|nocache), both meant for mapping a device */
0049 #define FIXMAP_PAGE_IO      (FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | L_PTE_SHARED)
0050 #define FIXMAP_PAGE_NOCACHE FIXMAP_PAGE_IO
0051 
0052 #define __early_set_fixmap  __set_fixmap
0053 
0054 #ifdef CONFIG_MMU
0055 
0056 void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot);
0057 void __init early_fixmap_init(void);
0058 
0059 #include <asm-generic/fixmap.h>
0060 
0061 #else
0062 
0063 static inline void early_fixmap_init(void) { }
0064 
0065 #endif
0066 #endif