Merge commit 'origin' into master
[pandora-kernel.git] / arch / sh / include / asm / mmzone.h
1 #ifndef __ASM_SH_MMZONE_H
2 #define __ASM_SH_MMZONE_H
3
4 #ifdef __KERNEL__
5
6 #ifdef CONFIG_NEED_MULTIPLE_NODES
7 #include <linux/numa.h>
8
9 extern struct pglist_data *node_data[];
10 #define NODE_DATA(nid)          (node_data[nid])
11
12 #define node_start_pfn(nid)     (NODE_DATA(nid)->node_start_pfn)
13 #define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn + \
14                                  NODE_DATA(nid)->node_spanned_pages)
15
16 static inline int pfn_to_nid(unsigned long pfn)
17 {
18         int nid;
19
20         for (nid = 0; nid < MAX_NUMNODES; nid++)
21                 if (pfn >= node_start_pfn(nid) && pfn <= node_end_pfn(nid))
22                         break;
23
24         return nid;
25 }
26
27 static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
28 {
29         return NODE_DATA(pfn_to_nid(pfn));
30 }
31
32 /* arch/sh/mm/numa.c */
33 void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end);
34 #else
35 static inline void
36 setup_bootmem_node(int nid, unsigned long start, unsigned long end)
37 {
38 }
39 #endif /* CONFIG_NEED_MULTIPLE_NODES */
40
41 /* Platform specific mem init */
42 void __init plat_mem_setup(void);
43
44 /* arch/sh/kernel/setup.c */
45 void __init setup_bootmem_allocator(unsigned long start_pfn);
46 void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
47                                unsigned long end_pfn);
48
49 #endif /* __KERNEL__ */
50 #endif /* __ASM_SH_MMZONE_H */