i2o_proc.c
来自「优龙2410linux2.6.8内核源代码」· C语言 代码 · 共 2,414 行 · 第 1/5 页
C
2,414 行
seq_printf(seq, ", Unknown (0x%02x)", lct->lct_entry[i].sub_class); break; } break; case I2O_CLASS_LAN: switch(lct->lct_entry[i].sub_class & 0xFF) { case 0x30: seq_printf(seq, ", Ethernet"); break; case 0x40: seq_printf(seq, ", 100base VG"); break; case 0x50: seq_printf(seq, ", IEEE 802.5/Token-Ring"); break; case 0x60: seq_printf(seq, ", ANSI X3T9.5 FDDI"); break; case 0x70: seq_printf(seq, ", Fibre Channel"); break; default: seq_printf(seq, ", Unknown Sub-Class (0x%02x)", lct->lct_entry[i].sub_class & 0xFF); break; } break; case I2O_CLASS_SCSI_PERIPHERAL: if(lct->lct_entry[i].sub_class < SCSI_TABLE_SIZE) seq_printf(seq, ", %s", scsi_devices[lct->lct_entry[i].sub_class]); else seq_printf(seq, ", Unknown Device Type"); break; case I2O_CLASS_BUS_ADAPTER_PORT: if(lct->lct_entry[i].sub_class < BUS_TABLE_SIZE) seq_printf(seq, ", %s", bus_ports[lct->lct_entry[i].sub_class]); else seq_printf(seq, ", Unknown Bus Type"); break; } seq_printf(seq, "\n"); seq_printf(seq, " Local TID : 0x%03x\n", lct->lct_entry[i].tid); seq_printf(seq, " User TID : 0x%03x\n", lct->lct_entry[i].user_tid); seq_printf(seq, " Parent TID : 0x%03x\n", lct->lct_entry[i].parent_tid); seq_printf(seq, " 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], lct->lct_entry[i].identity_tag[3], lct->lct_entry[i].identity_tag[4], lct->lct_entry[i].identity_tag[5], lct->lct_entry[i].identity_tag[6], lct->lct_entry[i].identity_tag[7]); seq_printf(seq, " Change Indicator : %0#10x\n", lct->lct_entry[i].change_ind); seq_printf(seq, " Event Capab Mask : %0#10x\n", lct->lct_entry[i].device_flags); } return 0;}int i2o_seq_show_status(struct seq_file *seq, void *v){ struct i2o_controller *c = (struct i2o_controller*)seq->private; char prodstr[25]; int version; i2o_status_get(c); // reread the status block seq_printf(seq, "Organization ID : %0#6x\n", c->status_block->org_id); version = c->status_block->i2o_version; /* FIXME for Spec 2.0 if (version == 0x02) { seq_printf(seq, "Lowest I2O version supported: "); switch(workspace[2]) { case 0x00: seq_printf(seq, "1.0\n"); break; case 0x01: seq_printf(seq, "1.5\n"); break; case 0x02: seq_printf(seq, "2.0\n"); break; } seq_printf(seq, "Highest I2O version supported: "); switch(workspace[3]) { case 0x00: seq_printf(seq, "1.0\n"); break; case 0x01: seq_printf(seq, "1.5\n"); break; case 0x02: seq_printf(seq, "2.0\n"); break; } }*/ seq_printf(seq, "IOP ID : %0#5x\n", c->status_block->iop_id); seq_printf(seq, "Host Unit ID : %0#6x\n", c->status_block->host_unit_id); seq_printf(seq, "Segment Number : %0#5x\n", c->status_block->segment_number); seq_printf(seq, "I2O version : "); switch (version) { case 0x00: seq_printf(seq, "1.0\n"); break; case 0x01: seq_printf(seq, "1.5\n"); break; case 0x02: seq_printf(seq, "2.0\n"); break; default: seq_printf(seq, "Unknown version\n"); } seq_printf(seq, "IOP State : "); switch (c->status_block->iop_state) { case 0x01: seq_printf(seq, "INIT\n"); break; case 0x02: seq_printf(seq, "RESET\n"); break; case 0x04: seq_printf(seq, "HOLD\n"); break; case 0x05: seq_printf(seq, "READY\n"); break; case 0x08: seq_printf(seq, "OPERATIONAL\n"); break; case 0x10: seq_printf(seq, "FAILED\n"); break; case 0x11: seq_printf(seq, "FAULTED\n"); break; default: seq_printf(seq, "Unknown\n"); break; } seq_printf(seq, "Messenger Type : "); switch (c->status_block->msg_type) { case 0x00: seq_printf(seq, "Memory mapped\n"); break; case 0x01: seq_printf(seq, "Memory mapped only\n"); break; case 0x02: seq_printf(seq,"Remote only\n"); break; case 0x03: seq_printf(seq, "Memory mapped and remote\n"); break; default: seq_printf(seq, "Unknown\n"); } seq_printf(seq, "Inbound Frame Size : %d bytes\n", c->status_block->inbound_frame_size<<2); seq_printf(seq, "Max Inbound Frames : %d\n", c->status_block->max_inbound_frames); seq_printf(seq, "Current Inbound Frames : %d\n", c->status_block->cur_inbound_frames); seq_printf(seq, "Max Outbound Frames : %d\n", c->status_block->max_outbound_frames); /* Spec doesn't say if NULL terminated or not... */ memcpy(prodstr, c->status_block->product_id, 24); prodstr[24] = '\0'; seq_printf(seq, "Product ID : %s\n", prodstr); seq_printf(seq, "Expected LCT Size : %d bytes\n", c->status_block->expected_lct_size); seq_printf(seq, "IOP Capabilities\n"); seq_printf(seq, " Context Field Size Support : "); switch (c->status_block->iop_capabilities & 0x0000003) { case 0: seq_printf(seq, "Supports only 32-bit context fields\n"); break; case 1: seq_printf(seq, "Supports only 64-bit context fields\n"); break; case 2: seq_printf(seq, "Supports 32-bit and 64-bit context fields, " "but not concurrently\n"); break; case 3: seq_printf(seq, "Supports 32-bit and 64-bit context fields " "concurrently\n"); break; default: seq_printf(seq, "0x%08x\n",c->status_block->iop_capabilities); } seq_printf(seq, " Current Context Field Size : "); switch (c->status_block->iop_capabilities & 0x0000000C) { case 0: seq_printf(seq, "not configured\n"); break; case 4: seq_printf(seq, "Supports only 32-bit context fields\n"); break; case 8: seq_printf(seq, "Supports only 64-bit context fields\n"); break; case 12: seq_printf(seq, "Supports both 32-bit or 64-bit context fields " "concurrently\n"); break; default: seq_printf(seq, "\n"); } seq_printf(seq, " Inbound Peer Support : %s\n", (c->status_block->iop_capabilities & 0x00000010) ? "Supported" : "Not supported"); seq_printf(seq, " Outbound Peer Support : %s\n", (c->status_block->iop_capabilities & 0x00000020) ? "Supported" : "Not supported"); seq_printf(seq, " Peer to Peer Support : %s\n", (c->status_block->iop_capabilities & 0x00000040) ? "Supported" : "Not supported"); seq_printf(seq, "Desired private memory size : %d kB\n", c->status_block->desired_mem_size>>10); seq_printf(seq, "Allocated private memory size : %d kB\n", c->status_block->current_mem_size>>10); seq_printf(seq, "Private memory base address : %0#10x\n", c->status_block->current_mem_base); seq_printf(seq, "Desired private I/O size : %d kB\n", c->status_block->desired_io_size>>10); seq_printf(seq, "Allocated private I/O size : %d kB\n", c->status_block->current_io_size>>10); seq_printf(seq, "Private I/O base address : %0#10x\n", c->status_block->current_io_base); return 0;}int i2o_proc_read_hw(char *buf, char **start, off_t offset, int len, int *eof, void *data){ struct i2o_controller *c = (struct i2o_controller*)data; static u32 work32[5]; static u8 *work8 = (u8*)work32; static u16 *work16 = (u16*)work32; int token; u32 hwcap; static char *cpu_table[] = { "Intel 80960 series", "AMD2900 series", "Motorola 68000 series", "ARM series", "MIPS series", "Sparc series", "PowerPC series", "Intel x86 series" }; spin_lock(&i2o_proc_lock); len = 0; token = i2o_query_scalar(c, ADAPTER_TID, 0x0000, -1, &work32, sizeof(work32)); if (token < 0) { len += i2o_report_query_status(buf+len, token,"0x0000 IOP Hardware"); spin_unlock(&i2o_proc_lock); return len; } 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 : 0x%08x\n", hwcap); len += sprintf(buf+len, " [%s] Self booting\n", (hwcap&0x00000001) ? "+" : "-"); len += sprintf(buf+len, " [%s] Upgradable IRTOS\n", (hwcap&0x00000002) ? "+" : "-"); len += sprintf(buf+len, " [%s] Supports downloading DDMs\n", (hwcap&0x00000004) ? "+" : "-"); len += sprintf(buf+len, " [%s] Supports installing DDMs\n", (hwcap&0x00000008) ? "+" : "-"); len += sprintf(buf+len, " [%s] Battery-backed RAM\n", (hwcap&0x00000010) ? "+" : "-"); spin_unlock(&i2o_proc_lock); return len;}/* Executive group 0003h - Executing DDM List (table) */int i2o_proc_read_ddm_table(char *buf, char **start, off_t offset, int len, int *eof, void *data){ struct i2o_controller *c = (struct i2o_controller*)data; int token; int i; typedef struct _i2o_exec_execute_ddm_table { u16 ddm_tid; u8 module_type; u8 reserved; u16 i2o_vendor_id; u16 module_id; u8 module_name_version[28]; u32 data_size; u32 code_size; } i2o_exec_execute_ddm_table; struct { u16 result_count; u16 pad; u16 block_size; u8 block_status; u8 error_info_size; u16 row_count; u16 more_flag; i2o_exec_execute_ddm_table ddm_table[MAX_I2O_MODULES]; } *result; i2o_exec_execute_ddm_table ddm_table; 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, c, ADAPTER_TID, 0x0003, -1, NULL, 0, result, sizeof(*result)); if (token < 0) { len += i2o_report_query_status(buf+len, token,"0x0003 Executing DDM List"); goto out; } 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]) { len += sprintf(buf+len, "0x%03x ", ddm_table.ddm_tid & 0xFFF); switch(ddm_table.module_type) { case 0x01: len += sprintf(buf+len, "Downloaded DDM "); break; case 0x22: len += sprintf(buf+len, "Embedded DDM "); break; default: len += sprintf(buf+len, " "); } 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"); }out: spin_unlock(&i2o_proc_lock); kfree(result); return len;}/* Executive group 0004h - Driver Store (scalar) */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; 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; } len += sprintf(buf+len, "Module limit : %d\n" "Module count : %d\n" "Current space : %d kB\n" "Free space : %d kB\n", work32[0], work32[1], work32[2]>>10, work32[3]>>10); spin_unlock(&i2o_proc_lock); return len;}/* Executive group 0005h - Driver Store Table (table) */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; u8 module_type; u8 reserved; u16 i2o_vendor_id; u16 module_id; u8 module_name_version[28]; u8 date[8]; u32 module_size; u32 mpb_size; u32 module_flags; } i2o_driver_store_table; struct i2o_controller *c = (struct i2o_controller*)data; int token; int i; typedef struct { u16 result_count; u16 pad; u16 block_size; u8 block_status; u8 error_info_size; u16 row_count; u16 more_flag; i2o_driver_store_table dst[MAX_I2O_MODULES]; } i2o_driver_result_table;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?