]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: Add sysfs entries for UV v4
authorRuss Anderson <rja@sgi.com>
Fri, 3 Oct 2008 16:59:50 +0000 (11:59 -0500)
committerIngo Molnar <mingo@elte.hu>
Thu, 16 Oct 2008 14:53:13 +0000 (16:53 +0200)
Create /sys/firmware/sgi_uv sysfs entries for partition_id and coherence_id.

Signed-off-by: Russ Anderson <rja@sgi.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/Makefile
arch/x86/kernel/uv_sysfs.c [new file with mode: 0644]
include/asm-x86/uv/bios.h

index acc0e8bf043e4bf9f3510c46283e384828becca7..cb6ade443f002a4f4a45bec340b1de65ee6f5da0 100644 (file)
@@ -108,7 +108,7 @@ obj-$(CONFIG_MICROCODE)                     += microcode.o
 # 64 bit specific files
 ifeq ($(CONFIG_X86_64),y)
         obj-y                          += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o
-       obj-y                           += bios_uv.o uv_irq.o
+       obj-y                           += bios_uv.o uv_irq.o uv_sysfs.o
         obj-y                          += genx2apic_cluster.o
         obj-y                          += genx2apic_phys.o
         obj-$(CONFIG_X86_PM_TIMER)     += pmtimer_64.o
diff --git a/arch/x86/kernel/uv_sysfs.c b/arch/x86/kernel/uv_sysfs.c
new file mode 100644 (file)
index 0000000..67f9b9d
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * This file supports the /sys/firmware/sgi_uv interfaces for SGI UV.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ *  Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ *  Copyright (c) Russ Anderson
+ */
+
+#include <linux/sysdev.h>
+#include <asm/uv/bios.h>
+
+struct kobject *sgi_uv_kobj;
+
+static ssize_t partition_id_show(struct kobject *kobj,
+                       struct kobj_attribute *attr, char *buf)
+{
+       return snprintf(buf, PAGE_SIZE, "%ld\n", sn_partition_id);
+}
+
+static ssize_t coherence_id_show(struct kobject *kobj,
+                       struct kobj_attribute *attr, char *buf)
+{
+       return snprintf(buf, PAGE_SIZE, "%ld\n", partition_coherence_id());
+}
+
+static struct kobj_attribute partition_id_attr =
+       __ATTR(partition_id, S_IRUGO, partition_id_show, NULL);
+
+static struct kobj_attribute coherence_id_attr =
+       __ATTR(coherence_id, S_IRUGO, coherence_id_show, NULL);
+
+
+static int __init sgi_uv_sysfs_init(void)
+{
+       unsigned long ret;
+
+       if (!sgi_uv_kobj)
+               sgi_uv_kobj = kobject_create_and_add("sgi_uv", firmware_kobj);
+       if (!sgi_uv_kobj) {
+               printk(KERN_WARNING "kobject_create_and_add sgi_uv failed \n");
+               return -EINVAL;
+       }
+
+       ret = sysfs_create_file(sgi_uv_kobj, &partition_id_attr.attr);
+       if (ret) {
+               printk(KERN_WARNING "sysfs_create_file partition_id failed \n");
+               return ret;
+       }
+
+       ret = sysfs_create_file(sgi_uv_kobj, &coherence_id_attr.attr);
+       if (ret) {
+               printk(KERN_WARNING "sysfs_create_file coherence_id failed \n");
+               return ret;
+       }
+
+       return 0;
+}
+
+device_initcall(sgi_uv_sysfs_init);
index 3b305d897c84dda159c9f93f2870a6fb75b4a245..215f1969c266c55b72722c64efc971ab56a49b5b 100644 (file)
@@ -89,5 +89,6 @@ extern long uv_coherency_id;
 extern long uv_region_size;
 #define partition_coherence_id()       (uv_coherency_id)
 
+extern struct kobject *sgi_uv_kobj;    /* /sys/firmware/sgi_uv */
 
 #endif /* ASM_X86__UV__BIOS_H */