diff options
Diffstat (limited to 'arch/arm/include/asm/memory.h')
-rw-r--r-- | arch/arm/include/asm/memory.h | 76 |
1 files changed, 10 insertions, 66 deletions
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 4312ee5e3d0b..23c2e8e5c0fa 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -124,6 +124,15 @@ | |||
124 | #endif /* !CONFIG_MMU */ | 124 | #endif /* !CONFIG_MMU */ |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * We fix the TCM memories max 32 KiB ITCM resp DTCM at these | ||
128 | * locations | ||
129 | */ | ||
130 | #ifdef CONFIG_HAVE_TCM | ||
131 | #define ITCM_OFFSET UL(0xfffe0000) | ||
132 | #define DTCM_OFFSET UL(0xfffe8000) | ||
133 | #endif | ||
134 | |||
135 | /* | ||
127 | * Physical vs virtual RAM address space conversion. These are | 136 | * Physical vs virtual RAM address space conversion. These are |
128 | * private definitions which should NOT be used outside memory.h | 137 | * private definitions which should NOT be used outside memory.h |
129 | * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. | 138 | * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. |
@@ -158,7 +167,7 @@ | |||
158 | #endif | 167 | #endif |
159 | 168 | ||
160 | #ifndef arch_adjust_zones | 169 | #ifndef arch_adjust_zones |
161 | #define arch_adjust_zones(node,size,holes) do { } while (0) | 170 | #define arch_adjust_zones(size,holes) do { } while (0) |
162 | #elif !defined(CONFIG_ZONE_DMA) | 171 | #elif !defined(CONFIG_ZONE_DMA) |
163 | #error "custom arch_adjust_zones() requires CONFIG_ZONE_DMA" | 172 | #error "custom arch_adjust_zones() requires CONFIG_ZONE_DMA" |
164 | #endif | 173 | #endif |
@@ -234,76 +243,11 @@ static inline __deprecated void *bus_to_virt(unsigned long x) | |||
234 | * virt_to_page(k) convert a _valid_ virtual address to struct page * | 243 | * virt_to_page(k) convert a _valid_ virtual address to struct page * |
235 | * virt_addr_valid(k) indicates whether a virtual address is valid | 244 | * virt_addr_valid(k) indicates whether a virtual address is valid |
236 | */ | 245 | */ |
237 | #ifndef CONFIG_DISCONTIGMEM | ||
238 | |||
239 | #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET | 246 | #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET |
240 | 247 | ||
241 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 248 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
242 | #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) | 249 | #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) |
243 | 250 | ||
244 | #define PHYS_TO_NID(addr) (0) | ||
245 | |||
246 | #else /* CONFIG_DISCONTIGMEM */ | ||
247 | |||
248 | /* | ||
249 | * This is more complex. We have a set of mem_map arrays spread | ||
250 | * around in memory. | ||
251 | */ | ||
252 | #include <linux/numa.h> | ||
253 | |||
254 | #define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn) | ||
255 | #define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT) | ||
256 | |||
257 | #define virt_to_page(kaddr) \ | ||
258 | (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr)) | ||
259 | |||
260 | #define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES) | ||
261 | |||
262 | /* | ||
263 | * Common discontigmem stuff. | ||
264 | * PHYS_TO_NID is used by the ARM kernel/setup.c | ||
265 | */ | ||
266 | #define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT) | ||
267 | |||
268 | /* | ||
269 | * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory | ||
270 | * and returns the mem_map of that node. | ||
271 | */ | ||
272 | #define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr)) | ||
273 | |||
274 | /* | ||
275 | * Given a page frame number, find the owning node of the memory | ||
276 | * and returns the mem_map of that node. | ||
277 | */ | ||
278 | #define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn)) | ||
279 | |||
280 | #ifdef NODE_MEM_SIZE_BITS | ||
281 | #define NODE_MEM_SIZE_MASK ((1 << NODE_MEM_SIZE_BITS) - 1) | ||
282 | |||
283 | /* | ||
284 | * Given a kernel address, find the home node of the underlying memory. | ||
285 | */ | ||
286 | #define KVADDR_TO_NID(addr) \ | ||
287 | (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MEM_SIZE_BITS) | ||
288 | |||
289 | /* | ||
290 | * Given a page frame number, convert it to a node id. | ||
291 | */ | ||
292 | #define PFN_TO_NID(pfn) \ | ||
293 | (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MEM_SIZE_BITS - PAGE_SHIFT)) | ||
294 | |||
295 | /* | ||
296 | * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory | ||
297 | * and returns the index corresponding to the appropriate page in the | ||
298 | * node's mem_map. | ||
299 | */ | ||
300 | #define LOCAL_MAP_NR(addr) \ | ||
301 | (((unsigned long)(addr) & NODE_MEM_SIZE_MASK) >> PAGE_SHIFT) | ||
302 | |||
303 | #endif /* NODE_MEM_SIZE_BITS */ | ||
304 | |||
305 | #endif /* !CONFIG_DISCONTIGMEM */ | ||
306 | |||
307 | /* | 251 | /* |
308 | * Optional coherency support. Currently used only by selected | 252 | * Optional coherency support. Currently used only by selected |
309 | * Intel XSC3-based systems. | 253 | * Intel XSC3-based systems. |