diff options
Diffstat (limited to 'arch/sparc64/mm/init.c')
-rw-r--r-- | arch/sparc64/mm/init.c | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 9f6ca624892d..63a7b9bafaff 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -1425,6 +1425,50 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
1425 | } | 1425 | } |
1426 | #endif | 1426 | #endif |
1427 | 1427 | ||
1428 | static void __init prom_probe_memory(void) | ||
1429 | { | ||
1430 | struct linux_mlist_p1275 *mlist; | ||
1431 | unsigned long bytes, base_paddr, tally; | ||
1432 | int i; | ||
1433 | |||
1434 | i = 0; | ||
1435 | mlist = *prom_meminfo()->p1275_available; | ||
1436 | bytes = tally = mlist->num_bytes; | ||
1437 | base_paddr = mlist->start_adr; | ||
1438 | |||
1439 | sp_banks[0].base_addr = base_paddr; | ||
1440 | sp_banks[0].num_bytes = bytes; | ||
1441 | |||
1442 | while (mlist->theres_more != (void *) 0) { | ||
1443 | i++; | ||
1444 | mlist = mlist->theres_more; | ||
1445 | bytes = mlist->num_bytes; | ||
1446 | tally += bytes; | ||
1447 | if (i >= SPARC_PHYS_BANKS-1) { | ||
1448 | printk ("The machine has more banks than " | ||
1449 | "this kernel can support\n" | ||
1450 | "Increase the SPARC_PHYS_BANKS " | ||
1451 | "setting (currently %d)\n", | ||
1452 | SPARC_PHYS_BANKS); | ||
1453 | i = SPARC_PHYS_BANKS-1; | ||
1454 | break; | ||
1455 | } | ||
1456 | |||
1457 | sp_banks[i].base_addr = mlist->start_adr; | ||
1458 | sp_banks[i].num_bytes = mlist->num_bytes; | ||
1459 | } | ||
1460 | |||
1461 | i++; | ||
1462 | sp_banks[i].base_addr = 0xdeadbeefbeefdeadUL; | ||
1463 | sp_banks[i].num_bytes = 0; | ||
1464 | |||
1465 | /* Now mask all bank sizes on a page boundary, it is all we can | ||
1466 | * use anyways. | ||
1467 | */ | ||
1468 | for (i = 0; sp_banks[i].num_bytes != 0; i++) | ||
1469 | sp_banks[i].num_bytes &= PAGE_MASK; | ||
1470 | } | ||
1471 | |||
1428 | /* paging_init() sets up the page tables */ | 1472 | /* paging_init() sets up the page tables */ |
1429 | 1473 | ||
1430 | extern void cheetah_ecache_flush_init(void); | 1474 | extern void cheetah_ecache_flush_init(void); |
@@ -1435,7 +1479,23 @@ pgd_t swapper_pg_dir[2048]; | |||
1435 | void __init paging_init(void) | 1479 | void __init paging_init(void) |
1436 | { | 1480 | { |
1437 | unsigned long end_pfn, pages_avail, shift; | 1481 | unsigned long end_pfn, pages_avail, shift; |
1438 | unsigned long real_end; | 1482 | unsigned long real_end, i; |
1483 | |||
1484 | prom_probe_memory(); | ||
1485 | |||
1486 | phys_base = 0xffffffffffffffffUL; | ||
1487 | for (i = 0; sp_banks[i].num_bytes != 0; i++) { | ||
1488 | unsigned long top; | ||
1489 | |||
1490 | if (sp_banks[i].base_addr < phys_base) | ||
1491 | phys_base = sp_banks[i].base_addr; | ||
1492 | top = sp_banks[i].base_addr + | ||
1493 | sp_banks[i].num_bytes; | ||
1494 | } | ||
1495 | pfn_base = phys_base >> PAGE_SHIFT; | ||
1496 | |||
1497 | kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; | ||
1498 | kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; | ||
1439 | 1499 | ||
1440 | set_bit(0, mmu_context_bmap); | 1500 | set_bit(0, mmu_context_bmap); |
1441 | 1501 | ||