2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * This file contains NUMA specific variables and functions which can
7 * be split away from DISCONTIGMEM and are used on NUMA machines with
9 * 2002/08/07 Erich Focht <efocht@ess.nec.de>
10 * Populate cpu entries in sysfs for non-numa systems as well
11 * Intel Corporation - Ashok Raj
14 #include <linux/config.h>
15 #include <linux/cpu.h>
16 #include <linux/kernel.h>
18 #include <linux/node.h>
19 #include <linux/init.h>
20 #include <linux/bootmem.h>
21 #include <linux/nodemask.h>
22 #include <asm/mmzone.h>
27 static struct node *sysfs_nodes;
29 static struct ia64_cpu *sysfs_cpus;
31 int arch_register_cpu(int num)
33 struct node *parent = NULL;
36 parent = &sysfs_nodes[cpu_to_node(num)];
37 #endif /* CONFIG_NUMA */
39 #if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU)
41 * If CPEI cannot be re-targetted, and this is
42 * CPEI target, then dont create the control file
44 if (!can_cpei_retarget() && is_cpu_cpei_target(num))
45 sysfs_cpus[num].cpu.no_control = 1;
48 return register_cpu(&sysfs_cpus[num].cpu, num, parent);
51 #ifdef CONFIG_HOTPLUG_CPU
53 void arch_unregister_cpu(int num)
55 struct node *parent = NULL;
58 int node = cpu_to_node(num);
59 parent = &sysfs_nodes[node];
60 #endif /* CONFIG_NUMA */
62 return unregister_cpu(&sysfs_cpus[num].cpu, parent);
64 EXPORT_SYMBOL(arch_register_cpu);
65 EXPORT_SYMBOL(arch_unregister_cpu);
66 #endif /*CONFIG_HOTPLUG_CPU*/
69 static int __init topology_init(void)
74 sysfs_nodes = kzalloc(sizeof(struct node) * MAX_NUMNODES, GFP_KERNEL);
81 * MCD - Do we want to register all ONLINE nodes, or all POSSIBLE nodes?
83 for_each_online_node(i) {
84 if ((err = register_node(&sysfs_nodes[i], i, 0)))
89 sysfs_cpus = kzalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL);
95 for_each_present_cpu(i) {
96 if((err = arch_register_cpu(i)))
103 subsys_initcall(topology_init);