aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2006-03-27 04:15:36 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:44 -0500
commit1c05dda2b6f025267ab79a267e0a84628a3760e1 (patch)
treed392ca5462102bdbf8504263e22b699ae2e6a3d3
parent659e35051b165fb40f1160190c2d23f3d5c319d5 (diff)
[PATCH] unify pfn_to_page: alpha pfn_to_page
Alpha can use generic funcs. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/asm-alpha/mmzone.h16
-rw-r--r--include/asm-alpha/page.h4
2 files changed, 2 insertions, 18 deletions
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h
index a011ef4cf3d3..c9004398f273 100644
--- a/include/asm-alpha/mmzone.h
+++ b/include/asm-alpha/mmzone.h
@@ -59,9 +59,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
59#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) 59#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
60#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 60#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
61 61
62#define local_mapnr(kvaddr) \
63 ((__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)))
64
65/* 62/*
66 * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory 63 * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory
67 * and returns the kaddr corresponding to first physical page in the 64 * and returns the kaddr corresponding to first physical page in the
@@ -104,19 +101,8 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
104 __xx; \ 101 __xx; \
105}) 102})
106 103
107#define pfn_to_page(pfn) \
108({ \
109 unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \
110 (NODE_DATA(kvaddr_to_nid(kaddr))->node_mem_map + local_mapnr(kaddr)); \
111})
112
113#define page_to_pfn(page) \
114 ((page) - page_zone(page)->zone_mem_map + \
115 (page_zone(page)->zone_start_pfn))
116
117#define page_to_pa(page) \ 104#define page_to_pa(page) \
118 ((( (page) - page_zone(page)->zone_mem_map ) \ 105 (page_to_pfn(page) << PAGE_SHIFT)
119 + page_zone(page)->zone_start_pfn) << PAGE_SHIFT)
120 106
121#define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT)) 107#define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT))
122#define pfn_valid(pfn) \ 108#define pfn_valid(pfn) \
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index fa0b41b164a7..61bcf70b5eac 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -85,8 +85,6 @@ typedef unsigned long pgprot_t;
85#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 85#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
86#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 86#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
87#ifndef CONFIG_DISCONTIGMEM 87#ifndef CONFIG_DISCONTIGMEM
88#define pfn_to_page(pfn) (mem_map + (pfn))
89#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
90#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 88#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
91 89
92#define pfn_valid(pfn) ((pfn) < max_mapnr) 90#define pfn_valid(pfn) ((pfn) < max_mapnr)
@@ -95,9 +93,9 @@ typedef unsigned long pgprot_t;
95 93
96#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 94#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
97 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 95 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
98
99#endif /* __KERNEL__ */ 96#endif /* __KERNEL__ */
100 97
98#include <asm-generic/memory_model.h>
101#include <asm-generic/page.h> 99#include <asm-generic/page.h>
102 100
103#endif /* _ALPHA_PAGE_H */ 101#endif /* _ALPHA_PAGE_H */