3 * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * Further, this software is distributed without any warranty that it is
14 * free of the rightful claim of any third person regarding infringement
15 * or the like. Any license provided herein, whether implied or
16 * otherwise, applies only to this software file. Patent licenses, if
17 * any, provided herein do not apply to combinations of this program with
18 * other software, or any other product whatsoever.
20 * You should have received a copy of the GNU General Public
21 * License along with this program; if not, write the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
25 * Mountain View, CA 94043, or:
29 * For further information regarding this notice, see:
31 * http://oss.sgi.com/projects/GenInfo/NoticeExplan
33 #include <linux/config.h>
36 #include <linux/proc_fs.h>
37 #include <asm/sn/sn_sal.h>
40 static int partition_id_read_proc(char *page, char **start, off_t off,
41 int count, int *eof, void *data) {
43 return sprintf(page, "%d\n", sn_local_partid());
46 struct proc_dir_entry * sgi_proc_dir = NULL;
49 register_sn_partition_id(void) {
50 struct proc_dir_entry *entry;
53 sgi_proc_dir = proc_mkdir("sgi_sn", 0);
55 entry = create_proc_entry("partition_id", 0444, sgi_proc_dir);
59 entry->read_proc = partition_id_read_proc;
60 entry->write_proc = NULL;
65 system_serial_number_read_proc(char *page, char **start, off_t off,
66 int count, int *eof, void *data) {
67 return sprintf(page, "%s\n", sn_system_serial_number());
71 licenseID_read_proc(char *page, char **start, off_t off,
72 int count, int *eof, void *data) {
73 return sprintf(page, "0x%lx\n",sn_partition_serial_number_val());
77 register_sn_serial_numbers(void) {
78 struct proc_dir_entry *entry;
81 sgi_proc_dir = proc_mkdir("sgi_sn", 0);
83 entry = create_proc_entry("system_serial_number", 0444, sgi_proc_dir);
87 entry->read_proc = system_serial_number_read_proc;
88 entry->write_proc = NULL;
90 entry = create_proc_entry("licenseID", 0444, sgi_proc_dir);
94 entry->read_proc = licenseID_read_proc;
95 entry->write_proc = NULL;
99 // Disable forced interrupts, but leave the code in, just in case.
100 int sn_force_interrupt_flag = 0;
103 sn_force_interrupt_read_proc(char *page, char **start, off_t off,
104 int count, int *eof, void *data) {
105 if (sn_force_interrupt_flag) {
106 return sprintf(page, "Force interrupt is enabled\n");
108 return sprintf(page, "Force interrupt is disabled\n");
112 sn_force_interrupt_write_proc(struct file *file, const char *buffer,
113 unsigned long count, void *data)
115 if (*buffer == '0') {
116 sn_force_interrupt_flag = 0;
118 sn_force_interrupt_flag = 1;
124 register_sn_force_interrupt(void) {
125 struct proc_dir_entry *entry;
128 sgi_proc_dir = proc_mkdir("sgi_sn", 0);
130 entry = create_proc_entry("sn_force_interrupt",0444, sgi_proc_dir);
134 entry->read_proc = sn_force_interrupt_read_proc;
135 entry->write_proc = sn_force_interrupt_write_proc;
139 register_sn_procfs(void) {
140 register_sn_partition_id();
141 register_sn_serial_numbers();
142 register_sn_force_interrupt();
145 #endif /* CONFIG_PROC_FS */