Commit 4e82c9a6 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Move ramdisk discovery code out to seperate function.

And add some comments explaining all of the quirks involved in
the way the bootloader provides this information.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7347aefb
...@@ -883,6 +883,37 @@ static void __init trim_pavail(unsigned long *cur_size_p, ...@@ -883,6 +883,37 @@ static void __init trim_pavail(unsigned long *cur_size_p,
} }
} }
static void __init find_ramdisk(unsigned long phys_base)
{
#ifdef CONFIG_BLK_DEV_INITRD
if (sparc_ramdisk_image || sparc_ramdisk_image64) {
unsigned long ramdisk_image;
/* Older versions of the bootloader only supported a
* 32-bit physical address for the ramdisk image
* location, stored at sparc_ramdisk_image. Newer
* SILO versions set sparc_ramdisk_image to zero and
* provide a full 64-bit physical address at
* sparc_ramdisk_image64.
*/
ramdisk_image = sparc_ramdisk_image;
if (!ramdisk_image)
ramdisk_image = sparc_ramdisk_image64;
/* Another bootloader quirk. The bootloader normalizes
* the physical address to KERNBASE, so we have to
* factor that back out and add in the lowest valid
* physical page address to get the true physical address.
*/
ramdisk_image -= KERNBASE;
ramdisk_image += phys_base;
initrd_start = ramdisk_image;
initrd_end = ramdisk_image + sparc_ramdisk_size;
}
#endif
}
/* About pages_avail, this is the value we will use to calculate /* About pages_avail, this is the value we will use to calculate
* the zholes_size[] argument given to free_area_init_node(). The * the zholes_size[] argument given to free_area_init_node(). The
* page allocator uses this to calculate nr_kernel_pages, * page allocator uses this to calculate nr_kernel_pages,
...@@ -912,30 +943,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail, ...@@ -912,30 +943,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
bytes_avail += pavail[i].reg_size; bytes_avail += pavail[i].reg_size;
} }
/* Determine the location of the initial ramdisk before trying
* to honor the "mem=xxx" command line argument. We must know
* where the kernel image and the ramdisk image are so that we
* do not trim those two areas from the physical memory map.
*/
#ifdef CONFIG_BLK_DEV_INITRD
/* Now have to check initial ramdisk, so that bootmap does not overwrite it */
if (sparc_ramdisk_image || sparc_ramdisk_image64) {
unsigned long ramdisk_image = sparc_ramdisk_image ?
sparc_ramdisk_image : sparc_ramdisk_image64;
ramdisk_image -= KERNBASE;
initrd_start = ramdisk_image + phys_base;
initrd_end = initrd_start + sparc_ramdisk_size;
if (initrd_end > end_of_phys_memory) {
printk(KERN_CRIT "initrd extends beyond end of memory "
"(0x%016lx > 0x%016lx)\ndisabling initrd\n",
initrd_end, end_of_phys_memory);
initrd_start = 0;
initrd_end = 0;
}
}
#endif
if (cmdline_memory_size && if (cmdline_memory_size &&
bytes_avail > cmdline_memory_size) bytes_avail > cmdline_memory_size)
trim_pavail(&bytes_avail, trim_pavail(&bytes_avail,
...@@ -1337,6 +1344,8 @@ void __init paging_init(void) ...@@ -1337,6 +1344,8 @@ void __init paging_init(void)
for (i = 0; i < pavail_ents; i++) for (i = 0; i < pavail_ents; i++)
phys_base = min(phys_base, pavail[i].phys_addr); phys_base = min(phys_base, pavail[i].phys_addr);
find_ramdisk(phys_base);
set_bit(0, mmu_context_bmap); set_bit(0, mmu_context_bmap);
shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE); shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment