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