📄 scsivar.h
字号:
u_char speed:4; /* was mbz2 now speed */ u_char bufmode:3; /* Buffered Mode */ u_char wp:1; /* Write Protect */ u_char bdeclen; /* Block Descriptor Length */ /* Parameter List Block Descriptor */ u_char density; /* was mbz3 now density */ u_char numofblk2; /* Number of Blocks (MSB) */ u_char numofblk1; /* Number of Blocks */ u_char numofblk0; /* Number of Blocks (LSB) */ u_char :8; /* Reserved */ u_char blklen2; /* Block Length (MSB) */ u_char blklen1; /* Block Length */ u_char blklen0; /* Block Length (LSB) */ u_char vulen; /* Vendor Unique Length */ u_char nof:2; /* Enable Fillers */ u_char mbz4:5; /* Must be Zero */ u_char vu7:1; /* Direct Track Access */ u_char pad[6]; /* Pad */ u_char pad1[24]; }modsns; /* * MODE SENSE Data for DISKS */ struct sz_rzmodsns_dt { /* Parameter List Header */ u_char sdlen; /* Sense Data Length */ u_char medtyp; /* Medium Type */ u_char : 7; /* Reserved */ u_char wp : 1; /* Write Protect */ u_char bdlen; /* Block Descriptor Length */ /* Parameter List Block Descriptor */ u_char dencode; /* Density Code */ u_char nblks2; /* Number of Blocks (MSB) */ u_char nblks1; /* Number of Blocks */ u_char nblks0; /* Number of Blocks (LSB) */ u_char : 8; /* Reserved */ u_char blklen2; /* Block Length (MSB) */ u_char blklen1; /* Block Length */ u_char blklen0; /* Block Length (LSB) */ /* Parameter List Page Data (32 bytes, one page only) */ u_char mspage[32]; /* Page header and data */ }rzmodsns; /* * RECEIVE DIAGNOSTIC RESULT Data */ struct sz_recdiag_dt { u_char ctlr_hd_rev; /* Controller hardware revision level */ u_char ctlr_fw_rev; /* Controller firmware revision level */ u_char ctlr_selftest; /* Controller selftest 0 = Passed */ /* 1 = Failed */ u_char drv_hw_rev; /* Drive hardware revision level */ u_char drv_fw_rev; /* Drive firmware revision level */ u_char drv_selftest; /* Drive selftest 0 = Passed */ /* xx = Failure Code */ /* TODO: why no pad? */ }recdiag; }dat;};/* * Define Masks for SCSI Group Codes. */#define SCSI_GROUP_0 0x00 /* SCSI Group Code 0. */#define SCSI_GROUP_1 0x20 /* SCSI Group Code 1. */#define SCSI_GROUP_2 0x40 /* SCSI Group Code 2. */#define SCSI_GROUP_3 0x60 /* SCSI Group Code 3. */#define SCSI_GROUP_4 0x80 /* SCSI Group Code 4. */#define SCSI_GROUP_5 0xA0 /* SCSI Group Code 5. */#define SCSI_GROUP_6 0xC0 /* SCSI Group Code 6. */#define SCSI_GROUP_7 0xE0 /* SCSI Group Code 7. */#define SCSI_GROUP_MASK 0xE0 /* SCSI Group Code mask. *//* * SCSI Command Opcodes: */#define SZ_TUR 0x00 /* TEST UNIT READY Command */#define SZ_REWIND 0x01 /* REWIND Command */#define SZ_RQSNS 0x03 /* REQUEST SENSE Command */#define SZ_RBL 0x05 /* READ BLOCK LIMITS Command */#define SZ_READ 0x08 /* READ Command */#define SZ_WRITE 0x0a /* WRITE Command */#define SZ_TRKSEL 0x0b /* TRACK SELECT Comand */#define SZ_RESUNIT 0x16 /* RESERVE UNIT Command */#define SZ_WFM 0x10 /* WRITE FILEMARKS Command */#define SZ_SPACE 0x11 /* SPACE Command */#define SZ_INQ 0x12 /* INQUIRY Command */#define SZ_VFY 0x13 /* VERIFY Command */#define SZ_RBD 0x14 /* RECOVER BUFFERED DATA Command */#define SZ_MODSEL 0x15 /* MODE SELECT Command */#define SZ_RELUNIT 0x17 /* RELEASE UNIT Command */#define SZ_ERASE 0x19 /* ERASE Command */#define SZ_MODSNS 0x1a /* MODE SENSE Command */#define SZ_SSLU 0x1b /* START/STOP or LOAD/UNLOAD Command */#define SZ_RECDIAG 0x1c /* RECEIVE DIAGNOSTIC RESULT Command */#define SZ_SNDDIAG 0x1d /* SEND DIAGNOSTIC Command */#define SZ_RDCAP 0x25 /* DISK: READ CAPACITY */#define SZ_FORMAT 0x04 /* DISK: FORMAT UNIT Command */#define SZ_REASSIGN 0x07 /* DISK: REASSIGN BLOCK Command */#define SZ_READ_10 0x28 /* DISK: READ 10-byte Command. */#define SZ_WRITE_10 0x2A /* DISK: WRITE 10-byte Command. */#define SZ_VFY_DATA 0x2f /* DISK: VERIFY DATA Command */#define SZ_RDD 0x37 /* DISK: READ DEFECT DATA Command */#define SZ_READL 0x3E /* DISK: READ LONG Command */#define SZ_WRITEL 0x3F /* DISK: WRITE LONG Command */#define RZSPECIAL 0x8000 /* DISK: set for special disk commands*//* * Group 2 - Psuedo SCSI Commands. */#define SZ_P_FSPACER 0x40 /* Psuedo opcode for space record */#define SZ_P_FSPACEF 0x41 /* Psuedo opcode for space file */#define SZ_P_BSPACER 0x42 /* Psuedo opcode for backspace record */#define SZ_P_BSPACEF 0x43 /* Psuedo opcode for backspace file */#define SZ_P_CACHE 0x44 /* Psuedo opcode for buffered mode */#define SZ_P_NOCACHE 0x45 /* Psuedo opcode for no buffered mode */#define SZ_P_LOAD 0x46 /* Pseudo opcode for load (not used) */#define SZ_P_UNLOAD 0x47 /* Pseudo opcode for unload */#define SZ_P_SSUNIT 0x48 /* Pseudo opcode for start/stop unit */#define SZ_P_RETENSION 0x49 /* Psuedo opcode for retension *//* * SCSI Command Data structure names shortened */#define szdt_exsns sz_datfmt.dat.exsns /* EXTENDED SENSE Data */#define szdt_rbl sz_datfmt.dat.rbl /* READ BLOCK LIMITS Data */#define szdt_rdcap sz_datfmt.dat.rdcap /* DISK: READ CAPACITY Data */#define szdt_inq sz_datfmt.dat.inq /* INQUIRY Data */#define szdt_modsel sz_datfmt.dat.modsel /* MODE SELECT Data */#define szdt_modsns sz_datfmt.dat.modsns /* MODE SENSE Data *//* * SCSI STATUS Byte */#define SZ_GOOD 0x00 /* Good */#define SZ_CHKCND 0x02 /* Check Condition */#define SZ_BUSY 0x08 /* Device cannot accept a command (busy) */#define SZ_INTRM 0x10 /* Intermediate */#define SZ_RESCNF 0x18 /* Reservation Conflict *//* * Fake SCSI STATUS Byte. */#define SZ_BAD 0xff /* Fatal error command (couldn't do RQSNS) *//* * SCSI Message Protocols */#define SZ_CMDCPT 0x00 /* Command Complete */#define SZ_EXTMSG 0x01 /* Extended message */#define SZ_SDP 0x02 /* Save Data Pointers */#define SZ_RDP 0x03 /* Restore Data Pointers (DISK: new) */#define SZ_DISCON 0x04 /* Disconnect */#define SZ_IDE 0x05 /* Initiator Detected Error */#define SZ_ABT 0x06 /* Abort */#define SZ_MSGREJ 0x07 /* Message Reject */#define SZ_NOP 0x08 /* No Operation */#define SZ_MSGPE 0x09 /* Message Parity Error */#define SZ_LNKCMP 0x0a /* Linked Command Complete */#define SZ_LNKCMPF 0x0b /* Linked Command Complete with Flag */#define SZ_DEVRST 0x0c /* Bus Device Reset */#define SZ_ID_NODIS 0x80 /* IDENTIFY wo/ disconnect capability, */#define SZ_ID_DIS 0xc0 /* IDENTIFY w/ disconnect capability, *//* * SCSI Extended Message Codes */#define SZ_MOD_DP 0x00 /* Modify Data Pointer */#define SZ_SYNC_XFER 0x01 /* Synchronous Data Transfer Request */#define SZ_EXT_ID 0x02 /* Extended Identify *//* * Command Data allocation constants */#define SZ_INQ_MAXLEN 44 /* number of bytes for INQUIRY data (MAX) */#define SZ_INQ_MINLEN 5 /* number of bytes for INQUIRY data (MIN) */ /* next 3 must match sz_inq_dt struct below */#define SZ_VID_LEN 8 /* INQUIRY data vendor ID field length */#define SZ_PID_LEN 16 /* INQUIRY data product ID field length */#define SZ_REV_LEN 4 /* INQUIRY data revision level field length */#define SZ_RECDIAG_LEN 6 /* number of bytes for RECEIVE DIAG data */#define SZ_RDCAP_LEN 8 /* number of bytes for READ CAPACITY data */#define SZ_RQSNS_LEN 20 /* number of bytes for REQUEST SENSE data */#define SZ_MODSNS_LEN 14 /* number of bytes for MODE SENSE data */#define SZ_MODSEL_LEN 14 /* number of bytes for MODE SELECT data */ /* NOTE: DATAO: subtracts 2 for disk/cdrom */#define SZ_MAX_DT_LEN 44 /* Size of sz_datfmt structure *//* * Command Packet Length constants */#define SZ_MAX_CMD_LEN 22 /* maximum command length in bytes */#define SZ_MODSEL_CMD_LEN 20 /* maximum length of modsel command */#define SZ_RDCAP_CMD_LEN 10 /* length of DISK read capacity cmd */#define SZ_CMD_LEN 6 /* length of commands in bytes *//* * Define Maximum Logical Block Address (LBA) for a 6-byte CDB. */#define SZ_MAX_LBA 0x1fffff /* Maximum 6-byte CDB LBA. *//* * Miscellaneous Constants */#define SZ_DEFAULT_FILLS 7 /* Default number of fills that can */ /* be written to keep tape streaming. */#define DEFAULT_SCSIID 7 /* Default system scsi id *//* * MACRO for converting a longword to a byte * args - the longword * - which byte in the longword you want */#define LTOB(a,b) ((a>>(b*8))&0xff)/* MACROS for timing out spin loops. * * desc: Waits while expression is true. * * args: expr - expression to spin on * spincount - amount of time to wait in microseconds * retval - return value of this macro */#define SZWAIT_WHILE(expr,spincount,retval) { \ for (retval = 0; ((retval < 100) && (expr)); retval++); \ while ((expr) && ( retval < spincount)) { \ DELAY(100); \ retval++; \ } \ }/* * desc: Waits unitl expression is true. */#define SZWAIT_UNTIL(expr,spincount,retval) { \ SZWAIT_WHILE((!expr),spincount,retval); \ }/* * macro for converting the density selection in the * minor number out of the buf struct into a tape option * struct index.*/#define DENS_IDX(bp) ((((minor(bp->b_dev))&DENS_MASK)>>3))/* * Request Sense Sense Key Codes. * Sense keys without comments are unsupported * becasue DEC devices don't use them. * TODO: comments are tape specific should be general? */#define SZ_NOSENSE 0x00 /* Successful cmd or EOT, ILI, FILEMARK */#define SZ_RECOVERR 0x01 /* Successful cmd with controller recovery */#define SZ_NOTREADY 0x02 /* Device present but not ready */#define SZ_MEDIUMERR 0x03 /* Cmd terminated with media flaw */#define SZ_HARDWARE 0x04 /* Controller or drive hardware error */#define SZ_ILLEGALREQ 0x05 /* Illegal command or command parameters */#define SZ_UNITATTEN 0x06 /* Unit Attention */#define SZ_DATAPROTECT 0x07 /* Write attempted to write protected media */#define SZ_BLANKCHK 0x08 /* Read zero length record (EOD) */#define SZ_VNDRUNIQUE 0x09#define SZ_COPYABORTD 0x0a#define SZ_ABORTEDCMD 0x0b /* Cmd aborted that may retry successfully */#define SZ_EQUAL 0x0c#define SZ_VOLUMEOVFL 0x0d /* Buffer data left over after EOM */#define SZ_MISCOMPARE 0x0e /* Miscompare on Verify command */#define SZ_RESERVED 0x0f/* Additional sence code values for extended sence data. */#define SZ_ASC_RRETRY 0x17#define SZ_ASC_RERROR 0x18/* * Top Level State Machine *//* Status/Positioning States */#define SZ_NEXT 0 /* Process next request from queue */#define SZ_SP_START 1 /* Start a Status or Positioning Operation */#define SZ_SP_CONT 2 /* Continue SZ_SP_SETUP: *//* Read/Write (DMA) States */#define SZ_RW_START 3 /* Setup a Read or Write Operation */#define SZ_RW_CONT 4 /* Start/Continue a Read or Write Operation */#define SZ_R_STDMA 5 /* Start DMA READ */#define SZ_W_STDMA 6 /* Start DMA WRITE */#define SZ_R_DMA 7 /* Read DMA processing */#define SZ_W_DMA 8 /* Write DMA processing */#define SZ_R_COPY 9 /* Copy READ data to memory */#define SZ_ERR 10 /* DMA Error *//* * Bottom Level State Machine */#define SZ_SP_ARB 0 /* Arbitrate for the Bus */#define SZ_SP_SEL 1 /* Select the target device */#define SZ_CMD_PHA 2 /* Command Phase */#define SZ_DATAO_PHA 3 /* Data Out Phase */#define SZ_DATAI_PHA 4 /* Data In Phase */#define SZ_STATUS_PHA 5 /* Status Phase */#define SZ_MESSI_PHA 6 /* Message In Phase */#define SZ_MESSO_PHA 7 /* Message Out Phase */#define SZ_RELBUS 8 /* Release the Bus *//* * define for fixed block tape units scsi. * Since there are no record boundaries we * now must remember if a tape mark is pending*/#define TPMARK_PENDING 0X80000000#endif /* SCSIVAR_INCLUDE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -