Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mm/cache-v3.S |
| 3 | * |
| 4 | * Copyright (C) 1997-2002 Russell king |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | #include <linux/linkage.h> |
| 11 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <asm/page.h> |
| 13 | #include "proc-macros.S" |
| 14 | |
| 15 | /* |
Mika Westerberg | c8c9086 | 2010-10-28 11:27:40 +0100 | [diff] [blame] | 16 | * flush_icache_all() |
| 17 | * |
| 18 | * Unconditionally clean and invalidate the entire icache. |
| 19 | */ |
| 20 | ENTRY(v3_flush_icache_all) |
| 21 | mov pc, lr |
| 22 | ENDPROC(v3_flush_icache_all) |
| 23 | |
| 24 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | * flush_user_cache_all() |
| 26 | * |
| 27 | * Invalidate all cache entries in a particular address |
| 28 | * space. |
| 29 | * |
| 30 | * - mm - mm_struct describing address space |
| 31 | */ |
| 32 | ENTRY(v3_flush_user_cache_all) |
| 33 | /* FALLTHROUGH */ |
| 34 | /* |
| 35 | * flush_kern_cache_all() |
| 36 | * |
| 37 | * Clean and invalidate the entire cache. |
| 38 | */ |
| 39 | ENTRY(v3_flush_kern_cache_all) |
| 40 | /* FALLTHROUGH */ |
| 41 | |
| 42 | /* |
| 43 | * flush_user_cache_range(start, end, flags) |
| 44 | * |
| 45 | * Invalidate a range of cache entries in the specified |
| 46 | * address space. |
| 47 | * |
| 48 | * - start - start address (may not be aligned) |
| 49 | * - end - end address (exclusive, may not be aligned) |
| 50 | * - flags - vma_area_struct flags describing address space |
| 51 | */ |
| 52 | ENTRY(v3_flush_user_cache_range) |
| 53 | mov ip, #0 |
| 54 | mcreq p15, 0, ip, c7, c0, 0 @ flush ID cache |
| 55 | mov pc, lr |
| 56 | |
| 57 | /* |
| 58 | * coherent_kern_range(start, end) |
| 59 | * |
| 60 | * Ensure coherency between the Icache and the Dcache in the |
| 61 | * region described by start. If you have non-snooping |
| 62 | * Harvard caches, you need to implement this function. |
| 63 | * |
| 64 | * - start - virtual start address |
| 65 | * - end - virtual end address |
| 66 | */ |
| 67 | ENTRY(v3_coherent_kern_range) |
| 68 | /* FALLTHROUGH */ |
| 69 | |
| 70 | /* |
| 71 | * coherent_user_range(start, end) |
| 72 | * |
| 73 | * Ensure coherency between the Icache and the Dcache in the |
| 74 | * region described by start. If you have non-snooping |
| 75 | * Harvard caches, you need to implement this function. |
| 76 | * |
| 77 | * - start - virtual start address |
| 78 | * - end - virtual end address |
| 79 | */ |
| 80 | ENTRY(v3_coherent_user_range) |
| 81 | mov pc, lr |
| 82 | |
| 83 | /* |
Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 84 | * flush_kern_dcache_area(void *page, size_t size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | * |
| 86 | * Ensure no D cache aliasing occurs, either with itself or |
| 87 | * the I cache |
| 88 | * |
Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 89 | * - addr - kernel address |
| 90 | * - size - region size |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | */ |
Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 92 | ENTRY(v3_flush_kern_dcache_area) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | /* FALLTHROUGH */ |
| 94 | |
| 95 | /* |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame^] | 96 | * dma_inv_range(start, end) |
| 97 | * |
| 98 | * Invalidate (discard) the specified virtual address range. |
| 99 | * May not write back any entries. If 'start' or 'end' |
| 100 | * are not cache line aligned, those lines must be written |
| 101 | * back. |
| 102 | * |
| 103 | * - start - virtual start address |
| 104 | * - end - virtual end address |
| 105 | */ |
| 106 | ENTRY(v3_dma_inv_range) |
| 107 | /* FALLTHROUGH */ |
| 108 | |
| 109 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | * dma_flush_range(start, end) |
| 111 | * |
| 112 | * Clean and invalidate the specified virtual address range. |
| 113 | * |
| 114 | * - start - virtual start address |
| 115 | * - end - virtual end address |
| 116 | */ |
| 117 | ENTRY(v3_dma_flush_range) |
| 118 | mov r0, #0 |
| 119 | mcr p15, 0, r0, c7, c0, 0 @ flush ID cache |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame^] | 120 | /* FALLTHROUGH */ |
| 121 | |
| 122 | /* |
| 123 | * dma_clean_range(start, end) |
| 124 | * |
| 125 | * Clean (write back) the specified virtual address range. |
| 126 | * |
| 127 | * - start - virtual start address |
| 128 | * - end - virtual end address |
| 129 | */ |
| 130 | ENTRY(v3_dma_clean_range) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | mov pc, lr |
| 132 | |
Russell King | a9c9147 | 2009-11-26 16:19:58 +0000 | [diff] [blame] | 133 | /* |
| 134 | * dma_unmap_area(start, size, dir) |
| 135 | * - start - kernel virtual start address |
| 136 | * - size - size of region |
| 137 | * - dir - DMA direction |
| 138 | */ |
| 139 | ENTRY(v3_dma_unmap_area) |
| 140 | teq r2, #DMA_TO_DEVICE |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame^] | 141 | bne v3_dma_inv_range |
Russell King | a9c9147 | 2009-11-26 16:19:58 +0000 | [diff] [blame] | 142 | /* FALLTHROUGH */ |
| 143 | |
| 144 | /* |
| 145 | * dma_map_area(start, size, dir) |
| 146 | * - start - kernel virtual start address |
| 147 | * - size - size of region |
| 148 | * - dir - DMA direction |
| 149 | */ |
| 150 | ENTRY(v3_dma_map_area) |
| 151 | mov pc, lr |
| 152 | ENDPROC(v3_dma_unmap_area) |
| 153 | ENDPROC(v3_dma_map_area) |
| 154 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | __INITDATA |
| 156 | |
| 157 | .type v3_cache_fns, #object |
| 158 | ENTRY(v3_cache_fns) |
Mika Westerberg | c8c9086 | 2010-10-28 11:27:40 +0100 | [diff] [blame] | 159 | .long v3_flush_icache_all |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | .long v3_flush_kern_cache_all |
| 161 | .long v3_flush_user_cache_all |
| 162 | .long v3_flush_user_cache_range |
| 163 | .long v3_coherent_kern_range |
| 164 | .long v3_coherent_user_range |
Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 165 | .long v3_flush_kern_dcache_area |
Russell King | a9c9147 | 2009-11-26 16:19:58 +0000 | [diff] [blame] | 166 | .long v3_dma_map_area |
| 167 | .long v3_dma_unmap_area |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame^] | 168 | .long v3_dma_inv_range |
| 169 | .long v3_dma_clean_range |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | .long v3_dma_flush_range |
| 171 | .size v3_cache_fns, . - v3_cache_fns |