Commit e5aaf60c authored by Tom Rini's avatar Tom Rini Committed by Paul Mackerras

PPC32: use the memory size passed in from the bootloader

in preference to probing at startup.

We now use boot_mem_size if it is nonzero and only call
ppc_md.find_end_of_memory if boot_mem_size is zero.
parent 8a05d490
...@@ -66,7 +66,7 @@ unsigned long sysmap_size; ...@@ -66,7 +66,7 @@ unsigned long sysmap_size;
/* Used with the BI_MEMSIZE bootinfo parameter to store the memory /* Used with the BI_MEMSIZE bootinfo parameter to store the memory
size value reported by the boot loader. */ size value reported by the boot loader. */
unsigned int boot_mem_size; unsigned long boot_mem_size;
unsigned long ISA_DMA_THRESHOLD; unsigned long ISA_DMA_THRESHOLD;
unsigned long DMA_MODE_READ, DMA_MODE_WRITE; unsigned long DMA_MODE_READ, DMA_MODE_WRITE;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/btext.h> #include <asm/btext.h>
#include <asm/tlb.h> #include <asm/tlb.h>
#include <asm/bootinfo.h>
#include "mem_pieces.h" #include "mem_pieces.h"
#include "mmu_decl.h" #include "mmu_decl.h"
...@@ -242,8 +243,13 @@ void __init MMU_init(void) ...@@ -242,8 +243,13 @@ void __init MMU_init(void)
/* /*
* Figure out how much memory we have, how much * Figure out how much memory we have, how much
* is lowmem, and how much is highmem. * is lowmem, and how much is highmem. If we were
* passed the total memory size from the bootloader,
* just use it.
*/ */
if (boot_mem_size)
total_memory = boot_mem_size;
else
total_memory = ppc_md.find_end_of_memory(); total_memory = ppc_md.find_end_of_memory();
if (__max_memory && total_memory > __max_memory) if (__max_memory && total_memory > __max_memory)
......
...@@ -301,12 +301,6 @@ lopec_progress(char *s, unsigned short hex) ...@@ -301,12 +301,6 @@ lopec_progress(char *s, unsigned short hex)
} }
#endif /* CONFIG_SERIAL_TEXT_DEBUG */ #endif /* CONFIG_SERIAL_TEXT_DEBUG */
static unsigned long __init
lopec_find_end_of_memory(void)
{
return mpc10x_get_mem_size(MPC10X_MEM_MAP_B);
}
TODC_ALLOC(); TODC_ALLOC();
static void __init static void __init
...@@ -376,7 +370,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -376,7 +370,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.power_off = lopec_power_off; ppc_md.power_off = lopec_power_off;
ppc_md.halt = lopec_halt; ppc_md.halt = lopec_halt;
ppc_md.find_end_of_memory = lopec_find_end_of_memory;
ppc_md.setup_io_mappings = lopec_map_io; ppc_md.setup_io_mappings = lopec_map_io;
ppc_md.time_init = todc_time_init; ppc_md.time_init = todc_time_init;
......
...@@ -761,37 +761,6 @@ static struct smp_ops_t prep_smp_ops __prepdata = { ...@@ -761,37 +761,6 @@ static struct smp_ops_t prep_smp_ops __prepdata = {
}; };
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
/*
* This finds the amount of physical ram and does necessary
* setup for prep. This is pretty architecture specific so
* this will likely stay separate from the pmac.
* -- Cort
*/
static unsigned long __init
prep_find_end_of_memory(void)
{
unsigned long total = 0;
extern unsigned int boot_mem_size;
#ifdef CONFIG_PREP_RESIDUAL
total = res->TotalMemory;
#endif
if (total == 0 && boot_mem_size != 0)
total = boot_mem_size;
else if (total == 0) {
/*
* I need a way to probe the amount of memory if the residual
* data doesn't contain it. -- Cort
*/
total = 0x02000000;
printk(KERN_INFO "Ramsize from residual data was 0"
" -- defaulting to %ldM\n", total>>20);
}
return (total);
}
/* /*
* Setup the bat mappings we're going to load that cover * Setup the bat mappings we're going to load that cover
* the io areas. RAM was mapped by mapin_ram(). * the io areas. RAM was mapped by mapin_ram().
...@@ -881,7 +850,6 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -881,7 +850,6 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.time_init = mk48t59_init; ppc_md.time_init = mk48t59_init;
} }
ppc_md.find_end_of_memory = prep_find_end_of_memory;
ppc_md.setup_io_mappings = prep_map_io; ppc_md.setup_io_mappings = prep_map_io;
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
......
...@@ -187,12 +187,6 @@ spruce_halt(void) ...@@ -187,12 +187,6 @@ spruce_halt(void)
extern int boot_mem_size; extern int boot_mem_size;
static unsigned long __init
spruce_find_end_of_memory(void)
{
return boot_mem_size;
}
static void __init static void __init
spruce_map_io(void) spruce_map_io(void)
{ {
...@@ -214,7 +208,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -214,7 +208,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.init_IRQ = cpc700_init_IRQ; ppc_md.init_IRQ = cpc700_init_IRQ;
ppc_md.get_irq = cpc700_get_irq; ppc_md.get_irq = cpc700_get_irq;
ppc_md.find_end_of_memory = spruce_find_end_of_memory;
ppc_md.setup_io_mappings = spruce_map_io; ppc_md.setup_io_mappings = spruce_map_io;
ppc_md.restart = spruce_restart; ppc_md.restart = spruce_restart;
......
...@@ -35,6 +35,7 @@ struct bi_record { ...@@ -35,6 +35,7 @@ struct bi_record {
extern struct bi_record *find_bootinfo(void); extern struct bi_record *find_bootinfo(void);
extern void parse_bootinfo(struct bi_record *rec); extern void parse_bootinfo(struct bi_record *rec);
extern unsigned long boot_mem_size;
#endif /* CONFIG_APUS */ #endif /* CONFIG_APUS */
......
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