numa.c (d8a382d2662822248a97ce9d670b90e68aefbd3a) numa.c (95f72d1ed41a66f1c1c29c24d479de81a0bea36f)
1/*
2 * arch/sh/mm/numa.c - Multiple node support for SH machines
3 *
4 * Copyright (C) 2007 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/module.h>
11#include <linux/bootmem.h>
1/*
2 * arch/sh/mm/numa.c - Multiple node support for SH machines
3 *
4 * Copyright (C) 2007 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/module.h>
11#include <linux/bootmem.h>
12#include <linux/lmb.h>
12#include <linux/memblock.h>
13#include <linux/mm.h>
14#include <linux/numa.h>
15#include <linux/pfn.h>
16#include <asm/sections.h>
17
18struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
19EXPORT_SYMBOL_GPL(node_data);
20

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

34 BUG_ON(nid > MAX_NUMNODES || nid <= 0);
35
36 start_pfn = start >> PAGE_SHIFT;
37 end_pfn = end >> PAGE_SHIFT;
38
39 pmb_bolt_mapping((unsigned long)__va(start), start, end - start,
40 PAGE_KERNEL);
41
13#include <linux/mm.h>
14#include <linux/numa.h>
15#include <linux/pfn.h>
16#include <asm/sections.h>
17
18struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
19EXPORT_SYMBOL_GPL(node_data);
20

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

34 BUG_ON(nid > MAX_NUMNODES || nid <= 0);
35
36 start_pfn = start >> PAGE_SHIFT;
37 end_pfn = end >> PAGE_SHIFT;
38
39 pmb_bolt_mapping((unsigned long)__va(start), start, end - start,
40 PAGE_KERNEL);
41
42 lmb_add(start, end - start);
42 memblock_add(start, end - start);
43
44 __add_active_range(nid, start_pfn, end_pfn);
45
46 /* Node-local pgdat */
43
44 __add_active_range(nid, start_pfn, end_pfn);
45
46 /* Node-local pgdat */
47 NODE_DATA(nid) = __va(lmb_alloc_base(sizeof(struct pglist_data),
47 NODE_DATA(nid) = __va(memblock_alloc_base(sizeof(struct pglist_data),
48 SMP_CACHE_BYTES, end));
49 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
50
51 NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
52 NODE_DATA(nid)->node_start_pfn = start_pfn;
53 NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
54
55 /* Node-local bootmap */
56 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
48 SMP_CACHE_BYTES, end));
49 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
50
51 NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
52 NODE_DATA(nid)->node_start_pfn = start_pfn;
53 NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
54
55 /* Node-local bootmap */
56 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
57 bootmem_paddr = lmb_alloc_base(bootmap_pages << PAGE_SHIFT,
57 bootmem_paddr = memblock_alloc_base(bootmap_pages << PAGE_SHIFT,
58 PAGE_SIZE, end);
59 init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT,
60 start_pfn, end_pfn);
61
62 free_bootmem_with_active_regions(nid, end_pfn);
63
64 /* Reserve the pgdat and bootmap space with the bootmem allocator */
65 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT,
66 sizeof(struct pglist_data), BOOTMEM_DEFAULT);
67 reserve_bootmem_node(NODE_DATA(nid), bootmem_paddr,
68 bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
69
70 /* It's up */
71 node_set_online(nid);
72
73 /* Kick sparsemem */
74 sparse_memory_present_with_active_regions(nid);
75}
58 PAGE_SIZE, end);
59 init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT,
60 start_pfn, end_pfn);
61
62 free_bootmem_with_active_regions(nid, end_pfn);
63
64 /* Reserve the pgdat and bootmap space with the bootmem allocator */
65 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT,
66 sizeof(struct pglist_data), BOOTMEM_DEFAULT);
67 reserve_bootmem_node(NODE_DATA(nid), bootmem_paddr,
68 bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
69
70 /* It's up */
71 node_set_online(nid);
72
73 /* Kick sparsemem */
74 sparse_memory_present_with_active_regions(nid);
75}