diff options
Diffstat (limited to 'include/asm-i386')
-rw-r--r-- | include/asm-i386/mmzone.h | 89 | ||||
-rw-r--r-- | include/asm-i386/page.h | 4 | ||||
-rw-r--r-- | include/asm-i386/pgtable.h | 4 | ||||
-rw-r--r-- | include/asm-i386/sparsemem.h | 31 |
4 files changed, 83 insertions, 45 deletions
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 48e46d403aa6..33ce5d37e894 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h | |||
@@ -8,7 +8,9 @@ | |||
8 | 8 | ||
9 | #include <asm/smp.h> | 9 | #include <asm/smp.h> |
10 | 10 | ||
11 | #ifdef CONFIG_DISCONTIGMEM | 11 | #if CONFIG_NUMA |
12 | extern struct pglist_data *node_data[]; | ||
13 | #define NODE_DATA(nid) (node_data[nid]) | ||
12 | 14 | ||
13 | #ifdef CONFIG_NUMA | 15 | #ifdef CONFIG_NUMA |
14 | #ifdef CONFIG_X86_NUMAQ | 16 | #ifdef CONFIG_X86_NUMAQ |
@@ -21,8 +23,28 @@ | |||
21 | #define get_zholes_size(n) (0) | 23 | #define get_zholes_size(n) (0) |
22 | #endif /* CONFIG_NUMA */ | 24 | #endif /* CONFIG_NUMA */ |
23 | 25 | ||
24 | extern struct pglist_data *node_data[]; | 26 | extern int get_memcfg_numa_flat(void ); |
25 | #define NODE_DATA(nid) (node_data[nid]) | 27 | /* |
28 | * This allows any one NUMA architecture to be compiled | ||
29 | * for, and still fall back to the flat function if it | ||
30 | * fails. | ||
31 | */ | ||
32 | static inline void get_memcfg_numa(void) | ||
33 | { | ||
34 | #ifdef CONFIG_X86_NUMAQ | ||
35 | if (get_memcfg_numaq()) | ||
36 | return; | ||
37 | #elif CONFIG_ACPI_SRAT | ||
38 | if (get_memcfg_from_srat()) | ||
39 | return; | ||
40 | #endif | ||
41 | |||
42 | get_memcfg_numa_flat(); | ||
43 | } | ||
44 | |||
45 | #endif /* CONFIG_NUMA */ | ||
46 | |||
47 | #ifdef CONFIG_DISCONTIGMEM | ||
26 | 48 | ||
27 | /* | 49 | /* |
28 | * generic node memory support, the following assumptions apply: | 50 | * generic node memory support, the following assumptions apply: |
@@ -48,26 +70,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
48 | #endif | 70 | #endif |
49 | } | 71 | } |
50 | 72 | ||
51 | /* | ||
52 | * Following are macros that are specific to this numa platform. | ||
53 | */ | ||
54 | #define reserve_bootmem(addr, size) \ | ||
55 | reserve_bootmem_node(NODE_DATA(0), (addr), (size)) | ||
56 | #define alloc_bootmem(x) \ | ||
57 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
58 | #define alloc_bootmem_low(x) \ | ||
59 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) | ||
60 | #define alloc_bootmem_pages(x) \ | ||
61 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
62 | #define alloc_bootmem_low_pages(x) \ | ||
63 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
64 | #define alloc_bootmem_node(ignore, x) \ | ||
65 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
66 | #define alloc_bootmem_pages_node(ignore, x) \ | ||
67 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
68 | #define alloc_bootmem_low_pages_node(ignore, x) \ | ||
69 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
70 | |||
71 | #define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) | 73 | #define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) |
72 | 74 | ||
73 | /* | 75 | /* |
@@ -121,28 +123,33 @@ static inline int pfn_valid(int pfn) | |||
121 | return (pfn < node_end_pfn(nid)); | 123 | return (pfn < node_end_pfn(nid)); |
122 | return 0; | 124 | return 0; |
123 | } | 125 | } |
124 | #endif | 126 | #endif /* CONFIG_X86_NUMAQ */ |
127 | |||
128 | #endif /* CONFIG_DISCONTIGMEM */ | ||
129 | |||
130 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
125 | 131 | ||
126 | extern int get_memcfg_numa_flat(void ); | ||
127 | /* | 132 | /* |
128 | * This allows any one NUMA architecture to be compiled | 133 | * Following are macros that are specific to this numa platform. |
129 | * for, and still fall back to the flat function if it | ||
130 | * fails. | ||
131 | */ | 134 | */ |
132 | static inline void get_memcfg_numa(void) | 135 | #define reserve_bootmem(addr, size) \ |
133 | { | 136 | reserve_bootmem_node(NODE_DATA(0), (addr), (size)) |
134 | #ifdef CONFIG_X86_NUMAQ | 137 | #define alloc_bootmem(x) \ |
135 | if (get_memcfg_numaq()) | 138 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
136 | return; | 139 | #define alloc_bootmem_low(x) \ |
137 | #elif CONFIG_ACPI_SRAT | 140 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) |
138 | if (get_memcfg_from_srat()) | 141 | #define alloc_bootmem_pages(x) \ |
139 | return; | 142 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
140 | #endif | 143 | #define alloc_bootmem_low_pages(x) \ |
141 | 144 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | |
142 | get_memcfg_numa_flat(); | 145 | #define alloc_bootmem_node(ignore, x) \ |
143 | } | 146 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
147 | #define alloc_bootmem_pages_node(ignore, x) \ | ||
148 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
149 | #define alloc_bootmem_low_pages_node(ignore, x) \ | ||
150 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
144 | 151 | ||
145 | #endif /* CONFIG_DISCONTIGMEM */ | 152 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ |
146 | 153 | ||
147 | extern int early_pfn_to_nid(unsigned long pfn); | 154 | extern int early_pfn_to_nid(unsigned long pfn); |
148 | 155 | ||
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 8f3dded01bff..dea8f8e6d86e 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h | |||
@@ -137,11 +137,11 @@ extern int page_is_ram(unsigned long pagenr); | |||
137 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | 137 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) |
138 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | 138 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
139 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 139 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
140 | #ifndef CONFIG_DISCONTIGMEM | 140 | #ifdef CONFIG_FLATMEM |
141 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 141 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
142 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 142 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
143 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 143 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
144 | #endif /* !CONFIG_DISCONTIGMEM */ | 144 | #endif /* CONFIG_FLATMEM */ |
145 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 145 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
146 | 146 | ||
147 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 147 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index e9efe148fdf7..77c6497f416e 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h | |||
@@ -398,9 +398,9 @@ extern void noexec_setup(const char *str); | |||
398 | 398 | ||
399 | #endif /* !__ASSEMBLY__ */ | 399 | #endif /* !__ASSEMBLY__ */ |
400 | 400 | ||
401 | #ifndef CONFIG_DISCONTIGMEM | 401 | #ifdef CONFIG_FLATMEM |
402 | #define kern_addr_valid(addr) (1) | 402 | #define kern_addr_valid(addr) (1) |
403 | #endif /* !CONFIG_DISCONTIGMEM */ | 403 | #endif /* CONFIG_FLATMEM */ |
404 | 404 | ||
405 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ | 405 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ |
406 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) | 406 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) |
diff --git a/include/asm-i386/sparsemem.h b/include/asm-i386/sparsemem.h new file mode 100644 index 000000000000..cfeed990585f --- /dev/null +++ b/include/asm-i386/sparsemem.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _I386_SPARSEMEM_H | ||
2 | #define _I386_SPARSEMEM_H | ||
3 | #ifdef CONFIG_SPARSEMEM | ||
4 | |||
5 | /* | ||
6 | * generic non-linear memory support: | ||
7 | * | ||
8 | * 1) we will not split memory into more chunks than will fit into the | ||
9 | * flags field of the struct page | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * SECTION_SIZE_BITS 2^N: how big each section will be | ||
14 | * MAX_PHYSADDR_BITS 2^N: how much physical address space we have | ||
15 | * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space | ||
16 | */ | ||
17 | #ifdef CONFIG_X86_PAE | ||
18 | #define SECTION_SIZE_BITS 30 | ||
19 | #define MAX_PHYSADDR_BITS 36 | ||
20 | #define MAX_PHYSMEM_BITS 36 | ||
21 | #else | ||
22 | #define SECTION_SIZE_BITS 26 | ||
23 | #define MAX_PHYSADDR_BITS 32 | ||
24 | #define MAX_PHYSMEM_BITS 32 | ||
25 | #endif | ||
26 | |||
27 | /* XXX: FIXME -- wli */ | ||
28 | #define kern_addr_valid(kaddr) (0) | ||
29 | |||
30 | #endif /* CONFIG_SPARSEMEM */ | ||
31 | #endif /* _I386_SPARSEMEM_H */ | ||