[PATCH] unify pfn_to_page: i386 pfn_to_page
i386 can use generic funcs. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
a117e66ed4
commit
ad658b385e
|
@ -70,8 +70,6 @@ static inline int pfn_to_nid(unsigned long pfn)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Following are macros that each numa implmentation must define.
|
* Following are macros that each numa implmentation must define.
|
||||||
*/
|
*/
|
||||||
|
@ -86,21 +84,6 @@ static inline int pfn_to_nid(unsigned long pfn)
|
||||||
/* XXX: FIXME -- wli */
|
/* XXX: FIXME -- wli */
|
||||||
#define kern_addr_valid(kaddr) (0)
|
#define kern_addr_valid(kaddr) (0)
|
||||||
|
|
||||||
#define pfn_to_page(pfn) \
|
|
||||||
({ \
|
|
||||||
unsigned long __pfn = pfn; \
|
|
||||||
int __node = pfn_to_nid(__pfn); \
|
|
||||||
&NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define page_to_pfn(pg) \
|
|
||||||
({ \
|
|
||||||
struct page *__page = pg; \
|
|
||||||
struct zone *__zone = page_zone(__page); \
|
|
||||||
(unsigned long)(__page - __zone->zone_mem_map) \
|
|
||||||
+ __zone->zone_start_pfn; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#ifdef CONFIG_X86_NUMAQ /* we have contiguous memory on NUMA-Q */
|
#ifdef CONFIG_X86_NUMAQ /* we have contiguous memory on NUMA-Q */
|
||||||
#define pfn_valid(pfn) ((pfn) < num_physpages)
|
#define pfn_valid(pfn) ((pfn) < num_physpages)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -126,8 +126,6 @@ extern int page_is_ram(unsigned long pagenr);
|
||||||
#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
|
#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
|
||||||
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
|
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
|
||||||
#ifdef CONFIG_FLATMEM
|
#ifdef CONFIG_FLATMEM
|
||||||
#define pfn_to_page(pfn) (mem_map + (pfn))
|
|
||||||
#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
|
|
||||||
#define pfn_valid(pfn) ((pfn) < max_mapnr)
|
#define pfn_valid(pfn) ((pfn) < max_mapnr)
|
||||||
#endif /* CONFIG_FLATMEM */
|
#endif /* CONFIG_FLATMEM */
|
||||||
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
|
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
|
||||||
|
@ -141,6 +139,7 @@ extern int page_is_ram(unsigned long pagenr);
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
#include <asm-generic/memory_model.h>
|
||||||
#include <asm-generic/page.h>
|
#include <asm-generic/page.h>
|
||||||
|
|
||||||
#endif /* _I386_PAGE_H */
|
#endif /* _I386_PAGE_H */
|
||||||
|
|
Loading…
Reference in New Issue