patch-2.3.27 linux/drivers/i2o/i2o_proc.c
Next file: linux/drivers/i2o/i2o_proc.h
Previous file: linux/drivers/i2o/i2o_pci.c
Back to the patch index
Back to the overall index
- Lines: 2763
- Date:
Wed Nov 10 09:52:18 1999
- Orig file:
v2.3.26/linux/drivers/i2o/i2o_proc.c
- Orig date:
Wed Oct 27 16:34:12 1999
diff -u --recursive --new-file v2.3.26/linux/drivers/i2o/i2o_proc.c linux/drivers/i2o/i2o_proc.c
@@ -51,9 +51,6 @@
#include <asm/uaccess.h>
#include <asm/byteorder.h>
-
-#include "i2o_proc.h"
-
#include "i2o_lan.h"
/*
@@ -69,24 +66,34 @@
static int proc_context = 0;
-
static int i2o_proc_read_lct(char *, char **, off_t, int, int *, void *);
static int i2o_proc_read_hrt(char *, char **, off_t, int, int *, void *);
-static int i2o_proc_read_stat(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_status(char *, char **, off_t, int, int *, void *);
+
static int i2o_proc_read_hw(char *, char **, off_t, int, int *, void *);
-static int i2o_proc_read_dst(char *, char **, off_t, int, int *, void *);
static int i2o_proc_read_ddm_table(char *, char **, off_t, int, int *, void *);
-static int i2o_proc_read_ds(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_driver_store(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_drivers_stored(char *, char **, off_t, int, int *, void *);
+
static int i2o_proc_read_groups(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_phys_device(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_claimed(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_users(char *, char **, off_t, int, int *, void *);
static int i2o_proc_read_priv_msgs(char *, char **, off_t, int, int *, void *);
-static int i2o_proc_read_dev(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_authorized_users(char *, char **, off_t, int, int *, void *);
+
static int i2o_proc_read_dev_name(char *, char **, off_t, int, int *, void *);
-static int i2o_proc_read_ddm(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_dev_identity(char *, char **, off_t, int, int *, void *);
+static int i2o_proc_read_ddm_identity(char *, char **, off_t, int, int *, void *);
static int i2o_proc_read_uinfo(char *, char **, off_t, int, int *, void *);
static int i2o_proc_read_sgl_limits(char *, char **, off_t, int, int *, void *);
+
+static int i2o_proc_read_sensors(char *, char **, off_t, int, int *, void *);
+
static int print_serial_number(char *, int, u8 *, int);
-static int i2o_proc_create_entries(void *,
- i2o_proc_entry *, struct proc_dir_entry *);
+
+static int i2o_proc_create_entries(void *, i2o_proc_entry *,
+ struct proc_dir_entry *);
static void i2o_proc_remove_entries(i2o_proc_entry *, struct proc_dir_entry *);
static int i2o_proc_add_controller(struct i2o_controller *,
struct proc_dir_entry * );
@@ -117,18 +124,8 @@
void *);
static int i2o_proc_read_lan_hist_stats(char *, char **, off_t, int, int *,
void *);
-static int i2o_proc_read_lan_supp_opt_stats(char *, char **, off_t, int, int *,
- void *);
-static int i2o_proc_read_lan_opt_tx_hist_stats(char *, char **, off_t, int,
- int *, void *);
-static int i2o_proc_read_lan_opt_rx_hist_stats(char *, char **, off_t, int,
- int *, void *);
static int i2o_proc_read_lan_eth_stats(char *, char **, off_t, int,
int *, void *);
-static int i2o_proc_read_lan_supp_eth_stats(char *, char **, off_t, int, int *,
- void *);
-static int i2o_proc_read_lan_opt_eth_stats(char *, char **, off_t, int, int *,
- void *);
static int i2o_proc_read_lan_tr_stats(char *, char **, off_t, int, int *,
void *);
static int i2o_proc_read_lan_fddi_stats(char *, char **, off_t, int, int *,
@@ -155,11 +152,11 @@
{
{"hrt", S_IFREG|S_IRUGO, i2o_proc_read_hrt, NULL},
{"lct", S_IFREG|S_IRUGO, i2o_proc_read_lct, NULL},
- {"stat", S_IFREG|S_IRUGO, i2o_proc_read_stat, NULL},
+ {"status", S_IFREG|S_IRUGO, i2o_proc_read_status, NULL},
{"hw", S_IFREG|S_IRUGO, i2o_proc_read_hw, NULL},
- {"dst", S_IFREG|S_IRUGO, i2o_proc_read_dst, NULL},
{"ddm_table", S_IFREG|S_IRUGO, i2o_proc_read_ddm_table, NULL},
- {"ds", S_IFREG|S_IRUGO, i2o_proc_read_ds, NULL},
+ {"driver_store", S_IFREG|S_IRUGO, i2o_proc_read_driver_store, NULL},
+ {"drivers_stored", S_IFREG|S_IRUGO, i2o_proc_read_drivers_stored, NULL},
{NULL, 0, NULL, NULL}
};
@@ -169,11 +166,16 @@
static i2o_proc_entry generic_dev_entries[] =
{
{"groups", S_IFREG|S_IRUGO, i2o_proc_read_groups, NULL},
+ {"phys_dev", S_IFREG|S_IRUGO, i2o_proc_read_phys_device, NULL},
+ {"claimed", S_IFREG|S_IRUGO, i2o_proc_read_claimed, NULL},
+ {"users", S_IFREG|S_IRUGO, i2o_proc_read_users, NULL},
{"priv_msgs", S_IFREG|S_IRUGO, i2o_proc_read_priv_msgs, NULL},
- {"dev_identity", S_IFREG|S_IRUGO, i2o_proc_read_dev, NULL},
- {"ddm_identity", S_IFREG|S_IRUGO, i2o_proc_read_ddm, NULL},
- {"sgl_limits", S_IFREG|S_IRUGO, i2o_proc_read_sgl_limits, NULL},
+ {"authorized_users", S_IFREG|S_IRUGO, i2o_proc_read_authorized_users, NULL},
+ {"dev_identity", S_IFREG|S_IRUGO, i2o_proc_read_dev_identity, NULL},
+ {"ddm_identity", S_IFREG|S_IRUGO, i2o_proc_read_ddm_identity, NULL},
{"user_info", S_IFREG|S_IRUGO, i2o_proc_read_uinfo, NULL},
+ {"sgl_limits", S_IFREG|S_IRUGO, i2o_proc_read_sgl_limits, NULL},
+ {"sensors", S_IFREG|S_IRUGO, i2o_proc_read_sensors, NULL},
{NULL, 0, NULL, NULL}
};
@@ -187,22 +189,22 @@
};
#define SCSI_TABLE_SIZE 13
- static char *scsi_devices[] =
- {
- "Direct-Access Read/Write",
- "Sequential-Access Storage",
- "Printer",
- "Processor",
- "WORM Device",
- "CD-ROM Device",
- "Scanner Device",
- "Optical Memory Device",
- "Medium Changer Device",
- "Communications Device",
- "Graphics Art Pre-Press Device",
- "Graphics Art Pre-Press Device",
- "Array Controller Device"
- };
+static char *scsi_devices[] =
+{
+ "Direct-Access Read/Write",
+ "Sequential-Access Storage",
+ "Printer",
+ "Processor",
+ "WORM Device",
+ "CD-ROM Device",
+ "Scanner Device",
+ "Optical Memory Device",
+ "Medium Changer Device",
+ "Communications Device",
+ "Graphics Art Pre-Press Device",
+ "Graphics Art Pre-Press Device",
+ "Array Controller Device"
+};
/* private */
@@ -214,7 +216,6 @@
*/
static i2o_proc_entry lan_entries[] =
{
- /* LAN param groups 0000h-0008h */
{"lan_dev_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_dev_info, NULL},
{"lan_mac_addr", S_IFREG|S_IRUGO, i2o_proc_read_lan_mac_addr, NULL},
{"lan_mcast_addr", S_IFREG|S_IRUGO|S_IWUSR,
@@ -227,56 +228,30 @@
{"lan_alt_addr", S_IFREG|S_IRUGO, i2o_proc_read_lan_alt_addr, NULL},
{"lan_tx_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_tx_info, NULL},
{"lan_rx_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_rx_info, NULL},
- /* LAN param groups 0100h, 0180h, 0182h, 0183h */
- {"lan_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_hist_stats, NULL},
- {"lan_supp_opt_stats", S_IFREG|S_IRUGO,
- i2o_proc_read_lan_supp_opt_stats, NULL},
- {"lan_opt_tx_stats", S_IFREG|S_IRUGO,
- i2o_proc_read_lan_opt_tx_hist_stats, NULL},
- {"lan_opt_rx_stats", S_IFREG|S_IRUGO,
- i2o_proc_read_lan_opt_rx_hist_stats, NULL},
- /* TODO: LAN param group 0184h */
+
+ {"lan_hist_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_hist_stats, NULL},
{NULL, 0, NULL, NULL}
};
/*
- * Ethernet specific LAN entries
+ * Port specific LAN entries
*
*/
static i2o_proc_entry lan_eth_entries[] =
{
- /* LAN param groups 0200h, 0280h, 0281h */
- {"lan_eth_stat", S_IFREG|S_IRUGO, i2o_proc_read_lan_eth_stats, NULL},
- {"lan_supp_eth_stats", S_IFREG|S_IRUGO,
- i2o_proc_read_lan_supp_eth_stats, NULL},
- {"lan_opt_eth_stats", S_IFREG|S_IRUGO,
- i2o_proc_read_lan_opt_eth_stats, NULL},
+ {"lan_eth_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_eth_stats, NULL},
{NULL, 0, NULL, NULL}
};
-/*
- * Token Ring specific LAN entries
- *
- */
static i2o_proc_entry lan_tr_entries[] =
{
- /* LAN param group 0300h */
- {"lan_tr_stats", S_IFREG|S_IRUGO,
- i2o_proc_read_lan_tr_stats, NULL},
- /* TODO: LAN param group 0380h, 0381h */
+ {"lan_tr_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_tr_stats, NULL},
{NULL, 0, NULL, NULL}
};
-/*
- * FDDI specific LAN entries
- *
- */
static i2o_proc_entry lan_fddi_entries[] =
{
- /* LAN param group 0400h */
- {"lan_fddi_stats", S_IFREG|S_IRUGO,
- i2o_proc_read_lan_fddi_stats, NULL},
- /* TODO: LAN param group 0480h, 0481h */
+ {"lan_fddi_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_fddi_stats, NULL},
{NULL, 0, NULL, NULL}
};
@@ -290,6 +265,22 @@
return strncat(tmp, (char *)chars, n);
}
+static int i2o_report_query_status(char *buf, int block_status, char *group)
+{
+ switch (block_status)
+ {
+ case -ETIMEDOUT:
+ return sprintf(buf, "Timeout reading group %s.\n",group);
+ case -ENOMEM:
+ return sprintf(buf, "No free memory to read the table.\n");
+ case -I2O_PARAMS_STATUS_INVALID_GROUP_ID:
+ return sprintf(buf, "Group %s not supported.\n", group);
+ default:
+ return sprintf(buf, "Error reading group %s. BlockStatus 0x%02X\n",
+ group, -block_status);
+ }
+}
+
static char* bus_strings[] =
{
"Local Bus",
@@ -314,7 +305,7 @@
int *eof, void *data)
{
struct i2o_controller *c = (struct i2o_controller *)data;
- pi2o_hrt hrt = (pi2o_hrt)c->hrt;
+ i2o_hrt *hrt = (i2o_hrt *)c->hrt;
u32 bus;
int count;
int i;
@@ -342,17 +333,15 @@
}
len += sprintf(buf+len, "HRT has %d entries of %d bytes each.\n",
- count, hrt->entry_len);
+ count, hrt->entry_len << 2);
for(i = 0; i < count; i++)
{
len += sprintf(buf+len, "Entry %d:\n", i);
len += sprintf(buf+len, " Adapter ID: %0#10x\n",
hrt->hrt_entry[i].adapter_id);
- len += sprintf(buf+len, " Controlled by: %0#6x\n",
+ len += sprintf(buf+len, " Controlling tid: %0#6x\n",
hrt->hrt_entry[i].parent_tid);
- len += sprintf(buf+len, " Bus#%d\n",
- hrt->hrt_entry[i].bus_num);
if(hrt->hrt_entry[i].bus_type != 0x80)
{
@@ -425,20 +414,19 @@
int *eof, void *data)
{
struct i2o_controller *c = (struct i2o_controller*)data;
- pi2o_lct lct = (pi2o_lct)c->lct;
+ i2o_lct *lct = (i2o_lct *)c->lct;
int entries;
int i;
#define BUS_TABLE_SIZE 3
static char *bus_ports[] =
- {
- "Generic Bus",
- "SCSI Bus",
- "Fibre Channel Bus"
- };
+ {
+ "Generic Bus",
+ "SCSI Bus",
+ "Fibre Channel Bus"
+ };
spin_lock(&i2o_proc_lock);
-
len = 0;
entries = (lct->table_size - 3)/9;
@@ -451,8 +439,7 @@
for(i = 0; i < entries; i++)
{
len += sprintf(buf+len, "Entry %d\n", i);
-
- len += sprintf(buf+len, " %s", i2o_get_class_name(lct->lct_entry[i].class_id));
+ len += sprintf(buf+len, " Class, SubClass : %s", i2o_get_class_name(lct->lct_entry[i].class_id));
/*
* Classes which we'll print subclass info for
@@ -463,23 +450,23 @@
switch(lct->lct_entry[i].sub_class)
{
case 0x00:
- len += sprintf(buf+len, ": Direct-Access Read/Write");
+ len += sprintf(buf+len, ", Direct-Access Read/Write");
break;
case 0x04:
- len += sprintf(buf+len, ": WORM Drive");
+ len += sprintf(buf+len, ", WORM Drive");
break;
case 0x05:
- len += sprintf(buf+len, ": CD-ROM Drive");
+ len += sprintf(buf+len, ", CD-ROM Drive");
break;
case 0x07:
- len += sprintf(buf+len, ": Optical Memory Device");
+ len += sprintf(buf+len, ", Optical Memory Device");
break;
default:
- len += sprintf(buf+len, ": Unknown (0x%02x)",
+ len += sprintf(buf+len, ", Unknown (0x%02x)",
lct->lct_entry[i].sub_class);
break;
}
@@ -489,27 +476,27 @@
switch(lct->lct_entry[i].sub_class & 0xFF)
{
case 0x30:
- len += sprintf(buf+len, ": Ethernet");
+ len += sprintf(buf+len, ", Ethernet");
break;
case 0x40:
- len += sprintf(buf+len, ": 100base VG");
+ len += sprintf(buf+len, ", 100base VG");
break;
case 0x50:
- len += sprintf(buf+len, ": IEEE 802.5/Token-Ring");
+ len += sprintf(buf+len, ", IEEE 802.5/Token-Ring");
break;
case 0x60:
- len += sprintf(buf+len, ": ANSI X3T9.5 FDDI");
+ len += sprintf(buf+len, ", ANSI X3T9.5 FDDI");
break;
case 0x70:
- len += sprintf(buf+len, ": Fibre Channel");
+ len += sprintf(buf+len, ", Fibre Channel");
break;
default:
- len += sprintf(buf+len, ": Unknown Sub-Class (0x%02x)",
+ len += sprintf(buf+len, ", Unknown Sub-Class (0x%02x)",
lct->lct_entry[i].sub_class & 0xFF);
break;
}
@@ -517,27 +504,27 @@
case I2O_CLASS_SCSI_PERIPHERAL:
if(lct->lct_entry[i].sub_class < SCSI_TABLE_SIZE)
- len += sprintf(buf+len, ": %s",
+ len += sprintf(buf+len, ", %s",
scsi_devices[lct->lct_entry[i].sub_class]);
else
- len += sprintf(buf+len, ": Unknown Device Type");
+ len += sprintf(buf+len, ", Unknown Device Type");
break;
case I2O_CLASS_BUS_ADAPTER_PORT:
if(lct->lct_entry[i].sub_class < BUS_TABLE_SIZE)
- len += sprintf(buf+len, ": %s",
+ len += sprintf(buf+len, ", %s",
bus_ports[lct->lct_entry[i].sub_class]);
else
- len += sprintf(buf+len, ": Unknown Bus Type");
+ len += sprintf(buf+len, ", Unknown Bus Type");
break;
}
len += sprintf(buf+len, "\n");
- len += sprintf(buf+len, " Local TID: 0x%03x\n", lct->lct_entry[i].tid);
- len += sprintf(buf+len, " User TID: 0x%03x\n", lct->lct_entry[i].user_tid);
- len += sprintf(buf+len, " Parent TID: 0x%03x\n",
+ len += sprintf(buf+len, " Local TID : 0x%03x\n", lct->lct_entry[i].tid);
+ len += sprintf(buf+len, " User TID : 0x%03x\n", lct->lct_entry[i].user_tid);
+ len += sprintf(buf+len, " Parent TID : 0x%03x\n",
lct->lct_entry[i].parent_tid);
- len += sprintf(buf+len, " Identity Tag: 0x%x%x%x%x%x%x%x%x\n",
+ len += sprintf(buf+len, " Identity Tag : 0x%x%x%x%x%x%x%x%x\n",
lct->lct_entry[i].identity_tag[0],
lct->lct_entry[i].identity_tag[1],
lct->lct_entry[i].identity_tag[2],
@@ -546,219 +533,211 @@
lct->lct_entry[i].identity_tag[5],
lct->lct_entry[i].identity_tag[6],
lct->lct_entry[i].identity_tag[7]);
- len += sprintf(buf+len, " Change Indicator: %0#10x\n",
+ len += sprintf(buf+len, " Change Indicator : %0#10x\n",
lct->lct_entry[i].change_ind);
- len += sprintf(buf+len, " Device Flags: %0#10x\n",
+ len += sprintf(buf+len, " Event Capab Mask : %0#10x\n",
lct->lct_entry[i].device_flags);
}
spin_unlock(&i2o_proc_lock);
-
return len;
}
-int i2o_proc_read_stat(char *buf, char **start, off_t offset, int len,
- int *eof, void *data)
+int i2o_proc_read_status(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
{
struct i2o_controller *c = (struct i2o_controller*)data;
- u32 *msg;
- u32 m;
- u8 *workspace;
- u16 *work16;
- u32 *work32;
- long time;
char prodstr[25];
int version;
spin_lock(&i2o_proc_lock);
-
len = 0;
- workspace = (u8*)kmalloc(88, GFP_KERNEL);
- if(!workspace)
- {
- len += sprintf(buf, "No memory for status transfer\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- m = I2O_POST_READ32(c);
- if(m == 0xFFFFFFFF)
- {
- len += sprintf(buf, "Could not get inbound message frame from IOP!\n");
- kfree(workspace);
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- msg = (u32 *)(m+c->mem_offset);
-
- memset(workspace, 0, 88);
- work32 = (u32*)workspace;
- work16 = (u16*)workspace;
-
- msg[0] = NINE_WORD_MSG_SIZE|SGL_OFFSET_0;
- msg[1] = I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID;
- msg[2] = msg[3] = msg[4] = msg[5] = 0;
- msg[6] = virt_to_phys(workspace);
- msg[7] = 0; /* FIXME: 64-bit */
- msg[8] = 88;
-
- /*
- * hmm...i2o_post_message should just take ptr to message, and
- * determine offset on it's own...less work for OSM developers
- */
- i2o_post_message(c, m);
-
- time = jiffies;
-
- while(workspace[87] != 0xFF)
- {
- if(jiffies-time >= 2*HZ)
- {
- len += sprintf(buf, "Timeout waiting for status reply\n");
- kfree(workspace);
- spin_unlock(&i2o_proc_lock);
- return len;
- }
- schedule();
- barrier();
- }
+ i2o_status_get(c); // reread the status block
- len += sprintf(buf+len, "Organization ID: %0#6x\n", work16[0]);
+ len += sprintf(buf+len,"Organization ID : %0#6x\n",
+ c->status_block->org_id);
- version = workspace[9]&0xF0>>4;
- if(version == 0x02) {
- len += sprintf(buf+len, "Lowest I2O version supported: ");
+ version = c->status_block->i2o_version;
+
+/* FIXME for Spec 2.0
+ if (version == 0x02) {
+ len += sprintf(buf+len,"Lowest I2O version supported: ");
switch(workspace[2]) {
- case 0x00:
- len += sprintf(buf+len, "1.0\n");
- break;
- case 0x01:
- len += sprintf(buf+len, "1.5\n");
- break;
- case 0x02:
- len += sprintf(buf+len, "2.0\n");
- break;
+ case 0x00:
+ len += sprintf(buf+len,"1.0\n");
+ break;
+ case 0x01:
+ len += sprintf(buf+len,"1.5\n");
+ break;
+ case 0x02:
+ len += sprintf(buf+len,"2.0\n");
+ break;
}
len += sprintf(buf+len, "Highest I2O version supported: ");
switch(workspace[3]) {
+ case 0x00:
+ len += sprintf(buf+len,"1.0\n");
+ break;
+ case 0x01:
+ len += sprintf(buf+len,"1.5\n");
+ break;
+ case 0x02:
+ len += sprintf(buf+len,"2.0\n");
+ break;
+ }
+ }
+*/
+ len += sprintf(buf+len,"IOP ID : %0#5x\n",
+ c->status_block->iop_id);
+ len += sprintf(buf+len,"Host Unit ID : %0#6x\n",
+ c->status_block->host_unit_id);
+ len += sprintf(buf+len,"Segment Number : %0#5x\n",
+ c->status_block->segment_number);
+
+ len += sprintf(buf+len, "I2O version : ");
+ switch (version) {
case 0x00:
- len += sprintf(buf+len, "1.0\n");
+ len += sprintf(buf+len,"1.0\n");
break;
case 0x01:
- len += sprintf(buf+len, "1.5\n");
+ len += sprintf(buf+len,"1.5\n");
break;
case 0x02:
- len += sprintf(buf+len, "2.0\n");
+ len += sprintf(buf+len,"2.0\n");
break;
- }
- }
-
- len += sprintf(buf+len, "IOP ID: %0#5x\n", work16[2]&0xFFF);
- len += sprintf(buf+len, "Host Unit ID: %0#6x\n", work16[3]);
- len += sprintf(buf+len, "Segment Number: %0#5x\n", work16[4]&0XFFF);
-
- len += sprintf(buf+len, "I2O version: ");
- switch(version)
- {
- case 0x00:
- len += sprintf(buf+len, "1.0\n");
- break;
- case 0x01:
- len += sprintf(buf+len, "1.5\n");
- break;
- case 0x02:
- len += sprintf(buf+len, "2.0\n");
- break;
- default:
- len += sprintf(buf+len, "Unknown version\n");
+ default:
+ len += sprintf(buf+len,"Unknown version\n");
}
- len += sprintf(buf+len, "IOP State: ");
- switch(workspace[10])
- {
+ len += sprintf(buf+len, "IOP State : ");
+ switch (c->status_block->iop_state) {
case 0x01:
- len += sprintf(buf+len, "Init\n");
+ len += sprintf(buf+len,"INIT\n");
break;
case 0x02:
- len += sprintf(buf+len, "Reset\n");
+ len += sprintf(buf+len,"RESET\n");
break;
case 0x04:
- len += sprintf(buf+len, "Hold\n");
+ len += sprintf(buf+len,"HOLD\n");
break;
case 0x05:
- len += sprintf(buf+len, "Hold\n");
+ len += sprintf(buf+len,"READY\n");
break;
case 0x08:
- len += sprintf(buf+len, "Operational\n");
+ len += sprintf(buf+len,"OPERATIONAL\n");
break;
case 0x10:
- len += sprintf(buf+len, "FAILED\n");
+ len += sprintf(buf+len,"FAILED\n");
break;
case 0x11:
- len += sprintf(buf+len, "FAULTED\n");
+ len += sprintf(buf+len,"FAULTED\n");
break;
default:
- len += sprintf(buf+len, "Unknown\n");
+ len += sprintf(buf+len,"Unknown\n");
break;
}
- /* 0x00 is the only type supported w/spec 1.5 */
- /* Added 2.0 types */
- len += sprintf(buf+len, "Messenger Type: ");
- switch (workspace[11])
- {
- case 0x00:
- len += sprintf(buf+len, "Memory mapped\n");
- break;
- case 0x01:
- len += sprintf(buf+len, "Memory mapped only\n");
- break;
- case 0x02:
- len += sprintf(buf+len, "Remote only\n");
- break;
- case 0x03:
- len += sprintf(buf+len, "Memory mapped and remote\n");
- break;
- default:
- len += sprintf(buf+len, "Unknown\n");
- break;
+ len += sprintf(buf+len,"Messenger Type : ");
+ switch (c->status_block->msg_type) {
+ case 0x00:
+ len += sprintf(buf+len,"Memory mapped\n");
+ break;
+ case 0x01:
+ len += sprintf(buf+len,"Memory mapped only\n");
+ break;
+ case 0x02:
+ len += sprintf(buf+len,"Remote only\n");
+ break;
+ case 0x03:
+ len += sprintf(buf+len,"Memory mapped and remote\n");
+ break;
+ default:
+ len += sprintf(buf+len,"Unknown\n");
}
- len += sprintf(buf+len, "Inbound Frame Size: %d bytes\n", work16[6]*4);
- len += sprintf(buf+len, "Max Inbound Frames: %d\n", work32[4]);
- len += sprintf(buf+len, "Current Inbound Frames: %d\n", work32[5]);
- len += sprintf(buf+len, "Max Outbound Frames: %d\n", work32[6]);
+
+ len += sprintf(buf+len,"Inbound Frame Size : %d bytes\n",
+ c->status_block->inbound_frame_size<<2);
+ len += sprintf(buf+len,"Max Inbound Frames : %d\n",
+ c->status_block->max_inbound_frames);
+ len += sprintf(buf+len,"Current Inbound Frames : %d\n",
+ c->status_block->cur_inbound_frames);
+ len += sprintf(buf+len,"Max Outbound Frames : %d\n",
+ c->status_block->max_outbound_frames);
/* Spec doesn't say if NULL terminated or not... */
- memcpy(prodstr, work32+7, 24);
+ memcpy(prodstr, c->status_block->product_id, 24);
prodstr[24] = '\0';
- len += sprintf(buf+len, "Product ID: %s\n", prodstr);
-
- len += sprintf(buf+len, "LCT Size: %d\n", work32[13]);
-
- len += sprintf(buf+len, "Desired private memory space: %d kB\n",
- work32[15]>>10);
- len += sprintf(buf+len, "Allocated private memory space: %d kB\n",
- work32[16]>>10);
- len += sprintf(buf+len, "Private memory base address: %0#10x\n",
- work32[17]);
- len += sprintf(buf+len, "Desired private I/O space: %d kB\n",
- work32[18]>>10);
- len += sprintf(buf+len, "Allocated private I/O space: %d kB\n",
- work32[19]>>10);
- len += sprintf(buf+len, "Private I/O base address: %0#10x\n",
- work32[20]);
+ len += sprintf(buf+len,"Product ID : %s\n", prodstr);
+ len += sprintf(buf+len,"Expected LCT Size : %d bytes\n",
+ c->status_block->expected_lct_size);
+
+ len += sprintf(buf+len,"IOP Capabilities\n");
+ len += sprintf(buf+len," Context Field Size Support : ");
+ switch (c->status_block->iop_capabilities & 0x0000003) {
+ case 0:
+ len += sprintf(buf+len,"Supports only 32-bit context fields\n");
+ break;
+ case 1:
+ len += sprintf(buf+len,"Supports only 64-bit context fields\n");
+ break;
+ case 2:
+ len += sprintf(buf+len,"Supports 32-bit and 64-bit context fields, "
+ "but not concurrently\n");
+ break;
+ case 3:
+ len += sprintf(buf+len,"Supports 32-bit and 64-bit context fields "
+ "concurrently\n");
+ break;
+ default:
+ len += sprintf(buf+len,"0x%08x\n",c->status_block->iop_capabilities);
+ }
+ len += sprintf(buf+len," Current Context Field Size : ");
+ switch (c->status_block->iop_capabilities & 0x0000000C) {
+ case 0:
+ len += sprintf(buf+len,"not configured\n");
+ break;
+ case 4:
+ len += sprintf(buf+len,"Supports only 32-bit context fields\n");
+ break;
+ case 8:
+ len += sprintf(buf+len,"Supports only 64-bit context fields\n");
+ break;
+ case 12:
+ len += sprintf(buf+len,"Supports both 32-bit or 64-bit context fields "
+ "concurrently\n");
+ break;
+ default:
+ len += sprintf(buf+len,"\n");
+ }
+ len += sprintf(buf+len," Inbound Peer Support : %s\n",
+ (c->status_block->iop_capabilities & 0x00000010) ? "Supported" : "Not supported");
+ len += sprintf(buf+len," Outbound Peer Support : %s\n",
+ (c->status_block->iop_capabilities & 0x00000020) ? "Supported" : "Not supported");
+ len += sprintf(buf+len," Peer to Peer Support : %s\n",
+ (c->status_block->iop_capabilities & 0x00000040) ? "Supported" : "Not supported");
+
+ len += sprintf(buf+len, "Desired private memory size : %d kB\n",
+ c->status_block->desired_mem_size>>10);
+ len += sprintf(buf+len, "Allocated private memory size : %d kB\n",
+ c->status_block->current_mem_size>>10);
+ len += sprintf(buf+len, "Private memory base address : %0#10x\n",
+ c->status_block->current_mem_base);
+ len += sprintf(buf+len, "Desired private I/O size : %d kB\n",
+ c->status_block->desired_io_size>>10);
+ len += sprintf(buf+len, "Allocated private I/O size : %d kB\n",
+ c->status_block->current_io_size>>10);
+ len += sprintf(buf+len, "Private I/O base address : %0#10x\n",
+ c->status_block->current_io_base);
- kfree(workspace);
spin_unlock(&i2o_proc_lock);
return len;
@@ -790,25 +769,25 @@
len = 0;
- token = i2o_query_scalar(c, ADAPTER_TID,
- 0, // ParamGroup 0x0000h
- -1, // all fields
- &work32,
- sizeof(work32));
+ token = i2o_query_scalar(c, ADAPTER_TID, 0x0000, -1, &work32, sizeof(work32));
- if(token < 0)
- {
- len += sprintf(buf, "Error waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0000 IOP Hardware");
spin_unlock(&i2o_proc_lock);
return len;
}
- len += sprintf(buf, "IOP Hardware Information Table (group = 0x0000)\n");
-
- len += sprintf(buf+len, "I2O Vendor ID : %0#6x\n", work16[0]);
- len += sprintf(buf+len, "Product ID : %0#6x\n", work16[1]);
- len += sprintf(buf+len, "RAM : %dkB\n", work32[1]>>10);
- len += sprintf(buf+len, "Non-Volatile Storage : %dkB\n", work32[2]>>10);
+ len += sprintf(buf+len, "I2O Vendor ID : %0#6x\n", work16[0]);
+ len += sprintf(buf+len, "Product ID : %0#6x\n", work16[1]);
+ len += sprintf(buf+len, "CPU : ");
+ if(work8[16] > 8)
+ len += sprintf(buf+len, "Unknown\n");
+ else
+ len += sprintf(buf+len, "%s\n", cpu_table[work8[16]]);
+ /* Anyone using ProcessorVersion? */
+
+ len += sprintf(buf+len, "RAM : %dkB\n", work32[1]>>10);
+ len += sprintf(buf+len, "Non-Volatile Mem : %dkB\n", work32[2]>>10);
hwcap = work32[3];
len += sprintf(buf+len, "Capabilities :\n");
@@ -823,13 +802,6 @@
if(hwcap&0x00000010)
len += sprintf(buf+len, " Battery-backed RAM\n");
- len += sprintf(buf+len, "CPU : ");
- if(work8[16] > 8)
- len += sprintf(buf+len, "Unknown\n");
- else
- len += sprintf(buf+len, "%s\n", cpu_table[work8[16]]);
- /* Anyone using ProcessorVersion? */
-
spin_unlock(&i2o_proc_lock);
return len;
@@ -850,11 +822,10 @@
u8 reserved;
u16 i2o_vendor_id;
u16 module_id;
- u8 module_name[24];
- u8 module_version[4];
+ u8 module_name_version[28];
u32 data_size;
u32 code_size;
- } i2o_exec_execute_ddm_table, *pi2o_exec_execute_ddm_table;
+ } i2o_exec_execute_ddm_table;
struct
{
@@ -879,27 +850,13 @@
NULL, 0,
&result, sizeof(result));
- if (token<0)
- switch (token)
- {
- case -ETIMEDOUT:
- len += sprintf(buf, "Timeout reading table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- case -ENOMEM:
- len += sprintf(buf, "No free memory to read the table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- default:
- len += sprintf(buf, "Error reading group. BlockStatus %d\n",
- token);
- spin_unlock(&i2o_proc_lock);
- return len;
- }
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0003 Executing DDM List");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
- len += sprintf(buf+len, "Tid Type Vendor Id Name Vrs Data_size Code_size\n");
+ len += sprintf(buf+len, "Tid Module_type Vendor Mod_id Module_name Vrs Data_size Code_size\n");
ddm_table=result.ddm_table[0];
for(i=0; i < result.row_count; ddm_table=result.ddm_table[++i])
@@ -918,11 +875,10 @@
len += sprintf(buf+len, " ");
}
- len += sprintf(buf+len, "%0#7x", ddm_table.i2o_vendor_id);
- len += sprintf(buf+len, "%0#7x", ddm_table.module_id);
- len += sprintf(buf+len, "%-25s", chtostr(ddm_table.module_name, 24));
- len += sprintf(buf+len, "%-6s", chtostr(ddm_table.module_version,4));
- len += sprintf(buf+len, "%8d ", ddm_table.data_size);
+ len += sprintf(buf+len, "%-#7x", ddm_table.i2o_vendor_id);
+ len += sprintf(buf+len, "%-#8x", ddm_table.module_id);
+ len += sprintf(buf+len, "%-29s", chtostr(ddm_table.module_name_version, 28));
+ len += sprintf(buf+len, "%9d ", ddm_table.data_size);
len += sprintf(buf+len, "%8d", ddm_table.code_size);
len += sprintf(buf+len, "\n");
@@ -935,20 +891,20 @@
/* Executive group 0004h - Driver Store (scalar) */
-int i2o_proc_read_ds(char *buf, char **start, off_t offset, int len,
+int i2o_proc_read_driver_store(char *buf, char **start, off_t offset, int len,
int *eof, void *data)
{
struct i2o_controller *c = (struct i2o_controller*)data;
u32 work32[8];
+ int token;
spin_lock(&i2o_proc_lock);
len = 0;
- if(i2o_query_scalar(c, ADAPTER_TID, 0x0004, -1, &work32,
- sizeof(work32)) < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ token = i2o_query_scalar(c, ADAPTER_TID, 0x0004, -1, &work32, sizeof(work32));
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0004 Driver Store");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -966,8 +922,8 @@
/* Executive group 0005h - Driver Store Table (table) */
-int i2o_proc_read_dst(char *buf, char **start, off_t offset, int len,
- int *eof, void *data)
+int i2o_proc_read_drivers_stored(char *buf, char **start, off_t offset,
+ int len, int *eof, void *data)
{
typedef struct _i2o_driver_store {
u16 stored_ddm_index;
@@ -1005,33 +961,17 @@
len = 0;
token = i2o_query_table(I2O_PARAMS_TABLE_GET,
- c, ADAPTER_TID,
- 0x0005, -1,
- NULL, 0,
+ c, ADAPTER_TID, 0x0005, -1, NULL, 0,
&result, sizeof(result));
- if (token<0)
- switch (token)
- {
- case -ETIMEDOUT:
- len += sprintf(buf, "Timeout reading table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- case -ENOMEM:
- len += sprintf(buf, "No free memory to read the table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- default:
- len += sprintf(buf, "Error reading group. "
- "BlockStatus %d\n",token);
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf+len, "# Type Vendor Id Name Vrs Date Mod_size Par_size Flags\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0005 DRIVER STORE TABLE");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
+ len += sprintf(buf+len, "# Module_type Vendor Mod_id Module_name Vrs"
+ "Date Mod_size Par_size Flags\n");
for(i=0, dst=result.dst[0]; i < result.row_count; dst=result.dst[++i])
{
len += sprintf(buf+len, "%-3d", dst.stored_ddm_index);
@@ -1052,8 +992,8 @@
len += sprintf(buf+len, "%-d", dst.module_state);
#endif
- len += sprintf(buf+len, "%#7x", dst.i2o_vendor_id);
- len += sprintf(buf+len, "%#8x", dst.module_id);
+ len += sprintf(buf+len, "%-#7x", dst.i2o_vendor_id);
+ len += sprintf(buf+len, "%-#8x", dst.module_id);
len += sprintf(buf+len, "%-29s", chtostr(dst.module_name_version,28));
len += sprintf(buf+len, "%-9s", chtostr(dst.date,8));
len += sprintf(buf+len, "%8d ", dst.module_size);
@@ -1077,81 +1017,69 @@
int i2o_proc_read_groups(char *buf, char **start, off_t offset, int len,
int *eof, void *data)
{
- struct i2o_controller *c = (struct i2o_controller*)data;
+ struct i2o_device *d = (struct i2o_device*)data;
int token;
int i;
- int rows;
- u16 work16[2048];
- u16 *group=work16;
- int more;
-
+ u8 properties;
+
+ typedef struct _i2o_group_info
+ {
+ u16 group_number;
+ u16 field_count;
+ u16 row_count;
+ u8 properties;
+ u8 reserved;
+ } i2o_group_info;
+
+ struct
+ {
+ u16 result_count;
+ u16 pad;
+ u16 block_size;
+ u8 block_status;
+ u8 error_info_size;
+ u16 row_count;
+ u16 more_flag;
+ i2o_group_info group[256];
+ } result;
+
spin_lock(&i2o_proc_lock);
len = 0;
token = i2o_query_table(I2O_PARAMS_TABLE_GET,
- c, ADAPTER_TID,
- 0xF000, -1,
- NULL, 0,
- &work16, sizeof(work16));
-
- if (token<0)
- switch (token)
- {
- case -ETIMEDOUT:
- len += sprintf(buf, "Timeout reading table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- case -ENOMEM:
- len += sprintf(buf, "No free memory to read the table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- default:
- len += sprintf(buf, "Error reading table. BlockStatus %d\n",
- token);
- spin_unlock(&i2o_proc_lock);
- return len;
- }
+ d->controller, d->lct_data->tid, 0xF000, -1, NULL, 0,
+ &result, sizeof(result));
- rows=work16[4];
- more=work16[5];
+ if (token < 0) {
+ len = i2o_report_query_status(buf+len, token, "0xF000 Params Descriptor");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
- len += sprintf(buf+len, "\nPARAMS DESCRIPTOR TABLE:\n\n");
len += sprintf(buf+len, "# Group FieldCount RowCount Type Add Del Clear\n");
- group+=64;
-
- for(i=0; i < rows; i++, group+=16)
+ for (i=0; i < result.row_count; i++)
{
len += sprintf(buf+len, "%-3d", i);
-
- len += sprintf(buf+len, "%#6x ", group[0]);
- len += sprintf(buf+len, "%10d ", group[1]);
- len += sprintf(buf+len, "%8d ", group[2]);
-
- if(group[3]&0x1)
- len += sprintf(buf+len, "Table ");
- else
- len += sprintf(buf+len, "Scalar ");
- if(group[3]&0x2)
- len += sprintf(buf+len, "x ");
- else
- len += sprintf(buf+len, " ");
- if(group[3]&0x4)
- len += sprintf(buf+len, "x ");
- else
- len += sprintf(buf+len, " ");
- if(group[3]&0x8)
- len += sprintf(buf+len, "x ");
- else
- len += sprintf(buf+len, " ");
+ len += sprintf(buf+len, "0x%04X ", result.group[i].group_number);
+ len += sprintf(buf+len, "%10d ", result.group[i].field_count);
+ len += sprintf(buf+len, "%8d ", result.group[i].row_count);
+
+ properties = result.group[i].properties;
+ if (properties & 0x1) len += sprintf(buf+len, "Table ");
+ else len += sprintf(buf+len, "Scalar ");
+ if (properties & 0x2) len += sprintf(buf+len, " + ");
+ else len += sprintf(buf+len, " - ");
+ if (properties & 0x4) len += sprintf(buf+len, " + ");
+ else len += sprintf(buf+len, " - ");
+ if (properties & 0x8) len += sprintf(buf+len, " + ");
+ else len += sprintf(buf+len, " - ");
len += sprintf(buf+len, "\n");
}
- if(more)
+ if (result.more_flag)
len += sprintf(buf+len, "There is more...\n");
spin_unlock(&i2o_proc_lock);
@@ -1160,74 +1088,283 @@
}
-/* Generic group F005h - Private message extensions (table) */
-int i2o_proc_read_priv_msgs(char *buf, char **start, off_t offset, int len,
- int *eof, void *data)
+/* Generic group F001h - Physical Device Table (table) */
+int i2o_proc_read_phys_device(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
{
- struct i2o_controller *c = (struct i2o_controller*)data;
+ struct i2o_device *d = (struct i2o_device*)data;
int token;
int i;
- int rows;
- int more;
- u16 work16[1024];
- u16 *field=work16;
- spin_lock(&i2o_proc_lock);
+ struct
+ {
+ u16 result_count;
+ u16 pad;
+ u16 block_size;
+ u8 block_status;
+ u8 error_info_size;
+ u16 row_count;
+ u16 more_flag;
+ u32 adapter_id[64];
+ } result;
+ spin_lock(&i2o_proc_lock);
len = 0;
token = i2o_query_table(I2O_PARAMS_TABLE_GET,
- c, ADAPTER_TID,
- 0xF000, -1,
- NULL, 0,
- &work16, sizeof(work16));
+ d->controller, d->lct_data->tid,
+ 0xF001, -1, NULL, 0,
+ &result, sizeof(result));
- if (token<0)
- switch (token)
- {
- case -ETIMEDOUT:
- len += sprintf(buf, "Timeout reading table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- case -ENOMEM:
- len += sprintf(buf, "No free memory to read the table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- default:
- len += sprintf(buf, "Error reading field. BlockStatus %d\n",
- token);
- spin_unlock(&i2o_proc_lock);
- return len;
- }
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF001 Physical Device Table");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
- rows=work16[4];
- more=work16[5];
-
- len += sprintf(buf+len, "Instance# OrgId FunctionCode\n");
+ if (result.row_count)
+ len += sprintf(buf+len, "# AdapterId\n");
- field+=64;
- for(i=0; i < rows; i++, field+=16)
+ for (i=0; i < result.row_count; i++)
{
- len += sprintf(buf+len, "%0#9x ", field[0]);
- len += sprintf(buf+len, "%0#6x ", work16[1]);
- len += sprintf(buf+len, "%0#6x", work16[2]);
-
- len += sprintf(buf+len, "\n");
+ len += sprintf(buf+len, "%-2d", i);
+ len += sprintf(buf+len, "%#7x\n", result.adapter_id[i]);
}
- if(more)
+ if (result.more_flag)
len += sprintf(buf+len, "There is more...\n");
spin_unlock(&i2o_proc_lock);
-
return len;
}
+/* Generic group F002h - Claimed Table (table) */
+int i2o_proc_read_claimed(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
+{
+ struct i2o_device *d = (struct i2o_device*)data;
+ int token;
+ int i;
-int i2o_proc_read_dev(char *buf, char **start, off_t offset, int len,
- int *eof, void *data)
+ struct {
+ u16 result_count;
+ u16 pad;
+ u16 block_size;
+ u8 block_status;
+ u8 error_info_size;
+ u16 row_count;
+ u16 more_flag;
+ u16 claimed_tid[64];
+ } result;
+
+ spin_lock(&i2o_proc_lock);
+ len = 0;
+
+ token = i2o_query_table(I2O_PARAMS_TABLE_GET,
+ d->controller, d->lct_data->tid,
+ 0xF002, -1, NULL, 0,
+ &result, sizeof(result));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF002 Claimed Table");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
+
+ if (result.row_count)
+ len += sprintf(buf+len, "# ClaimedTid\n");
+
+ for (i=0; i < result.row_count; i++)
+ {
+ len += sprintf(buf+len, "%-2d", i);
+ len += sprintf(buf+len, "%#7x\n", result.claimed_tid[i]);
+ }
+
+ if (result.more_flag)
+ len += sprintf(buf+len, "There is more...\n");
+
+ spin_unlock(&i2o_proc_lock);
+ return len;
+}
+
+/* Generic group F003h - User Table (table) */
+int i2o_proc_read_users(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
+{
+ struct i2o_device *d = (struct i2o_device*)data;
+ int token;
+ int i;
+
+ typedef struct _i2o_user_table
+ {
+ u16 instance;
+ u16 user_tid;
+ u8 claim_type;
+ u8 reserved1;
+ u16 reserved2;
+ } i2o_user_table;
+
+ struct
+ {
+ u16 result_count;
+ u16 pad;
+ u16 block_size;
+ u8 block_status;
+ u8 error_info_size;
+ u16 row_count;
+ u16 more_flag;
+ i2o_user_table user[64];
+ } result;
+
+ spin_lock(&i2o_proc_lock);
+ len = 0;
+
+ token = i2o_query_table(I2O_PARAMS_TABLE_GET,
+ d->controller, d->lct_data->tid,
+ 0xF003, -1, NULL, 0,
+ &result, sizeof(result));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF003 User Table");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
+
+ len += sprintf(buf+len, "# Instance UserTid ClaimType\n");
+
+ for(i=0; i < result.row_count; i++)
+ {
+ len += sprintf(buf+len, "%-3d", i);
+ len += sprintf(buf+len, "%#8x ", result.user[i].instance);
+ len += sprintf(buf+len, "%#7x ", result.user[i].user_tid);
+ len += sprintf(buf+len, "%#9x\n", result.user[i].claim_type);
+ }
+
+ if (result.more_flag)
+ len += sprintf(buf+len, "There is more...\n");
+
+ spin_unlock(&i2o_proc_lock);
+ return len;
+}
+
+/* Generic group F005h - Private message extensions (table) (optional) */
+int i2o_proc_read_priv_msgs(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
+{
+ struct i2o_device *d = (struct i2o_device*)data;
+ int token;
+ int i;
+
+ typedef struct _i2o_private
+ {
+ u16 ext_instance;
+ u16 organization_id;
+ u16 x_function_code;
+ } i2o_private;
+
+ struct
+ {
+ u16 result_count;
+ u16 pad;
+ u16 block_size;
+ u8 block_status;
+ u8 error_info_size;
+ u16 row_count;
+ u16 more_flag;
+ i2o_private extension[64];
+ } result;
+
+ spin_lock(&i2o_proc_lock);
+
+ len = 0;
+
+ token = i2o_query_table(I2O_PARAMS_TABLE_GET,
+ d->controller, d->lct_data->tid,
+ 0xF000, -1,
+ NULL, 0,
+ &result, sizeof(result));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF005 Private Message Extensions (optional)");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
+
+ len += sprintf(buf+len, "Instance# OrgId FunctionCode\n");
+
+ for(i=0; i < result.row_count; i++)
+ {
+ len += sprintf(buf+len, "%0#9x ", result.extension[i].ext_instance);
+ len += sprintf(buf+len, "%0#6x ", result.extension[i].organization_id);
+ len += sprintf(buf+len, "%0#6x", result.extension[i].x_function_code);
+
+ len += sprintf(buf+len, "\n");
+ }
+
+ if(result.more_flag)
+ len += sprintf(buf+len, "There is more...\n");
+
+ spin_unlock(&i2o_proc_lock);
+
+ return len;
+}
+
+
+/* Generic group F006h - Authorized User Table (table) */
+int i2o_proc_read_authorized_users(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
+{
+ struct i2o_device *d = (struct i2o_device*)data;
+ int token;
+ int i;
+
+ struct
+ {
+ u16 result_count;
+ u16 pad;
+ u16 block_size;
+ u8 block_status;
+ u8 error_info_size;
+ u16 row_count;
+ u16 more_flag;
+ u32 alternate_tid[64];
+ } result;
+
+ spin_lock(&i2o_proc_lock);
+ len = 0;
+
+ token = i2o_query_table(I2O_PARAMS_TABLE_GET,
+ d->controller, d->lct_data->tid,
+ 0xF006, -1,
+ NULL, 0,
+ &result, sizeof(result));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF006 Autohorized User Table");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
+
+ if (result.row_count)
+ len += sprintf(buf+len, "# AlternateTid\n");
+
+ for(i=0; i < result.row_count; i++)
+ {
+ len += sprintf(buf+len, "%-2d", i);
+ len += sprintf(buf+len, "%#7x ", result.alternate_tid[i]);
+ }
+
+ if (result.more_flag)
+ len += sprintf(buf+len, "There is more...\n");
+
+ spin_unlock(&i2o_proc_lock);
+ return len;
+}
+
+
+/* Generic group F100h - Device Identity (scalar) */
+int i2o_proc_read_dev_identity(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
{
struct i2o_device *d = (struct i2o_device*)data;
static u32 work32[128]; // allow for "stuff" + up to 256 byte (max) serial number
@@ -1240,14 +1377,11 @@
len = 0;
token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0xF100, // ParamGroup F100h (Device Identity)
- -1, // all fields
- &work32,
- sizeof(work32));
+ 0xF100, -1,
+ &work32, sizeof(work32));
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token ,"0xF100 Device Identity");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -1290,44 +1424,45 @@
}
-
-int i2o_proc_read_ddm(char *buf, char **start, off_t offset, int len,
- int *eof, void *data)
+/* Generic group F101h - DDM Identity (scalar) */
+int i2o_proc_read_ddm_identity(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
{
struct i2o_device *d = (struct i2o_device*)data;
- static u32 work32[128];
- static u16 *work16 = (u16*)work32;
int token;
+ struct
+ {
+ u16 ddm_tid;
+ u8 module_name[24];
+ u8 module_rev[8];
+ u8 sn_format;
+ u8 serial_number[12];
+ u8 pad[256]; // allow up to 256 byte (max) serial number
+ } result;
+
spin_lock(&i2o_proc_lock);
len = 0;
token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0xF101, // ParamGroup F101h (DDM Identity)
- -1, // all fields
- &work32,
- sizeof(work32));
+ 0xF101, -1,
+ &result, sizeof(result));
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF101 DDM Identity");
spin_unlock(&i2o_proc_lock);
return len;
}
- len += sprintf(buf, "Registering DDM TID : 0x%03x\n", work16[0]&0xFFF);
- len += sprintf(buf+len, "Module name : %s\n", chtostr((u8 *)(work16+1), 24));
- len += sprintf(buf+len, "Module revision : %s\n", chtostr((u8 *)(work16+13), 8));
+ len += sprintf(buf, "Registering DDM TID : 0x%03x\n", result.ddm_tid);
+ len += sprintf(buf+len, "Module name : %s\n", chtostr(result.module_name, 24));
+ len += sprintf(buf+len, "Module revision : %s\n", chtostr(result.module_rev, 8));
len += sprintf(buf+len, "Serial number : ");
- len = print_serial_number(buf, len,
- (u8*)(work16+17),
- /* allow for SNLen plus
- * possible trailing '\0'
- */
- sizeof(work32)-(17*sizeof(u16))-2
- );
+ len = print_serial_number(buf, len, result.serial_number, sizeof(result)-36);
+ /* allow for SNLen plus possible trailing '\0' */
+
len += sprintf(buf+len, "\n");
spin_unlock(&i2o_proc_lock);
@@ -1335,41 +1470,44 @@
return len;
}
+/* Generic group F102h - User Information (scalar) */
int i2o_proc_read_uinfo(char *buf, char **start, off_t offset, int len,
int *eof, void *data)
{
struct i2o_device *d = (struct i2o_device*)data;
- static u32 work32[256];
int token;
-
+
+ struct
+ {
+ u8 device_name[64];
+ u8 service_name[64];
+ u8 physical_location[64];
+ u8 instance_number[4];
+ } result;
+
spin_lock(&i2o_proc_lock);
-
len = 0;
token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0xF102, // ParamGroup F102h (User Information)
- -1, // all fields
- &work32,
- sizeof(work32));
+ 0xF102, -1,
+ &result, sizeof(result));
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF102 User Information");
spin_unlock(&i2o_proc_lock);
return len;
}
- len += sprintf(buf, "Device name : %s\n", chtostr((u8 *)work32, 64));
- len += sprintf(buf+len, "Service name : %s\n", chtostr((u8 *)(work32+16), 64));
- len += sprintf(buf+len, "Physical name : %s\n", chtostr((u8 *)(work32+32), 64));
- len += sprintf(buf+len, "Instance number : %s\n", chtostr((u8 *)(work32+48), 4));
-
- spin_unlock(&i2o_proc_lock);
+ len += sprintf(buf, "Device name : %s\n", chtostr(result.device_name, 64));
+ len += sprintf(buf+len, "Service name : %s\n", chtostr(result.service_name, 64));
+ len += sprintf(buf+len, "Physical name : %s\n", chtostr(result.physical_location, 64));
+ len += sprintf(buf+len, "Instance number : %s\n", chtostr(result.instance_number, 4));
+ spin_unlock(&i2o_proc_lock);
return len;
}
-
+/* Generic group F103h - SGL Operating Limits (scalar) */
int i2o_proc_read_sgl_limits(char *buf, char **start, off_t offset, int len,
int *eof, void *data)
{
@@ -1384,14 +1522,11 @@
len = 0;
token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0xF103, // ParamGroup F103h (SGL Operating Limits)
- -1, // all fields
- &work32,
- sizeof(work32));
+ 0xF103, -1,
+ &work32, sizeof(work32));
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF103 SGL Operating Limits");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -1424,6 +1559,164 @@
return len;
}
+/* Generic group F200h - Sensors (scalar) */
+int i2o_proc_read_sensors(char *buf, char **start, off_t offset, int len,
+ int *eof, void *data)
+{
+ struct i2o_device *d = (struct i2o_device*)data;
+ int token;
+
+ struct
+ {
+ u16 sensor_instance;
+ u8 component;
+ u16 component_instance;
+ u8 sensor_class;
+ u8 sensor_type;
+ u8 scaling_exponent;
+ u32 actual_reading;
+ u32 minimum_reading;
+ u32 low2lowcat_treshold;
+ u32 lowcat2low_treshold;
+ u32 lowwarn2low_treshold;
+ u32 low2lowwarn_treshold;
+ u32 norm2lowwarn_treshold;
+ u32 lowwarn2norm_treshold;
+ u32 nominal_reading;
+ u32 hiwarn2norm_treshold;
+ u32 norm2hiwarn_treshold;
+ u32 high2hiwarn_treshold;
+ u32 hiwarn2high_treshold;
+ u32 hicat2high_treshold;
+ u32 hi2hicat_treshold;
+ u32 maximum_reading;
+ u8 sensor_state;
+ u16 event_enable;
+ } result;
+
+ spin_lock(&i2o_proc_lock);
+ len = 0;
+
+ token = i2o_query_scalar(d->controller, d->lct_data->tid,
+ 0xF200, -1,
+ &result, sizeof(result));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0xF200 Sensors (optional)");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
+
+ len += sprintf(buf+len, "Sensor instance : %d\n", result.sensor_instance);
+
+ len += sprintf(buf+len, "Component : %d = ", result.component);
+ switch (result.component)
+ {
+ case 0: len += sprintf(buf+len, "Other");
+ break;
+ case 1: len += sprintf(buf+len, "Planar logic Board");
+ break;
+ case 2: len += sprintf(buf+len, "CPU");
+ break;
+ case 3: len += sprintf(buf+len, "Chassis");
+ break;
+ case 4: len += sprintf(buf+len, "Power Supply");
+ break;
+ case 5: len += sprintf(buf+len, "Storage");
+ break;
+ case 6: len += sprintf(buf+len, "External");
+ break;
+ }
+ len += sprintf(buf+len,"\n");
+
+ len += sprintf(buf+len, "Component instance : %d\n", result.component_instance);
+ len += sprintf(buf+len, "Sensor class : %s\n",
+ result.sensor_class ? "Analog" : "Digital");
+
+ len += sprintf(buf+len, "Sensor type : %d = ",result.sensor_type);
+ switch (result.sensor_type)
+ {
+ case 0: len += sprintf(buf+len, "Other\n");
+ break;
+ case 1: len += sprintf(buf+len, "Thermal\n");
+ break;
+ case 2: len += sprintf(buf+len, "DC voltage (DC volts)\n");
+ break;
+ case 3: len += sprintf(buf+len, "AC voltage (AC volts)\n");
+ break;
+ case 4: len += sprintf(buf+len, "DC current (DC amps)\n");
+ break;
+ case 5: len += sprintf(buf+len, "AC current (AC volts)\n");
+ break;
+ case 6: len += sprintf(buf+len, "Door open\n");
+ break;
+ case 7: len += sprintf(buf+len, "Fan operational\n");
+ break;
+ }
+
+ len += sprintf(buf+len, "Scaling exponent : %d\n", result.scaling_exponent);
+ len += sprintf(buf+len, "Actual reading : %d\n", result.actual_reading);
+ len += sprintf(buf+len, "Minimum reading : %d\n", result.minimum_reading);
+ len += sprintf(buf+len, "Low2LowCat treshold : %d\n", result.low2lowcat_treshold);
+ len += sprintf(buf+len, "LowCat2Low treshold : %d\n", result.lowcat2low_treshold);
+ len += sprintf(buf+len, "LowWarn2Low treshold : %d\n", result.lowwarn2low_treshold);
+ len += sprintf(buf+len, "Low2LowWarn treshold : %d\n", result.low2lowwarn_treshold);
+ len += sprintf(buf+len, "Norm2LowWarn treshold : %d\n", result.norm2lowwarn_treshold);
+ len += sprintf(buf+len, "LowWarn2Norm treshold : %d\n", result.lowwarn2norm_treshold);
+ len += sprintf(buf+len, "Nominal reading : %d\n", result.nominal_reading);
+ len += sprintf(buf+len, "HiWarn2Norm treshold : %d\n", result.hiwarn2norm_treshold);
+ len += sprintf(buf+len, "Norm2HiWarn treshold : %d\n", result.norm2hiwarn_treshold);
+ len += sprintf(buf+len, "High2HiWarn treshold : %d\n", result.high2hiwarn_treshold);
+ len += sprintf(buf+len, "HiWarn2High treshold : %d\n", result.hiwarn2high_treshold);
+ len += sprintf(buf+len, "HiCat2High treshold : %d\n", result.hicat2high_treshold);
+ len += sprintf(buf+len, "High2HiCat treshold : %d\n", result.hi2hicat_treshold);
+ len += sprintf(buf+len, "Maximum reading : %d\n", result.maximum_reading);
+
+ len += sprintf(buf+len, "Sensor state : %d = ", result.sensor_state);
+ switch (result.sensor_state)
+ {
+ case 0: len += sprintf(buf+len, "Normal\n");
+ break;
+ case 1: len += sprintf(buf+len, "Abnormal\n");
+ break;
+ case 2: len += sprintf(buf+len, "Unknown\n");
+ break;
+ case 3: len += sprintf(buf+len, "Low Catastrophic (LoCat)\n");
+ break;
+ case 4: len += sprintf(buf+len, "Low (Low)\n");
+ break;
+ case 5: len += sprintf(buf+len, "Low Warning (LoWarn)\n");
+ break;
+ case 6: len += sprintf(buf+len, "High Warning (HiWarn)\n");
+ break;
+ case 7: len += sprintf(buf+len, "High (High)\n");
+ break;
+ case 8: len += sprintf(buf+len, "High Catastrophic (HiCat)\n");
+ break;
+ }
+
+ len += sprintf(buf+len, "Event_enable : 0x%02X\n", result.event_enable);
+ if (result.event_enable & 0x01)
+ len += sprintf(buf+len, "\tOperational state change. \n");
+ if (result.event_enable & 0x02)
+ len += sprintf(buf+len, "\tLow catastrophic. \n");
+ if (result.event_enable & 0x04)
+ len += sprintf(buf+len, "\tLow reading. \n");
+ if (result.event_enable & 0x08)
+ len += sprintf(buf+len, "\tLow warning. \n");
+ if (result.event_enable & 0x10)
+ len += sprintf(buf+len, "\tChange back to normal from out of range state. \n");
+ if (result.event_enable & 0x20)
+ len += sprintf(buf+len, "\tHigh warning. \n");
+ if (result.event_enable & 0x40)
+ len += sprintf(buf+len, "\tHigh reading. \n");
+ if (result.event_enable & 0x80)
+ len += sprintf(buf+len, "\tHigh catastrophic. \n");
+
+ spin_unlock(&i2o_proc_lock);
+ return len;
+}
+
static int print_serial_number(char *buff, int pos, u8 *serialno, int max_len)
{
@@ -1749,14 +2042,12 @@
int token;
spin_lock(&i2o_proc_lock);
-
len = 0;
token = i2o_query_scalar(d->controller, d->lct_data->tid,
0x0000, -1, &work32, 56*4);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token, "0x0000 LAN Device Info");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -1877,9 +2168,8 @@
token = i2o_query_scalar(d->controller, d->lct_data->tid,
0x0001, -1, &work32, 48*4);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0001 LAN MAC Address");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -1955,51 +2245,44 @@
int len, int *eof, void *data)
{
struct i2o_device *d = (struct i2o_device*)data;
- static u32 field32[64];
- static u8 *field8 = (u8 *)field32;
- static u16 *field16 = (u16 *)field32;
int token;
int i;
+ u8 mc_addr[8];
+
+ struct
+ {
+ u16 result_count;
+ u16 pad;
+ u16 block_size;
+ u8 block_status;
+ u8 error_info_size;
+ u16 row_count;
+ u16 more_flag;
+ u8 mc_addr[256][8];
+ } result;
spin_lock(&i2o_proc_lock);
len = 0;
token = i2o_query_table(I2O_PARAMS_TABLE_GET,
- d->controller, d->lct_data->tid, 0x0002, -1,
- NULL, 0, &field32, sizeof(field32));
-
- if (token<0)
- switch (token) {
- case -ETIMEDOUT:
- len += sprintf(buf, "Timeout reading table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- case -ENOMEM:
- len += sprintf(buf, "No free memory to read the table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- default:
- len += sprintf(buf, "Error reading field. BlockStatus %d\n",
- token);
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf, "RowCount=%d, MoreFlag=%d\n",
- field16[0], field16[1]);
+ d->controller, d->lct_data->tid, 0x0002, -1,
+ NULL, 0, &result, sizeof(result));
- field8=(u8 *)&field16[2];
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x002 LAN Multicast MAC Address");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
- for(i=0; i<field16[0]; i++, field8+=8)
+ for (i = 0; i < result.row_count; i++)
{
+ memcpy(mc_addr, result.mc_addr[i], 8);
+
len += sprintf(buf+len, "MC MAC address[%d]: "
"%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
- i,
- field8[0], field8[1], field8[2],
- field8[3], field8[4], field8[5],
- field8[6], field8[7]);
+ i, mc_addr[0], mc_addr[1], mc_addr[2],
+ mc_addr[3], mc_addr[4], mc_addr[5],
+ mc_addr[6], mc_addr[7]);
}
spin_unlock(&i2o_proc_lock);
@@ -2019,9 +2302,8 @@
token = i2o_query_scalar(d->controller, d->lct_data->tid,
0x0003, -1, &work32, 9*4);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0003 LAN Batch Control");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -2050,8 +2332,8 @@
work32[4]/10);
}
- len += sprintf(buf+len, "Max Rx batch count : %d\n", work32[5]);
- len += sprintf(buf+len, "Max Rx batch delay : %d\n", work32[6]);
+ len += sprintf(buf+len, "Max Rx batch count : %d\n", work32[5]);
+ len += sprintf(buf+len, "Max Rx batch delay : %d\n", work32[6]);
if(d->i2oversion == 0x00) {
len += sprintf(buf+len,
@@ -2079,9 +2361,8 @@
token = i2o_query_scalar(d->controller, d->lct_data->tid,
0x0004, -1, &work32, 20);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0004 LAN Operation");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -2090,7 +2371,7 @@
len += sprintf(buf+len, "Transmission error reporting : %s\n",
(work32[1]&1)?"on":"off");
len += sprintf(buf+len, "Bad packet handling : %s\n",
- (work32[1]&0x2)?"by host":"by DDM");
+ (work32[1]&0x2)?"by host":"by DDM");
len += sprintf(buf+len, "Packet orphan limit : %d\n", work32[2]);
len += sprintf(buf+len, "Tx modes :\n");
@@ -2134,52 +2415,72 @@
int len, int *eof, void *data)
{
struct i2o_device *d = (struct i2o_device*)data;
- static u32 work32[9];
- static u8 *work8 = (u8*)work32;
- static u64 *work64 = (u64*)work32;
int token;
+ struct
+ {
+ u32 connector_type;
+ u32 connection_type;
+ u64 current_tx_wire_speed;
+ u64 current_rx_wire_speed;
+ u8 duplex_mode;
+ u8 link_status;
+ u8 reserved;
+ u8 duplex_mode_target;
+ u32 connector_type_target;
+ u32 connection_type_target;
+ } result;
+
spin_lock(&i2o_proc_lock);
len = 0;
token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0005, -1, &work32, 36);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ 0x0005, -1, &result, sizeof(result));
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token, "0x0005 LAN Media Operation");
spin_unlock(&i2o_proc_lock);
return len;
}
len += sprintf(buf, "Connector type : %s\n",
- i2o_get_connector_type(work32[0]));
+ i2o_get_connector_type(result.connector_type));
len += sprintf(buf+len, "Connection type : %s\n",
- i2o_get_connection_type(work32[1]));
-
- len += sprintf(buf+len, "Current Tx wire speed : %d bps\n", (int)work64[1]);
- len += sprintf(buf+len, "Current Rx wire speed : %d bps\n", (int)work64[2]);
+ i2o_get_connection_type(result.connection_type));
- len += sprintf(buf+len, "Duplex mode : %s duplex\n",
- (work8[24]&1)?"Full":"Half");
+ len += sprintf(buf+len, "Current Tx wire speed : %d bps\n", (int)result.current_tx_wire_speed);
+ len += sprintf(buf+len, "Current Rx wire speed : %d bps\n", (int)result.current_rx_wire_speed);
+ len += sprintf(buf+len, "Duplex mode : %s duplex\n",
+ (result.duplex_mode)?"Full":"Half");
+
len += sprintf(buf+len, "Link status : ");
- if(work8[25] == 0x00)
+ switch (result.link_status)
+ {
+ case 0x00:
len += sprintf(buf+len, "Unknown\n");
- else if(work8[25] == 0x01)
+ break;
+ case 0x01:
len += sprintf(buf+len, "Normal\n");
- else if(work8[25] == 0x02)
+ break;
+ case 0x02:
len += sprintf(buf+len, "Failure\n");
- else if(work8[25] == 0x03)
+ break;
+ case 0x03:
len += sprintf(buf+len, "Reset\n");
- else
+ break;
+ default:
len += sprintf(buf+len, "Unspecified\n");
-
- if (d->i2oversion == 0x00) { /* Reserved in 1.53 and 2.0 */
+ }
+
+ if (d->i2oversion == 0x00) /* Reserved in 1.53 and 2.0 */
+ {
len += sprintf(buf+len, "Bad packets handled by : %s\n",
- (work8[26] == 0xFF)?"host":"DDM");
+ (result.reserved == 0xFF)?"host":"DDM");
}
- if (d->i2oversion != 0x00) {
+ else
+ {
len += sprintf(buf+len, "Duplex mode target : ");
- switch (work8[27]) {
+ switch (result.duplex_mode_target)
+ {
case 0:
len += sprintf(buf+len, "Half duplex\n");
break;
@@ -2188,69 +2489,59 @@
break;
default:
len += sprintf(buf+len, "\n");
- break;
}
len += sprintf(buf+len, "Connector type target : %s\n",
- i2o_get_connector_type(work32[7]));
+ i2o_get_connector_type(result.connector_type_target));
len += sprintf(buf+len, "Connection type target : %s\n",
- i2o_get_connection_type(work32[8]));
+ i2o_get_connection_type(result.connection_type_target));
}
spin_unlock(&i2o_proc_lock);
return len;
}
-/* LAN group 0006h - Alternate address (table) */
+/* LAN group 0006h - Alternate address (table) (optional) */
int i2o_proc_read_lan_alt_addr(char *buf, char **start, off_t offset, int len,
int *eof, void *data)
{
struct i2o_device *d = (struct i2o_device*)data;
- static u32 field32[64];
- static u8 *field8 = (u8 *)field32;
- static u16 *field16 = (u16 *)field32;
int token;
int i;
+ u8 alt_addr[8];
+ struct
+ {
+ u16 result_count;
+ u16 pad;
+ u16 block_size;
+ u8 block_status;
+ u8 error_info_size;
+ u16 row_count;
+ u16 more_flag;
+ u8 alt_addr[256][8];
+ } result;
spin_lock(&i2o_proc_lock);
len = 0;
token = i2o_query_table(I2O_PARAMS_TABLE_GET,
- d->controller, d->lct_data->tid, 0x0006, -1,
- NULL, 0, &field32, sizeof(field32));
+ d->controller, d->lct_data->tid,
+ 0x0006, -1, NULL, 0, &result, sizeof(result));
- if (token<0)
- switch (token) {
- case -ETIMEDOUT:
- len += sprintf(buf, "Timeout reading table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- case -ENOMEM:
- len += sprintf(buf, "No free memory to read the table.\n");
- spin_unlock(&i2o_proc_lock);
- return len;
- break;
- default:
- len += sprintf(buf, "Error reading field. BlockStatus %d\n",
- token);
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf,"RowCount=%d, MoreFlag=%d\n", field16[0],
- field16[1]);
-
- field8=(u8 *)&field16[2];
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token, "0x0006 LAN Alternate Address (optional)");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
- for(i=0; i<field16[0]; i++, field8+=8)
+ for (i=0; i < result.row_count; i++)
{
+ memcpy(alt_addr,result.alt_addr[i],8);
len += sprintf(buf+len, "Alternate address[%d]: "
"%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
- i,
- field8[0], field8[1], field8[2],
- field8[3], field8[4], field8[5],
- field8[6], field8[7]);
+ i, alt_addr[0], alt_addr[1], alt_addr[2],
+ alt_addr[3], alt_addr[4], alt_addr[5],
+ alt_addr[6], alt_addr[7]);
}
spin_unlock(&i2o_proc_lock);
@@ -2271,9 +2562,8 @@
token = i2o_query_scalar(d->controller, d->lct_data->tid,
0x0007, -1, &work32, 8*4);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0007 LAN Transmit Info");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -2304,12 +2594,15 @@
len += sprintf(buf+len, " RSVP checksum\n");
if(work32[4]&0x00001000)
len += sprintf(buf+len, " ICMP checksum\n");
- if (d->i2oversion == 0x00) {
+ if (d->i2oversion == 0x00)
+ {
if(work32[4]&0x00008000)
len += sprintf(buf+len, " Loopback enabled\n");
if(work32[4]&0x00010000)
len += sprintf(buf+len, " Loopback suppression enabled\n");
- } else {
+ }
+ else
+ {
if(work32[4]&0x00010000)
len += sprintf(buf+len, " Loopback enabled\n");
if(work32[4]&0x00020000)
@@ -2333,9 +2626,8 @@
token = i2o_query_scalar(d->controller, d->lct_data->tid,
0x0008, -1, &work32, 8*4);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0008 LAN Receive Info");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -2354,288 +2646,345 @@
return len;
}
+static int i2o_report_opt_field(char *buf, char *field_name,
+ int field_nbr, int supp_fields, u64 *value)
+{
+ if (supp_fields & (1 << field_nbr))
+ return sprintf(buf, "%-24s : " FMT_U64_HEX "\n", field_name, U64_VAL(value));
+ else
+ return sprintf(buf, "%-24s : Not supported\n", field_name);
+}
/* LAN group 0100h - LAN Historical statistics (scalar) */
+/* LAN group 0180h - Supported Optional Historical Statistics (scalar) */
+/* LAN group 0182h - Optional Non Media Specific Transmit Historical Statistics (scalar) */
+/* LAN group 0183h - Optional Non Media Specific Receive Historical Statistics (scalar) */
+
int i2o_proc_read_lan_hist_stats(char *buf, char **start, off_t offset, int len,
int *eof, void *data)
{
struct i2o_device *d = (struct i2o_device*)data;
- static u64 work64[9];
int token;
+ struct
+ {
+ u64 tx_packets;
+ u64 tx_bytes;
+ u64 rx_packets;
+ u64 rx_bytes;
+ u64 tx_errors;
+ u64 rx_errors;
+ u64 rx_dropped;
+ u64 adapter_resets;
+ u64 adapter_suspends;
+ } stats; // 0x0100
+
+ static u64 supp_groups[4]; // 0x0180
+
+ struct
+ {
+ u64 tx_retries;
+ u64 tx_directed_bytes;
+ u64 tx_directed_packets;
+ u64 tx_multicast_bytes;
+ u64 tx_multicast_packets;
+ u64 tx_broadcast_bytes;
+ u64 tx_broadcast_packets;
+ u64 tx_group_addr_packets;
+ u64 tx_short_packets;
+ } tx_stats; // 0x0182
+
+ struct
+ {
+ u64 rx_crc_errors;
+ u64 rx_directed_bytes;
+ u64 rx_directed_packets;
+ u64 rx_multicast_bytes;
+ u64 rx_multicast_packets;
+ u64 rx_broadcast_bytes;
+ u64 rx_broadcast_packets;
+ u64 rx_group_addr_packets;
+ u64 rx_short_packets;
+ u64 rx_long_packets;
+ u64 rx_runt_packets;
+ } rx_stats; // 0x0183
+
+ struct
+ {
+ u64 ipv4_generate;
+ u64 ipv4_validate_success;
+ u64 ipv4_validate_errors;
+ u64 tcp_generate;
+ u64 tcp_validate_success;
+ u64 tcp_validate_errors;
+ u64 udp_generate;
+ u64 udp_validate_success;
+ u64 udp_validate_errors;
+ u64 rsvp_generate;
+ u64 rsvp_validate_success;
+ u64 rsvp_validate_errors;
+ u64 icmp_generate;
+ u64 icmp_validate_success;
+ u64 icmp_validate_errors;
+ } chksum_stats; // 0x0184
+
spin_lock(&i2o_proc_lock);
len = 0;
token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0100, -1, &work64, 9*8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ 0x0100, -1, &stats, sizeof(stats));
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x100 LAN Statistics");
spin_unlock(&i2o_proc_lock);
return len;
}
- len += sprintf(buf, "Tx packets : " FMT_U64_HEX "\n",
- U64_VAL(&work64[0]));
+ len += sprintf(buf+len, "Tx packets : " FMT_U64_HEX "\n",
+ U64_VAL(&stats.tx_packets));
len += sprintf(buf+len, "Tx bytes : " FMT_U64_HEX "\n",
- U64_VAL(&work64[1]));
+ U64_VAL(&stats.tx_bytes));
len += sprintf(buf+len, "Rx packets : " FMT_U64_HEX "\n",
- U64_VAL(&work64[2]));
+ U64_VAL(&stats.rx_packets));
len += sprintf(buf+len, "Rx bytes : " FMT_U64_HEX "\n",
- U64_VAL(&work64[3]));
+ U64_VAL(&stats.rx_bytes));
len += sprintf(buf+len, "Tx errors : " FMT_U64_HEX "\n",
- U64_VAL(&work64[4]));
+ U64_VAL(&stats.tx_errors));
len += sprintf(buf+len, "Rx errors : " FMT_U64_HEX "\n",
- U64_VAL(&work64[5]));
+ U64_VAL(&stats.rx_errors));
len += sprintf(buf+len, "Rx dropped : " FMT_U64_HEX "\n",
- U64_VAL(&work64[6]));
+ U64_VAL(&stats.rx_dropped));
len += sprintf(buf+len, "Adapter resets : " FMT_U64_HEX "\n",
- U64_VAL(&work64[7]));
+ U64_VAL(&stats.adapter_resets));
len += sprintf(buf+len, "Adapter suspends : " FMT_U64_HEX "\n",
- U64_VAL(&work64[8]));
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}
-
-
-/* LAN group 0180h - Supported Optional Historical Statistics (scalar) */
-int i2o_proc_read_lan_supp_opt_stats(char *buf, char **start, off_t offset,
- int len, int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u64 work64[4];
- int token;
+ U64_VAL(&stats.adapter_suspends));
- spin_lock(&i2o_proc_lock);
-
- len = 0;
+ /* Optional statistics follows */
+ /* Get 0x0180 to see which optional groups/fields are supported */
token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0180, -1, &work64, 4*8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ 0x0180, -1, &supp_groups, sizeof(supp_groups));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token, "0x180 LAN Supported Optional Statistics");
spin_unlock(&i2o_proc_lock);
return len;
}
- if (d->i2oversion == 0x00)
- len += sprintf(buf, "Supported stats : " FMT_U64_HEX " \n",
- U64_VAL(&work64[0]));
- else
+ if (supp_groups[1]) /* 0x0182 */
{
- len += sprintf(buf, "Supported stats (0182h) : " FMT_U64_HEX " \n",
- U64_VAL(&work64[1]));
- len += sprintf(buf, "Supported stats (0183h) : " FMT_U64_HEX " \n",
- U64_VAL(&work64[2]));
- len += sprintf(buf, "Supported stats (0184h) : " FMT_U64_HEX " \n",
- U64_VAL(&work64[3]));
- }
+ token = i2o_query_scalar(d->controller, d->lct_data->tid,
+ 0x0182, -1, &tx_stats, sizeof(tx_stats));
- spin_unlock(&i2o_proc_lock);
- return len;
-}
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x182 LAN Optional Tx Historical Statistics");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
+ len += sprintf(buf+len, "==== Optional TX statistics (group 0182h)\n");
-/* LAN group 0182h - Optional Non Media Specific Transmit Historical Statistics
- * (scalar) */
-int i2o_proc_read_lan_opt_tx_hist_stats(char *buf, char **start, off_t offset,
- int len, int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u64 work64[9];
- int token;
-
- spin_lock(&i2o_proc_lock);
+ len += i2o_report_opt_field(buf+len, "Tx RetryCount",
+ 0, supp_groups[1], &tx_stats.tx_retries);
+ len += i2o_report_opt_field(buf+len, "Tx DirectedBytes",
+ 1, supp_groups[1], &tx_stats.tx_directed_bytes);
+ len += i2o_report_opt_field(buf+len, "Tx DirectedPackets",
+ 2, supp_groups[1], &tx_stats.tx_directed_packets);
+ len += i2o_report_opt_field(buf+len, "Tx MulticastBytes",
+ 3, supp_groups[1], &tx_stats.tx_multicast_bytes);
+ len += i2o_report_opt_field(buf+len, "Tx MulticastPackets",
+ 4, supp_groups[1], &tx_stats.tx_multicast_packets);
+ len += i2o_report_opt_field(buf+len, "Tx BroadcastBytes",
+ 5, supp_groups[1], &tx_stats.tx_broadcast_bytes);
+ len += i2o_report_opt_field(buf+len, "Tx BroadcastPackets",
+ 6, supp_groups[1], &tx_stats.tx_broadcast_packets);
+ len += i2o_report_opt_field(buf+len, "Tx TotalGroupAddrPackets",
+ 7, supp_groups[1], &tx_stats.tx_group_addr_packets);
+ len += i2o_report_opt_field(buf+len, "Tx TotalPacketsTooShort",
+ 8, supp_groups[1], &tx_stats.tx_short_packets);
+ }
+
+ if (supp_groups[2]) /* 0x0183 */
+ {
+ token = i2o_query_scalar(d->controller, d->lct_data->tid,
+ 0x0183, -1, &rx_stats, sizeof(rx_stats));
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x183 LAN Optional Rx Historical Stats");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
- len = 0;
+ len += sprintf(buf+len, "==== Optional RX statistics (group 0183h)\n");
- token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0182, -1, &work64, 9*8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
- spin_unlock(&i2o_proc_lock);
- return len;
+ len += i2o_report_opt_field(buf+len, "Rx CRCErrorCount",
+ 0, supp_groups[2], &rx_stats.rx_crc_errors);
+ len += i2o_report_opt_field(buf+len, "Rx DirectedBytes",
+ 1, supp_groups[2], &rx_stats.rx_directed_bytes);
+ len += i2o_report_opt_field(buf+len, "Rx DirectedPackets",
+ 2, supp_groups[2], &rx_stats.rx_directed_packets);
+ len += i2o_report_opt_field(buf+len, "Rx MulticastBytes",
+ 3, supp_groups[2], &rx_stats.rx_multicast_bytes);
+ len += i2o_report_opt_field(buf+len, "Rx MulticastPackets",
+ 4, supp_groups[2], &rx_stats.rx_multicast_packets);
+ len += i2o_report_opt_field(buf+len, "Rx BroadcastBytes",
+ 5, supp_groups[2], &rx_stats.rx_broadcast_bytes);
+ len += i2o_report_opt_field(buf+len, "Rx BroadcastPackets",
+ 6, supp_groups[2], &rx_stats.rx_broadcast_packets);
+ len += i2o_report_opt_field(buf+len, "Rx TotalGroupAddrPackets",
+ 7, supp_groups[2], &rx_stats.rx_group_addr_packets);
+ len += i2o_report_opt_field(buf+len, "Rx TotalPacketsTooShort",
+ 8, supp_groups[2], &rx_stats.rx_short_packets);
+ len += i2o_report_opt_field(buf+len, "Rx TotalPacketsTooLong",
+ 9, supp_groups[2], &rx_stats.rx_long_packets);
+ len += i2o_report_opt_field(buf+len, "Rx TotalPacketsRunt",
+ 10, supp_groups[2], &rx_stats.rx_runt_packets);
}
+
+ if (supp_groups[3]) /* 0x0184 */
+ {
+ token = i2o_query_scalar(d->controller, d->lct_data->tid,
+ 0x0184, -1, &chksum_stats, sizeof(chksum_stats));
- len += sprintf(buf, "TxRetryCount : " FMT_U64_HEX "\n",
- U64_VAL(&work64[0]));
- len += sprintf(buf+len, "DirectedBytesTx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[1]));
- len += sprintf(buf+len, "DirectedPacketsTx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[2]));
- len += sprintf(buf+len, "MulticastBytesTx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[3]));
- len += sprintf(buf+len, "MulticastPacketsTx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[4]));
- len += sprintf(buf+len, "BroadcastBytesTx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[5]));
- len += sprintf(buf+len, "BroadcastPacketsTx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[6]));
- len += sprintf(buf+len, "TotalGroupAddrTxCount : " FMT_U64_HEX "\n",
- U64_VAL(&work64[7]));
- len += sprintf(buf+len, "TotalTxPacketsTooShort : " FMT_U64_HEX "\n",
- U64_VAL(&work64[8]));
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}
-
-/* LAN group 0183h - Optional Non Media Specific Receive Historical Statistics
- * (scalar) */
-int i2o_proc_read_lan_opt_rx_hist_stats(char *buf, char **start, off_t offset,
- int len, int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u64 work64[11];
- int token;
-
- spin_lock(&i2o_proc_lock);
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x184 LAN Optional Chksum Historical Stats");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
- len = 0;
+ len += sprintf(buf+len, "==== Optional CHKSUM statistics (group 0x0184)\n");
- token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0183, -1, &work64, 11*8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
- spin_unlock(&i2o_proc_lock);
- return len;
+ len += i2o_report_opt_field(buf+len, "IPv4 Generate",
+ 0, supp_groups[3], &chksum_stats.ipv4_generate);
+ len += i2o_report_opt_field(buf+len, "IPv4 ValidateSuccess",
+ 1, supp_groups[3], &chksum_stats.ipv4_validate_success);
+ len += i2o_report_opt_field(buf+len, "IPv4 ValidateError",
+ 2, supp_groups[3], &chksum_stats.ipv4_validate_errors);
+ len += i2o_report_opt_field(buf+len, "TCP Generate",
+ 3, supp_groups[3], &chksum_stats.tcp_generate);
+ len += i2o_report_opt_field(buf+len, "TCP ValidateSuccess",
+ 4, supp_groups[3], &chksum_stats.tcp_validate_success);
+ len += i2o_report_opt_field(buf+len, "TCP ValidateError",
+ 5, supp_groups[3], &chksum_stats.tcp_validate_errors);
+ len += i2o_report_opt_field(buf+len, "UDP Generate",
+ 6, supp_groups[3], &chksum_stats.udp_generate);
+ len += i2o_report_opt_field(buf+len, "UDP ValidateSuccess",
+ 7, supp_groups[3], &chksum_stats.udp_validate_success);
+ len += i2o_report_opt_field(buf+len, "UDP ValidateError",
+ 8, supp_groups[3], &chksum_stats.udp_validate_errors);
+ len += i2o_report_opt_field(buf+len, "RSVP Generate",
+ 9, supp_groups[3], &chksum_stats.rsvp_generate);
+ len += i2o_report_opt_field(buf+len, "RSVP ValidateSuccess",
+ 10, supp_groups[3], &chksum_stats.rsvp_validate_success);
+ len += i2o_report_opt_field(buf+len, "RSVP ValidateError",
+ 11, supp_groups[3], &chksum_stats.rsvp_validate_errors);
+ len += i2o_report_opt_field(buf+len, "ICMP Generate",
+ 12, supp_groups[3], &chksum_stats.icmp_generate);
+ len += i2o_report_opt_field(buf+len, "ICMP ValidateSuccess",
+ 13, supp_groups[3], &chksum_stats.icmp_validate_success);
+ len += i2o_report_opt_field(buf+len, "ICMP ValidateError",
+ 14, supp_groups[3], &chksum_stats.icmp_validate_errors);
}
- len += sprintf(buf, "ReceiveCRCErrorCount : " FMT_U64_HEX "\n",
- U64_VAL(&work64[0]));
- len += sprintf(buf+len, "DirectedBytesRx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[1]));
- len += sprintf(buf+len, "DirectedPacketsRx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[2]));
- len += sprintf(buf+len, "MulticastBytesRx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[3]));
- len += sprintf(buf+len, "MulticastPacketsRx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[4]));
- len += sprintf(buf+len, "BroadcastBytesRx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[5]));
- len += sprintf(buf+len, "BroadcastPacketsRx : " FMT_U64_HEX "\n",
- U64_VAL(&work64[6]));
- len += sprintf(buf+len, "TotalGroupAddrRxCount : " FMT_U64_HEX "\n",
- U64_VAL(&work64[7]));
- len += sprintf(buf+len, "TotalRxPacketsTooShort : " FMT_U64_HEX "\n",
- U64_VAL(&work64[8]));
- len += sprintf(buf+len, "TotalRxPacketsTooLong : " FMT_U64_HEX "\n",
- U64_VAL(&work64[9]));
- len += sprintf(buf+len, "TotalRuntPacketsReceived : " FMT_U64_HEX "\n",
- U64_VAL(&work64[10]));
-
spin_unlock(&i2o_proc_lock);
return len;
}
/* LAN group 0200h - Required Ethernet Statistics (scalar) */
+/* LAN group 0280h - Optional Ethernet Statistics Supported (scalar) */
+/* LAN group 0281h - Optional Ethernet Historical Statistics (scalar) */
int i2o_proc_read_lan_eth_stats(char *buf, char **start, off_t offset,
int len, int *eof, void *data)
{
struct i2o_device *d = (struct i2o_device*)data;
- static u64 work64[8];
int token;
+ struct
+ {
+ u64 rx_align_errors;
+ u64 tx_one_collisions;
+ u64 tx_multiple_collisions;
+ u64 tx_deferred;
+ u64 tx_late_collisions;
+ u64 tx_max_collisions;
+ u64 tx_carrier_lost;
+ u64 tx_excessive_deferrals;
+ } stats;
- spin_lock(&i2o_proc_lock);
-
+ static u64 supp_fields;
+ struct
+ {
+ u64 rx_overrun;
+ u64 tx_underrun;
+ u64 tx_heartbeat_failure;
+ } hist_stats;
+
+ spin_lock(&i2o_proc_lock);
len = 0;
- token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0200, -1, &work64, 8*8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ token = i2o_query_scalar(d->controller, d->lct_data->tid,
+ 0x0200, -1, &stats, sizeof(stats));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0200 LAN Ethernet Statistics");
spin_unlock(&i2o_proc_lock);
return len;
}
- len += sprintf(buf, "Rx alignment errors : " FMT_U64_HEX "\n",
- U64_VAL(&work64[0]));
+ len += sprintf(buf+len, "Rx alignment errors : " FMT_U64_HEX "\n",
+ U64_VAL(&stats.rx_align_errors));
len += sprintf(buf+len, "Tx one collisions : " FMT_U64_HEX "\n",
- U64_VAL(&work64[1]));
+ U64_VAL(&stats.tx_one_collisions));
len += sprintf(buf+len, "Tx multicollisions : " FMT_U64_HEX "\n",
- U64_VAL(&work64[2]));
+ U64_VAL(&stats.tx_multiple_collisions));
len += sprintf(buf+len, "Tx deferred : " FMT_U64_HEX "\n",
- U64_VAL(&work64[3]));
+ U64_VAL(&stats.tx_deferred));
len += sprintf(buf+len, "Tx late collisions : " FMT_U64_HEX "\n",
- U64_VAL(&work64[4]));
+ U64_VAL(&stats.tx_late_collisions));
len += sprintf(buf+len, "Tx max collisions : " FMT_U64_HEX "\n",
- U64_VAL(&work64[5]));
+ U64_VAL(&stats.tx_max_collisions));
len += sprintf(buf+len, "Tx carrier lost : " FMT_U64_HEX "\n",
- U64_VAL(&work64[6]));
+ U64_VAL(&stats.tx_carrier_lost));
len += sprintf(buf+len, "Tx excessive deferrals : " FMT_U64_HEX "\n",
- U64_VAL(&work64[7]));
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}
-
-/* LAN group 0280h - Supported Ethernet Historical Statistics (scalar) */
-int i2o_proc_read_lan_supp_eth_stats(char *buf, char **start, off_t offset,
- int len, int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u64 work64[1];
- int token;
+ U64_VAL(&stats.tx_excessive_deferrals));
- spin_lock(&i2o_proc_lock);
+ /* Optional Ethernet statistics follows */
+ /* Get 0x0280 to see which optional fields are supported */
- len = 0;
+ token = i2o_query_scalar(d->controller, d->lct_data->tid,
+ 0x0280, -1, &supp_fields, sizeof(supp_fields));
- token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0280, -1, &work64, 8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0280 LAN Supported Optional Ethernet Statistics");
spin_unlock(&i2o_proc_lock);
return len;
}
- len += sprintf(buf, "Supported stats : " FMT_U64_HEX "\n",
- U64_VAL(&work64[0]));
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}
-
-/* LAN group 0281h - Optional Ethernet Historical Statistics (scalar) */
-int i2o_proc_read_lan_opt_eth_stats(char *buf, char **start, off_t offset,
- int len, int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u64 work64[3];
- int token;
+ if (supp_fields) /* 0x0281 */
+ {
+ token = i2o_query_scalar(d->controller, d->lct_data->tid,
+ 0x0281, -1, &stats, sizeof(stats));
- spin_lock(&i2o_proc_lock);
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0281 LAN Optional Ethernet Statistics");
+ spin_unlock(&i2o_proc_lock);
+ return len;
+ }
- len = 0;
+ len += sprintf(buf+len, "==== Optional ETHERNET statistics (group 0x0281)\n");
- token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0281, -1, &work64, 3*8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
- spin_unlock(&i2o_proc_lock);
- return len;
+ len += i2o_report_opt_field(buf+len, "Rx Overrun",
+ 0, supp_fields, &hist_stats.rx_overrun);
+ len += i2o_report_opt_field(buf+len, "Tx Underrun",
+ 1, supp_fields, &hist_stats.tx_underrun);
+ len += i2o_report_opt_field(buf+len, "Tx HeartbeatFailure",
+ 2, supp_fields, &hist_stats.tx_heartbeat_failure);
}
- len += sprintf(buf, "Rx overrun : " FMT_U64_HEX "\n",
- U64_VAL(&work64[0]));
- len += sprintf(buf, "Tx underrun : " FMT_U64_HEX "\n",
- U64_VAL(&work64[1]));
- len += sprintf(buf, "Tx heartbeat failure : " FMT_U64_HEX "\n",
- U64_VAL(&work64[2]));
-
spin_unlock(&i2o_proc_lock);
return len;
}
/* LAN group 0300h - Required Token Ring Statistics (scalar) */
+/* LAN group 0380h, 0381h - Optional Statistics not yet defined (TODO) */
int i2o_proc_read_lan_tr_stats(char *buf, char **start, off_t offset,
int len, int *eof, void *data)
{
@@ -2663,15 +3012,14 @@
"Signal Loss"
};
- spin_lock(&i2o_proc_lock);
-
+ spin_lock(&i2o_proc_lock);
len = 0;
- token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0300, -1, &work64, 13*8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ token = i2o_query_scalar(d->controller, d->lct_data->tid,
+ 0x0300, -1, &work64, sizeof(work64));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0300 Token Ring Statistics");
spin_unlock(&i2o_proc_lock);
return len;
}
@@ -2707,6 +3055,7 @@
}
/* LAN group 0400h - Required FDDI Statistics (scalar) */
+/* LAN group 0480h, 0481h - Optional Statistics, not yet defined (TODO) */
int i2o_proc_read_lan_fddi_stats(char *buf, char **start, off_t offset,
int len, int *eof, void *data)
{
@@ -2758,19 +3107,18 @@
};
spin_lock(&i2o_proc_lock);
-
len = 0;
token = i2o_query_scalar(d->controller, d->lct_data->tid,
- 0x0400, -1, &work64, 11*8);
- if(token < 0)
- {
- len += sprintf(buf, "Timeout waiting for reply from IOP\n");
+ 0x0400, -1, &work64, sizeof(work64));
+
+ if (token < 0) {
+ len += i2o_report_query_status(buf+len, token,"0x0400 FDDI Required Statistics");
spin_unlock(&i2o_proc_lock);
return len;
}
- len += sprintf(buf, "ConfigurationState : %s\n", conf_state[work64[0]]);
+ len += sprintf(buf+len, "ConfigurationState : %s\n", conf_state[work64[0]]);
len += sprintf(buf+len, "UpstreamNode : " FMT_U64_HEX "\n",
U64_VAL(&work64[1]));
len += sprintf(buf+len, "DownStreamNode : " FMT_U64_HEX "\n",
@@ -2780,7 +3128,7 @@
len += sprintf(buf+len, "FramesLost : " FMT_U64_HEX "\n",
U64_VAL(&work64[4]));
len += sprintf(buf+len, "RingMgmtState : %s\n", ring_state[work64[5]]);
- len += sprintf(buf+len, "LCTFailures: " FMT_U64_HEX "\n",
+ len += sprintf(buf+len, "LCTFailures : " FMT_U64_HEX "\n",
U64_VAL(&work64[6]));
len += sprintf(buf+len, "LEMRejects : " FMT_U64_HEX "\n",
U64_VAL(&work64[7]));
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)