diff options
36 files changed, 179 insertions, 333 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ce64b7f66328..03551fafb1fd 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1101,11 +1101,6 @@ source "arch/arm/firmware/Kconfig" | |||
1101 | 1101 | ||
1102 | source arch/arm/mm/Kconfig | 1102 | source arch/arm/mm/Kconfig |
1103 | 1103 | ||
1104 | config ARM_NR_BANKS | ||
1105 | int | ||
1106 | default 16 if ARCH_EP93XX | ||
1107 | default 8 | ||
1108 | |||
1109 | config IWMMXT | 1104 | config IWMMXT |
1110 | bool "Enable iWMMXt support" if !CPU_PJ4 | 1105 | bool "Enable iWMMXt support" if !CPU_PJ4 |
1111 | depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4 | 1106 | depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4 |
diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index d1153c8a765a..9448aa0c6686 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c | |||
@@ -7,6 +7,8 @@ | |||
7 | #define do_extend_cmdline 0 | 7 | #define do_extend_cmdline 0 |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | #define NR_BANKS 16 | ||
11 | |||
10 | static int node_offset(void *fdt, const char *node_path) | 12 | static int node_offset(void *fdt, const char *node_path) |
11 | { | 13 | { |
12 | int offset = fdt_path_offset(fdt, node_path); | 14 | int offset = fdt_path_offset(fdt, node_path); |
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 17a3fa2979e8..c43473afde8a 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/reboot.h> | 14 | #include <linux/reboot.h> |
15 | 15 | ||
16 | struct tag; | 16 | struct tag; |
17 | struct meminfo; | ||
18 | struct pt_regs; | 17 | struct pt_regs; |
19 | struct smp_operations; | 18 | struct smp_operations; |
20 | #ifdef CONFIG_SMP | 19 | #ifdef CONFIG_SMP |
@@ -47,8 +46,7 @@ struct machine_desc { | |||
47 | enum reboot_mode reboot_mode; /* default restart mode */ | 46 | enum reboot_mode reboot_mode; /* default restart mode */ |
48 | struct smp_operations *smp; /* SMP operations */ | 47 | struct smp_operations *smp; /* SMP operations */ |
49 | bool (*smp_init)(void); | 48 | bool (*smp_init)(void); |
50 | void (*fixup)(struct tag *, char **, | 49 | void (*fixup)(struct tag *, char **); |
51 | struct meminfo *); | ||
52 | void (*init_meminfo)(void); | 50 | void (*init_meminfo)(void); |
53 | void (*reserve)(void);/* reserve mem blocks */ | 51 | void (*reserve)(void);/* reserve mem blocks */ |
54 | void (*map_io)(void);/* IO mapping function */ | 52 | void (*map_io)(void);/* IO mapping function */ |
diff --git a/arch/arm/include/asm/memblock.h b/arch/arm/include/asm/memblock.h index c2f5102ae659..bf47a6c110a2 100644 --- a/arch/arm/include/asm/memblock.h +++ b/arch/arm/include/asm/memblock.h | |||
@@ -1,10 +1,9 @@ | |||
1 | #ifndef _ASM_ARM_MEMBLOCK_H | 1 | #ifndef _ASM_ARM_MEMBLOCK_H |
2 | #define _ASM_ARM_MEMBLOCK_H | 2 | #define _ASM_ARM_MEMBLOCK_H |
3 | 3 | ||
4 | struct meminfo; | ||
5 | struct machine_desc; | 4 | struct machine_desc; |
6 | 5 | ||
7 | void arm_memblock_init(struct meminfo *, const struct machine_desc *); | 6 | void arm_memblock_init(const struct machine_desc *); |
8 | phys_addr_t arm_memblock_steal(phys_addr_t size, phys_addr_t align); | 7 | phys_addr_t arm_memblock_steal(phys_addr_t size, phys_addr_t align); |
9 | 8 | ||
10 | #endif | 9 | #endif |
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 8d6a089dfb76..e0adb9f1bf94 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h | |||
@@ -21,34 +21,6 @@ | |||
21 | #define __tagtable(tag, fn) \ | 21 | #define __tagtable(tag, fn) \ |
22 | static const struct tagtable __tagtable_##fn __tag = { tag, fn } | 22 | static const struct tagtable __tagtable_##fn __tag = { tag, fn } |
23 | 23 | ||
24 | /* | ||
25 | * Memory map description | ||
26 | */ | ||
27 | #define NR_BANKS CONFIG_ARM_NR_BANKS | ||
28 | |||
29 | struct membank { | ||
30 | phys_addr_t start; | ||
31 | phys_addr_t size; | ||
32 | unsigned int highmem; | ||
33 | }; | ||
34 | |||
35 | struct meminfo { | ||
36 | int nr_banks; | ||
37 | struct membank bank[NR_BANKS]; | ||
38 | }; | ||
39 | |||
40 | extern struct meminfo meminfo; | ||
41 | |||
42 | #define for_each_bank(iter,mi) \ | ||
43 | for (iter = 0; iter < (mi)->nr_banks; iter++) | ||
44 | |||
45 | #define bank_pfn_start(bank) __phys_to_pfn((bank)->start) | ||
46 | #define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size) | ||
47 | #define bank_pfn_size(bank) ((bank)->size >> PAGE_SHIFT) | ||
48 | #define bank_phys_start(bank) (bank)->start | ||
49 | #define bank_phys_end(bank) ((bank)->start + (bank)->size) | ||
50 | #define bank_phys_size(bank) (bank)->size | ||
51 | |||
52 | extern int arm_add_memory(u64 start, u64 size); | 24 | extern int arm_add_memory(u64 start, u64 size); |
53 | extern void early_print(const char *str, ...); | 25 | extern void early_print(const char *str, ...); |
54 | extern void dump_machine_table(void); | 26 | extern void dump_machine_table(void); |
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c index 8c14de8180c0..7807ef58a2ab 100644 --- a/arch/arm/kernel/atags_parse.c +++ b/arch/arm/kernel/atags_parse.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
23 | #include <linux/root_dev.h> | 23 | #include <linux/root_dev.h> |
24 | #include <linux/screen_info.h> | 24 | #include <linux/screen_info.h> |
25 | #include <linux/memblock.h> | ||
25 | 26 | ||
26 | #include <asm/setup.h> | 27 | #include <asm/setup.h> |
27 | #include <asm/system_info.h> | 28 | #include <asm/system_info.h> |
@@ -222,10 +223,10 @@ setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr) | |||
222 | } | 223 | } |
223 | 224 | ||
224 | if (mdesc->fixup) | 225 | if (mdesc->fixup) |
225 | mdesc->fixup(tags, &from, &meminfo); | 226 | mdesc->fixup(tags, &from); |
226 | 227 | ||
227 | if (tags->hdr.tag == ATAG_CORE) { | 228 | if (tags->hdr.tag == ATAG_CORE) { |
228 | if (meminfo.nr_banks != 0) | 229 | if (memblock_phys_mem_size()) |
229 | squash_mem_tags(tags); | 230 | squash_mem_tags(tags); |
230 | save_atags(tags); | 231 | save_atags(tags); |
231 | parse_tags(tags); | 232 | parse_tags(tags); |
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index c7419a585ddc..679a83d470cc 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c | |||
@@ -27,11 +27,6 @@ | |||
27 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
28 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
29 | 29 | ||
30 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) | ||
31 | { | ||
32 | arm_add_memory(base, size); | ||
33 | } | ||
34 | |||
35 | void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | 30 | void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) |
36 | { | 31 | { |
37 | return memblock_virt_alloc(size, align); | 32 | return memblock_virt_alloc(size, align); |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 50e198c1e9c8..6d78ba47ea5b 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -628,15 +628,8 @@ void __init dump_machine_table(void) | |||
628 | 628 | ||
629 | int __init arm_add_memory(u64 start, u64 size) | 629 | int __init arm_add_memory(u64 start, u64 size) |
630 | { | 630 | { |
631 | struct membank *bank = &meminfo.bank[meminfo.nr_banks]; | ||
632 | u64 aligned_start; | 631 | u64 aligned_start; |
633 | 632 | ||
634 | if (meminfo.nr_banks >= NR_BANKS) { | ||
635 | pr_crit("NR_BANKS too low, ignoring memory at 0x%08llx\n", | ||
636 | (long long)start); | ||
637 | return -EINVAL; | ||
638 | } | ||
639 | |||
640 | /* | 633 | /* |
641 | * Ensure that start/size are aligned to a page boundary. | 634 | * Ensure that start/size are aligned to a page boundary. |
642 | * Size is appropriately rounded down, start is rounded up. | 635 | * Size is appropriately rounded down, start is rounded up. |
@@ -677,17 +670,17 @@ int __init arm_add_memory(u64 start, u64 size) | |||
677 | aligned_start = PHYS_OFFSET; | 670 | aligned_start = PHYS_OFFSET; |
678 | } | 671 | } |
679 | 672 | ||
680 | bank->start = aligned_start; | 673 | start = aligned_start; |
681 | bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1); | 674 | size = size & ~(phys_addr_t)(PAGE_SIZE - 1); |
682 | 675 | ||
683 | /* | 676 | /* |
684 | * Check whether this memory region has non-zero size or | 677 | * Check whether this memory region has non-zero size or |
685 | * invalid node number. | 678 | * invalid node number. |
686 | */ | 679 | */ |
687 | if (bank->size == 0) | 680 | if (size == 0) |
688 | return -EINVAL; | 681 | return -EINVAL; |
689 | 682 | ||
690 | meminfo.nr_banks++; | 683 | memblock_add(start, size); |
691 | return 0; | 684 | return 0; |
692 | } | 685 | } |
693 | 686 | ||
@@ -695,6 +688,7 @@ int __init arm_add_memory(u64 start, u64 size) | |||
695 | * Pick out the memory size. We look for mem=size@start, | 688 | * Pick out the memory size. We look for mem=size@start, |
696 | * where start and size are "size[KkMm]" | 689 | * where start and size are "size[KkMm]" |
697 | */ | 690 | */ |
691 | |||
698 | static int __init early_mem(char *p) | 692 | static int __init early_mem(char *p) |
699 | { | 693 | { |
700 | static int usermem __initdata = 0; | 694 | static int usermem __initdata = 0; |
@@ -709,7 +703,8 @@ static int __init early_mem(char *p) | |||
709 | */ | 703 | */ |
710 | if (usermem == 0) { | 704 | if (usermem == 0) { |
711 | usermem = 1; | 705 | usermem = 1; |
712 | meminfo.nr_banks = 0; | 706 | memblock_remove(memblock_start_of_DRAM(), |
707 | memblock_end_of_DRAM() - memblock_start_of_DRAM()); | ||
713 | } | 708 | } |
714 | 709 | ||
715 | start = PHYS_OFFSET; | 710 | start = PHYS_OFFSET; |
@@ -854,13 +849,6 @@ static void __init reserve_crashkernel(void) | |||
854 | static inline void reserve_crashkernel(void) {} | 849 | static inline void reserve_crashkernel(void) {} |
855 | #endif /* CONFIG_KEXEC */ | 850 | #endif /* CONFIG_KEXEC */ |
856 | 851 | ||
857 | static int __init meminfo_cmp(const void *_a, const void *_b) | ||
858 | { | ||
859 | const struct membank *a = _a, *b = _b; | ||
860 | long cmp = bank_pfn_start(a) - bank_pfn_start(b); | ||
861 | return cmp < 0 ? -1 : cmp > 0 ? 1 : 0; | ||
862 | } | ||
863 | |||
864 | void __init hyp_mode_check(void) | 852 | void __init hyp_mode_check(void) |
865 | { | 853 | { |
866 | #ifdef CONFIG_ARM_VIRT_EXT | 854 | #ifdef CONFIG_ARM_VIRT_EXT |
@@ -903,12 +891,10 @@ void __init setup_arch(char **cmdline_p) | |||
903 | 891 | ||
904 | parse_early_param(); | 892 | parse_early_param(); |
905 | 893 | ||
906 | sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL); | ||
907 | |||
908 | early_paging_init(mdesc, lookup_processor_type(read_cpuid_id())); | 894 | early_paging_init(mdesc, lookup_processor_type(read_cpuid_id())); |
909 | setup_dma_zone(mdesc); | 895 | setup_dma_zone(mdesc); |
910 | sanity_check_meminfo(); | 896 | sanity_check_meminfo(); |
911 | arm_memblock_init(&meminfo, mdesc); | 897 | arm_memblock_init(mdesc); |
912 | 898 | ||
913 | paging_init(mdesc); | 899 | paging_init(mdesc); |
914 | request_standard_resources(mdesc); | 900 | request_standard_resources(mdesc); |
diff --git a/arch/arm/mach-clps711x/board-clep7312.c b/arch/arm/mach-clps711x/board-clep7312.c index 221b9de32dd6..94a7add88a3f 100644 --- a/arch/arm/mach-clps711x/board-clep7312.c +++ b/arch/arm/mach-clps711x/board-clep7312.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/memblock.h> | ||
21 | 22 | ||
22 | #include <asm/setup.h> | 23 | #include <asm/setup.h> |
23 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
@@ -26,11 +27,9 @@ | |||
26 | #include "common.h" | 27 | #include "common.h" |
27 | 28 | ||
28 | static void __init | 29 | static void __init |
29 | fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi) | 30 | fixup_clep7312(struct tag *tags, char **cmdline) |
30 | { | 31 | { |
31 | mi->nr_banks=1; | 32 | memblock_add(0xc0000000, 0x01000000); |
32 | mi->bank[0].start = 0xc0000000; | ||
33 | mi->bank[0].size = 0x01000000; | ||
34 | } | 33 | } |
35 | 34 | ||
36 | MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") | 35 | MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") |
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c index 077609841f14..f9828f89972a 100644 --- a/arch/arm/mach-clps711x/board-edb7211.c +++ b/arch/arm/mach-clps711x/board-edb7211.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/backlight.h> | 17 | #include <linux/backlight.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/memblock.h> | ||
19 | 20 | ||
20 | #include <linux/mtd/physmap.h> | 21 | #include <linux/mtd/physmap.h> |
21 | #include <linux/mtd/partitions.h> | 22 | #include <linux/mtd/partitions.h> |
@@ -133,7 +134,7 @@ static void __init edb7211_reserve(void) | |||
133 | } | 134 | } |
134 | 135 | ||
135 | static void __init | 136 | static void __init |
136 | fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi) | 137 | fixup_edb7211(struct tag *tags, char **cmdline) |
137 | { | 138 | { |
138 | /* | 139 | /* |
139 | * Bank start addresses are not present in the information | 140 | * Bank start addresses are not present in the information |
@@ -143,11 +144,8 @@ fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi) | |||
143 | * Banks sizes _are_ present in the param block, but we're | 144 | * Banks sizes _are_ present in the param block, but we're |
144 | * not using that information yet. | 145 | * not using that information yet. |
145 | */ | 146 | */ |
146 | mi->bank[0].start = 0xc0000000; | 147 | memblock_add(0xc0000000, SZ_8M); |
147 | mi->bank[0].size = SZ_8M; | 148 | memblock_add(0xc1000000, SZ_8M); |
148 | mi->bank[1].start = 0xc1000000; | ||
149 | mi->bank[1].size = SZ_8M; | ||
150 | mi->nr_banks = 2; | ||
151 | } | 149 | } |
152 | 150 | ||
153 | static void __init edb7211_init(void) | 151 | static void __init edb7211_init(void) |
diff --git a/arch/arm/mach-clps711x/board-p720t.c b/arch/arm/mach-clps711x/board-p720t.c index 67b733744ed7..0cf0e51e6546 100644 --- a/arch/arm/mach-clps711x/board-p720t.c +++ b/arch/arm/mach-clps711x/board-p720t.c | |||
@@ -295,7 +295,7 @@ static struct generic_bl_info p720t_lcd_backlight_pdata = { | |||
295 | }; | 295 | }; |
296 | 296 | ||
297 | static void __init | 297 | static void __init |
298 | fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi) | 298 | fixup_p720t(struct tag *tag, char **cmdline) |
299 | { | 299 | { |
300 | /* | 300 | /* |
301 | * Our bootloader doesn't setup any tags (yet). | 301 | * Our bootloader doesn't setup any tags (yet). |
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c index da0415094856..8f05489671b7 100644 --- a/arch/arm/mach-footbridge/cats-hw.c +++ b/arch/arm/mach-footbridge/cats-hw.c | |||
@@ -76,7 +76,7 @@ __initcall(cats_hw_init); | |||
76 | * hard reboots fail on early boards. | 76 | * hard reboots fail on early boards. |
77 | */ | 77 | */ |
78 | static void __init | 78 | static void __init |
79 | fixup_cats(struct tag *tags, char **cmdline, struct meminfo *mi) | 79 | fixup_cats(struct tag *tags, char **cmdline) |
80 | { | 80 | { |
81 | #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) | 81 | #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) |
82 | screen_info.orig_video_lines = 25; | 82 | screen_info.orig_video_lines = 25; |
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c index eb1fa5c84723..cdee08c6d239 100644 --- a/arch/arm/mach-footbridge/netwinder-hw.c +++ b/arch/arm/mach-footbridge/netwinder-hw.c | |||
@@ -620,7 +620,7 @@ __initcall(nw_hw_init); | |||
620 | * the parameter page. | 620 | * the parameter page. |
621 | */ | 621 | */ |
622 | static void __init | 622 | static void __init |
623 | fixup_netwinder(struct tag *tags, char **cmdline, struct meminfo *mi) | 623 | fixup_netwinder(struct tag *tags, char **cmdline) |
624 | { | 624 | { |
625 | #ifdef CONFIG_ISAPNP | 625 | #ifdef CONFIG_ISAPNP |
626 | extern int isapnp_disable; | 626 | extern int isapnp_disable; |
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c index a77529887cbc..61bfe584a9d7 100644 --- a/arch/arm/mach-msm/board-halibut.c +++ b/arch/arm/mach-msm/board-halibut.c | |||
@@ -83,11 +83,6 @@ static void __init halibut_init(void) | |||
83 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 83 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
84 | } | 84 | } |
85 | 85 | ||
86 | static void __init halibut_fixup(struct tag *tags, char **cmdline, | ||
87 | struct meminfo *mi) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | static void __init halibut_map_io(void) | 86 | static void __init halibut_map_io(void) |
92 | { | 87 | { |
93 | msm_map_common_io(); | 88 | msm_map_common_io(); |
@@ -100,7 +95,6 @@ static void __init halibut_init_late(void) | |||
100 | 95 | ||
101 | MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)") | 96 | MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)") |
102 | .atag_offset = 0x100, | 97 | .atag_offset = 0x100, |
103 | .fixup = halibut_fixup, | ||
104 | .map_io = halibut_map_io, | 98 | .map_io = halibut_map_io, |
105 | .init_early = halibut_init_early, | 99 | .init_early = halibut_init_early, |
106 | .init_irq = halibut_init_irq, | 100 | .init_irq = halibut_init_irq, |
diff --git a/arch/arm/mach-msm/board-mahimahi.c b/arch/arm/mach-msm/board-mahimahi.c index 7d9981cb400e..873c3ca3cd7e 100644 --- a/arch/arm/mach-msm/board-mahimahi.c +++ b/arch/arm/mach-msm/board-mahimahi.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/memblock.h> | ||
25 | 26 | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
@@ -52,16 +53,10 @@ static void __init mahimahi_init(void) | |||
52 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 53 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
53 | } | 54 | } |
54 | 55 | ||
55 | static void __init mahimahi_fixup(struct tag *tags, char **cmdline, | 56 | static void __init mahimahi_fixup(struct tag *tags, char **cmdline) |
56 | struct meminfo *mi) | ||
57 | { | 57 | { |
58 | mi->nr_banks = 2; | 58 | memblock_add(PHYS_OFFSET, 219*SZ_1M); |
59 | mi->bank[0].start = PHYS_OFFSET; | 59 | memblock_add(MSM_HIGHMEM_BASE, MSM_HIGHMEM_SIZE); |
60 | mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET); | ||
61 | mi->bank[0].size = (219*1024*1024); | ||
62 | mi->bank[1].start = MSM_HIGHMEM_BASE; | ||
63 | mi->bank[1].node = PHYS_TO_NID(MSM_HIGHMEM_BASE); | ||
64 | mi->bank[1].size = MSM_HIGHMEM_SIZE; | ||
65 | } | 60 | } |
66 | 61 | ||
67 | static void __init mahimahi_map_io(void) | 62 | static void __init mahimahi_map_io(void) |
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c index 46de789ad3ae..b621b23a5ecc 100644 --- a/arch/arm/mach-msm/board-msm7x30.c +++ b/arch/arm/mach-msm/board-msm7x30.c | |||
@@ -40,8 +40,7 @@ | |||
40 | #include "proc_comm.h" | 40 | #include "proc_comm.h" |
41 | #include "common.h" | 41 | #include "common.h" |
42 | 42 | ||
43 | static void __init msm7x30_fixup(struct tag *tag, char **cmdline, | 43 | static void __init msm7x30_fixup(struct tag *tag, char **cmdline) |
44 | struct meminfo *mi) | ||
45 | { | 44 | { |
46 | for (; tag->hdr.size; tag = tag_next(tag)) | 45 | for (; tag->hdr.size; tag = tag_next(tag)) |
47 | if (tag->hdr.tag == ATAG_MEM && tag->u.mem.start == 0x200000) { | 46 | if (tag->hdr.tag == ATAG_MEM && tag->u.mem.start == 0x200000) { |
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c index 327605174d63..e50967926dcd 100644 --- a/arch/arm/mach-msm/board-sapphire.c +++ b/arch/arm/mach-msm/board-sapphire.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include <linux/mtd/nand.h> | 36 | #include <linux/mtd/nand.h> |
37 | #include <linux/mtd/partitions.h> | 37 | #include <linux/mtd/partitions.h> |
38 | #include <linux/memblock.h> | ||
38 | 39 | ||
39 | #include "gpio_chip.h" | 40 | #include "gpio_chip.h" |
40 | #include "board-sapphire.h" | 41 | #include "board-sapphire.h" |
@@ -74,22 +75,18 @@ static struct map_desc sapphire_io_desc[] __initdata = { | |||
74 | } | 75 | } |
75 | }; | 76 | }; |
76 | 77 | ||
77 | static void __init sapphire_fixup(struct tag *tags, char **cmdline, | 78 | static void __init sapphire_fixup(struct tag *tags, char **cmdline) |
78 | struct meminfo *mi) | ||
79 | { | 79 | { |
80 | int smi_sz = parse_tag_smi((const struct tag *)tags); | 80 | int smi_sz = parse_tag_smi((const struct tag *)tags); |
81 | 81 | ||
82 | mi->nr_banks = 1; | ||
83 | mi->bank[0].start = PHYS_OFFSET; | ||
84 | mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET); | ||
85 | if (smi_sz == 32) { | 82 | if (smi_sz == 32) { |
86 | mi->bank[0].size = (84*1024*1024); | 83 | memblock_add(PHYS_OFFSET, 84*SZ_1M); |
87 | } else if (smi_sz == 64) { | 84 | } else if (smi_sz == 64) { |
88 | mi->bank[0].size = (101*1024*1024); | 85 | memblock_add(PHYS_OFFSET, 101*SZ_1M); |
89 | } else { | 86 | } else { |
87 | memblock_add(PHYS_OFFSET, 101*SZ_1M); | ||
90 | /* Give a default value when not get smi size */ | 88 | /* Give a default value when not get smi size */ |
91 | smi_sz = 64; | 89 | smi_sz = 64; |
92 | mi->bank[0].size = (101*1024*1024); | ||
93 | } | 90 | } |
94 | } | 91 | } |
95 | 92 | ||
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c index 015d544aa017..58826cfab6b0 100644 --- a/arch/arm/mach-msm/board-trout.c +++ b/arch/arm/mach-msm/board-trout.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/clkdev.h> | 21 | #include <linux/clkdev.h> |
22 | #include <linux/memblock.h> | ||
22 | 23 | ||
23 | #include <asm/system_info.h> | 24 | #include <asm/system_info.h> |
24 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
@@ -55,12 +56,9 @@ static void __init trout_init_irq(void) | |||
55 | msm_init_irq(); | 56 | msm_init_irq(); |
56 | } | 57 | } |
57 | 58 | ||
58 | static void __init trout_fixup(struct tag *tags, char **cmdline, | 59 | static void __init trout_fixup(struct tag *tags, char **cmdline) |
59 | struct meminfo *mi) | ||
60 | { | 60 | { |
61 | mi->nr_banks = 1; | 61 | memblock_add(PHYS_OFFSET, 101*SZ_1M); |
62 | mi->bank[0].start = PHYS_OFFSET; | ||
63 | mi->bank[0].size = (101*1024*1024); | ||
64 | } | 62 | } |
65 | 63 | ||
66 | static void __init trout_init(void) | 64 | static void __init trout_init(void) |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 3f1de1111e0f..6bbb7b55c6d1 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -365,8 +365,7 @@ void orion5x_restart(enum reboot_mode mode, const char *cmd) | |||
365 | * Many orion-based systems have buggy bootloader implementations. | 365 | * Many orion-based systems have buggy bootloader implementations. |
366 | * This is a common fixup for bogus memory tags. | 366 | * This is a common fixup for bogus memory tags. |
367 | */ | 367 | */ |
368 | void __init tag_fixup_mem32(struct tag *t, char **from, | 368 | void __init tag_fixup_mem32(struct tag *t, char **from) |
369 | struct meminfo *meminfo) | ||
370 | { | 369 | { |
371 | for (; t->hdr.size; t = tag_next(t)) | 370 | for (; t->hdr.size; t = tag_next(t)) |
372 | if (t->hdr.tag == ATAG_MEM && | 371 | if (t->hdr.tag == ATAG_MEM && |
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index f565f9944af2..175ec4ca8df6 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h | |||
@@ -71,9 +71,8 @@ void edmini_v2_init(void); | |||
71 | static inline void edmini_v2_init(void) {}; | 71 | static inline void edmini_v2_init(void) {}; |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | struct meminfo; | ||
75 | struct tag; | 74 | struct tag; |
76 | extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *); | 75 | extern void __init tag_fixup_mem32(struct tag *, char **); |
77 | 76 | ||
78 | /***************************************************************************** | 77 | /***************************************************************************** |
79 | * Helpers to access Orion registers | 78 | * Helpers to access Orion registers |
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index 584439bfa59f..4d3588d26c2a 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -837,8 +837,7 @@ static void __init cm_x300_init(void) | |||
837 | cm_x300_init_bl(); | 837 | cm_x300_init_bl(); |
838 | } | 838 | } |
839 | 839 | ||
840 | static void __init cm_x300_fixup(struct tag *tags, char **cmdline, | 840 | static void __init cm_x300_fixup(struct tag *tags, char **cmdline) |
841 | struct meminfo *mi) | ||
842 | { | 841 | { |
843 | /* Make sure that mi->bank[0].start = PHYS_ADDR */ | 842 | /* Make sure that mi->bank[0].start = PHYS_ADDR */ |
844 | for (; tags->hdr.size; tags = tag_next(tags)) | 843 | for (; tags->hdr.size; tags = tag_next(tags)) |
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 57d60542f982..91dd1c7cdbcd 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/input/matrix_keypad.h> | 34 | #include <linux/input/matrix_keypad.h> |
35 | #include <linux/gpio_keys.h> | 35 | #include <linux/gpio_keys.h> |
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/memblock.h> | ||
37 | #include <video/w100fb.h> | 38 | #include <video/w100fb.h> |
38 | 39 | ||
39 | #include <asm/setup.h> | 40 | #include <asm/setup.h> |
@@ -753,16 +754,13 @@ static void __init corgi_init(void) | |||
753 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 754 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
754 | } | 755 | } |
755 | 756 | ||
756 | static void __init fixup_corgi(struct tag *tags, char **cmdline, | 757 | static void __init fixup_corgi(struct tag *tags, char **cmdline) |
757 | struct meminfo *mi) | ||
758 | { | 758 | { |
759 | sharpsl_save_param(); | 759 | sharpsl_save_param(); |
760 | mi->nr_banks=1; | ||
761 | mi->bank[0].start = 0xa0000000; | ||
762 | if (machine_is_corgi()) | 760 | if (machine_is_corgi()) |
763 | mi->bank[0].size = (32*1024*1024); | 761 | memblock_add(0xa0000000, SZ_32M); |
764 | else | 762 | else |
765 | mi->bank[0].size = (64*1024*1024); | 763 | memblock_add(0xa0000000, SZ_64M); |
766 | } | 764 | } |
767 | 765 | ||
768 | #ifdef CONFIG_MACH_CORGI | 766 | #ifdef CONFIG_MACH_CORGI |
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index 8280ebcaab9f..cfb864173ce3 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/mtd/nand.h> | 21 | #include <linux/mtd/nand.h> |
22 | #include <linux/mtd/partitions.h> | 22 | #include <linux/mtd/partitions.h> |
23 | #include <linux/usb/gpio_vbus.h> | 23 | #include <linux/usb/gpio_vbus.h> |
24 | #include <linux/memblock.h> | ||
24 | 25 | ||
25 | #include <video/w100fb.h> | 26 | #include <video/w100fb.h> |
26 | 27 | ||
@@ -41,14 +42,12 @@ | |||
41 | #include "clock.h" | 42 | #include "clock.h" |
42 | 43 | ||
43 | /* Only e800 has 128MB RAM */ | 44 | /* Only e800 has 128MB RAM */ |
44 | void __init eseries_fixup(struct tag *tags, char **cmdline, struct meminfo *mi) | 45 | void __init eseries_fixup(struct tag *tags, char **cmdline) |
45 | { | 46 | { |
46 | mi->nr_banks=1; | ||
47 | mi->bank[0].start = 0xa0000000; | ||
48 | if (machine_is_e800()) | 47 | if (machine_is_e800()) |
49 | mi->bank[0].size = (128*1024*1024); | 48 | memblock_add(0xa0000000, SZ_128M); |
50 | else | 49 | else |
51 | mi->bank[0].size = (64*1024*1024); | 50 | memblock_add(0xa0000000, SZ_64M); |
52 | } | 51 | } |
53 | 52 | ||
54 | struct gpio_vbus_mach_info e7xx_udc_info = { | 53 | struct gpio_vbus_mach_info e7xx_udc_info = { |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index aedf053a1de5..131991629116 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/spi/ads7846.h> | 29 | #include <linux/spi/ads7846.h> |
30 | #include <linux/spi/pxa2xx_spi.h> | 30 | #include <linux/spi/pxa2xx_spi.h> |
31 | #include <linux/mtd/sharpsl.h> | 31 | #include <linux/mtd/sharpsl.h> |
32 | #include <linux/memblock.h> | ||
32 | 33 | ||
33 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
34 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
@@ -456,13 +457,10 @@ static void __init poodle_init(void) | |||
456 | poodle_init_spi(); | 457 | poodle_init_spi(); |
457 | } | 458 | } |
458 | 459 | ||
459 | static void __init fixup_poodle(struct tag *tags, char **cmdline, | 460 | static void __init fixup_poodle(struct tag *tags, char **cmdline) |
460 | struct meminfo *mi) | ||
461 | { | 461 | { |
462 | sharpsl_save_param(); | 462 | sharpsl_save_param(); |
463 | mi->nr_banks=1; | 463 | memblock_add(0xa0000000, SZ_32M); |
464 | mi->bank[0].start = 0xa0000000; | ||
465 | mi->bank[0].size = (32*1024*1024); | ||
466 | } | 464 | } |
467 | 465 | ||
468 | MACHINE_START(POODLE, "SHARP Poodle") | 466 | MACHINE_START(POODLE, "SHARP Poodle") |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 0b11c1af51c4..840c3a48e720 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/reboot.h> | 34 | #include <linux/reboot.h> |
35 | #include <linux/memblock.h> | ||
35 | 36 | ||
36 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
37 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
@@ -971,13 +972,10 @@ static void __init spitz_init(void) | |||
971 | spitz_i2c_init(); | 972 | spitz_i2c_init(); |
972 | } | 973 | } |
973 | 974 | ||
974 | static void __init spitz_fixup(struct tag *tags, char **cmdline, | 975 | static void __init spitz_fixup(struct tag *tags, char **cmdline) |
975 | struct meminfo *mi) | ||
976 | { | 976 | { |
977 | sharpsl_save_param(); | 977 | sharpsl_save_param(); |
978 | mi->nr_banks = 1; | 978 | memblock_add(0xa0000000, SZ_64M); |
979 | mi->bank[0].start = 0xa0000000; | ||
980 | mi->bank[0].size = (64*1024*1024); | ||
981 | } | 979 | } |
982 | 980 | ||
983 | #ifdef CONFIG_MACH_SPITZ | 981 | #ifdef CONFIG_MACH_SPITZ |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index ef5557b807ed..c158a6e3e0aa 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/i2c/pxa-i2c.h> | 37 | #include <linux/i2c/pxa-i2c.h> |
38 | #include <linux/usb/gpio_vbus.h> | 38 | #include <linux/usb/gpio_vbus.h> |
39 | #include <linux/reboot.h> | 39 | #include <linux/reboot.h> |
40 | #include <linux/memblock.h> | ||
40 | 41 | ||
41 | #include <asm/setup.h> | 42 | #include <asm/setup.h> |
42 | #include <asm/mach-types.h> | 43 | #include <asm/mach-types.h> |
@@ -960,13 +961,10 @@ static void __init tosa_init(void) | |||
960 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 961 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
961 | } | 962 | } |
962 | 963 | ||
963 | static void __init fixup_tosa(struct tag *tags, char **cmdline, | 964 | static void __init fixup_tosa(struct tag *tags, char **cmdline) |
964 | struct meminfo *mi) | ||
965 | { | 965 | { |
966 | sharpsl_save_param(); | 966 | sharpsl_save_param(); |
967 | mi->nr_banks=1; | 967 | memblock_add(0xa0000000, SZ_64M); |
968 | mi->bank[0].start = 0xa0000000; | ||
969 | mi->bank[0].size = (64*1024*1024); | ||
970 | } | 968 | } |
971 | 969 | ||
972 | MACHINE_START(TOSA, "SHARP Tosa") | 970 | MACHINE_START(TOSA, "SHARP Tosa") |
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 1d5ee5c9a1dc..c2fae3a5aad8 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/amba/mmci.h> | 31 | #include <linux/amba/mmci.h> |
32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
33 | #include <linux/mtd/physmap.h> | 33 | #include <linux/mtd/physmap.h> |
34 | #include <linux/memblock.h> | ||
34 | 35 | ||
35 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
36 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
@@ -370,19 +371,15 @@ void __init realview_timer_init(unsigned int timer_irq) | |||
370 | /* | 371 | /* |
371 | * Setup the memory banks. | 372 | * Setup the memory banks. |
372 | */ | 373 | */ |
373 | void realview_fixup(struct tag *tags, char **from, struct meminfo *meminfo) | 374 | void realview_fixup(struct tag *tags, char **from) |
374 | { | 375 | { |
375 | /* | 376 | /* |
376 | * Most RealView platforms have 512MB contiguous RAM at 0x70000000. | 377 | * Most RealView platforms have 512MB contiguous RAM at 0x70000000. |
377 | * Half of this is mirrored at 0. | 378 | * Half of this is mirrored at 0. |
378 | */ | 379 | */ |
379 | #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET | 380 | #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET |
380 | meminfo->bank[0].start = 0x70000000; | 381 | memblock_add(0x70000000, SZ_512M); |
381 | meminfo->bank[0].size = SZ_512M; | ||
382 | meminfo->nr_banks = 1; | ||
383 | #else | 382 | #else |
384 | meminfo->bank[0].start = 0; | 383 | memblock_add(0, SZ_256M); |
385 | meminfo->bank[0].size = SZ_256M; | ||
386 | meminfo->nr_banks = 1; | ||
387 | #endif | 384 | #endif |
388 | } | 385 | } |
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index 602ca5ec52c5..844946da3c66 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h | |||
@@ -51,8 +51,7 @@ extern int realview_flash_register(struct resource *res, u32 num); | |||
51 | extern int realview_eth_register(const char *name, struct resource *res); | 51 | extern int realview_eth_register(const char *name, struct resource *res); |
52 | extern int realview_usb_register(struct resource *res); | 52 | extern int realview_usb_register(struct resource *res); |
53 | extern void realview_init_early(void); | 53 | extern void realview_init_early(void); |
54 | extern void realview_fixup(struct tag *tags, char **from, | 54 | extern void realview_fixup(struct tag *tags, char **from); |
55 | struct meminfo *meminfo); | ||
56 | 55 | ||
57 | extern struct smp_operations realview_smp_ops; | 56 | extern struct smp_operations realview_smp_ops; |
58 | extern void realview_cpu_die(unsigned int cpu); | 57 | extern void realview_cpu_die(unsigned int cpu); |
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c index c5eade76461b..6abf6a037b9e 100644 --- a/arch/arm/mach-realview/realview_pb1176.c +++ b/arch/arm/mach-realview/realview_pb1176.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/irqchip/arm-gic.h> | 32 | #include <linux/irqchip/arm-gic.h> |
33 | #include <linux/platform_data/clk-realview.h> | 33 | #include <linux/platform_data/clk-realview.h> |
34 | #include <linux/reboot.h> | 34 | #include <linux/reboot.h> |
35 | #include <linux/memblock.h> | ||
35 | 36 | ||
36 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
37 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
@@ -339,15 +340,12 @@ static void realview_pb1176_restart(enum reboot_mode mode, const char *cmd) | |||
339 | dsb(); | 340 | dsb(); |
340 | } | 341 | } |
341 | 342 | ||
342 | static void realview_pb1176_fixup(struct tag *tags, char **from, | 343 | static void realview_pb1176_fixup(struct tag *tags, char **from) |
343 | struct meminfo *meminfo) | ||
344 | { | 344 | { |
345 | /* | 345 | /* |
346 | * RealView PB1176 only has 128MB of RAM mapped at 0. | 346 | * RealView PB1176 only has 128MB of RAM mapped at 0. |
347 | */ | 347 | */ |
348 | meminfo->bank[0].start = 0; | 348 | memblock_add(0, SZ_128M); |
349 | meminfo->bank[0].size = SZ_128M; | ||
350 | meminfo->nr_banks = 1; | ||
351 | } | 349 | } |
352 | 350 | ||
353 | static void __init realview_pb1176_init(void) | 351 | static void __init realview_pb1176_init(void) |
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c index 9d75493e3f0c..60d322ad9db4 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/irqchip/arm-gic.h> | 29 | #include <linux/irqchip/arm-gic.h> |
30 | #include <linux/platform_data/clk-realview.h> | 30 | #include <linux/platform_data/clk-realview.h> |
31 | #include <linux/reboot.h> | 31 | #include <linux/reboot.h> |
32 | #include <linux/memblock.h> | ||
32 | 33 | ||
33 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
34 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
@@ -325,23 +326,19 @@ static void __init realview_pbx_timer_init(void) | |||
325 | realview_pbx_twd_init(); | 326 | realview_pbx_twd_init(); |
326 | } | 327 | } |
327 | 328 | ||
328 | static void realview_pbx_fixup(struct tag *tags, char **from, | 329 | static void realview_pbx_fixup(struct tag *tags, char **from) |
329 | struct meminfo *meminfo) | ||
330 | { | 330 | { |
331 | #ifdef CONFIG_SPARSEMEM | 331 | #ifdef CONFIG_SPARSEMEM |
332 | /* | 332 | /* |
333 | * Memory configuration with SPARSEMEM enabled on RealView PBX (see | 333 | * Memory configuration with SPARSEMEM enabled on RealView PBX (see |
334 | * asm/mach/memory.h for more information). | 334 | * asm/mach/memory.h for more information). |
335 | */ | 335 | */ |
336 | meminfo->bank[0].start = 0; | 336 | |
337 | meminfo->bank[0].size = SZ_256M; | 337 | memblock_add(0, SZ_256M); |
338 | meminfo->bank[1].start = 0x20000000; | 338 | memblock_add(0x20000000, SZ_512M); |
339 | meminfo->bank[1].size = SZ_512M; | 339 | memblock_add(0x80000000, SZ_256M); |
340 | meminfo->bank[2].start = 0x80000000; | ||
341 | meminfo->bank[2].size = SZ_256M; | ||
342 | meminfo->nr_banks = 3; | ||
343 | #else | 340 | #else |
344 | realview_fixup(tags, from, meminfo); | 341 | realview_fixup(tags, from); |
345 | #endif | 342 | #endif |
346 | } | 343 | } |
347 | 344 | ||
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c index 233fe52d2015..a03c855ee854 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2413.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/serial_s3c.h> | 22 | #include <linux/serial_s3c.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/memblock.h> | ||
25 | 26 | ||
26 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
27 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
@@ -93,13 +94,10 @@ static struct platform_device *smdk2413_devices[] __initdata = { | |||
93 | &s3c2412_device_dma, | 94 | &s3c2412_device_dma, |
94 | }; | 95 | }; |
95 | 96 | ||
96 | static void __init smdk2413_fixup(struct tag *tags, char **cmdline, | 97 | static void __init smdk2413_fixup(struct tag *tags, char **cmdline) |
97 | struct meminfo *mi) | ||
98 | { | 98 | { |
99 | if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { | 99 | if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { |
100 | mi->nr_banks=1; | 100 | memblock_add(0x30000000, SZ_64M); |
101 | mi->bank[0].start = 0x30000000; | ||
102 | mi->bank[0].size = SZ_64M; | ||
103 | } | 101 | } |
104 | } | 102 | } |
105 | 103 | ||
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c index 40868c0e0a68..a79af7843aed 100644 --- a/arch/arm/mach-s3c24xx/mach-vstms.c +++ b/arch/arm/mach-s3c24xx/mach-vstms.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mtd/nand.h> | 23 | #include <linux/mtd/nand.h> |
24 | #include <linux/mtd/nand_ecc.h> | 24 | #include <linux/mtd/nand_ecc.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/memblock.h> | ||
26 | 27 | ||
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
28 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
@@ -129,13 +130,10 @@ static struct platform_device *vstms_devices[] __initdata = { | |||
129 | &s3c2412_device_dma, | 130 | &s3c2412_device_dma, |
130 | }; | 131 | }; |
131 | 132 | ||
132 | static void __init vstms_fixup(struct tag *tags, char **cmdline, | 133 | static void __init vstms_fixup(struct tag *tags, char **cmdline) |
133 | struct meminfo *mi) | ||
134 | { | 134 | { |
135 | if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { | 135 | if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { |
136 | mi->nr_banks=1; | 136 | memblock_add(0x30000000, SZ_64M); |
137 | mi->bank[0].start = 0x30000000; | ||
138 | mi->bank[0].size = SZ_64M; | ||
139 | } | 137 | } |
140 | } | 138 | } |
141 | 139 | ||
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index 8443a27bca2f..7dd894ece9ae 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c | |||
@@ -531,7 +531,7 @@ static void __init get_assabet_scr(void) | |||
531 | } | 531 | } |
532 | 532 | ||
533 | static void __init | 533 | static void __init |
534 | fixup_assabet(struct tag *tags, char **cmdline, struct meminfo *mi) | 534 | fixup_assabet(struct tag *tags, char **cmdline) |
535 | { | 535 | { |
536 | /* This must be done before any call to machine_has_neponset() */ | 536 | /* This must be done before any call to machine_has_neponset() */ |
537 | map_sa1100_gpio_regs(); | 537 | map_sa1100_gpio_regs(); |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 2a77ba8796ae..c8ab21dc2178 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -81,24 +81,21 @@ __tagtable(ATAG_INITRD2, parse_tag_initrd2); | |||
81 | * initialization functions, as well as show_mem() for the skipping | 81 | * initialization functions, as well as show_mem() for the skipping |
82 | * of holes in the memory map. It is populated by arm_add_memory(). | 82 | * of holes in the memory map. It is populated by arm_add_memory(). |
83 | */ | 83 | */ |
84 | struct meminfo meminfo; | ||
85 | |||
86 | void show_mem(unsigned int filter) | 84 | void show_mem(unsigned int filter) |
87 | { | 85 | { |
88 | int free = 0, total = 0, reserved = 0; | 86 | int free = 0, total = 0, reserved = 0; |
89 | int shared = 0, cached = 0, slab = 0, i; | 87 | int shared = 0, cached = 0, slab = 0; |
90 | struct meminfo * mi = &meminfo; | 88 | struct memblock_region *reg; |
91 | 89 | ||
92 | printk("Mem-info:\n"); | 90 | printk("Mem-info:\n"); |
93 | show_free_areas(filter); | 91 | show_free_areas(filter); |
94 | 92 | ||
95 | for_each_bank (i, mi) { | 93 | for_each_memblock (memory, reg) { |
96 | struct membank *bank = &mi->bank[i]; | ||
97 | unsigned int pfn1, pfn2; | 94 | unsigned int pfn1, pfn2; |
98 | struct page *page, *end; | 95 | struct page *page, *end; |
99 | 96 | ||
100 | pfn1 = bank_pfn_start(bank); | 97 | pfn1 = memblock_region_memory_base_pfn(reg); |
101 | pfn2 = bank_pfn_end(bank); | 98 | pfn2 = memblock_region_memory_end_pfn(reg); |
102 | 99 | ||
103 | page = pfn_to_page(pfn1); | 100 | page = pfn_to_page(pfn1); |
104 | end = pfn_to_page(pfn2 - 1) + 1; | 101 | end = pfn_to_page(pfn2 - 1) + 1; |
@@ -115,8 +112,9 @@ void show_mem(unsigned int filter) | |||
115 | free++; | 112 | free++; |
116 | else | 113 | else |
117 | shared += page_count(page) - 1; | 114 | shared += page_count(page) - 1; |
118 | page++; | 115 | pfn1++; |
119 | } while (page < end); | 116 | page = pfn_to_page(pfn1); |
117 | } while (pfn1 < pfn2); | ||
120 | } | 118 | } |
121 | 119 | ||
122 | printk("%d pages of RAM\n", total); | 120 | printk("%d pages of RAM\n", total); |
@@ -130,16 +128,9 @@ void show_mem(unsigned int filter) | |||
130 | static void __init find_limits(unsigned long *min, unsigned long *max_low, | 128 | static void __init find_limits(unsigned long *min, unsigned long *max_low, |
131 | unsigned long *max_high) | 129 | unsigned long *max_high) |
132 | { | 130 | { |
133 | struct meminfo *mi = &meminfo; | 131 | *max_low = PFN_DOWN(memblock_get_current_limit()); |
134 | int i; | 132 | *min = PFN_UP(memblock_start_of_DRAM()); |
135 | 133 | *max_high = PFN_DOWN(memblock_end_of_DRAM()); | |
136 | /* This assumes the meminfo array is properly sorted */ | ||
137 | *min = bank_pfn_start(&mi->bank[0]); | ||
138 | for_each_bank (i, mi) | ||
139 | if (mi->bank[i].highmem) | ||
140 | break; | ||
141 | *max_low = bank_pfn_end(&mi->bank[i - 1]); | ||
142 | *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]); | ||
143 | } | 134 | } |
144 | 135 | ||
145 | #ifdef CONFIG_ZONE_DMA | 136 | #ifdef CONFIG_ZONE_DMA |
@@ -274,14 +265,8 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align) | |||
274 | return phys; | 265 | return phys; |
275 | } | 266 | } |
276 | 267 | ||
277 | void __init arm_memblock_init(struct meminfo *mi, | 268 | void __init arm_memblock_init(const struct machine_desc *mdesc) |
278 | const struct machine_desc *mdesc) | ||
279 | { | 269 | { |
280 | int i; | ||
281 | |||
282 | for (i = 0; i < mi->nr_banks; i++) | ||
283 | memblock_add(mi->bank[i].start, mi->bank[i].size); | ||
284 | |||
285 | /* Register the kernel text, kernel data and initrd with memblock. */ | 270 | /* Register the kernel text, kernel data and initrd with memblock. */ |
286 | #ifdef CONFIG_XIP_KERNEL | 271 | #ifdef CONFIG_XIP_KERNEL |
287 | memblock_reserve(__pa(_sdata), _end - _sdata); | 272 | memblock_reserve(__pa(_sdata), _end - _sdata); |
@@ -413,54 +398,53 @@ free_memmap(unsigned long start_pfn, unsigned long end_pfn) | |||
413 | /* | 398 | /* |
414 | * The mem_map array can get very big. Free the unused area of the memory map. | 399 | * The mem_map array can get very big. Free the unused area of the memory map. |
415 | */ | 400 | */ |
416 | static void __init free_unused_memmap(struct meminfo *mi) | 401 | static void __init free_unused_memmap(void) |
417 | { | 402 | { |
418 | unsigned long bank_start, prev_bank_end = 0; | 403 | unsigned long start, prev_end = 0; |
419 | unsigned int i; | 404 | struct memblock_region *reg; |
420 | 405 | ||
421 | /* | 406 | /* |
422 | * This relies on each bank being in address order. | 407 | * This relies on each bank being in address order. |
423 | * The banks are sorted previously in bootmem_init(). | 408 | * The banks are sorted previously in bootmem_init(). |
424 | */ | 409 | */ |
425 | for_each_bank(i, mi) { | 410 | for_each_memblock(memory, reg) { |
426 | struct membank *bank = &mi->bank[i]; | 411 | start = memblock_region_memory_base_pfn(reg); |
427 | |||
428 | bank_start = bank_pfn_start(bank); | ||
429 | 412 | ||
430 | #ifdef CONFIG_SPARSEMEM | 413 | #ifdef CONFIG_SPARSEMEM |
431 | /* | 414 | /* |
432 | * Take care not to free memmap entries that don't exist | 415 | * Take care not to free memmap entries that don't exist |
433 | * due to SPARSEMEM sections which aren't present. | 416 | * due to SPARSEMEM sections which aren't present. |
434 | */ | 417 | */ |
435 | bank_start = min(bank_start, | 418 | start = min(start, |
436 | ALIGN(prev_bank_end, PAGES_PER_SECTION)); | 419 | ALIGN(prev_end, PAGES_PER_SECTION)); |
437 | #else | 420 | #else |
438 | /* | 421 | /* |
439 | * Align down here since the VM subsystem insists that the | 422 | * Align down here since the VM subsystem insists that the |
440 | * memmap entries are valid from the bank start aligned to | 423 | * memmap entries are valid from the bank start aligned to |
441 | * MAX_ORDER_NR_PAGES. | 424 | * MAX_ORDER_NR_PAGES. |
442 | */ | 425 | */ |
443 | bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES); | 426 | start = round_down(start, MAX_ORDER_NR_PAGES); |
444 | #endif | 427 | #endif |
445 | /* | 428 | /* |
446 | * If we had a previous bank, and there is a space | 429 | * If we had a previous bank, and there is a space |
447 | * between the current bank and the previous, free it. | 430 | * between the current bank and the previous, free it. |
448 | */ | 431 | */ |
449 | if (prev_bank_end && prev_bank_end < bank_start) | 432 | if (prev_end && prev_end < start) |
450 | free_memmap(prev_bank_end, bank_start); | 433 | free_memmap(prev_end, start); |
451 | 434 | ||
452 | /* | 435 | /* |
453 | * Align up here since the VM subsystem insists that the | 436 | * Align up here since the VM subsystem insists that the |
454 | * memmap entries are valid from the bank end aligned to | 437 | * memmap entries are valid from the bank end aligned to |
455 | * MAX_ORDER_NR_PAGES. | 438 | * MAX_ORDER_NR_PAGES. |
456 | */ | 439 | */ |
457 | prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES); | 440 | prev_end = ALIGN(memblock_region_memory_end_pfn(reg), |
441 | MAX_ORDER_NR_PAGES); | ||
458 | } | 442 | } |
459 | 443 | ||
460 | #ifdef CONFIG_SPARSEMEM | 444 | #ifdef CONFIG_SPARSEMEM |
461 | if (!IS_ALIGNED(prev_bank_end, PAGES_PER_SECTION)) | 445 | if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION)) |
462 | free_memmap(prev_bank_end, | 446 | free_memmap(prev_end, |
463 | ALIGN(prev_bank_end, PAGES_PER_SECTION)); | 447 | ALIGN(prev_end, PAGES_PER_SECTION)); |
464 | #endif | 448 | #endif |
465 | } | 449 | } |
466 | 450 | ||
@@ -536,7 +520,7 @@ void __init mem_init(void) | |||
536 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); | 520 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); |
537 | 521 | ||
538 | /* this will put all unused low memory onto the freelists */ | 522 | /* this will put all unused low memory onto the freelists */ |
539 | free_unused_memmap(&meminfo); | 523 | free_unused_memmap(); |
540 | free_all_bootmem(); | 524 | free_all_bootmem(); |
541 | 525 | ||
542 | #ifdef CONFIG_SA1111 | 526 | #ifdef CONFIG_SA1111 |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index a991ce2f18d4..82ea2b3fb9b5 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -1062,74 +1062,47 @@ phys_addr_t arm_lowmem_limit __initdata = 0; | |||
1062 | void __init sanity_check_meminfo(void) | 1062 | void __init sanity_check_meminfo(void) |
1063 | { | 1063 | { |
1064 | phys_addr_t memblock_limit = 0; | 1064 | phys_addr_t memblock_limit = 0; |
1065 | int i, j, highmem = 0; | 1065 | int highmem = 0; |
1066 | phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1; | 1066 | phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1; |
1067 | struct memblock_region *reg; | ||
1067 | 1068 | ||
1068 | for (i = 0, j = 0; i < meminfo.nr_banks; i++) { | 1069 | for_each_memblock(memory, reg) { |
1069 | struct membank *bank = &meminfo.bank[j]; | 1070 | phys_addr_t block_start = reg->base; |
1070 | phys_addr_t size_limit; | 1071 | phys_addr_t block_end = reg->base + reg->size; |
1071 | 1072 | phys_addr_t size_limit = reg->size; | |
1072 | *bank = meminfo.bank[i]; | ||
1073 | size_limit = bank->size; | ||
1074 | 1073 | ||
1075 | if (bank->start >= vmalloc_limit) | 1074 | if (reg->base >= vmalloc_limit) |
1076 | highmem = 1; | 1075 | highmem = 1; |
1077 | else | 1076 | else |
1078 | size_limit = vmalloc_limit - bank->start; | 1077 | size_limit = vmalloc_limit - reg->base; |
1079 | 1078 | ||
1080 | bank->highmem = highmem; | ||
1081 | 1079 | ||
1082 | #ifdef CONFIG_HIGHMEM | 1080 | if (!IS_ENABLED(CONFIG_HIGHMEM) || cache_is_vipt_aliasing()) { |
1083 | /* | 1081 | |
1084 | * Split those memory banks which are partially overlapping | 1082 | if (highmem) { |
1085 | * the vmalloc area greatly simplifying things later. | 1083 | pr_notice("Ignoring RAM at %pa-%pa (!CONFIG_HIGHMEM)\n", |
1086 | */ | 1084 | &block_start, &block_end); |
1087 | if (!highmem && bank->size > size_limit) { | 1085 | memblock_remove(reg->base, reg->size); |
1088 | if (meminfo.nr_banks >= NR_BANKS) { | 1086 | continue; |
1089 | printk(KERN_CRIT "NR_BANKS too low, " | ||
1090 | "ignoring high memory\n"); | ||
1091 | } else { | ||
1092 | memmove(bank + 1, bank, | ||
1093 | (meminfo.nr_banks - i) * sizeof(*bank)); | ||
1094 | meminfo.nr_banks++; | ||
1095 | i++; | ||
1096 | bank[1].size -= size_limit; | ||
1097 | bank[1].start = vmalloc_limit; | ||
1098 | bank[1].highmem = highmem = 1; | ||
1099 | j++; | ||
1100 | } | 1087 | } |
1101 | bank->size = size_limit; | ||
1102 | } | ||
1103 | #else | ||
1104 | /* | ||
1105 | * Highmem banks not allowed with !CONFIG_HIGHMEM. | ||
1106 | */ | ||
1107 | if (highmem) { | ||
1108 | printk(KERN_NOTICE "Ignoring RAM at %.8llx-%.8llx " | ||
1109 | "(!CONFIG_HIGHMEM).\n", | ||
1110 | (unsigned long long)bank->start, | ||
1111 | (unsigned long long)bank->start + bank->size - 1); | ||
1112 | continue; | ||
1113 | } | ||
1114 | 1088 | ||
1115 | /* | 1089 | if (reg->size > size_limit) { |
1116 | * Check whether this memory bank would partially overlap | 1090 | phys_addr_t overlap_size = reg->size - size_limit; |
1117 | * the vmalloc area. | 1091 | |
1118 | */ | 1092 | pr_notice("Truncating RAM at %pa-%pa to -%pa", |
1119 | if (bank->size > size_limit) { | 1093 | &block_start, &block_end, &vmalloc_limit); |
1120 | printk(KERN_NOTICE "Truncating RAM at %.8llx-%.8llx " | 1094 | memblock_remove(vmalloc_limit, overlap_size); |
1121 | "to -%.8llx (vmalloc region overlap).\n", | 1095 | block_end = vmalloc_limit; |
1122 | (unsigned long long)bank->start, | 1096 | } |
1123 | (unsigned long long)bank->start + bank->size - 1, | ||
1124 | (unsigned long long)bank->start + size_limit - 1); | ||
1125 | bank->size = size_limit; | ||
1126 | } | 1097 | } |
1127 | #endif | ||
1128 | if (!bank->highmem) { | ||
1129 | phys_addr_t bank_end = bank->start + bank->size; | ||
1130 | 1098 | ||
1131 | if (bank_end > arm_lowmem_limit) | 1099 | if (!highmem) { |
1132 | arm_lowmem_limit = bank_end; | 1100 | if (block_end > arm_lowmem_limit) { |
1101 | if (reg->size > size_limit) | ||
1102 | arm_lowmem_limit = vmalloc_limit; | ||
1103 | else | ||
1104 | arm_lowmem_limit = block_end; | ||
1105 | } | ||
1133 | 1106 | ||
1134 | /* | 1107 | /* |
1135 | * Find the first non-section-aligned page, and point | 1108 | * Find the first non-section-aligned page, and point |
@@ -1145,35 +1118,15 @@ void __init sanity_check_meminfo(void) | |||
1145 | * occurs before any free memory is mapped. | 1118 | * occurs before any free memory is mapped. |
1146 | */ | 1119 | */ |
1147 | if (!memblock_limit) { | 1120 | if (!memblock_limit) { |
1148 | if (!IS_ALIGNED(bank->start, SECTION_SIZE)) | 1121 | if (!IS_ALIGNED(block_start, SECTION_SIZE)) |
1149 | memblock_limit = bank->start; | 1122 | memblock_limit = block_start; |
1150 | else if (!IS_ALIGNED(bank_end, SECTION_SIZE)) | 1123 | else if (!IS_ALIGNED(block_end, SECTION_SIZE)) |
1151 | memblock_limit = bank_end; | 1124 | memblock_limit = arm_lowmem_limit; |
1152 | } | 1125 | } |
1153 | } | ||
1154 | j++; | ||
1155 | } | ||
1156 | #ifdef CONFIG_HIGHMEM | ||
1157 | if (highmem) { | ||
1158 | const char *reason = NULL; | ||
1159 | 1126 | ||
1160 | if (cache_is_vipt_aliasing()) { | ||
1161 | /* | ||
1162 | * Interactions between kmap and other mappings | ||
1163 | * make highmem support with aliasing VIPT caches | ||
1164 | * rather difficult. | ||
1165 | */ | ||
1166 | reason = "with VIPT aliasing cache"; | ||
1167 | } | ||
1168 | if (reason) { | ||
1169 | printk(KERN_CRIT "HIGHMEM is not supported %s, ignoring high memory\n", | ||
1170 | reason); | ||
1171 | while (j > 0 && meminfo.bank[j - 1].highmem) | ||
1172 | j--; | ||
1173 | } | 1127 | } |
1174 | } | 1128 | } |
1175 | #endif | 1129 | |
1176 | meminfo.nr_banks = j; | ||
1177 | high_memory = __va(arm_lowmem_limit - 1) + 1; | 1130 | high_memory = __va(arm_lowmem_limit - 1) + 1; |
1178 | 1131 | ||
1179 | /* | 1132 | /* |
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index 55764a7ef1f0..da1874f9f8cf 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
@@ -88,30 +88,35 @@ static unsigned long irbar_read(void) | |||
88 | void __init sanity_check_meminfo_mpu(void) | 88 | void __init sanity_check_meminfo_mpu(void) |
89 | { | 89 | { |
90 | int i; | 90 | int i; |
91 | struct membank *bank = meminfo.bank; | ||
92 | phys_addr_t phys_offset = PHYS_OFFSET; | 91 | phys_addr_t phys_offset = PHYS_OFFSET; |
93 | phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size; | 92 | phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size; |
94 | 93 | struct memblock_region *reg; | |
95 | /* Initially only use memory continuous from PHYS_OFFSET */ | 94 | bool first = true; |
96 | if (bank_phys_start(&bank[0]) != phys_offset) | 95 | phys_addr_t mem_start; |
97 | panic("First memory bank must be contiguous from PHYS_OFFSET"); | 96 | phys_addr_t mem_end; |
98 | 97 | ||
99 | /* Banks have already been sorted by start address */ | 98 | for_each_memblock(memory, reg) { |
100 | for (i = 1; i < meminfo.nr_banks; i++) { | 99 | if (first) { |
101 | if (bank[i].start <= bank_phys_end(&bank[0]) && | 100 | /* |
102 | bank_phys_end(&bank[i]) > bank_phys_end(&bank[0])) { | 101 | * Initially only use memory continuous from |
103 | bank[0].size = bank_phys_end(&bank[i]) - bank[0].start; | 102 | * PHYS_OFFSET */ |
103 | if (reg->base != phys_offset) | ||
104 | panic("First memory bank must be contiguous from PHYS_OFFSET"); | ||
105 | |||
106 | mem_start = reg->base; | ||
107 | mem_end = reg->base + reg->size; | ||
108 | specified_mem_size = reg->size; | ||
109 | first = false; | ||
104 | } else { | 110 | } else { |
105 | pr_notice("Ignoring RAM after 0x%.8lx. " | 111 | /* |
106 | "First non-contiguous (ignored) bank start: 0x%.8lx\n", | 112 | * memblock auto merges contiguous blocks, remove |
107 | (unsigned long)bank_phys_end(&bank[0]), | 113 | * all blocks afterwards |
108 | (unsigned long)bank_phys_start(&bank[i])); | 114 | */ |
109 | break; | 115 | pr_notice("Ignoring RAM after %pa, memory at %pa ignored\n", |
116 | &mem_start, ®->base); | ||
117 | memblock_remove(reg->base, reg->size); | ||
110 | } | 118 | } |
111 | } | 119 | } |
112 | /* All contiguous banks are now merged in to the first bank */ | ||
113 | meminfo.nr_banks = 1; | ||
114 | specified_mem_size = bank[0].size; | ||
115 | 120 | ||
116 | /* | 121 | /* |
117 | * MPU has curious alignment requirements: Size must be power of 2, and | 122 | * MPU has curious alignment requirements: Size must be power of 2, and |
@@ -128,23 +133,24 @@ void __init sanity_check_meminfo_mpu(void) | |||
128 | */ | 133 | */ |
129 | aligned_region_size = (phys_offset - 1) ^ (phys_offset); | 134 | aligned_region_size = (phys_offset - 1) ^ (phys_offset); |
130 | /* Find the max power-of-two sized region that fits inside our bank */ | 135 | /* Find the max power-of-two sized region that fits inside our bank */ |
131 | rounded_mem_size = (1 << __fls(bank[0].size)) - 1; | 136 | rounded_mem_size = (1 << __fls(specified_mem_size)) - 1; |
132 | 137 | ||
133 | /* The actual region size is the smaller of the two */ | 138 | /* The actual region size is the smaller of the two */ |
134 | aligned_region_size = aligned_region_size < rounded_mem_size | 139 | aligned_region_size = aligned_region_size < rounded_mem_size |
135 | ? aligned_region_size + 1 | 140 | ? aligned_region_size + 1 |
136 | : rounded_mem_size + 1; | 141 | : rounded_mem_size + 1; |
137 | 142 | ||
138 | if (aligned_region_size != specified_mem_size) | 143 | if (aligned_region_size != specified_mem_size) { |
139 | pr_warn("Truncating memory from 0x%.8lx to 0x%.8lx (MPU region constraints)", | 144 | pr_warn("Truncating memory from %pa to %pa (MPU region constraints)", |
140 | (unsigned long)specified_mem_size, | 145 | &specified_mem_size, &aligned_region_size); |
141 | (unsigned long)aligned_region_size); | 146 | memblock_remove(mem_start + aligned_region_size, |
147 | specified_mem_size - aligned_round_size); | ||
148 | |||
149 | mem_end = mem_start + aligned_region_size; | ||
150 | } | ||
142 | 151 | ||
143 | meminfo.bank[0].size = aligned_region_size; | 152 | pr_debug("MPU Region from %pa size %pa (end %pa))\n", |
144 | pr_debug("MPU Region from 0x%.8lx size 0x%.8lx (end 0x%.8lx))\n", | 153 | &phys_offset, &aligned_region_size, &mem_end); |
145 | (unsigned long)phys_offset, | ||
146 | (unsigned long)aligned_region_size, | ||
147 | (unsigned long)bank_phys_end(&bank[0])); | ||
148 | 154 | ||
149 | } | 155 | } |
150 | 156 | ||
@@ -292,7 +298,7 @@ void __init sanity_check_meminfo(void) | |||
292 | { | 298 | { |
293 | phys_addr_t end; | 299 | phys_addr_t end; |
294 | sanity_check_meminfo_mpu(); | 300 | sanity_check_meminfo_mpu(); |
295 | end = bank_phys_end(&meminfo.bank[meminfo.nr_banks - 1]); | 301 | end = memblock_end_of_DRAM(); |
296 | high_memory = __va(end - 1) + 1; | 302 | high_memory = __va(end - 1) + 1; |
297 | } | 303 | } |
298 | 304 | ||