- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0000, -1, &work32, 56*4);
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token, "0x0000 LAN Device Info");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf, "LAN Type : ");
- switch (work16[0])
- {
- case 0x0030:
- len += sprintf(buf+len, "Ethernet, ");
- break;
- case 0x0040:
- len += sprintf(buf+len, "100Base VG, ");
- break;
- case 0x0050:
- len += sprintf(buf+len, "Token Ring, ");
- break;
- case 0x0060:
- len += sprintf(buf+len, "FDDI, ");
- break;
- case 0x0070:
- len += sprintf(buf+len, "Fibre Channel, ");
- break;
- default:
- len += sprintf(buf+len, "Unknown type (0x%04x), ", work16[0]);
- break;
- }
-
- if (work16[1]&0x00000001)
- len += sprintf(buf+len, "emulated LAN, ");
- else
- len += sprintf(buf+len, "physical LAN port, ");
-
- if (work16[1]&0x00000002)
- len += sprintf(buf+len, "full duplex\n");
- else
- len += sprintf(buf+len, "simplex\n");
-
- len += sprintf(buf+len, "Address format : ");
- switch(work8[4]) {
- case 0x00:
- len += sprintf(buf+len, "IEEE 48bit\n");
- break;
- case 0x01:
- len += sprintf(buf+len, "FC IEEE\n");
- break;
- default:
- len += sprintf(buf+len, "Unknown (0x%02x)\n", work8[4]);
- break;
- }
-
- len += sprintf(buf+len, "State : ");
- switch(work8[5])
- {
- case 0x00:
- len += sprintf(buf+len, "Unknown\n");
- break;
- case 0x01:
- len += sprintf(buf+len, "Unclaimed\n");
- break;
- case 0x02:
- len += sprintf(buf+len, "Operational\n");
- break;
- case 0x03:
- len += sprintf(buf+len, "Suspended\n");
- break;
- case 0x04:
- len += sprintf(buf+len, "Resetting\n");
- break;
- case 0x05:
- len += sprintf(buf+len, "ERROR: ");
- if(work16[3]&0x0001)
- len += sprintf(buf+len, "TxCU inoperative ");
- if(work16[3]&0x0002)
- len += sprintf(buf+len, "RxCU inoperative ");
- if(work16[3]&0x0004)
- len += sprintf(buf+len, "Local mem alloc ");
- len += sprintf(buf+len, "\n");
- break;
- case 0x06:
- len += sprintf(buf+len, "Operational no Rx\n");
- break;
- case 0x07:
- len += sprintf(buf+len, "Suspended no Rx\n");
- break;
- default:
- len += sprintf(buf+len, "Unspecified\n");
- break;
- }
-
- len += sprintf(buf+len, "Min packet size : %d\n", work32[2]);
- len += sprintf(buf+len, "Max packet size : %d\n", work32[3]);
- len += sprintf(buf+len, "HW address : "
- "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
- work8[16],work8[17],work8[18],work8[19],
- work8[20],work8[21],work8[22],work8[23]);
-
- len += sprintf(buf+len, "Max Tx wire speed : %d bps\n", (int)work64[3]);
- len += sprintf(buf+len, "Max Rx wire speed : %d bps\n", (int)work64[4]);
-
- len += sprintf(buf+len, "Min SDU packet size : 0x%08x\n", work32[10]);
- len += sprintf(buf+len, "Max SDU packet size : 0x%08x\n", work32[11]);
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}
-
-/* LAN group 0001h - MAC address table (scalar) */
-int i2o_proc_read_lan_mac_addr(char *buf, char **start, off_t offset, int len,
- int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u32 work32[48];
- static u8 *work8 = (u8*)work32;
- int token;
-
- spin_lock(&i2o_proc_lock);
- len = 0;
-
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0001, -1, &work32, 48*4);
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x0001 LAN MAC Address");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf, "Active address : "
- "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
- work8[0],work8[1],work8[2],work8[3],
- work8[4],work8[5],work8[6],work8[7]);
- len += sprintf(buf+len, "Current address : "
- "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
- work8[8],work8[9],work8[10],work8[11],
- work8[12],work8[13],work8[14],work8[15]);
- len += sprintf(buf+len, "Functional address mask : "
- "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
- work8[16],work8[17],work8[18],work8[19],
- work8[20],work8[21],work8[22],work8[23]);
-
- len += sprintf(buf+len,"HW/DDM capabilities : 0x%08x\n", work32[7]);
- len += sprintf(buf+len," [%s] Unicast packets supported\n",
- (work32[7]&0x00000001)?"+":"-");
- len += sprintf(buf+len," [%s] Promiscuous mode supported\n",
- (work32[7]&0x00000002)?"+":"-");
- len += sprintf(buf+len," [%s] Promiscuous multicast mode supported\n",
- (work32[7]&0x00000004)?"+":"-");
- len += sprintf(buf+len," [%s] Broadcast reception disabling supported\n",
- (work32[7]&0x00000100)?"+":"-");
- len += sprintf(buf+len," [%s] Multicast reception disabling supported\n",
- (work32[7]&0x00000200)?"+":"-");
- len += sprintf(buf+len," [%s] Functional address disabling supported\n",
- (work32[7]&0x00000400)?"+":"-");
- len += sprintf(buf+len," [%s] MAC reporting supported\n",
- (work32[7]&0x00000800)?"+":"-");
-
- len += sprintf(buf+len,"Filter mask : 0x%08x\n", work32[6]);
- len += sprintf(buf+len," [%s] Unicast packets disable\n",
- (work32[6]&0x00000001)?"+":"-");
- len += sprintf(buf+len," [%s] Promiscuous mode enable\n",
- (work32[6]&0x00000002)?"+":"-");
- len += sprintf(buf+len," [%s] Promiscuous multicast mode enable\n",
- (work32[6]&0x00000004)?"+":"-");
- len += sprintf(buf+len," [%s] Broadcast packets disable\n",
- (work32[6]&0x00000100)?"+":"-");
- len += sprintf(buf+len," [%s] Multicast packets disable\n",
- (work32[6]&0x00000200)?"+":"-");
- len += sprintf(buf+len," [%s] Functional address disable\n",
- (work32[6]&0x00000400)?"+":"-");
-
- if (work32[7]&0x00000800) {
- len += sprintf(buf+len, " MAC reporting mode : ");
- if (work32[6]&0x00000800)
- len += sprintf(buf+len, "Pass only priority MAC packets to user\n");
- else if (work32[6]&0x00001000)
- len += sprintf(buf+len, "Pass all MAC packets to user\n");
- else if (work32[6]&0x00001800)
- len += sprintf(buf+len, "Pass all MAC packets (promiscuous) to user\n");
- else
- len += sprintf(buf+len, "Do not pass MAC packets to user\n");
- }
- len += sprintf(buf+len, "Number of multicast addresses : %d\n", work32[8]);
- len += sprintf(buf+len, "Perfect filtering for max %d multicast addresses\n",
- work32[9]);
- len += sprintf(buf+len, "Imperfect filtering for max %d multicast addresses\n",
- work32[10]);
-
- spin_unlock(&i2o_proc_lock);
-
- return len;
-}
-
-/* LAN group 0002h - Multicast MAC address table (table) */
-int i2o_proc_read_lan_mcast_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 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;
-}
-
-
-/* LAN group 0007h - Transmit info (scalar) */
-int i2o_proc_read_lan_tx_info(char *buf, char **start, off_t offset, int len,
- int *eof, void *data)
-{
- struct i2o_device *d = (struct i2o_device*)data;
- static u32 work32[8];
- int token;
-
- spin_lock(&i2o_proc_lock);
- len = 0;
-
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0007, -1, &work32, 8*4);
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x0007 LAN Transmit Info");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf, "Tx Max SG elements per packet : %d\n", work32[0]);
- len += sprintf(buf+len, "Tx Max SG elements per chain : %d\n", work32[1]);
- len += sprintf(buf+len, "Tx Max outstanding packets : %d\n", work32[2]);
- len += sprintf(buf+len, "Tx Max packets per request : %d\n", work32[3]);
-
- len += sprintf(buf+len, "Tx modes : 0x%08x\n", work32[4]);
- len += sprintf(buf+len, " [%s] No DA in SGL\n",
- (work32[4]&0x00000002) ? "+" : "-");
- len += sprintf(buf+len, " [%s] CRC suppression\n",
- (work32[4]&0x00000004) ? "+" : "-");
- len += sprintf(buf+len, " [%s] MAC insertion\n",
- (work32[4]&0x00000010) ? "+" : "-");
- len += sprintf(buf+len, " [%s] RIF insertion\n",
- (work32[4]&0x00000020) ? "+" : "-");
- len += sprintf(buf+len, " [%s] IPv4 checksum generation\n",
- (work32[4]&0x00000100) ? "+" : "-");
- len += sprintf(buf+len, " [%s] TCP checksum generation\n",
- (work32[4]&0x00000200) ? "+" : "-");
- len += sprintf(buf+len, " [%s] UDP checksum generation\n",
- (work32[4]&0x00000400) ? "+" : "-");
- len += sprintf(buf+len, " [%s] RSVP checksum generation\n",
- (work32[4]&0x00000800) ? "+" : "-");
- len += sprintf(buf+len, " [%s] ICMP checksum generation\n",
- (work32[4]&0x00001000) ? "+" : "-");
- len += sprintf(buf+len, " [%s] Loopback enabled\n",
- (work32[4]&0x00010000) ? "+" : "-");
- len += sprintf(buf+len, " [%s] Loopback suppression enabled\n",
- (work32[4]&0x00020000) ? "+" : "-");
-
- spin_unlock(&i2o_proc_lock);
- return len;
-}