aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/isp/ispmbox.h
diff options
context:
space:
mode:
authorMatt Jacob <mjacob@FreeBSD.org>2012-07-28 20:06:29 +0000
committerMatt Jacob <mjacob@FreeBSD.org>2012-07-28 20:06:29 +0000
commit387d8239fb5e7a6023d4627b3bc0e3afbf22af03 (patch)
treee1ac1dcf97e2541ae902e508daa253c99de306c4 /sys/dev/isp/ispmbox.h
parenta277f47bd2e7d2f9475b85fd58722f8716e22f16 (diff)
downloadsrc-387d8239fb5e7a6023d4627b3bc0e3afbf22af03.tar.gz
src-387d8239fb5e7a6023d4627b3bc0e3afbf22af03.zip
-----------
MISC CHANGES Add a new async event- ISP_TARGET_NOTIFY_ACK, that will guarantee eventual delivery of a NOTIFY ACK. This is tons better than just ignoring the return from isp_notify_ack and hoping for the best. Clean up the lower level lun enable code to be a bit more sensible. Fix a botch in isp_endcmd which was messing up the sense data. Fix notify ack for SRR to use a sensible error code in the case of a reject. Clean up and make clear what kind of firmware we've loaded and what capabilities it has. ----------- FULL (252 byte) SENSE DATA In CTIOs for the ISP, there's only a limimted amount of space to load SENSE DATA for associated CHECK CONDITIONS (24 or 26 bytes). This makes it difficult to send full SENSE DATA that can be up to 252 bytes. Implement MODE 2 responses which have us build the FCP Response in system memory which the ISP will put onto the wire directly. On the initiator side, the same problem occurs in that a command status response only has a limited amount of space for SENSE DATA. This data is supplemented by status continuation responses that the ISP pushes onto the response queue after the status response. We now pull them all together so that full sense data can be returned to the periph driver. This is supported on 23XX, 24XX and 25XX cards. This is also preparation for doing >16 byte CDBs. ----------- FC TAPE Implement full FC-TAPE on both initiator and target mode side. This capability is driven by firmware loaded, board type, board NVRAM settings, or hint configuration options to enable or disable. This is supported for 23XX, 24XX and 25XX cards. On the initiator side, we pretty much just have to generate a command reference number for each command we send out. This is FCP-4 compliant in that we do this per ITL nexus to generate the allowed 1 thru 255 CRN. In order to support the target side of FC-TAPE, we now pay attention to more of the PRLI word 3 parameters which will tell us whether an initiator wants confirmed responses. While we're at it, we'll pay attention to the initiator view too and report it. On sending back CTIOs, we will notice whether the initiator wants confirmed responses and we'll set up flags to do so. If a response or data frame is lost the initiator sends us an SRR (Sequence Retransmit Request) ELS which shows up as an SRR notify and all outstanding CTIOs are nuked with SRR Received status. The SRR notify contains the offset that the initiator wants us to restart the data transfer from or to retransmit the response frame. If the ISP driver still has the CCB around for which the data segment or response applies, it will retransmit. However, we typically don't know about a lost data frame until we send the FCP Response and the initiator totes up counters for data moved and notices missing segments. In this case we've already completed the data CCBs already and sent themn back up to the periph driver. Because there's no really clean mechanism yet in CAM to handle this, a hack has been put into place to complete the CTIO CCB with the CAM_MESSAGE_RECV status which will have a MODIFY DATA POINTER extended message in it. The internal ISP target groks this and ctl(8) will be modified to deal with this as well. At any rate, the data is retransmitted and an an FCP response is sent. The whole point here is to successfully complete a command so that you don't have to depend on ULP (SCSI) to have to recover, which in the case of tape is not really possible (hence the name FC-TAPE). Sponsored by: Spectralogic MFC after: 1 month
Notes
Notes: svn path=/head/; revision=238869
Diffstat (limited to 'sys/dev/isp/ispmbox.h')
-rw-r--r--sys/dev/isp/ispmbox.h112
1 files changed, 42 insertions, 70 deletions
diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h
index c86ce6030965..85b31e515944 100644
--- a/sys/dev/isp/ispmbox.h
+++ b/sys/dev/isp/ispmbox.h
@@ -428,7 +428,8 @@ typedef struct {
uint8_t req_target;
uint16_t req_scclun;
uint16_t req_flags;
- uint16_t req_reserved;
+ uint8_t req_crn;
+ uint8_t req_reserved;
uint16_t req_time;
uint16_t req_seg_count;
uint8_t req_cdb[16];
@@ -458,7 +459,8 @@ typedef struct {
uint8_t req_target;
uint16_t req_scclun;
uint16_t req_flags;
- uint16_t req_reserved;
+ uint8_t req_crn;
+ uint8_t req_reserved;
uint16_t req_time;
uint16_t req_seg_count;
uint8_t req_cdb[16];
@@ -473,7 +475,8 @@ typedef struct {
uint16_t req_target;
uint16_t req_scclun;
uint16_t req_flags;
- uint16_t req_reserved;
+ uint8_t req_crn;
+ uint8_t req_reserved;
uint16_t req_time;
uint16_t req_seg_count;
uint8_t req_cdb[16];
@@ -515,40 +518,10 @@ typedef struct {
uint8_t req_cdb[44];
} ispextreq_t;
-/* 24XX only */
-typedef struct {
- uint16_t fcd_length;
- uint16_t fcd_a1500;
- uint16_t fcd_a3116;
- uint16_t fcd_a4732;
- uint16_t fcd_a6348;
-} fcp_cmnd_ds_t;
-
-typedef struct {
- isphdr_t req_header;
- uint32_t req_handle;
- uint16_t req_nphdl;
- uint16_t req_time;
- uint16_t req_seg_count;
- uint16_t req_fc_rsp_dsd_length;
- uint8_t req_lun[8];
- uint16_t req_flags;
- uint16_t req_fc_cmnd_dsd_length;
- uint16_t req_fc_cmnd_dsd_a1500;
- uint16_t req_fc_cmnd_dsd_a3116;
- uint16_t req_fc_cmnd_dsd_a4732;
- uint16_t req_fc_cmnd_dsd_a6348;
- uint16_t req_fc_rsp_dsd_a1500;
- uint16_t req_fc_rsp_dsd_a3116;
- uint16_t req_fc_rsp_dsd_a4732;
- uint16_t req_fc_rsp_dsd_a6348;
- uint32_t req_totalcnt;
- uint16_t req_tidlo;
- uint8_t req_tidhi;
- uint8_t req_vpidx;
- ispds64_t req_dataseg;
-} ispreqt6_t;
+/*
+ * ISP24XX structures
+ */
typedef struct {
isphdr_t req_header;
uint32_t req_handle;
@@ -945,7 +918,7 @@ typedef struct {
#define ICBOPT_SRCHDOWN 0x0400
#define ICBOPT_NOLIP 0x0200
#define ICBOPT_PDBCHANGE_AE 0x0100
-#define ICBOPT_INI_TGTTYPE 0x0080
+#define ICBOPT_TGT_TYPE 0x0080
#define ICBOPT_INI_ADISC 0x0040
#define ICBOPT_INI_DISABLE 0x0020
#define ICBOPT_TGT_ENABLE 0x0010
@@ -1044,7 +1017,7 @@ typedef struct {
#define ICB_DFLT_RCOUNT 3
#define ICB_LOGIN_TOV 30
-#define ICB_LUN_ENABLE_TOV 180
+#define ICB_LUN_ENABLE_TOV 15
/*
@@ -1272,10 +1245,8 @@ typedef struct {
#define PDB_STATE_PLOGO 10
#define PDB_STATE_PLOG_ACK 11
-#define SVC3_TGT_ROLE 0x10
-#define SVC3_INI_ROLE 0x20
-#define SVC3_ROLE_MASK 0x30
-#define SVC3_ROLE_SHIFT 4
+#define SVC3_ROLE_MASK 0x30
+#define SVC3_ROLE_SHIFT 4
#define BITS2WORD(x) ((x)[0] << 16 | (x)[3] << 8 | (x)[2])
#define BITS2WORD_24XX(x) ((x)[0] << 16 | (x)[1] << 8 | (x)[2])
@@ -1321,8 +1292,8 @@ typedef struct {
*/
typedef struct {
uint16_t handle;
- uint16_t reserved;
- uint32_t s3_role : 8,
+ uint16_t prli_word3;
+ uint32_t : 8,
portid : 24;
uint8_t portname[8];
uint8_t nodename[8];
@@ -1781,6 +1752,7 @@ typedef struct {
#define IN_PORT_CHANGED 0x2A /* port changed */
#define IN_GLOBAL_LOGO 0x2E /* all ports logged out */
#define IN_NO_NEXUS 0x3B /* Nexus not established */
+#define IN_SRR_RCVD 0x45 /* SRR received */
/*
* Values for the in_task_flags field- should only get one at a time!
@@ -1811,24 +1783,17 @@ typedef struct {
uint16_t in_srr_iu;
uint16_t in_srr_oxid;
/*
- * If bit 2 is set in in_flags, the following
- * two tags are valid. If the received ELS is
+ * If bit 2 is set in in_flags, the N-Port and
+ * handle tags are valid. If the received ELS is
* a LOGO, then these tags contain the N Port ID
* from the LOGO payload. If the received ELS
* request is TPRLO, these tags contain the
* Third Party Originator N Port ID.
*/
uint16_t in_nport_id_hi;
+#define in_prli_options in_nport_id_hi
uint8_t in_nport_id_lo;
uint8_t in_reserved3;
- /*
- * If bit 2 is set in in_flags, the following
- * tag is valid. If the received ELS is a LOGO,
- * then this tag contains the n-port handle
- * from the LOGO payload. If the received ELS
- * request is TPRLO, this tag contain the
- * n-port handle for the Third Party Originator.
- */
uint16_t in_np_handle;
uint8_t in_reserved4[12];
uint8_t in_reserved5;
@@ -2183,7 +2148,7 @@ typedef struct {
uint8_t ct_tag_val; /* tag value */
uint8_t ct_tag_type; /* tag type */
uint32_t ct_xfrlen; /* transfer length */
- int32_t ct_resid; /* residual length */
+ uint32_t ct_resid; /* residual length */
uint16_t ct_timeout;
uint16_t ct_seg_count;
ispds_t ct_dataseg[ISP_RQDSEG];
@@ -2206,8 +2171,8 @@ typedef struct {
* 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_DATA_IN 0x00000040 /* bits 6&7, Data direction - *to* initiator */
+#define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction - *from* initiator */
#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 */
@@ -2278,7 +2243,7 @@ typedef struct {
uint16_t ct_timeout;
uint16_t ct_seg_count;
uint32_t ct_reloff; /* relative offset */
- int32_t ct_resid; /* residual length */
+ uint32_t ct_resid; /* residual length */
union {
/*
* The three different modes that the target driver
@@ -2317,7 +2282,10 @@ typedef struct {
uint16_t _reserved2;
uint16_t _reserved3;
uint32_t ct_datalen;
- ispds_t ct_fcp_rsp_iudata;
+ union {
+ ispds_t ct_fcp_rsp_iudata_32;
+ ispds64_t ct_fcp_rsp_iudata_64;
+ } u;
} m2;
} rsp;
} ct2_entry_t;
@@ -2332,7 +2300,7 @@ typedef struct {
uint16_t ct_timeout;
uint16_t ct_seg_count;
uint32_t ct_reloff; /* relative offset */
- int32_t ct_resid; /* residual length */
+ uint32_t ct_resid; /* residual length */
union {
struct {
uint32_t _reserved;
@@ -2358,7 +2326,10 @@ typedef struct {
uint16_t _reserved2;
uint16_t _reserved3;
uint32_t ct_datalen;
- ispds_t ct_fcp_rsp_iudata;
+ union {
+ ispds_t ct_fcp_rsp_iudata_32;
+ ispds64_t ct_fcp_rsp_iudata_64;
+ } u;
} m2;
} rsp;
} ct2e_entry_t;
@@ -2370,8 +2341,8 @@ typedef struct {
#define CT2_FLAG_MODE1 0x0001
#define CT2_FLAG_MODE2 0x0002
#define CT2_FLAG_MMASK 0x0003
-#define CT2_DATA_IN 0x0040
-#define CT2_DATA_OUT 0x0080
+#define CT2_DATA_IN 0x0040 /* *to* initiator */
+#define CT2_DATA_OUT 0x0080 /* *from* initiator */
#define CT2_NO_DATA 0x00C0
#define CT2_DATAMASK 0x00C0
#define CT2_CCINCR 0x0100
@@ -2412,7 +2383,7 @@ typedef struct {
uint32_t ct_rxid;
uint16_t ct_senselen; /* mode 1 only */
uint16_t ct_flags;
- int32_t ct_resid; /* residual length */
+ uint32_t ct_resid; /* residual length */
uint16_t ct_oxid;
uint16_t ct_scsi_status; /* modes 0 && 1 only */
union {
@@ -2430,8 +2401,9 @@ typedef struct {
} m1;
struct {
uint32_t reserved0;
- uint32_t ct_datalen;
uint32_t reserved1;
+ uint32_t ct_datalen;
+ uint32_t reserved2;
ispds64_t ct_fcp_rsp_iudata;
} m2;
} rsp;
@@ -2440,10 +2412,10 @@ typedef struct {
/*
* ct_flags values for CTIO7
*/
-#define CT7_DATA_IN 0x0002
-#define CT7_DATA_OUT 0x0001
#define CT7_NO_DATA 0x0000
-#define CT7_DATAMASK 0x003
+#define CT7_DATA_OUT 0x0001 /* *from* initiator */
+#define CT7_DATA_IN 0x0002 /* *to* initiator */
+#define CT7_DATAMASK 0x3
#define CT7_DSD_ENABLE 0x0004
#define CT7_CONF_STSFD 0x0010
#define CT7_EXPLCT_CONF 0x0020
@@ -2451,9 +2423,9 @@ typedef struct {
#define CT7_FLAG_MODE1 0x0040
#define CT7_FLAG_MODE2 0x0080
#define CT7_FLAG_MMASK 0x00C0
-#define CT7_NOACK 0x0100
+#define CT7_NOACK 0x0100
#define CT7_TASK_ATTR_SHIFT 9
-#define CT7_CONFIRM 0x2000
+#define CT7_CONFIRM 0x2000
#define CT7_TERMINATE 0x4000
#define CT7_SENDSTATUS 0x8000