diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-10-31 19:45:19 -0500 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-10-31 22:34:30 -0500 |
commit | bec7c458b372251617e0fdc6bf8ce4df06bab430 (patch) | |
tree | bdffb7e8a092655f535fe4401ad8e81ae639221b /arch | |
parent | 5015b49448cbe5352b9cc232333ab26f3e608a07 (diff) |
powerpc: make mem= work on iSeries again
By parsing the command line earlier, we can add the mem= value to the
flattened device tree and let the generic code sort out the memory limit
for us.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 17 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/setup.c | 42 |
2 files changed, 25 insertions, 34 deletions
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 40c48100bf1b..19530ce9cd27 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -631,23 +631,6 @@ static int ppc64_panic_event(struct notifier_block *this, | |||
631 | return NOTIFY_DONE; | 631 | return NOTIFY_DONE; |
632 | } | 632 | } |
633 | 633 | ||
634 | #ifdef CONFIG_PPC_ISERIES | ||
635 | /* | ||
636 | * On iSeries we just parse the mem=X option from the command line. | ||
637 | * On pSeries it's a bit more complicated, see prom_init_mem() | ||
638 | */ | ||
639 | static int __init early_parsemem(char *p) | ||
640 | { | ||
641 | if (!p) | ||
642 | return 0; | ||
643 | |||
644 | memory_limit = ALIGN(memparse(p, &p), PAGE_SIZE); | ||
645 | |||
646 | return 0; | ||
647 | } | ||
648 | early_param("mem", early_parsemem); | ||
649 | #endif /* CONFIG_PPC_ISERIES */ | ||
650 | |||
651 | #ifdef CONFIG_IRQSTACKS | 634 | #ifdef CONFIG_IRQSTACKS |
652 | static void __init irqstack_early_init(void) | 635 | static void __init irqstack_early_init(void) |
653 | { | 636 | { |
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index 1544c6f10a38..06431e642533 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/kdev_t.h> | 27 | #include <linux/kdev_t.h> |
28 | #include <linux/major.h> | 28 | #include <linux/major.h> |
29 | #include <linux/root_dev.h> | 29 | #include <linux/root_dev.h> |
30 | #include <linux/kernel.h> | ||
30 | 31 | ||
31 | #include <asm/processor.h> | 32 | #include <asm/processor.h> |
32 | #include <asm/machdep.h> | 33 | #include <asm/machdep.h> |
@@ -94,6 +95,8 @@ extern unsigned long iSeries_recal_titan; | |||
94 | 95 | ||
95 | static int mf_initialized; | 96 | static int mf_initialized; |
96 | 97 | ||
98 | static unsigned long cmd_mem_limit; | ||
99 | |||
97 | struct MemoryBlock { | 100 | struct MemoryBlock { |
98 | unsigned long absStart; | 101 | unsigned long absStart; |
99 | unsigned long absEnd; | 102 | unsigned long absEnd; |
@@ -341,23 +344,6 @@ static void __init iSeries_init_early(void) | |||
341 | */ | 344 | */ |
342 | iommu_init_early_iSeries(); | 345 | iommu_init_early_iSeries(); |
343 | 346 | ||
344 | iSeries_get_cmdline(); | ||
345 | |||
346 | /* Save unparsed command line copy for /proc/cmdline */ | ||
347 | strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); | ||
348 | |||
349 | /* Parse early parameters, in particular mem=x */ | ||
350 | parse_early_param(); | ||
351 | |||
352 | if (memory_limit) { | ||
353 | if (memory_limit < systemcfg->physicalMemorySize) | ||
354 | systemcfg->physicalMemorySize = memory_limit; | ||
355 | else { | ||
356 | printk("Ignoring mem=%lu >= ram_top.\n", memory_limit); | ||
357 | memory_limit = 0; | ||
358 | } | ||
359 | } | ||
360 | |||
361 | /* Initialize machine-dependency vectors */ | 347 | /* Initialize machine-dependency vectors */ |
362 | #ifdef CONFIG_SMP | 348 | #ifdef CONFIG_SMP |
363 | smp_init_iSeries(); | 349 | smp_init_iSeries(); |
@@ -971,6 +957,8 @@ void build_flat_dt(struct iseries_flat_dt *dt) | |||
971 | /* /chosen */ | 957 | /* /chosen */ |
972 | dt_start_node(dt, "chosen"); | 958 | dt_start_node(dt, "chosen"); |
973 | dt_prop_u32(dt, "linux,platform", PLATFORM_ISERIES_LPAR); | 959 | dt_prop_u32(dt, "linux,platform", PLATFORM_ISERIES_LPAR); |
960 | if (cmd_mem_limit) | ||
961 | dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit); | ||
974 | dt_end_node(dt); | 962 | dt_end_node(dt); |
975 | 963 | ||
976 | dt_cpus(dt); | 964 | dt_cpus(dt); |
@@ -990,7 +978,27 @@ void * __init iSeries_early_setup(void) | |||
990 | */ | 978 | */ |
991 | build_iSeries_Memory_Map(); | 979 | build_iSeries_Memory_Map(); |
992 | 980 | ||
981 | iSeries_get_cmdline(); | ||
982 | |||
983 | /* Save unparsed command line copy for /proc/cmdline */ | ||
984 | strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); | ||
985 | |||
986 | /* Parse early parameters, in particular mem=x */ | ||
987 | parse_early_param(); | ||
988 | |||
993 | build_flat_dt(&iseries_dt); | 989 | build_flat_dt(&iseries_dt); |
994 | 990 | ||
995 | return (void *) __pa(&iseries_dt); | 991 | return (void *) __pa(&iseries_dt); |
996 | } | 992 | } |
993 | |||
994 | /* | ||
995 | * On iSeries we just parse the mem=X option from the command line. | ||
996 | * On pSeries it's a bit more complicated, see prom_init_mem() | ||
997 | */ | ||
998 | static int __init early_parsemem(char *p) | ||
999 | { | ||
1000 | if (p) | ||
1001 | cmd_mem_limit = ALIGN(memparse(p, &p), PAGE_SIZE); | ||
1002 | return 0; | ||
1003 | } | ||
1004 | early_param("mem", early_parsemem); | ||