diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-alpha/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-alpha/mmzone.h')
-rw-r--r-- | include/asm-alpha/mmzone.h | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h new file mode 100644 index 000000000000..726c150dcbe4 --- /dev/null +++ b/include/asm-alpha/mmzone.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99 | ||
3 | * Adapted for the alpha wildfire architecture Jan 2001. | ||
4 | */ | ||
5 | #ifndef _ASM_MMZONE_H_ | ||
6 | #define _ASM_MMZONE_H_ | ||
7 | |||
8 | #include <linux/config.h> | ||
9 | #include <asm/smp.h> | ||
10 | |||
11 | struct bootmem_data_t; /* stupid forward decl. */ | ||
12 | |||
13 | /* | ||
14 | * Following are macros that are specific to this numa platform. | ||
15 | */ | ||
16 | |||
17 | extern pg_data_t node_data[]; | ||
18 | |||
19 | #define alpha_pa_to_nid(pa) \ | ||
20 | (alpha_mv.pa_to_nid \ | ||
21 | ? alpha_mv.pa_to_nid(pa) \ | ||
22 | : (0)) | ||
23 | #define node_mem_start(nid) \ | ||
24 | (alpha_mv.node_mem_start \ | ||
25 | ? alpha_mv.node_mem_start(nid) \ | ||
26 | : (0UL)) | ||
27 | #define node_mem_size(nid) \ | ||
28 | (alpha_mv.node_mem_size \ | ||
29 | ? alpha_mv.node_mem_size(nid) \ | ||
30 | : ((nid) ? (0UL) : (~0UL))) | ||
31 | |||
32 | #define pa_to_nid(pa) alpha_pa_to_nid(pa) | ||
33 | #define NODE_DATA(nid) (&node_data[(nid)]) | ||
34 | |||
35 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) | ||
36 | |||
37 | #if 1 | ||
38 | #define PLAT_NODE_DATA_LOCALNR(p, n) \ | ||
39 | (((p) >> PAGE_SHIFT) - PLAT_NODE_DATA(n)->gendata.node_start_pfn) | ||
40 | #else | ||
41 | static inline unsigned long | ||
42 | PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | ||
43 | { | ||
44 | unsigned long temp; | ||
45 | temp = p >> PAGE_SHIFT; | ||
46 | return temp - PLAT_NODE_DATA(n)->gendata.node_start_pfn; | ||
47 | } | ||
48 | #endif | ||
49 | |||
50 | #ifdef CONFIG_DISCONTIGMEM | ||
51 | |||
52 | /* | ||
53 | * Following are macros that each numa implementation must define. | ||
54 | */ | ||
55 | |||
56 | /* | ||
57 | * Given a kernel address, find the home node of the underlying memory. | ||
58 | */ | ||
59 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | ||
60 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
61 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
62 | |||
63 | #define local_mapnr(kvaddr) \ | ||
64 | ((__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr))) | ||
65 | |||
66 | /* | ||
67 | * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory | ||
68 | * and returns the kaddr corresponding to first physical page in the | ||
69 | * node's mem_map. | ||
70 | */ | ||
71 | #define LOCAL_BASE_ADDR(kaddr) \ | ||
72 | ((unsigned long)__va(NODE_DATA(kvaddr_to_nid(kaddr))->node_start_pfn \ | ||
73 | << PAGE_SHIFT)) | ||
74 | |||
75 | /* XXX: FIXME -- wli */ | ||
76 | #define kern_addr_valid(kaddr) (0) | ||
77 | |||
78 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
79 | |||
80 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) | ||
81 | |||
82 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) | ||
83 | #define pte_pfn(pte) (pte_val(pte) >> 32) | ||
84 | |||
85 | #define mk_pte(page, pgprot) \ | ||
86 | ({ \ | ||
87 | pte_t pte; \ | ||
88 | unsigned long pfn; \ | ||
89 | \ | ||
90 | pfn = ((unsigned long)((page)-page_zone(page)->zone_mem_map)) << 32; \ | ||
91 | pfn += page_zone(page)->zone_start_pfn << 32; \ | ||
92 | pte_val(pte) = pfn | pgprot_val(pgprot); \ | ||
93 | \ | ||
94 | pte; \ | ||
95 | }) | ||
96 | |||
97 | #define pte_page(x) \ | ||
98 | ({ \ | ||
99 | unsigned long kvirt; \ | ||
100 | struct page * __xx; \ | ||
101 | \ | ||
102 | kvirt = (unsigned long)__va(pte_val(x) >> (32-PAGE_SHIFT)); \ | ||
103 | __xx = virt_to_page(kvirt); \ | ||
104 | \ | ||
105 | __xx; \ | ||
106 | }) | ||
107 | |||
108 | #define pfn_to_page(pfn) \ | ||
109 | ({ \ | ||
110 | unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \ | ||
111 | (node_mem_map(kvaddr_to_nid(kaddr)) + local_mapnr(kaddr)); \ | ||
112 | }) | ||
113 | |||
114 | #define page_to_pfn(page) \ | ||
115 | ((page) - page_zone(page)->zone_mem_map + \ | ||
116 | (page_zone(page)->zone_start_pfn)) | ||
117 | |||
118 | #define page_to_pa(page) \ | ||
119 | ((( (page) - page_zone(page)->zone_mem_map ) \ | ||
120 | + page_zone(page)->zone_start_pfn) << PAGE_SHIFT) | ||
121 | |||
122 | #define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT)) | ||
123 | #define pfn_valid(pfn) \ | ||
124 | (((pfn) - node_start_pfn(pfn_to_nid(pfn))) < \ | ||
125 | node_spanned_pages(pfn_to_nid(pfn))) \ | ||
126 | |||
127 | #define virt_addr_valid(kaddr) pfn_valid((__pa(kaddr) >> PAGE_SHIFT)) | ||
128 | |||
129 | #endif /* CONFIG_DISCONTIGMEM */ | ||
130 | |||
131 | #endif /* _ASM_MMZONE_H_ */ | ||