2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2000-2005 Silicon Graphics, Inc. All rights reserved.
10 #include <linux/proc_fs.h>
11 #include <linux/seq_file.h>
12 #include <linux/uaccess.h>
13 #include <asm/sn/sn_sal.h>
15 static int partition_id_show(struct seq_file *s, void *p)
17 seq_printf(s, "%d\n", sn_partition_id);
21 static int system_serial_number_show(struct seq_file *s, void *p)
23 seq_printf(s, "%s\n", sn_system_serial_number());
27 static int licenseID_show(struct seq_file *s, void *p)
29 seq_printf(s, "0x%llx\n", sn_partition_serial_number_val());
33 static int coherence_id_show(struct seq_file *s, void *p)
35 seq_printf(s, "%d\n", partition_coherence_id());
40 /* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */
41 extern int sn_topology_open(struct inode *, struct file *);
42 extern int sn_topology_release(struct inode *, struct file *);
44 static const struct file_operations proc_sn_topo_fops = {
45 .open = sn_topology_open,
48 .release = sn_topology_release,
51 void register_sn_procfs(void)
53 static struct proc_dir_entry *sgi_proc_dir = NULL;
55 BUG_ON(sgi_proc_dir != NULL);
56 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))
59 proc_create_single("partition_id", 0444, sgi_proc_dir,
61 proc_create_single("system_serial_number", 0444, sgi_proc_dir,
62 system_serial_number_show);
63 proc_create_single("licenseID", 0444, sgi_proc_dir, licenseID_show);
64 proc_create_single("coherence_id", 0444, sgi_proc_dir,
66 proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops);
69 #endif /* CONFIG_PROC_FS */