- struct i2o_device *d = (struct i2o_device*)data;
- 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;
-
- result = kmalloc(sizeof(*result), GFP_KERNEL);
- if(!result)
- return -ENOMEM;
-
- 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, result, sizeof(*result));
-
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x002 LAN Multicast MAC Address");
- goto out;
- }
-
- 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, mc_addr[0], mc_addr[1], mc_addr[2],
- mc_addr[3], mc_addr[4], mc_addr[5],
- mc_addr[6], mc_addr[7]);
- }
-out:
- spin_unlock(&i2o_proc_lock);
- kfree(result);
- return len;
-}
-
-/* LAN group 0003h - Batch Control (scalar) */
-int i2o_proc_read_lan_batch_control(char *buf, char **start, off_t offset,
- int len, int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u32 work32[9];
- int token;
-
- spin_lock(&i2o_proc_lock);
- len = 0;
-
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0003, -1, &work32, 9*4);
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x0003 LAN Batch Control");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf, "Batch mode ");
- if (work32[0]&0x00000001)
- len += sprintf(buf+len, "disabled");
- else
- len += sprintf(buf+len, "enabled");
- if (work32[0]&0x00000002)
- len += sprintf(buf+len, " (current setting)");
- if (work32[0]&0x00000004)
- len += sprintf(buf+len, ", forced");
- else
- len += sprintf(buf+len, ", toggle");
- len += sprintf(buf+len, "\n");
-
- 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 Tx batch delay : %d\n", work32[7]);
- len += sprintf(buf+len, "Max Tx batch count : %d\n", work32[8]);
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}
-
-/* LAN group 0004h - LAN Operation (scalar) */
-int i2o_proc_read_lan_operation(char *buf, char **start, off_t offset, int len,
- int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u32 work32[5];
- int token;
-
- spin_lock(&i2o_proc_lock);
- len = 0;
-
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0004, -1, &work32, 20);
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x0004 LAN Operation");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf, "Packet prepadding (32b words) : %d\n", work32[0]);
- 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");
- len += sprintf(buf+len, "Packet orphan limit : %d\n", work32[2]);
-
- len += sprintf(buf+len, "Tx modes : 0x%08x\n", work32[3]);
- len += sprintf(buf+len, " [%s] HW CRC suppression\n",
- (work32[3]&0x00000004) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW IPv4 checksum\n",
- (work32[3]&0x00000100) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW TCP checksum\n",
- (work32[3]&0x00000200) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW UDP checksum\n",
- (work32[3]&0x00000400) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW RSVP checksum\n",
- (work32[3]&0x00000800) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW ICMP checksum\n",
- (work32[3]&0x00001000) ? "+" : "-");
- len += sprintf(buf+len, " [%s] Loopback suppression enable\n",
- (work32[3]&0x00002000) ? "+" : "-");
-
- len += sprintf(buf+len, "Rx modes : 0x%08x\n", work32[4]);
- len += sprintf(buf+len, " [%s] FCS in payload\n",
- (work32[4]&0x00000004) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW IPv4 checksum validation\n",
- (work32[4]&0x00000100) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW TCP checksum validation\n",
- (work32[4]&0x00000200) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW UDP checksum validation\n",
- (work32[4]&0x00000400) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW RSVP checksum validation\n",
- (work32[4]&0x00000800) ? "+" : "-");
- len += sprintf(buf+len, " [%s] HW ICMP checksum validation\n",
- (work32[4]&0x00001000) ? "+" : "-");
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}
-
-/* LAN group 0005h - Media operation (scalar) */
-int i2o_proc_read_lan_media_operation(char *buf, char **start, off_t offset,
- int len, int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- 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, &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(result.connector_type));
- len += sprintf(buf+len, "Connection type : %s\n",
- i2o_get_connection_type(result.connection_type));
-
- 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 : ");
- switch (result.link_status)
- {
- case 0x00:
- len += sprintf(buf+len, "Unknown\n");
- break;
- case 0x01:
- len += sprintf(buf+len, "Normal\n");
- break;
- case 0x02:
- len += sprintf(buf+len, "Failure\n");
- break;
- case 0x03:
- len += sprintf(buf+len, "Reset\n");
- break;
- default:
- len += sprintf(buf+len, "Unspecified\n");
- }
-
- len += sprintf(buf+len, "Duplex mode target : ");
- switch (result.duplex_mode_target){
- case 0:
- len += sprintf(buf+len, "Half duplex\n");
- break;
- case 1:
- len += sprintf(buf+len, "Full duplex\n");
- break;
- default:
- len += sprintf(buf+len, "\n");
- }
-
- len += sprintf(buf+len, "Connector type target : %s\n",
- i2o_get_connector_type(result.connector_type_target));
- len += sprintf(buf+len, "Connection type target : %s\n",
- i2o_get_connection_type(result.connection_type_target));
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}
-
-/* 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;
- 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;
-
- result = kmalloc(sizeof(*result), GFP_KERNEL);
- if(!result)
- return -ENOMEM;
-
- 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, result, sizeof(*result));
-
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token, "0x0006 LAN Alternate Address (optional)");
- goto out;
- }
-
- 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, alt_addr[0], alt_addr[1], alt_addr[2],
- alt_addr[3], alt_addr[4], alt_addr[5],
- alt_addr[6], alt_addr[7]);
- }
-out:
- spin_unlock(&i2o_proc_lock);
- kfree(result);
- return len;
-}