Russell King | 3ff1559 | 2006-11-30 13:53:54 +0000 | [diff] [blame] | 1 | #ifdef CONFIG_MMU |
| 2 | |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 3 | /* the upper-most page table pointer */ |
Russell King | 1b2e2b7 | 2006-08-21 17:06:38 +0100 | [diff] [blame] | 4 | extern pmd_t *top_pmd; |
| 5 | |
Russell King | de27c30 | 2011-07-02 14:46:27 +0100 | [diff] [blame] | 6 | /* |
| 7 | * 0xffff8000 to 0xffffffff is reserved for any ARM architecture |
| 8 | * specific hacks for copying pages efficiently, while 0xffff4000 |
| 9 | * is reserved for VIPT aliasing flushing by generic code. |
| 10 | * |
| 11 | * Note that we don't allow VIPT aliasing caches with SMP. |
| 12 | */ |
| 13 | #define COPYPAGE_MINICACHE 0xffff8000 |
| 14 | #define COPYPAGE_V6_FROM 0xffff8000 |
| 15 | #define COPYPAGE_V6_TO 0xffffc000 |
| 16 | /* PFN alias flushing, for VIPT caches */ |
| 17 | #define FLUSH_ALIAS_START 0xffff4000 |
| 18 | |
Russell King | 67ece14 | 2011-07-02 15:20:44 +0100 | [diff] [blame] | 19 | static inline void set_top_pte(unsigned long va, pte_t pte) |
| 20 | { |
Russell King | 60db4fc | 2011-07-04 11:25:53 +0100 | [diff] [blame] | 21 | pte_t *ptep = pte_offset_kernel(top_pmd, va); |
| 22 | set_pte_ext(ptep, pte, 0); |
Russell King | 67ece14 | 2011-07-02 15:20:44 +0100 | [diff] [blame] | 23 | local_flush_tlb_kernel_page(va); |
| 24 | } |
| 25 | |
Russell King | 0d31fe4 | 2011-07-04 11:22:27 +0100 | [diff] [blame] | 26 | static inline pte_t get_top_pte(unsigned long va) |
| 27 | { |
Russell King | 60db4fc | 2011-07-04 11:25:53 +0100 | [diff] [blame] | 28 | pte_t *ptep = pte_offset_kernel(top_pmd, va); |
| 29 | return *ptep; |
Russell King | 0d31fe4 | 2011-07-04 11:22:27 +0100 | [diff] [blame] | 30 | } |
| 31 | |
Russell King | 1b2e2b7 | 2006-08-21 17:06:38 +0100 | [diff] [blame] | 32 | static inline pmd_t *pmd_off_k(unsigned long virt) |
| 33 | { |
Russell King | cc780af | 2011-05-26 19:50:30 +0100 | [diff] [blame] | 34 | return pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt); |
Russell King | 1b2e2b7 | 2006-08-21 17:06:38 +0100 | [diff] [blame] | 35 | } |
| 36 | |
Russell King | b29e9f5 | 2007-04-21 10:47:29 +0100 | [diff] [blame] | 37 | struct mem_type { |
Russell King | f6e3354 | 2010-11-16 00:22:09 +0000 | [diff] [blame] | 38 | pteval_t prot_pte; |
Catalin Marinas | 442e70c | 2011-09-05 17:51:56 +0100 | [diff] [blame] | 39 | pmdval_t prot_l1; |
| 40 | pmdval_t prot_sect; |
Russell King | b29e9f5 | 2007-04-21 10:47:29 +0100 | [diff] [blame] | 41 | unsigned int domain; |
| 42 | }; |
| 43 | |
| 44 | const struct mem_type *get_mem_type(unsigned int type); |
| 45 | |
Russell King | 7b0a100 | 2009-10-24 14:11:59 +0100 | [diff] [blame] | 46 | extern void __flush_dcache_page(struct address_space *mapping, struct page *page); |
| 47 | |
Nicolas Pitre | 576d2f2 | 2011-09-16 01:14:23 -0400 | [diff] [blame] | 48 | /* |
| 49 | * ARM specific vm_struct->flags bits. |
| 50 | */ |
| 51 | |
| 52 | /* (super)section-mapped I/O regions used by ioremap()/iounmap() */ |
| 53 | #define VM_ARM_SECTION_MAPPING 0x80000000 |
| 54 | |
| 55 | /* permanent static mappings from iotable_init() */ |
| 56 | #define VM_ARM_STATIC_MAPPING 0x40000000 |
| 57 | |
| 58 | /* mapping type (attributes) for permanent static mappings */ |
| 59 | #define VM_ARM_MTYPE(mt) ((mt) << 20) |
| 60 | #define VM_ARM_MTYPE_MASK (0x1f << 20) |
| 61 | |
Marek Szyprowski | e9da6e9 | 2012-07-30 09:11:33 +0200 | [diff] [blame] | 62 | /* consistent regions used by dma_alloc_attrs() */ |
| 63 | #define VM_ARM_DMA_CONSISTENT 0x20000000 |
| 64 | |
Russell King | 3ff1559 | 2006-11-30 13:53:54 +0000 | [diff] [blame] | 65 | #endif |
| 66 | |
Russell King | 022ae53 | 2011-07-08 21:26:59 +0100 | [diff] [blame] | 67 | #ifdef CONFIG_ZONE_DMA |
Marek Szyprowski | 4986e5c | 2012-06-06 12:05:01 +0200 | [diff] [blame] | 68 | extern phys_addr_t arm_dma_limit; |
Russell King | 022ae53 | 2011-07-08 21:26:59 +0100 | [diff] [blame] | 69 | #else |
Russell King | 09b2ad1 | 2012-07-05 13:11:31 +0100 | [diff] [blame] | 70 | #define arm_dma_limit ((phys_addr_t)~0) |
Russell King | 022ae53 | 2011-07-08 21:26:59 +0100 | [diff] [blame] | 71 | #endif |
| 72 | |
Marek Szyprowski | c790950 | 2011-12-29 13:09:51 +0100 | [diff] [blame] | 73 | extern phys_addr_t arm_lowmem_limit; |
| 74 | |
Russell King | 8d717a5 | 2010-05-22 19:47:18 +0100 | [diff] [blame] | 75 | void __init bootmem_init(void); |
Russell King | 2778f62 | 2010-07-09 16:27:52 +0100 | [diff] [blame] | 76 | void arm_mm_memblock_reserve(void); |
Marek Szyprowski | c790950 | 2011-12-29 13:09:51 +0100 | [diff] [blame] | 77 | void dma_contiguous_remap(void); |