diff options
author | Johannes Weiner <jw@emlix.com> | 2009-03-04 10:21:30 -0500 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2009-04-03 02:41:08 -0400 |
commit | c947a585ab13f310c9223284dfd502790abd05f9 (patch) | |
tree | 1295ce0f825139326eb3d894eaddcf8027953e96 /arch/xtensa | |
parent | 264da9f708b130122d881fa4570d1cd618440a73 (diff) |
xtensa: cope with ram beginning at higher addresses
The current assumption of the memory code is that the first RAM PFN in
the system is 0.
Adjust the relevant code to play well with setups where memory starts
at higher addresses, indicated by PLATFORM_DEFAULT_MEM_START.
The new memory model looks like this:
+----------+--+----------------------+----------------+
| | | | |
| | | RAM | |
| | | | |
+----------+--+----------------------+----------------+
| | | | |
+- PFN 0 | +- min_low_pfn +- max_low_pfn +- max_pfn
|
+- ARCH_PFN_OFFSET
+- PLATFORM_DEFAULT_MEM_START >> PAGE_SIZE
The memory map contains pages starting from pfn ARCH_PFN_OFFSET up to
max_low_pfn. The only zone used right now will span exactly the same
region.
Usually, ARCH_PFN_OFFSET and min_low_pfn are the same value. Handle
them separately for robustness. Gapping pages will be in the memory
map but marked as reserved and won't be touched.
Signed-off-by: Johannes Weiner <jw@emlix.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa')
-rw-r--r-- | arch/xtensa/include/asm/page.h | 5 | ||||
-rw-r--r-- | arch/xtensa/mm/init.c | 10 |
2 files changed, 9 insertions, 6 deletions
diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h index 11f7dc2dbec7..a5a5d33c15d0 100644 --- a/arch/xtensa/include/asm/page.h +++ b/arch/xtensa/include/asm/page.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/processor.h> | 14 | #include <asm/processor.h> |
15 | #include <asm/types.h> | 15 | #include <asm/types.h> |
16 | #include <asm/cache.h> | 16 | #include <asm/cache.h> |
17 | #include <platform/hardware.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * Fixed TLB translations in the processor. | 20 | * Fixed TLB translations in the processor. |
@@ -150,9 +151,11 @@ extern void copy_user_page(void*, void*, unsigned long, struct page*); | |||
150 | * addresses. | 151 | * addresses. |
151 | */ | 152 | */ |
152 | 153 | ||
154 | #define ARCH_PFN_OFFSET (PLATFORM_DEFAULT_MEM_START >> PAGE_SHIFT) | ||
155 | |||
153 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) | 156 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) |
154 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) | 157 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) |
155 | #define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr) | 158 | #define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr) |
156 | #ifdef CONFIG_DISCONTIGMEM | 159 | #ifdef CONFIG_DISCONTIGMEM |
157 | # error CONFIG_DISCONTIGMEM not supported | 160 | # error CONFIG_DISCONTIGMEM not supported |
158 | #endif | 161 | #endif |
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index a534d52a57bd..6190988bba17 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c | |||
@@ -167,7 +167,7 @@ void __init paging_init(void) | |||
167 | 167 | ||
168 | /* All pages are DMA-able, so we put them all in the DMA zone. */ | 168 | /* All pages are DMA-able, so we put them all in the DMA zone. */ |
169 | 169 | ||
170 | zones_size[ZONE_DMA] = max_low_pfn; | 170 | zones_size[ZONE_DMA] = max_low_pfn - ARCH_PFN_OFFSET; |
171 | for (i = 1; i < MAX_NR_ZONES; i++) | 171 | for (i = 1; i < MAX_NR_ZONES; i++) |
172 | zones_size[i] = 0; | 172 | zones_size[i] = 0; |
173 | 173 | ||
@@ -179,7 +179,7 @@ void __init paging_init(void) | |||
179 | 179 | ||
180 | memset(swapper_pg_dir, 0, PAGE_SIZE); | 180 | memset(swapper_pg_dir, 0, PAGE_SIZE); |
181 | 181 | ||
182 | free_area_init(zones_size); | 182 | free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL); |
183 | } | 183 | } |
184 | 184 | ||
185 | /* | 185 | /* |
@@ -220,8 +220,8 @@ void __init mem_init(void) | |||
220 | unsigned long codesize, reservedpages, datasize, initsize; | 220 | unsigned long codesize, reservedpages, datasize, initsize; |
221 | unsigned long highmemsize, tmp, ram; | 221 | unsigned long highmemsize, tmp, ram; |
222 | 222 | ||
223 | max_mapnr = num_physpages = max_low_pfn; | 223 | max_mapnr = num_physpages = max_low_pfn - ARCH_PFN_OFFSET; |
224 | high_memory = (void *) __va(max_mapnr << PAGE_SHIFT); | 224 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); |
225 | highmemsize = 0; | 225 | highmemsize = 0; |
226 | 226 | ||
227 | #ifdef CONFIG_HIGHMEM | 227 | #ifdef CONFIG_HIGHMEM |
@@ -231,7 +231,7 @@ void __init mem_init(void) | |||
231 | totalram_pages += free_all_bootmem(); | 231 | totalram_pages += free_all_bootmem(); |
232 | 232 | ||
233 | reservedpages = ram = 0; | 233 | reservedpages = ram = 0; |
234 | for (tmp = 0; tmp < max_low_pfn; tmp++) { | 234 | for (tmp = 0; tmp < max_mapnr; tmp++) { |
235 | ram++; | 235 | ram++; |
236 | if (PageReserved(mem_map+tmp)) | 236 | if (PageReserved(mem_map+tmp)) |
237 | reservedpages++; | 237 | reservedpages++; |