From: Ashok Raj <ashok.raj@intel.com>

Creation of sysfs via topology_init() creates sysfs entries.  The creation of
the online control file is created separately when the cpu_up is invoked in
arch independent code.


---

 25-akpm/arch/ia64/dig/Makefile   |    5 ++++
 25-akpm/arch/ia64/dig/topology.c |   43 +++++++++++++++++++++++++++++++++++++++
 25-akpm/include/asm-ia64/cpu.h   |   17 +++++++++++++++
 3 files changed, 65 insertions(+)

diff -puN arch/ia64/dig/Makefile~ia64-cpuhotplug-sysfs_ia64 arch/ia64/dig/Makefile
--- 25/arch/ia64/dig/Makefile~ia64-cpuhotplug-sysfs_ia64	Wed Apr 28 14:49:59 2004
+++ 25-akpm/arch/ia64/dig/Makefile	Wed Apr 28 14:49:59 2004
@@ -6,4 +6,9 @@
 #
 
 obj-y := setup.o
+
+ifndef CONFIG_NUMA
+obj-$(CONFIG_IA64_DIG) += topology.o
+endif
+
 obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff -puN /dev/null arch/ia64/dig/topology.c
--- /dev/null	Thu Apr 11 07:25:15 2002
+++ 25-akpm/arch/ia64/dig/topology.c	Wed Apr 28 14:49:59 2004
@@ -0,0 +1,43 @@
+/*
+ * arch/ia64/dig/topology.c
+ *	Popuate driverfs with topology information.
+ *	Derived entirely from i386/mach-default.c
+ *  Intel Corporation - Ashok Raj
+ */
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/cpumask.h>
+#include <linux/percpu.h>
+#include <linux/notifier.h>
+#include <linux/cpu.h>
+#include <asm/cpu.h>
+
+static DEFINE_PER_CPU(struct ia64_cpu, cpu_devices);
+
+/*
+ * First Pass: simply borrowed code for now. Later should hook into
+ * hotplug notification for node/cpu/memory as applicable
+ */
+
+static int arch_register_cpu(int num)
+{
+	struct node *parent = NULL;
+
+#ifdef CONFIG_NUMA
+	//parent = &node_devices[cpu_to_node(num)].node;
+#endif
+
+	return register_cpu(&per_cpu(cpu_devices,num).cpu, num, parent);
+}
+
+static int __init topology_init(void)
+{
+    int i;
+
+    for_each_cpu(i) {
+        arch_register_cpu(i);
+	}
+    return 0;
+}
+
+subsys_initcall(topology_init);
diff -puN /dev/null include/asm-ia64/cpu.h
--- /dev/null	Thu Apr 11 07:25:15 2002
+++ 25-akpm/include/asm-ia64/cpu.h	Wed Apr 28 14:49:59 2004
@@ -0,0 +1,17 @@
+#ifndef _ASM_IA64_CPU_H_
+#define _ASM_IA64_CPU_H_
+
+#include <linux/device.h>
+#include <linux/cpu.h>
+#include <linux/topology.h>
+#include <linux/percpu.h>
+
+struct ia64_cpu {
+	struct cpu cpu;
+};
+
+DECLARE_PER_CPU(struct ia64_cpu, cpu_devices);
+
+DECLARE_PER_CPU(int, cpu_state);
+
+#endif /* _ASM_IA64_CPU_H_ */

_