diff options
Diffstat (limited to 'include/asm-arm/memory.h')
-rw-r--r-- | include/asm-arm/memory.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h index 91d536c215d7..d9bfb39adabf 100644 --- a/include/asm-arm/memory.h +++ b/include/asm-arm/memory.h | |||
@@ -215,6 +215,7 @@ static inline __deprecated void *bus_to_virt(unsigned long x) | |||
215 | * virt_addr_valid(k) indicates whether a virtual address is valid | 215 | * virt_addr_valid(k) indicates whether a virtual address is valid |
216 | */ | 216 | */ |
217 | #ifndef CONFIG_DISCONTIGMEM | 217 | #ifndef CONFIG_DISCONTIGMEM |
218 | |||
218 | #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET | 219 | #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET |
219 | #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr)) | 220 | #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr)) |
220 | 221 | ||
@@ -230,6 +231,7 @@ static inline __deprecated void *bus_to_virt(unsigned long x) | |||
230 | * around in memory. | 231 | * around in memory. |
231 | */ | 232 | */ |
232 | #include <linux/numa.h> | 233 | #include <linux/numa.h> |
234 | |||
233 | #define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn) | 235 | #define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn) |
234 | #define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT) | 236 | #define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT) |
235 | 237 | ||
@@ -256,6 +258,43 @@ static inline __deprecated void *bus_to_virt(unsigned long x) | |||
256 | */ | 258 | */ |
257 | #define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT) | 259 | #define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT) |
258 | 260 | ||
261 | /* | ||
262 | * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory | ||
263 | * and returns the mem_map of that node. | ||
264 | */ | ||
265 | #define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr)) | ||
266 | |||
267 | /* | ||
268 | * Given a page frame number, find the owning node of the memory | ||
269 | * and returns the mem_map of that node. | ||
270 | */ | ||
271 | #define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn)) | ||
272 | |||
273 | #ifdef NODE_MEM_SIZE_BITS | ||
274 | #define NODE_MEM_SIZE_MASK ((1 << NODE_MEM_SIZE_BITS) - 1) | ||
275 | |||
276 | /* | ||
277 | * Given a kernel address, find the home node of the underlying memory. | ||
278 | */ | ||
279 | #define KVADDR_TO_NID(addr) \ | ||
280 | (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MEM_SIZE_BITS) | ||
281 | |||
282 | /* | ||
283 | * Given a page frame number, convert it to a node id. | ||
284 | */ | ||
285 | #define PFN_TO_NID(pfn) \ | ||
286 | (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MEM_SIZE_BITS - PAGE_SHIFT)) | ||
287 | |||
288 | /* | ||
289 | * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory | ||
290 | * and returns the index corresponding to the appropriate page in the | ||
291 | * node's mem_map. | ||
292 | */ | ||
293 | #define LOCAL_MAP_NR(addr) \ | ||
294 | (((unsigned long)(addr) & NODE_MEM_SIZE_MASK) >> PAGE_SHIFT) | ||
295 | |||
296 | #endif /* NODE_MEM_SIZE_BITS */ | ||
297 | |||
259 | #endif /* !CONFIG_DISCONTIGMEM */ | 298 | #endif /* !CONFIG_DISCONTIGMEM */ |
260 | 299 | ||
261 | /* | 300 | /* |