prom.c (a61944c251c3e68c4bbf6eb96ff61c7b286351c5) | prom.c (307cfe715344e15eda12dad3bb14f794115ca823) |
---|---|
1/* 2 * Procedures for creating, accessing and interpreting the device tree. 3 * 4 * Paul Mackerras August 1996. 5 * Copyright (C) 1996-2005 Paul Mackerras. 6 * 7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner. 8 * {engebret|bergner}@us.ibm.com --- 68 unchanged lines hidden (view full) --- 77 78 memory_limit = PAGE_ALIGN(memparse(p, &p)); 79 DBG("memory limit = 0x%llx\n", (unsigned long long)memory_limit); 80 81 return 0; 82} 83early_param("mem", early_parse_mem); 84 | 1/* 2 * Procedures for creating, accessing and interpreting the device tree. 3 * 4 * Paul Mackerras August 1996. 5 * Copyright (C) 1996-2005 Paul Mackerras. 6 * 7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner. 8 * {engebret|bergner}@us.ibm.com --- 68 unchanged lines hidden (view full) --- 77 78 memory_limit = PAGE_ALIGN(memparse(p, &p)); 79 DBG("memory limit = 0x%llx\n", (unsigned long long)memory_limit); 80 81 return 0; 82} 83early_param("mem", early_parse_mem); 84 |
85/* 86 * overlaps_initrd - check for overlap with page aligned extension of 87 * initrd. 88 */ 89static inline int overlaps_initrd(unsigned long start, unsigned long size) 90{ 91#ifdef CONFIG_BLK_DEV_INITRD 92 if (!initrd_start) 93 return 0; 94 95 return (start + size) > _ALIGN_DOWN(initrd_start, PAGE_SIZE) && 96 start <= _ALIGN_UP(initrd_end, PAGE_SIZE); 97#else 98 return 0; 99#endif 100} 101 |
|
85/** 86 * move_device_tree - move tree to an unused area, if needed. 87 * 88 * The device tree may be allocated beyond our memory limit, or inside the | 102/** 103 * move_device_tree - move tree to an unused area, if needed. 104 * 105 * The device tree may be allocated beyond our memory limit, or inside the |
89 * crash kernel region for kdump. If so, move it out of the way. | 106 * crash kernel region for kdump, or within the page aligned range of initrd. 107 * If so, move it out of the way. |
90 */ 91static void __init move_device_tree(void) 92{ 93 unsigned long start, size; 94 void *p; 95 96 DBG("-> move_device_tree\n"); 97 98 start = __pa(initial_boot_params); 99 size = be32_to_cpu(initial_boot_params->totalsize); 100 101 if ((memory_limit && (start + size) > PHYSICAL_START + memory_limit) || | 108 */ 109static void __init move_device_tree(void) 110{ 111 unsigned long start, size; 112 void *p; 113 114 DBG("-> move_device_tree\n"); 115 116 start = __pa(initial_boot_params); 117 size = be32_to_cpu(initial_boot_params->totalsize); 118 119 if ((memory_limit && (start + size) > PHYSICAL_START + memory_limit) || |
102 overlaps_crashkernel(start, size)) { | 120 overlaps_crashkernel(start, size) || 121 overlaps_initrd(start, size)) { |
103 p = __va(memblock_alloc(size, PAGE_SIZE)); 104 memcpy(p, initial_boot_params, size); 105 initial_boot_params = (struct boot_param_header *)p; 106 DBG("Moved device tree to 0x%p\n", p); 107 } 108 109 DBG("<- move_device_tree\n"); 110} --- 439 unchanged lines hidden (view full) --- 550 /* before we do anything, lets reserve the dt blob */ 551 self_base = __pa((unsigned long)initial_boot_params); 552 self_size = initial_boot_params->totalsize; 553 memblock_reserve(self_base, self_size); 554 555#ifdef CONFIG_BLK_DEV_INITRD 556 /* then reserve the initrd, if any */ 557 if (initrd_start && (initrd_end > initrd_start)) | 122 p = __va(memblock_alloc(size, PAGE_SIZE)); 123 memcpy(p, initial_boot_params, size); 124 initial_boot_params = (struct boot_param_header *)p; 125 DBG("Moved device tree to 0x%p\n", p); 126 } 127 128 DBG("<- move_device_tree\n"); 129} --- 439 unchanged lines hidden (view full) --- 569 /* before we do anything, lets reserve the dt blob */ 570 self_base = __pa((unsigned long)initial_boot_params); 571 self_size = initial_boot_params->totalsize; 572 memblock_reserve(self_base, self_size); 573 574#ifdef CONFIG_BLK_DEV_INITRD 575 /* then reserve the initrd, if any */ 576 if (initrd_start && (initrd_end > initrd_start)) |
558 memblock_reserve(__pa(initrd_start), initrd_end - initrd_start); | 577 memblock_reserve(_ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE), 578 _ALIGN_UP(initrd_end, PAGE_SIZE) - 579 _ALIGN_DOWN(initrd_start, PAGE_SIZE)); |
559#endif /* CONFIG_BLK_DEV_INITRD */ 560 561#ifdef CONFIG_PPC32 562 /* 563 * Handle the case where we might be booting from an old kexec 564 * image that setup the mem_rsvmap as pairs of 32-bit values 565 */ 566 if (*reserve_map > 0xffffffffull) { --- 364 unchanged lines hidden --- | 580#endif /* CONFIG_BLK_DEV_INITRD */ 581 582#ifdef CONFIG_PPC32 583 /* 584 * Handle the case where we might be booting from an old kexec 585 * image that setup the mem_rsvmap as pairs of 32-bit values 586 */ 587 if (*reserve_map > 0xffffffffull) { --- 364 unchanged lines hidden --- |