Commit | Line | Data |
---|---|---|
b241cb0c PM |
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> | |
95f72d1e | 11 | #include <linux/memblock.h> |
b241cb0c PM |
12 | #include <linux/mm.h> |
13 | #include <linux/numa.h> | |
14 | #include <linux/pfn.h> | |
15 | #include <asm/sections.h> | |
16 | ||
b241cb0c PM |
17 | struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; |
18 | EXPORT_SYMBOL_GPL(node_data); | |
19 | ||
20 | /* | |
21 | * On SH machines the conventional approach is to stash system RAM | |
22 | * in node 0, and other memory blocks in to node 1 and up, ordered by | |
23 | * latency. Each node's pgdat is node-local at the beginning of the node, | |
24 | * immediately followed by the node mem map. | |
25 | */ | |
b241cb0c PM |
26 | void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) |
27 | { | |
5084f61a | 28 | unsigned long start_pfn, end_pfn; |
b241cb0c PM |
29 | |
30 | /* Don't allow bogus node assignment */ | |
ded00142 | 31 | BUG_ON(nid >= MAX_NUMNODES || nid <= 0); |
b241cb0c | 32 | |
81cf09ed AK |
33 | start_pfn = PFN_DOWN(start); |
34 | end_pfn = PFN_DOWN(end); | |
b241cb0c | 35 | |
09e11723 PM |
36 | pmb_bolt_mapping((unsigned long)__va(start), start, end - start, |
37 | PAGE_KERNEL); | |
38 | ||
95f72d1e | 39 | memblock_add(start, end - start); |
5084f61a | 40 | |
0146ba78 | 41 | __add_active_range(nid, start_pfn, end_pfn); |
b241cb0c PM |
42 | |
43 | /* Node-local pgdat */ | |
95f72d1e | 44 | NODE_DATA(nid) = __va(memblock_alloc_base(sizeof(struct pglist_data), |
b25b9758 | 45 | SMP_CACHE_BYTES, end)); |
b241cb0c PM |
46 | memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); |
47 | ||
b241cb0c PM |
48 | NODE_DATA(nid)->node_start_pfn = start_pfn; |
49 | NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; | |
50 | ||
b241cb0c PM |
51 | /* It's up */ |
52 | node_set_online(nid); | |
53 | ||
54 | /* Kick sparsemem */ | |
55 | sparse_memory_present_with_active_regions(nid); | |
56 | } |