summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp/isp_tpublic.h
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2006-04-21 18:30:01 +0000
committermjacob <mjacob@FreeBSD.org>2006-04-21 18:30:01 +0000
commit7fe1ec42ecb4af74f86aa2ab365fcc04205ebcce (patch)
treed3b3f19e96f6129f2561de62e8c2131359d8ae0e /sys/dev/isp/isp_tpublic.h
parent50753086acb394e1e208593acf703491bcb2f693 (diff)
downloadFreeBSD-src-7fe1ec42ecb4af74f86aa2ab365fcc04205ebcce.zip
FreeBSD-src-7fe1ec42ecb4af74f86aa2ab365fcc04205ebcce.tar.gz
Some more gratuitous format and name changes.
Pull in some target mode changes from a private branch. Pull in some more RELENG_4 compilation changes. A lot of lines changed, but not much content change yet.
Diffstat (limited to 'sys/dev/isp/isp_tpublic.h')
-rw-r--r--sys/dev/isp/isp_tpublic.h273
1 files changed, 129 insertions, 144 deletions
diff --git a/sys/dev/isp/isp_tpublic.h b/sys/dev/isp/isp_tpublic.h
index b4f6f4d..5609454 100644
--- a/sys/dev/isp/isp_tpublic.h
+++ b/sys/dev/isp/isp_tpublic.h
@@ -27,38 +27,38 @@
* SUCH DAMAGE.
*/
/*
- * Qlogic ISP Host Adapter Public Target Interface Structures && Routines
+ * Host Adapter Public Target Interface Structures && Routines
*/
-#ifndef _ISP_TPUBLIC_H
-#define _ISP_TPUBLIC_H 1
+#ifndef _ISP_TPUBLIC_H
+#define _ISP_TPUBLIC_H 1
/*
- * Action codes set by the Qlogic MD target driver for
+ * Action codes set by the MD target driver for
* the external layer to figure out what to do with.
*/
typedef enum {
- QOUT_HBA_REG=0, /* the argument is a pointer to a hba_register_t */
- QOUT_ENABLE, /* the argument is a pointer to a enadis_t */
- QOUT_DISABLE, /* the argument is a pointer to a enadis_t */
- QOUT_TMD_START, /* the argument is a pointer to a tmd_cmd_t */
- QOUT_TMD_DONE, /* the argument is a pointer to a tmd_cmd_t */
- QOUT_NOTIFY, /* the argument is a pointer to a tmd_notify_t */
- QOUT_HBA_UNREG /* the argument is a pointer to a hba_register_t */
+ QOUT_HBA_REG=0, /* the argument is a pointer to a hba_register_t */
+ QOUT_ENABLE, /* the argument is a pointer to a enadis_t */
+ QOUT_DISABLE, /* the argument is a pointer to a enadis_t */
+ QOUT_TMD_START, /* the argument is a pointer to a tmd_cmd_t */
+ QOUT_TMD_DONE, /* the argument is a pointer to a tmd_cmd_t */
+ QOUT_NOTIFY, /* the argument is a pointer to a tmd_notify_t */
+ QOUT_HBA_UNREG /* the argument is a pointer to a hba_register_t */
} tact_e;
/*
* Action codes set by the external layer for the
- * MD Qlogic driver to figure out what to do with.
+ * MD driver to figure out what to do with.
*/
typedef enum {
- QIN_HBA_REG=99, /* the argument is a pointer to a hba_register_t */
- QIN_ENABLE, /* the argument is a pointer to a enadis_t */
- QIN_DISABLE, /* the argument is a pointer to a enadis_t */
- QIN_TMD_CONT, /* the argument is a pointer to a tmd_cmd_t */
- QIN_TMD_FIN, /* the argument is a pointer to a tmd_cmd_t */
- QIN_NOTIFY_ACK, /* the argument is a pointer to a tmd_notify_t */
- QIN_HBA_UNREG, /* the argument is a pointer to a hba_register_t */
+ QIN_HBA_REG=99, /* the argument is a pointer to a hba_register_t */
+ QIN_ENABLE, /* the argument is a pointer to a enadis_t */
+ QIN_DISABLE, /* the argument is a pointer to a enadis_t */
+ QIN_TMD_CONT, /* the argument is a pointer to a tmd_cmd_t */
+ QIN_TMD_FIN, /* the argument is a pointer to a tmd_cmd_t */
+ QIN_NOTIFY_ACK, /* the argument is a pointer to a tmd_notify_t */
+ QIN_HBA_UNREG, /* the argument is a pointer to a hba_register_t */
} qact_e;
/*
@@ -71,14 +71,14 @@ typedef enum {
* in, and the external module to call back with a QIN_HBA_REG that
* passes back the corresponding information.
*/
-#define QR_VERSION 2
+#define QR_VERSION 10
typedef struct {
- void * r_identity;
- void (*r_action)(qact_e, void *);
- char r_name[8];
- int r_inst;
- int r_version;
- enum { R_FC, R_SCSI } r_type;
+ void * r_identity;
+ void (*r_action)(qact_e, void *);
+ char r_name[8];
+ int r_inst;
+ int r_version;
+ enum { R_FC, R_SCSI } r_type;
} hba_register_t;
/*
@@ -123,21 +123,19 @@ typedef struct tmd_notify {
/*
* A word about ENABLE/DISABLE: the argument is a pointer to a enadis_t
- * with cd_hba, cd_iid, cd_chan, cd_tgt and cd_lun filled out.
+ * with en_hba, en_iid, en_chan, en_tgt and en_lun filled out.
*
* If an error occurs in either enabling or disabling the described lun
* cd_error is set with an appropriate non-zero value.
- *
- * Logical unit zero must be the first enabled and the last disabled.
*/
typedef struct {
- void * en_private; /* for outer layer usage */
- void * en_hba; /* HBA tag */
- uint64_t en_iid; /* initiator ID */
- uint64_t en_tgt; /* target id */
- uint64_t en_lun; /* logical unit */
- uint8_t en_chan; /* channel on card */
- int32_t en_error;
+ void * en_private; /* for outer layer usage */
+ void * en_hba; /* HBA tag */
+ uint64_t en_iid; /* initiator ID */
+ uint64_t en_tgt; /* target id */
+ uint16_t en_lun; /* logical unit */
+ uint16_t en_chan; /* channel on card */
+ int en_error;
} enadis_t;
/*
@@ -173,29 +171,23 @@ typedef struct {
* mode command is coming from. The outer layer has to pass this back
* unchanged to avoid chaos.
*
- * The cd_iid, cd_tgt, cd_lun and cd_bus tags are used to identify the
+ * The cd_iid, cd_tgt, cd_lun and cd_port tags are used to identify the
* id of the initiator who sent us a command, the target claim to be, the
- * lun on the target we claim to be, and the bus instance (for multiple
- * bus host adapters) that this applies to (consider it an extra Port
+ * lun on the target we claim to be, and the port instance (for multiple
+ * port host adapters) that this applies to (consider it an extra port
* parameter). The iid, tgt and lun values are deliberately chosen to be
* fat so that, for example, World Wide Names can be used instead of
- * the units that the Qlogic firmware uses (in the case where the MD
+ * the units that the firmware uses (in the case where the MD
* layer maintains a port database, for example).
*
- * The cd_tagtype field specifies what kind of command tag has been
- * sent with the command. The cd_tagval is the tag's value (low 16
- * bits). It also contains (in the upper 16 bits) any command handle.
- *
- *
- * N.B.: when the MD layer sends this command to outside software
- * the outside software likely *MUST* return the same cd_tagval that
- * was in place because this value is likely what the Qlogic f/w uses
- * to identify a command.
+ * The cd_tagtype field specifies what kind of command tag type, if
+ * any, has been sent with the command. Note that the Outer Layer
+ * still needs to pass the tag handle through unchanged even
+ * if the tag type is CD_UNTAGGED.
*
* The cd_cdb contains storage for the passed in command descriptor block.
- * This is the maximum size we can get out of the Qlogic f/w. There's no
- * passed in length because whoever decodes the command to act upon it
- * will know what the appropriate length is.
+ * There is no need to define length as the callee should be able to
+ * figure this out.
*
* The tag cd_lflags are the flags set by the MD driver when it gets
* command incoming or when it needs to inform any outside entities
@@ -219,10 +211,11 @@ typedef struct {
* The tag cd_data points to a data segment to either be filled or
* read from depending on the direction of data movement. The tag
* is undefined if no data direction is set. The MD layer and outer
- * layers must agree on the meaning of cd_data.
+ * layers must agree on the meaning of cd_data and it is specifically
+ * not defined here.
*
* The tag cd_totlen is the total data amount expected to be moved
- * over the life of the command. It *may* be set by the MD layer, possibly
+ * over the life of the command. It may be set by the MD layer, possibly
* from the datalen field of an FCP CMND IU unit. If it shows up in the outer
* layers set to zero and the CDB indicates data should be moved, the outer
* layer should set it to the amount expected to be moved.
@@ -231,28 +224,14 @@ typedef struct {
* The outer layers need to set this at the begining of command processing
* to equal cd_totlen. As data is successfully moved, this value is decreased.
* At the end of a command, any nonzero residual indicates the number of bytes
- * requested but not moved. XXXXXXXXXXXXXXXXXXXXXXX TOO VAGUE!!!
+ * requested by the command but not moved.
*
* The tag cd_xfrlen is the length of the currently active data transfer.
* This allows several interations between any outside software and the
* MD layer to move data.
*
* The reason that total length and total residual have to be tracked
- * is that fibre channel FCP DATA IU units have to have a relative
- * offset field.
- *
- * N.B.: there is no necessary 1-to-1 correspondence between any one
- * data transfer segment and the number of CTIOs that will be generated
- * satisfy the current data transfer segment. It's not also possible to
- * predict how big a transfer can be before it will be 'too big'. Be
- * reasonable- a 64KB transfer is 'reasonable'. A 1MB transfer may not
- * be. A 32MB transfer is unreasonable. The problem here has to do with
- * how CTIOs can be used to map passed data pointers. In systems which
- * have page based scatter-gather requirements, each PAGESIZEd chunk will
- * consume one data segment descriptor- you get 3 or 4 of them per CTIO.
- * The size of the REQUEST QUEUE you drop a CTIO onto is finite (typically
- * it's 256, but on some systems it's even smaller, and note you have to
- * sure this queue with the initiator side of this driver).
+ * is to keep track of relative offset.
*
* The tags cd_sense and cd_scsi_status are pretty obvious.
*
@@ -264,51 +243,53 @@ typedef struct {
*
*/
-#ifndef TMD_CDBLEN
-#define TMD_CDBLEN 16
+#ifndef TMD_CDBLEN
+#define TMD_CDBLEN 16
#endif
-#ifndef TMD_SENSELEN
-#define TMD_SENSELEN 24
+#ifndef TMD_SENSELEN
+#define TMD_SENSELEN 18
#endif
-#ifndef QCDS
-#define QCDS 8
+#ifndef QCDS
+#define QCDS 8
#endif
typedef struct tmd_cmd {
- void * cd_private; /* private data pointer */
- void * cd_hba; /* HBA tag */
- void * cd_data; /* 'pointer' to data */
- uint64_t cd_iid; /* initiator ID */
- uint64_t cd_tgt; /* target id */
- uint64_t cd_lun; /* logical unit */
- uint32_t cd_tagval; /* tag value */
- uint32_t cd_lflags; /* flags lower level sets */
- uint32_t cd_hflags; /* flags higher level sets */
- uint32_t cd_totlen; /* total data requirement */
- uint32_t cd_resid; /* total data residual */
- uint32_t cd_xfrlen; /* current data requirement */
- int32_t cd_error; /* current error */
- uint32_t
- cd_scsi_status : 16, /* closing SCSI status */
- : 7,
- cd_chan : 1, /* channel on card */
- : 2,
- cd_tagtype : 6; /* tag type */
- uint8_t cd_senselen;
- uint8_t cd_cdblen;
- uint8_t cd_sense[TMD_SENSELEN];
- uint8_t cd_cdb[TMD_CDBLEN]; /* Command */
- union {
- void * ptrs[QCDS / sizeof (void *)];
- uint64_t llongs[QCDS / sizeof (uint64_t)];
- uint32_t longs[QCDS / sizeof (uint32_t)];
- uint16_t shorts[QCDS / sizeof (uint16_t)];
- uint8_t bytes[QCDS];
- } cd_lreserved[2], cd_hreserved[2];
+ void * cd_private; /* private data pointer */
+ void * cd_hba; /* HBA tag */
+ void * cd_data; /* 'pointer' to data */
+ uint64_t cd_iid; /* initiator ID */
+ uint64_t cd_tgt; /* target id */
+ uint64_t cd_lun; /* logical unit */
+ uint32_t cd_tagval; /* tag value */
+ uint32_t cd_lflags; /* flags lower level sets */
+ uint32_t cd_hflags; /* flags higher level sets */
+ uint32_t cd_totlen; /* total data load */
+ uint32_t cd_resid; /* total data residual */
+ uint32_t cd_xfrlen; /* current data load */
+ int32_t cd_error; /* current error */
+ uint8_t cd_tagtype : 4,
+ cd_port : 4; /* port number on HBA */
+ uint8_t cd_scsi_status;
+ uint8_t cd_sense[TMD_SENSELEN];
+ uint8_t cd_cdb[TMD_CDBLEN];
+ union {
+ void * ptrs[QCDS / sizeof (void *)];
+ uint64_t llongs[QCDS / sizeof (uint64_t)];
+ uint32_t longs[QCDS / sizeof (uint32_t)];
+ uint16_t shorts[QCDS / sizeof (uint16_t)];
+ uint8_t bytes[QCDS];
+ } cd_lreserved[2], cd_hreserved[2];
} tmd_cmd_t;
-#ifndef TMD_SIZE
-#define TMD_SIZE (sizeof (tmd_cmd_t))
+/* defined tags */
+#define CD_UNTAGGED 0
+#define CD_SIMPLE_TAG 1
+#define CD_ORDERED_TAG 2
+#define CD_HEAD_TAG 3
+#define CD_ACA_TAG 4
+
+#ifndef TMD_SIZE
+#define TMD_SIZE (sizeof (tmd_cmd_t))
#endif
/*
@@ -324,49 +305,50 @@ typedef struct tmd_cmd {
* be transferred in any QOUT_TMD_CONT call is cd_xfrlen- the
* flags CDFH_DATA_IN and CDFH_DATA_OUT define which direction.
*/
-#define CDFL_SNSVALID 0x01 /* sense data (from f/w) good */
-#define CDFL_SENTSTATUS 0x02 /* last action sent status */
-#define CDFL_DATA_IN 0x04 /* target (us) -> initiator (them) */
-#define CDFL_DATA_OUT 0x08 /* initiator (them) -> target (us) */
-#define CDFL_BIDIR 0x0C /* bidirectional data */
-#define CDFL_ERROR 0x10 /* last action ended in error */
-#define CDFL_NODISC 0x20 /* disconnects disabled */
-#define CDFL_SENTSENSE 0x40 /* last action sent sense data */
-#define CDFL_BUSY 0x80 /* this command is not on a free list */
-#define CDFL_PRIVATE 0xFF000000 /* private layer flags */
+#define CDFL_SNSVALID 0x01 /* sense data (from f/w) good */
+#define CDFL_SENTSTATUS 0x02 /* last action sent status */
+#define CDFL_DATA_IN 0x04 /* target (us) -> initiator (them) */
+#define CDFL_DATA_OUT 0x08 /* initiator (them) -> target (us) */
+#define CDFL_BIDIR 0x0C /* bidirectional data */
+#define CDFL_ERROR 0x10 /* last action ended in error */
+#define CDFL_NODISC 0x20 /* disconnects disabled */
+#define CDFL_SENTSENSE 0x40 /* last action sent sense data */
+#define CDFL_BUSY 0x80 /* this command is not on a free list */
+#define CDFL_PRIVATE 0xFF000000 /* private layer flags */
-#define CDFH_SNSVALID 0x01 /* sense data (from outer layer) good */
-#define CDFH_STSVALID 0x02 /* status valid */
-#define CDFH_DATA_IN 0x04 /* target (us) -> initiator (them) */
-#define CDFH_DATA_OUT 0x08 /* initiator (them) -> target (us) */
-#define CDFH_DATA_MASK 0x0C /* mask to cover data direction */
-#define CDFH_PRIVATE 0xFF000000 /* private layer flags */
+#define CDFH_SNSVALID 0x01 /* sense data (from outer layer) good */
+#define CDFH_STSVALID 0x02 /* status valid */
+#define CDFH_DATA_IN 0x04 /* target (us) -> initiator (them) */
+#define CDFH_DATA_OUT 0x08 /* initiator (them) -> target (us) */
+#define CDFH_DATA_MASK 0x0C /* mask to cover data direction */
+#define CDFH_PRIVATE 0xFF000000 /* private layer flags */
/*
* A word about the START/CONT/DONE/FIN dance:
*
- * When the HBA is enabled for receiving commands, one may show up
- * without notice. When that happens, the Qlogic target mode driver
- * gets a tmd_cmd_t, fills it with the info that just arrived, and
- * calls the outer layer with a QOUT_TMD_START code and pointer to
- * the tmd_cmd_t.
+ * When the HBA is enabled for receiving commands, one may show up
+ * without notice. When that happens, the MD target mode driver
+ * gets a tmd_cmd_t, fills it with the info that just arrived, and
+ * calls the outer layer with a QOUT_TMD_START code and pointer to
+ * the tmd_cmd_t.
*
- * The outer layer decodes the command, fetches data, prepares stuff,
- * whatever, and starts by passing back the pointer with a QIN_TMD_CONT
- * code which causes the Qlogic target mode driver to generate CTIOs to
- * satisfy whatever action needs to be taken. When those CTIOs complete,
- * the Qlogic target driver sends the pointer to the cmd_tmd_t back with
- * a QOUT_TMD_DONE code. This repeats for as long as necessary.
+ * The outer layer decodes the command, fetches data, prepares stuff,
+ * whatever, and starts by passing back the pointer with a QIN_TMD_CONT
+ * code which causes the MD target mode driver to generate CTIOs to
+ * satisfy whatever action needs to be taken. When those CTIOs complete,
+ * the MD target driver sends the pointer to the cmd_tmd_t back with
+ * a QOUT_TMD_DONE code. This repeats for as long as necessary. These
+ * may not be done in parallel- they are sequential operations.
*
- * The outer layer signals it wants to end the command by settings within
- * the tmd_cmd_t itself. When the final QIN_TMD_CONT is reported completed,
- * the outer layer frees the tmd_cmd_t by sending the pointer to it
- * back with a QIN_TMD_FIN code.
+ * The outer layer signals it wants to end the command by settings within
+ * the tmd_cmd_t itself. When the final QIN_TMD_CONT is reported completed,
+ * the outer layer frees the tmd_cmd_t by sending the pointer to it
+ * back with a QIN_TMD_FIN code.
*
- * The graph looks like:
+ * The graph looks like:
*
- * QOUT_TMD_START -> [ QIN_TMD_CONT -> QOUT_TMD_DONE ] * -> QIN_TMD_FIN.
+ * QOUT_TMD_START -> [ QIN_TMD_CONT -> QOUT_TMD_DONE ] * -> QIN_TMD_FIN.
*
*/
@@ -376,11 +358,14 @@ typedef struct tmd_cmd {
* The MD target handler function (the outer layer calls this)
* should be be prototyped like:
*
- * void target_action(qact_e, void *arg)
+ * void target_action(qact_e, void *arg)
*
* The outer layer target handler function (the MD layer calls this)
* should be be prototyped like:
*
- * void system_target_handler(tact_e, void *arg)
+ * void scsi_target_handler(tact_e, void *arg)
+ */
+#endif /* _ISP_TPUBLIC_H */
+/*
+ * vim:ts=4:sw=4:expandtab
*/
-#endif /* _ISP_TPUBLIC_H */
OpenPOWER on IntegriCloud