aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/isp/isp_stds.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/isp_stds.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/isp_stds.h')
-rw-r--r--sys/dev/isp/isp_stds.h78
1 files changed, 70 insertions, 8 deletions
diff --git a/sys/dev/isp/isp_stds.h b/sys/dev/isp/isp_stds.h
index 2ed66cb5f37d..e53f0058323d 100644
--- a/sys/dev/isp/isp_stds.h
+++ b/sys/dev/isp/isp_stds.h
@@ -137,9 +137,30 @@ typedef struct {
} rft_id_t;
/*
- * FCP Response IU Bits of interest
- * Source: NCITS T10, Project 1144D, Revision 08 (aka FCP2r08)
+ * FCP Response IU and bits of interest
+ * Source: NCITS T10, Project 1828D, Revision 02b (aka FCP4r02b)
*/
+typedef struct {
+ uint8_t fcp_rsp_reserved[8];
+ uint16_t fcp_rsp_status_qualifier; /* SAM-5 Status Qualifier */
+ uint8_t fcp_rsp_bits;
+ uint8_t fcp_rsp_scsi_status; /* SAM-5 SCSI Status Byte */
+ uint32_t fcp_rsp_resid;
+ uint32_t fcp_rsp_snslen;
+ uint32_t fcp_rsp_rsplen;
+ /*
+ * In the bytes that follow, it's going to be
+ * FCP RESPONSE INFO (max 8 bytes, possibly 0)
+ * FCP SENSE INFO (if any)
+ * FCP BIDIRECTIONAL READ RESID (if any)
+ */
+ uint8_t fcp_rsp_extra[0];
+} fcp_rsp_iu_t;
+#define MIN_FCP_RESPONSE_SIZE 24
+
+#define FCP_BIDIR_RSP 0x80 /* Bi-Directional response */
+#define FCP_BIDIR_RESID_UNDERFLOW 0x40
+#define FCP_BIDIR_RESID_OVERFLOW 0x20
#define FCP_CONF_REQ 0x10
#define FCP_RESID_UNDERFLOW 0x08
#define FCP_RESID_OVERFLOW 0x04
@@ -162,17 +183,41 @@ typedef struct {
#define FCP_RSPNS_TMF_SUCCEEDED 8
#define FCP_RSPNS_TMF_INCORRECT_LUN 9
+/*
+ * R_CTL field definitions
+ *
+ * Bits 31-28 are ROUTING
+ * Bits 27-24 are INFORMATION
+ *
+ * These are nibble values, not bits
+ */
+#define R_CTL_ROUTE_DATA 0x00
+#define R_CTL_ROUTE_ELS 0x02
+#define R_CTL_ROUTE_FC4_LINK 0x03
+#define R_CTL_ROUTE_VDATA 0x04
+#define R_CTL_ROUTE_EXENDED 0x05
+#define R_CTL_ROUTE_BASIC 0x08
+#define R_CTL_ROUTE_LINK 0x0c
+#define R_CTL_ROUTE_EXT_ROUTING 0x0f
+
+#define R_CTL_INFO_UNCATEGORIZED 0x00
+#define R_CTL_INFO_SOLICITED_DATA 0x01
+#define R_CTL_INFO_UNSOLICITED_CONTROL 0x02
+#define R_CTL_INFO_SOLICITED_CONTROL 0x03
+#define R_CTL_INFO_UNSOLICITED_DATA 0x04
+#define R_CTL_INFO_DATA_DESCRIPTOR 0x05
+#define R_CTL_INFO_UNSOLICITED_COMMAND 0x06
+#define R_CTL_INFO_COMMAND_STATUS 0x07
+
+#define MAKE_RCTL(a, b) (((a) << 4) | (b))
/* unconverted miscellany */
/*
* Basic FC Link Service defines
*/
-/*
- * These are in the R_CTL field.
- */
-#define ABTS 0x81
-#define BA_ACC 0x84 /* of ABORT SEQUENCE */
-#define BA_RJT 0x85 /* of ABORT SEQUENCE */
+/* #define ABTS MAKE_RCTL(R_CTL_ROUTE_BASIC, R_CTL_INFO_SOLICITED_DATA) */
+#define BA_ACC MAKE_RCTL(R_CTL_ROUTE_BASIC, R_CTL_INFO_UNSOLICITED_DATA) /* of ABORT */
+#define BA_RJT MAKE_RCTL(R_CTL_ROUTE_BASIC, R_CTL_INFO_DATA_DESCRIPTOR) /* of ABORT */
/*
* Link Service Accept/Reject
@@ -196,6 +241,23 @@ typedef struct {
#define RNC 0x53
/*
+ * PRLI Word 3 definitions
+ * FPC4-r02b January, 2011
+ */
+#define PRLI_WD3_ENHANCED_DISCOVERY (1 << 11)
+#define PRLI_WD3_REC_SUPPORT (1 << 10)
+#define PRLI_WD3_TASK_RETRY_IDENTIFICATION_REQUESTED (1 << 9)
+#define PRLI_WD3_RETRY (1 << 8)
+#define PRLI_WD3_CONFIRMED_COMPLETION_ALLOWED (1 << 7)
+#define PRLI_WD3_DATA_OVERLAY_ALLOWED (1 << 6)
+#define PRLI_WD3_INITIATOR_FUNCTION (1 << 5)
+#define PRLI_WD3_TARGET_FUNCTION (1 << 4)
+#define PRLI_WD3_READ_FCP_XFER_RDY_DISABLED (1 << 1) /* definitely supposed to be set */
+#define PRLI_WD3_WRITE_FCP_XFER_RDY_DISABLED (1 << 0)
+
+
+
+/*
* FC4 defines
*/
#define FC4_IP 5 /* ISO/EEC 8802-2 LLC/SNAP */