📄 klgraph_hack.c
字号:
klxbow_ptr->xbow_port_info[6].port_flag = 0x5; klxbow_ptr->xbow_port_info[6].port_offset = 0x30210; klxbow_ptr->xbow_port_info[7].port_nasid = 0x3; klxbow_ptr->xbow_port_info[7].port_flag = 0x5; klxbow_ptr->xbow_port_info[7].port_offset = 0x302e0; lb_ptr->brd_compts[1] = 0; lb_ptr->brd_numcompts = 1; /* * lboard KLTYPE_PBRICK */ lb_ptr = kmalloc(sizeof(lboard_t), GFP_KERNEL); temp_ptr->brd_next = (klconf_off_t)lb_ptr; /* Let the previous point at the new .. */ temp_ptr = lb_ptr; printk("Third Lboard %p\n", lb_ptr); lb_ptr->brd_next = 0; lb_ptr->struct_type = 0x1; lb_ptr->brd_type = 0x72; lb_ptr->brd_sversion = 0x2; lb_ptr->brd_brevision = 0x0; lb_ptr->brd_promver = 0x1; lb_ptr->brd_promver = 0x41; lb_ptr->brd_slot = 0xe; lb_ptr->brd_debugsw = 0x0; lb_ptr->brd_module = 0x145; lb_ptr->brd_partition = 0x1; lb_ptr->brd_diagval = 0x0; lb_ptr->brd_diagparm = 0x0; lb_ptr->brd_inventory = 0x0; lb_ptr->brd_numcompts = 0x1; lb_ptr->brd_nic = 0x30e3fd; lb_ptr->brd_nasid = 0x0; lb_ptr->brd_errinfo = 0x0; lb_ptr->brd_parent = (struct lboard_s *)0x9600000000030140; lb_ptr->brd_graph_link = (devfs_handle_t)0xffffffff; lb_ptr->brd_owner = 0x0; lb_ptr->brd_nic_flags = 0x0; memcpy(&lb_ptr->brd_name[0], "IP35", 4); /* * KLSTRUCT_BRI Component */ klcomp_ptr = kmalloc(sizeof(klcomp_t), GFP_KERNEL); klbri_ptr = (klbri_t *)klcomp_ptr; klinfo_ptr = (klinfo_t *)klcomp_ptr; lb_ptr->brd_compts[0] = (klconf_off_t)klcomp_ptr; klinfo_ptr->struct_type = 0x5; klinfo_ptr->struct_version = 0x2; klinfo_ptr->flags = 0x1; klinfo_ptr->revision = 0x2; klinfo_ptr->diagval = 0x0; klinfo_ptr->diagparm = 0x0; klinfo_ptr->inventory = 0x0; klinfo_ptr->partid = 0xd002; klinfo_ptr->nic = 0x30e3fd; klinfo_ptr->physid = 0xe; klinfo_ptr->virtid = 0xe; klinfo_ptr->widid = 0xe; klinfo_ptr->nasid = 0x0; klbri_ptr->bri_eprominfo = 0xff; klbri_ptr->bri_bustype = 0x7; klbri_ptr->bri_mfg_nic = 0x3f4a8; lb_ptr->brd_compts[1] = 0; lb_ptr->brd_numcompts = 1; /* * lboard KLTYPE_PBRICK */ lb_ptr = kmalloc(sizeof(lboard_t), GFP_KERNEL); temp_ptr->brd_next = (klconf_off_t)lb_ptr; /* Let the previous point at the new .. */ temp_ptr = lb_ptr; printk("Fourth Lboard %p\n", lb_ptr); lb_ptr->brd_next = 0x0; lb_ptr->struct_type = 0x1; lb_ptr->brd_type = 0x72; lb_ptr->brd_sversion = 0x2; lb_ptr->brd_brevision = 0x0; lb_ptr->brd_promver = 0x1; lb_ptr->brd_promver = 0x31; lb_ptr->brd_slot = 0xf; lb_ptr->brd_debugsw = 0x0; lb_ptr->brd_module = 0x145; lb_ptr->brd_partition = 0x1; lb_ptr->brd_diagval = 0x0; lb_ptr->brd_diagparm = 0x0; lb_ptr->brd_inventory = 0x0; lb_ptr->brd_numcompts = 0x6; lb_ptr->brd_nic = 0x30e3fd; lb_ptr->brd_nasid = 0x0; lb_ptr->brd_errinfo = 0x0; lb_ptr->brd_parent = (struct lboard_s *)0x9600000000030140; lb_ptr->brd_graph_link = (devfs_handle_t)0xffffffff; lb_ptr->brd_owner = 0x0; lb_ptr->brd_nic_flags = 0x0; memcpy(&lb_ptr->brd_name[0], "IP35", 4); /* * KLSTRUCT_BRI Component */ klcomp_ptr = kmalloc(sizeof(klcomp_t), GFP_KERNEL); klbri_ptr = (klbri_t *)klcomp_ptr; klinfo_ptr = (klinfo_t *)klcomp_ptr; lb_ptr->brd_compts[0] = (klconf_off_t)klcomp_ptr; klinfo_ptr->struct_type = 0x5; klinfo_ptr->struct_version = 0x2; klinfo_ptr->flags = 0x1; klinfo_ptr->revision = 0x2; klinfo_ptr->diagval = 0x0; klinfo_ptr->diagparm = 0x0; klinfo_ptr->inventory = 0x0; klinfo_ptr->partid = 0xd002; klinfo_ptr->nic = 0x30e3fd; klinfo_ptr->physid = 0xf; klinfo_ptr->virtid = 0xf; klinfo_ptr->widid = 0xf; klinfo_ptr->nasid = 0x0; klbri_ptr->bri_eprominfo = 0xff; klbri_ptr->bri_bustype = 0x7; klbri_ptr->bri_mfg_nic = 0x3f528; /* * KLSTRUCT_SCSI component */ klcomp_ptr = kmalloc(sizeof(klcomp_t), GFP_KERNEL); klinfo_ptr = (klinfo_t *)klcomp_ptr; lb_ptr->brd_compts[1] = (klconf_off_t)klcomp_ptr; klinfo_ptr->struct_type = 0xb; klinfo_ptr->struct_version = 0x1; klinfo_ptr->flags = 0x31; klinfo_ptr->revision = 0x5; klinfo_ptr->diagval = 0x0; klinfo_ptr->diagparm = 0x0; klinfo_ptr->inventory = 0x0; klinfo_ptr->partid = 0x0; klinfo_ptr->nic = 0xffffffffffffffff; klinfo_ptr->physid = 0x1; klinfo_ptr->virtid = 0x0; klinfo_ptr->widid = 0xf; klinfo_ptr->nasid = 0x0; /* * KLSTRUCT_IOC3 Component */ klcomp_ptr = kmalloc(sizeof(klcomp_t), GFP_KERNEL); klioc3_ptr = (klioc3_t *)klcomp_ptr; klinfo_ptr = (klinfo_t *)klcomp_ptr; lb_ptr->brd_compts[2] = (klconf_off_t)klcomp_ptr; klinfo_ptr->struct_type = 0x6; klinfo_ptr->struct_version = 0x1; klinfo_ptr->flags = 0x31; klinfo_ptr->revision = 0x1; klinfo_ptr->diagval = 0x0; klinfo_ptr->diagparm = 0x0; klinfo_ptr->inventory = 0x0; klinfo_ptr->partid = 0x0; klinfo_ptr->nic = 0xffffffffffffffff; klinfo_ptr->physid = 0x4; klinfo_ptr->virtid = 0x0; klinfo_ptr->widid = 0xf; klinfo_ptr->nasid = 0x0; klioc3_ptr->ioc3_ssram = 0x0; klioc3_ptr->ioc3_nvram = 0x0; /* * KLSTRUCT_UNKNOWN Component */ klcomp_ptr = kmalloc(sizeof(klcomp_t), GFP_KERNEL); klinfo_ptr = (klinfo_t *)klcomp_ptr; lb_ptr->brd_compts[3] = (klconf_off_t)klcomp_ptr; klinfo_ptr->struct_type = 0x0; klinfo_ptr->struct_version = 0x1; klinfo_ptr->flags = 0x31; klinfo_ptr->revision = 0xff; klinfo_ptr->diagval = 0x0; klinfo_ptr->diagparm = 0x0; klinfo_ptr->inventory = 0x0; klinfo_ptr->partid = 0x0; klinfo_ptr->nic = 0xffffffffffffffff; klinfo_ptr->physid = 0x5; klinfo_ptr->virtid = 0x0; klinfo_ptr->widid = 0xf; klinfo_ptr->nasid = 0x0; /* * KLSTRUCT_SCSI Component */ klcomp_ptr = kmalloc(sizeof(klcomp_t), GFP_KERNEL); klinfo_ptr = (klinfo_t *)klcomp_ptr; lb_ptr->brd_compts[4] = (klconf_off_t)klcomp_ptr; klinfo_ptr->struct_type = 0xb; klinfo_ptr->struct_version = 0x1; klinfo_ptr->flags = 0x31; klinfo_ptr->revision = 0x1; klinfo_ptr->diagval = 0x0; klinfo_ptr->diagparm = 0x0; klinfo_ptr->inventory = 0x0; klinfo_ptr->partid = 0x0; klinfo_ptr->nic = 0xffffffffffffffff; klinfo_ptr->physid = 0x6; klinfo_ptr->virtid = 0x5; klinfo_ptr->widid = 0xf; klinfo_ptr->nasid = 0x0; /* * KLSTRUCT_UNKNOWN */ klcomp_ptr = kmalloc(sizeof(klcomp_t), GFP_KERNEL); klinfo_ptr = (klinfo_t *)klcomp_ptr; lb_ptr->brd_compts[5] = (klconf_off_t)klcomp_ptr; klinfo_ptr->struct_type = 0x0; klinfo_ptr->struct_version = 0x1; klinfo_ptr->flags = 0x31; klinfo_ptr->revision = 0xff; klinfo_ptr->diagval = 0x0; klinfo_ptr->diagparm = 0x0; klinfo_ptr->inventory = 0x0; klinfo_ptr->partid = 0x0; klinfo_ptr->nic = 0xffffffffffffffff; klinfo_ptr->physid = 0x7; klinfo_ptr->virtid = 0x0; klinfo_ptr->widid = 0xf; klinfo_ptr->nasid = 0x0; lb_ptr->brd_compts[6] = 0; lb_ptr->brd_numcompts = 6;} #ifdef BRINGUP/* * these were useful for printing out registers etc * during bringup */voidxdump(long long *addr, int count){ int ii; volatile long long *xx = addr; for ( ii = 0; ii < count; ii++, xx++ ) { printk("0x%p : 0x%p\n", xx, *xx); }}voidxdump32(unsigned int *addr, int count){ int ii; volatile unsigned int *xx = addr; for ( ii = 0; ii < count; ii++, xx++ ) { printk("0x%p : 0x%0x\n", xx, *xx); }}voidclear_ii_error(void){ volatile long long *tmp; printk("... WSTAT "); xdump((long long *)0xc0000a0001c00008, 1); printk("... WCTRL "); xdump((long long *)0xc0000a0001c00020, 1); printk("... WLCSR "); xdump((long long *)0xc0000a0001c00128, 1); printk("... IIDSR "); xdump((long long *)0xc0000a0001c00138, 1); printk("... IOPRBs "); xdump((long long *)0xc0000a0001c00198, 9); printk("... IXSS "); xdump((long long *)0xc0000a0001c00210, 1); printk("... IBLS0 "); xdump((long long *)0xc0000a0001c10000, 1); printk("... IBLS1 "); xdump((long long *)0xc0000a0001c20000, 1); /* Write IOERR clear to clear the CRAZY bit in the status */ tmp = (long long *)0xc0000a0001c001f8; *tmp = (long long)0xffffffff; /* dump out local block error registers */ printk("... "); xdump((long long *)0xc0000a0001e04040, 1); /* LB_ERROR_BITS */ printk("... "); xdump((long long *)0xc0000a0001e04050, 1); /* LB_ERROR_HDR1 */ printk("... "); xdump((long long *)0xc0000a0001e04058, 1); /* LB_ERROR_HDR2 */ /* and clear the LB_ERROR_BITS */ tmp = (long long *)0xc0000a0001e04040; *tmp = 0x0; printk("clr: "); xdump((long long *)0xc0000a0001e04040, 1); /* LB_ERROR_BITS */ tmp = (long long *)0xc0000a0001e04050; *tmp = 0x0; tmp = (long long *)0xc0000a0001e04058; *tmp = 0x0;}voiddump_ii(){ printk("===== Dump the II regs =====\n"); xdump((long long *)0xc0000a0001c00000, 2); xdump((long long *)0xc0000a0001c00020, 1); xdump((long long *)0xc0000a0001c00100, 37); xdump((long long *)0xc0000a0001c00300, 98); xdump((long long *)0xc0000a0001c10000, 6); xdump((long long *)0xc0000a0001c20000, 6); xdump((long long *)0xc0000a0001c30000, 2); xdump((long long *)0xc0000a0000000000, 1); xdump((long long *)0xc0000a0001000000, 1); xdump((long long *)0xc0000a0002000000, 1); xdump((long long *)0xc0000a0003000000, 1); xdump((long long *)0xc0000a0004000000, 1); xdump((long long *)0xc0000a0005000000, 1); xdump((long long *)0xc0000a0006000000, 1); xdump((long long *)0xc0000a0007000000, 1); xdump((long long *)0xc0000a0008000000, 1); xdump((long long *)0xc0000a0009000000, 1); xdump((long long *)0xc0000a000a000000, 1); xdump((long long *)0xc0000a000b000000, 1); xdump((long long *)0xc0000a000c000000, 1); xdump((long long *)0xc0000a000d000000, 1); xdump((long long *)0xc0000a000e000000, 1); xdump((long long *)0xc0000a000f000000, 1);}voiddump_lb(){ printk("===== Dump the LB regs =====\n"); xdump((long long *)0xc0000a0001e00000, 1); xdump((long long *)0xc0000a0001e04000, 13); xdump((long long *)0xc0000a0001e04100, 2); xdump((long long *)0xc0000a0001e04200, 2); xdump((long long *)0xc0000a0001e08000, 5); xdump((long long *)0xc0000a0001e08040, 2); xdump((long long *)0xc0000a0001e08050, 3); xdump((long long *)0xc0000a0001e0c000, 3); xdump((long long *)0xc0000a0001e0c020, 4);}voiddump_crossbow(){ printk("===== Dump the Crossbow regs =====\n"); clear_ii_error(); xdump32((unsigned int *)0xc0000a0000000004, 1); clear_ii_error(); xdump32((unsigned int *)0xc0000a0000000000, 1); printk("and again..\n"); xdump32((unsigned int *)0xc0000a0000000000, 1); xdump32((unsigned int *)0xc0000a0000000000, 1); clear_ii_error(); xdump32((unsigned int *)0xc000020000000004, 1); clear_ii_error(); xdump32((unsigned int *)0xc000020000000000, 1); clear_ii_error(); xdump32((unsigned int *)0xc0000a0000800004, 1); clear_ii_error(); xdump32((unsigned int *)0xc0000a0000800000, 1); clear_ii_error(); xdump32((unsigned int *)0xc000020000800004, 1); clear_ii_error(); xdump32((unsigned int *)0xc000020000800000, 1); clear_ii_error();}#endif /* BRINGUP */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -