[CONNECTOR]: Update documentation to match reality.
[linux-2.6/verdex.git] / include / asm-m32r / mmzone.h
blobd58878ec899ed005ae3863be23f3e8edb4b383ae
1 /*
2 * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
4 */
6 #ifndef _ASM_MMZONE_H_
7 #define _ASM_MMZONE_H_
9 #include <asm/smp.h>
11 #ifdef CONFIG_DISCONTIGMEM
13 extern struct pglist_data *node_data[];
14 #define NODE_DATA(nid) (node_data[nid])
16 #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
17 #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
18 #define node_end_pfn(nid) \
19 ({ \
20 pg_data_t *__pgdat = NODE_DATA(nid); \
21 __pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \
24 #define local_mapnr(kvaddr) \
25 ({ \
26 unsigned long __pfn = __pa(kvaddr) >> PAGE_SHIFT; \
27 (__pfn - node_start_pfn(pfn_to_nid(__pfn))); \
30 #define pfn_to_page(pfn) \
31 ({ \
32 unsigned long __pfn = pfn; \
33 int __node = pfn_to_nid(__pfn); \
34 &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \
37 #define page_to_pfn(pg) \
38 ({ \
39 struct page *__page = pg; \
40 struct zone *__zone = page_zone(__page); \
41 (unsigned long)(__page - __zone->zone_mem_map) \
42 + __zone->zone_start_pfn; \
44 #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
46 * pfn_valid should be made as fast as possible, and the current definition
47 * is valid for machines that are NUMA, but still contiguous, which is what
48 * is currently supported. A more generalised, but slower definition would
49 * be something like this - mbligh:
50 * ( pfn_to_pgdat(pfn) && ((pfn) < node_end_pfn(pfn_to_nid(pfn))) )
52 #if 1 /* M32R_FIXME */
53 #define pfn_valid(pfn) (1)
54 #else
55 #define pfn_valid(pfn) ((pfn) < num_physpages)
56 #endif
59 * generic node memory support, the following assumptions apply:
62 static __inline__ int pfn_to_nid(unsigned long pfn)
64 int node;
66 for (node = 0 ; node < MAX_NUMNODES ; node++)
67 if (pfn >= node_start_pfn(node) && pfn <= node_end_pfn(node))
68 break;
70 return node;
73 static __inline__ struct pglist_data *pfn_to_pgdat(unsigned long pfn)
75 return(NODE_DATA(pfn_to_nid(pfn)));
78 #endif /* CONFIG_DISCONTIGMEM */
79 #endif /* _ASM_MMZONE_H_ */