Commit b13feb70 authored by Tony Luck's avatar Tony Luck

[IA64] cleanup contig/discontig/virt_mem_map macros

I got this patch from Zou Nan hai to resolve the problem that
Andrew Morton has been having booting his ia64 system.  The code
is quite a bit cleaner as he has reduced the number of different
definitions of pfn_valid/page_to_pfn/pfn_to_page, and left the
only remaining ones next to each other in page.h ... so this
should be easier to maintain going forward.
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 5ff874a2
...@@ -269,7 +269,6 @@ paging_init (void) ...@@ -269,7 +269,6 @@ paging_init (void)
vmem_map = (struct page *) 0; vmem_map = (struct page *) 0;
free_area_init_node(0, &contig_page_data, zones_size, 0, free_area_init_node(0, &contig_page_data, zones_size, 0,
zholes_size); zholes_size);
mem_map = contig_page_data.node_mem_map;
} else { } else {
unsigned long map_size; unsigned long map_size;
...@@ -280,11 +279,10 @@ paging_init (void) ...@@ -280,11 +279,10 @@ paging_init (void)
vmem_map = (struct page *) vmalloc_end; vmem_map = (struct page *) vmalloc_end;
efi_memmap_walk(create_mem_map_page_table, 0); efi_memmap_walk(create_mem_map_page_table, 0);
contig_page_data.node_mem_map = vmem_map; mem_map = contig_page_data.node_mem_map = vmem_map;
free_area_init_node(0, &contig_page_data, zones_size, free_area_init_node(0, &contig_page_data, zones_size,
0, zholes_size); 0, zholes_size);
mem_map = contig_page_data.node_mem_map;
printk("Virtual mem_map starts at 0x%p\n", mem_map); printk("Virtual mem_map starts at 0x%p\n", mem_map);
} }
#else /* !CONFIG_VIRTUAL_MEM_MAP */ #else /* !CONFIG_VIRTUAL_MEM_MAP */
......
...@@ -27,12 +27,6 @@ ...@@ -27,12 +27,6 @@
# define NR_NODE_MEMBLKS (NR_NODES * 4) # define NR_NODE_MEMBLKS (NR_NODES * 4)
#endif #endif
extern unsigned long max_low_pfn;
#define pfn_valid(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))
#else /* CONFIG_DISCONTIGMEM */ #else /* CONFIG_DISCONTIGMEM */
# define NR_NODE_MEMBLKS 4 # define NR_NODE_MEMBLKS 4
#endif /* CONFIG_DISCONTIGMEM */ #endif /* CONFIG_DISCONTIGMEM */
......
...@@ -84,17 +84,16 @@ extern int ia64_pfn_valid (unsigned long pfn); ...@@ -84,17 +84,16 @@ extern int ia64_pfn_valid (unsigned long pfn);
#endif #endif
#ifndef CONFIG_DISCONTIGMEM #ifndef CONFIG_DISCONTIGMEM
# ifdef CONFIG_VIRTUAL_MEM_MAP
extern struct page *vmem_map;
# define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
# define page_to_pfn(page) ((unsigned long) (page - vmem_map))
# define pfn_to_page(pfn) (vmem_map + (pfn))
# else
# define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn)) # define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
# define page_to_pfn(page) ((unsigned long) (page - mem_map)) # define page_to_pfn(page) ((unsigned long) (page - mem_map))
# define pfn_to_page(pfn) (mem_map + (pfn)) # define pfn_to_page(pfn) (mem_map + (pfn))
# endif #else
#endif /* CONFIG_DISCONTIGMEM */ extern struct page *vmem_map;
extern unsigned long max_low_pfn;
# define pfn_valid(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) #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment