📄 scsireg.h
字号:
/* #define SPIN_STATS */struct sz_softc { int sc_sysid; /* SCSI bus ID of system (initiator) */ int sc_cntlr_alive; /* Status of this cntlr (alive or not)*/ int sc_aipfts; /* scsistart: # of AIP failed to set */ int sc_lostarb; /* # of times CPU lost arbitration */ int sc_lastid; /* ID of last target I/O started on */ int sc_active; /* Current selected target ID (0=none)*/ int sc_prevpha; /* Previous bus phase */ int sc_fstate; /* State for sz_fuzzy state machine */ int (*port_start)(); /* pointer to the port start routine */ int (*port_reset)(); /* pointer to the port reset routine */ char *sc_rambuff; /* Holds pointer to the RAM buffer */ int sc_swcount; /* Select timeout wait counter */ int sc_rip; /* SCSI bus reset in progress */ int sc_scs_selena; /* Soft copy, 5380 select enable reg */ int sc_rmv_media; /* Save removable media bit per target*/ int sc_dummy; /* Align sz_softc for ADB */ int (*device_comp[NDPS])(); /* pointer to device completion func */ int sc_sel_retry[NDPS]; /* Select failure retry count */ struct scsi_devtab *sc_devtab[NDPS]; /* Target's scsi_devtab pointer */#ifdef SPIN_STATS int sc_i_spin1[NDPS]; /* szintr: longest spin count */ int sc_i_spcmd[NDPS]; /* current command */ int sc_i_phase[NDPS]; /* phase entered after spin */ int sc_ss_spin1[NDPS]; /* scsistart: longest spin count */ int sc_ss_spcmd[NDPS]; /* current command */ int sc_ss_phase[NDPS]; /* phase entered after spin*/#endif /* SPIN_STATS */#ifdef DCT_STATS int sc_dcstart[NDPS]; /* Time target disconnected */ int sc_dcend[NDPS]; /* Time target disconnect ended */ int sc_dcdiff[NDPS]; /* How long last disconnect lasted */ int sc_dclongest[NDPS]; /* Longest time target disconnected */#endif /* DCT_STATS */ struct buf *sc_bp[NDPS]; /* Saved buffer pointer */ int sc_b_bcount[NDPS]; /* part of bp->b_bcount for this xfer */ int sc_bpcount[NDPS]; /* Xfer size, not always bp->b_bcount */ int sc_segcnt[NDPS]; /* Max byte count for xfer (segment) */ int sc_xfercnt[NDPS]; /* Number of bytes transfered so far */ int sc_resid[NDPS]; /* Copy of last bc */ int sc_savcnt[NDPS]; /* Bytes remaining in transfer when a */ daddr_t sc_blkno[NDPS]; /* Starting block number of xfer */ int sc_openf[NDPS]; /* Lock against multiple opens */ daddr_t sc_disksize[NDPS]; /* DISK: number of LBNs on disk */ struct size *sc_dstp[NDPS]; /* Pointer to default psrtition sizes */ long sc_flags[NDPS]; /* Flags */ long sc_category_flags[NDPS];/* Category flags */ u_long sc_softcnt[NDPS]; /* Soft error count total */ u_long sc_hardcnt[NDPS]; /* Hard error count total */ int sc_devtyp[NDPS]; /* Device class/type ID */ int sc_dkn[NDPS]; /* Saved DK number for iostat */ int sc_alive[NDPS]; /* Is a device at this SCSI target ID */ int sc_unit[NDPS]; /* Logical unit number for this ID */ char sc_device[NDPS][DEV_SIZE]; /* Device type string,ADB 64 bytes */ long sc_szflags[NDPS]; /* Flags for reuesting other action */ int sc_curcmd[NDPS]; /* Current cmd, eg: TUR, MODSEL, R/W */ int sc_actcmd[NDPS]; /* Actual cmd, eg: RQSNS after R/W */ int sc_selstat[NDPS]; /* Cntlr state: SEL RESEL DISCON IDLE */ int sc_xstate[NDPS]; /* State for sz_start state machine */ int sc_xevent[NDPS]; /* Event for sz_start state machine */ int sc_pxstate[NDPS]; /* Save state in case target busy */ int sc_c_status[NDPS]; /* Status of last ??command() */ int sc_c_snskey[NDPS]; /* Sense Key for last ??command() */ int sc_c_asc[NDPS]; /* Additional Sense code (disks only) */ char *sc_SZ_bufmap[NDPS]; /* Virtual address for buffer mapping */ struct pte *sc_szbufmap[NDPS]; /* PTEs from get_sys_ptes() call */ char *sc_bufp[NDPS]; /* Pointer to user buffer */ long sc_dboff[NDPS]; /* Target's offset in 128K h/w buffer */ u_char sc_cmdlog[NDPS][12]; /* Copy of current command (cdb) */ union { /* ADB: size is 22 bytes */ struct sz_cmdfmt sz_cmd; /* Complete command packet */ struct { char cmd[6]; /* Command portion of comand packet */ char dat[16]; /* Data portion of command packet */ } altcmd; } sc_cmdpkt[NDPS]; /* Command packet */ struct sz_datfmt sz_dat[NDPS]; /* Return status data, ADB size 44b */ u_char sc_status[NDPS]; /* Status for current command */ u_char sc_statlog[NDPS]; /* Copy of status byte for error log */ u_char sc_message[NDPS]; /* Current message */ struct sz_exsns_dt sc_sns[NDPS]; /* extended sense data,ADB size 44b */ char sc_devnam[NDPS][SZ_DNSIZE]; /* ASCII device name (8*24b) */ char sc_revlvl[NDPS][SZ_REV_LEN]; /* ASCII dev rev level (8*4b) */ u_char sc_extmessg[NDPS][5]; /* For extended messages */ u_char sc_siioddbyte[NDPS]; /* Used for SII to hold the ODD BYTE */ int sc_siireqack[NDPS]; /* The req/ack offset for each target */ int sc_siisentsync[NDPS]; /* Tells if Sync DataXfer Messg sent */ int sc_siidmacount[NDPS]; /* Used for SII for I/O transfers >8K */ long sc_siidboff[NDPS]; /* Special RAM buffer offsets for SII */ int sc_rzspecial[NDPS]; /* Used for the "rzdisk" utility */ char *sc_rzparams[NDPS]; /* Used for the "rzdisk" utility */ char *sc_rzaddr[NDPS]; /* Used for the "rzdisk" utility */ struct sz_exsns_dt sc_rzsns[NDPS];/* Used for the "rzdisk" utility */ u_short sc_mc_cnt[NDPS]; /* Floppy media changed counter */ struct timeval sc_progress; /* last time progress occurred */ long targ_lun[NDPS]; /* target lun global (for ECRM) */ /* TODO: sc_progress set but not used */ /* Parameters for the BBR code */ int sc_bbr_active[NDPS]; /* Active flag for BBR state machine */ int sc_bbr_state[NDPS]; /* State for bbr state machine */ int sc_bbr_oper[NDPS]; /* Current operation for bbr */ int sc_bbr_read[NDPS]; /* Read counts */ int sc_bbr_rawr[NDPS]; /* Reassign/write counts */ int sc_bbr_write[NDPS]; /* Write counts */ char *sc_bbraddr[NDPS]; /* Used for BBR data location */ char *sc_bbrparams[NDPS]; /* Used for BBR REASSIGN parameters */};/* * sz_softc names shortened */#define sc_cmd sc_cmdpkt[targid].altcmd.cmd /* Cmd part of cmd pkt*/#define sc_dat sc_cmdpkt[targid].altcmd.dat /* Dat part of cmd pkt*/#define sz_command sc_cmdpkt[targid].sz_cmd /* Command Packet */#define sz_opcode sc_cmdpkt[targid].sz_cmd.opcode /* Command Opcode */#define sz_tur sc_cmdpkt[targid].sz_cmd.cmd.tur /* TEST UNIT READY */#define sz_rwd sc_cmdpkt[targid].sz_cmd.cmd.rwd /* REWIND Comman */#define sz_rqsns sc_cmdpkt[targid].sz_cmd.cmd.sense /* REQUEST SENSE */#define sz_rbl sc_cmdpkt[targid].sz_cmd.cmd.rbl /* REQUEST BLOCK LMTS */ /* DISK: */#define sz_rdcap sc_cmdpkt[targid].sz_cmd.cmd.rdcap /* READ CAPACITY */#define sz_rwl sc_cmdpkt[targid].sz_cmd.cmd.rwl /* Read/Write long */ /* TAPE: */#define sz_t_read sc_cmdpkt[targid].sz_cmd.cmd.t_rw /* READ Command */#define sz_t_write sc_cmdpkt[targid].sz_cmd.cmd.t_rw /* WRITE Command */ /* DISK: */#define sz_d_read sc_cmdpkt[targid].sz_cmd.cmd.d_rw /* READ Command */#define sz_d_write sc_cmdpkt[targid].sz_cmd.cmd.d_rw /* WRITE Command */#define sz_d_rw10 sc_cmdpkt[targid].sz_cmd.cmd.d_rw10 /* R/W 10-byte CDB */#define sz_d_fu sc_cmdpkt[targid].sz_cmd.cmd.d_fu /* FORMAT UNIT */#define sz_d_rb sc_cmdpkt[targid].sz_cmd.cmd.d_rb /* REASSIGN BLOCK */#define sz_d_rdd sc_cmdpkt[targid].sz_cmd.cmd.d_rdd/* READ DEFECT DATA */#define sz_d_vd sc_cmdpkt[targid].sz_cmd.cmd.d_vd /* VERIFY DATA */#define sz_trksel sc_cmdpkt[targid].sz_cmd.cmd.trksel /* TRACK SELECT */#define sz_resunit sc_cmdpkt[targid].sz_cmd.cmd.runit /* RESERVE UNIT */#define sz_wfm sc_cmdpkt[targid].sz_cmd.cmd.wfm /* WRITE FILEMARKS */#define sz_space sc_cmdpkt[targid].sz_cmd.cmd.space /* SPACE Command */#define sz_inq sc_cmdpkt[targid].sz_cmd.cmd.inq /* INQUIRY Command */#define sz_vfy sc_cmdpkt[targid].sz_cmd.cmd.vfy /* VERIFY Command */#define sz_rbd sc_cmdpkt[targid].sz_cmd.cmd.rw /* RCVR BUFFERED DATA */#define sz_modsel sc_cmdpkt[targid].sz_cmd.cmd.modsel /* MODE SELECT */#define sz_relunit sc_cmdpkt[targid].sz_cmd.cmd.runit /* RELEASE UNIT */#define sz_erase sc_cmdpkt[targid].sz_cmd.cmd.erase /* ERASE Command */#define sz_modsns sc_cmdpkt[targid].sz_cmd.cmd.sense /* MODE SENSE Command*/#define sz_load sc_cmdpkt[targid].sz_cmd.cmd.ld /* LOAD Command */#define sz_unload sc_cmdpkt[targid].sz_cmd.cmd.ld /* UNLOAD Command */#define sz_recdiag sc_cmdpkt[targid].sz_cmd.cmd.recdiag /* REC DIAG RESULT */#define sz_snddiag sc_cmdpkt[targid].sz_cmd.cmd.diag /* SEND DIAGNOSTIC */#define sz_copy sc_cmdpkt[targid].sz_cmd.cmd.copy /* SEND COPY *//* * Values for sc_selstat */#define SZ_IDLE 0 /* The device is not selected (BUS Free) */#define SZ_SELECT 1 /* The device is selected */#define SZ_DISCONN 2 /* The device has disconnected */#define SZ_RESELECT 3 /* The device is in the reselection process */#define SZ_BBWAIT 4 /* Bus Busy Wait (wait for bus free) */#define SZ_SELTIMO 5 /* Waiting for select (250 MS timeout) *//* * State Machine Events */#define SZ_CONT 0 /* Continue wherever processing left off */#define SZ_BEGIN 1 /* BEGIN processing requests from the queue */#define SZ_DMA_DONE 2 /* DMA count to zero interrupt */#define SZ_PAR_ERR 3 /* Parity Error interrupt */#define SZ_PHA_MIS 4 /* Phase Mismatch interrupt */#define SZ_RESET 5 /* RST interrupt */#define SZ_CMD 6 /* In Command Mode (Status/Positioning Cmd) */#define SZ_DMA 7 /* Data transfer using DMA */#define SZ_ABORT 8 /* Abort the fuzzy transfer */#define SZ_ERROR 9 /* An error event occured */#define SZ_TIMEOUT 10 /* Timer expired */#define SZ_FREEB 11 /* Bus needs to be freed */#define SZ_SELWAIT1 12 /* Select timeout wait events */#define SZ_SELWAIT2 13/* * Number of retries for data transfer (RW) * and non data transfer (SP) commands. * Note: values are equal for now, but that could change. */#define SZ_SP_RTCNT 1#define SZ_RW_RTCNT 1/* * Number of seconds to wait before retrying the command * when a target return busy status. Currently we wait * one second. * NOTE: used by SII code, not by NCR 5380 code. */#define SZ_BUSY_WAIT 1/* * Return Status from various routines */#define SZ_SUCCESS 0 /* Success */#define SZ_IP 1 /* In Progress */#define SZ_RET_ERR 2 /* Error condition occured */#define SZ_RET_ABORT 3 /* Command aborted in scsistart() */#define SZ_DISCONNECT 4 /* Phase Error */#define SZ_RETRY 5 /* The command failed, retries may succeed */#define SZ_FATAL 6 /* The command failed, retries will fail */#define SZ_BUSBUSY 7 /* SCSI bus arbitration failed (put off cmd) */#define SZ_SELBUSY 8 /* Wait for 250 MS select timeout */#define SZ_RET_RESET 9 /* Bus being reset (bail out, restart later) */#define SZ_TARGBUSY 10 /* Target is busy, resend command later */#define b_retry b_bufsize /* Local command buffer [see tzcommand()] */#define b_comand b_gid /* Local command buffer [see tzcommand()] *//* * General defines for Common values used with the option tables. * Ie generic densities etc.*/#define NO_OPTTABLE 0X0 /* make sure its null if no option table */ /* Block sizes defined - some of the common ones */#define SCSI_QIC_FIXED 512 /* for densities 24, 120, 150 */#define SCSI_QIC_320_FIXED 1024 /* for fixed 320 density */#define SCSI_VARIABLE 0 /* varible block size */ /* QIC SCSI density codes */#define SCSI_QIC_UNKNOWN 0x0 /* QIC density is unknown. */#define SCSI_QIC_24_DENS 0x5 /* QIC 24 density code */#define SCSI_QIC_120_DENS_ECC 0xd /* QIC 120 density with ECC. */#define SCSI_QIC_150_DENS_ECC 0xe /* QIC 150 density with ECC. */#define SCSI_QIC_120_DENS 0xf /* QIC 120 density code */#define SCSI_QIC_150_DENS 0x10 /* QIC 150 density code */#define SCSI_QIC_320_DENS 0x11 /* QIC 320 density code */ /* SCSI 9 track density codes */#define SCSI_DENS_DEFAULT 0 /* default with this density */#define SCSI_800 0x1 /* 800 bpi */#define SCSI_1600 0x2 /* 1600 bpi */#define SCSI_6250 0x3 /* 6250 bpi */#define SCSI_SPEED_MASK 0xf /* Mask the char to 4 bits. */#define SCSI_DENS_MASK 0xff /* Mask off the int to a char *//* Instructions for setting up a tape_opt_tab structure. * * The tape option table structure allows for easy addition of a * a SCSI bus tape drive. The table directs the SCSI driver to * format scsi command packets with certain lengths, density codes * number of file marks on close etc. The tape option table is * and array of structures each having the type of struct tape_opt_tab. * The struct devtab entry for the device has a pointer declared called * opt_tab. This pointer can either be null for no option table or can * contain the address of the tape option table entry for this device. * There are some pre-defined tape option table entries for units already * known. If there is not an entry that describes your tape device you * can add an entry to the end of the table. * * Each tape option table structure has 2 parts. The first part is the * device specific part which describes what type of tape unit the * device is, and some out/in going data sizes. The second part of * the struct is an array of structures that descibes the actions * for each of the possible densities. There can be only 4 densities * descibed by the major/minor pair for the device. Below is an * example of the rmt0 device in the /dev directory. Bits 5 and 4 * of minor number are used for density selection. * * Bit 5 | Bit 4 * |-------------| * rmt0l | 0 | 0 | low density device * rmt0h | 0 | 1 | high density device * rmt0m | 1 | 0 | medium density device * rmt0a | 1 | 1 | auxilary density device * |-------------| * * Structure flags and members explainations * * opt_flags * MSEL_PLL_VAL * This flag is used in conjuction with the struct member * msel_pll. The flag tells the driver if the field msel_pll * is valid and available for use. The msel_pll member is * the mode select parameter list length. This field is * used for the mode select command to specify the length * of the parameter list. If this field is not valid a paramter * list length of 0 is used. This can cause problems with density * selection and other options. Please refer to your SCSI devices * technical manual for the length of your devices parameter * list. * MSEL_BLKDL_VAL * This flag is used in conjuction with the struct member * msel_blkdl. The flag tells the driver if the field msel_blkdl * is valid and available for use. The msel_blkdl member is * the mode select block descriptor list length. This field is * used for the mode select command to specify the length * of the block descriptor list. If this field is not valid a * block descriptor list length of zero is used. This can cause * problems with density selection and other options. * Please refer to your SCSI devices technical manual for the * length of your devices block descriptor list. * MSEL_VUL_VAL * This flag is used in conjuction with the struct member
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -