summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-03-24 02:06:05 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-03-24 02:06:05 +0000
commitf79c44e04169d10b07b53d4a524c8c41ea5504d5 (patch)
treed0c6d30fd505677d280efad9cebf655769aafb54 /arch
parent248493a05d58a4c880f46e21abbeb5db47cb3962 (diff)
Tweak the bootmap setup code to be more conservative, and not assume
that we can throw the bootmap right after _end. This allows strange and useful things like embedding root ramdisks into the kernel using linker scripts and symbol tweaks. This patch also fixes the generic initrd handling code that was commented out as broken. Patch from Justin.
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/kernel/setup.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 04f2ee113..4f12b01f5 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -461,11 +461,12 @@ void __init setup_arch(char **cmdline_p)
void momenco_ocelot_setup(void);
void nino_setup(void);
-#ifdef CONFIG_BLK_DEV_INITRD
+#ifdef CONFIG_NINO
extern void * __rd_start, * __rd_end;
#endif
unsigned long bootmap_size;
- unsigned long start_pfn, max_pfn;
+ unsigned long start_pfn, max_pfn, first_usable_pfn;
+
int i;
/* Save defaults for configuration-dependent routines. */
@@ -582,6 +583,7 @@ void __init setup_arch(char **cmdline_p)
/* Find the highest page frame number we have available. */
max_pfn = 0;
+ first_usable_pfn = -1UL;
for (i = 0; i < boot_mem_map.nr_map; i++) {
unsigned long start, end;
@@ -596,10 +598,17 @@ void __init setup_arch(char **cmdline_p)
continue;
if (end > max_pfn)
max_pfn = end;
+ if (start < first_usable_pfn) {
+ if (start > start_pfn) {
+ first_usable_pfn = start;
+ } else if (end > start_pfn) {
+ first_usable_pfn = start_pfn;
+ }
+ }
}
-
+
/* Initialize the boot-time allocator. */
- bootmap_size = init_bootmem(start_pfn, max_pfn);
+ bootmap_size = init_bootmem(first_usable_pfn, max_pfn);
/*
* Register fully available low RAM pages with the bootmem allocator.
@@ -643,7 +652,7 @@ void __init setup_arch(char **cmdline_p)
}
/* Reserve the bootmap memory. */
- reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size);
+ reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size);
#ifdef CONFIG_NINO
ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
@@ -652,27 +661,22 @@ void __init setup_arch(char **cmdline_p)
initrd_below_start_ok = 1;
#endif
-#if 0
#ifdef CONFIG_BLK_DEV_INITRD
-#error "Fixme, I'm broken."
- tmp = (((unsigned long)&_end + PAGE_SIZE-1) & PAGE_MASK) - 8;
- if (tmp < (unsigned long)&_end)
- tmp += PAGE_SIZE;
- initrd_header = (unsigned long *)tmp;
- if (initrd_header[0] == 0x494E5244) {
- initrd_start = (unsigned long)&initrd_header[2];
- initrd_end = initrd_start + initrd_header[1];
- initrd_below_start_ok = 1;
- if (initrd_end > memory_end) {
+ /* Board specific code should have set up initrd_start and initrd_end */
+ if (initrd_start) {
+ unsigned long initrd_size = ((unsigned char *)initrd_end) - ((unsigned char *)initrd_start);
+ printk("Initial ramdisk at: 0x%p (%lu bytes)\n",
+ (void *)initrd_start,
+ initrd_size);
+ if ((void *)initrd_end > phys_to_virt(PFN_PHYS(max_low_pfn))) {
printk("initrd extends beyond end of memory "
- "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
- initrd_end,memory_end);
- initrd_start = 0;
- } else
- *memory_start_p = initrd_end;
+ "(0x%lx > 0x%p)\ndisabling initrd\n",
+ initrd_end,
+ phys_to_virt(PFN_PHYS(max_low_pfn)));
+ initrd_start = initrd_end = 0;
+ }
}
#endif /* CONFIG_BLK_DEV_INITRD */
-#endif /* 0 */
paging_init();