mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 16:54:02 +00:00
Code cleanup: use mpt_prt instead of device_printf.
This commit is contained in:
parent
660e41d37f
commit
301472c20b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103914
|
@ -39,16 +39,16 @@ static int maxwait_ack = 0;
|
|||
static int maxwait_int = 0;
|
||||
static int maxwait_state = 0;
|
||||
|
||||
static __inline u_int32_t mpt_rd_db(mpt_softc_t *mpt);
|
||||
static __inline u_int32_t mpt_rd_intr(mpt_softc_t *mpt);
|
||||
static INLINE u_int32_t mpt_rd_db(mpt_softc_t *mpt);
|
||||
static INLINE u_int32_t mpt_rd_intr(mpt_softc_t *mpt);
|
||||
|
||||
static __inline u_int32_t
|
||||
static INLINE u_int32_t
|
||||
mpt_rd_db(mpt_softc_t *mpt)
|
||||
{
|
||||
return mpt_read(mpt, MPT_OFFSET_DOORBELL);
|
||||
}
|
||||
|
||||
static __inline u_int32_t
|
||||
static INLINE u_int32_t
|
||||
mpt_rd_intr(mpt_softc_t *mpt)
|
||||
{
|
||||
return mpt_read(mpt, MPT_OFFSET_INTR_STATUS);
|
||||
|
@ -91,7 +91,7 @@ mpt_check_doorbell(mpt_softc_t *mpt)
|
|||
{
|
||||
u_int32_t db = mpt_rd_db(mpt);
|
||||
if (MPT_STATE(db) != MPT_DB_STATE_RUNNING) {
|
||||
device_printf(mpt->dev, "Device not running!\n");
|
||||
mpt_prt(mpt, "Device not running");
|
||||
mpt_print_db(db);
|
||||
}
|
||||
}
|
||||
|
@ -119,13 +119,12 @@ int
|
|||
mpt_soft_reset(mpt_softc_t *mpt)
|
||||
{
|
||||
if (mpt->verbose) {
|
||||
device_printf(mpt->dev,"soft reset\n");
|
||||
mpt_prt(mpt, "soft reset");
|
||||
}
|
||||
|
||||
/* Have to use hard reset if we are not in Running state */
|
||||
if (MPT_STATE(mpt_rd_db(mpt)) != MPT_DB_STATE_RUNNING) {
|
||||
device_printf(mpt->dev,
|
||||
"soft reset failed: device not running\n");
|
||||
mpt_prt(mpt, "soft reset failed: device not running");
|
||||
return MPT_FAIL;
|
||||
}
|
||||
|
||||
|
@ -134,7 +133,7 @@ mpt_soft_reset(mpt_softc_t *mpt)
|
|||
* processing. So don't waste our time.
|
||||
*/
|
||||
if (MPT_DB_IS_IN_USE(mpt_rd_db(mpt))) {
|
||||
device_printf(mpt->dev, "soft reset failed: doorbell wedged\n");
|
||||
mpt_prt(mpt, "soft reset failed: doorbell wedged");
|
||||
return MPT_FAIL;
|
||||
}
|
||||
|
||||
|
@ -142,14 +141,13 @@ mpt_soft_reset(mpt_softc_t *mpt)
|
|||
mpt_write(mpt, MPT_OFFSET_DOORBELL,
|
||||
MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET << MPI_DOORBELL_FUNCTION_SHIFT);
|
||||
if (mpt_wait_db_ack(mpt) != MPT_OK) {
|
||||
device_printf(mpt->dev, "soft reset failed: ack timeout\n");
|
||||
mpt_prt(mpt, "soft reset failed: ack timeout");
|
||||
return MPT_FAIL;
|
||||
}
|
||||
|
||||
/* Wait for the IOC to reload and come out of reset state */
|
||||
if (mpt_wait_state(mpt, MPT_DB_STATE_READY) != MPT_OK) {
|
||||
device_printf(mpt->dev,
|
||||
"soft reset failed: device did not start running\n");
|
||||
mpt_prt(mpt, "soft reset failed: device did not start running");
|
||||
return MPT_FAIL;
|
||||
}
|
||||
|
||||
|
@ -166,7 +164,7 @@ mpt_hard_reset(mpt_softc_t *mpt)
|
|||
* released by LSI. It's function is undocumented!
|
||||
*/
|
||||
if (mpt->verbose) {
|
||||
device_printf(mpt->dev, "hard reset\n");
|
||||
mpt_prt(mpt, "hard reset");
|
||||
}
|
||||
mpt_read(mpt, MPT_OFFSET_FUBAR);
|
||||
|
||||
|
@ -216,7 +214,7 @@ mpt_reset(mpt_softc_t *mpt)
|
|||
/* Wait for the IOC to reload and come out of reset state */
|
||||
ret = mpt_wait_state(mpt, MPT_DB_STATE_READY);
|
||||
if (ret != MPT_OK) {
|
||||
device_printf(mpt->dev, "failed to reset device\n");
|
||||
mpt_prt(mpt, "failed to reset device");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,19 +262,19 @@ 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%lx):\n",
|
||||
req->index, (long) req->req_pbuf);
|
||||
device_printf(mpt->dev, "%08X %08X %08X %08X\n",
|
||||
mpt_prt(mpt, "Send Request %d (0x%x):",
|
||||
req->index, req->req_pbuf);
|
||||
mpt_prt(mpt, "%08x %08x %08x %08x",
|
||||
pReq[0], pReq[1], pReq[2], pReq[3]);
|
||||
device_printf(mpt->dev, "%08X %08X %08X %08X\n",
|
||||
mpt_prt(mpt, "%08x %08x %08x %08x",
|
||||
pReq[4], pReq[5], pReq[6], pReq[7]);
|
||||
device_printf(mpt->dev, "%08X %08X %08X %08X\n",
|
||||
mpt_prt(mpt, "%08x %08x %08x %08x",
|
||||
pReq[8], pReq[9], pReq[10], pReq[11]);
|
||||
device_printf(mpt->dev, "%08X %08X %08X %08X\n",
|
||||
mpt_prt(mpt, "%08x %08x %08x %08x",
|
||||
pReq[12], pReq[13], pReq[14], pReq[15]);
|
||||
}
|
||||
bus_dmamap_sync(mpt->request_dmat, mpt->request_dmap,
|
||||
BUS_DMASYNC_PREWRITE);
|
||||
BUS_DMASYNC_PREWRITE);
|
||||
req->debug = REQ_ON_CHIP;
|
||||
mpt_write(mpt, MPT_OFFSET_REQUEST_Q, (u_int32_t) req->req_pbuf);
|
||||
}
|
||||
|
@ -316,8 +314,7 @@ mpt_send_handshake_cmd(mpt_softc_t *mpt, size_t len, void *cmd)
|
|||
(MPT_STATE(data) != MPT_DB_STATE_RUNNING) &&
|
||||
(MPT_STATE(data) != MPT_DB_STATE_FAULT)) ||
|
||||
( MPT_DB_IS_IN_USE(data) )) {
|
||||
device_printf(mpt->dev,
|
||||
"handshake aborted due to invalid doorbell state\n");
|
||||
mpt_prt(mpt, "handshake aborted due to invalid doorbell state");
|
||||
mpt_print_db(data);
|
||||
return(EBUSY);
|
||||
}
|
||||
|
@ -340,7 +337,7 @@ mpt_send_handshake_cmd(mpt_softc_t *mpt, size_t len, void *cmd)
|
|||
|
||||
/* Wait for the chip to notice */
|
||||
if (mpt_wait_db_int(mpt) != MPT_OK) {
|
||||
device_printf(mpt->dev, "mpt_send_handshake_cmd timeout1!\n");
|
||||
mpt_prt(mpt, "mpt_send_handshake_cmd timeout1");
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
|
||||
|
@ -348,7 +345,7 @@ mpt_send_handshake_cmd(mpt_softc_t *mpt, size_t len, void *cmd)
|
|||
mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0);
|
||||
|
||||
if (mpt_wait_db_ack(mpt) != MPT_OK) {
|
||||
device_printf(mpt->dev, "mpt_send_handshake_cmd timeout2!\n");
|
||||
mpt_prt(mpt, "mpt_send_handshake_cmd timeout2");
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
|
||||
|
@ -356,8 +353,8 @@ mpt_send_handshake_cmd(mpt_softc_t *mpt, size_t len, void *cmd)
|
|||
for (i = 0; i < len; i++) {
|
||||
mpt_write(mpt, MPT_OFFSET_DOORBELL, *data32++);
|
||||
if (mpt_wait_db_ack(mpt) != MPT_OK) {
|
||||
device_printf(mpt->dev,
|
||||
"mpt_send_handshake_cmd timeout! index = %d\n", i);
|
||||
mpt_prt(mpt,
|
||||
"mpt_send_handshake_cmd timeout! index = %d", i);
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
}
|
||||
|
@ -380,7 +377,7 @@ mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply)
|
|||
|
||||
/* Get first word */
|
||||
if (mpt_wait_db_int(mpt) != MPT_OK) {
|
||||
device_printf(mpt->dev, "mpt_recv_handshake_cmd timeout1!\n");
|
||||
mpt_prt(mpt, "mpt_recv_handshake_cmd timeout1");
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
*data16++ = mpt_read(mpt, MPT_OFFSET_DOORBELL) & MPT_DB_DATA_MASK;
|
||||
|
@ -388,7 +385,7 @@ mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply)
|
|||
|
||||
/* Get Second Word */
|
||||
if (mpt_wait_db_int(mpt) != MPT_OK) {
|
||||
device_printf(mpt->dev, "mpt_recv_handshake_cmd timeout2!\n");
|
||||
mpt_prt(mpt, "mpt_recv_handshake_cmd timeout2");
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
*data16++ = mpt_read(mpt, MPT_OFFSET_DOORBELL) & MPT_DB_DATA_MASK;
|
||||
|
@ -396,10 +393,9 @@ mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply)
|
|||
|
||||
/* With the second word, we can now look at the length */
|
||||
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%02lx\n",
|
||||
hdr->MsgLength << 2, (long) (reply_len << 1));
|
||||
mpt_prt(mpt, "reply length does not match message length: "
|
||||
"got 0x%02x, expected 0x%02x",
|
||||
hdr->MsgLength << 2, reply_len << 1);
|
||||
}
|
||||
|
||||
/* Get rest of the reply; but don't overflow the provided buffer */
|
||||
|
@ -409,8 +405,7 @@ mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply)
|
|||
u_int16_t datum;
|
||||
|
||||
if (mpt_wait_db_int(mpt) != MPT_OK) {
|
||||
device_printf(mpt->dev,
|
||||
"mpt_recv_handshake_cmd timeout3!\n");
|
||||
mpt_prt(mpt, "mpt_recv_handshake_cmd timeout3");
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
datum = mpt_read(mpt, MPT_OFFSET_DOORBELL);
|
||||
|
@ -423,7 +418,7 @@ mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply)
|
|||
|
||||
/* One more wait & clear at the end */
|
||||
if (mpt_wait_db_int(mpt) != MPT_OK) {
|
||||
device_printf(mpt->dev, "mpt_recv_handshake_cmd timeout4!\n");
|
||||
mpt_prt(mpt, "mpt_recv_handshake_cmd timeout4");
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0);
|
||||
|
@ -542,16 +537,16 @@ mpt_read_cfg_header(mpt_softc_t *mpt, int PageType, int PageNumber,
|
|||
DELAY(500);
|
||||
mpt_intr(mpt);
|
||||
if (++count == 1000) {
|
||||
device_printf(mpt->dev, "read_cfg_header timed out\n");
|
||||
mpt_prt(mpt, "read_cfg_header timed out");
|
||||
return (-1);
|
||||
}
|
||||
} while (req->debug == REQ_ON_CHIP);
|
||||
|
||||
reply = (MSG_CONFIG_REPLY *) MPT_REPLY_PTOV(mpt, req->sequence);
|
||||
if ((reply->IOCStatus & MPI_IOCSTATUS_MASK) != MPI_IOCSTATUS_SUCCESS) {
|
||||
device_printf(mpt->dev,
|
||||
"mpt_read_cfg_header: Config Info Status %x\n",
|
||||
mpt_prt(mpt, "mpt_read_cfg_header: Config Info Status %x",
|
||||
reply->IOCStatus);
|
||||
mpt_free_reply(mpt, (req->sequence << 1));
|
||||
return (-1);
|
||||
}
|
||||
bcopy(&reply->Header, rslt, sizeof (fCONFIG_PAGE_HEADER));
|
||||
|
@ -575,11 +570,11 @@ mpt_read_cfg_page(mpt_softc_t *mpt, int PageAddress, fCONFIG_PAGE_HEADER *hdr)
|
|||
req = mpt_get_request(mpt);
|
||||
|
||||
cfgp = req->req_vbuf;
|
||||
amt = (cfgp->Header.PageLength * sizeof (uint32_t));
|
||||
bzero(cfgp, MPT_REQUEST_AREA);
|
||||
cfgp->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
|
||||
cfgp->Function = MPI_FUNCTION_CONFIG;
|
||||
cfgp->Header = *hdr;
|
||||
amt = (cfgp->Header.PageLength * sizeof (u_int32_t));
|
||||
cfgp->Header.PageType &= MPI_CONFIG_PAGETYPE_MASK;
|
||||
cfgp->PageAddress = PageAddress;
|
||||
se = (SGE_SIMPLE32 *) &cfgp->PageBufferSGE;
|
||||
|
@ -598,16 +593,16 @@ mpt_read_cfg_page(mpt_softc_t *mpt, int PageAddress, fCONFIG_PAGE_HEADER *hdr)
|
|||
DELAY(500);
|
||||
mpt_intr(mpt);
|
||||
if (++count == 1000) {
|
||||
device_printf(mpt->dev, "read_cfg_page timed out\n");
|
||||
mpt_prt(mpt, "read_cfg_page timed out");
|
||||
return (-1);
|
||||
}
|
||||
} while (req->debug == REQ_ON_CHIP);
|
||||
|
||||
reply = (MSG_CONFIG_REPLY *) MPT_REPLY_PTOV(mpt, req->sequence);
|
||||
if ((reply->IOCStatus & MPI_IOCSTATUS_MASK) != MPI_IOCSTATUS_SUCCESS) {
|
||||
device_printf(mpt->dev,
|
||||
"mpt_read_cfg_page: Config Info Status %x\n",
|
||||
mpt_prt(mpt, "mpt_read_cfg_page: Config Info Status %x",
|
||||
reply->IOCStatus);
|
||||
mpt_free_reply(mpt, (req->sequence << 1));
|
||||
return (-1);
|
||||
}
|
||||
mpt_free_reply(mpt, (req->sequence << 1));
|
||||
|
@ -652,16 +647,16 @@ mpt_write_cfg_page(mpt_softc_t *mpt, int PageAddress, fCONFIG_PAGE_HEADER *hdr)
|
|||
hdr_attr = hdr->PageType & MPI_CONFIG_PAGEATTR_MASK;
|
||||
if (hdr_attr != MPI_CONFIG_PAGEATTR_CHANGEABLE &&
|
||||
hdr_attr != MPI_CONFIG_PAGEATTR_PERSISTENT) {
|
||||
device_printf(mpt->dev, "page type 0x%x not changeable\n",
|
||||
mpt_prt(mpt, "page type 0x%x not changeable",
|
||||
hdr->PageType & MPI_CONFIG_PAGETYPE_MASK);
|
||||
return (-1);
|
||||
}
|
||||
hdr->PageType &= MPI_CONFIG_PAGETYPE_MASK;
|
||||
|
||||
amt = (cfgp->Header.PageLength * sizeof (uint32_t));
|
||||
cfgp->Action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
|
||||
cfgp->Function = MPI_FUNCTION_CONFIG;
|
||||
cfgp->Header = *hdr;
|
||||
amt = (cfgp->Header.PageLength * sizeof (u_int32_t));
|
||||
cfgp->PageAddress = PageAddress;
|
||||
|
||||
se = (SGE_SIMPLE32 *) &cfgp->PageBufferSGE;
|
||||
|
@ -690,6 +685,8 @@ mpt_write_cfg_page(mpt_softc_t *mpt, int PageAddress, fCONFIG_PAGE_HEADER *hdr)
|
|||
amt = sizeof (fCONFIG_PAGE_SCSI_DEVICE_1);
|
||||
}
|
||||
bcopy(hdr, ((caddr_t)req->req_vbuf)+CFG_DATA_OFF, amt);
|
||||
/* Restore stripped out attributes */
|
||||
hdr->PageType |= hdr_attr;
|
||||
|
||||
mpt_check_doorbell(mpt);
|
||||
mpt_send_cmd(mpt, req);
|
||||
|
@ -699,25 +696,20 @@ mpt_write_cfg_page(mpt_softc_t *mpt, int PageAddress, fCONFIG_PAGE_HEADER *hdr)
|
|||
mpt_intr(mpt);
|
||||
if (++count == 1000) {
|
||||
hdr->PageType |= hdr_attr;
|
||||
device_printf(mpt->dev,
|
||||
"mpt_write_cfg_page timed out\n");
|
||||
mpt_prt(mpt, "mpt_write_cfg_page timed out");
|
||||
return (-1);
|
||||
}
|
||||
} while (req->debug == REQ_ON_CHIP);
|
||||
|
||||
reply = (MSG_CONFIG_REPLY *) MPT_REPLY_PTOV(mpt, req->sequence);
|
||||
if ((reply->IOCStatus & MPI_IOCSTATUS_MASK) != MPI_IOCSTATUS_SUCCESS) {
|
||||
device_printf(mpt->dev,
|
||||
"mpt_write_cfg_page: Config Info Status %x\n",
|
||||
mpt_prt(mpt, "mpt_write_cfg_page: Config Info Status %x",
|
||||
reply->IOCStatus);
|
||||
mpt_free_reply(mpt, (req->sequence << 1));
|
||||
return (-1);
|
||||
}
|
||||
mpt_free_reply(mpt, (req->sequence << 1));
|
||||
|
||||
/*
|
||||
* Restore stripped out attributes
|
||||
*/
|
||||
hdr->PageType |= hdr_attr;
|
||||
mpt_free_request(mpt, req);
|
||||
return (0);
|
||||
}
|
||||
|
@ -736,7 +728,7 @@ mpt_read_config_info_spi(mpt_softc_t *mpt)
|
|||
return (-1);
|
||||
}
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "SPI Port Page 0 Header: %x %x %x %x\n",
|
||||
mpt_prt(mpt, "SPI Port Page 0 Header: %x %x %x %x",
|
||||
mpt->mpt_port_page0.Header.PageVersion,
|
||||
mpt->mpt_port_page0.Header.PageLength,
|
||||
mpt->mpt_port_page0.Header.PageNumber,
|
||||
|
@ -749,7 +741,7 @@ mpt_read_config_info_spi(mpt_softc_t *mpt)
|
|||
return (-1);
|
||||
}
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "SPI Port Page 1 Header: %x %x %x %x\n",
|
||||
mpt_prt(mpt, "SPI Port Page 1 Header: %x %x %x %x",
|
||||
mpt->mpt_port_page1.Header.PageVersion,
|
||||
mpt->mpt_port_page1.Header.PageLength,
|
||||
mpt->mpt_port_page1.Header.PageNumber,
|
||||
|
@ -763,7 +755,7 @@ mpt_read_config_info_spi(mpt_softc_t *mpt)
|
|||
}
|
||||
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "SPI Port Page 2 Header: %x %x %x %x\n",
|
||||
mpt_prt(mpt, "SPI Port Page 2 Header: %x %x %x %x",
|
||||
mpt->mpt_port_page1.Header.PageVersion,
|
||||
mpt->mpt_port_page1.Header.PageLength,
|
||||
mpt->mpt_port_page1.Header.PageNumber,
|
||||
|
@ -777,8 +769,8 @@ mpt_read_config_info_spi(mpt_softc_t *mpt)
|
|||
return (-1);
|
||||
}
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Target %d Device Page 0 Header: %x %x %x %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Target %d Device Page 0 Header: %x %x %x %x",
|
||||
i, mpt->mpt_dev_page0[i].Header.PageVersion,
|
||||
mpt->mpt_dev_page0[i].Header.PageLength,
|
||||
mpt->mpt_dev_page0[i].Header.PageNumber,
|
||||
|
@ -791,8 +783,8 @@ mpt_read_config_info_spi(mpt_softc_t *mpt)
|
|||
return (-1);
|
||||
}
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Target %d Device Page 1 Header: %x %x %x %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Target %d Device Page 1 Header: %x %x %x %x",
|
||||
i, mpt->mpt_dev_page1[i].Header.PageVersion,
|
||||
mpt->mpt_dev_page1[i].Header.PageLength,
|
||||
mpt->mpt_dev_page1[i].Header.PageNumber,
|
||||
|
@ -808,35 +800,35 @@ mpt_read_config_info_spi(mpt_softc_t *mpt)
|
|||
|
||||
rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_port_page0.Header);
|
||||
if (rv) {
|
||||
device_printf(mpt->dev, "failed to read SPI Port Page 0\n");
|
||||
mpt_prt(mpt, "failed to read SPI Port Page 0");
|
||||
} else if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Port Page 0: Capabilities %x PhysicalInterface %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Port Page 0: Capabilities %x PhysicalInterface %x",
|
||||
mpt->mpt_port_page0.Capabilities,
|
||||
mpt->mpt_port_page0.PhysicalInterface);
|
||||
}
|
||||
|
||||
rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_port_page1.Header);
|
||||
if (rv) {
|
||||
device_printf(mpt->dev, "failed to read SPI Port Page 1\n");
|
||||
mpt_prt(mpt, "failed to read SPI Port Page 1");
|
||||
} else if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Port Page 1: Configuration %x OnBusTimerValue %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Port Page 1: Configuration %x OnBusTimerValue %x",
|
||||
mpt->mpt_port_page1.Configuration,
|
||||
mpt->mpt_port_page1.OnBusTimerValue);
|
||||
}
|
||||
|
||||
rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_port_page2.Header);
|
||||
if (rv) {
|
||||
device_printf(mpt->dev, "failed to read SPI Port Page 2\n");
|
||||
mpt_prt(mpt, "failed to read SPI Port Page 2");
|
||||
} else if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Port Page 2: Flags %x Settings %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Port Page 2: Flags %x Settings %x",
|
||||
mpt->mpt_port_page2.PortFlags,
|
||||
mpt->mpt_port_page2.PortSettings);
|
||||
for (i = 0; i < 16; i++) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Port Page 2 Tgt %d: timo %x SF %x Flags %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Port Page 2 Tgt %d: timo %x SF %x Flags %x",
|
||||
i, mpt->mpt_port_page2.DeviceSettings[i].Timeout,
|
||||
mpt->mpt_port_page2.DeviceSettings[i].SyncFactor,
|
||||
mpt->mpt_port_page2.DeviceSettings[i].DeviceFlags);
|
||||
|
@ -846,25 +838,23 @@ mpt_read_config_info_spi(mpt_softc_t *mpt)
|
|||
for (i = 0; i < 16; i++) {
|
||||
rv = mpt_read_cfg_page(mpt, i, &mpt->mpt_dev_page0[i].Header);
|
||||
if (rv) {
|
||||
device_printf(mpt->dev,
|
||||
"cannot read SPI Tgt %d Device Page 0\n", i);
|
||||
mpt_prt(mpt, "cannot read SPI Tgt %d Device Page 0", i);
|
||||
continue;
|
||||
}
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Tgt %d Page 0: NParms %x Information %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Tgt %d Page 0: NParms %x Information %x",
|
||||
i, mpt->mpt_dev_page0[i].NegotiatedParameters,
|
||||
mpt->mpt_dev_page0[i].Information);
|
||||
}
|
||||
rv = mpt_read_cfg_page(mpt, i, &mpt->mpt_dev_page1[i].Header);
|
||||
if (rv) {
|
||||
device_printf(mpt->dev,
|
||||
"cannot read SPI Tgt %d Device Page 1\n", i);
|
||||
mpt_prt(mpt, "cannot read SPI Tgt %d Device Page 1", i);
|
||||
continue;
|
||||
}
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Tgt %d Page 1: RParms %x Configuration %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Tgt %d Page 1: RParms %x Configuration %x",
|
||||
i, mpt->mpt_dev_page1[i].RequestedParameters,
|
||||
mpt->mpt_dev_page1[i].Configuration);
|
||||
}
|
||||
|
@ -887,8 +877,8 @@ mpt_set_initial_config_spi(mpt_softc_t *mpt)
|
|||
|
||||
if (mpt->mpt_port_page1.Configuration != pp1val) {
|
||||
fCONFIG_PAGE_SCSI_PORT_1 tmp;
|
||||
device_printf(mpt->dev,
|
||||
"SPI Port Page 1 Config value bad (%x)- should be %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Port Page 1 Config value bad (%x)- should be %x",
|
||||
mpt->mpt_port_page1.Configuration, pp1val);
|
||||
tmp = mpt->mpt_port_page1;
|
||||
tmp.Configuration = pp1val;
|
||||
|
@ -899,8 +889,8 @@ mpt_set_initial_config_spi(mpt_softc_t *mpt)
|
|||
return (-1);
|
||||
}
|
||||
if (tmp.Configuration != pp1val) {
|
||||
device_printf(mpt->dev,
|
||||
"failed to reset SPI Port Page 1 Config value\n");
|
||||
mpt_prt(mpt,
|
||||
"failed to reset SPI Port Page 1 Config value");
|
||||
return (-1);
|
||||
}
|
||||
mpt->mpt_port_page1 = tmp;
|
||||
|
@ -912,8 +902,8 @@ mpt_set_initial_config_spi(mpt_softc_t *mpt)
|
|||
tmp.RequestedParameters = 0;
|
||||
tmp.Configuration = 0;
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"Set Tgt %d SPI DevicePage 1 values to %x 0 %x\n",
|
||||
mpt_prt(mpt,
|
||||
"Set Tgt %d SPI DevicePage 1 values to %x 0 %x",
|
||||
i, tmp.RequestedParameters, tmp.Configuration);
|
||||
}
|
||||
if (mpt_write_cfg_page(mpt, i, &tmp.Header)) {
|
||||
|
@ -924,41 +914,12 @@ mpt_set_initial_config_spi(mpt_softc_t *mpt)
|
|||
}
|
||||
mpt->mpt_dev_page1[i] = tmp;
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Tgt %d Page 1: RParm %x Configuration %x\n", i,
|
||||
mpt_prt(mpt,
|
||||
"SPI Tgt %d Page 1: RParm %x Configuration %x", i,
|
||||
mpt->mpt_dev_page1[i].RequestedParameters,
|
||||
mpt->mpt_dev_page1[i].Configuration);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the BIOS hasn't been enabled, the SCSI Port Page2 device
|
||||
* parameter are apparently complete nonsense. I've had partially
|
||||
* sensible Page2 settings on *one* bus, but nothing on another-
|
||||
* it's ridiculous.
|
||||
*
|
||||
* For that matter, the Port Page 0 parameters are *also* nonsense,
|
||||
* so the offset and period and currently connected physical interface
|
||||
* is also nonsense.
|
||||
*
|
||||
* This makes it very difficult to try and figure out what maximum
|
||||
* settings we could have. Therefore, we'll synthesize the maximums
|
||||
* here.
|
||||
*/
|
||||
for (i = 0; i < 16; i++) {
|
||||
mpt->mpt_port_page2.DeviceSettings[i].DeviceFlags =
|
||||
MPI_SCSIPORTPAGE2_DEVICE_DISCONNECT_ENABLE |
|
||||
MPI_SCSIPORTPAGE2_DEVICE_TAG_QUEUE_ENABLE;
|
||||
}
|
||||
mpt->mpt_port_page0.Capabilities =
|
||||
MPI_SCSIPORTPAGE0_CAP_IU |
|
||||
MPI_SCSIPORTPAGE0_CAP_DT |
|
||||
MPI_SCSIPORTPAGE0_CAP_QAS |
|
||||
MPI_SCSIPORTPAGE0_CAP_WIDE |
|
||||
(31 << 16) | /* offset */
|
||||
(8 << 8); /* period */
|
||||
mpt->mpt_port_page0.PhysicalInterface =
|
||||
MPI_SCSIPORTPAGE0_PHY_SIGNAL_LVD;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -983,7 +944,7 @@ mpt_send_port_enable(mpt_softc_t *mpt, int port)
|
|||
|
||||
mpt_check_doorbell(mpt);
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "enabling port %d\n", port);
|
||||
mpt_prt(mpt, "enabling port %d", port);
|
||||
}
|
||||
mpt_send_cmd(mpt, req);
|
||||
|
||||
|
@ -992,7 +953,7 @@ mpt_send_port_enable(mpt_softc_t *mpt, int port)
|
|||
DELAY(500);
|
||||
mpt_intr(mpt);
|
||||
if (++count == 100000) {
|
||||
device_printf(mpt->dev, "port enable timed out\n");
|
||||
mpt_prt(mpt, "port enable timed out");
|
||||
return (-1);
|
||||
}
|
||||
} while (req->debug == REQ_ON_CHIP);
|
||||
|
@ -1023,8 +984,7 @@ mpt_send_event_request(mpt_softc_t *mpt, int onoff)
|
|||
|
||||
mpt_check_doorbell(mpt);
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "%sabling async events\n",
|
||||
onoff? "en" : "dis");
|
||||
mpt_prt(mpt, "%sabling async events", onoff? "en" : "dis");
|
||||
}
|
||||
mpt_send_cmd(mpt, req);
|
||||
|
||||
|
@ -1069,7 +1029,7 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who)
|
|||
}
|
||||
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "doorbell req = %s\n",
|
||||
mpt_prt(mpt, "doorbell req = %s",
|
||||
mpt_ioc_diag(mpt_read(mpt, MPT_OFFSET_DOORBELL)));
|
||||
}
|
||||
|
||||
|
@ -1105,12 +1065,12 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who)
|
|||
}
|
||||
|
||||
if (mpt_get_iocfacts(mpt, &facts) != MPT_OK) {
|
||||
device_printf(mpt->dev, "mpt_get_iocfacts failed\n");
|
||||
mpt_prt(mpt, "mpt_get_iocfacts failed");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
mpt_prt(mpt,
|
||||
"IOCFACTS: GlobalCredits=%d BlockSize=%u "
|
||||
"Request Frame Size %u\n", facts.GlobalCredits,
|
||||
facts.BlockSize, facts.RequestFrameSize);
|
||||
|
@ -1119,12 +1079,12 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who)
|
|||
mpt->request_frame_size = facts.RequestFrameSize;
|
||||
|
||||
if (mpt_get_portfacts(mpt, &pfp) != MPT_OK) {
|
||||
device_printf(mpt->dev, "mpt_get_portfacts failed\n");
|
||||
mpt_prt(mpt, "mpt_get_portfacts failed");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
mpt_prt(mpt,
|
||||
"PORTFACTS: Type %x PFlags %x IID %d MaxDev %d\n",
|
||||
pfp.PortType, pfp.ProtocolFlags, pfp.PortSCSIID,
|
||||
pfp.MaxDevices);
|
||||
|
@ -1132,12 +1092,12 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who)
|
|||
|
||||
if (pfp.PortType != MPI_PORTFACTS_PORTTYPE_SCSI &&
|
||||
pfp.PortType != MPI_PORTFACTS_PORTTYPE_FC) {
|
||||
device_printf(mpt->dev, "Unsupported Port Type (%x)\n",
|
||||
mpt_prt(mpt, "Unsupported Port Type (%x)",
|
||||
pfp.PortType);
|
||||
return (ENXIO);
|
||||
}
|
||||
if (!(pfp.ProtocolFlags & MPI_PORTFACTS_PROTOCOL_INITIATOR)) {
|
||||
device_printf(mpt->dev, "initiator role unsupported\n");
|
||||
mpt_prt(mpt, "initiator role unsupported");
|
||||
return (ENXIO);
|
||||
}
|
||||
if (pfp.PortType == MPI_PORTFACTS_PORTTYPE_FC) {
|
||||
|
@ -1148,21 +1108,20 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who)
|
|||
mpt->mpt_ini_id = pfp.PortSCSIID;
|
||||
|
||||
if (mpt_send_ioc_init(mpt, who) != MPT_OK) {
|
||||
device_printf(mpt->dev, "mpt_send_ioc_init failed\n");
|
||||
mpt_prt(mpt, "mpt_send_ioc_init failed");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "mpt_send_ioc_init ok\n");
|
||||
mpt_prt(mpt, "mpt_send_ioc_init ok");
|
||||
}
|
||||
|
||||
if (mpt_wait_state(mpt, MPT_DB_STATE_RUNNING) != MPT_OK) {
|
||||
device_printf(mpt->dev,
|
||||
"IOC failed to go to run state\n");
|
||||
mpt_prt(mpt, "IOC failed to go to run state");
|
||||
continue;
|
||||
}
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "IOC now at RUNSTATE\n");
|
||||
mpt_prt(mpt, "IOC now at RUNSTATE");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1202,12 +1161,12 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who)
|
|||
* Now enable the port
|
||||
*/
|
||||
if (mpt_send_port_enable(mpt, 0) != MPT_OK) {
|
||||
device_printf(mpt->dev, "failed to enable port 0\n");
|
||||
mpt_prt(mpt, "failed to enable port 0");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "enabled port 0\n");
|
||||
mpt_prt(mpt, "enabled port 0");
|
||||
}
|
||||
|
||||
/* Everything worked */
|
||||
|
@ -1215,12 +1174,12 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who)
|
|||
}
|
||||
|
||||
if (try >= MPT_MAX_TRYS) {
|
||||
device_printf(mpt->dev, "failed to initialize IOC\n");
|
||||
mpt_prt(mpt, "failed to initialize IOC");
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "enabling interrupts\n");
|
||||
mpt_prt(mpt, "enabling interrupts");
|
||||
}
|
||||
|
||||
mpt_enable_ints(mpt);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <dev/mpt/mpt_freebsd.h>
|
||||
#include <machine/stdarg.h> /* for use by mpt_prt below */
|
||||
|
||||
struct Error_Map {
|
||||
int Error_Code;
|
||||
|
@ -592,3 +593,14 @@ mpt_dump_sgl(SGE_IO_UNION *su)
|
|||
iCount -= 1;
|
||||
} while ((flags & MPI_SGE_FLAGS_END_OF_LIST) == 0 && iCount != 0);
|
||||
}
|
||||
|
||||
void
|
||||
mpt_prt(mpt_softc_t *mpt, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
printf("%s: ", device_get_nameunit(mpt->dev));
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
printf("\n");
|
||||
}
|
||||
|
|
|
@ -130,17 +130,17 @@ mpttimeout(void *arg)
|
|||
mpt->timeouts++;
|
||||
if (mpt_intr(mpt)) {
|
||||
if (req->sequence != oseq) {
|
||||
device_printf(mpt->dev, "bullet missed in timeout\n");
|
||||
mpt_prt(mpt, "bullet missed in timeout");
|
||||
MPT_UNLOCK(mpt);
|
||||
return;
|
||||
}
|
||||
device_printf(mpt->dev, "bullet U-turned in timeout: got us\n");
|
||||
mpt_prt(mpt, "bullet U-turned in timeout: got us");
|
||||
}
|
||||
device_printf(mpt->dev,
|
||||
"time out on request index = 0x%02x sequence = 0x%08x\n",
|
||||
mpt_prt(mpt,
|
||||
"time out on request index = 0x%02x sequence = 0x%08x",
|
||||
req->index, req->sequence);
|
||||
mpt_check_doorbell(mpt);
|
||||
device_printf(mpt->dev, "Status %08X; Mask %08X; Doorbell %08X\n",
|
||||
mpt_prt(mpt, "Status %08x; Mask %08x; Doorbell %08x",
|
||||
mpt_read(mpt, MPT_OFFSET_INTR_STATUS),
|
||||
mpt_read(mpt, MPT_OFFSET_INTR_MASK),
|
||||
mpt_read(mpt, MPT_OFFSET_DOORBELL) );
|
||||
|
@ -204,8 +204,7 @@ mpt_execute_req(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
|
|||
|
||||
if (error != 0) {
|
||||
if (error != EFBIG)
|
||||
device_printf(mpt->dev, "bus_dmamap_load returned %d\n",
|
||||
error);
|
||||
mpt_prt(mpt, "bus_dmamap_load returned %d", error);
|
||||
if (ccb->ccb_h.status == CAM_REQ_INPROG) {
|
||||
xpt_freeze_devq(ccb->ccb_h.path, 1);
|
||||
ccb->ccb_h.status = CAM_DEV_QFRZN;
|
||||
|
@ -396,7 +395,7 @@ mpt_start(union ccb *ccb)
|
|||
mpt->outofbeer = 1;
|
||||
xpt_freeze_simq(mpt->sim, 1);
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "FREEZEQ\n");
|
||||
mpt_prt(mpt, "FREEZEQ");
|
||||
}
|
||||
}
|
||||
MPTLOCK_2_CAMLOCK(mpt);
|
||||
|
@ -583,8 +582,8 @@ mpt_bus_reset(union ccb *ccb)
|
|||
error = mpt_send_handshake_cmd(mpt,
|
||||
sizeof (MSG_SCSI_TASK_MGMT), reset_req);
|
||||
if (error) {
|
||||
device_printf(mpt->dev,
|
||||
"mpt_bus_reset: mpt_send_handshake return %d\n", error);
|
||||
mpt_prt(mpt,
|
||||
"mpt_bus_reset: mpt_send_handshake return %d", error);
|
||||
return (CAM_REQ_CMP_ERR);
|
||||
} else {
|
||||
return (CAM_REQ_CMP);
|
||||
|
@ -611,8 +610,7 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, u_int32_t reply)
|
|||
MSG_PORT_ENABLE_REPLY *msg = vmsg;
|
||||
int index = msg->MsgContext & ~0x80000000;
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "enable port reply idx %d\n",
|
||||
index);
|
||||
mpt_prt(mpt, "enable port reply idx %d", index);
|
||||
}
|
||||
if (index >= 0 && index < MPT_MAX_REQUESTS(mpt)) {
|
||||
request_t *req = &mpt->request_pool[index];
|
||||
|
@ -630,8 +628,7 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, u_int32_t reply)
|
|||
mpt_free_reply(mpt, (reply << 1));
|
||||
}
|
||||
} else {
|
||||
device_printf(mpt->dev, "unknown mpt_ctlop: %x\n",
|
||||
dmsg->Function);
|
||||
mpt_prt(mpt, "unknown mpt_ctlop: %x", dmsg->Function);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -641,35 +638,31 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg)
|
|||
switch(msg->Event) {
|
||||
case MPI_EVENT_LOG_DATA:
|
||||
/* Some error occured that LSI wants logged */
|
||||
device_printf(mpt->dev,
|
||||
"\tEvtLogData: IOCLogInfo: 0x%08x\n",
|
||||
msg->IOCLogInfo);
|
||||
device_printf(mpt->dev, "\tEvtLogData: Event Data:");
|
||||
printf("\tEvtLogData: IOCLogInfo: 0x%08x\n", msg->IOCLogInfo);
|
||||
printf("\tEvtLogData: Event Data:");
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < msg->EventDataLength; i++) {
|
||||
device_printf(mpt->dev,
|
||||
" %08X", msg->Data[i]);
|
||||
printf(" %08x", msg->Data[i]);
|
||||
}
|
||||
}
|
||||
device_printf(mpt->dev, "\n");
|
||||
printf("\n");
|
||||
break;
|
||||
|
||||
case MPI_EVENT_UNIT_ATTENTION:
|
||||
device_printf(mpt->dev,
|
||||
"Bus: 0x%02x TargetID: 0x%02x\n",
|
||||
mpt_prt(mpt, "Bus: 0x%02x TargetID: 0x%02x",
|
||||
(msg->Data[0] >> 8) & 0xff, msg->Data[0] & 0xff);
|
||||
break;
|
||||
|
||||
case MPI_EVENT_IOC_BUS_RESET:
|
||||
/* We generated a bus reset */
|
||||
device_printf(mpt->dev, "IOC Bus Reset Port: %d\n",
|
||||
mpt_prt(mpt, "IOC Bus Reset Port: %d",
|
||||
(msg->Data[0] >> 8) & 0xff);
|
||||
break;
|
||||
|
||||
case MPI_EVENT_EXT_BUS_RESET:
|
||||
/* Someone else generated a bus reset */
|
||||
device_printf(mpt->dev, "Ext Bus Reset\n");
|
||||
mpt_prt(mpt, "Ext Bus Reset");
|
||||
/*
|
||||
* These replies don't return EventData like the MPI
|
||||
* spec says they do
|
||||
|
@ -682,13 +675,12 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg)
|
|||
* In general this means a device has been added
|
||||
* to the loop.
|
||||
*/
|
||||
device_printf(mpt->dev,
|
||||
"Rescan Port: %d\n", (msg->Data[0] >> 8) & 0xff);
|
||||
mpt_prt(mpt, "Rescan Port: %d", (msg->Data[0] >> 8) & 0xff);
|
||||
/* xpt_async(AC_FOUND_DEVICE, path, NULL); */
|
||||
break;
|
||||
|
||||
case MPI_EVENT_LINK_STATUS_CHANGE:
|
||||
device_printf(mpt->dev, "Port %d: LinkState: %s\n",
|
||||
mpt_prt(mpt, "Port %d: LinkState: %s",
|
||||
(msg->Data[1] >> 8) & 0xff,
|
||||
((msg->Data[0] & 0xff) == 0)? "Failed" : "Active");
|
||||
break;
|
||||
|
@ -696,8 +688,8 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg)
|
|||
case MPI_EVENT_LOOP_STATE_CHANGE:
|
||||
switch ((msg->Data[0] >> 16) & 0xff) {
|
||||
case 0x01:
|
||||
device_printf(mpt->dev,
|
||||
"Port 0x%x: FC LinkEvent: LIP(%02X,%02X) (Loop Initialization)\n",
|
||||
mpt_prt(mpt,
|
||||
"Port 0x%x: FC LinkEvent: LIP(%02x,%02x) (Loop Initialization)\n",
|
||||
(msg->Data[1] >> 8) & 0xff,
|
||||
(msg->Data[0] >> 8) & 0xff,
|
||||
(msg->Data[0] ) & 0xff);
|
||||
|
@ -706,7 +698,7 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg)
|
|||
if ((msg->Data[0] & 0xff) == 0xF7) {
|
||||
printf("Device needs AL_PA\n");
|
||||
} else {
|
||||
printf("Device %02X doesn't like FC performance\n",
|
||||
printf("Device %02x doesn't like FC performance\n",
|
||||
msg->Data[0] & 0xFF);
|
||||
}
|
||||
break;
|
||||
|
@ -714,33 +706,33 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg)
|
|||
if ((msg->Data[0] & 0xff) == 0xF7) {
|
||||
printf("Device had loop failure at its receiver prior to acquiring AL_PA\n");
|
||||
} else {
|
||||
printf("Device %02X detected loop failure at its receiver\n",
|
||||
printf("Device %02x detected loop failure at its receiver\n",
|
||||
msg->Data[0] & 0xFF);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("Device %02X requests that device %02X reset itself\n",
|
||||
printf("Device %02x requests that device %02x reset itself\n",
|
||||
msg->Data[0] & 0xFF,
|
||||
(msg->Data[0] >> 8) & 0xFF);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x02:
|
||||
device_printf(mpt->dev, "Port 0x%x: FC LinkEvent: LPE(%02X,%02X) (Loop Port Enable)\n",
|
||||
mpt_prt(mpt, "Port 0x%x: FC LinkEvent: LPE(%02x,%02x) (Loop Port Enable)",
|
||||
(msg->Data[1] >> 8) & 0xff, /* Port */
|
||||
(msg->Data[0] >> 8) & 0xff, /* Character 3 */
|
||||
(msg->Data[0] ) & 0xff /* Character 4 */
|
||||
);
|
||||
break;
|
||||
case 0x03:
|
||||
device_printf(mpt->dev, "Port 0x%x: FC LinkEvent: LPB(%02X,%02X) (Loop Port Bypass)\n",
|
||||
mpt_prt(mpt, "Port 0x%x: FC LinkEvent: LPB(%02x,%02x) (Loop Port Bypass)",
|
||||
(msg->Data[1] >> 8) & 0xff, /* Port */
|
||||
(msg->Data[0] >> 8) & 0xff, /* Character 3 */
|
||||
(msg->Data[0] ) & 0xff /* Character 4 */
|
||||
);
|
||||
break;
|
||||
default:
|
||||
device_printf(mpt->dev, "Port 0x%x: FC LinkEvent: Unknown FC event (%02X %02X %02X)\n",
|
||||
mpt_prt(mpt, "Port 0x%x: FC LinkEvent: Unknown FC event (%02x %02x %02x)",
|
||||
(msg->Data[1] >> 8) & 0xff, /* Port */
|
||||
(msg->Data[0] >> 16) & 0xff, /* Event */
|
||||
(msg->Data[0] >> 8) & 0xff, /* Character 3 */
|
||||
|
@ -750,16 +742,15 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg)
|
|||
break;
|
||||
|
||||
case MPI_EVENT_LOGOUT:
|
||||
device_printf(mpt->dev, "FC Logout Port: %d N_PortID: %02X\n",
|
||||
(msg->Data[1] >> 8) & 0xff,
|
||||
msg->Data[0]);
|
||||
mpt_prt(mpt, "FC Logout Port: %d N_PortID: %02x",
|
||||
(msg->Data[1] >> 8) & 0xff, msg->Data[0]);
|
||||
break;
|
||||
case MPI_EVENT_EVENT_CHANGE:
|
||||
/* This is just an acknowledgement of our
|
||||
mpt_send_event_request */
|
||||
break;
|
||||
default:
|
||||
device_printf(mpt->dev, "Unknown event %X\n", msg->Event);
|
||||
mpt_prt(mpt, "Unknown event 0x%x\n", msg->Event);
|
||||
}
|
||||
if (msg->AckRequired) {
|
||||
MSG_EVENT_ACK *ackp;
|
||||
|
@ -777,6 +768,7 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg)
|
|||
mpt_send_cmd(mpt, req);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mpt_done(mpt_softc_t *mpt, u_int32_t reply)
|
||||
{
|
||||
|
@ -801,13 +793,13 @@ mpt_done(mpt_softc_t *mpt, u_int32_t reply)
|
|||
mpt_reply = MPT_REPLY_PTOV(mpt, reply);
|
||||
if (mpt->verbose > 1) {
|
||||
pReply = (unsigned *) mpt_reply;
|
||||
device_printf(mpt->dev, "Address Reply (index %u)\n",
|
||||
mpt_prt(mpt, "Address Reply (index %u)",
|
||||
mpt_reply->MsgContext & 0xffff);
|
||||
device_printf(mpt->dev, "%08X %08X %08X %08X\n",
|
||||
printf("%08x %08x %08x %08x\n",
|
||||
pReply[0], pReply[1], pReply[2], pReply[3]);
|
||||
device_printf(mpt->dev, "%08X %08X %08X %08X\n",
|
||||
printf("%08x %08x %08x %08x\n",
|
||||
pReply[4], pReply[5], pReply[6], pReply[7]);
|
||||
device_printf(mpt->dev, "%08X %08X %08X %08X\n\n",
|
||||
printf("%08x %08x %08x %08x\n\n",
|
||||
pReply[8], pReply[9], pReply[10], pReply[11]);
|
||||
}
|
||||
index = mpt_reply->MsgContext;
|
||||
|
@ -822,15 +814,14 @@ mpt_done(mpt_softc_t *mpt, u_int32_t reply)
|
|||
if (mpt_reply != NULL) {
|
||||
mpt_ctlop(mpt, mpt_reply, reply);
|
||||
} else {
|
||||
device_printf(mpt->dev,
|
||||
"mpt_done: index 0x%x, NULL reply\n", index);
|
||||
mpt_prt(mpt, "mpt_done: index 0x%x, NULL reply", index);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Did we end up with a valid index into the table? */
|
||||
if (index < 0 || index >= MPT_MAX_REQUESTS(mpt)) {
|
||||
printf("mpt_done: invalid index (%x) in reply\n", index);
|
||||
mpt_prt(mpt, "mpt_done: invalid index (%x) in reply", index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -846,7 +837,7 @@ mpt_done(mpt_softc_t *mpt, u_int32_t reply)
|
|||
mpt_req = req->req_vbuf;
|
||||
if (mpt_req->Function == MPI_FUNCTION_SCSI_TASK_MGMT) {
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "mpt_done: TASK MGMT\n");
|
||||
mpt_prt(mpt, "mpt_done: TASK MGMT");
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
@ -868,7 +859,7 @@ mpt_done(mpt_softc_t *mpt, u_int32_t reply)
|
|||
|
||||
/* Can't have had a SCSI command with out a CAM control block */
|
||||
if (ccb == NULL || (ccb->ccb_h.status & CAM_SIM_QUEUED) == 0) {
|
||||
device_printf(mpt->dev,
|
||||
mpt_prt(mpt,
|
||||
"mpt_done: corrupted ccb, index = 0x%02x seq = 0x%08x",
|
||||
req->index, req->sequence);
|
||||
printf(" request state %s\nmpt_request:\n",
|
||||
|
@ -908,7 +899,7 @@ mpt_done(mpt_softc_t *mpt, u_int32_t reply)
|
|||
ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
|
||||
mpt->outofbeer = 0;
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "THAWQ\n");
|
||||
mpt_prt(mpt, "THAWQ");
|
||||
}
|
||||
}
|
||||
MPTLOCK_2_CAMLOCK(mpt);
|
||||
|
@ -937,10 +928,6 @@ mpt_done(mpt_softc_t *mpt, u_int32_t reply)
|
|||
ccb->ccb_h.status = CAM_DATA_RUN_ERR;
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
device_printf(mpt->dev, "underrun, scsi status is %x\n", ccb->csio.scsi_status);
|
||||
ccb->csio.scsi_status = SCSI_STATUS_QUEUE_FULL;
|
||||
#endif
|
||||
/* Fall through */
|
||||
case MPI_IOCSTATUS_SUCCESS:
|
||||
case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR:
|
||||
|
@ -1021,7 +1008,7 @@ device_printf(mpt->dev, "underrun, scsi status is %x\n", ccb->csio.scsi_status);
|
|||
ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
|
||||
mpt->outofbeer = 0;
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "THAWQ\n");
|
||||
mpt_prt(mpt, "THAWQ");
|
||||
}
|
||||
}
|
||||
MPTLOCK_2_CAMLOCK(mpt);
|
||||
|
@ -1054,7 +1041,7 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
|||
switch (ccb->ccb_h.func_code) {
|
||||
case XPT_RESET_BUS:
|
||||
if (mpt->verbose > 1)
|
||||
device_printf(mpt->dev, "XPT_RESET_BUS\n");
|
||||
mpt_prt(mpt, "XPT_RESET_BUS");
|
||||
CAMLOCK_2_MPTLOCK(mpt);
|
||||
error = mpt_bus_reset(ccb);
|
||||
switch (error) {
|
||||
|
@ -1066,7 +1053,7 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
|||
mpt->outofbeer = 1;
|
||||
xpt_freeze_simq(sim, 1);
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "FREEZEQ\n");
|
||||
mpt_prt(mpt, "FREEZEQ");
|
||||
}
|
||||
}
|
||||
ccb->ccb_h.status = CAM_REQUEUE_REQ;
|
||||
|
@ -1081,7 +1068,7 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
|||
ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
|
||||
mpt->outofbeer = 0;
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev, "THAWQ\n");
|
||||
mpt_prt(mpt, "THAWQ");
|
||||
}
|
||||
}
|
||||
MPTLOCK_2_CAMLOCK(mpt);
|
||||
|
@ -1245,8 +1232,8 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
|||
}
|
||||
MPTLOCK_2_CAMLOCK(mpt);
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SET tgt %d flags %x period %x off %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SET tgt %d flags %x period %x off %x",
|
||||
tgt, dval, period, offset);
|
||||
}
|
||||
}
|
||||
|
@ -1308,12 +1295,12 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
|||
tmp = mpt->mpt_dev_page0[tgt];
|
||||
CAMLOCK_2_MPTLOCK(mpt);
|
||||
if (mpt_read_cfg_page(mpt, tgt, &tmp.Header)) {
|
||||
device_printf(mpt->dev,
|
||||
"cannot get target %d DP0\n", tgt);
|
||||
mpt_prt(mpt,
|
||||
"cannot get target %d DP0", tgt);
|
||||
} else {
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Tgt %d Page 0: NParms %x Information %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Tgt %d Page 0: NParms %x Information %x",
|
||||
tgt,
|
||||
tmp.NegotiatedParameters,
|
||||
tmp.Information);
|
||||
|
@ -1399,8 +1386,8 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
|||
}
|
||||
#endif
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"GET %s tgt %d flags %x period %x off %x\n",
|
||||
mpt_prt(mpt,
|
||||
"GET %s tgt %d flags %x period %x off %x",
|
||||
IS_CURRENT_SETTINGS(cts)? "ACTIVE" :
|
||||
"NVRAM", tgt, dval, pval, oval);
|
||||
}
|
||||
|
@ -1492,8 +1479,8 @@ mpt_setwidth(mpt_softc_t *mpt, int tgt, int onoff)
|
|||
}
|
||||
mpt->mpt_dev_page1[tgt] = tmp;
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Target %d Page 1: RequestedParameters %x Config %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Target %d Page 1: RequestedParameters %x Config %x",
|
||||
tgt, mpt->mpt_dev_page1[tgt].RequestedParameters,
|
||||
mpt->mpt_dev_page1[tgt].Configuration);
|
||||
}
|
||||
|
@ -1520,17 +1507,8 @@ mpt_setsync(mpt_softc_t *mpt, int tgt, int period, int offset)
|
|||
*/
|
||||
if (period && offset) {
|
||||
int factor, offset, np;
|
||||
factor =
|
||||
(mpt->mpt_port_page0.Capabilities >> 8) & 0xff;
|
||||
offset =
|
||||
(mpt->mpt_port_page0.Capabilities >> 16) & 0xff;
|
||||
#if 0
|
||||
if ((mpt->mpt_port_page0.PhysicalInterface &
|
||||
MPI_SCSIPORTPAGE0_PHY_SIGNAL_TYPE_MASK) !=
|
||||
MPI_SCSIPORTPAGE0_PHY_SIGNAL_LVD && factor < 0xa) {
|
||||
factor = 0xa;
|
||||
}
|
||||
#endif
|
||||
factor = (mpt->mpt_port_page0.Capabilities >> 8) & 0xff;
|
||||
offset = (mpt->mpt_port_page0.Capabilities >> 16) & 0xff;
|
||||
np = 0;
|
||||
if (factor < 0x9) {
|
||||
np |= MPI_SCSIDEVPAGE1_RP_QAS;
|
||||
|
@ -1550,8 +1528,8 @@ mpt_setsync(mpt_softc_t *mpt, int tgt, int period, int offset)
|
|||
}
|
||||
mpt->mpt_dev_page1[tgt] = tmp;
|
||||
if (mpt->verbose > 1) {
|
||||
device_printf(mpt->dev,
|
||||
"SPI Target %d Page 1: RParams %x Config %x\n",
|
||||
mpt_prt(mpt,
|
||||
"SPI Target %d Page 1: RParams %x Config %x",
|
||||
tgt, mpt->mpt_dev_page1[tgt].RequestedParameters,
|
||||
mpt->mpt_dev_page1[tgt].Configuration);
|
||||
}
|
||||
|
|
|
@ -327,6 +327,7 @@ mpt_read(mpt_softc_t *mpt, int offset)
|
|||
void mpt_cam_attach(mpt_softc_t *);
|
||||
void mpt_cam_detach(mpt_softc_t *);
|
||||
void mpt_done(mpt_softc_t *, u_int32_t);
|
||||
void mpt_prt(mpt_softc_t *, const char *, ...);
|
||||
void mpt_set_config_regs(mpt_softc_t *);
|
||||
|
||||
#ifdef RELENG_4
|
||||
|
|
|
@ -126,8 +126,7 @@ mpt_intr(void *dummy)
|
|||
mpt_print_reply(MPT_REPLY_PTOV(mpt, reply));
|
||||
} else {
|
||||
/* Context reply ; all went well */
|
||||
device_printf(mpt->dev,
|
||||
"context %u reply OK\n", reply);
|
||||
mpt_prt(mpt, "context %u reply OK", reply);
|
||||
}
|
||||
}
|
||||
mpt_done(mpt, reply);
|
||||
|
@ -235,7 +234,7 @@ mpt_link_peer(mpt_softc_t *mpt)
|
|||
mpt->mpt2 = mpt2;
|
||||
mpt2->mpt2 = mpt;
|
||||
if (mpt->verbose) {
|
||||
device_printf(mpt->dev, "linking with peer (mpt%d)\n",
|
||||
mpt_prt(mpt, "linking with peer (mpt%d)",
|
||||
device_get_unit(mpt2->dev));
|
||||
}
|
||||
}
|
||||
|
@ -418,7 +417,7 @@ mpt_detach(device_t dev)
|
|||
mpt_softc_t *mpt;
|
||||
mpt = (mpt_softc_t*) device_get_softc(dev);
|
||||
|
||||
device_printf(mpt->dev,"mpt_detach!\n");
|
||||
mpt_prt(mpt, "mpt_detach");
|
||||
|
||||
if (mpt) {
|
||||
mpt_disable_ints(mpt);
|
||||
|
@ -671,7 +670,7 @@ mpt_set_config_regs(mpt_softc_t *mpt)
|
|||
#define MPT_CHECK(reg, offset, size) \
|
||||
val = pci_read_config(mpt->dev, offset, size); \
|
||||
if (mpt->pci_cfg.reg != val) { \
|
||||
device_printf(mpt->dev, \
|
||||
mpt_prt(mpt, \
|
||||
"Restoring " #reg " to 0x%X from 0x%X\n", \
|
||||
mpt->pci_cfg.reg, val); \
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue