2 * linux/include/asm-sh/mmzone.h
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 #ifndef __ASM_SH_MMZONE_H
9 #define __ASM_SH_MMZONE_H
11 #include <linux/config.h>
13 #ifdef CONFIG_DISCONTIGMEM
15 /* Currently, just for HP690 */
16 #define PHYSADDR_TO_NID(phys) ((((phys) - __MEMORY_START) >= 0x01000000)?1:0)
18 extern pg_data_t discontig_page_data[MAX_NUMNODES];
19 extern bootmem_data_t discontig_node_bdata[MAX_NUMNODES];
22 * Following are macros that each numa implmentation must define.
26 * Given a kernel address, find the home node of the underlying memory.
28 #define KVADDR_TO_NID(kaddr) PHYSADDR_TO_NID(__pa(kaddr))
31 * Return a pointer to the node data for node n.
33 #define NODE_DATA(nid) (&discontig_page_data[nid])
36 * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
38 #define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
40 #define phys_to_page(phys) \
41 ({ unsigned int node = PHYSADDR_TO_NID(phys); \
43 + (((phys) - NODE_DATA(node)->node_start_paddr) >> PAGE_SHIFT); })
45 static inline int is_valid_page(struct page *page)
49 for (i = 0; i < MAX_NUMNODES; i++) {
50 if (page >= NODE_MEM_MAP(i) &&
51 page < NODE_MEM_MAP(i) + NODE_DATA(i)->node_size)
57 #define VALID_PAGE(page) is_valid_page(page)
58 #define page_to_phys(page) PHYSADDR(page_address(page))
60 #endif /* CONFIG_DISCONTIGMEM */