diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2005-09-29 00:38:08 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-09-29 00:38:08 -0400 |
commit | 0836a0eb4073c3e0a09c5965833b9dec19f5abc7 (patch) | |
tree | d6538773d4bdc18a32e49c11e35138465f7739a1 /arch/sparc64 | |
parent | 801ab3c731e77324c055769491711e620100dbfb (diff) |
[SPARC64]: Move phys_base, kern_{base,size}, and sp_banks[] init to paging_init
Also, move prom_probe_memory() into arch/sparc64/mm/init.c
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/setup.c | 19 | ||||
-rw-r--r-- | arch/sparc64/mm/fault.c | 47 | ||||
-rw-r--r-- | arch/sparc64/mm/init.c | 62 |
3 files changed, 61 insertions, 67 deletions
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index 516f4854955f..4c9c8f241748 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c | |||
@@ -464,8 +464,6 @@ static void __init boot_flags_init(char *commands) | |||
464 | } | 464 | } |
465 | } | 465 | } |
466 | 466 | ||
467 | extern int prom_probe_memory(void); | ||
468 | extern unsigned long start, end; | ||
469 | extern void panic_setup(char *, int *); | 467 | extern void panic_setup(char *, int *); |
470 | 468 | ||
471 | extern unsigned short root_flags; | 469 | extern unsigned short root_flags; |
@@ -494,8 +492,6 @@ void register_prom_callbacks(void) | |||
494 | 492 | ||
495 | void __init setup_arch(char **cmdline_p) | 493 | void __init setup_arch(char **cmdline_p) |
496 | { | 494 | { |
497 | int i; | ||
498 | |||
499 | /* Initialize PROM console and command line. */ | 495 | /* Initialize PROM console and command line. */ |
500 | *cmdline_p = prom_getbootargs(); | 496 | *cmdline_p = prom_getbootargs(); |
501 | strcpy(saved_command_line, *cmdline_p); | 497 | strcpy(saved_command_line, *cmdline_p); |
@@ -514,21 +510,6 @@ void __init setup_arch(char **cmdline_p) | |||
514 | boot_flags_init(*cmdline_p); | 510 | boot_flags_init(*cmdline_p); |
515 | 511 | ||
516 | idprom_init(); | 512 | idprom_init(); |
517 | (void) prom_probe_memory(); | ||
518 | |||
519 | phys_base = 0xffffffffffffffffUL; | ||
520 | for (i = 0; sp_banks[i].num_bytes != 0; i++) { | ||
521 | unsigned long top; | ||
522 | |||
523 | if (sp_banks[i].base_addr < phys_base) | ||
524 | phys_base = sp_banks[i].base_addr; | ||
525 | top = sp_banks[i].base_addr + | ||
526 | sp_banks[i].num_bytes; | ||
527 | } | ||
528 | pfn_base = phys_base >> PAGE_SHIFT; | ||
529 | |||
530 | kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; | ||
531 | kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; | ||
532 | 513 | ||
533 | if (!root_flags) | 514 | if (!root_flags) |
534 | root_mountflags &= ~MS_RDONLY; | 515 | root_mountflags &= ~MS_RDONLY; |
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 4a52e79d515f..80793d61f311 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c | |||
@@ -71,53 +71,6 @@ void set_brkpt(unsigned long addr, unsigned char mask, int flags, int mode) | |||
71 | : "memory"); | 71 | : "memory"); |
72 | } | 72 | } |
73 | 73 | ||
74 | /* Nice, simple, prom library does all the sweating for us. ;) */ | ||
75 | unsigned long __init prom_probe_memory (void) | ||
76 | { | ||
77 | register struct linux_mlist_p1275 *mlist; | ||
78 | register unsigned long bytes, base_paddr, tally; | ||
79 | register int i; | ||
80 | |||
81 | i = 0; | ||
82 | mlist = *prom_meminfo()->p1275_available; | ||
83 | bytes = tally = mlist->num_bytes; | ||
84 | base_paddr = mlist->start_adr; | ||
85 | |||
86 | sp_banks[0].base_addr = base_paddr; | ||
87 | sp_banks[0].num_bytes = bytes; | ||
88 | |||
89 | while (mlist->theres_more != (void *) 0) { | ||
90 | i++; | ||
91 | mlist = mlist->theres_more; | ||
92 | bytes = mlist->num_bytes; | ||
93 | tally += bytes; | ||
94 | if (i >= SPARC_PHYS_BANKS-1) { | ||
95 | printk ("The machine has more banks than " | ||
96 | "this kernel can support\n" | ||
97 | "Increase the SPARC_PHYS_BANKS " | ||
98 | "setting (currently %d)\n", | ||
99 | SPARC_PHYS_BANKS); | ||
100 | i = SPARC_PHYS_BANKS-1; | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | sp_banks[i].base_addr = mlist->start_adr; | ||
105 | sp_banks[i].num_bytes = mlist->num_bytes; | ||
106 | } | ||
107 | |||
108 | i++; | ||
109 | sp_banks[i].base_addr = 0xdeadbeefbeefdeadUL; | ||
110 | sp_banks[i].num_bytes = 0; | ||
111 | |||
112 | /* Now mask all bank sizes on a page boundary, it is all we can | ||
113 | * use anyways. | ||
114 | */ | ||
115 | for (i = 0; sp_banks[i].num_bytes != 0; i++) | ||
116 | sp_banks[i].num_bytes &= PAGE_MASK; | ||
117 | |||
118 | return tally; | ||
119 | } | ||
120 | |||
121 | static void __kprobes unhandled_fault(unsigned long address, | 74 | static void __kprobes unhandled_fault(unsigned long address, |
122 | struct task_struct *tsk, | 75 | struct task_struct *tsk, |
123 | struct pt_regs *regs) | 76 | struct pt_regs *regs) |
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 | ||