Re: [PATCH] unify pfn_to_page take3 [23/23] ia64 pfn_to_page
From: KAMEZAWA Hiroyuki
Date: Thu Feb 23 2006 - 06:06:19 EST
KAMEZAWA Hiroyuki wrote:
ia64 has special config CONFIG_VIRTUAL_MEM_MAP.
This vesion had a BUG. This is fixed one.
--Kame
ia64 has special config CONFIG_VIRTUAL_MEM_MAP.
CONFIG_DISCONTIGMEM=y && CONFIG_VIRTUAL_MEM_MAP!=y is bug ?
Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Index: unify_page_to_pfn/include/asm-ia64/page.h
===================================================================
--- unify_page_to_pfn.orig/include/asm-ia64/page.h
+++ unify_page_to_pfn/include/asm-ia64/page.h
@@ -104,17 +104,25 @@ extern int ia64_pfn_valid (unsigned long
# define ia64_pfn_valid(pfn) 1
#endif
+#ifdef CONFIG_VIRTUAL_MEM_MAP
+extern struct page *vmem_map;
+#ifdef CONFIG_DISCONTIGMEM
+# define page_to_pfn(page) ((unsigned long) (page - vmem_map))
+# define pfn_to_page(pfn) (vmem_map + (pfn))
+#endif
+#endif
+
+#if defined(CONFIG_FLATMEM) || defined(CONFIG_SPARSEMEM)
+/* FLATMEM always configures mem_map (mem_map = vmem_map if necessary) */
+#include <asm-generic/memory_model.h>
+#endif
+
#ifdef CONFIG_FLATMEM
# define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
-# define page_to_pfn(page) ((unsigned long) (page - mem_map))
-# define pfn_to_page(pfn) (mem_map + (pfn))
#elif defined(CONFIG_DISCONTIGMEM)
-extern struct page *vmem_map;
extern unsigned long min_low_pfn;
extern unsigned long max_low_pfn;
# define pfn_valid(pfn) (((pfn) >= min_low_pfn) && ((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
-# define page_to_pfn(page) ((unsigned long) (page - vmem_map))
-# define pfn_to_page(pfn) (vmem_map + (pfn))
#endif
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)