summaryrefslogtreecommitdiffstats
path: root/sys/dev/mpt
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2002-08-23 06:56:31 +0000
committermjacob <mjacob@FreeBSD.org>2002-08-23 06:56:31 +0000
commit907806e8e11a2c90f83d29354e36d0ae91bf8223 (patch)
tree800c07e2d3abab6ebc97549ac20ae25a89654f0c /sys/dev/mpt
parentf862e4d733eb527d5a30eee5193e963fabf5bedb (diff)
downloadFreeBSD-src-907806e8e11a2c90f83d29354e36d0ae91bf8223.zip
FreeBSD-src-907806e8e11a2c90f83d29354e36d0ae91bf8223.tar.gz
Do some minor cleanups found during backport to RELENG_4.
Diffstat (limited to 'sys/dev/mpt')
-rw-r--r--sys/dev/mpt/mpt.c8
-rw-r--r--sys/dev/mpt/mpt_freebsd.c10
-rw-r--r--sys/dev/mpt/mpt_freebsd.h31
3 files changed, 24 insertions, 25 deletions
diff --git a/sys/dev/mpt/mpt.c b/sys/dev/mpt/mpt.c
index 445f884..7fed740 100644
--- a/sys/dev/mpt/mpt.c
+++ b/sys/dev/mpt/mpt.c
@@ -263,8 +263,8 @@ mpt_send_cmd(mpt_softc_t *mpt, request_t *req)
if (mpt->verbose > 1) {
u_int32_t *pReq;
pReq = req->req_vbuf;
- device_printf(mpt->dev, "Send Request %d (0x%x):\n",
- req->index, req->req_pbuf);
+ device_printf(mpt->dev, "Send Request %d (0x%lx):\n",
+ req->index, (long) req->req_pbuf);
device_printf(mpt->dev, "%08X %08X %08X %08X\n",
pReq[0], pReq[1], pReq[2], pReq[3]);
device_printf(mpt->dev, "%08X %08X %08X %08X\n",
@@ -397,8 +397,8 @@ mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply)
if (mpt->verbose > 1 && ((reply_len >> 1) != hdr->MsgLength)) {
device_printf(mpt->dev,
"reply length does not match message length: "
- "got 0x%02x, expected 0x%02x\n",
- hdr->MsgLength << 2, reply_len << 1);
+ "got 0x%02x, expected 0x%02lx\n",
+ hdr->MsgLength << 2, (long) (reply_len << 1));
}
/* Get rest of the reply; but don't overflow the provided buffer */
diff --git a/sys/dev/mpt/mpt_freebsd.c b/sys/dev/mpt/mpt_freebsd.c
index 4380724..52cb1ab 100644
--- a/sys/dev/mpt/mpt_freebsd.c
+++ b/sys/dev/mpt/mpt_freebsd.c
@@ -132,13 +132,12 @@ mpttimeout(void *arg)
mpt_read(mpt, MPT_OFFSET_INTR_STATUS),
mpt_read(mpt, MPT_OFFSET_INTR_MASK),
mpt_read(mpt, MPT_OFFSET_DOORBELL) );
- printf( "request state %s\n", mpt_req_state(req->debug));
- if (ccb != req->ccb)
+ printf("request state %s\n", mpt_req_state(req->debug));
+ if (ccb != req->ccb) {
printf("time out: ccb %p != req->ccb %p\n",
ccb,req->ccb);
-
+ }
mpt_print_scsi_io_request((MSG_SCSI_IO_REQUEST *)req->req_vbuf);
-
req->debug = REQ_TIMEOUT;
req->ccb = NULL;
ccb->ccb_h.status = CAM_CMD_TIMEOUT;
@@ -146,6 +145,7 @@ mpttimeout(void *arg)
MPTLOCK_2_CAMLOCK(mpt);
xpt_done(ccb);
CAMLOCK_2_MPTLOCK(mpt);
+ MPT_UNLOCK(mpt);
}
/*
@@ -459,7 +459,6 @@ mpt_start(union ccb *ccb)
* Virtual address that needs to translated into
* one or more physical pages.
*/
- int s;
int error;
error = bus_dmamap_load(mpt->buffer_dmat,
@@ -475,7 +474,6 @@ mpt_start(union ccb *ccb)
xpt_freeze_simq(mpt->sim, 1);
ccbh->status |= CAM_RELEASE_SIMQ;
}
- splx(s);
} else {
/*
* We have been given a pointer to single
diff --git a/sys/dev/mpt/mpt_freebsd.h b/sys/dev/mpt/mpt_freebsd.h
index b3260c1..d2a2970 100644
--- a/sys/dev/mpt/mpt_freebsd.h
+++ b/sys/dev/mpt/mpt_freebsd.h
@@ -36,13 +36,15 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/endian.h>
+#ifdef RELENG_4
#include <sys/kernel.h>
#include <sys/queue.h>
-#ifdef RELENG_4
#include <sys/malloc.h>
#else
+#include <sys/endian.h>
#include <sys/lock.h>
+#include <sys/kernel.h>
+#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
@@ -85,7 +87,7 @@
#define MPT_LOCK(mpt) mpt_lockspl(mpt)
#define MPT_UNLOCK(mpt) mpt_unlockspl(mpt)
#define MPTLOCK_2_CAMLOCK MPT_UNLOCK
-#define CAMLOCK_2_MPTLOCK(mpt) MPT_LOCK
+#define CAMLOCK_2_MPTLOCK MPT_LOCK
#define MPT_LOCK_SETUP(mpt)
#define MPT_LOCK_DESTROY(mpt)
#else
@@ -151,7 +153,7 @@
* needed to access the data.
*/
#define MPT_REPLY_PTOV(m, x) \
- ((void *)(m->reply + ((x << 1) - (u_int32_t)(m->reply_phys))))
+ ((void *)(&m->reply[((x << 1) - m->reply_phys)]))
#define ccb_mpt_ptr sim_priv.entries[0].ptr
#define ccb_req_ptr sim_priv.entries[1].ptr
@@ -160,16 +162,16 @@ enum mpt_req_state {
REQ_FREE, REQ_IN_PROGRESS, REQ_TIMEOUT, REQ_ON_CHIP, REQ_DONE
};
typedef struct req_entry {
- u_int16_t index; /* Index of this entry */
- union ccb *ccb; /* CAM request */
- void *req_vbuf; /* Virtual Address of Entry */
- void *sense_vbuf; /* Virtual Address of sense data */
- u_int32_t req_pbuf; /* Physical Address of Entry */
- u_int32_t sense_pbuf; /* Physical Address of sense data */
- bus_dmamap_t dmap; /* DMA map for data buffer */
+ u_int16_t index; /* Index of this entry */
+ union ccb * ccb; /* CAM request */
+ void * req_vbuf; /* Virtual Address of Entry */
+ void * sense_vbuf; /* Virtual Address of sense data */
+ bus_addr_t req_pbuf; /* Physical Address of Entry */
+ bus_addr_t sense_pbuf; /* Physical Address of sense data */
+ bus_dmamap_t dmap; /* DMA map for data buffer */
SLIST_ENTRY(req_entry) link; /* Pointer to next in list */
enum mpt_req_state debug; /* Debugging */
- u_int32_t sequence; /* Sequence Number */
+ u_int32_t sequence; /* Sequence Number */
} request_t;
@@ -264,15 +266,14 @@ typedef struct mpt_softc {
bus_dma_tag_t reply_dmat; /* DMA tag for reply memory */
bus_dmamap_t reply_dmap; /* DMA map for reply memory */
char * reply; /* KVA of reply memory */
- u_int32_t reply_phys; /* BusAddr of reply memory (XXX Wrong) */
+ bus_addr_t reply_phys; /* BusAddr of reply memory */
bus_dma_tag_t buffer_dmat; /* DMA tag for buffers */
bus_dma_tag_t request_dmat; /* DMA tag for request memroy */
bus_dmamap_t request_dmap; /* DMA map for request memroy */
char * request; /* KVA of Request memory */
- u_int32_t request_phys; /* BusADdr of request memory (XXX WRONG) */
-
+ bus_addr_t request_phys; /* BusADdr of request memory */
/*
* CAM && Software Management
OpenPOWER on IntegriCloud