diff options
| author | Matt Jacob <mjacob@FreeBSD.org> | 2010-02-03 21:09:32 +0000 |
|---|---|---|
| committer | Matt Jacob <mjacob@FreeBSD.org> | 2010-02-03 21:09:32 +0000 |
| commit | c8b8a2c4e6ee8692a7eeff8a75511ad52835be75 (patch) | |
| tree | fdde0434a01b70cd56bc51a41aa3aaccfc6b07f8 /sys/dev/isp/ispvar.h | |
| parent | 7121df6349476d73276d4e51b4de6774cad003ca (diff) | |
Notes
Diffstat (limited to 'sys/dev/isp/ispvar.h')
| -rw-r--r-- | sys/dev/isp/ispvar.h | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h index e568a1c9b7650..5c8508c87c41d 100644 --- a/sys/dev/isp/ispvar.h +++ b/sys/dev/isp/ispvar.h @@ -50,7 +50,7 @@ #include "ispmbox.h" #endif -#define ISP_CORE_VERSION_MAJOR 6 +#define ISP_CORE_VERSION_MAJOR 7 #define ISP_CORE_VERSION_MINOR 0 /* @@ -288,6 +288,53 @@ typedef struct { #define DOMAIN_CONTROLLER_BASE 0xFFFC00 #define DOMAIN_CONTROLLER_END 0xFFFCFF +/* + * Command Handles + * + * Most QLogic initiator or target have 32 bit handles associated with them. + * We want to have a quick way to index back and forth between a local SCSI + * command context and what the firmware is passing back to us. We also + * want to avoid working on stale information. This structure handles both + * at the expense of some local memory. + * + * The handle is architected thusly: + * + * 0 means "free handle" + * bits 0..12 index commands + * bits 13..15 bits index usage + * bits 16..31 contain a rolling sequence + * + * + */ +typedef struct { + void * cmd; /* associated command context */ + uint32_t handle; /* handle associated with this command */ +} isp_hdl_t; +#define ISP_HANDLE_FREE 0x00000000 +#define ISP_HANDLE_CMD_MASK 0x00001fff +#define ISP_HANDLE_USAGE_MASK 0x0000e000 +#define ISP_HANDLE_USAGE_SHIFT 13 +#define ISP_H2HT(hdl) ((hdl & ISP_HANDLE_USAGE_MASK) >> ISP_HANDLE_USAGE_SHIFT) +# define ISP_HANDLE_NONE 0 +# define ISP_HANDLE_INITIATOR 1 +# define ISP_HANDLE_TARGET 2 +#define ISP_HANDLE_SEQ_MASK 0xffff0000 +#define ISP_HANDLE_SEQ_SHIFT 16 +#define ISP_H2SEQ(hdl) ((hdl & ISP_HANDLE_SEQ_MASK) >> ISP_HANDLE_SEQ_SHIFT) +#define ISP_VALID_INI_HANDLE(c, hdl) \ + (ISP_H2HT(hdl) == ISP_HANDLE_INITIATOR && (hdl & ISP_HANDLE_CMD_MASK) < (c)->isp_maxcmds && \ + ISP_H2SEQ(hdl) == ISP_H2SEQ((c)->isp_xflist[hdl & ISP_HANDLE_CMD_MASK].handle)) +#ifdef ISP_TARGET_MODE +#define ISP_VALID_TGT_HANDLE(c, hdl) \ + (ISP_H2HT(hdl) == ISP_HANDLE_TARGET && (hdl & ISP_HANDLE_CMD_MASK) < (c)->isp_maxcmds && \ + ISP_H2SEQ(hdl) == ISP_H2SEQ((c)->isp_tgtlist[hdl & ISP_HANDLE_CMD_MASK].handle)) +#define ISP_VALID_HANDLE(c, hdl) \ + (ISP_VALID_INI_HANDLE((c), hdl) || ISP_VALID_TGT_HANDLE((c), hdl)) +#else +#define ISP_VALID_HANDLE ISP_VALID_INI_HANDLE +#endif +#define ISP_BAD_HANDLE_INDEX 0xffffffff + /* * FC Port Database entry. @@ -562,11 +609,11 @@ struct ispsoftc { isp_mboxbsy : 1, /* mailbox command active */ isp_state : 3, isp_nactive : 16; /* how many commands active */ + volatile mbreg_t isp_curmbx; /* currently active mailbox command */ volatile uint32_t isp_reqodx; /* index of last ISP pickup */ volatile uint32_t isp_reqidx; /* index of next request */ volatile uint32_t isp_residx; /* index of next result */ volatile uint32_t isp_resodx; /* index of next result */ - volatile uint32_t isp_lasthdls; /* last handle seed */ volatile uint32_t isp_obits; /* mailbox command output */ volatile uint32_t isp_serno; /* rolling serial number */ volatile uint16_t isp_mboxtmp[MAILBOX_STORAGE]; @@ -575,18 +622,21 @@ struct ispsoftc { volatile uint16_t isp_mbxwrk1; volatile uint16_t isp_mbxwrk2; volatile uint16_t isp_mbxwrk8; + volatile uint16_t isp_seqno; /* running sequence number */ void * isp_mbxworkp; /* * Active commands are stored here, indexed by handle functions. */ - XS_T **isp_xflist; + isp_hdl_t *isp_xflist; + isp_hdl_t *isp_xffree; #ifdef ISP_TARGET_MODE /* * Active target commands are stored here, indexed by handle functions. */ - void **isp_tgtlist; + isp_hdl_t *isp_tgtlist; + isp_hdl_t *isp_tgtfree; #endif /* |
