Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * fixmap.h: compile-time virtual memory allocation
0003  *
0004  * This file is subject to the terms and conditions of the GNU General Public
0005  * License.  See the file "COPYING" in the main directory of this archive
0006  * for more details.
0007  *
0008  * Copyright (C) 1998 Ingo Molnar
0009  * Copyright (C) 2013 Mark Salter <msalter@redhat.com>
0010  *
0011  * Adapted from arch/x86 version.
0012  *
0013  */
0014 
0015 #ifndef _ASM_ARM64_FIXMAP_H
0016 #define _ASM_ARM64_FIXMAP_H
0017 
0018 #ifndef __ASSEMBLY__
0019 #include <linux/kernel.h>
0020 #include <linux/sizes.h>
0021 #include <asm/boot.h>
0022 #include <asm/page.h>
0023 #include <asm/pgtable-prot.h>
0024 
0025 /*
0026  * Here we define all the compile-time 'special' virtual
0027  * addresses. The point is to have a constant address at
0028  * compile time, but to set the physical address only
0029  * in the boot process.
0030  *
0031  * Each enum increment in these 'compile-time allocated'
0032  * memory buffers is page-sized. Use set_fixmap(idx,phys)
0033  * to associate physical memory with a fixmap index.
0034  */
0035 enum fixed_addresses {
0036     FIX_HOLE,
0037 
0038     /*
0039      * Reserve a virtual window for the FDT that is 2 MB larger than the
0040      * maximum supported size, and put it at the top of the fixmap region.
0041      * The additional space ensures that any FDT that does not exceed
0042      * MAX_FDT_SIZE can be mapped regardless of whether it crosses any
0043      * 2 MB alignment boundaries.
0044      *
0045      * Keep this at the top so it remains 2 MB aligned.
0046      */
0047 #define FIX_FDT_SIZE        (MAX_FDT_SIZE + SZ_2M)
0048     FIX_FDT_END,
0049     FIX_FDT = FIX_FDT_END + FIX_FDT_SIZE / PAGE_SIZE - 1,
0050 
0051     FIX_EARLYCON_MEM_BASE,
0052     FIX_TEXT_POKE0,
0053 
0054 #ifdef CONFIG_ACPI_APEI_GHES
0055     /* Used for GHES mapping from assorted contexts */
0056     FIX_APEI_GHES_IRQ,
0057     FIX_APEI_GHES_SEA,
0058 #ifdef CONFIG_ARM_SDE_INTERFACE
0059     FIX_APEI_GHES_SDEI_NORMAL,
0060     FIX_APEI_GHES_SDEI_CRITICAL,
0061 #endif
0062 #endif /* CONFIG_ACPI_APEI_GHES */
0063 
0064 #ifdef CONFIG_UNMAP_KERNEL_AT_EL0
0065 #ifdef CONFIG_RELOCATABLE
0066     FIX_ENTRY_TRAMP_TEXT4,  /* one extra slot for the data page */
0067 #endif
0068     FIX_ENTRY_TRAMP_TEXT3,
0069     FIX_ENTRY_TRAMP_TEXT2,
0070     FIX_ENTRY_TRAMP_TEXT1,
0071 #define TRAMP_VALIAS        (__fix_to_virt(FIX_ENTRY_TRAMP_TEXT1))
0072 #endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */
0073     __end_of_permanent_fixed_addresses,
0074 
0075     /*
0076      * Temporary boot-time mappings, used by early_ioremap(),
0077      * before ioremap() is functional.
0078      */
0079 #define NR_FIX_BTMAPS       (SZ_256K / PAGE_SIZE)
0080 #define FIX_BTMAPS_SLOTS    7
0081 #define TOTAL_FIX_BTMAPS    (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
0082 
0083     FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
0084     FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
0085 
0086     /*
0087      * Used for kernel page table creation, so unmapped memory may be used
0088      * for tables.
0089      */
0090     FIX_PTE,
0091     FIX_PMD,
0092     FIX_PUD,
0093     FIX_PGD,
0094 
0095     __end_of_fixed_addresses
0096 };
0097 
0098 #define FIXADDR_SIZE    (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
0099 #define FIXADDR_START   (FIXADDR_TOP - FIXADDR_SIZE)
0100 
0101 #define FIXMAP_PAGE_IO     __pgprot(PROT_DEVICE_nGnRE)
0102 
0103 void __init early_fixmap_init(void);
0104 
0105 #define __early_set_fixmap __set_fixmap
0106 
0107 #define __late_set_fixmap __set_fixmap
0108 #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
0109 
0110 extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot);
0111 
0112 #include <asm-generic/fixmap.h>
0113 
0114 #endif /* !__ASSEMBLY__ */
0115 #endif /* _ASM_ARM64_FIXMAP_H */