📄 scsi.c
字号:
{ printf("Unable to read in devtab name.\n"); continue; } printf("\tnamelen:\t%d\n",devtab.namelen); printf("\tname:\t\t%s\n",name); printf("\tdevtype:\t%s\n", scsi_decode(devtab.devtype, scsi_device_class, EQUAL_MATCH)); printf("\tpart table:\t"); praddr(devtab.disksize); printf("\n"); printf("\tprobedelay:\t0x%x\n",devtab.probedelay);#ifdef vax printf("\tmspw:\t\t0x%x\n",devtab.mspw);#endif vax if (devtab.flags == 0) printf("\tflags:\t\tNone\n"); else printf("\tflags:\t\t%s\n", scsi_decode(devtab.flags, scsi_device_flags, OR_MATCH)); }}/* * Print SCSI command/message information */voiddo_scsiprint_cmd(cntlr)int cntlr;{ struct sz_softc *sc = &sz_softc[cntlr]; int i, j; for (i=0; i < NDPS; i++) { if (sc->sc_devtyp[i] == 0) continue; printf("\nSCSI message and command information:\n"); printf("Controller #%d Targid #%d:\n", cntlr, i); printf("\textmessg:\t0x%x 0x%x 0x%x 0x%x 0x%x\n", sc->sc_extmessg[i][0],sc->sc_extmessg[i][1], sc->sc_extmessg[i][2],sc->sc_extmessg[i][3], sc->sc_extmessg[i][4]); printf("\tsc_cmdlog:\t"); for (j=0; j < 12; j++) printf("0x%x ",sc->sc_cmdlog[i][j]); printf("\n"); printf("\tExtended sense data:\n"); printf("\t\terror code:\t\t0x%x\n",sc->sc_sns[i].errcode); printf("\t\terror class:\t\t0x%x\n",sc->sc_sns[i].errclass); printf("\t\tvalid:\t\t\t0x%x\n",sc->sc_sns[i].valid); printf("\t\tsegment number:\t\t0x%x\n",sc->sc_sns[i].segnum); printf("\t\tsense key:\t\t0x%x\n",sc->sc_sns[i].snskey); printf("\t\tillegal length indicator:0x%x\n", sc->sc_sns[i].ili); printf("\t\tend of medium:\t\t0x%x\n",sc->sc_sns[i].eom); printf("\t\tfilemark:\t\t0x%x\n",sc->sc_sns[i].filmrk); printf("\t\tinformation byte (msb):\t0x%x\n", sc->sc_sns[i].infobyte3); printf("\t\tinformation byte:\t0x%x\n", sc->sc_sns[i].infobyte2); printf("\t\tinformation byte:\t0x%x\n", sc->sc_sns[i].infobyte1); printf("\t\tinformation byte (lsb):\t0x%x\n", sc->sc_sns[i].infobyte0); printf("\t\tadditional sense length:0x%x\n", sc->sc_sns[i].asl); if ((sc->sc_devtyp[i] & SZ_TAPE) == SZ_TAPE) { printf("\t\tTAPE specific types:\n"); printf("\t\t\tcont err code:\t0x%x\n", sc->sc_sns[i].asb.tz_asb.ctlr); printf("\t\t\tdrive error #0:\t0x%x\n", sc->sc_sns[i].asb.tz_asb.drv0); printf("\t\t\tdrive error #1:\t0x%x\n", sc->sc_sns[i].asb.tz_asb.drv1); } if ((sc->sc_devtyp[i] & SZ_DISK) == SZ_DISK) { printf("\t\tDISK specific bytes:\n"); printf("\t\t\taddit sense code:\t0x%x\n", sc->sc_sns[i].asb.rz_asb.asc); } if ((sc->sc_devtyp[i] & SZ_CDROM) == SZ_CDROM) { printf("\t\tCDROM specific bytes:\n"); printf("\t\t\taddit sense code:\t0x%x\n", sc->sc_sns[i].asb.cd_asb.asc); printf("\t\t\tfrufld:\t\t\t0x%x\n", sc->sc_sns[i].asb.cd_asb.frufld); printf("\t\t\tbit pointer:\t\t0x%x\n", sc->sc_sns[i].asb.cd_asb.bitp); printf("\t\t\tbit pointer valid:\t0x%x\n", sc->sc_sns[i].asb.cd_asb.bpv); printf("\t\t\tvendor unique:\t\t0x%x\n", sc->sc_sns[i].asb.cd_asb.vu); printf("\t\t\tcommand/data:\t\t0x%x\n", sc->sc_sns[i].asb.cd_asb.cd); printf("\t\t\tfield pointer valid:\t0x%x\n", sc->sc_sns[i].asb.cd_asb.fpv); printf("\t\t\tfield pointer (msb):\t0x%x\n", sc->sc_sns[i].asb.cd_asb.fpmsb); printf("\t\t\tfield pointer (lsb):\t0x%x\n", sc->sc_sns[i].asb.cd_asb.fplsb); } printf("\tsc_cmdpkt:\n"); printf("\t\tcmd:\t"); for(j=0; j<6; j++) printf("0x%x ",sc->sc_cmdpkt[i].altcmd.cmd[j] & 0xff); printf("\n\t\tdata:\t"); for(j=0; j<8; j++) printf("0x%x ",sc->sc_cmdpkt[i].altcmd.dat[j] & 0xff); printf("\n\t\t\t"); for(j=8; j<16; j++) printf("0x%x ",sc->sc_cmdpkt[i].altcmd.dat[j] & 0xff); printf("\n"); printf("\tsc_status:\t%s\n", scsi_decode(sc->sc_status[i], scsi_status_byte, EQUAL_MATCH)); }}/* * Print Bad Block Replacement data */voiddo_scsiprint_bbr(cntlr)int cntlr;{ struct sz_softc *sc = &sz_softc[cntlr]; int i; for (i=0; i < NDPS; i++) { if (sc->sc_devtyp[i] == 0) continue; if ((sc->sc_devtyp[i] & SZ_DISK) != SZ_DISK) continue; printf("\nSCSI Bad Block Replacement information:\n"); printf("Controller #%d Targid #%d:\n", cntlr, i); printf("\tsc_bbr_active:\t0x%x\n",sc->sc_bbr_active[i]); printf("\tsc_bbr_state:\t0x%x\n",sc->sc_bbr_state[i]); printf("\tsc_bbr_oper:\t0x%x\n",sc->sc_bbr_oper[i]); printf("\tsc_bbr_read:\t0x%x\n",sc->sc_bbr_read[i]); printf("\tsc_bbr_rawr:\t0x%x\n",sc->sc_bbr_rawr[i]); printf("\tsc_bbr_write:\t0x%x\n",sc->sc_bbr_write[i]); printf("\tsc_bbraddr:\t0x%x\n",sc->sc_bbraddr[i]); printf("\tsc_bbrparams:\t0x%x\n",sc->sc_bbrparams[i]); }}/* * Print SCSI error related information */voiddo_scsiprint_err(cntlr)int cntlr;{ struct sz_softc *sc = &sz_softc[cntlr]; int i; for (i=0; i < NDPS; i++) { if (sc->sc_devtyp[i] == 0) continue; printf("\nSCSI Error information:\n"); printf("Controller #%d Targid #%d:\n", cntlr, i);#ifdef vax printf("\tsc_statlog:\t0x%x\n",sc->sc_statlog[i]); printf("\tsc_selretry:\t0x%x\n",sc->sc_sel_retry[i]);#endif vax printf("\tsc_softcnt:\t0x%x\n",sc->sc_softcnt[i]); printf("\tsc_hardcnt:\t0x%x\n",sc->sc_hardcnt[i]); }}/* * Print SII information */voiddo_scsiprint_sii(cntlr)int cntlr;{ struct sz_softc *sc = &sz_softc[cntlr]; int i; for (i=0; i < NDPS; i++) { if (sc->sc_devtyp[i] == 0) continue; printf("\nSCSI SII information:\n"); printf("Controller #%d Targid #%d:\n", cntlr, i); printf("\tsc_siioddbyte:\t0x%x\n",sc->sc_siioddbyte[i]); printf("\tsc_siireqack:\t0x%x\n",sc->sc_siireqack[i]); printf("\tsc_siisentsync:\t0x%x\n",sc->sc_siisentsync[i]); printf("\tsc_siidmacount:\t0x%x\n",sc->sc_siidmacount[i]); }}/* * Print SPIN_STATS information */voiddo_scsiprint_spinstats(cntlr)int cntlr;{#ifdef SPIN_STATS struct sz_softc *sc = &sz_softc[cntlr]; int i; for (i=0; i < NDPS; i++) { if (sc->sc_devtyp[i] == 0) continue; printf("\nSCSI Spin Stat information:\n"); printf("Controller #%d Targid #%d:\n", cntlr, i); printf("\tsc_i_spin1:\t0x%x\n",sc->sc_i_spin1[i]); printf("\tsc_i_spcmd:\t0x%x\n",sc->sc_i_spcmd[i]); printf("\tsc_i_phase:\t0x%x\n",sc->sc_i_phase[i]); printf("\tsc_ss_spin1:\t0x%x\n",sc->sc_ss_spin1[i]); printf("\tsc_ss_spcmd:\t0x%x\n",sc->sc_ss_spcmd[i]); printf("\tsc_ss_phase:\t0x%x\n",sc->sc_ss_phase[i]); }#else SPIN_STATS printf("\nController #%d: SPIN_STATS not defined\n", cntlr);#endif SPIN_STATS}/* * Print DCT_STATS information. */voiddo_scsiprint_dctstats(cntlr)int cntlr;{#ifdef DCT_STATS struct sz_softc *sc = &sz_softc[cntlr]; int i; for (i=0; i < NDPS; i++) { if (sc->sc_devtyp[i] == 0) continue; printf("\nSCSI DCT Stat information:\n"); printf("Controller #%d Targid #%d:\n", cntlr, i); printf("\tsc_dcstart:\t0x%x\n",sc->sc_dcstart[i]); printf("\tsc_dcend:\t0x%x\n",sc->sc_dcend[i]); printf("\tsc_dcdiff:\t0x%x\n",sc->sc_dcdiff[i]); printf("\tsc_dclongest:\t0x%x\n",sc->sc_dclongest[i]); }#else DCT_STATS printf("\nController #%d: DCT_STATS not defined\n", cntlr);#endif DCT_STATS}/* * Print data transfer information */voiddo_scsiprint_trans(cntlr)int cntlr;{ struct sz_softc *sc = &sz_softc[cntlr]; int i; for (i=0; i < NDPS; i++) { if (sc->sc_devtyp[i] == 0) continue; printf("\nSCSI data transfer information:\n"); printf("Controller #%d Targid #%d:\n", cntlr, i); printf("\tsc_b_bcount:\t0x%x\n",sc->sc_b_bcount[i]); printf("\tsc_bpcount:\t0x%x\n",sc->sc_bpcount[i]); printf("\tsc_segcnt:\t0x%x\n",sc->sc_segcnt[i]); printf("\tsc_xfercnt:\t0x%x\n",sc->sc_xfercnt[i]); printf("\tsc_resid:\t0x%x\n",sc->sc_resid[i]); printf("\tsc_savcnt:\t0x%x\n",sc->sc_savcnt[i]); }}/* * Return a description of the given code. */char *scsi_decode(code, dc, type)long code;struct scsi_dcode *dc;int type;{ int i; char desc[256]; bzero(desc, sizeof(desc)); for (; dc->desc != NULL; *dc++) { if (((type == EQUAL_MATCH) && (dc->code == code)) || ((type == OR_MATCH) && ((dc->code | code) == code))) { if (strlen(desc) > 0) strcat(desc, ","); strcat(desc, dc->desc); if (type == EQUAL_MATCH) break; code -= dc->code; } } if (strlen(desc) == 0) sprintf(desc, "0x%x", code); return (desc);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -