diff options
author | Albert Herranz <albert_herranz@yahoo.es> | 2009-12-12 01:31:53 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2009-12-13 00:24:31 -0500 |
commit | de32400dd26e743c5d500aa42d8d6818b79edb73 (patch) | |
tree | 5fee868e4fac044dca4fb3a18532b67b62c90c96 /arch/powerpc/mm/pgtable_32.c | |
parent | 02d748a9ee56735641bade9b734dc2fa9be4df4c (diff) |
wii: use both mem1 and mem2 as ram
The Nintendo Wii video game console has two discontiguous RAM regions:
- MEM1: 24MB @ 0x00000000
- MEM2: 64MB @ 0x10000000
Unfortunately, the kernel currently does not support discontiguous RAM
memory regions on 32-bit PowerPC platforms.
This patch adds a series of workarounds to allow the use of the second
memory region (MEM2) as RAM by the kernel.
Basically, a single range of memory from the beginning of MEM1 to the
end of MEM2 is reported to the kernel, and a memory reservation is
created for the hole between MEM1 and MEM2.
With this patch the system is able to use all the available RAM and not
just ~27% of it.
This will no longer be needed when proper discontig memory support
for 32-bit PowerPC is added to the kernel.
Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/powerpc/mm/pgtable_32.c')
-rw-r--r-- | arch/powerpc/mm/pgtable_32.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index cb96cb2e17cc..b55bbe87acb8 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c | |||
@@ -283,18 +283,18 @@ int map_page(unsigned long va, phys_addr_t pa, int flags) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /* | 285 | /* |
286 | * Map in a big chunk of physical memory starting at PAGE_OFFSET. | 286 | * Map in a chunk of physical memory starting at start. |
287 | */ | 287 | */ |
288 | void __init mapin_ram(void) | 288 | void __init __mapin_ram_chunk(unsigned long offset, unsigned long top) |
289 | { | 289 | { |
290 | unsigned long v, s, f; | 290 | unsigned long v, s, f; |
291 | phys_addr_t p; | 291 | phys_addr_t p; |
292 | int ktext; | 292 | int ktext; |
293 | 293 | ||
294 | s = mmu_mapin_ram(); | 294 | s = offset; |
295 | v = PAGE_OFFSET + s; | 295 | v = PAGE_OFFSET + s; |
296 | p = memstart_addr + s; | 296 | p = memstart_addr + s; |
297 | for (; s < total_lowmem; s += PAGE_SIZE) { | 297 | for (; s < top; s += PAGE_SIZE) { |
298 | ktext = ((char *) v >= _stext && (char *) v < etext); | 298 | ktext = ((char *) v >= _stext && (char *) v < etext); |
299 | f = ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL; | 299 | f = ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL; |
300 | map_page(v, p, f); | 300 | map_page(v, p, f); |
@@ -307,6 +307,30 @@ void __init mapin_ram(void) | |||
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
310 | void __init mapin_ram(void) | ||
311 | { | ||
312 | unsigned long s, top; | ||
313 | |||
314 | #ifndef CONFIG_WII | ||
315 | top = total_lowmem; | ||
316 | s = mmu_mapin_ram(top); | ||
317 | __mapin_ram_chunk(s, top); | ||
318 | #else | ||
319 | if (!wii_hole_size) { | ||
320 | s = mmu_mapin_ram(total_lowmem); | ||
321 | __mapin_ram_chunk(s, total_lowmem); | ||
322 | } else { | ||
323 | top = wii_hole_start; | ||
324 | s = mmu_mapin_ram(top); | ||
325 | __mapin_ram_chunk(s, top); | ||
326 | |||
327 | top = lmb_end_of_DRAM(); | ||
328 | s = wii_mmu_mapin_mem2(top); | ||
329 | __mapin_ram_chunk(s, top); | ||
330 | } | ||
331 | #endif | ||
332 | } | ||
333 | |||
310 | /* Scan the real Linux page tables and return a PTE pointer for | 334 | /* Scan the real Linux page tables and return a PTE pointer for |
311 | * a virtual address in a context. | 335 | * a virtual address in a context. |
312 | * Returns true (1) if PTE was found, zero otherwise. The pointer to | 336 | * Returns true (1) if PTE was found, zero otherwise. The pointer to |