📄 i2o_proc.c
字号:
return 0; } if (result.row_count) seq_printf(seq, "# AdapterId\n"); for (i = 0; i < result.row_count; i++) { seq_printf(seq, "%-2d", i); seq_printf(seq, "%#7x\n", result.adapter_id[i]); } if (result.more_flag) seq_printf(seq, "There is more...\n"); return 0;}/* Generic group F002h - Claimed Table (table) */static int i2o_seq_show_claimed(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; 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; u16 claimed_tid[64]; } result; token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF002, -1, NULL, 0, &result, sizeof(result)); if (token < 0) { i2o_report_query_status(seq, token, "0xF002 Claimed Table"); return 0; } if (result.row_count) seq_printf(seq, "# ClaimedTid\n"); for (i = 0; i < result.row_count; i++) { seq_printf(seq, "%-2d", i); seq_printf(seq, "%#7x\n", result.claimed_tid[i]); } if (result.more_flag) seq_printf(seq, "There is more...\n"); return 0;}/* Generic group F003h - User Table (table) */static int i2o_seq_show_users(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; 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; result = kmalloc(sizeof(*result), GFP_KERNEL); if (!result) return -ENOMEM; token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF003, -1, NULL, 0, result, sizeof(*result)); if (token < 0) { i2o_report_query_status(seq, token, "0xF003 User Table"); goto out; } seq_printf(seq, "# Instance UserTid ClaimType\n"); for (i = 0; i < result->row_count; i++) { seq_printf(seq, "%-3d", i); seq_printf(seq, "%#8x ", result->user[i].instance); seq_printf(seq, "%#7x ", result->user[i].user_tid); seq_printf(seq, "%#9x\n", result->user[i].claim_type); } if (result->more_flag) seq_printf(seq, "There is more...\n"); out: kfree(result); return 0;}/* Generic group F005h - Private message extensions (table) (optional) */static int i2o_seq_show_priv_msgs(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; 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; token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF000, -1, NULL, 0, &result, sizeof(result)); if (token < 0) { i2o_report_query_status(seq, token, "0xF005 Private Message Extensions (optional)"); return 0; } seq_printf(seq, "Instance# OrgId FunctionCode\n"); for (i = 0; i < result.row_count; i++) { seq_printf(seq, "%0#9x ", result.extension[i].ext_instance); seq_printf(seq, "%0#6x ", result.extension[i].organization_id); seq_printf(seq, "%0#6x", result.extension[i].x_function_code); seq_printf(seq, "\n"); } if (result.more_flag) seq_printf(seq, "There is more...\n"); return 0;}/* Generic group F006h - Authorized User Table (table) */static int i2o_seq_show_authorized_users(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; 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; token = i2o_parm_table_get(d, I2O_PARAMS_TABLE_GET, 0xF006, -1, NULL, 0, &result, sizeof(result)); if (token < 0) { i2o_report_query_status(seq, token, "0xF006 Autohorized User Table"); return 0; } if (result.row_count) seq_printf(seq, "# AlternateTid\n"); for (i = 0; i < result.row_count; i++) { seq_printf(seq, "%-2d", i); seq_printf(seq, "%#7x ", result.alternate_tid[i]); } if (result.more_flag) seq_printf(seq, "There is more...\n"); return 0;}/* Generic group F100h - Device Identity (scalar) */static int i2o_seq_show_dev_identity(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; static u32 work32[128]; // allow for "stuff" + up to 256 byte (max) serial number // == (allow) 512d bytes (max) static u16 *work16 = (u16 *) work32; int token; token = i2o_parm_field_get(d, 0xF100, -1, &work32, sizeof(work32)); if (token < 0) { i2o_report_query_status(seq, token, "0xF100 Device Identity"); return 0; } seq_printf(seq, "Device Class : %s\n", i2o_get_class_name(work16[0])); seq_printf(seq, "Owner TID : %0#5x\n", work16[2]); seq_printf(seq, "Parent TID : %0#5x\n", work16[3]); seq_printf(seq, "Vendor info : %s\n", chtostr((u8 *) (work32 + 2), 16)); seq_printf(seq, "Product info : %s\n", chtostr((u8 *) (work32 + 6), 16)); seq_printf(seq, "Description : %s\n", chtostr((u8 *) (work32 + 10), 16)); seq_printf(seq, "Product rev. : %s\n", chtostr((u8 *) (work32 + 14), 8)); seq_printf(seq, "Serial number : "); print_serial_number(seq, (u8 *) (work32 + 16), /* allow for SNLen plus * possible trailing '\0' */ sizeof(work32) - (16 * sizeof(u32)) - 2); seq_printf(seq, "\n"); return 0;}static int i2o_seq_show_dev_name(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; seq_printf(seq, "%s\n", d->device.bus_id); return 0;}/* Generic group F101h - DDM Identity (scalar) */static int i2o_seq_show_ddm_identity(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; 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; token = i2o_parm_field_get(d, 0xF101, -1, &result, sizeof(result)); if (token < 0) { i2o_report_query_status(seq, token, "0xF101 DDM Identity"); return 0; } seq_printf(seq, "Registering DDM TID : 0x%03x\n", result.ddm_tid); seq_printf(seq, "Module name : %s\n", chtostr(result.module_name, 24)); seq_printf(seq, "Module revision : %s\n", chtostr(result.module_rev, 8)); seq_printf(seq, "Serial number : "); print_serial_number(seq, result.serial_number, sizeof(result) - 36); /* allow for SNLen plus possible trailing '\0' */ seq_printf(seq, "\n"); return 0;}/* Generic group F102h - User Information (scalar) */static int i2o_seq_show_uinfo(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; int token; struct { u8 device_name[64]; u8 service_name[64]; u8 physical_location[64]; u8 instance_number[4]; } result; token = i2o_parm_field_get(d, 0xF102, -1, &result, sizeof(result)); if (token < 0) { i2o_report_query_status(seq, token, "0xF102 User Information"); return 0; } seq_printf(seq, "Device name : %s\n", chtostr(result.device_name, 64)); seq_printf(seq, "Service name : %s\n", chtostr(result.service_name, 64)); seq_printf(seq, "Physical name : %s\n", chtostr(result.physical_location, 64)); seq_printf(seq, "Instance number : %s\n", chtostr(result.instance_number, 4)); return 0;}/* Generic group F103h - SGL Operating Limits (scalar) */static int i2o_seq_show_sgl_limits(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; static u32 work32[12]; static u16 *work16 = (u16 *) work32; static u8 *work8 = (u8 *) work32; int token; token = i2o_parm_field_get(d, 0xF103, -1, &work32, sizeof(work32)); if (token < 0) { i2o_report_query_status(seq, token, "0xF103 SGL Operating Limits"); return 0; } seq_printf(seq, "SGL chain size : %d\n", work32[0]); seq_printf(seq, "Max SGL chain size : %d\n", work32[1]); seq_printf(seq, "SGL chain size target : %d\n", work32[2]); seq_printf(seq, "SGL frag count : %d\n", work16[6]); seq_printf(seq, "Max SGL frag count : %d\n", work16[7]); seq_printf(seq, "SGL frag count target : %d\n", work16[8]);/* FIXME if (d->i2oversion == 0x02) {*/ seq_printf(seq, "SGL data alignment : %d\n", work16[8]); seq_printf(seq, "SGL addr limit : %d\n", work8[20]); seq_printf(seq, "SGL addr sizes supported : "); if (work8[21] & 0x01) seq_printf(seq, "32 bit "); if (work8[21] & 0x02) seq_printf(seq, "64 bit "); if (work8[21] & 0x04) seq_printf(seq, "96 bit "); if (work8[21] & 0x08) seq_printf(seq, "128 bit "); seq_printf(seq, "\n");/* }*/ return 0;}/* Generic group F200h - Sensors (scalar) */static int i2o_seq_show_sensors(struct seq_file *seq, void *v){ struct i2o_device *d = (struct i2o_device *)seq->private; 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; token = i2o_parm_field_get(d, 0xF200, -1, &result, sizeof(result)); if (token < 0) { i2o_report_query_status(seq, token, "0xF200 Sensors (optional)"); return 0; } seq_printf(seq, "Sensor instance : %d\n", result.sensor_instance); seq_printf(seq, "Component : %d = ", result.component); switch (result.component) { case 0: seq_printf(seq, "Other"); break; case 1: seq_printf(seq, "Planar logic Board"); break; case 2: seq_printf(seq, "CPU"); break; case 3: seq_printf(seq, "Chassis"); break; case 4: seq_printf(seq, "Power Supply"); break; case 5: seq_printf(seq, "Storage"); break; case 6: seq_printf(seq, "External"); break; } seq_printf(seq, "\n"); seq_printf(seq, "Component instance : %d\n", result.component_instance); seq_printf(seq, "Sensor class : %s\n", result.sensor_class ? "Analog" : "Digital"); seq_printf(seq, "Sensor type : %d = ", result.sensor_type); switch (result.sensor_type) { case 0: seq_printf(seq, "Other\n"); break; case 1: seq_printf(seq, "Thermal\n"); break; case 2: seq_printf(seq, "DC voltage (DC volts)\n"); break; case 3: seq_printf(seq, "AC voltage (AC volts)\n"); break; case 4: seq_printf(seq, "DC current (DC amps)\n"); break; case 5: seq_printf(seq, "AC current (AC volts)\n"); break; case 6: seq_printf(seq, "Door open\n"); break; case 7: seq_printf(seq, "Fan operational\n"); break; } seq_printf(seq, "Scaling exponent : %d\n", result.scaling_exponent); seq_printf(seq, "Actual reading : %d\n", result.actual_reading); seq_printf(seq, "Minimum reading : %d\n", result.minimum_reading); seq_printf(seq, "Low2LowCat treshold : %d\n", result.low2lowcat_treshold); seq_printf(seq, "LowCat2Low treshold : %d\n", result.lowcat2low_treshold); seq_printf(seq, "LowWarn2Low treshold : %d\n", result.lowwarn2low_treshold); seq_printf(seq, "Low2LowWarn treshold : %d\n", result.low2lowwarn_treshold); seq_printf(seq, "Norm2LowWarn treshold : %d\n", result.norm2lowwarn_treshold); seq_printf(seq, "LowWarn2Norm treshold : %d\n", result.lowwarn2norm_treshold); seq_printf(seq, "Nominal reading : %d\n", result.nominal_reading); seq_printf(seq, "HiWarn2Norm treshold : %d\n", result.hiwarn2norm_treshold); seq_printf(seq, "Norm2HiWarn treshold : %d\n", result.norm2hiwarn_treshold); seq_printf(seq, "High2HiWarn treshold : %d\n", result.high2hiwarn_treshold); seq_printf(seq, "HiWarn2High treshold : %d\n", result.hiwarn2high_treshold); seq_printf(seq, "HiCat2High treshold : %d\n", result.hicat2high_treshold); seq_printf(seq, "High2HiCat treshold : %d\n", result.hi2hicat_treshold); seq_printf(seq, "Maximum reading : %d\n", result.maximum_reading); seq_printf(seq, "Sensor state : %d = ", result.sensor_state); switch (result.sensor_state) { case 0: seq_printf(seq, "Normal\n"); break; case 1: seq_printf(seq, "Abnormal\n"); break; case 2: seq_printf(seq, "Unknown\n"); break; case 3: seq_printf(seq, "Low Catastrophic (LoCat)\n"); break; case 4: seq_printf(seq, "Low (Low)\n"); break; case 5: seq_printf(seq, "Low Warning (LoWarn)\n"); break; case 6: seq_printf(seq, "High Warning (HiWarn)\n"); break; case 7: seq_printf(seq, "High (High)\n"); break; case 8: seq_printf(seq, "High Catastrophic (HiCat)\n"); break; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -