• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/drivers/message/i2o/
1/*
2 *	procfs handler for Linux I2O subsystem
3 *
4 *	(c) Copyright 1999	Deepak Saxena
5 *
6 *	Originally written by Deepak Saxena(deepak@plexity.net)
7 *
8 *	This program is free software; you can redistribute it and/or modify it
9 *	under the terms of the GNU General Public License as published by the
10 *	Free Software Foundation; either version 2 of the License, or (at your
11 *	option) any later version.
12 *
13 *	This is an initial test release. The code is based on the design of the
14 *	ide procfs system (drivers/block/ide-proc.c). Some code taken from
15 *	i2o-core module by Alan Cox.
16 *
17 *	DISCLAIMER: This code is still under development/test and may cause
18 *	your system to behave unpredictably.  Use at your own discretion.
19 *
20 *
21 *	Fixes/additions:
22 *		Juha Siev��nen (Juha.Sievanen@cs.Helsinki.FI),
23 *		Auvo H��kkinen (Auvo.Hakkinen@cs.Helsinki.FI)
24 *		University of Helsinki, Department of Computer Science
25 *			LAN entries
26 *		Markus Lidel <Markus.Lidel@shadowconnect.com>
27 *			Changes for new I2O API
28 */
29
30#define OSM_NAME	"proc-osm"
31#define OSM_VERSION	"1.316"
32#define OSM_DESCRIPTION	"I2O ProcFS OSM"
33
34#define I2O_MAX_MODULES 4
35#define FMT_U64_HEX "0x%08x%08x"
36#define U64_VAL(pu64) *((u32*)(pu64)+1), *((u32*)(pu64))
37
38#include <linux/types.h>
39#include <linux/kernel.h>
40#include <linux/pci.h>
41#include <linux/i2o.h>
42#include <linux/slab.h>
43#include <linux/proc_fs.h>
44#include <linux/seq_file.h>
45#include <linux/init.h>
46#include <linux/module.h>
47#include <linux/errno.h>
48#include <linux/spinlock.h>
49#include <linux/workqueue.h>
50
51#include <asm/io.h>
52#include <asm/uaccess.h>
53#include <asm/byteorder.h>
54
55/* Structure used to define /proc entries */
56typedef struct _i2o_proc_entry_t {
57	char *name;		/* entry name */
58	mode_t mode;		/* mode */
59	const struct file_operations *fops;	/* open function */
60} i2o_proc_entry;
61
62/* global I2O /proc/i2o entry */
63static struct proc_dir_entry *i2o_proc_dir_root;
64
65/* proc OSM driver struct */
66static struct i2o_driver i2o_proc_driver = {
67	.name = OSM_NAME,
68};
69
70static int print_serial_number(struct seq_file *seq, u8 * serialno, int max_len)
71{
72	int i;
73
74	/* 19990419 -sralston
75	 *      The I2O v1.5 (and v2.0 so far) "official specification"
76	 *      got serial numbers WRONG!
77	 *      Apparently, and despite what Section 3.4.4 says and
78	 *      Figure 3-35 shows (pg 3-39 in the pdf doc),
79	 *      the convention / consensus seems to be:
80	 *        + First byte is SNFormat
81	 *        + Second byte is SNLen (but only if SNFormat==7 (?))
82	 *        + (v2.0) SCSI+BS may use IEEE Registered (64 or 128 bit) format
83	 */
84	switch (serialno[0]) {
85	case I2O_SNFORMAT_BINARY:	/* Binary */
86		seq_printf(seq, "0x");
87		for (i = 0; i < serialno[1]; i++) {
88			seq_printf(seq, "%02X", serialno[2 + i]);
89		}
90		break;
91
92	case I2O_SNFORMAT_ASCII:	/* ASCII */
93		if (serialno[1] < ' ') {	/* printable or SNLen? */
94			/* sanity */
95			max_len =
96			    (max_len < serialno[1]) ? max_len : serialno[1];
97			serialno[1 + max_len] = '\0';
98
99			/* just print it */
100			seq_printf(seq, "%s", &serialno[2]);
101		} else {
102			/* print chars for specified length */
103			for (i = 0; i < serialno[1]; i++) {
104				seq_printf(seq, "%c", serialno[2 + i]);
105			}
106		}
107		break;
108
109	case I2O_SNFORMAT_UNICODE:	/* UNICODE */
110		seq_printf(seq, "UNICODE Format.  Can't Display\n");
111		break;
112
113	case I2O_SNFORMAT_LAN48_MAC:	/* LAN-48 MAC Address */
114		seq_printf(seq, "LAN-48 MAC address @ %pM", &serialno[2]);
115		break;
116
117	case I2O_SNFORMAT_WAN:	/* WAN MAC Address */
118		seq_printf(seq, "WAN Access Address");
119		break;
120
121/* plus new in v2.0 */
122	case I2O_SNFORMAT_LAN64_MAC:	/* LAN-64 MAC Address */
123		seq_printf(seq,
124			   "LAN-64 MAC address @ [?:%02X:%02X:?] %pM",
125			   serialno[8], serialno[9], &serialno[2]);
126		break;
127
128	case I2O_SNFORMAT_DDM:	/* I2O DDM */
129		seq_printf(seq,
130			   "DDM: Tid=%03Xh, Rsvd=%04Xh, OrgId=%04Xh",
131			   *(u16 *) & serialno[2],
132			   *(u16 *) & serialno[4], *(u16 *) & serialno[6]);
133		break;
134
135	case I2O_SNFORMAT_IEEE_REG64:	/* IEEE Registered (64-bit) */
136	case I2O_SNFORMAT_IEEE_REG128:	/* IEEE Registered (128-bit) */
137		seq_printf(seq,
138			   "IEEE NodeName(hi,lo)=(%08Xh:%08Xh), PortName(hi,lo)=(%08Xh:%08Xh)\n",
139			   *(u32 *) & serialno[2],
140			   *(u32 *) & serialno[6],
141			   *(u32 *) & serialno[10], *(u32 *) & serialno[14]);
142		break;
143
144	case I2O_SNFORMAT_UNKNOWN:	/* Unknown 0    */
145	case I2O_SNFORMAT_UNKNOWN2:	/* Unknown 0xff */
146	default:
147		seq_printf(seq, "Unknown data format (0x%02x)", serialno[0]);
148		break;
149	}
150
151	return 0;
152}
153
154/**
155 *	i2o_get_class_name - 	do i2o class name lookup
156 *	@class: class number
157 *
158 *	Return a descriptive string for an i2o class.
159 */
160static const char *i2o_get_class_name(int class)
161{
162	int idx = 16;
163	static char *i2o_class_name[] = {
164		"Executive",
165		"Device Driver Module",
166		"Block Device",
167		"Tape Device",
168		"LAN Interface",
169		"WAN Interface",
170		"Fibre Channel Port",
171		"Fibre Channel Device",
172		"SCSI Device",
173		"ATE Port",
174		"ATE Device",
175		"Floppy Controller",
176		"Floppy Device",
177		"Secondary Bus Port",
178		"Peer Transport Agent",
179		"Peer Transport",
180		"Unknown"
181	};
182
183	switch (class & 0xfff) {
184	case I2O_CLASS_EXECUTIVE:
185		idx = 0;
186		break;
187	case I2O_CLASS_DDM:
188		idx = 1;
189		break;
190	case I2O_CLASS_RANDOM_BLOCK_STORAGE:
191		idx = 2;
192		break;
193	case I2O_CLASS_SEQUENTIAL_STORAGE:
194		idx = 3;
195		break;
196	case I2O_CLASS_LAN:
197		idx = 4;
198		break;
199	case I2O_CLASS_WAN:
200		idx = 5;
201		break;
202	case I2O_CLASS_FIBRE_CHANNEL_PORT:
203		idx = 6;
204		break;
205	case I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL:
206		idx = 7;
207		break;
208	case I2O_CLASS_SCSI_PERIPHERAL:
209		idx = 8;
210		break;
211	case I2O_CLASS_ATE_PORT:
212		idx = 9;
213		break;
214	case I2O_CLASS_ATE_PERIPHERAL:
215		idx = 10;
216		break;
217	case I2O_CLASS_FLOPPY_CONTROLLER:
218		idx = 11;
219		break;
220	case I2O_CLASS_FLOPPY_DEVICE:
221		idx = 12;
222		break;
223	case I2O_CLASS_BUS_ADAPTER:
224		idx = 13;
225		break;
226	case I2O_CLASS_PEER_TRANSPORT_AGENT:
227		idx = 14;
228		break;
229	case I2O_CLASS_PEER_TRANSPORT:
230		idx = 15;
231		break;
232	}
233
234	return i2o_class_name[idx];
235}
236
237#define SCSI_TABLE_SIZE	13
238static char *scsi_devices[] = {
239	"Direct-Access Read/Write",
240	"Sequential-Access Storage",
241	"Printer",
242	"Processor",
243	"WORM Device",
244	"CD-ROM Device",
245	"Scanner Device",
246	"Optical Memory Device",
247	"Medium Changer Device",
248	"Communications Device",
249	"Graphics Art Pre-Press Device",
250	"Graphics Art Pre-Press Device",
251	"Array Controller Device"
252};
253
254static char *chtostr(u8 * chars, int n)
255{
256	char tmp[256];
257	tmp[0] = 0;
258	return strncat(tmp, (char *)chars, n);
259}
260
261static int i2o_report_query_status(struct seq_file *seq, int block_status,
262				   char *group)
263{
264	switch (block_status) {
265	case -ETIMEDOUT:
266		return seq_printf(seq, "Timeout reading group %s.\n", group);
267	case -ENOMEM:
268		return seq_printf(seq, "No free memory to read the table.\n");
269	case -I2O_PARAMS_STATUS_INVALID_GROUP_ID:
270		return seq_printf(seq, "Group %s not supported.\n", group);
271	default:
272		return seq_printf(seq,
273				  "Error reading group %s. BlockStatus 0x%02X\n",
274				  group, -block_status);
275	}
276}
277
278static char *bus_strings[] = {
279	"Local Bus",
280	"ISA",
281	"EISA",
282	"MCA",
283	"PCI",
284	"PCMCIA",
285	"NUBUS",
286	"CARDBUS"
287};
288
289static int i2o_seq_show_hrt(struct seq_file *seq, void *v)
290{
291	struct i2o_controller *c = (struct i2o_controller *)seq->private;
292	i2o_hrt *hrt = (i2o_hrt *) c->hrt.virt;
293	u32 bus;
294	int i;
295
296	if (hrt->hrt_version) {
297		seq_printf(seq,
298			   "HRT table for controller is too new a version.\n");
299		return 0;
300	}
301
302	seq_printf(seq, "HRT has %d entries of %d bytes each.\n",
303		   hrt->num_entries, hrt->entry_len << 2);
304
305	for (i = 0; i < hrt->num_entries; i++) {
306		seq_printf(seq, "Entry %d:\n", i);
307		seq_printf(seq, "   Adapter ID: %0#10x\n",
308			   hrt->hrt_entry[i].adapter_id);
309		seq_printf(seq, "   Controlling tid: %0#6x\n",
310			   hrt->hrt_entry[i].parent_tid);
311
312		if (hrt->hrt_entry[i].bus_type != 0x80) {
313			bus = hrt->hrt_entry[i].bus_type;
314			seq_printf(seq, "   %s Information\n",
315				   bus_strings[bus]);
316
317			switch (bus) {
318			case I2O_BUS_LOCAL:
319				seq_printf(seq, "     IOBase: %0#6x,",
320					   hrt->hrt_entry[i].bus.local_bus.
321					   LbBaseIOPort);
322				seq_printf(seq, " MemoryBase: %0#10x\n",
323					   hrt->hrt_entry[i].bus.local_bus.
324					   LbBaseMemoryAddress);
325				break;
326
327			case I2O_BUS_ISA:
328				seq_printf(seq, "     IOBase: %0#6x,",
329					   hrt->hrt_entry[i].bus.isa_bus.
330					   IsaBaseIOPort);
331				seq_printf(seq, " MemoryBase: %0#10x,",
332					   hrt->hrt_entry[i].bus.isa_bus.
333					   IsaBaseMemoryAddress);
334				seq_printf(seq, " CSN: %0#4x,",
335					   hrt->hrt_entry[i].bus.isa_bus.CSN);
336				break;
337
338			case I2O_BUS_EISA:
339				seq_printf(seq, "     IOBase: %0#6x,",
340					   hrt->hrt_entry[i].bus.eisa_bus.
341					   EisaBaseIOPort);
342				seq_printf(seq, " MemoryBase: %0#10x,",
343					   hrt->hrt_entry[i].bus.eisa_bus.
344					   EisaBaseMemoryAddress);
345				seq_printf(seq, " Slot: %0#4x,",
346					   hrt->hrt_entry[i].bus.eisa_bus.
347					   EisaSlotNumber);
348				break;
349
350			case I2O_BUS_MCA:
351				seq_printf(seq, "     IOBase: %0#6x,",
352					   hrt->hrt_entry[i].bus.mca_bus.
353					   McaBaseIOPort);
354				seq_printf(seq, " MemoryBase: %0#10x,",
355					   hrt->hrt_entry[i].bus.mca_bus.
356					   McaBaseMemoryAddress);
357				seq_printf(seq, " Slot: %0#4x,",
358					   hrt->hrt_entry[i].bus.mca_bus.
359					   McaSlotNumber);
360				break;
361
362			case I2O_BUS_PCI:
363				seq_printf(seq, "     Bus: %0#4x",
364					   hrt->hrt_entry[i].bus.pci_bus.
365					   PciBusNumber);
366				seq_printf(seq, " Dev: %0#4x",
367					   hrt->hrt_entry[i].bus.pci_bus.
368					   PciDeviceNumber);
369				seq_printf(seq, " Func: %0#4x",
370					   hrt->hrt_entry[i].bus.pci_bus.
371					   PciFunctionNumber);
372				seq_printf(seq, " Vendor: %0#6x",
373					   hrt->hrt_entry[i].bus.pci_bus.
374					   PciVendorID);
375				seq_printf(seq, " Device: %0#6x\n",
376					   hrt->hrt_entry[i].bus.pci_bus.
377					   PciDeviceID);
378				break;
379
380			default:
381				seq_printf(seq, "      Unsupported Bus Type\n");
382			}
383		} else
384			seq_printf(seq, "   Unknown Bus Type\n");
385	}
386
387	return 0;
388}
389
390static int i2o_seq_show_lct(struct seq_file *seq, void *v)
391{
392	struct i2o_controller *c = (struct i2o_controller *)seq->private;
393	i2o_lct *lct = (i2o_lct *) c->lct;
394	int entries;
395	int i;
396
397#define BUS_TABLE_SIZE 3
398	static char *bus_ports[] = {
399		"Generic Bus",
400		"SCSI Bus",
401		"Fibre Channel Bus"
402	};
403
404	entries = (lct->table_size - 3) / 9;
405
406	seq_printf(seq, "LCT contains %d %s\n", entries,
407		   entries == 1 ? "entry" : "entries");
408	if (lct->boot_tid)
409		seq_printf(seq, "Boot Device @ ID %d\n", lct->boot_tid);
410
411	seq_printf(seq, "Current Change Indicator: %#10x\n", lct->change_ind);
412
413	for (i = 0; i < entries; i++) {
414		seq_printf(seq, "Entry %d\n", i);
415		seq_printf(seq, "  Class, SubClass  : %s",
416			   i2o_get_class_name(lct->lct_entry[i].class_id));
417
418		/*
419		 *      Classes which we'll print subclass info for
420		 */
421		switch (lct->lct_entry[i].class_id & 0xFFF) {
422		case I2O_CLASS_RANDOM_BLOCK_STORAGE:
423			switch (lct->lct_entry[i].sub_class) {
424			case 0x00:
425				seq_printf(seq, ", Direct-Access Read/Write");
426				break;
427
428			case 0x04:
429				seq_printf(seq, ", WORM Drive");
430				break;
431
432			case 0x05:
433				seq_printf(seq, ", CD-ROM Drive");
434				break;
435
436			case 0x07:
437				seq_printf(seq, ", Optical Memory Device");
438				break;
439
440			default:
441				seq_printf(seq, ", Unknown (0x%02x)",
442					   lct->lct_entry[i].sub_class);
443				break;
444			}
445			break;
446
447		case I2O_CLASS_LAN:
448			switch (lct->lct_entry[i].sub_class & 0xFF) {
449			case 0x30:
450				seq_printf(seq, ", Ethernet");
451				break;
452
453			case 0x40:
454				seq_printf(seq, ", 100base VG");
455				break;
456
457			case 0x50:
458				seq_printf(seq, ", IEEE 802.5/Token-Ring");
459				break;
460
461			case 0x60:
462				seq_printf(seq, ", ANSI X3T9.5 FDDI");
463				break;
464
465			case 0x70:
466				seq_printf(seq, ", Fibre Channel");
467				break;
468
469			default:
470				seq_printf(seq, ", Unknown Sub-Class (0x%02x)",
471					   lct->lct_entry[i].sub_class & 0xFF);
472				break;
473			}
474			break;
475
476		case I2O_CLASS_SCSI_PERIPHERAL:
477			if (lct->lct_entry[i].sub_class < SCSI_TABLE_SIZE)
478				seq_printf(seq, ", %s",
479					   scsi_devices[lct->lct_entry[i].
480							sub_class]);
481			else
482				seq_printf(seq, ", Unknown Device Type");
483			break;
484
485		case I2O_CLASS_BUS_ADAPTER:
486			if (lct->lct_entry[i].sub_class < BUS_TABLE_SIZE)
487				seq_printf(seq, ", %s",
488					   bus_ports[lct->lct_entry[i].
489						     sub_class]);
490			else
491				seq_printf(seq, ", Unknown Bus Type");
492			break;
493		}
494		seq_printf(seq, "\n");
495
496		seq_printf(seq, "  Local TID        : 0x%03x\n",
497			   lct->lct_entry[i].tid);
498		seq_printf(seq, "  User TID         : 0x%03x\n",
499			   lct->lct_entry[i].user_tid);
500		seq_printf(seq, "  Parent TID       : 0x%03x\n",
501			   lct->lct_entry[i].parent_tid);
502		seq_printf(seq, "  Identity Tag     : 0x%x%x%x%x%x%x%x%x\n",
503			   lct->lct_entry[i].identity_tag[0],
504			   lct->lct_entry[i].identity_tag[1],
505			   lct->lct_entry[i].identity_tag[2],
506			   lct->lct_entry[i].identity_tag[3],
507			   lct->lct_entry[i].identity_tag[4],
508			   lct->lct_entry[i].identity_tag[5],
509			   lct->lct_entry[i].identity_tag[6],
510			   lct->lct_entry[i].identity_tag[7]);
511		seq_printf(seq, "  Change Indicator : %0#10x\n",
512			   lct->lct_entry[i].change_ind);
513		seq_printf(seq, "  Event Capab Mask : %0#10x\n",
514			   lct->lct_entry[i].device_flags);
515	}
516
517	return 0;
518}
519
520static int i2o_seq_show_status(struct seq_file *seq, void *v)
521{
522	struct i2o_controller *c = (struct i2o_controller *)seq->private;
523	char prodstr[25];
524	int version;
525	i2o_status_block *sb = c->status_block.virt;
526
527	i2o_status_get(c);	// reread the status block
528
529	seq_printf(seq, "Organization ID        : %0#6x\n", sb->org_id);
530
531	version = sb->i2o_version;
532
533	seq_printf(seq, "IOP ID                 : %0#5x\n", sb->iop_id);
534	seq_printf(seq, "Host Unit ID           : %0#6x\n", sb->host_unit_id);
535	seq_printf(seq, "Segment Number         : %0#5x\n", sb->segment_number);
536
537	seq_printf(seq, "I2O version            : ");
538	switch (version) {
539	case 0x00:
540		seq_printf(seq, "1.0\n");
541		break;
542	case 0x01:
543		seq_printf(seq, "1.5\n");
544		break;
545	case 0x02:
546		seq_printf(seq, "2.0\n");
547		break;
548	default:
549		seq_printf(seq, "Unknown version\n");
550	}
551
552	seq_printf(seq, "IOP State              : ");
553	switch (sb->iop_state) {
554	case 0x01:
555		seq_printf(seq, "INIT\n");
556		break;
557
558	case 0x02:
559		seq_printf(seq, "RESET\n");
560		break;
561
562	case 0x04:
563		seq_printf(seq, "HOLD\n");
564		break;
565
566	case 0x05:
567		seq_printf(seq, "READY\n");
568		break;
569
570	case 0x08:
571		seq_printf(seq, "OPERATIONAL\n");
572		break;
573
574	case 0x10:
575		seq_printf(seq, "FAILED\n");
576		break;
577
578	case 0x11:
579		seq_printf(seq, "FAULTED\n");
580		break;
581
582	default:
583		seq_printf(seq, "Unknown\n");
584		break;
585	}
586
587	seq_printf(seq, "Messenger Type         : ");
588	switch (sb->msg_type) {
589	case 0x00:
590		seq_printf(seq, "Memory mapped\n");
591		break;
592	case 0x01:
593		seq_printf(seq, "Memory mapped only\n");
594		break;
595	case 0x02:
596		seq_printf(seq, "Remote only\n");
597		break;
598	case 0x03:
599		seq_printf(seq, "Memory mapped and remote\n");
600		break;
601	default:
602		seq_printf(seq, "Unknown\n");
603	}
604
605	seq_printf(seq, "Inbound Frame Size     : %d bytes\n",
606		   sb->inbound_frame_size << 2);
607	seq_printf(seq, "Max Inbound Frames     : %d\n",
608		   sb->max_inbound_frames);
609	seq_printf(seq, "Current Inbound Frames : %d\n",
610		   sb->cur_inbound_frames);
611	seq_printf(seq, "Max Outbound Frames    : %d\n",
612		   sb->max_outbound_frames);
613
614	/* Spec doesn't say if NULL terminated or not... */
615	memcpy(prodstr, sb->product_id, 24);
616	prodstr[24] = '\0';
617	seq_printf(seq, "Product ID             : %s\n", prodstr);
618	seq_printf(seq, "Expected LCT Size      : %d bytes\n",
619		   sb->expected_lct_size);
620
621	seq_printf(seq, "IOP Capabilities\n");
622	seq_printf(seq, "    Context Field Size Support : ");
623	switch (sb->iop_capabilities & 0x0000003) {
624	case 0:
625		seq_printf(seq, "Supports only 32-bit context fields\n");
626		break;
627	case 1:
628		seq_printf(seq, "Supports only 64-bit context fields\n");
629		break;
630	case 2:
631		seq_printf(seq, "Supports 32-bit and 64-bit context fields, "
632			   "but not concurrently\n");
633		break;
634	case 3:
635		seq_printf(seq, "Supports 32-bit and 64-bit context fields "
636			   "concurrently\n");
637		break;
638	default:
639		seq_printf(seq, "0x%08x\n", sb->iop_capabilities);
640	}
641	seq_printf(seq, "    Current Context Field Size : ");
642	switch (sb->iop_capabilities & 0x0000000C) {
643	case 0:
644		seq_printf(seq, "not configured\n");
645		break;
646	case 4:
647		seq_printf(seq, "Supports only 32-bit context fields\n");
648		break;
649	case 8:
650		seq_printf(seq, "Supports only 64-bit context fields\n");
651		break;
652	case 12:
653		seq_printf(seq, "Supports both 32-bit or 64-bit context fields "
654			   "concurrently\n");
655		break;
656	default:
657		seq_printf(seq, "\n");
658	}
659	seq_printf(seq, "    Inbound Peer Support       : %s\n",
660		   (sb->
661		    iop_capabilities & 0x00000010) ? "Supported" :
662		   "Not supported");
663	seq_printf(seq, "    Outbound Peer Support      : %s\n",
664		   (sb->
665		    iop_capabilities & 0x00000020) ? "Supported" :
666		   "Not supported");
667	seq_printf(seq, "    Peer to Peer Support       : %s\n",
668		   (sb->
669		    iop_capabilities & 0x00000040) ? "Supported" :
670		   "Not supported");
671
672	seq_printf(seq, "Desired private memory size   : %d kB\n",
673		   sb->desired_mem_size >> 10);
674	seq_printf(seq, "Allocated private memory size : %d kB\n",
675		   sb->current_mem_size >> 10);
676	seq_printf(seq, "Private memory base address   : %0#10x\n",
677		   sb->current_mem_base);
678	seq_printf(seq, "Desired private I/O size      : %d kB\n",
679		   sb->desired_io_size >> 10);
680	seq_printf(seq, "Allocated private I/O size    : %d kB\n",
681		   sb->current_io_size >> 10);
682	seq_printf(seq, "Private I/O base address      : %0#10x\n",
683		   sb->current_io_base);
684
685	return 0;
686}
687
688static int i2o_seq_show_hw(struct seq_file *seq, void *v)
689{
690	struct i2o_controller *c = (struct i2o_controller *)seq->private;
691	static u32 work32[5];
692	static u8 *work8 = (u8 *) work32;
693	static u16 *work16 = (u16 *) work32;
694	int token;
695	u32 hwcap;
696
697	static char *cpu_table[] = {
698		"Intel 80960 series",
699		"AMD2900 series",
700		"Motorola 68000 series",
701		"ARM series",
702		"MIPS series",
703		"Sparc series",
704		"PowerPC series",
705		"Intel x86 series"
706	};
707
708	token =
709	    i2o_parm_field_get(c->exec, 0x0000, -1, &work32, sizeof(work32));
710
711	if (token < 0) {
712		i2o_report_query_status(seq, token, "0x0000 IOP Hardware");
713		return 0;
714	}
715
716	seq_printf(seq, "I2O Vendor ID    : %0#6x\n", work16[0]);
717	seq_printf(seq, "Product ID       : %0#6x\n", work16[1]);
718	seq_printf(seq, "CPU              : ");
719	if (work8[16] > 8)
720		seq_printf(seq, "Unknown\n");
721	else
722		seq_printf(seq, "%s\n", cpu_table[work8[16]]);
723	/* Anyone using ProcessorVersion? */
724
725	seq_printf(seq, "RAM              : %dkB\n", work32[1] >> 10);
726	seq_printf(seq, "Non-Volatile Mem : %dkB\n", work32[2] >> 10);
727
728	hwcap = work32[3];
729	seq_printf(seq, "Capabilities : 0x%08x\n", hwcap);
730	seq_printf(seq, "   [%s] Self booting\n",
731		   (hwcap & 0x00000001) ? "+" : "-");
732	seq_printf(seq, "   [%s] Upgradable IRTOS\n",
733		   (hwcap & 0x00000002) ? "+" : "-");
734	seq_printf(seq, "   [%s] Supports downloading DDMs\n",
735		   (hwcap & 0x00000004) ? "+" : "-");
736	seq_printf(seq, "   [%s] Supports installing DDMs\n",
737		   (hwcap & 0x00000008) ? "+" : "-");
738	seq_printf(seq, "   [%s] Battery-backed RAM\n",
739		   (hwcap & 0x00000010) ? "+" : "-");
740
741	return 0;
742}
743
744/* Executive group 0003h - Executing DDM List (table) */
745static int i2o_seq_show_ddm_table(struct seq_file *seq, void *v)
746{
747	struct i2o_controller *c = (struct i2o_controller *)seq->private;
748	int token;
749	int i;
750
751	typedef struct _i2o_exec_execute_ddm_table {
752		u16 ddm_tid;
753		u8 module_type;
754		u8 reserved;
755		u16 i2o_vendor_id;
756		u16 module_id;
757		u8 module_name_version[28];
758		u32 data_size;
759		u32 code_size;
760	} i2o_exec_execute_ddm_table;
761
762	struct {
763		u16 result_count;
764		u16 pad;
765		u16 block_size;
766		u8 block_status;
767		u8 error_info_size;
768		u16 row_count;
769		u16 more_flag;
770		i2o_exec_execute_ddm_table ddm_table[I2O_MAX_MODULES];
771	} *result;
772
773	i2o_exec_execute_ddm_table ddm_table;
774
775	result = kmalloc(sizeof(*result), GFP_KERNEL);
776	if (!result)
777		return -ENOMEM;
778
779	token = i2o_parm_table_get(c->exec, I2O_PARAMS_TABLE_GET, 0x0003, -1,
780				   NULL, 0, result, sizeof(*result));
781
782	if (token < 0) {
783		i2o_report_query_status(seq, token,
784					"0x0003 Executing DDM List");
785		goto out;
786	}
787
788	seq_printf(seq,
789		   "Tid   Module_type     Vendor Mod_id  Module_name             Vrs  Data_size Code_size\n");
790	ddm_table = result->ddm_table[0];
791
792	for (i = 0; i < result->row_count; ddm_table = result->ddm_table[++i]) {
793		seq_printf(seq, "0x%03x ", ddm_table.ddm_tid & 0xFFF);
794
795		switch (ddm_table.module_type) {
796		case 0x01:
797			seq_printf(seq, "Downloaded DDM  ");
798			break;
799		case 0x22:
800			seq_printf(seq, "Embedded DDM    ");
801			break;
802		default:
803			seq_printf(seq, "                ");
804		}
805
806		seq_printf(seq, "%-#7x", ddm_table.i2o_vendor_id);
807		seq_printf(seq, "%-#8x", ddm_table.module_id);
808		seq_printf(seq, "%-29s",
809			   chtostr(ddm_table.module_name_version, 28));
810		seq_printf(seq, "%9d  ", ddm_table.data_size);
811		seq_printf(seq, "%8d", ddm_table.code_size);
812
813		seq_printf(seq, "\n");
814	}
815      out:
816	kfree(result);
817	return 0;
818}
819
820/* Executive group 0004h - Driver Store (scalar) */
821static int i2o_seq_show_driver_store(struct seq_file *seq, void *v)
822{
823	struct i2o_controller *c = (struct i2o_controller *)seq->private;
824	u32 work32[8];
825	int token;
826
827	token =
828	    i2o_parm_field_get(c->exec, 0x0004, -1, &work32, sizeof(work32));
829	if (token < 0) {
830		i2o_report_query_status(seq, token, "0x0004 Driver Store");
831		return 0;
832	}
833
834	seq_printf(seq, "Module limit  : %d\n"
835		   "Module count  : %d\n"
836		   "Current space : %d kB\n"
837		   "Free space    : %d kB\n",
838		   work32[0], work32[1], work32[2] >> 10, work32[3] >> 10);
839
840	return 0;
841}
842
843/* Executive group 0005h - Driver Store Table (table) */
844static int i2o_seq_show_drivers_stored(struct seq_file *seq, void *v)
845{
846	typedef struct _i2o_driver_store {
847		u16 stored_ddm_index;
848		u8 module_type;
849		u8 reserved;
850		u16 i2o_vendor_id;
851		u16 module_id;
852		u8 module_name_version[28];
853		u8 date[8];
854		u32 module_size;
855		u32 mpb_size;
856		u32 module_flags;
857	} i2o_driver_store_table;
858
859	struct i2o_controller *c = (struct i2o_controller *)seq->private;
860	int token;
861	int i;
862
863	typedef struct {
864		u16 result_count;
865		u16 pad;
866		u16 block_size;
867		u8 block_status;
868		u8 error_info_size;
869		u16 row_count;
870		u16 more_flag;
871		i2o_driver_store_table dst[I2O_MAX_MODULES];
872	} i2o_driver_result_table;
873
874	i2o_driver_result_table *result;
875	i2o_driver_store_table *dst;
876
877	result = kmalloc(sizeof(i2o_driver_result_table), GFP_KERNEL);
878	if (result == NULL)
879		return -ENOMEM;
880
881	token = i2o_parm_table_get(c->exec, I2O_PARAMS_TABLE_GET, 0x0005, -1,
882				   NULL, 0, result, sizeof(*result));
883
884	if (token < 0) {
885		i2o_report_query_status(seq, token,
886					"0x0005 DRIVER STORE TABLE");
887		kfree(result);
888		return 0;
889	}
890
891	seq_printf(seq,
892		   "#  Module_type     Vendor Mod_id  Module_name             Vrs"
893		   "Date     Mod_size Par_size Flags\n");
894	for (i = 0, dst = &result->dst[0]; i < result->row_count;
895	     dst = &result->dst[++i]) {
896		seq_printf(seq, "%-3d", dst->stored_ddm_index);
897		switch (dst->module_type) {
898		case 0x01:
899			seq_printf(seq, "Downloaded DDM  ");
900			break;
901		case 0x22:
902			seq_printf(seq, "Embedded DDM    ");
903			break;
904		default:
905			seq_printf(seq, "                ");
906		}
907
908		seq_printf(seq, "%-#7x", dst->i2o_vendor_id);
909		seq_printf(seq, "%-#8x", dst->module_id);
910		seq_printf(seq, "%-29s", chtostr(dst->module_name_version, 28));
911		seq_printf(seq, "%-9s", chtostr(dst->date, 8));
912		seq_printf(seq, "%8d ", dst->module_size);
913		seq_printf(seq, "%8d ", dst->mpb_size);
914		seq_printf(seq, "0x%04x", dst->module_flags);
915		seq_printf(seq, "\n");
916	}
917
918	kfree(result);
919	return 0;
920}
921
922/* Generic group F000h - Params Descriptor (table) */
923static int i2o_seq_show_groups(struct seq_file *seq, void *v)
924{
925	struct i2o_device *d = (struct i2o_device *)seq->private;
926	int token;
927	int i;
928	u8 properties;
929
930	typedef struct _i2o_group_info {
931		u16 group_number;
932		u16 field_count;
933		u16 row_count;
934		u8 properties;
935		u8 reserved;
936	} i2o_group_info;
937
938	struct {
939		u16 result_count;
940		u16 pad;
941		u16 block_size;
942		u8 block_status;
943		u8 error_info_size;
944		u16 row_count;
945		u16 more_flag;
946		i2o_group_info group[256];
947	} *result;
948
949	result = kmalloc(sizeof(*result), GFP_KERNEL);
950	if (!result)
951		return -ENOMEM;
952
953	token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF000, -1, NULL, 0,
954				   result, sizeof(*result));
955
956	if (token < 0) {
957		i2o_report_query_status(seq, token, "0xF000 Params Descriptor");
958		goto out;
959	}
960
961	seq_printf(seq,
962		   "#  Group   FieldCount RowCount Type   Add Del Clear\n");
963
964	for (i = 0; i < result->row_count; i++) {
965		seq_printf(seq, "%-3d", i);
966		seq_printf(seq, "0x%04X ", result->group[i].group_number);
967		seq_printf(seq, "%10d ", result->group[i].field_count);
968		seq_printf(seq, "%8d ", result->group[i].row_count);
969
970		properties = result->group[i].properties;
971		if (properties & 0x1)
972			seq_printf(seq, "Table  ");
973		else
974			seq_printf(seq, "Scalar ");
975		if (properties & 0x2)
976			seq_printf(seq, " + ");
977		else
978			seq_printf(seq, " - ");
979		if (properties & 0x4)
980			seq_printf(seq, "  + ");
981		else
982			seq_printf(seq, "  - ");
983		if (properties & 0x8)
984			seq_printf(seq, "  + ");
985		else
986			seq_printf(seq, "  - ");
987
988		seq_printf(seq, "\n");
989	}
990
991	if (result->more_flag)
992		seq_printf(seq, "There is more...\n");
993      out:
994	kfree(result);
995	return 0;
996}
997
998/* Generic group F001h - Physical Device Table (table) */
999static int i2o_seq_show_phys_device(struct seq_file *seq, void *v)
1000{
1001	struct i2o_device *d = (struct i2o_device *)seq->private;
1002	int token;
1003	int i;
1004
1005	struct {
1006		u16 result_count;
1007		u16 pad;
1008		u16 block_size;
1009		u8 block_status;
1010		u8 error_info_size;
1011		u16 row_count;
1012		u16 more_flag;
1013		u32 adapter_id[64];
1014	} result;
1015
1016	token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF001, -1, NULL, 0,
1017				   &result, sizeof(result));
1018
1019	if (token < 0) {
1020		i2o_report_query_status(seq, token,
1021					"0xF001 Physical Device Table");
1022		return 0;
1023	}
1024
1025	if (result.row_count)
1026		seq_printf(seq, "#  AdapterId\n");
1027
1028	for (i = 0; i < result.row_count; i++) {
1029		seq_printf(seq, "%-2d", i);
1030		seq_printf(seq, "%#7x\n", result.adapter_id[i]);
1031	}
1032
1033	if (result.more_flag)
1034		seq_printf(seq, "There is more...\n");
1035
1036	return 0;
1037}
1038
1039/* Generic group F002h - Claimed Table (table) */
1040static int i2o_seq_show_claimed(struct seq_file *seq, void *v)
1041{
1042	struct i2o_device *d = (struct i2o_device *)seq->private;
1043	int token;
1044	int i;
1045
1046	struct {
1047		u16 result_count;
1048		u16 pad;
1049		u16 block_size;
1050		u8 block_status;
1051		u8 error_info_size;
1052		u16 row_count;
1053		u16 more_flag;
1054		u16 claimed_tid[64];
1055	} result;
1056
1057	token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF002, -1, NULL, 0,
1058				   &result, sizeof(result));
1059
1060	if (token < 0) {
1061		i2o_report_query_status(seq, token, "0xF002 Claimed Table");
1062		return 0;
1063	}
1064
1065	if (result.row_count)
1066		seq_printf(seq, "#  ClaimedTid\n");
1067
1068	for (i = 0; i < result.row_count; i++) {
1069		seq_printf(seq, "%-2d", i);
1070		seq_printf(seq, "%#7x\n", result.claimed_tid[i]);
1071	}
1072
1073	if (result.more_flag)
1074		seq_printf(seq, "There is more...\n");
1075
1076	return 0;
1077}
1078
1079/* Generic group F003h - User Table (table) */
1080static int i2o_seq_show_users(struct seq_file *seq, void *v)
1081{
1082	struct i2o_device *d = (struct i2o_device *)seq->private;
1083	int token;
1084	int i;
1085
1086	typedef struct _i2o_user_table {
1087		u16 instance;
1088		u16 user_tid;
1089		u8 claim_type;
1090		u8 reserved1;
1091		u16 reserved2;
1092	} i2o_user_table;
1093
1094	struct {
1095		u16 result_count;
1096		u16 pad;
1097		u16 block_size;
1098		u8 block_status;
1099		u8 error_info_size;
1100		u16 row_count;
1101		u16 more_flag;
1102		i2o_user_table user[64];
1103	} *result;
1104
1105	result = kmalloc(sizeof(*result), GFP_KERNEL);
1106	if (!result)
1107		return -ENOMEM;
1108
1109	token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF003, -1, NULL, 0,
1110				   result, sizeof(*result));
1111
1112	if (token < 0) {
1113		i2o_report_query_status(seq, token, "0xF003 User Table");
1114		goto out;
1115	}
1116
1117	seq_printf(seq, "#  Instance UserTid ClaimType\n");
1118
1119	for (i = 0; i < result->row_count; i++) {
1120		seq_printf(seq, "%-3d", i);
1121		seq_printf(seq, "%#8x ", result->user[i].instance);
1122		seq_printf(seq, "%#7x ", result->user[i].user_tid);
1123		seq_printf(seq, "%#9x\n", result->user[i].claim_type);
1124	}
1125
1126	if (result->more_flag)
1127		seq_printf(seq, "There is more...\n");
1128      out:
1129	kfree(result);
1130	return 0;
1131}
1132
1133/* Generic group F005h - Private message extensions (table) (optional) */
1134static int i2o_seq_show_priv_msgs(struct seq_file *seq, void *v)
1135{
1136	struct i2o_device *d = (struct i2o_device *)seq->private;
1137	int token;
1138	int i;
1139
1140	typedef struct _i2o_private {
1141		u16 ext_instance;
1142		u16 organization_id;
1143		u16 x_function_code;
1144	} i2o_private;
1145
1146	struct {
1147		u16 result_count;
1148		u16 pad;
1149		u16 block_size;
1150		u8 block_status;
1151		u8 error_info_size;
1152		u16 row_count;
1153		u16 more_flag;
1154		i2o_private extension[64];
1155	} result;
1156
1157	token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF000, -1, NULL, 0,
1158				   &result, sizeof(result));
1159
1160	if (token < 0) {
1161		i2o_report_query_status(seq, token,
1162					"0xF005 Private Message Extensions (optional)");
1163		return 0;
1164	}
1165
1166	seq_printf(seq, "Instance#  OrgId  FunctionCode\n");
1167
1168	for (i = 0; i < result.row_count; i++) {
1169		seq_printf(seq, "%0#9x ", result.extension[i].ext_instance);
1170		seq_printf(seq, "%0#6x ", result.extension[i].organization_id);
1171		seq_printf(seq, "%0#6x", result.extension[i].x_function_code);
1172
1173		seq_printf(seq, "\n");
1174	}
1175
1176	if (result.more_flag)
1177		seq_printf(seq, "There is more...\n");
1178
1179	return 0;
1180}
1181
1182/* Generic group F006h - Authorized User Table (table) */
1183static int i2o_seq_show_authorized_users(struct seq_file *seq, void *v)
1184{
1185	struct i2o_device *d = (struct i2o_device *)seq->private;
1186	int token;
1187	int i;
1188
1189	struct {
1190		u16 result_count;
1191		u16 pad;
1192		u16 block_size;
1193		u8 block_status;
1194		u8 error_info_size;
1195		u16 row_count;
1196		u16 more_flag;
1197		u32 alternate_tid[64];
1198	} result;
1199
1200	token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF006, -1, NULL, 0,
1201				   &result, sizeof(result));
1202
1203	if (token < 0) {
1204		i2o_report_query_status(seq, token,
1205					"0xF006 Autohorized User Table");
1206		return 0;
1207	}
1208
1209	if (result.row_count)
1210		seq_printf(seq, "#  AlternateTid\n");
1211
1212	for (i = 0; i < result.row_count; i++) {
1213		seq_printf(seq, "%-2d", i);
1214		seq_printf(seq, "%#7x ", result.alternate_tid[i]);
1215	}
1216
1217	if (result.more_flag)
1218		seq_printf(seq, "There is more...\n");
1219
1220	return 0;
1221}
1222
1223/* Generic group F100h - Device Identity (scalar) */
1224static int i2o_seq_show_dev_identity(struct seq_file *seq, void *v)
1225{
1226	struct i2o_device *d = (struct i2o_device *)seq->private;
1227	static u32 work32[128];	// allow for "stuff" + up to 256 byte (max) serial number
1228	// == (allow) 512d bytes (max)
1229	static u16 *work16 = (u16 *) work32;
1230	int token;
1231
1232	token = i2o_parm_field_get(d, 0xF100, -1, &work32, sizeof(work32));
1233
1234	if (token < 0) {
1235		i2o_report_query_status(seq, token, "0xF100 Device Identity");
1236		return 0;
1237	}
1238
1239	seq_printf(seq, "Device Class  : %s\n", i2o_get_class_name(work16[0]));
1240	seq_printf(seq, "Owner TID     : %0#5x\n", work16[2]);
1241	seq_printf(seq, "Parent TID    : %0#5x\n", work16[3]);
1242	seq_printf(seq, "Vendor info   : %s\n",
1243		   chtostr((u8 *) (work32 + 2), 16));
1244	seq_printf(seq, "Product info  : %s\n",
1245		   chtostr((u8 *) (work32 + 6), 16));
1246	seq_printf(seq, "Description   : %s\n",
1247		   chtostr((u8 *) (work32 + 10), 16));
1248	seq_printf(seq, "Product rev.  : %s\n",
1249		   chtostr((u8 *) (work32 + 14), 8));
1250
1251	seq_printf(seq, "Serial number : ");
1252	print_serial_number(seq, (u8 *) (work32 + 16),
1253			    /* allow for SNLen plus
1254			     * possible trailing '\0'
1255			     */
1256			    sizeof(work32) - (16 * sizeof(u32)) - 2);
1257	seq_printf(seq, "\n");
1258
1259	return 0;
1260}
1261
1262static int i2o_seq_show_dev_name(struct seq_file *seq, void *v)
1263{
1264	struct i2o_device *d = (struct i2o_device *)seq->private;
1265
1266	seq_printf(seq, "%s\n", dev_name(&d->device));
1267
1268	return 0;
1269}
1270
1271/* Generic group F101h - DDM Identity (scalar) */
1272static int i2o_seq_show_ddm_identity(struct seq_file *seq, void *v)
1273{
1274	struct i2o_device *d = (struct i2o_device *)seq->private;
1275	int token;
1276
1277	struct {
1278		u16 ddm_tid;
1279		u8 module_name[24];
1280		u8 module_rev[8];
1281		u8 sn_format;
1282		u8 serial_number[12];
1283		u8 pad[256];	// allow up to 256 byte (max) serial number
1284	} result;
1285
1286	token = i2o_parm_field_get(d, 0xF101, -1, &result, sizeof(result));
1287
1288	if (token < 0) {
1289		i2o_report_query_status(seq, token, "0xF101 DDM Identity");
1290		return 0;
1291	}
1292
1293	seq_printf(seq, "Registering DDM TID : 0x%03x\n", result.ddm_tid);
1294	seq_printf(seq, "Module name         : %s\n",
1295		   chtostr(result.module_name, 24));
1296	seq_printf(seq, "Module revision     : %s\n",
1297		   chtostr(result.module_rev, 8));
1298
1299	seq_printf(seq, "Serial number       : ");
1300	print_serial_number(seq, result.serial_number, sizeof(result) - 36);
1301	/* allow for SNLen plus possible trailing '\0' */
1302
1303	seq_printf(seq, "\n");
1304
1305	return 0;
1306}
1307
1308/* Generic group F102h - User Information (scalar) */
1309static int i2o_seq_show_uinfo(struct seq_file *seq, void *v)
1310{
1311	struct i2o_device *d = (struct i2o_device *)seq->private;
1312	int token;
1313
1314	struct {
1315		u8 device_name[64];
1316		u8 service_name[64];
1317		u8 physical_location[64];
1318		u8 instance_number[4];
1319	} result;
1320
1321	token = i2o_parm_field_get(d, 0xF102, -1, &result, sizeof(result));
1322
1323	if (token < 0) {
1324		i2o_report_query_status(seq, token, "0xF102 User Information");
1325		return 0;
1326	}
1327
1328	seq_printf(seq, "Device name     : %s\n",
1329		   chtostr(result.device_name, 64));
1330	seq_printf(seq, "Service name    : %s\n",
1331		   chtostr(result.service_name, 64));
1332	seq_printf(seq, "Physical name   : %s\n",
1333		   chtostr(result.physical_location, 64));
1334	seq_printf(seq, "Instance number : %s\n",
1335		   chtostr(result.instance_number, 4));
1336
1337	return 0;
1338}
1339
1340/* Generic group F103h - SGL Operating Limits (scalar) */
1341static int i2o_seq_show_sgl_limits(struct seq_file *seq, void *v)
1342{
1343	struct i2o_device *d = (struct i2o_device *)seq->private;
1344	static u32 work32[12];
1345	static u16 *work16 = (u16 *) work32;
1346	static u8 *work8 = (u8 *) work32;
1347	int token;
1348
1349	token = i2o_parm_field_get(d, 0xF103, -1, &work32, sizeof(work32));
1350
1351	if (token < 0) {
1352		i2o_report_query_status(seq, token,
1353					"0xF103 SGL Operating Limits");
1354		return 0;
1355	}
1356
1357	seq_printf(seq, "SGL chain size        : %d\n", work32[0]);
1358	seq_printf(seq, "Max SGL chain size    : %d\n", work32[1]);
1359	seq_printf(seq, "SGL chain size target : %d\n", work32[2]);
1360	seq_printf(seq, "SGL frag count        : %d\n", work16[6]);
1361	seq_printf(seq, "Max SGL frag count    : %d\n", work16[7]);
1362	seq_printf(seq, "SGL frag count target : %d\n", work16[8]);
1363
1364	seq_printf(seq, "SGL data alignment    : %d\n", work16[8]);
1365	seq_printf(seq, "SGL addr limit        : %d\n", work8[20]);
1366	seq_printf(seq, "SGL addr sizes supported : ");
1367	if (work8[21] & 0x01)
1368		seq_printf(seq, "32 bit ");
1369	if (work8[21] & 0x02)
1370		seq_printf(seq, "64 bit ");
1371	if (work8[21] & 0x04)
1372		seq_printf(seq, "96 bit ");
1373	if (work8[21] & 0x08)
1374		seq_printf(seq, "128 bit ");
1375	seq_printf(seq, "\n");
1376/*
1377	}
1378*/
1379
1380	return 0;
1381}
1382
1383/* Generic group F200h - Sensors (scalar) */
1384static int i2o_seq_show_sensors(struct seq_file *seq, void *v)
1385{
1386	struct i2o_device *d = (struct i2o_device *)seq->private;
1387	int token;
1388
1389	struct {
1390		u16 sensor_instance;
1391		u8 component;
1392		u16 component_instance;
1393		u8 sensor_class;
1394		u8 sensor_type;
1395		u8 scaling_exponent;
1396		u32 actual_reading;
1397		u32 minimum_reading;
1398		u32 low2lowcat_treshold;
1399		u32 lowcat2low_treshold;
1400		u32 lowwarn2low_treshold;
1401		u32 low2lowwarn_treshold;
1402		u32 norm2lowwarn_treshold;
1403		u32 lowwarn2norm_treshold;
1404		u32 nominal_reading;
1405		u32 hiwarn2norm_treshold;
1406		u32 norm2hiwarn_treshold;
1407		u32 high2hiwarn_treshold;
1408		u32 hiwarn2high_treshold;
1409		u32 hicat2high_treshold;
1410		u32 hi2hicat_treshold;
1411		u32 maximum_reading;
1412		u8 sensor_state;
1413		u16 event_enable;
1414	} result;
1415
1416	token = i2o_parm_field_get(d, 0xF200, -1, &result, sizeof(result));
1417
1418	if (token < 0) {
1419		i2o_report_query_status(seq, token,
1420					"0xF200 Sensors (optional)");
1421		return 0;
1422	}
1423
1424	seq_printf(seq, "Sensor instance       : %d\n", result.sensor_instance);
1425
1426	seq_printf(seq, "Component             : %d = ", result.component);
1427	switch (result.component) {
1428	case 0:
1429		seq_printf(seq, "Other");
1430		break;
1431	case 1:
1432		seq_printf(seq, "Planar logic Board");
1433		break;
1434	case 2:
1435		seq_printf(seq, "CPU");
1436		break;
1437	case 3:
1438		seq_printf(seq, "Chassis");
1439		break;
1440	case 4:
1441		seq_printf(seq, "Power Supply");
1442		break;
1443	case 5:
1444		seq_printf(seq, "Storage");
1445		break;
1446	case 6:
1447		seq_printf(seq, "External");
1448		break;
1449	}
1450	seq_printf(seq, "\n");
1451
1452	seq_printf(seq, "Component instance    : %d\n",
1453		   result.component_instance);
1454	seq_printf(seq, "Sensor class          : %s\n",
1455		   result.sensor_class ? "Analog" : "Digital");
1456
1457	seq_printf(seq, "Sensor type           : %d = ", result.sensor_type);
1458	switch (result.sensor_type) {
1459	case 0:
1460		seq_printf(seq, "Other\n");
1461		break;
1462	case 1:
1463		seq_printf(seq, "Thermal\n");
1464		break;
1465	case 2:
1466		seq_printf(seq, "DC voltage (DC volts)\n");
1467		break;
1468	case 3:
1469		seq_printf(seq, "AC voltage (AC volts)\n");
1470		break;
1471	case 4:
1472		seq_printf(seq, "DC current (DC amps)\n");
1473		break;
1474	case 5:
1475		seq_printf(seq, "AC current (AC volts)\n");
1476		break;
1477	case 6:
1478		seq_printf(seq, "Door open\n");
1479		break;
1480	case 7:
1481		seq_printf(seq, "Fan operational\n");
1482		break;
1483	}
1484
1485	seq_printf(seq, "Scaling exponent      : %d\n",
1486		   result.scaling_exponent);
1487	seq_printf(seq, "Actual reading        : %d\n", result.actual_reading);
1488	seq_printf(seq, "Minimum reading       : %d\n", result.minimum_reading);
1489	seq_printf(seq, "Low2LowCat treshold   : %d\n",
1490		   result.low2lowcat_treshold);
1491	seq_printf(seq, "LowCat2Low treshold   : %d\n",
1492		   result.lowcat2low_treshold);
1493	seq_printf(seq, "LowWarn2Low treshold  : %d\n",
1494		   result.lowwarn2low_treshold);
1495	seq_printf(seq, "Low2LowWarn treshold  : %d\n",
1496		   result.low2lowwarn_treshold);
1497	seq_printf(seq, "Norm2LowWarn treshold : %d\n",
1498		   result.norm2lowwarn_treshold);
1499	seq_printf(seq, "LowWarn2Norm treshold : %d\n",
1500		   result.lowwarn2norm_treshold);
1501	seq_printf(seq, "Nominal reading       : %d\n", result.nominal_reading);
1502	seq_printf(seq, "HiWarn2Norm treshold  : %d\n",
1503		   result.hiwarn2norm_treshold);
1504	seq_printf(seq, "Norm2HiWarn treshold  : %d\n",
1505		   result.norm2hiwarn_treshold);
1506	seq_printf(seq, "High2HiWarn treshold  : %d\n",
1507		   result.high2hiwarn_treshold);
1508	seq_printf(seq, "HiWarn2High treshold  : %d\n",
1509		   result.hiwarn2high_treshold);
1510	seq_printf(seq, "HiCat2High treshold   : %d\n",
1511		   result.hicat2high_treshold);
1512	seq_printf(seq, "High2HiCat treshold   : %d\n",
1513		   result.hi2hicat_treshold);
1514	seq_printf(seq, "Maximum reading       : %d\n", result.maximum_reading);
1515
1516	seq_printf(seq, "Sensor state          : %d = ", result.sensor_state);
1517	switch (result.sensor_state) {
1518	case 0:
1519		seq_printf(seq, "Normal\n");
1520		break;
1521	case 1:
1522		seq_printf(seq, "Abnormal\n");
1523		break;
1524	case 2:
1525		seq_printf(seq, "Unknown\n");
1526		break;
1527	case 3:
1528		seq_printf(seq, "Low Catastrophic (LoCat)\n");
1529		break;
1530	case 4:
1531		seq_printf(seq, "Low (Low)\n");
1532		break;
1533	case 5:
1534		seq_printf(seq, "Low Warning (LoWarn)\n");
1535		break;
1536	case 6:
1537		seq_printf(seq, "High Warning (HiWarn)\n");
1538		break;
1539	case 7:
1540		seq_printf(seq, "High (High)\n");
1541		break;
1542	case 8:
1543		seq_printf(seq, "High Catastrophic (HiCat)\n");
1544		break;
1545	}
1546
1547	seq_printf(seq, "Event_enable : 0x%02X\n", result.event_enable);
1548	seq_printf(seq, "    [%s] Operational state change. \n",
1549		   (result.event_enable & 0x01) ? "+" : "-");
1550	seq_printf(seq, "    [%s] Low catastrophic. \n",
1551		   (result.event_enable & 0x02) ? "+" : "-");
1552	seq_printf(seq, "    [%s] Low reading. \n",
1553		   (result.event_enable & 0x04) ? "+" : "-");
1554	seq_printf(seq, "    [%s] Low warning. \n",
1555		   (result.event_enable & 0x08) ? "+" : "-");
1556	seq_printf(seq,
1557		   "    [%s] Change back to normal from out of range state. \n",
1558		   (result.event_enable & 0x10) ? "+" : "-");
1559	seq_printf(seq, "    [%s] High warning. \n",
1560		   (result.event_enable & 0x20) ? "+" : "-");
1561	seq_printf(seq, "    [%s] High reading. \n",
1562		   (result.event_enable & 0x40) ? "+" : "-");
1563	seq_printf(seq, "    [%s] High catastrophic. \n",
1564		   (result.event_enable & 0x80) ? "+" : "-");
1565
1566	return 0;
1567}
1568
1569static int i2o_seq_open_hrt(struct inode *inode, struct file *file)
1570{
1571	return single_open(file, i2o_seq_show_hrt, PDE(inode)->data);
1572};
1573
1574static int i2o_seq_open_lct(struct inode *inode, struct file *file)
1575{
1576	return single_open(file, i2o_seq_show_lct, PDE(inode)->data);
1577};
1578
1579static int i2o_seq_open_status(struct inode *inode, struct file *file)
1580{
1581	return single_open(file, i2o_seq_show_status, PDE(inode)->data);
1582};
1583
1584static int i2o_seq_open_hw(struct inode *inode, struct file *file)
1585{
1586	return single_open(file, i2o_seq_show_hw, PDE(inode)->data);
1587};
1588
1589static int i2o_seq_open_ddm_table(struct inode *inode, struct file *file)
1590{
1591	return single_open(file, i2o_seq_show_ddm_table, PDE(inode)->data);
1592};
1593
1594static int i2o_seq_open_driver_store(struct inode *inode, struct file *file)
1595{
1596	return single_open(file, i2o_seq_show_driver_store, PDE(inode)->data);
1597};
1598
1599static int i2o_seq_open_drivers_stored(struct inode *inode, struct file *file)
1600{
1601	return single_open(file, i2o_seq_show_drivers_stored, PDE(inode)->data);
1602};
1603
1604static int i2o_seq_open_groups(struct inode *inode, struct file *file)
1605{
1606	return single_open(file, i2o_seq_show_groups, PDE(inode)->data);
1607};
1608
1609static int i2o_seq_open_phys_device(struct inode *inode, struct file *file)
1610{
1611	return single_open(file, i2o_seq_show_phys_device, PDE(inode)->data);
1612};
1613
1614static int i2o_seq_open_claimed(struct inode *inode, struct file *file)
1615{
1616	return single_open(file, i2o_seq_show_claimed, PDE(inode)->data);
1617};
1618
1619static int i2o_seq_open_users(struct inode *inode, struct file *file)
1620{
1621	return single_open(file, i2o_seq_show_users, PDE(inode)->data);
1622};
1623
1624static int i2o_seq_open_priv_msgs(struct inode *inode, struct file *file)
1625{
1626	return single_open(file, i2o_seq_show_priv_msgs, PDE(inode)->data);
1627};
1628
1629static int i2o_seq_open_authorized_users(struct inode *inode, struct file *file)
1630{
1631	return single_open(file, i2o_seq_show_authorized_users,
1632			   PDE(inode)->data);
1633};
1634
1635static int i2o_seq_open_dev_identity(struct inode *inode, struct file *file)
1636{
1637	return single_open(file, i2o_seq_show_dev_identity, PDE(inode)->data);
1638};
1639
1640static int i2o_seq_open_ddm_identity(struct inode *inode, struct file *file)
1641{
1642	return single_open(file, i2o_seq_show_ddm_identity, PDE(inode)->data);
1643};
1644
1645static int i2o_seq_open_uinfo(struct inode *inode, struct file *file)
1646{
1647	return single_open(file, i2o_seq_show_uinfo, PDE(inode)->data);
1648};
1649
1650static int i2o_seq_open_sgl_limits(struct inode *inode, struct file *file)
1651{
1652	return single_open(file, i2o_seq_show_sgl_limits, PDE(inode)->data);
1653};
1654
1655static int i2o_seq_open_sensors(struct inode *inode, struct file *file)
1656{
1657	return single_open(file, i2o_seq_show_sensors, PDE(inode)->data);
1658};
1659
1660static int i2o_seq_open_dev_name(struct inode *inode, struct file *file)
1661{
1662	return single_open(file, i2o_seq_show_dev_name, PDE(inode)->data);
1663};
1664
1665static const struct file_operations i2o_seq_fops_lct = {
1666	.open = i2o_seq_open_lct,
1667	.read = seq_read,
1668	.llseek = seq_lseek,
1669	.release = single_release,
1670};
1671
1672static const struct file_operations i2o_seq_fops_hrt = {
1673	.open = i2o_seq_open_hrt,
1674	.read = seq_read,
1675	.llseek = seq_lseek,
1676	.release = single_release,
1677};
1678
1679static const struct file_operations i2o_seq_fops_status = {
1680	.open = i2o_seq_open_status,
1681	.read = seq_read,
1682	.llseek = seq_lseek,
1683	.release = single_release,
1684};
1685
1686static const struct file_operations i2o_seq_fops_hw = {
1687	.open = i2o_seq_open_hw,
1688	.read = seq_read,
1689	.llseek = seq_lseek,
1690	.release = single_release,
1691};
1692
1693static const struct file_operations i2o_seq_fops_ddm_table = {
1694	.open = i2o_seq_open_ddm_table,
1695	.read = seq_read,
1696	.llseek = seq_lseek,
1697	.release = single_release,
1698};
1699
1700static const struct file_operations i2o_seq_fops_driver_store = {
1701	.open = i2o_seq_open_driver_store,
1702	.read = seq_read,
1703	.llseek = seq_lseek,
1704	.release = single_release,
1705};
1706
1707static const struct file_operations i2o_seq_fops_drivers_stored = {
1708	.open = i2o_seq_open_drivers_stored,
1709	.read = seq_read,
1710	.llseek = seq_lseek,
1711	.release = single_release,
1712};
1713
1714static const struct file_operations i2o_seq_fops_groups = {
1715	.open = i2o_seq_open_groups,
1716	.read = seq_read,
1717	.llseek = seq_lseek,
1718	.release = single_release,
1719};
1720
1721static const struct file_operations i2o_seq_fops_phys_device = {
1722	.open = i2o_seq_open_phys_device,
1723	.read = seq_read,
1724	.llseek = seq_lseek,
1725	.release = single_release,
1726};
1727
1728static const struct file_operations i2o_seq_fops_claimed = {
1729	.open = i2o_seq_open_claimed,
1730	.read = seq_read,
1731	.llseek = seq_lseek,
1732	.release = single_release,
1733};
1734
1735static const struct file_operations i2o_seq_fops_users = {
1736	.open = i2o_seq_open_users,
1737	.read = seq_read,
1738	.llseek = seq_lseek,
1739	.release = single_release,
1740};
1741
1742static const struct file_operations i2o_seq_fops_priv_msgs = {
1743	.open = i2o_seq_open_priv_msgs,
1744	.read = seq_read,
1745	.llseek = seq_lseek,
1746	.release = single_release,
1747};
1748
1749static const struct file_operations i2o_seq_fops_authorized_users = {
1750	.open = i2o_seq_open_authorized_users,
1751	.read = seq_read,
1752	.llseek = seq_lseek,
1753	.release = single_release,
1754};
1755
1756static const struct file_operations i2o_seq_fops_dev_name = {
1757	.open = i2o_seq_open_dev_name,
1758	.read = seq_read,
1759	.llseek = seq_lseek,
1760	.release = single_release,
1761};
1762
1763static const struct file_operations i2o_seq_fops_dev_identity = {
1764	.open = i2o_seq_open_dev_identity,
1765	.read = seq_read,
1766	.llseek = seq_lseek,
1767	.release = single_release,
1768};
1769
1770static const struct file_operations i2o_seq_fops_ddm_identity = {
1771	.open = i2o_seq_open_ddm_identity,
1772	.read = seq_read,
1773	.llseek = seq_lseek,
1774	.release = single_release,
1775};
1776
1777static const struct file_operations i2o_seq_fops_uinfo = {
1778	.open = i2o_seq_open_uinfo,
1779	.read = seq_read,
1780	.llseek = seq_lseek,
1781	.release = single_release,
1782};
1783
1784static const struct file_operations i2o_seq_fops_sgl_limits = {
1785	.open = i2o_seq_open_sgl_limits,
1786	.read = seq_read,
1787	.llseek = seq_lseek,
1788	.release = single_release,
1789};
1790
1791static const struct file_operations i2o_seq_fops_sensors = {
1792	.open = i2o_seq_open_sensors,
1793	.read = seq_read,
1794	.llseek = seq_lseek,
1795	.release = single_release,
1796};
1797
1798/*
1799 * IOP specific entries...write field just in case someone
1800 * ever wants one.
1801 */
1802static i2o_proc_entry i2o_proc_generic_iop_entries[] = {
1803	{"hrt", S_IFREG | S_IRUGO, &i2o_seq_fops_hrt},
1804	{"lct", S_IFREG | S_IRUGO, &i2o_seq_fops_lct},
1805	{"status", S_IFREG | S_IRUGO, &i2o_seq_fops_status},
1806	{"hw", S_IFREG | S_IRUGO, &i2o_seq_fops_hw},
1807	{"ddm_table", S_IFREG | S_IRUGO, &i2o_seq_fops_ddm_table},
1808	{"driver_store", S_IFREG | S_IRUGO, &i2o_seq_fops_driver_store},
1809	{"drivers_stored", S_IFREG | S_IRUGO, &i2o_seq_fops_drivers_stored},
1810	{NULL, 0, NULL}
1811};
1812
1813/*
1814 * Device specific entries
1815 */
1816static i2o_proc_entry generic_dev_entries[] = {
1817	{"groups", S_IFREG | S_IRUGO, &i2o_seq_fops_groups},
1818	{"phys_dev", S_IFREG | S_IRUGO, &i2o_seq_fops_phys_device},
1819	{"claimed", S_IFREG | S_IRUGO, &i2o_seq_fops_claimed},
1820	{"users", S_IFREG | S_IRUGO, &i2o_seq_fops_users},
1821	{"priv_msgs", S_IFREG | S_IRUGO, &i2o_seq_fops_priv_msgs},
1822	{"authorized_users", S_IFREG | S_IRUGO, &i2o_seq_fops_authorized_users},
1823	{"dev_identity", S_IFREG | S_IRUGO, &i2o_seq_fops_dev_identity},
1824	{"ddm_identity", S_IFREG | S_IRUGO, &i2o_seq_fops_ddm_identity},
1825	{"user_info", S_IFREG | S_IRUGO, &i2o_seq_fops_uinfo},
1826	{"sgl_limits", S_IFREG | S_IRUGO, &i2o_seq_fops_sgl_limits},
1827	{"sensors", S_IFREG | S_IRUGO, &i2o_seq_fops_sensors},
1828	{NULL, 0, NULL}
1829};
1830
1831/*
1832 *  Storage unit specific entries (SCSI Periph, BS) with device names
1833 */
1834static i2o_proc_entry rbs_dev_entries[] = {
1835	{"dev_name", S_IFREG | S_IRUGO, &i2o_seq_fops_dev_name},
1836	{NULL, 0, NULL}
1837};
1838
1839/**
1840 *	i2o_proc_create_entries - Creates proc dir entries
1841 *	@dir: proc dir entry under which the entries should be placed
1842 *	@i2o_pe: pointer to the entries which should be added
1843 *	@data: pointer to I2O controller or device
1844 *
1845 *	Create proc dir entries for a I2O controller or I2O device.
1846 *
1847 *	Returns 0 on success or negative error code on failure.
1848 */
1849static int i2o_proc_create_entries(struct proc_dir_entry *dir,
1850				   i2o_proc_entry * i2o_pe, void *data)
1851{
1852	struct proc_dir_entry *tmp;
1853
1854	while (i2o_pe->name) {
1855		tmp = proc_create_data(i2o_pe->name, i2o_pe->mode, dir,
1856				       i2o_pe->fops, data);
1857		if (!tmp)
1858			return -1;
1859
1860		i2o_pe++;
1861	}
1862
1863	return 0;
1864}
1865
1866/**
1867 *	i2o_proc_subdir_remove - Remove child entries from a proc entry
1868 *	@dir: proc dir entry from which the childs should be removed
1869 *
1870 *	Iterate over each i2o proc entry under dir and remove it. If the child
1871 *	also has entries, remove them too.
1872 */
1873static void i2o_proc_subdir_remove(struct proc_dir_entry *dir)
1874{
1875	struct proc_dir_entry *pe, *tmp;
1876	pe = dir->subdir;
1877	while (pe) {
1878		tmp = pe->next;
1879		i2o_proc_subdir_remove(pe);
1880		remove_proc_entry(pe->name, dir);
1881		pe = tmp;
1882	}
1883};
1884
1885/**
1886 *	i2o_proc_device_add - Add an I2O device to the proc dir
1887 *	@dir: proc dir entry to which the device should be added
1888 *	@dev: I2O device which should be added
1889 *
1890 *	Add an I2O device to the proc dir entry dir and create the entries for
1891 *	the device depending on the class of the I2O device.
1892 */
1893static void i2o_proc_device_add(struct proc_dir_entry *dir,
1894				struct i2o_device *dev)
1895{
1896	char buff[10];
1897	struct proc_dir_entry *devdir;
1898	i2o_proc_entry *i2o_pe = NULL;
1899
1900	sprintf(buff, "%03x", dev->lct_data.tid);
1901
1902	osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
1903
1904	devdir = proc_mkdir(buff, dir);
1905	if (!devdir) {
1906		osm_warn("Could not allocate procdir!\n");
1907		return;
1908	}
1909
1910	devdir->data = dev;
1911
1912	i2o_proc_create_entries(devdir, generic_dev_entries, dev);
1913
1914	/* Inform core that we want updates about this device's status */
1915	switch (dev->lct_data.class_id) {
1916	case I2O_CLASS_SCSI_PERIPHERAL:
1917	case I2O_CLASS_RANDOM_BLOCK_STORAGE:
1918		i2o_pe = rbs_dev_entries;
1919		break;
1920	default:
1921		break;
1922	}
1923	if (i2o_pe)
1924		i2o_proc_create_entries(devdir, i2o_pe, dev);
1925}
1926
1927/**
1928 *	i2o_proc_iop_add - Add an I2O controller to the i2o proc tree
1929 *	@dir: parent proc dir entry
1930 *	@c: I2O controller which should be added
1931 *
1932 *	Add the entries to the parent proc dir entry. Also each device is added
1933 *	to the controllers proc dir entry.
1934 *
1935 *	Returns 0 on success or negative error code on failure.
1936 */
1937static int i2o_proc_iop_add(struct proc_dir_entry *dir,
1938			    struct i2o_controller *c)
1939{
1940	struct proc_dir_entry *iopdir;
1941	struct i2o_device *dev;
1942
1943	osm_debug("adding IOP /proc/i2o/%s\n", c->name);
1944
1945	iopdir = proc_mkdir(c->name, dir);
1946	if (!iopdir)
1947		return -1;
1948
1949	iopdir->data = c;
1950
1951	i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c);
1952
1953	list_for_each_entry(dev, &c->devices, list)
1954	    i2o_proc_device_add(iopdir, dev);
1955
1956	return 0;
1957}
1958
1959/**
1960 *	i2o_proc_iop_remove - Removes an I2O controller from the i2o proc tree
1961 *	@dir: parent proc dir entry
1962 *	@c: I2O controller which should be removed
1963 *
1964 *	Iterate over each i2o proc entry and search controller c. If it is found
1965 *	remove it from the tree.
1966 */
1967static void i2o_proc_iop_remove(struct proc_dir_entry *dir,
1968				struct i2o_controller *c)
1969{
1970	struct proc_dir_entry *pe, *tmp;
1971
1972	pe = dir->subdir;
1973	while (pe) {
1974		tmp = pe->next;
1975		if (pe->data == c) {
1976			i2o_proc_subdir_remove(pe);
1977			remove_proc_entry(pe->name, dir);
1978		}
1979		osm_debug("removing IOP /proc/i2o/%s\n", c->name);
1980		pe = tmp;
1981	}
1982}
1983
1984/**
1985 *	i2o_proc_fs_create - Create the i2o proc fs.
1986 *
1987 *	Iterate over each I2O controller and create the entries for it.
1988 *
1989 *	Returns 0 on success or negative error code on failure.
1990 */
1991static int __init i2o_proc_fs_create(void)
1992{
1993	struct i2o_controller *c;
1994
1995	i2o_proc_dir_root = proc_mkdir("i2o", NULL);
1996	if (!i2o_proc_dir_root)
1997		return -1;
1998
1999	list_for_each_entry(c, &i2o_controllers, list)
2000	    i2o_proc_iop_add(i2o_proc_dir_root, c);
2001
2002	return 0;
2003};
2004
2005/**
2006 *	i2o_proc_fs_destroy - Cleanup the all i2o proc entries
2007 *
2008 *	Iterate over each I2O controller and remove the entries for it.
2009 *
2010 *	Returns 0 on success or negative error code on failure.
2011 */
2012static int __exit i2o_proc_fs_destroy(void)
2013{
2014	struct i2o_controller *c;
2015
2016	list_for_each_entry(c, &i2o_controllers, list)
2017	    i2o_proc_iop_remove(i2o_proc_dir_root, c);
2018
2019	remove_proc_entry("i2o", NULL);
2020
2021	return 0;
2022};
2023
2024/**
2025 *	i2o_proc_init - Init function for procfs
2026 *
2027 *	Registers Proc OSM and creates procfs entries.
2028 *
2029 *	Returns 0 on success or negative error code on failure.
2030 */
2031static int __init i2o_proc_init(void)
2032{
2033	int rc;
2034
2035	printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
2036
2037	rc = i2o_driver_register(&i2o_proc_driver);
2038	if (rc)
2039		return rc;
2040
2041	rc = i2o_proc_fs_create();
2042	if (rc) {
2043		i2o_driver_unregister(&i2o_proc_driver);
2044		return rc;
2045	}
2046
2047	return 0;
2048};
2049
2050/**
2051 *	i2o_proc_exit - Exit function for procfs
2052 *
2053 *	Unregisters Proc OSM and removes procfs entries.
2054 */
2055static void __exit i2o_proc_exit(void)
2056{
2057	i2o_driver_unregister(&i2o_proc_driver);
2058	i2o_proc_fs_destroy();
2059};
2060
2061MODULE_AUTHOR("Deepak Saxena");
2062MODULE_LICENSE("GPL");
2063MODULE_DESCRIPTION(OSM_DESCRIPTION);
2064MODULE_VERSION(OSM_VERSION);
2065
2066module_init(i2o_proc_init);
2067module_exit(i2o_proc_exit);
2068