aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-arm/memory.h')
-rw-r--r--include/asm-arm/memory.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index e47bea7d1723..a8a933a775db 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -160,12 +160,25 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
160#define page_to_pfn(page) \ 160#define page_to_pfn(page) \
161 (( (page) - page_zone(page)->zone_mem_map) \ 161 (( (page) - page_zone(page)->zone_mem_map) \
162 + page_zone(page)->zone_start_pfn) 162 + page_zone(page)->zone_start_pfn)
163
163#define pfn_to_page(pfn) \ 164#define pfn_to_page(pfn) \
164 (PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT)) 165 (PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT))
165#define pfn_valid(pfn) (PFN_TO_NID(pfn) < MAX_NUMNODES) 166
167#define pfn_valid(pfn) \
168 ({ \
169 unsigned int nid = PFN_TO_NID(pfn); \
170 int valid = nid < MAX_NUMNODES; \
171 if (valid) { \
172 pg_data_t *node = NODE_DATA(nid); \
173 valid = (pfn - node->node_start_pfn) < \
174 node->node_spanned_pages; \
175 } \
176 valid; \
177 })
166 178
167#define virt_to_page(kaddr) \ 179#define virt_to_page(kaddr) \
168 (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr)) 180 (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
181
169#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES) 182#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES)
170 183
171/* 184/*