init.c (9ad57f6dfc2345ed5d3a8bf4dabac0a34069c54c) init.c (3eef6b74d9fecf18b03db26584cc66928972a60b)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/arch/sh/mm/init.c
4 *
5 * Copyright (C) 1999 Niibe Yutaka
6 * Copyright (C) 2002 - 2011 Paul Mundt
7 *
8 * Based on linux/arch/i386/mm/init.c:

--- 13 unchanged lines hidden (view full) ---

22#include <asm/mmu_context.h>
23#include <asm/mmzone.h>
24#include <asm/kexec.h>
25#include <asm/tlb.h>
26#include <asm/cacheflush.h>
27#include <asm/sections.h>
28#include <asm/setup.h>
29#include <asm/cache.h>
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/arch/sh/mm/init.c
4 *
5 * Copyright (C) 1999 Niibe Yutaka
6 * Copyright (C) 2002 - 2011 Paul Mundt
7 *
8 * Based on linux/arch/i386/mm/init.c:

--- 13 unchanged lines hidden (view full) ---

22#include <asm/mmu_context.h>
23#include <asm/mmzone.h>
24#include <asm/kexec.h>
25#include <asm/tlb.h>
26#include <asm/cacheflush.h>
27#include <asm/sections.h>
28#include <asm/setup.h>
29#include <asm/cache.h>
30#include <asm/pgalloc.h>
31#include <linux/sizes.h>
30#include <linux/sizes.h>
31#include "ioremap.h"
32
33pgd_t swapper_pg_dir[PTRS_PER_PGD];
34
35void __init generic_mem_init(void)
36{
37 memblock_add(__MEMORY_START, __MEMORY_SIZE);
38}
39

--- 196 unchanged lines hidden (view full) ---

236 }
237
238 /* All of system RAM sits in node 0 for the non-NUMA case */
239 allocate_pgdat(0);
240 node_set_online(0);
241
242 plat_mem_setup();
243
32
33pgd_t swapper_pg_dir[PTRS_PER_PGD];
34
35void __init generic_mem_init(void)
36{
37 memblock_add(__MEMORY_START, __MEMORY_SIZE);
38}
39

--- 196 unchanged lines hidden (view full) ---

236 }
237
238 /* All of system RAM sits in node 0 for the non-NUMA case */
239 allocate_pgdat(0);
240 node_set_online(0);
241
242 plat_mem_setup();
243
244 for_each_memblock(memory, reg) {
245 int nid = memblock_get_region_node(reg);
246
247 memory_present(nid, memblock_region_memory_base_pfn(reg),
248 memblock_region_memory_end_pfn(reg));
249 }
244 sparse_init();
245}
246
247static void __init early_reserve_mem(void)
248{
249 unsigned long start_pfn;
250 u32 zero_base = (u32)__MEMORY_START + (u32)PHYSICAL_OFFSET;
251 u32 start = zero_base + (u32)CONFIG_ZERO_PAGE_OFFSET;

--- 168 unchanged lines hidden (view full) ---

420 /* We only have ZONE_NORMAL, so this is easy.. */
421 ret = __add_pages(nid, start_pfn, nr_pages, params);
422 if (unlikely(ret))
423 printk("%s: Failed, __add_pages() == %d\n", __func__, ret);
424
425 return ret;
426}
427
250 sparse_init();
251}
252
253static void __init early_reserve_mem(void)
254{
255 unsigned long start_pfn;
256 u32 zero_base = (u32)__MEMORY_START + (u32)PHYSICAL_OFFSET;
257 u32 start = zero_base + (u32)CONFIG_ZERO_PAGE_OFFSET;

--- 168 unchanged lines hidden (view full) ---

426 /* We only have ZONE_NORMAL, so this is easy.. */
427 ret = __add_pages(nid, start_pfn, nr_pages, params);
428 if (unlikely(ret))
429 printk("%s: Failed, __add_pages() == %d\n", __func__, ret);
430
431 return ret;
432}
433
434#ifdef CONFIG_NUMA
435int memory_add_physaddr_to_nid(u64 addr)
436{
437 /* Node 0 for now.. */
438 return 0;
439}
440EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
441#endif
442
428void arch_remove_memory(int nid, u64 start, u64 size,
429 struct vmem_altmap *altmap)
430{
431 unsigned long start_pfn = PFN_DOWN(start);
432 unsigned long nr_pages = size >> PAGE_SHIFT;
433
434 __remove_pages(start_pfn, nr_pages, altmap);
435}
436#endif /* CONFIG_MEMORY_HOTPLUG */
443void arch_remove_memory(int nid, u64 start, u64 size,
444 struct vmem_altmap *altmap)
445{
446 unsigned long start_pfn = PFN_DOWN(start);
447 unsigned long nr_pages = size >> PAGE_SHIFT;
448
449 __remove_pages(start_pfn, nr_pages, altmap);
450}
451#endif /* CONFIG_MEMORY_HOTPLUG */