diff options
Diffstat (limited to 'arch/powerpc/mm/mem.c')
-rw-r--r-- | arch/powerpc/mm/mem.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 0f594d774bf7..1a84a8d00005 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <linux/initrd.h> | 32 | #include <linux/initrd.h> |
33 | #include <linux/pagemap.h> | 33 | #include <linux/pagemap.h> |
34 | #include <linux/suspend.h> | 34 | #include <linux/suspend.h> |
35 | #include <linux/lmb.h> | 35 | #include <linux/memblock.h> |
36 | #include <linux/hugetlb.h> | 36 | #include <linux/hugetlb.h> |
37 | 37 | ||
38 | #include <asm/pgalloc.h> | 38 | #include <asm/pgalloc.h> |
@@ -83,13 +83,13 @@ int page_is_ram(unsigned long pfn) | |||
83 | #else | 83 | #else |
84 | unsigned long paddr = (pfn << PAGE_SHIFT); | 84 | unsigned long paddr = (pfn << PAGE_SHIFT); |
85 | int i; | 85 | int i; |
86 | for (i=0; i < lmb.memory.cnt; i++) { | 86 | for (i=0; i < memblock.memory.cnt; i++) { |
87 | unsigned long base; | 87 | unsigned long base; |
88 | 88 | ||
89 | base = lmb.memory.region[i].base; | 89 | base = memblock.memory.region[i].base; |
90 | 90 | ||
91 | if ((paddr >= base) && | 91 | if ((paddr >= base) && |
92 | (paddr < (base + lmb.memory.region[i].size))) { | 92 | (paddr < (base + memblock.memory.region[i].size))) { |
93 | return 1; | 93 | return 1; |
94 | } | 94 | } |
95 | } | 95 | } |
@@ -142,14 +142,14 @@ int arch_add_memory(int nid, u64 start, u64 size) | |||
142 | /* | 142 | /* |
143 | * walk_memory_resource() needs to make sure there is no holes in a given | 143 | * walk_memory_resource() needs to make sure there is no holes in a given |
144 | * memory range. PPC64 does not maintain the memory layout in /proc/iomem. | 144 | * memory range. PPC64 does not maintain the memory layout in /proc/iomem. |
145 | * Instead it maintains it in lmb.memory structures. Walk through the | 145 | * Instead it maintains it in memblock.memory structures. Walk through the |
146 | * memory regions, find holes and callback for contiguous regions. | 146 | * memory regions, find holes and callback for contiguous regions. |
147 | */ | 147 | */ |
148 | int | 148 | int |
149 | walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, | 149 | walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, |
150 | void *arg, int (*func)(unsigned long, unsigned long, void *)) | 150 | void *arg, int (*func)(unsigned long, unsigned long, void *)) |
151 | { | 151 | { |
152 | struct lmb_property res; | 152 | struct memblock_property res; |
153 | unsigned long pfn, len; | 153 | unsigned long pfn, len; |
154 | u64 end; | 154 | u64 end; |
155 | int ret = -1; | 155 | int ret = -1; |
@@ -158,7 +158,7 @@ walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, | |||
158 | res.size = (u64) nr_pages << PAGE_SHIFT; | 158 | res.size = (u64) nr_pages << PAGE_SHIFT; |
159 | 159 | ||
160 | end = res.base + res.size - 1; | 160 | end = res.base + res.size - 1; |
161 | while ((res.base < end) && (lmb_find(&res) >= 0)) { | 161 | while ((res.base < end) && (memblock_find(&res) >= 0)) { |
162 | pfn = (unsigned long)(res.base >> PAGE_SHIFT); | 162 | pfn = (unsigned long)(res.base >> PAGE_SHIFT); |
163 | len = (unsigned long)(res.size >> PAGE_SHIFT); | 163 | len = (unsigned long)(res.size >> PAGE_SHIFT); |
164 | ret = (*func)(pfn, len, arg); | 164 | ret = (*func)(pfn, len, arg); |
@@ -184,8 +184,8 @@ void __init do_init_bootmem(void) | |||
184 | unsigned long total_pages; | 184 | unsigned long total_pages; |
185 | int boot_mapsize; | 185 | int boot_mapsize; |
186 | 186 | ||
187 | max_low_pfn = max_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT; | 187 | max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; |
188 | total_pages = (lmb_end_of_DRAM() - memstart_addr) >> PAGE_SHIFT; | 188 | total_pages = (memblock_end_of_DRAM() - memstart_addr) >> PAGE_SHIFT; |
189 | #ifdef CONFIG_HIGHMEM | 189 | #ifdef CONFIG_HIGHMEM |
190 | total_pages = total_lowmem >> PAGE_SHIFT; | 190 | total_pages = total_lowmem >> PAGE_SHIFT; |
191 | max_low_pfn = lowmem_end_addr >> PAGE_SHIFT; | 191 | max_low_pfn = lowmem_end_addr >> PAGE_SHIFT; |
@@ -198,16 +198,16 @@ void __init do_init_bootmem(void) | |||
198 | */ | 198 | */ |
199 | bootmap_pages = bootmem_bootmap_pages(total_pages); | 199 | bootmap_pages = bootmem_bootmap_pages(total_pages); |
200 | 200 | ||
201 | start = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE); | 201 | start = memblock_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE); |
202 | 202 | ||
203 | min_low_pfn = MEMORY_START >> PAGE_SHIFT; | 203 | min_low_pfn = MEMORY_START >> PAGE_SHIFT; |
204 | boot_mapsize = init_bootmem_node(NODE_DATA(0), start >> PAGE_SHIFT, min_low_pfn, max_low_pfn); | 204 | boot_mapsize = init_bootmem_node(NODE_DATA(0), start >> PAGE_SHIFT, min_low_pfn, max_low_pfn); |
205 | 205 | ||
206 | /* Add active regions with valid PFNs */ | 206 | /* Add active regions with valid PFNs */ |
207 | for (i = 0; i < lmb.memory.cnt; i++) { | 207 | for (i = 0; i < memblock.memory.cnt; i++) { |
208 | unsigned long start_pfn, end_pfn; | 208 | unsigned long start_pfn, end_pfn; |
209 | start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT; | 209 | start_pfn = memblock.memory.region[i].base >> PAGE_SHIFT; |
210 | end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i); | 210 | end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i); |
211 | add_active_range(0, start_pfn, end_pfn); | 211 | add_active_range(0, start_pfn, end_pfn); |
212 | } | 212 | } |
213 | 213 | ||
@@ -218,17 +218,17 @@ void __init do_init_bootmem(void) | |||
218 | free_bootmem_with_active_regions(0, lowmem_end_addr >> PAGE_SHIFT); | 218 | free_bootmem_with_active_regions(0, lowmem_end_addr >> PAGE_SHIFT); |
219 | 219 | ||
220 | /* reserve the sections we're already using */ | 220 | /* reserve the sections we're already using */ |
221 | for (i = 0; i < lmb.reserved.cnt; i++) { | 221 | for (i = 0; i < memblock.reserved.cnt; i++) { |
222 | unsigned long addr = lmb.reserved.region[i].base + | 222 | unsigned long addr = memblock.reserved.region[i].base + |
223 | lmb_size_bytes(&lmb.reserved, i) - 1; | 223 | memblock_size_bytes(&memblock.reserved, i) - 1; |
224 | if (addr < lowmem_end_addr) | 224 | if (addr < lowmem_end_addr) |
225 | reserve_bootmem(lmb.reserved.region[i].base, | 225 | reserve_bootmem(memblock.reserved.region[i].base, |
226 | lmb_size_bytes(&lmb.reserved, i), | 226 | memblock_size_bytes(&memblock.reserved, i), |
227 | BOOTMEM_DEFAULT); | 227 | BOOTMEM_DEFAULT); |
228 | else if (lmb.reserved.region[i].base < lowmem_end_addr) { | 228 | else if (memblock.reserved.region[i].base < lowmem_end_addr) { |
229 | unsigned long adjusted_size = lowmem_end_addr - | 229 | unsigned long adjusted_size = lowmem_end_addr - |
230 | lmb.reserved.region[i].base; | 230 | memblock.reserved.region[i].base; |
231 | reserve_bootmem(lmb.reserved.region[i].base, | 231 | reserve_bootmem(memblock.reserved.region[i].base, |
232 | adjusted_size, BOOTMEM_DEFAULT); | 232 | adjusted_size, BOOTMEM_DEFAULT); |
233 | } | 233 | } |
234 | } | 234 | } |
@@ -236,9 +236,9 @@ void __init do_init_bootmem(void) | |||
236 | free_bootmem_with_active_regions(0, max_pfn); | 236 | free_bootmem_with_active_regions(0, max_pfn); |
237 | 237 | ||
238 | /* reserve the sections we're already using */ | 238 | /* reserve the sections we're already using */ |
239 | for (i = 0; i < lmb.reserved.cnt; i++) | 239 | for (i = 0; i < memblock.reserved.cnt; i++) |
240 | reserve_bootmem(lmb.reserved.region[i].base, | 240 | reserve_bootmem(memblock.reserved.region[i].base, |
241 | lmb_size_bytes(&lmb.reserved, i), | 241 | memblock_size_bytes(&memblock.reserved, i), |
242 | BOOTMEM_DEFAULT); | 242 | BOOTMEM_DEFAULT); |
243 | 243 | ||
244 | #endif | 244 | #endif |
@@ -251,20 +251,20 @@ void __init do_init_bootmem(void) | |||
251 | /* mark pages that don't exist as nosave */ | 251 | /* mark pages that don't exist as nosave */ |
252 | static int __init mark_nonram_nosave(void) | 252 | static int __init mark_nonram_nosave(void) |
253 | { | 253 | { |
254 | unsigned long lmb_next_region_start_pfn, | 254 | unsigned long memblock_next_region_start_pfn, |
255 | lmb_region_max_pfn; | 255 | memblock_region_max_pfn; |
256 | int i; | 256 | int i; |
257 | 257 | ||
258 | for (i = 0; i < lmb.memory.cnt - 1; i++) { | 258 | for (i = 0; i < memblock.memory.cnt - 1; i++) { |
259 | lmb_region_max_pfn = | 259 | memblock_region_max_pfn = |
260 | (lmb.memory.region[i].base >> PAGE_SHIFT) + | 260 | (memblock.memory.region[i].base >> PAGE_SHIFT) + |
261 | (lmb.memory.region[i].size >> PAGE_SHIFT); | 261 | (memblock.memory.region[i].size >> PAGE_SHIFT); |
262 | lmb_next_region_start_pfn = | 262 | memblock_next_region_start_pfn = |
263 | lmb.memory.region[i+1].base >> PAGE_SHIFT; | 263 | memblock.memory.region[i+1].base >> PAGE_SHIFT; |
264 | 264 | ||
265 | if (lmb_region_max_pfn < lmb_next_region_start_pfn) | 265 | if (memblock_region_max_pfn < memblock_next_region_start_pfn) |
266 | register_nosave_region(lmb_region_max_pfn, | 266 | register_nosave_region(memblock_region_max_pfn, |
267 | lmb_next_region_start_pfn); | 267 | memblock_next_region_start_pfn); |
268 | } | 268 | } |
269 | 269 | ||
270 | return 0; | 270 | return 0; |
@@ -275,8 +275,8 @@ static int __init mark_nonram_nosave(void) | |||
275 | */ | 275 | */ |
276 | void __init paging_init(void) | 276 | void __init paging_init(void) |
277 | { | 277 | { |
278 | unsigned long total_ram = lmb_phys_mem_size(); | 278 | unsigned long total_ram = memblock_phys_mem_size(); |
279 | phys_addr_t top_of_ram = lmb_end_of_DRAM(); | 279 | phys_addr_t top_of_ram = memblock_end_of_DRAM(); |
280 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | 280 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
281 | 281 | ||
282 | #ifdef CONFIG_PPC32 | 282 | #ifdef CONFIG_PPC32 |
@@ -327,7 +327,7 @@ void __init mem_init(void) | |||
327 | swiotlb_init(1); | 327 | swiotlb_init(1); |
328 | #endif | 328 | #endif |
329 | 329 | ||
330 | num_physpages = lmb.memory.size >> PAGE_SHIFT; | 330 | num_physpages = memblock.memory.size >> PAGE_SHIFT; |
331 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); | 331 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); |
332 | 332 | ||
333 | #ifdef CONFIG_NEED_MULTIPLE_NODES | 333 | #ifdef CONFIG_NEED_MULTIPLE_NODES |
@@ -364,7 +364,7 @@ void __init mem_init(void) | |||
364 | highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT; | 364 | highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT; |
365 | for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { | 365 | for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { |
366 | struct page *page = pfn_to_page(pfn); | 366 | struct page *page = pfn_to_page(pfn); |
367 | if (lmb_is_reserved(pfn << PAGE_SHIFT)) | 367 | if (memblock_is_reserved(pfn << PAGE_SHIFT)) |
368 | continue; | 368 | continue; |
369 | ClearPageReserved(page); | 369 | ClearPageReserved(page); |
370 | init_page_count(page); | 370 | init_page_count(page); |