sh: enable LMB region setup via machvec.
This plugs in a memory init callback in the machvec to permit boards to wire up various bits of memory directly in to LMB. A generic machvec implementation is provided that simply wraps around the normal Kconfig-derived memory start/size. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
080e71e13d
commit
19d8f84f86
@ -38,5 +38,6 @@ void IO_CONCAT(__IO_PREFIX,iounmap)(void *addr);
|
|||||||
|
|
||||||
void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size);
|
void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size);
|
||||||
void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr);
|
void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr);
|
||||||
|
void IO_CONCAT(__IO_PREFIX,mem_init)(void);
|
||||||
|
|
||||||
#undef __IO_PREFIX
|
#undef __IO_PREFIX
|
||||||
|
@ -49,6 +49,8 @@ struct sh_machine_vector {
|
|||||||
|
|
||||||
int (*mv_clk_init)(void);
|
int (*mv_clk_init)(void);
|
||||||
int (*mv_mode_pins)(void);
|
int (*mv_mode_pins)(void);
|
||||||
|
|
||||||
|
void (*mv_mem_init)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct sh_machine_vector sh_mv;
|
extern struct sh_machine_vector sh_mv;
|
||||||
|
@ -42,7 +42,6 @@ setup_bootmem_node(int nid, unsigned long start, unsigned long end)
|
|||||||
void __init plat_mem_setup(void);
|
void __init plat_mem_setup(void);
|
||||||
|
|
||||||
/* arch/sh/kernel/setup.c */
|
/* arch/sh/kernel/setup.c */
|
||||||
void __init setup_bootmem_allocator(unsigned long start_pfn);
|
|
||||||
void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
|
void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
|
||||||
unsigned long end_pfn);
|
unsigned long end_pfn);
|
||||||
|
|
||||||
|
@ -131,6 +131,7 @@ void __init sh_mv_setup(void)
|
|||||||
mv_set(ioport_unmap);
|
mv_set(ioport_unmap);
|
||||||
mv_set(irq_demux);
|
mv_set(irq_demux);
|
||||||
mv_set(mode_pins);
|
mv_set(mode_pins);
|
||||||
|
mv_set(mem_init);
|
||||||
|
|
||||||
if (!sh_mv.mv_nr_irqs)
|
if (!sh_mv.mv_nr_irqs)
|
||||||
sh_mv.mv_nr_irqs = NR_IRQS;
|
sh_mv.mv_nr_irqs = NR_IRQS;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This file handles the architecture-dependent parts of initialization
|
* This file handles the architecture-dependent parts of initialization
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Niibe Yutaka
|
* Copyright (C) 1999 Niibe Yutaka
|
||||||
* Copyright (C) 2002 - 2007 Paul Mundt
|
* Copyright (C) 2002 - 2010 Paul Mundt
|
||||||
*/
|
*/
|
||||||
#include <linux/screen_info.h>
|
#include <linux/screen_info.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
@ -41,6 +41,7 @@
|
|||||||
#include <asm/clock.h>
|
#include <asm/clock.h>
|
||||||
#include <asm/smp.h>
|
#include <asm/smp.h>
|
||||||
#include <asm/mmu_context.h>
|
#include <asm/mmu_context.h>
|
||||||
|
#include <asm/mmzone.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize loops_per_jiffy as 10000000 (1000MIPS).
|
* Initialize loops_per_jiffy as 10000000 (1000MIPS).
|
||||||
@ -247,7 +248,7 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
|
|||||||
add_active_range(nid, start_pfn, end_pfn);
|
add_active_range(nid, start_pfn, end_pfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init setup_bootmem_allocator(unsigned long free_pfn)
|
void __init do_init_bootmem(void)
|
||||||
{
|
{
|
||||||
unsigned long bootmap_size;
|
unsigned long bootmap_size;
|
||||||
unsigned long bootmap_pages, bootmem_paddr;
|
unsigned long bootmap_pages, bootmem_paddr;
|
||||||
@ -298,12 +299,9 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
|
|||||||
sparse_memory_present_with_active_regions(0);
|
sparse_memory_present_with_active_regions(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_NEED_MULTIPLE_NODES
|
|
||||||
static void __init setup_memory(void)
|
static void __init setup_memory(void)
|
||||||
{
|
{
|
||||||
unsigned long start_pfn;
|
unsigned long start_pfn;
|
||||||
u64 base = min_low_pfn << PAGE_SHIFT;
|
|
||||||
u64 size = (max_low_pfn << PAGE_SHIFT) - base;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Partially used pages are not usable - thus
|
* Partially used pages are not usable - thus
|
||||||
@ -311,8 +309,6 @@ static void __init setup_memory(void)
|
|||||||
*/
|
*/
|
||||||
start_pfn = PFN_UP(__pa(_end));
|
start_pfn = PFN_UP(__pa(_end));
|
||||||
|
|
||||||
lmb_add(base, size);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reserve the kernel text and
|
* Reserve the kernel text and
|
||||||
* Reserve the bootmem bitmap. We do this in two steps (first step
|
* Reserve the bootmem bitmap. We do this in two steps (first step
|
||||||
@ -333,11 +329,9 @@ static void __init setup_memory(void)
|
|||||||
lmb_analyze();
|
lmb_analyze();
|
||||||
lmb_dump_all();
|
lmb_dump_all();
|
||||||
|
|
||||||
setup_bootmem_allocator(start_pfn);
|
do_init_bootmem();
|
||||||
|
plat_mem_setup();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
extern void __init setup_memory(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
|
* Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
|
||||||
@ -358,7 +352,11 @@ static int __init parse_elfcorehdr(char *arg)
|
|||||||
early_param("elfcorehdr", parse_elfcorehdr);
|
early_param("elfcorehdr", parse_elfcorehdr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __init __attribute__ ((weak)) plat_early_device_setup(void)
|
void __init __weak plat_early_device_setup(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void __init __weak plat_mem_setup(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +424,10 @@ void __init setup_arch(char **cmdline_p)
|
|||||||
/* Let earlyprintk output early console messages */
|
/* Let earlyprintk output early console messages */
|
||||||
early_platform_driver_probe("earlyprintk", 1, 1);
|
early_platform_driver_probe("earlyprintk", 1, 1);
|
||||||
|
|
||||||
|
lmb_init();
|
||||||
|
|
||||||
sh_mv_setup();
|
sh_mv_setup();
|
||||||
|
sh_mv.mv_mem_init();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the highest page frame number we have available
|
* Find the highest page frame number we have available
|
||||||
@ -442,7 +443,6 @@ void __init setup_arch(char **cmdline_p)
|
|||||||
nodes_clear(node_online_map);
|
nodes_clear(node_online_map);
|
||||||
|
|
||||||
pmb_init();
|
pmb_init();
|
||||||
lmb_init();
|
|
||||||
setup_memory();
|
setup_memory();
|
||||||
sparse_init();
|
sparse_init();
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* linux/arch/sh/mm/init.c
|
* linux/arch/sh/mm/init.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Niibe Yutaka
|
* Copyright (C) 1999 Niibe Yutaka
|
||||||
* Copyright (C) 2002 - 2007 Paul Mundt
|
* Copyright (C) 2002 - 2010 Paul Mundt
|
||||||
*
|
*
|
||||||
* Based on linux/arch/i386/mm/init.c:
|
* Based on linux/arch/i386/mm/init.c:
|
||||||
* Copyright (C) 1995 Linus Torvalds
|
* Copyright (C) 1995 Linus Torvalds
|
||||||
@ -16,6 +16,7 @@
|
|||||||
#include <linux/pagemap.h>
|
#include <linux/pagemap.h>
|
||||||
#include <linux/percpu.h>
|
#include <linux/percpu.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
#include <linux/lmb.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <asm/mmu_context.h>
|
#include <asm/mmu_context.h>
|
||||||
#include <asm/tlb.h>
|
#include <asm/tlb.h>
|
||||||
@ -27,6 +28,11 @@
|
|||||||
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
|
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
|
||||||
pgd_t swapper_pg_dir[PTRS_PER_PGD];
|
pgd_t swapper_pg_dir[PTRS_PER_PGD];
|
||||||
|
|
||||||
|
void __init generic_mem_init(void)
|
||||||
|
{
|
||||||
|
lmb_add(__MEMORY_START, __MEMORY_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MMU
|
#ifdef CONFIG_MMU
|
||||||
static pte_t *__get_pte_phys(unsigned long addr)
|
static pte_t *__get_pte_phys(unsigned long addr)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user