PERFORCE change 201725 for review
Matt Jacob
mjacob at FreeBSD.org
Wed Nov 16 02:54:59 UTC 2011
http://p4web.freebsd.org/@@201725?ac=10
Change 201725 by mjacob at mjacob-sandbox on 2011/11/16 02:53:57
Sync up with Alacritech tree.
Affected files ...
.. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2cam.c#6 edit
.. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2cam.h#3 edit
.. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2pci.c#7 edit
.. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.c#9 edit
.. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.h#9 edit
Differences ...
==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2cam.c#6 (text+ko) ====
@@ -511,7 +511,7 @@
}
rqs->SenseBufferLowAddress = htole32(mpt->sense.paddr + (MPT2_REQ2SMID(mpt, req) * MPT2_SENSE_SIZE));
- rqs->SenseBufferLength = MPT2_SENSE_SIZE;
+ rqs->SenseBufferLength = MPT2_USABLE_SENSE_SIZE;
/*
* If we have any data to send with this command map it into bus space.
@@ -902,7 +902,7 @@
rqs->IoFlags = htole16(cdblen);
memcpy(rqs->CDB.CDB32, cdbp, cdblen);
rqs->SenseBufferLowAddress = htole32(mpt->sense.paddr + (MPT2_REQ2SMID(mpt, req) * MPT2_SENSE_SIZE));
- rqs->SenseBufferLength = MPT2_SENSE_SIZE;
+ rqs->SenseBufferLength = MPT2_USABLE_SENSE_SIZE;
mpt2sas_send_cmd(mpt, req);
error = mpt2sas_wait_req(mpt, req, REQ_STATE_DONE, REQ_STATE_DONE, 10000);
MPT2SAS_SYNC_ERR(mpt, error);
==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2cam.h#3 (text+ko) ====
@@ -157,8 +157,8 @@
static __inline void
mpt2sas_set_ccb_status(union ccb *ccb, cam_status status)
{
- ccb->ccb_h.status &= ~CAM_STATUS_MASK;
- ccb->ccb_h.status |= status;
+ ccb->ccb_h.status &= ~CAM_STATUS_MASK;
+ ccb->ccb_h.status |= status;
}
/************************** CCB Manipulation Routines *************************/
==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2pci.c#7 (text+ko) ====
@@ -209,8 +209,8 @@
static int
mpt2sas_pci_attach(device_t dev)
{
- struct sysctl_ctx_list *ctx;
- struct sysctl_oid *tree;
+ struct sysctl_ctx_list *ctx;
+ struct sysctl_oid *tree;
mpt2sas_t *mpt;
int iqd, result;
@@ -224,16 +224,18 @@
mpt->dev = dev;
mpt2sas_set_options(mpt);
- ctx = device_get_sysctl_ctx(mpt->dev);
- tree = device_get_sysctl_tree(mpt->dev);
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "prt_mask", CTLFLAG_RW, &mpt->prt_mask, 0, "logging mask");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "config_buf_mask", CTLFLAG_RD, &mpt->config_buf_mask, 0, "logging mask");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nactive", CTLFLAG_RD, &mpt->nactive, 0, "number of active commands");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nreq_total", CTLFLAG_RD, &mpt->nreq_total, 0, "total number of requests for this HBA");
- SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nreq_allocated", CTLFLAG_RD, &mpt->nreq_allocated, 0, "number of allocated requests currently allocated");
- SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "rpintr", CTLFLAG_RD, &mpt->rpintr, "reply interrupts");
- SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nreply", CTLFLAG_RD, &mpt->nreply, "total replies");
- SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nreq", CTLFLAG_RD, &mpt->nreq, "total requests");
+ ctx = device_get_sysctl_ctx(mpt->dev);
+ tree = device_get_sysctl_tree(mpt->dev);
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "prt_mask", CTLFLAG_RW, &mpt->prt_mask, 0, "logging mask");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "config_buf_mask", CTLFLAG_RD, &mpt->config_buf_mask, 0, "logging mask");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nactive", CTLFLAG_RD, &mpt->nactive, 0, "number of active commands");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nreq_total", CTLFLAG_RD, &mpt->nreq_total, 0, "total number of requests for this HBA");
+ SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nreq_allocated", CTLFLAG_RD, &mpt->nreq_allocated, 0, "number of requests currently allocated");
+ SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "fwversion", CTLFLAG_RD, &mpt->fwversion[0], 0, "F/W version");
+ snprintf(mpt->fwversion, sizeof (mpt->fwversion), "0.0.0.0");
+ SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "rpintr", CTLFLAG_RD, &mpt->rpintr, "reply interrupts");
+ SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nreply", CTLFLAG_RD, &mpt->nreply, "total replies");
+ SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "nreq", CTLFLAG_RD, &mpt->nreq, "total requests");
/*
@@ -343,10 +345,10 @@
static void
mpt2sas_pci_intr(void *arg)
{
- mpt2sas_t *mpt = arg;
- MPT2_LOCK(mpt);
- mpt2sas_intr(mpt);
- MPT2_UNLOCK(mpt);
+ mpt2sas_t *mpt = arg;
+ MPT2_LOCK(mpt);
+ mpt2sas_intr(mpt);
+ MPT2_UNLOCK(mpt);
}
@@ -701,7 +703,7 @@
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filtfunc, filtfuncarg */
- MPT2_SENSE_DATA_SIZE(mpt), /* buddy paired with requests */
+ MPT2_SENSE_DATA_SIZE(mpt), /* buddy paired with requests */
1, /* nsegments */
BUS_SPACE_MAXSIZE, /* maxsegsz */
BUS_DMA_ALLOCNOW, /* flags */
@@ -739,7 +741,7 @@
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filtfunc, filtfuncarg */
- MPT2_CONFIG_DATA_MAX(mpt), /* maxsize */
+ MPT2_CONFIG_DATA_MAX(mpt), /* maxsize */
1, /* nsegments */
BUS_SPACE_MAXSIZE, /* maxsegsz */
BUS_DMA_ALLOCNOW, /* flags */
==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.c#9 (text+ko) ====
@@ -210,6 +210,8 @@
mpt->cfg_ExtPageLength = le16toh(m->ExtPageLength);
mpt->cfg_ExtPageType = m->ExtPageType;
}
+ } else {
+ mpt2sas_prt(mpt, MP2PRT_ERR, "%s: MPI2_CONFIG_REPLY IOC STATUS %#x\n", __func__, req->IOCStatus);
}
} else {
mpt2sas_prt(mpt, MP2PRT_ERR, "%s: MPI2_FUNCTION_CONFIG with no reply frame\n", __func__);
@@ -966,7 +968,7 @@
/*
* Tell the handshake reg. we are going to send a command
- * and how long it is going to be.
+ * and how long it is going to be.
*/
data = (MPI2_FUNCTION_HANDSHAKE << MPI2_DOORBELL_FUNCTION_SHIFT) |
(len << MPI2_DOORBELL_ADD_DWORDS_SHIFT);
@@ -1602,12 +1604,12 @@
/* Diag. port is now active so we can now hit the reset bit */
mpt2sas_write(mpt, MPI2_HOST_DIAGNOSTIC_OFFSET, diagreg | MPI2_DIAG_RESET_ADAPTER);
- /*
- * Ensure that the reset has finished. We delay 1ms
- * prior to reading the register to make sure the chip
- * has sufficiently completed its reset to handle register
- * accesses.
- */
+ /*
+ * Ensure that the reset has finished. We delay 1ms
+ * prior to reading the register to make sure the chip
+ * has sufficiently completed its reset to handle register
+ * accesses.
+ */
wait = 5000;
do {
DELAY(1000);
@@ -1655,11 +1657,11 @@
if ((cl = req->chain) != NULL) {
while (cl) {
- nxt = cl->linkage;
- cl->linkage = mpt->dma_chunk_free;
+ nxt = cl->linkage;
+ cl->linkage = mpt->dma_chunk_free;
mpt->dma_chunk_free = cl;
- cl = nxt;
- }
+ cl = nxt;
+ }
}
req->chain = NULL;
req->ccb = NULL;
@@ -1975,8 +1977,8 @@
/*
* The number of reply frames cannot be a multiple of 16
*/
- if ((mpt->max_replies % 16) == 0)
- mpt->max_replies -= 1;
+ if ((mpt->max_replies % 16) == 0)
+ mpt->max_replies -= 1;
mpt->reply_free_queue_depth = roundup(mpt->max_replies, 16);
mpt->reply_post_queue_depth = roundup(mpt->max_requests + mpt->max_replies + 1, 16);
@@ -1985,7 +1987,7 @@
mpt->max_requests -= qd;
mpt->reply_free_queue_depth -= qd;
mpt->reply_post_queue_depth -= qd;
- }
+ }
/*
* Figure out our chunk size.
*/
@@ -2165,8 +2167,10 @@
return (EIO);
}
mpt2host_iocfacts_convert(&mpt->ioc_facts);
- mpt2sas_prt(mpt, MP2PRT_ALL, "MPI2 Version=%d.%d.%d.%d\n", mpt->ioc_facts.MsgVersion >> 8, mpt->ioc_facts.MsgVersion & 0xFF,
- mpt->ioc_facts.HeaderVersion >> 8, mpt->ioc_facts.HeaderVersion & 0xFF);
+ snprintf(mpt->fwversion, sizeof (mpt->fwversion), "%d.%d.%d.%d", (mpt->ioc_facts.FWVersion.Word >> 24) & 0xff,
+ (mpt->ioc_facts.FWVersion.Word >> 16) & 0xff, (mpt->ioc_facts.FWVersion.Word >> 8) & 0xff, (mpt->ioc_facts.FWVersion.Word >> 0) & 0xff);
+ mpt2sas_prt(mpt, MP2PRT_ALL, "FW Version=%s MPI2 Version=%d.%d.%d.%d\n", mpt->fwversion,
+ mpt->ioc_facts.MsgVersion >> 8, mpt->ioc_facts.MsgVersion & 0xFF, mpt->ioc_facts.HeaderVersion >> 8, mpt->ioc_facts.HeaderVersion & 0xFF);
mpt2sas_prt(mpt, MP2PRT_CONFIG, "IOCCapabilities Report:\n");
for (i = 0; capabilities[i].val != NULL; i++) {
if (mpt->ioc_facts.IOCCapabilities & capabilities[i].mask)
@@ -2275,6 +2279,7 @@
struct timeval now, save;
request_t *req;
char buf[64];
+ int error;
struct topochg *tp;
int r;
@@ -2297,7 +2302,13 @@
req->state |= REQ_STATE_TIMEDOUT;
mpt2sas_prt(mpt, MP2PRT_ERR, "request %s timed out\n", mpt2sas_decode_request(mpt, req, buf, sizeof (buf)));
if ((req->state & (REQ_STATE_NEED_CALLBACK|REQ_STATE_NEED_WAKEUP)) == 0 && req->ccb) {
- mpt2sas_scsi_abort(mpt, req);
+ error = mpt2sas_scsi_abort(mpt, req);
+ if (error == ENOMEM) {
+ req->state &= ~REQ_STATE_TIMEDOUT;
+ req->timeout = 1000;
+ } else if (error) {
+ mpt2sas_prt(mpt, MP2PRT_ERR, "request %s failed to abort\n", mpt2sas_decode_request(mpt, req, buf, sizeof (buf)));
+ }
}
}
@@ -2345,14 +2356,14 @@
char buf[256];
int used;
va_list ap;
- if (mask != MP2PRT_ALL && (mask & mpt->prt_mask) == 0) {
- return;
- }
- snprintf(buf, sizeof buf, "%s: ", device_get_nameunit(mpt->dev));
+ if (mask != MP2PRT_ALL && (mask & mpt->prt_mask) == 0) {
+ return;
+ }
+ snprintf(buf, sizeof buf, "%s: ", device_get_nameunit(mpt->dev));
used = strlen(buf);
- va_start(ap, fmt);
- vsnprintf(&buf[used], sizeof (buf) - used, fmt, ap);
- va_end(ap);
+ va_start(ap, fmt);
+ vsnprintf(&buf[used], sizeof (buf) - used, fmt, ap);
+ va_end(ap);
printf("%s", buf);
}
@@ -2360,25 +2371,25 @@
mpt2sas_cam_prt(mpt2sas_t *mpt, struct cam_path *path, int mask, const char *fmt, ...)
{
va_list ap;
- if (mask != MP2PRT_ALL && (mask & mpt->prt_mask) == 0) {
- return;
- }
- xpt_print_path(path);
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
+ if (mask != MP2PRT_ALL && (mask & mpt->prt_mask) == 0) {
+ return;
+ }
+ xpt_print_path(path);
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
}
void
mpt2sas_prt_cont(mpt2sas_t *mpt, int mask, const char *fmt, ...)
{
va_list ap;
- if (mask != MP2PRT_ALL && (mask & mpt->prt_mask) == 0) {
- return;
- }
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
+ if (mask != MP2PRT_ALL && (mask & mpt->prt_mask) == 0) {
+ return;
+ }
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
}
int
@@ -2392,8 +2403,8 @@
mpt->ehook_active = 1;
if (config_intrhook_establish(&mpt->ehook) != 0) {
mpt->ehook_active = 0;
- return (-EIO);
- }
+ return (-EIO);
+ }
callout_init(&mpt->watchdog, 1);
MPT2_UNLOCK(mpt);
error = mpt2sas_init(mpt);
==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.h#9 (text+ko) ====
@@ -186,7 +186,8 @@
#define MAX_SAS_PORTS 8 /* TEMPORARY */
#define MPT2_MAX_LUN 0 /* TEMPORARY */
-#define MPT2_SENSE_SIZE roundup(SSD_FULL_SIZE, 32)
+#define MPT2_SENSE_SIZE 256
+#define MPT2_USABLE_SENSE_SIZE 252
#define MPT2_MAX_TOPO 256
@@ -328,7 +329,8 @@
REQ_STATE_NEED_WAKEUP = 0x20,
REQ_STATE_NEED_CALLBACK = 0x40,
REQ_STATE_POLLED = 0x80,
- REQ_STATE_LOCKED = 0x100, /* can't be freed */
+ REQ_STATE_ABORTED = 0x100,
+ REQ_STATE_LOCKED = 0x1000, /* can't be freed */
} req_state_t;
typedef void req_callback_t(mpt2sas_t *, request_t *, MPI2_DEFAULT_REPLY *);
@@ -444,6 +446,7 @@
uint16_t max_replies;
uint16_t reply_free_queue_depth;
uint16_t reply_post_queue_depth;
+ char fwversion[32];
/*
* Port Facts- one per port. For this device we only support one port.
More information about the p4-projects
mailing list