1 From: Russ Anderson <rja@sgi.com>
2 Subject: x86: Add UV sysfs entries
5 Create /sys/firmware/sgi_uv sysfs entries for partition_id and coherence_id.
7 Signed-off-by: Russ Anderson <rja@sgi.com>
8 Acked-by: Bernhard Walle <bwalle@suse.de>
11 arch/x86/kernel/Makefile | 1
12 arch/x86/kernel/uv_sysfs.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
13 include/asm-x86/uv/bios.h | 1
14 3 files changed, 74 insertions(+)
16 --- a/arch/x86/kernel/Makefile
17 +++ b/arch/x86/kernel/Makefile
18 @@ -103,6 +103,7 @@ obj-$(CONFIG_OLPC) += olpc.o
19 # 64 bit specific files
20 ifeq ($(CONFIG_X86_64),y)
21 obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o
23 obj-y += genx2apic_cluster.o
24 obj-y += genx2apic_phys.o
27 +++ b/arch/x86/kernel/uv_sysfs.c
30 + * This file supports the /sys/firmware/sgi_uv interfaces for SGI UV.
32 + * This program is free software; you can redistribute it and/or modify
33 + * it under the terms of the GNU General Public License as published by
34 + * the Free Software Foundation; either version 2 of the License, or
35 + * (at your option) any later version.
37 + * This program is distributed in the hope that it will be useful,
38 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
39 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 + * GNU General Public License for more details.
42 + * You should have received a copy of the GNU General Public License
43 + * along with this program; if not, write to the Free Software
44 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
46 + * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
47 + * Copyright (c) Russ Anderson
50 +#include <linux/sysdev.h>
51 +#include <asm/uv/bios.h>
53 +struct kobject *sgi_uv_kobj;
55 +static ssize_t partition_id_show(struct kobject *kobj,
56 + struct kobj_attribute *attr, char *buf)
58 + return snprintf(buf, PAGE_SIZE, "%ld\n", sn_partition_id);
61 +static ssize_t coherence_id_show(struct kobject *kobj,
62 + struct kobj_attribute *attr, char *buf)
64 + return snprintf(buf, PAGE_SIZE, "%ld\n", partition_coherence_id());
67 +static struct kobj_attribute partition_id_attr =
68 + __ATTR(partition_id, S_IRUGO, partition_id_show, NULL);
70 +static struct kobj_attribute coherence_id_attr =
71 + __ATTR(coherence_id, S_IRUGO, coherence_id_show, NULL);
74 +static int __init sgi_uv_sysfs_init(void)
79 + sgi_uv_kobj = kobject_create_and_add("sgi_uv", firmware_kobj);
81 + printk(KERN_WARNING "kobject_create_and_add sgi_uv failed \n");
85 + ret = sysfs_create_file(sgi_uv_kobj, &partition_id_attr.attr);
87 + printk(KERN_WARNING "sysfs_create_file partition_id failed \n");
91 + ret = sysfs_create_file(sgi_uv_kobj, &coherence_id_attr.attr);
93 + printk(KERN_WARNING "sysfs_create_file coherence_id failed \n");
100 +device_initcall(sgi_uv_sysfs_init);
101 --- a/include/asm-x86/uv/bios.h
102 +++ b/include/asm-x86/uv/bios.h
103 @@ -89,5 +89,6 @@ extern long uv_coherency_id;
104 extern long uv_region_size;
105 #define partition_coherence_id() (uv_coherency_id)
107 +extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */
109 #endif /* _ASM_X86_BIOS_H */