diff options
-rw-r--r-- | arch/mips/kernel/setup.c | 36 | ||||
-rw-r--r-- | arch/mips/mm/init.c | 23 | ||||
-rw-r--r-- | include/asm-mips/dma.h | 1 |
3 files changed, 39 insertions, 21 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 89440a0d8528..f352cd9c834b 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -271,8 +271,7 @@ static void __init bootmem_init(void) | |||
271 | static void __init bootmem_init(void) | 271 | static void __init bootmem_init(void) |
272 | { | 272 | { |
273 | unsigned long reserved_end; | 273 | unsigned long reserved_end; |
274 | unsigned long highest = 0; | 274 | unsigned long mapstart = ~0UL; |
275 | unsigned long mapstart = -1UL; | ||
276 | unsigned long bootmap_size; | 275 | unsigned long bootmap_size; |
277 | int i; | 276 | int i; |
278 | 277 | ||
@@ -284,6 +283,13 @@ static void __init bootmem_init(void) | |||
284 | reserved_end = max(init_initrd(), PFN_UP(__pa_symbol(&_end))); | 283 | reserved_end = max(init_initrd(), PFN_UP(__pa_symbol(&_end))); |
285 | 284 | ||
286 | /* | 285 | /* |
286 | * max_low_pfn is not a number of pages. The number of pages | ||
287 | * of the system is given by 'max_low_pfn - min_low_pfn'. | ||
288 | */ | ||
289 | min_low_pfn = ~0UL; | ||
290 | max_low_pfn = 0; | ||
291 | |||
292 | /* | ||
287 | * Find the highest page frame number we have available. | 293 | * Find the highest page frame number we have available. |
288 | */ | 294 | */ |
289 | for (i = 0; i < boot_mem_map.nr_map; i++) { | 295 | for (i = 0; i < boot_mem_map.nr_map; i++) { |
@@ -296,8 +302,10 @@ static void __init bootmem_init(void) | |||
296 | end = PFN_DOWN(boot_mem_map.map[i].addr | 302 | end = PFN_DOWN(boot_mem_map.map[i].addr |
297 | + boot_mem_map.map[i].size); | 303 | + boot_mem_map.map[i].size); |
298 | 304 | ||
299 | if (end > highest) | 305 | if (end > max_low_pfn) |
300 | highest = end; | 306 | max_low_pfn = end; |
307 | if (start < min_low_pfn) | ||
308 | min_low_pfn = start; | ||
301 | if (end <= reserved_end) | 309 | if (end <= reserved_end) |
302 | continue; | 310 | continue; |
303 | if (start >= mapstart) | 311 | if (start >= mapstart) |
@@ -305,22 +313,32 @@ static void __init bootmem_init(void) | |||
305 | mapstart = max(reserved_end, start); | 313 | mapstart = max(reserved_end, start); |
306 | } | 314 | } |
307 | 315 | ||
316 | if (min_low_pfn >= max_low_pfn) | ||
317 | panic("Incorrect memory mapping !!!"); | ||
318 | if (min_low_pfn > 0) { | ||
319 | printk(KERN_INFO | ||
320 | "Wasting %lu bytes for tracking %lu unused pages\n", | ||
321 | min_low_pfn * sizeof(struct page), | ||
322 | min_low_pfn); | ||
323 | min_low_pfn = 0; | ||
324 | } | ||
325 | |||
308 | /* | 326 | /* |
309 | * Determine low and high memory ranges | 327 | * Determine low and high memory ranges |
310 | */ | 328 | */ |
311 | if (highest > PFN_DOWN(HIGHMEM_START)) { | 329 | if (max_low_pfn > PFN_DOWN(HIGHMEM_START)) { |
312 | #ifdef CONFIG_HIGHMEM | 330 | #ifdef CONFIG_HIGHMEM |
313 | highstart_pfn = PFN_DOWN(HIGHMEM_START); | 331 | highstart_pfn = PFN_DOWN(HIGHMEM_START); |
314 | highend_pfn = highest; | 332 | highend_pfn = max_low_pfn; |
315 | #endif | 333 | #endif |
316 | highest = PFN_DOWN(HIGHMEM_START); | 334 | max_low_pfn = PFN_DOWN(HIGHMEM_START); |
317 | } | 335 | } |
318 | 336 | ||
319 | /* | 337 | /* |
320 | * Initialize the boot-time allocator with low memory only. | 338 | * Initialize the boot-time allocator with low memory only. |
321 | */ | 339 | */ |
322 | bootmap_size = init_bootmem(mapstart, highest); | 340 | bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart, |
323 | 341 | min_low_pfn, max_low_pfn); | |
324 | /* | 342 | /* |
325 | * Register fully available low RAM pages with the bootmem allocator. | 343 | * Register fully available low RAM pages with the bootmem allocator. |
326 | */ | 344 | */ |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index fb427dbfe71e..5257f7b42fd2 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -341,7 +341,6 @@ static int __init page_is_ram(unsigned long pagenr) | |||
341 | void __init paging_init(void) | 341 | void __init paging_init(void) |
342 | { | 342 | { |
343 | unsigned long zones_size[MAX_NR_ZONES] = { 0, }; | 343 | unsigned long zones_size[MAX_NR_ZONES] = { 0, }; |
344 | unsigned long max_dma, low; | ||
345 | #ifndef CONFIG_FLATMEM | 344 | #ifndef CONFIG_FLATMEM |
346 | unsigned long zholes_size[MAX_NR_ZONES] = { 0, }; | 345 | unsigned long zholes_size[MAX_NR_ZONES] = { 0, }; |
347 | unsigned long i, j, pfn; | 346 | unsigned long i, j, pfn; |
@@ -354,19 +353,19 @@ void __init paging_init(void) | |||
354 | #endif | 353 | #endif |
355 | kmap_coherent_init(); | 354 | kmap_coherent_init(); |
356 | 355 | ||
357 | max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; | ||
358 | low = max_low_pfn; | ||
359 | |||
360 | #ifdef CONFIG_ISA | 356 | #ifdef CONFIG_ISA |
361 | if (low < max_dma) | 357 | if (max_low_pfn >= MAX_DMA_PFN) |
362 | zones_size[ZONE_DMA] = low; | 358 | if (min_low_pfn >= MAX_DMA_PFN) { |
363 | else { | 359 | zones_size[ZONE_DMA] = 0; |
364 | zones_size[ZONE_DMA] = max_dma; | 360 | zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; |
365 | zones_size[ZONE_NORMAL] = low - max_dma; | 361 | } else { |
366 | } | 362 | zones_size[ZONE_DMA] = MAX_DMA_PFN - min_low_pfn; |
367 | #else | 363 | zones_size[ZONE_NORMAL] = max_low_pfn - MAX_DMA_PFN; |
368 | zones_size[ZONE_DMA] = low; | 364 | } |
365 | else | ||
369 | #endif | 366 | #endif |
367 | zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn; | ||
368 | |||
370 | #ifdef CONFIG_HIGHMEM | 369 | #ifdef CONFIG_HIGHMEM |
371 | zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn; | 370 | zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn; |
372 | 371 | ||
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h index 23f789c80845..e06ef0776d48 100644 --- a/include/asm-mips/dma.h +++ b/include/asm-mips/dma.h | |||
@@ -91,6 +91,7 @@ | |||
91 | #else | 91 | #else |
92 | #define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000) | 92 | #define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000) |
93 | #endif | 93 | #endif |
94 | #define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS)) | ||
94 | 95 | ||
95 | /* 8237 DMA controllers */ | 96 | /* 8237 DMA controllers */ |
96 | #define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ | 97 | #define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ |