Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 1 | #ifndef _ASM_FIXMAP_H |
| 2 | #define _ASM_FIXMAP_H |
| 3 | |
Liu Hua | a05e54c | 2014-04-18 09:43:32 +0100 | [diff] [blame] | 4 | #define FIXADDR_START 0xffc00000UL |
Rob Herring | 836a241 | 2014-07-02 02:01:15 -0500 | [diff] [blame] | 5 | #define FIXADDR_END 0xfff00000UL |
Mark Salter | b615bbb | 2014-08-13 09:04:49 -0700 | [diff] [blame] | 6 | #define FIXADDR_TOP (FIXADDR_END - PAGE_SIZE) |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 7 | |
Mark Salter | b615bbb | 2014-08-13 09:04:49 -0700 | [diff] [blame] | 8 | #include <asm/kmap_types.h> |
Stefan Agner | a5f4c56 | 2015-08-13 00:01:52 +0100 | [diff] [blame] | 9 | #include <asm/pgtable.h> |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 10 | |
Mark Salter | b615bbb | 2014-08-13 09:04:49 -0700 | [diff] [blame] | 11 | enum fixed_addresses { |
Stefan Agner | a5f4c56 | 2015-08-13 00:01:52 +0100 | [diff] [blame] | 12 | FIX_EARLYCON_MEM_BASE, |
| 13 | __end_of_permanent_fixed_addresses, |
| 14 | |
| 15 | FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses, |
Mark Salter | b615bbb | 2014-08-13 09:04:49 -0700 | [diff] [blame] | 16 | FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1, |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 17 | |
Rabin Vincent | ab0615e | 2014-04-24 23:28:57 +0200 | [diff] [blame] | 18 | /* Support writing RO kernel text via kprobes, jump labels, etc. */ |
| 19 | FIX_TEXT_POKE0, |
| 20 | FIX_TEXT_POKE1, |
| 21 | |
Ard Biesheuvel | 2937367 | 2015-09-01 08:59:28 +0200 | [diff] [blame] | 22 | __end_of_fixmap_region, |
| 23 | |
| 24 | /* |
| 25 | * Share the kmap() region with early_ioremap(): this is guaranteed |
| 26 | * not to clash since early_ioremap() is only available before |
| 27 | * paging_init(), and kmap() only after. |
| 28 | */ |
| 29 | #define NR_FIX_BTMAPS 32 |
| 30 | #define FIX_BTMAPS_SLOTS 7 |
| 31 | #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) |
| 32 | |
| 33 | FIX_BTMAP_END = __end_of_permanent_fixed_addresses, |
| 34 | FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, |
| 35 | __end_of_early_ioremap_region |
Mark Salter | b615bbb | 2014-08-13 09:04:49 -0700 | [diff] [blame] | 36 | }; |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 37 | |
Ard Biesheuvel | 2937367 | 2015-09-01 08:59:28 +0200 | [diff] [blame] | 38 | static const enum fixed_addresses __end_of_fixed_addresses = |
| 39 | __end_of_fixmap_region > __end_of_early_ioremap_region ? |
| 40 | __end_of_fixmap_region : __end_of_early_ioremap_region; |
| 41 | |
Stefan Agner | a5f4c56 | 2015-08-13 00:01:52 +0100 | [diff] [blame] | 42 | #define FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY) |
| 43 | |
| 44 | #define FIXMAP_PAGE_NORMAL (FIXMAP_PAGE_COMMON | L_PTE_MT_WRITEBACK) |
Ard Biesheuvel | 2937367 | 2015-09-01 08:59:28 +0200 | [diff] [blame] | 45 | #define FIXMAP_PAGE_RO (FIXMAP_PAGE_NORMAL | L_PTE_RDONLY) |
Stefan Agner | a5f4c56 | 2015-08-13 00:01:52 +0100 | [diff] [blame] | 46 | |
| 47 | /* Used by set_fixmap_(io|nocache), both meant for mapping a device */ |
| 48 | #define FIXMAP_PAGE_IO (FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | L_PTE_SHARED) |
| 49 | #define FIXMAP_PAGE_NOCACHE FIXMAP_PAGE_IO |
| 50 | |
Ard Biesheuvel | 2937367 | 2015-09-01 08:59:28 +0200 | [diff] [blame] | 51 | #define __early_set_fixmap __set_fixmap |
| 52 | |
| 53 | #ifdef CONFIG_MMU |
| 54 | |
Kees Cook | 99b4ac9 | 2014-04-04 23:27:49 +0200 | [diff] [blame] | 55 | void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); |
Stefan Agner | a5f4c56 | 2015-08-13 00:01:52 +0100 | [diff] [blame] | 56 | void __init early_fixmap_init(void); |
Kees Cook | 99b4ac9 | 2014-04-04 23:27:49 +0200 | [diff] [blame] | 57 | |
Mark Salter | b615bbb | 2014-08-13 09:04:49 -0700 | [diff] [blame] | 58 | #include <asm-generic/fixmap.h> |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 59 | |
Ard Biesheuvel | 2937367 | 2015-09-01 08:59:28 +0200 | [diff] [blame] | 60 | #else |
| 61 | |
| 62 | static inline void early_fixmap_init(void) { } |
| 63 | |
| 64 | #endif |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 65 | #endif |