summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp/ispmbox.h
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2001-12-11 00:18:45 +0000
committermjacob <mjacob@FreeBSD.org>2001-12-11 00:18:45 +0000
commit991ffbae5691ddb93149381b3c23fcf0763b63bd (patch)
treec9f72bc76f2873325753abbad1598b1881e3e759 /sys/dev/isp/ispmbox.h
parent356efe3c0b9c059153349979d7c80cd8b40c104c (diff)
downloadFreeBSD-src-991ffbae5691ddb93149381b3c23fcf0763b63bd.zip
FreeBSD-src-991ffbae5691ddb93149381b3c23fcf0763b63bd.tar.gz
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have a complete set of inline functions in isp_inline.h. Each platform is responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32} macros. The reason this needs to be done is that we need to have a single set of functions that will work correctly on multiple architectures for both little and big endian machines. It also needs to work correctly in the case that we have the request or response queues in memory that has to be treated specially (e.g., have ddi_dma_sync called on it for Solaris after we update it or before we read from it). It also has to handle the SBus cards (for platforms that have them) which, while on a Big Endian machine, do *not* require *most* of the request/response queue entry fields to be swizzled or unswizzled. One thing that falls out of this is that we no longer build requests in the request queue itself. Instead, we build the request locally (e.g., on the stack) and then as part of the swizzling operation, copy it to the request queue entry we've allocated. I thought long and hard about whether this was too expensive a change to make as it in a lot of cases requires an extra copy. On balance, the flexbility is worth it. With any luck, the entry that we build locally stays in a processor writeback cache (after all, it's only 64 bytes) so that the cost of actually flushing it to the memory area that is the shared queue with the PCI device is not all that expensive. We may examine this again and try to get clever in the future to try and avoid copies. Another change that falls out of this is that MEMORYBARRIER should be taken a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the entry being added. But there had been many other places this had been missing. It's now very important that it be done. Additional changes: Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry, the iptr value that gets returned is the value we intend to eventually plug into the ISP registers as the entry *one past* the last one we've written- *not* the current entry we're updating. All along we've been calling sync functions on the wrong index value. Argh. The 'fix' here is to rename all 'iptr' variables as 'nxti' to remember that this is the 'next' pointer- not the current pointer. Devote a single bit to mboxbsy- and set aside bits for output mbox registers that we need to pick up- we can have at least one command which does not have any defined output registers (MBOX_EXECUTE_FIRMWARE). MFC after: 2 weeks
Diffstat (limited to 'sys/dev/isp/ispmbox.h')
-rw-r--r--sys/dev/isp/ispmbox.h37
1 files changed, 10 insertions, 27 deletions
diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h
index 78ef00d..ac4613c 100644
--- a/sys/dev/isp/ispmbox.h
+++ b/sys/dev/isp/ispmbox.h
@@ -253,6 +253,8 @@ typedef struct {
u_int32_t ds_count;
} ispds64_t;
+#define DSTYPE_32BIT 0
+#define DSTYPE_64BIT 1
typedef struct {
u_int16_t ds_type; /* 0-> ispds_t, 1-> ispds64_t */
u_int32_t ds_segment; /* unused */
@@ -263,7 +265,7 @@ typedef struct {
/*
* These elements get swizzled around for SBus instances.
*/
-#define _ISP_SWAP8(a, b) { \
+#define ISP_SWAP8(a, b) { \
u_int8_t tmp; \
tmp = a; \
a = b; \
@@ -275,18 +277,6 @@ typedef struct {
u_int8_t rqs_seqno;
u_int8_t rqs_flags;
} isphdr_t;
-/*
- * There are no (for all intents and purposes) non-sparc SBus machines
- */
-#ifdef __sparc__
-#define ISP_SBUSIFY_ISPHDR(isp, hdrp) \
- if ((isp)->isp_bustype == ISP_BT_SBUS) { \
- _ISP_SWAP8((hdrp)->rqs_entry_count, (hdrp)->rqs_entry_type); \
- _ISP_SWAP8((hdrp)->rqs_flags, (hdrp)->rqs_seqno); \
- }
-#else
-#define ISP_SBUSIFY_ISPHDR(a, b)
-#endif
/* RQS Flag definitions */
#define RQSFLAG_CONTINUATION 0x01
@@ -350,18 +340,6 @@ typedef struct {
#define SYNC_TARGET 1
#define SYNC_ALL 2
-/*
- * There are no (for all intents and purposes) non-sparc SBus machines
- */
-#ifdef __sparc__
-#define ISP_SBUSIFY_ISPREQ(isp, rqp) \
- if ((isp)->isp_bustype == ISP_BT_SBUS) { \
- _ISP_SWAP8((rqp)->req_target, (rqp)->req_lun_trn); \
- }
-#else
-#define ISP_SBUSIFY_ISPREQ(a, b)
-#endif
-
#define ISP_RQDSEG_T2 3
typedef struct {
isphdr_t req_header;
@@ -373,7 +351,7 @@ typedef struct {
u_int16_t _res2;
u_int16_t req_time;
u_int16_t req_seg_count;
- u_int32_t req_cdb[4];
+ u_int8_t req_cdb[16];
u_int32_t req_totalcnt;
ispds_t req_dataseg[ISP_RQDSEG_T2];
} ispreqt2_t;
@@ -389,7 +367,7 @@ typedef struct {
u_int16_t _res2;
u_int16_t req_time;
u_int16_t req_seg_count;
- u_int32_t req_cdb[4];
+ u_int8_t req_cdb[16];
u_int32_t req_totalcnt;
ispds64_t req_dataseg[ISP_RQDSEG_T3];
} ispreqt3_t;
@@ -456,6 +434,11 @@ typedef struct {
u_int8_t req_sense_data[32];
} ispstatusreq_t;
+typedef struct {
+ isphdr_t req_header;
+ u_int8_t req_sense_data[60];
+} ispstatus_cont_t;
+
/*
* For Qlogic 2X00, the high order byte of SCSI status has
* additional meaning.
OpenPOWER on IntegriCloud