📄 wd7000.h
字号:
* WD7000-specific scatter/gather element structure */typedef struct { unchar len[3]; unchar ptr[3]; /* Also SCSI-style - MSB first */} Sgb;typedef struct { /* Command Control Block 5.4.1 */ unchar op; /* Command Control Block Operation Code */ unchar idlun; /* op=0,2:Target Id, op=1:Initiator Id */ /* Outbound data transfer, length is checked */ /* Inbound data transfer, length is checked */ /* Logical Unit Number */ unchar cdb[12]; /* SCSI Command Block */ volatile unchar status; /* SCSI Return Status */ volatile unchar vue; /* Vendor Unique Error Code */ unchar maxlen[3]; /* Maximum Data Transfer Length */ unchar dataptr[3]; /* SCSI Data Block Pointer */ unchar linkptr[3]; /* Next Command Link Pointer */ unchar direc; /* Transfer Direction */ unchar reserved2[6]; /* SCSI Command Descriptor Block */ /* end of hardware SCB */ Scsi_Cmnd *SCpnt; /* Scsi_Cmnd using this SCB */ Sgb sgb[WD7000_SG]; /* Scatter/gather list for this SCB */ Adapter *host; /* host adapter */ unchar used; /* flag */} Scb;/* * This driver is written to allow host-only commands to be executed. * These use a 16-byte block called an ICB. The format is extended by the * driver to 18 bytes, to support the status returned in the ICMB and * an execution phase code. * * There are other formats besides these; these are the ones I've tried * to use. Formats for some of the defined ICB opcodes are not defined * (notably, get/set unsolicited interrupt status) in my copy of the OEM * manual, and others are ambiguous/hard to follow. */#define ICB_OP_MASK 0x80 /* distinguishes scbs from icbs */#define ICB_OP_OPEN_RBUF 0x80 /* open receive buffer */#define ICB_OP_RECV_CMD 0x81 /* receive command from initiator */#define ICB_OP_RECV_DATA 0x82 /* receive data from initiator */#define ICB_OP_RECV_SDATA 0x83 /* receive data with status from init. */#define ICB_OP_SEND_DATA 0x84 /* send data with status to initiator */#define ICB_OP_SEND_STAT 0x86 /* send command status to initiator */ /* 0x87 is reserved */#define ICB_OP_READ_INIT 0x88 /* read initialization bytes */#define ICB_OP_READ_ID 0x89 /* read adapter's SCSI ID */#define ICB_OP_SET_UMASK 0x8A /* set unsolicited interrupt mask */#define ICB_OP_GET_UMASK 0x8B /* read unsolicited interrupt mask */#define ICB_OP_GET_REVISION 0x8C /* read firmware revision level */#define ICB_OP_DIAGNOSTICS 0x8D /* execute diagnostics */#define ICB_OP_SET_EPARMS 0x8E /* set execution parameters */#define ICB_OP_GET_EPARMS 0x8F /* read execution parameters */typedef struct { unchar op; unchar IDlun; /* Initiator SCSI ID/lun */ unchar len[3]; /* command buffer length */ unchar ptr[3]; /* command buffer address */ unchar rsvd[7]; /* reserved */ volatile unchar vue; /* vendor-unique error code */ volatile unchar status; /* returned (icmb) status */ volatile unchar phase; /* used by interrupt handler */} IcbRecvCmd;typedef struct { unchar op; unchar IDlun; /* Target SCSI ID/lun */ unchar stat; /* (outgoing) completion status byte 1 */ unchar rsvd[12]; /* reserved */ volatile unchar vue; /* vendor-unique error code */ volatile unchar status; /* returned (icmb) status */ volatile unchar phase; /* used by interrupt handler */} IcbSendStat;typedef struct { unchar op; volatile unchar primary; /* primary revision level (returned) */ volatile unchar secondary; /* secondary revision level (returned) */ unchar rsvd[12]; /* reserved */ volatile unchar vue; /* vendor-unique error code */ volatile unchar status; /* returned (icmb) status */ volatile unchar phase; /* used by interrupt handler */} IcbRevLvl;typedef struct { /* I'm totally guessing here */ unchar op; volatile unchar mask[14]; /* mask bits */#if 0 unchar rsvd[12]; /* reserved */#endif volatile unchar vue; /* vendor-unique error code */ volatile unchar status; /* returned (icmb) status */ volatile unchar phase; /* used by interrupt handler */} IcbUnsMask;typedef struct { unchar op; unchar type; /* diagnostics type code (0-3) */ unchar len[3]; /* buffer length */ unchar ptr[3]; /* buffer address */ unchar rsvd[7]; /* reserved */ volatile unchar vue; /* vendor-unique error code */ volatile unchar status; /* returned (icmb) status */ volatile unchar phase; /* used by interrupt handler */} IcbDiag;#define ICB_DIAG_POWERUP 0 /* Power-up diags only */#define ICB_DIAG_WALKING 1 /* walking 1's pattern */#define ICB_DIAG_DMA 2 /* DMA - system memory diags */#define ICB_DIAG_FULL 3 /* do both 1 & 2 */typedef struct { unchar op; unchar rsvd1; /* reserved */ unchar len[3]; /* parms buffer length */ unchar ptr[3]; /* parms buffer address */ unchar idx[2]; /* index (MSB-LSB) */ unchar rsvd2[5]; /* reserved */ volatile unchar vue; /* vendor-unique error code */ volatile unchar status; /* returned (icmb) status */ volatile unchar phase; /* used by interrupt handler */} IcbParms;typedef struct { unchar op; unchar data[14]; /* format-specific data */ volatile unchar vue; /* vendor-unique error code */ volatile unchar status; /* returned (icmb) status */ volatile unchar phase; /* used by interrupt handler */} IcbAny;typedef union { unchar op; /* ICB opcode */ IcbRecvCmd recv_cmd; /* format for receive command */ IcbSendStat send_stat; /* format for send status */ IcbRevLvl rev_lvl; /* format for get revision level */ IcbDiag diag; /* format for execute diagnostics */ IcbParms eparms; /* format for get/set exec parms */ IcbAny icb; /* generic format */ unchar data[18];} Icb;#define WAITnexttimeout 200 /* 2 seconds */typedef union { /* let's cheat... */ int i; unchar u[sizeof (int)]; /* the sizeof(int) makes it more portable */} i_u;#endif /* WD7000_DEFINES */#if (LINUX_VERSION_CODE >= 0x020100)#define WD7000 { \ proc_dir: &proc_scsi_wd7000, \ proc_info: wd7000_proc_info, \ name: "Western Digital WD-7000", \ detect: wd7000_detect, \ command: wd7000_command, \ queuecommand: wd7000_queuecommand, \ abort: wd7000_abort, \ reset: wd7000_reset, \ bios_param: wd7000_biosparam, \ can_queue: WD7000_Q, \ this_id: 7, \ sg_tablesize: WD7000_SG, \ cmd_per_lun: 1, \ unchecked_isa_dma: 1, \ use_clustering: ENABLE_CLUSTERING, \ use_new_eh_code: 0 \}#else /* Use old scsi code */#define WD7000 { \ proc_dir: &proc_scsi_wd7000, \ proc_info: wd7000_proc_info, \ name: "Western Digital WD-7000", \ detect: wd7000_detect, \ command: wd7000_command, \ queuecommand: wd7000_queuecommand, \ abort: wd7000_abort, \ reset: wd7000_reset, \ bios_param: wd7000_biosparam, \ can_queue: WD7000_Q, \ this_id: 7, \ sg_tablesize: WD7000_SG, \ cmd_per_lun: 1, \ unchecked_isa_dma: 1, \ use_clustering: ENABLE_CLUSTERING, \}#endif /* LINUX_VERSION_CODE */extern struct proc_dir_entry proc_scsi_wd7000;#ifdef WD7000_DEFINESint wd7000_diagnostics (Adapter *, int);int wd7000_init (Adapter *);void wd7000_revision (Adapter *);#endif /* WD7000_DEFINES */void wd7000_setup (char *, int *);int make_code (uint, uint);void wd7000_intr_handle (int, void *, struct pt_regs *);void do_wd7000_intr_handle (int, void *, struct pt_regs *);int wd7000_queuecommand (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));int wd7000_command (Scsi_Cmnd *);int wd7000_set_info (char *, int, struct Scsi_Host *);int wd7000_proc_info (char *, char **, off_t, int, int, int);int wd7000_detect (Scsi_Host_Template *);int wd7000_abort (Scsi_Cmnd *);int wd7000_reset (Scsi_Cmnd *, uint);int wd7000_biosparam (Disk *, kdev_t, int *);#endif /* _WD7000_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -