📄 isp_target.h
字号:
u_int8_t at_execodes; u_int8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ u_int32_t at_datalen; /* allocated data len */ u_int16_t at_scclun; /* SCC Lun or reserved */ u_int16_t at_wwpn[4]; /* WWPN of initiator */ u_int16_t at_reserved2[6]; u_int16_t at_oxid;} at2_entry_t;#define ATIO2_WWPN_OFFSET 0x2A#define ATIO2_OXID_OFFSET 0x3E#define ATIO2_TC_ATTR_MASK 0x7#define ATIO2_TC_ATTR_SIMPLEQ 0#define ATIO2_TC_ATTR_HEADOFQ 1#define ATIO2_TC_ATTR_ORDERED 2#define ATIO2_TC_ATTR_ACAQ 4#define ATIO2_TC_ATTR_UNTAGGED 5/* * Continue Target I/O Entry structure * Request from driver. The response from the * ISP firmware is the same except that the last 18 * bytes are overwritten by suggested sense data if * the 'autosense valid' bit is set in the status byte. */typedef struct { isphdr_t ct_header; u_int16_t ct_reserved;#define ct_syshandle ct_reserved /* we use this */ u_int16_t ct_fwhandle; /* required by f/w */ u_int8_t ct_lun; /* lun */ u_int8_t ct_iid; /* initiator id */ u_int8_t ct_reserved2; u_int8_t ct_tgt; /* our target id */ u_int32_t ct_flags; u_int8_t ct_status; /* isp status */ u_int8_t ct_scsi_status; /* scsi status */ u_int8_t ct_tag_val; /* tag value */ u_int8_t ct_tag_type; /* tag type */ u_int32_t ct_xfrlen; /* transfer length */ u_int32_t ct_resid; /* residual length */ u_int16_t ct_timeout; u_int16_t ct_seg_count; /* * This is so we can share tag name space with * CTIO{2,3,4} with the minimum of pain. */ union { ispds_t ct_a[ISP_RQDSEG]; } _u;#define ct_dataseg _u.ct_a} ct_entry_t;/* * For some of the dual port SCSI adapters, port (bus #) is reported * in the MSbit of ct_iid. Bit fields are a bit too awkward here. * * Note that this does not apply to FC adapters at all which can and * do report IIDs between 129 && 255 (these represent devices that have * logged in across a SCSI fabric). */#define GET_IID_VAL(x) (x & 0x3f)#define GET_BUS_VAL(x) ((x >> 7) & 0x1)#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f))#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7))/* * ct_flags values */#define CT_TQAE 0x00000002 /* bit 1, Tagged Queue Action enable */#define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction */#define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction */#define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */#define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */#define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */#define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */#define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */#define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */#define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */#define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte *//* * ct_status values * - set by the firmware when it returns the CTIO */#define CT_OK 0x01 /* completed without error */#define CT_ABORTED 0x02 /* aborted by host */#define CT_ERR 0x04 /* see sense data for error */#define CT_INVAL 0x06 /* request for disabled lun */#define CT_NOPATH 0x07 /* invalid ITL nexus */#define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */#define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */#define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */#define CT_TIMEOUT 0x0B /* timed out */#define CT_RESET 0x0E /* SCSI Bus Reset occurred */#define CT_PARITY 0x0F /* Uncorrectable Parity Error */#define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */#define CT_PANIC 0x13 /* Unrecoverable Error */#define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */#define CT_PORTNOTAVAIL 0x28 /* port not available */#define CT_LOGOUT 0x29 /* port logout */#define CT_PORTCHANGED 0x2A /* port changed */#define CT_IDE 0x33 /* Initiator Detected Error */#define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry *//* * When the firmware returns a CTIO entry, it may overwrite the last * part of the structure with sense data. This starts at offset 0x2E * into the entry, which is in the middle of ct_dataseg[1]. Rather * than define a new struct for this, I'm just using the sense data * offset. */#define CTIO_SENSE_OFFSET 0x2E/* * Entry length in u_longs. All entries are the same size so * any one will do as the numerator. */#define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(u_int32_t))/* * QLA2100 CTIO (type 2) entry */#define MAXRESPLEN 26typedef struct { isphdr_t ct_header; u_int16_t ct_reserved; u_int16_t ct_fwhandle; /* just to match CTIO */ u_int8_t ct_lun; /* lun */ u_int8_t ct_iid; /* initiator id */ u_int16_t ct_rxid; /* response ID */ u_int16_t ct_flags; u_int16_t ct_status; /* isp status */ u_int16_t ct_timeout; u_int16_t ct_seg_count; u_int32_t ct_reloff; /* relative offset */ int32_t ct_resid; /* residual length */ union { /* * The three different modes that the target driver * can set the CTIO{2,3,4} up as. * * The first is for sending FCP_DATA_IUs as well as * (optionally) sending a terminal SCSI status FCP_RSP_IU. * * The second is for sending SCSI sense data in an FCP_RSP_IU. * Note that no FCP_DATA_IUs will be sent. * * The third is for sending FCP_RSP_IUs as built specifically * in system memory as located by the isp_dataseg. */ struct { u_int32_t _reserved; u_int16_t _reserved2; u_int16_t ct_scsi_status; u_int32_t ct_xfrlen; union { ispds_t ct_a[ISP_RQDSEG_T2]; /* CTIO2 */ ispds64_t ct_b[ISP_RQDSEG_T3]; /* CTIO3 */ ispdslist_t ct_c; /* CTIO4 */ } _u;#define ct_dataseg _u.ct_a#define ct_dataseg64 _u.ct_b#define ct_dslist _u.ct_c } m0; struct { u_int16_t _reserved; u_int16_t _reserved2; u_int16_t ct_senselen; u_int16_t ct_scsi_status; u_int16_t ct_resplen; u_int8_t ct_resp[MAXRESPLEN]; } m1; struct { u_int32_t _reserved; u_int16_t _reserved2; u_int16_t _reserved3; u_int32_t ct_datalen; ispds_t ct_fcp_rsp_iudata; } m2; /* * CTIO2 returned from F/W... */ struct { u_int32_t _reserved[4]; u_int16_t ct_scsi_status; u_int8_t ct_sense[QLTM_SENSELEN]; } fw; } rsp;} ct2_entry_t;/* * ct_flags values for CTIO2 */#define CT2_FLAG_MMASK 0x0003#define CT2_FLAG_MODE0 0x0000#define CT2_FLAG_MODE1 0x0001#define CT2_FLAG_MODE2 0x0002#define CT2_DATA_IN CT_DATA_IN#define CT2_DATA_OUT CT_DATA_OUT#define CT2_NO_DATA CT_NO_DATA#define CT2_DATAMASK CT_DATAMASK#define CT2_CCINCR 0x0100#define CT2_FASTPOST 0x0200#define CT2_SENDSTATUS 0x8000/* * ct_status values are (mostly) the same as that for ct_entry. *//* * ct_scsi_status values- the low 8 bits are the normal SCSI status * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU * fields. */#define CT2_RSPLEN_VALID 0x0100#define CT2_SNSLEN_VALID 0x0200#define CT2_DATA_OVER 0x0400#define CT2_DATA_UNDER 0x0800/* * Debug macros */#define ISP_TDQE(isp, msg, idx, arg) \ if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg)#ifdef ISP_TARGET_FUNCTIONS/* * The functions below are for the publicly available * target mode functions that are internal to the Qlogic driver. *//* * This function handles new response queue entry appropriate for target mode. */int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);/* * Enable/Disable/Modify a logical unit. * (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque) */#define DFLT_CMND_CNT 32#define DFLT_INOT_CNT 4int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);/* * General request queue 'put' routine for target mode entries. */int isp_target_put_entry(struct ispsoftc *isp, void *);/* * General routine to put back an ATIO entry- * used for replenishing f/w resource counts. * The argument is a pointer to a source ATIO * or ATIO2. */int isp_target_put_atio(struct ispsoftc *, void *);/* * General routine to send a final CTIO for a command- used mostly for * local responses. */int isp_endcmd(struct ispsoftc *, void *, u_int32_t, u_int16_t);#define ECMD_SVALID 0x100/* * Handle an asynchronous event */void isp_target_async(struct ispsoftc *, int, int);#endif#endif /* _ISP_TARGET_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -