]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/uv-sysfs.diff
Add a patch to fix Intel E100 wake-on-lan problems.
[ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / uv-sysfs.diff
1 From: Russ Anderson <rja@sgi.com>
2 Subject: x86: Add UV sysfs entries
3 References: bnc#442455
4
5 Create /sys/firmware/sgi_uv sysfs entries for partition_id and coherence_id.
6
7 Signed-off-by: Russ Anderson <rja@sgi.com>
8 Acked-by: Bernhard Walle <bwalle@suse.de>
9
10 ---
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(+)
15
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
22 + obj-y += uv_sysfs.o
23 obj-y += genx2apic_cluster.o
24 obj-y += genx2apic_phys.o
25 obj-y += bios_uv.o
26 --- /dev/null
27 +++ b/arch/x86/kernel/uv_sysfs.c
28 @@ -0,0 +1,72 @@
29 +/*
30 + * This file supports the /sys/firmware/sgi_uv interfaces for SGI UV.
31 + *
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.
36 + *
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.
41 + *
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
45 + *
46 + * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
47 + * Copyright (c) Russ Anderson
48 + */
49 +
50 +#include <linux/sysdev.h>
51 +#include <asm/uv/bios.h>
52 +
53 +struct kobject *sgi_uv_kobj;
54 +
55 +static ssize_t partition_id_show(struct kobject *kobj,
56 + struct kobj_attribute *attr, char *buf)
57 +{
58 + return snprintf(buf, PAGE_SIZE, "%ld\n", sn_partition_id);
59 +}
60 +
61 +static ssize_t coherence_id_show(struct kobject *kobj,
62 + struct kobj_attribute *attr, char *buf)
63 +{
64 + return snprintf(buf, PAGE_SIZE, "%ld\n", partition_coherence_id());
65 +}
66 +
67 +static struct kobj_attribute partition_id_attr =
68 + __ATTR(partition_id, S_IRUGO, partition_id_show, NULL);
69 +
70 +static struct kobj_attribute coherence_id_attr =
71 + __ATTR(coherence_id, S_IRUGO, coherence_id_show, NULL);
72 +
73 +
74 +static int __init sgi_uv_sysfs_init(void)
75 +{
76 + unsigned long ret;
77 +
78 + if (!sgi_uv_kobj)
79 + sgi_uv_kobj = kobject_create_and_add("sgi_uv", firmware_kobj);
80 + if (!sgi_uv_kobj) {
81 + printk(KERN_WARNING "kobject_create_and_add sgi_uv failed \n");
82 + return -EINVAL;
83 + }
84 +
85 + ret = sysfs_create_file(sgi_uv_kobj, &partition_id_attr.attr);
86 + if (ret) {
87 + printk(KERN_WARNING "sysfs_create_file partition_id failed \n");
88 + return ret;
89 + }
90 +
91 + ret = sysfs_create_file(sgi_uv_kobj, &coherence_id_attr.attr);
92 + if (ret) {
93 + printk(KERN_WARNING "sysfs_create_file coherence_id failed \n");
94 + return ret;
95 + }
96 +
97 + return 0;
98 +}
99 +
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)
106
107 +extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */
108
109 #endif /* _ASM_X86_BIOS_H */