diff options
-rw-r--r-- | arch/arm/mach-realview/Kconfig | 17 | ||||
-rw-r--r-- | arch/arm/mach-realview/core.c | 41 | ||||
-rw-r--r-- | arch/arm/mach-realview/core.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-realview/include/mach/memory.h | 56 | ||||
-rw-r--r-- | arch/arm/mach-realview/platsmp.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_eb.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_pb1176.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_pb11mp.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_pba8.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_pbx.c | 21 | ||||
-rw-r--r-- | include/linux/mmzone.h | 20 | ||||
-rw-r--r-- | mm/page_alloc.c | 10 |
12 files changed, 107 insertions, 85 deletions
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig index 3b5f6c74d9fb..c02cce367105 100644 --- a/arch/arm/mach-realview/Kconfig +++ b/arch/arm/mach-realview/Kconfig @@ -67,7 +67,7 @@ config MACH_REALVIEW_PBX bool "Support RealView/PBX platform" select ARM_GIC select HAVE_PATA_PLATFORM - select ARCH_SPARSEMEM_ENABLE if REALVIEW_HIGH_PHYS_OFFSET + select ARCH_SPARSEMEM_ENABLE if !REALVIEW_HIGH_PHYS_OFFSET && CPU_V7 select ZONE_DMA if SPARSEMEM help Include support for the ARM(R) RealView PBX platform. @@ -87,19 +87,4 @@ config ARCH_FLATMEM_ENABLE bool default y if ARCH_SPARSEMEM_ENABLE -config ZONE_DMA_IDX - int - default 1 - depends on MACH_REALVIEW_PBX && ZONE_DMA - -config ZONE_NORMAL_IDX - int - default 0 - depends on MACH_REALVIEW_PBX && ZONE_DMA - -config ZONE_MOVABLE_IDX - int - default 2 - depends on MACH_REALVIEW_PBX && ZONE_DMA - endmenu diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 01f29371c383..f2df45f3ec7d 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -63,17 +63,15 @@ void __iomem *gic_cpu_base_addr; void __init realview_adjust_zones(int node, unsigned long *size, unsigned long *hole) { - if (machine_is_realview_pbx()) { - /* - * Allow at least 16MB for ZONE_NORMAL. Note that ZONE_DMA is - * after ZONE_NORMAL in this configuration. - */ - unsigned long dma_size = min(UL(SZ_512M) >> PAGE_SHIFT, - size[0] - hole[0] - - (UL(SZ_16M) >> PAGE_SHIFT)); - size[ZONE_NORMAL] -= dma_size; - size[ZONE_DMA] = dma_size; - } + unsigned long dma_size = SZ_256M >> PAGE_SHIFT; + + if (!machine_is_realview_pbx() || node || (size[0] <= dma_size)) + return; + + size[ZONE_NORMAL] = size[0] - dma_size; + size[ZONE_DMA] = dma_size; + hole[ZONE_NORMAL] = hole[0]; + hole[ZONE_DMA] = 0; } #endif @@ -775,3 +773,24 @@ void __init realview_timer_init(unsigned int timer_irq) realview_clocksource_init(); realview_clockevents_init(timer_irq); } + +/* + * Setup the memory banks. + */ +void realview_fixup(struct machine_desc *mdesc, struct tag *tags, char **from, + struct meminfo *meminfo) +{ + /* + * Most RealView platforms have 512MB contiguous RAM at 0x70000000. + * Half of this is mirrored at 0. + */ +#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET + meminfo->bank[0].start = 0x70000000; + meminfo->bank[0].size = SZ_512M; + meminfo->nr_banks = 1; +#else + meminfo->bank[0].start = 0; + meminfo->bank[0].size = SZ_256M; + meminfo->nr_banks = 1; +#endif +} diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index 59d4fee96741..50659277da3c 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h @@ -25,6 +25,7 @@ #include <linux/amba/bus.h> #include <linux/io.h> +#include <asm/setup.h> #include <asm/leds.h> #define AMBA_DEVICE(name,busid,base,plat) \ @@ -44,6 +45,8 @@ static struct amba_device name##_device = { \ /* .dma = base##_DMA,*/ \ } +struct machine_desc; + extern struct platform_device realview_flash_device; extern struct platform_device realview_cf_device; extern struct platform_device realview_i2c_device; @@ -65,5 +68,7 @@ extern void realview_timer_init(unsigned int timer_irq); extern int realview_flash_register(struct resource *res, u32 num); extern int realview_eth_register(const char *name, struct resource *res); extern int realview_usb_register(struct resource *res); +extern void realview_fixup(struct machine_desc *mdesc, struct tag *tags, + char **from, struct meminfo *meminfo); #endif diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h index f00bde1520a5..d7c54a4c1d6a 100644 --- a/arch/arm/mach-realview/include/mach/memory.h +++ b/arch/arm/mach-realview/include/mach/memory.h @@ -36,52 +36,44 @@ extern void realview_adjust_zones(int node, unsigned long *size, realview_adjust_zones(node, size, hole) #endif +#ifdef CONFIG_SPARSEMEM + /* - * Sparsemem definitions, only valid for high PHYS_OFFSET. + * Sparsemem definitions for RealView PBX. * - * Most RealView boards (except PB1176) have 512MB of RAM at 0x70000000. The - * PBX board has another block of 512MB of RAM at 0x20000000, however only the - * block at 0x70000000 may be used for DMA. + * The RealView PBX board has another block of 512MB of RAM at 0x20000000, + * however only the block at 0x70000000 (or the 256MB mirror at 0x00000000) + * may be used for DMA. * * The macros below define a section size of 256MB and a non-linear virtual to * physical mapping: * - * 0x70000000 -> PAGE_OFFSET - * 0x20000000 -> PAGE_OFFSET + 0x20000000 - * 0x90000000 -> PAGE_OFFSET + 0x40000000 (required for high_memory) + * 256MB @ 0x00000000 -> PAGE_OFFSET + * 512MB @ 0x20000000 -> PAGE_OFFSET + 0x10000000 + * 256MB @ 0x80000000 -> PAGE_OFFSET + 0x30000000 */ -#ifdef CONFIG_SPARSEMEM - -#ifndef CONFIG_REALVIEW_HIGH_PHYS_OFFSET -#error "SPARSEMEM only available with REALVIEW_HIGH_PHYS_OFFSET" +#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET +#error "SPARSEMEM not available with REALVIEW_HIGH_PHYS_OFFSET" #endif #define MAX_PHYSMEM_BITS 32 #define SECTION_SIZE_BITS 28 -#define __phys_to_virt(phys) ({ \ - unsigned long virt = 0; \ - if ((phys) >= 0x90000000UL) \ - virt = (phys) - 0x50000000UL + PAGE_OFFSET; \ - else if ((phys) >= 0x70000000UL) \ - virt = (phys) - 0x70000000UL + PAGE_OFFSET; \ - else if ((phys) >= 0x20000000UL) \ - virt = (phys) + PAGE_OFFSET; \ - virt; \ -}) +/* bank page offsets */ +#define PAGE_OFFSET1 (PAGE_OFFSET + 0x10000000) +#define PAGE_OFFSET2 (PAGE_OFFSET + 0x30000000) -#define __virt_to_phys(virt) ({ \ - unsigned long phys = 0; \ - if ((virt) >= PAGE_OFFSET + 0x40000000UL) \ - phys = (virt) - PAGE_OFFSET + 0x50000000UL; \ - else if ((virt) >= PAGE_OFFSET + 0x20000000UL) \ - phys = (virt) - PAGE_OFFSET; \ - else if ((virt) >= PAGE_OFFSET) \ - phys = (virt) - PAGE_OFFSET + 0x70000000UL; \ - phys; \ -}) +#define __phys_to_virt(phys) \ + ((phys) >= 0x80000000 ? (phys) - 0x80000000 + PAGE_OFFSET2 : \ + (phys) >= 0x20000000 ? (phys) - 0x20000000 + PAGE_OFFSET1 : \ + (phys) + PAGE_OFFSET) -#endif +#define __virt_to_phys(virt) \ + ((virt) >= PAGE_OFFSET2 ? (virt) - PAGE_OFFSET2 + 0x80000000 : \ + (virt) >= PAGE_OFFSET1 ? (virt) - PAGE_OFFSET1 + 0x20000000 : \ + (virt) - PAGE_OFFSET) + +#endif /* CONFIG_SPARSEMEM */ /* * Virtual view <-> DMA view memory address translations diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index 13852339f999..4954a45b3b61 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c @@ -175,8 +175,12 @@ static void __init poke_milo(void) * register. The BootMonitor waits for this register to become * non-zero. */ + +#define REALVIEW_SYS_FLAGSS_OFFSET 0x30 +#define REALVIEW_SYS_FLAGSC_OFFSET 0x34 __raw_writel(BSYM(virt_to_phys(realview_secondary_startup)), - __io_address(REALVIEW_SYS_FLAGSSET)); + __io_address(REALVIEW_SYS_BASE) + + REALVIEW_SYS_FLAGSS_OFFSET); mb(); } diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index f439ccae6b1f..a0926ed56d11 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -408,6 +408,7 @@ MACHINE_START(REALVIEW_EB, "ARM-RealView EB") .phys_io = REALVIEW_EB_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_EB_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_fixup, .map_io = realview_eb_map_io, .init_irq = gic_init_irq, .timer = &realview_eb_timer, diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c index 237ce3c648b1..7cc75700a362 100644 --- a/arch/arm/mach-realview/realview_pb1176.c +++ b/arch/arm/mach-realview/realview_pb1176.c @@ -284,6 +284,18 @@ static struct sys_timer realview_pb1176_timer = { .init = realview_pb1176_timer_init, }; +static void realview_pb1176_fixup(struct machine_desc *mdesc, + struct tag *tags, char **from, + struct meminfo *meminfo) +{ + /* + * RealView PB1176 only has 128MB of RAM mapped at 0. + */ + meminfo->bank[0].start = 0; + meminfo->bank[0].size = SZ_128M; + meminfo->nr_banks = 1; +} + static void __init realview_pb1176_init(void) { int i; @@ -316,6 +328,7 @@ MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176") .phys_io = REALVIEW_PB1176_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PB1176_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_pb1176_fixup, .map_io = realview_pb1176_map_io, .init_irq = gic_init_irq, .timer = &realview_pb1176_timer, diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c index 95e48e11370e..fb11130004f2 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c @@ -326,6 +326,7 @@ MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") .phys_io = REALVIEW_PB11MP_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PB11MP_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_fixup, .map_io = realview_pb11mp_map_io, .init_irq = gic_init_irq, .timer = &realview_pb11mp_timer, diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c index ae0ab4c675c8..f6f145299096 100644 --- a/arch/arm/mach-realview/realview_pba8.c +++ b/arch/arm/mach-realview/realview_pba8.c @@ -284,6 +284,7 @@ MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8") .phys_io = REALVIEW_PBA8_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PBA8_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_fixup, .map_io = realview_pba8_map_io, .init_irq = gic_init_irq, .timer = &realview_pba8_timer, diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c index b6af0dc20b56..8cde31f51c78 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c @@ -311,6 +311,26 @@ static int __init realview_pbx_l2x0_init(void) early_initcall(realview_pbx_l2x0_init); #endif +static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags, + char **from, struct meminfo *meminfo) +{ +#ifdef CONFIG_SPARSEMEM + /* + * Memory configuration with SPARSEMEM enabled on RealView PBX (see + * asm/mach/memory.h for more information). + */ + meminfo->bank[0].start = 0; + meminfo->bank[0].size = SZ_256M; + meminfo->bank[1].start = 0x20000000; + meminfo->bank[1].size = SZ_512M; + meminfo->bank[2].start = 0x80000000; + meminfo->bank[2].size = SZ_256M; + meminfo->nr_banks = 3; +#else + realview_fixup(mdesc, tags, from, meminfo); +#endif +} + static void __init realview_pbx_init(void) { int i; @@ -339,6 +359,7 @@ MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") .phys_io = REALVIEW_PBX_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PBX_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_pbx_fixup, .map_io = realview_pbx_map_io, .init_irq = gic_init_irq, .timer = &realview_pbx_timer, diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 13ce4536c161..35a7b5e19465 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -212,34 +212,22 @@ enum zone_type { * i386, x86_64 and multiple other arches * <16M. */ -#ifdef CONFIG_ZONE_DMA_IDX - ZONE_DMA = CONFIG_ZONE_DMA_IDX, -#else ZONE_DMA, #endif -#endif #ifdef CONFIG_ZONE_DMA32 /* * x86_64 needs two ZONE_DMAs because it supports devices that are * only able to do DMA to the lower 16M but also 32 bit devices that * can only do DMA areas below 4G. */ -#ifdef CONFIG_ZONE_DMA32_IDX - ZONE_DMA32 = CONFIG_ZONE_DMA32_IDX, -#else ZONE_DMA32, #endif -#endif /* * Normal addressable memory is in ZONE_NORMAL. DMA operations can be * performed on pages in ZONE_NORMAL if the DMA devices support * transfers to all addressable memory. */ -#ifdef CONFIG_ZONE_NORMAL_IDX - ZONE_NORMAL = CONFIG_ZONE_NORMAL_IDX, -#else ZONE_NORMAL, -#endif #ifdef CONFIG_HIGHMEM /* * A memory area that is only addressable by the kernel through @@ -249,17 +237,9 @@ enum zone_type { * table entries on i386) for each page that the kernel needs to * access. */ -#ifdef CONFIG_ZONE_HIGHMEM_IDX - ZONE_HIGHMEM = CONFIG_ZONE_HIGHMEM_IDX, -#else ZONE_HIGHMEM, #endif -#endif -#ifdef CONFIG_ZONE_MOVABLE_IDX - ZONE_MOVABLE = CONFIG_ZONE_MOVABLE_IDX, -#else ZONE_MOVABLE, -#endif __MAX_NR_ZONES }; diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 09b6fd7145ed..d8ac01474563 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -106,16 +106,16 @@ EXPORT_SYMBOL(totalram_pages); static char * const zone_names[MAX_NR_ZONES] = { #ifdef CONFIG_ZONE_DMA - [ZONE_DMA] = "DMA", + "DMA", #endif #ifdef CONFIG_ZONE_DMA32 - [ZONE_DMA32] = "DMA32", + "DMA32", #endif - [ZONE_NORMAL] = "Normal", + "Normal", #ifdef CONFIG_HIGHMEM - [ZONE_HIGHMEN] = "HighMem", + "HighMem", #endif - [ZONE_MOVABLE] = "Movable", + "Movable", }; int min_free_kbytes = 1024; |