diff options
Diffstat (limited to 'arch/sparc64/mm/init.c')
| -rw-r--r-- | arch/sparc64/mm/init.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 1539a8362b6f..513993414747 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <asm/sections.h> | 42 | #include <asm/sections.h> |
| 43 | #include <asm/tsb.h> | 43 | #include <asm/tsb.h> |
| 44 | #include <asm/hypervisor.h> | 44 | #include <asm/hypervisor.h> |
| 45 | #include <asm/prom.h> | ||
| 45 | 46 | ||
| 46 | extern void device_scan(void); | 47 | extern void device_scan(void); |
| 47 | 48 | ||
| @@ -101,8 +102,6 @@ static void __init read_obp_memory(const char *property, | |||
| 101 | prom_halt(); | 102 | prom_halt(); |
| 102 | } | 103 | } |
| 103 | 104 | ||
| 104 | *num_ents = ents; | ||
| 105 | |||
| 106 | /* Sanitize what we got from the firmware, by page aligning | 105 | /* Sanitize what we got from the firmware, by page aligning |
| 107 | * everything. | 106 | * everything. |
| 108 | */ | 107 | */ |
| @@ -124,6 +123,25 @@ static void __init read_obp_memory(const char *property, | |||
| 124 | regs[i].phys_addr = base; | 123 | regs[i].phys_addr = base; |
| 125 | regs[i].reg_size = size; | 124 | regs[i].reg_size = size; |
| 126 | } | 125 | } |
| 126 | |||
| 127 | for (i = 0; i < ents; i++) { | ||
| 128 | if (regs[i].reg_size == 0UL) { | ||
| 129 | int j; | ||
| 130 | |||
| 131 | for (j = i; j < ents - 1; j++) { | ||
| 132 | regs[j].phys_addr = | ||
| 133 | regs[j+1].phys_addr; | ||
| 134 | regs[j].reg_size = | ||
| 135 | regs[j+1].reg_size; | ||
| 136 | } | ||
| 137 | |||
| 138 | ents--; | ||
| 139 | i--; | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | *num_ents = ents; | ||
| 144 | |||
| 127 | sort(regs, ents, sizeof(struct linux_prom64_registers), | 145 | sort(regs, ents, sizeof(struct linux_prom64_registers), |
| 128 | cmp_p64, NULL); | 146 | cmp_p64, NULL); |
| 129 | } | 147 | } |
| @@ -1339,6 +1357,8 @@ void __init paging_init(void) | |||
| 1339 | 1357 | ||
| 1340 | kernel_physical_mapping_init(); | 1358 | kernel_physical_mapping_init(); |
| 1341 | 1359 | ||
| 1360 | prom_build_devicetree(); | ||
| 1361 | |||
| 1342 | { | 1362 | { |
| 1343 | unsigned long zones_size[MAX_NR_ZONES]; | 1363 | unsigned long zones_size[MAX_NR_ZONES]; |
| 1344 | unsigned long zholes_size[MAX_NR_ZONES]; | 1364 | unsigned long zholes_size[MAX_NR_ZONES]; |
| @@ -1376,7 +1396,7 @@ static void __init taint_real_pages(void) | |||
| 1376 | while (old_start < old_end) { | 1396 | while (old_start < old_end) { |
| 1377 | int n; | 1397 | int n; |
| 1378 | 1398 | ||
| 1379 | for (n = 0; pavail_rescan_ents; n++) { | 1399 | for (n = 0; n < pavail_rescan_ents; n++) { |
| 1380 | unsigned long new_start, new_end; | 1400 | unsigned long new_start, new_end; |
| 1381 | 1401 | ||
| 1382 | new_start = pavail_rescan[n].phys_addr; | 1402 | new_start = pavail_rescan[n].phys_addr; |
| @@ -1398,6 +1418,32 @@ static void __init taint_real_pages(void) | |||
| 1398 | } | 1418 | } |
| 1399 | } | 1419 | } |
| 1400 | 1420 | ||
| 1421 | int __init page_in_phys_avail(unsigned long paddr) | ||
| 1422 | { | ||
| 1423 | int i; | ||
| 1424 | |||
| 1425 | paddr &= PAGE_MASK; | ||
| 1426 | |||
| 1427 | for (i = 0; i < pavail_rescan_ents; i++) { | ||
| 1428 | unsigned long start, end; | ||
| 1429 | |||
| 1430 | start = pavail_rescan[i].phys_addr; | ||
| 1431 | end = start + pavail_rescan[i].reg_size; | ||
| 1432 | |||
| 1433 | if (paddr >= start && paddr < end) | ||
| 1434 | return 1; | ||
| 1435 | } | ||
| 1436 | if (paddr >= kern_base && paddr < (kern_base + kern_size)) | ||
| 1437 | return 1; | ||
| 1438 | #ifdef CONFIG_BLK_DEV_INITRD | ||
| 1439 | if (paddr >= __pa(initrd_start) && | ||
| 1440 | paddr < __pa(PAGE_ALIGN(initrd_end))) | ||
| 1441 | return 1; | ||
| 1442 | #endif | ||
| 1443 | |||
| 1444 | return 0; | ||
| 1445 | } | ||
| 1446 | |||
| 1401 | void __init mem_init(void) | 1447 | void __init mem_init(void) |
| 1402 | { | 1448 | { |
| 1403 | unsigned long codepages, datapages, initpages; | 1449 | unsigned long codepages, datapages, initpages; |
