[PATCH 15/19] ppc64: Move iSeries initrd logic into device tree
Michael Ellerman
michael at ellerman.id.au
Tue Jul 26 18:58:42 EST 2005
Move iSeries initrd logic earlier and store the result in the device tree
so generic code can do the rest for us.
The iSeries code had a "feature" which the generic code lacks, ie. if the
initrd is bigger than the configured ram disk size, we make the ram disk size
big enough - I've copied the code across but I'm not sure if we want to keep
it.
---
arch/ppc64/kernel/iSeries_setup.c | 43 ++++++++++----------------------------
arch/ppc64/kernel/setup.c | 8 ++++++-
2 files changed, 19 insertions(+), 32 deletions(-)
Index: work/arch/ppc64/kernel/iSeries_setup.c
===================================================================
--- work.orig/arch/ppc64/kernel/iSeries_setup.c
+++ work/arch/ppc64/kernel/iSeries_setup.c
@@ -24,7 +24,6 @@
#include <linux/smp.h>
#include <linux/param.h>
#include <linux/string.h>
-#include <linux/initrd.h>
#include <linux/seq_file.h>
#include <linux/kdev_t.h>
#include <linux/major.h>
@@ -95,7 +94,6 @@ static unsigned long tbFreqMhzHundreths;
int piranha_simulator;
-extern int rd_size; /* Defined in drivers/block/rd.c */
extern unsigned long klimit;
extern unsigned long embedded_sysmap_start;
extern unsigned long embedded_sysmap_end;
@@ -319,24 +317,6 @@ static void __init iSeries_init_early(vo
ppc64_interrupt_controller = IC_ISERIES;
-#if defined(CONFIG_BLK_DEV_INITRD)
- /*
- * If the init RAM disk has been configured and there is
- * a non-zero starting address for it, set it up
- */
- if (naca.xRamDisk) {
- initrd_start = (unsigned long)__va(naca.xRamDisk);
- initrd_end = initrd_start + naca.xRamDiskSize * PAGE_SIZE;
- initrd_below_start_ok = 1; // ramdisk in kernel space
- ROOT_DEV = Root_RAM0;
- if (((rd_size * 1024) / PAGE_SIZE) < naca.xRamDiskSize)
- rd_size = (naca.xRamDiskSize * PAGE_SIZE) / 1024;
- } else
-#endif /* CONFIG_BLK_DEV_INITRD */
- {
- /* ROOT_DEV = MKDEV(VIODASD_MAJOR, 1); */
- }
-
iSeries_recal_tb = get_tb();
iSeries_recal_titan = HvCallXm_loadTod();
@@ -370,17 +350,6 @@ static void __init iSeries_init_early(vo
mf_initialized = 1;
mb();
- /* If we were passed an initrd, set the ROOT_DEV properly if the values
- * look sensible. If not, clear initrd reference.
- */
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start >= KERNELBASE && initrd_end >= KERNELBASE &&
- initrd_end > initrd_start)
- ROOT_DEV = Root_RAM0;
- else
- initrd_start = initrd_end = 0;
-#endif /* CONFIG_BLK_DEV_INITRD */
-
DBG(" <- iSeries_init_early()\n");
}
@@ -1067,6 +1036,17 @@ void dt_model(struct iseries_flat_dt *dt
dt_prop_str(dt, "compatible", "IBM,iSeries");
}
+void dt_initrd(struct iseries_flat_dt *dt)
+{
+#ifdef CONFIG_BLK_DEV_INITRD
+ if (naca.xRamDisk) {
+ dt_prop_u64(dt, "linux,initrd-start", (u64)naca.xRamDisk);
+ dt_prop_u64(dt, "linux,initrd-end",
+ (u64)naca.xRamDisk + naca.xRamDiskSize * PAGE_SIZE);
+ }
+#endif
+}
+
void build_flat_dt(struct iseries_flat_dt *dt)
{
u64 tmp[2];
@@ -1094,6 +1074,7 @@ void build_flat_dt(struct iseries_flat_d
dt_prop_str(dt, "bootargs", cmd_line);
if (iseries_memory_limit)
dt_prop_u64(dt, "linux,memory-limit", iseries_memory_limit);
+ dt_initrd(dt);
dt_end_node(dt);
Index: work/arch/ppc64/kernel/setup.c
===================================================================
--- work.orig/arch/ppc64/kernel/setup.c
+++ work/arch/ppc64/kernel/setup.c
@@ -534,6 +534,7 @@ static void __init check_for_initrd(void
{
#ifdef CONFIG_BLK_DEV_INITRD
u64 *prop;
+ extern int rd_size; /* Defined in drivers/block/rd.c */
DBG(" -> check_for_initrd()\n");
@@ -557,8 +558,13 @@ static void __init check_for_initrd(void
else
initrd_start = initrd_end = 0;
+ /* XXX This came from iSeries code, make sure ram disk is big enough */
+ if ((rd_size * 1024) < (initrd_end - initrd_start))
+ rd_size = (initrd_end - initrd_start) / 1024;
+
if (initrd_start)
- printk("Found initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end);
+ printk("Found initrd at 0x%lx:0x%lx\n", initrd_start,
+ initrd_end);
DBG(" <- check_for_initrd()\n");
#endif /* CONFIG_BLK_DEV_INITRD */
More information about the Linuxppc64-dev
mailing list