1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * This file supports the /sys/firmware/sgi_uv interfaces for SGI UV.
5 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
6 * Copyright (c) Russ Anderson
9 #include <linux/device.h>
10 #include <asm/uv/bios.h>
11 #include <asm/uv/uv.h>
13 struct kobject
*sgi_uv_kobj
;
15 static ssize_t
partition_id_show(struct kobject
*kobj
,
16 struct kobj_attribute
*attr
, char *buf
)
18 return snprintf(buf
, PAGE_SIZE
, "%ld\n", sn_partition_id
);
21 static ssize_t
coherence_id_show(struct kobject
*kobj
,
22 struct kobj_attribute
*attr
, char *buf
)
24 return snprintf(buf
, PAGE_SIZE
, "%ld\n", uv_partition_coherence_id());
27 static struct kobj_attribute partition_id_attr
=
28 __ATTR(partition_id
, S_IRUGO
, partition_id_show
, NULL
);
30 static struct kobj_attribute coherence_id_attr
=
31 __ATTR(coherence_id
, S_IRUGO
, coherence_id_show
, NULL
);
34 static int __init
sgi_uv_sysfs_init(void)
42 sgi_uv_kobj
= kobject_create_and_add("sgi_uv", firmware_kobj
);
44 printk(KERN_WARNING
"kobject_create_and_add sgi_uv failed\n");
48 ret
= sysfs_create_file(sgi_uv_kobj
, &partition_id_attr
.attr
);
50 printk(KERN_WARNING
"sysfs_create_file partition_id failed\n");
54 ret
= sysfs_create_file(sgi_uv_kobj
, &coherence_id_attr
.attr
);
56 printk(KERN_WARNING
"sysfs_create_file coherence_id failed\n");
63 device_initcall(sgi_uv_sysfs_init
);