Path: blob/master/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
17531 views
/*1* This file is subject to the terms and conditions of the GNU General Public2* License. See the file "COPYING" in the main directory of this archive3* for more details.4*5* Copyright (C) 2000-2005 Silicon Graphics, Inc. All rights reserved.6*/78#ifdef CONFIG_PROC_FS9#include <linux/proc_fs.h>10#include <linux/seq_file.h>11#include <asm/uaccess.h>12#include <asm/sn/sn_sal.h>1314static int partition_id_show(struct seq_file *s, void *p)15{16seq_printf(s, "%d\n", sn_partition_id);17return 0;18}1920static int partition_id_open(struct inode *inode, struct file *file)21{22return single_open(file, partition_id_show, NULL);23}2425static int system_serial_number_show(struct seq_file *s, void *p)26{27seq_printf(s, "%s\n", sn_system_serial_number());28return 0;29}3031static int system_serial_number_open(struct inode *inode, struct file *file)32{33return single_open(file, system_serial_number_show, NULL);34}3536static int licenseID_show(struct seq_file *s, void *p)37{38seq_printf(s, "0x%llx\n", sn_partition_serial_number_val());39return 0;40}4142static int licenseID_open(struct inode *inode, struct file *file)43{44return single_open(file, licenseID_show, NULL);45}4647static int coherence_id_show(struct seq_file *s, void *p)48{49seq_printf(s, "%d\n", partition_coherence_id());5051return 0;52}5354static int coherence_id_open(struct inode *inode, struct file *file)55{56return single_open(file, coherence_id_show, NULL);57}5859/* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */60extern int sn_topology_open(struct inode *, struct file *);61extern int sn_topology_release(struct inode *, struct file *);6263static const struct file_operations proc_partition_id_fops = {64.open = partition_id_open,65.read = seq_read,66.llseek = seq_lseek,67.release = single_release,68};6970static const struct file_operations proc_system_sn_fops = {71.open = system_serial_number_open,72.read = seq_read,73.llseek = seq_lseek,74.release = single_release,75};7677static const struct file_operations proc_license_id_fops = {78.open = licenseID_open,79.read = seq_read,80.llseek = seq_lseek,81.release = single_release,82};8384static const struct file_operations proc_coherence_id_fops = {85.open = coherence_id_open,86.read = seq_read,87.llseek = seq_lseek,88.release = single_release,89};9091static const struct file_operations proc_sn_topo_fops = {92.open = sn_topology_open,93.read = seq_read,94.llseek = seq_lseek,95.release = sn_topology_release,96};9798void register_sn_procfs(void)99{100static struct proc_dir_entry *sgi_proc_dir = NULL;101102BUG_ON(sgi_proc_dir != NULL);103if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))104return;105106proc_create("partition_id", 0444, sgi_proc_dir,107&proc_partition_id_fops);108proc_create("system_serial_number", 0444, sgi_proc_dir,109&proc_system_sn_fops);110proc_create("licenseID", 0444, sgi_proc_dir, &proc_license_id_fops);111proc_create("coherence_id", 0444, sgi_proc_dir,112&proc_coherence_id_fops);113proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops);114}115116#endif /* CONFIG_PROC_FS */117118119