Move basic VIRTUAL_MEM_MAP code from IA64 to generic code This patch genericizes the IA64 VIRTUAL_MEM_MAP support. The VIRTUAL_MEM_MAP functions are simply a variation on CONFIG_FLATMEM so use the existing FLATMEM definitions rather than add to the multitude of existing definitions. mem_map can now point to a static array or to a virtually mapped array. Signed-off-by: Christoph Lameter Index: linux-2.6.18-mm3/include/asm-generic/memory_model.h =================================================================== --- linux-2.6.18-mm3.orig/include/asm-generic/memory_model.h 2006-10-04 21:13:01.000000000 -0700 +++ linux-2.6.18-mm3/include/asm-generic/memory_model.h 2006-10-04 21:13:53.000000000 -0700 @@ -4,7 +4,7 @@ #ifdef __KERNEL__ #ifndef __ASSEMBLY__ -#if defined(CONFIG_FLATMEM) +#if defined(CONFIG_FLATMEM) || defined(CONFIG_VIRTUAL_MEM_MAP) #ifndef ARCH_PFN_OFFSET #define ARCH_PFN_OFFSET (0UL) @@ -26,7 +26,7 @@ /* * supports 3 memory models. */ -#if defined(CONFIG_FLATMEM) +#if defined(CONFIG_FLATMEM) || defined(CONFIG_VIRTUAL_MEM_MAP) #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET)) #define __page_to_pfn(page) ((unsigned long)((page) - mem_map) + \ Index: linux-2.6.18-mm3/include/asm-ia64/page.h =================================================================== --- linux-2.6.18-mm3.orig/include/asm-ia64/page.h 2006-10-04 21:13:45.000000000 -0700 +++ linux-2.6.18-mm3/include/asm-ia64/page.h 2006-10-04 21:14:52.000000000 -0700 @@ -105,18 +105,7 @@ # define ia64_pfn_valid(pfn) 1 #endif -#ifdef CONFIG_VIRTUAL_MEM_MAP -extern struct page *mem_map; -#ifdef CONFIG_DISCONTIGMEM -# define page_to_pfn(page) ((unsigned long) (page - mem_map)) -# define pfn_to_page(pfn) (mem_map + (pfn)) -#endif -#endif - -#if defined(CONFIG_FLATMEM) || defined(CONFIG_SPARSEMEM) -/* FLATMEM always configures mem_map */ #include -#endif #ifdef CONFIG_FLATMEM # define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn)) Index: linux-2.6.18-mm3/include/linux/mmzone.h =================================================================== --- linux-2.6.18-mm3.orig/include/linux/mmzone.h 2006-10-04 21:13:01.000000000 -0700 +++ linux-2.6.18-mm3/include/linux/mmzone.h 2006-10-04 21:13:53.000000000 -0700 @@ -338,7 +338,7 @@ }; #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ -#ifndef CONFIG_DISCONTIGMEM +#if defined(CONFIG_VIRTUAL_MEM_MAP) || !defined(CONFIG_DISCONTIGMEM) /* The array of struct pages - for discontigmem use pgdat->lmem_map */ extern struct page *mem_map; #endif