aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m32r/mmzone.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-m32r/mmzone.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-m32r/mmzone.h')
-rw-r--r--include/asm-m32r/mmzone.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/include/asm-m32r/mmzone.h b/include/asm-m32r/mmzone.h
new file mode 100644
index 000000000000..ebf0228fec42
--- /dev/null
+++ b/include/asm-m32r/mmzone.h
@@ -0,0 +1,80 @@
1/*
2 * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
3 *
4 */
5
6#ifndef _ASM_MMZONE_H_
7#define _ASM_MMZONE_H_
8
9#include <asm/smp.h>
10
11#ifdef CONFIG_DISCONTIGMEM
12
13extern struct pglist_data *node_data[];
14#define NODE_DATA(nid) (node_data[nid])
15
16#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
17#define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map)
18#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
19#define node_end_pfn(nid) \
20({ \
21 pg_data_t *__pgdat = NODE_DATA(nid); \
22 __pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \
23})
24
25#define local_mapnr(kvaddr) \
26({ \
27 unsigned long __pfn = __pa(kvaddr) >> PAGE_SHIFT; \
28 (__pfn - node_start_pfn(pfn_to_nid(__pfn))); \
29})
30
31#define pfn_to_page(pfn) \
32({ \
33 unsigned long __pfn = pfn; \
34 int __node = pfn_to_nid(__pfn); \
35 &node_mem_map(__node)[node_localnr(__pfn,__node)]; \
36})
37
38#define page_to_pfn(pg) \
39({ \
40 struct page *__page = pg; \
41 struct zone *__zone = page_zone(__page); \
42 (unsigned long)(__page - __zone->zone_mem_map) \
43 + __zone->zone_start_pfn; \
44})
45#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
46/*
47 * pfn_valid should be made as fast as possible, and the current definition
48 * is valid for machines that are NUMA, but still contiguous, which is what
49 * is currently supported. A more generalised, but slower definition would
50 * be something like this - mbligh:
51 * ( pfn_to_pgdat(pfn) && ((pfn) < node_end_pfn(pfn_to_nid(pfn))) )
52 */
53#if 1 /* M32R_FIXME */
54#define pfn_valid(pfn) (1)
55#else
56#define pfn_valid(pfn) ((pfn) < num_physpages)
57#endif
58
59/*
60 * generic node memory support, the following assumptions apply:
61 */
62
63static __inline__ int pfn_to_nid(unsigned long pfn)
64{
65 int node;
66
67 for (node = 0 ; node < MAX_NUMNODES ; node++)
68 if (pfn >= node_start_pfn(node) && pfn <= node_end_pfn(node))
69 break;
70
71 return node;
72}
73
74static __inline__ struct pglist_data *pfn_to_pgdat(unsigned long pfn)
75{
76 return(NODE_DATA(pfn_to_nid(pfn)));
77}
78
79#endif /* CONFIG_DISCONTIGMEM */
80#endif /* _ASM_MMZONE_H_ */