mirror of
https://github.com/torvalds/linux.git
synced 2024-12-18 17:12:55 +00:00
1a59d1b8e0
Based on 1 normalized pattern(s): 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
64 lines
1.5 KiB
C
64 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* This file supports the /sys/firmware/sgi_uv interfaces for SGI UV.
|
|
*
|
|
* Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
|
|
* Copyright (c) Russ Anderson
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
#include <asm/uv/bios.h>
|
|
#include <asm/uv/uv.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", uv_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 (!is_uv_system())
|
|
return -ENODEV;
|
|
|
|
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);
|