aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-02-13 21:00:03 -0500
committerDavid S. Miller <davem@davemloft.net>2008-04-24 02:32:07 -0400
commit4e82c9a606da2b1c1c7ea7dfd8052626a4c6d5d6 (patch)
tree2e87c991f60300e960518fb866bd88b0df8f0995 /arch/sparc64
parent7347aefbccb47ce2d076d8ac7dff2cdd1435974c (diff)
[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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/mm/init.c57
1 files changed, 33 insertions, 24 deletions
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index f37078d96407..21e9267608c7 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -883,6 +883,37 @@ static void __init trim_pavail(unsigned long *cur_size_p,
883 } 883 }
884} 884}
885 885
886static void __init find_ramdisk(unsigned long phys_base)
887{
888#ifdef CONFIG_BLK_DEV_INITRD
889 if (sparc_ramdisk_image || sparc_ramdisk_image64) {
890 unsigned long ramdisk_image;
891
892 /* Older versions of the bootloader only supported a
893 * 32-bit physical address for the ramdisk image
894 * location, stored at sparc_ramdisk_image. Newer
895 * SILO versions set sparc_ramdisk_image to zero and
896 * provide a full 64-bit physical address at
897 * sparc_ramdisk_image64.
898 */
899 ramdisk_image = sparc_ramdisk_image;
900 if (!ramdisk_image)
901 ramdisk_image = sparc_ramdisk_image64;
902
903 /* Another bootloader quirk. The bootloader normalizes
904 * the physical address to KERNBASE, so we have to
905 * factor that back out and add in the lowest valid
906 * physical page address to get the true physical address.
907 */
908 ramdisk_image -= KERNBASE;
909 ramdisk_image += phys_base;
910
911 initrd_start = ramdisk_image;
912 initrd_end = ramdisk_image + sparc_ramdisk_size;
913 }
914#endif
915}
916
886/* About pages_avail, this is the value we will use to calculate 917/* About pages_avail, this is the value we will use to calculate
887 * the zholes_size[] argument given to free_area_init_node(). The 918 * the zholes_size[] argument given to free_area_init_node(). The
888 * page allocator uses this to calculate nr_kernel_pages, 919 * page allocator uses this to calculate nr_kernel_pages,
@@ -912,30 +943,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
912 bytes_avail += pavail[i].reg_size; 943 bytes_avail += pavail[i].reg_size;
913 } 944 }
914 945
915 /* Determine the location of the initial ramdisk before trying
916 * to honor the "mem=xxx" command line argument. We must know
917 * where the kernel image and the ramdisk image are so that we
918 * do not trim those two areas from the physical memory map.
919 */
920
921#ifdef CONFIG_BLK_DEV_INITRD
922 /* Now have to check initial ramdisk, so that bootmap does not overwrite it */
923 if (sparc_ramdisk_image || sparc_ramdisk_image64) {
924 unsigned long ramdisk_image = sparc_ramdisk_image ?
925 sparc_ramdisk_image : sparc_ramdisk_image64;
926 ramdisk_image -= KERNBASE;
927 initrd_start = ramdisk_image + phys_base;
928 initrd_end = initrd_start + sparc_ramdisk_size;
929 if (initrd_end > end_of_phys_memory) {
930 printk(KERN_CRIT "initrd extends beyond end of memory "
931 "(0x%016lx > 0x%016lx)\ndisabling initrd\n",
932 initrd_end, end_of_phys_memory);
933 initrd_start = 0;
934 initrd_end = 0;
935 }
936 }
937#endif
938
939 if (cmdline_memory_size && 946 if (cmdline_memory_size &&
940 bytes_avail > cmdline_memory_size) 947 bytes_avail > cmdline_memory_size)
941 trim_pavail(&bytes_avail, 948 trim_pavail(&bytes_avail,
@@ -1337,6 +1344,8 @@ void __init paging_init(void)
1337 for (i = 0; i < pavail_ents; i++) 1344 for (i = 0; i < pavail_ents; i++)
1338 phys_base = min(phys_base, pavail[i].phys_addr); 1345 phys_base = min(phys_base, pavail[i].phys_addr);
1339 1346
1347 find_ramdisk(phys_base);
1348
1340 set_bit(0, mmu_context_bmap); 1349 set_bit(0, mmu_context_bmap);
1341 1350
1342 shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE); 1351 shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE);