summaryrefslogtreecommitdiff
path: root/sys/dev/ic/mpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic/mpt.c')
-rw-r--r--sys/dev/ic/mpt.c425
1 files changed, 197 insertions, 228 deletions
diff --git a/sys/dev/ic/mpt.c b/sys/dev/ic/mpt.c
index 054af56fadc..1fa7631297f 100644
--- a/sys/dev/ic/mpt.c
+++ b/sys/dev/ic/mpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpt.c,v 1.21 2005/12/10 11:45:43 miod Exp $ */
+/* $OpenBSD: mpt.c,v 1.22 2006/02/04 19:05:00 marco Exp $ */
/* $NetBSD: mpt.c,v 1.4 2003/11/02 11:07:45 wiz Exp $ */
/*
@@ -46,9 +46,13 @@
#define MPT_MAX_TRIES 3
#define MPT_MAX_WAIT 300000
-static int maxwait_ack = 0;
-static int maxwait_int = 0;
-static int maxwait_state = 0;
+static int maxwait_ack = 0;
+static int maxwait_int = 0;
+static int maxwait_state = 0;
+
+#ifdef MPT_DEBUG
+int mpt_debug = 11;
+#endif /* MPT_DEBUG */
__inline u_int32_t mpt_rd_db(struct mpt_softc *);
__inline u_int32_t mpt_rd_intr(struct mpt_softc *);
@@ -157,9 +161,7 @@ mpt_wait_state(struct mpt_softc *mpt, enum DB_STATE_BITS state)
int
mpt_soft_reset(struct mpt_softc *mpt)
{
- if (mpt->verbose) {
- mpt_prt(mpt, "soft reset");
- }
+ DNPRINTF(10, "soft reset\n");
/* Have to use hard reset if we are not in Running state */
if (MPT_STATE(mpt_rd_db(mpt)) != MPT_DB_STATE_RUNNING) {
@@ -205,9 +207,7 @@ mpt_hard_reset(struct mpt_softc *mpt)
/* This extra read comes for the Linux source
* released by LSI. It's function is undocumented!
*/
- if (mpt->verbose) {
- mpt_prt(mpt, "hard reset");
- }
+ DNPRINTF(10, "hard reset\n");
mpt_read(mpt, MPT_OFFSET_FUBAR);
/* Enable diagnostic registers */
@@ -342,20 +342,20 @@ void
mpt_send_cmd(struct mpt_softc *mpt, struct req_entry *req)
{
req->sequence = mpt->sequence++;
- if (mpt->verbose > 1) {
- u_int32_t *pReq;
- pReq = req->req_vbuf;
- 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]);
- mpt_prt(mpt, "%08x %08x %08x %08x",
- pReq[4], pReq[5], pReq[6], pReq[7]);
- mpt_prt(mpt, "%08x %08x %08x %08x",
- pReq[8], pReq[9], pReq[10], pReq[11]);
- mpt_prt(mpt, "%08x %08x %08x %08x",
- pReq[12], pReq[13], pReq[14], pReq[15]);
- }
+ u_int32_t *pReq;
+
+ pReq = req->req_vbuf;
+ DNPRINTF(50, "%s: Send Request %d (0x%x):\n",
+ DEVNAME(mpt), req->index, req->req_pbuf);
+ DNPRINTF(50, "%s: %08x %08x %08x %08x\n",
+ DEVNAME(mpt), pReq[0], pReq[1], pReq[2], pReq[3]);
+ DNPRINTF(50, "%s: %08x %08x %08x %08x\n",
+ DEVNAME(mpt), pReq[4], pReq[5], pReq[6], pReq[7]);
+ DNPRINTF(50, "%s: %08x %08x %08x %08x\n",
+ DEVNAME(mpt), pReq[8], pReq[9], pReq[10], pReq[11]);
+ DNPRINTF(50, "%s: %08x %08x %08x %08x\n",
+ DEVNAME(mpt), pReq[12], pReq[13], pReq[14], pReq[15]);
+
MPT_SYNC_REQ(mpt, req, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
req->debug = REQ_ON_CHIP;
mpt_write(mpt, MPT_OFFSET_REQUEST_Q, (u_int32_t) req->req_pbuf);
@@ -397,7 +397,9 @@ mpt_send_handshake_cmd(struct mpt_softc *mpt, size_t len, void *cmd)
(MPT_STATE(data) != MPT_DB_STATE_FAULT)) ||
(MPT_DB_IS_IN_USE(data))) {
mpt_prt(mpt, "handshake aborted due to invalid doorbell state");
+#ifdef MPT_DEBUG
mpt_print_db(data);
+#endif /* MPT_DEBUG */
return(EBUSY);
}
@@ -473,12 +475,14 @@ mpt_recv_handshake_reply(struct mpt_softc *mpt, size_t reply_len, void *reply)
*data16++ = mpt_read(mpt, MPT_OFFSET_DOORBELL) & MPT_DB_DATA_MASK;
mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0);
+#ifdef MPT_DEBUG
/* With the second word, we can now look at the length */
- if (mpt->verbose > 1 && ((reply_len >> 1) != hdr->MsgLength)) {
- mpt_prt(mpt, "reply length does not match message length: "
- "got 0x%02x, expected 0x%02x",
- hdr->MsgLength << 2, reply_len << 1);
- }
+ if ((reply_len >> 1) != hdr->MsgLength)
+ /* XXX don't remove brackets! */
+ DNPRINTF(50, "%s: reply length does not match message length: "
+ "got 0x%02x, expected 0x%02x\n",
+ DEVNAME(mpt), hdr->MsgLength << 2, reply_len << 1);
+#endif /* MPT_DEBUG */
/* Get rest of the reply; but don't overflow the provided buffer */
left = (hdr->MsgLength << 1) - 2;
@@ -506,8 +510,10 @@ mpt_recv_handshake_reply(struct mpt_softc *mpt, size_t reply_len, void *reply)
mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0);
if ((hdr->IOCStatus & MPI_IOCSTATUS_MASK) != MPI_IOCSTATUS_SUCCESS) {
- if (mpt->verbose > 1)
+#ifdef MPT_DEBUG
+ if (mpt_debug > 50)
mpt_print_reply(hdr);
+#endif
return (MPT_FAIL | hdr->IOCStatus);
}
@@ -587,10 +593,9 @@ mpt_send_ioc_init(struct mpt_softc *mpt, u_int32_t who)
mpt->upload_fw = 1;
}
}
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "flags %d, upload_fw %d", init.Flags,
- mpt->upload_fw);
- }
+
+ DNPRINTF(10, "%s: flags %d, upload_fw %d\n", DEVNAME(mpt), init.Flags,
+ mpt->upload_fw);
if ((error = mpt_send_handshake_cmd(mpt, sizeof init, &init)) != 0) {
return(error);
@@ -831,7 +836,8 @@ mpt_write_cfg_page(struct mpt_softc *mpt, int PageAddress, CONFIG_PAGE_HEADER *h
void
mpt_print_header(struct mpt_softc *mpt, char *s, CONFIG_PAGE_HEADER *phdr)
{
- mpt_prt(mpt, "%s %x: %x %x %x %x",
+ DNPRINTF(10,"%s: %s %x: %x %x %x %x\n",
+ DEVNAME(mpt),
s,
phdr->PageNumber,
phdr->PageType,
@@ -863,10 +869,9 @@ mpt_read_config_info_mfg(struct mpt_softc *mpt)
mpt_prt(mpt, "Could not retrieve Manufacturing Page "
"%i Header.", i);
return (-1);
- } else if (mpt->verbose > 1) {
+ } else
mpt_print_header(mpt, "Manufacturing Header Page",
phdr[i]);
- }
/* retrieve MFG config pages using retrieved headers */
rv = mpt_read_cfg_page(mpt, i, phdr[i]);
@@ -877,8 +882,8 @@ mpt_read_config_info_mfg(struct mpt_softc *mpt)
}
}
- /* mpt->verbose = 2; */
- if (mpt->verbose > 1) {
+#ifdef MPT_DEBUG
+ if (mpt_debug > 10) {
mpt_prt(mpt, "Manufacturing Page 0 data: %s %s %s %s %s",
mpt->mpt_mfg_page0.ChipName,
mpt->mpt_mfg_page0.ChipRevision,
@@ -925,7 +930,7 @@ mpt_read_config_info_mfg(struct mpt_softc *mpt)
}
printf("\n");
}
- /* mpt->verbose = 1; */
+#endif /* MPT_DEBUG */
return (0);
}
@@ -953,9 +958,8 @@ mpt_read_config_info_iou(struct mpt_softc *mpt)
mpt_prt(mpt, "Could not retrieve IO Unit Page %i "
"header.", i);
return (-1);
- } else if (mpt->verbose > 1) {
+ } else
mpt_print_header(mpt, "IO Unit Header Page", phdr[i]);
- }
/* retrieve IO Unit config pages using retrieved headers */
rv = mpt_read_cfg_page(mpt, i, phdr[i]);
@@ -973,23 +977,20 @@ mpt_read_config_info_iou(struct mpt_softc *mpt)
}
}
- /* mpt->verbose = 2; */
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "IO Unit Page 0 data: %llx",
- mpt->mpt_iou_page0.UniqueValue);
-
- mpt_prt(mpt, "IO Unit Page 1 data: %x",
- mpt->mpt_iou_page1.Flags);
-
- mpt_prt(mpt, "IO Unit Page 2 data: %x %x %x %x %x %x",
- mpt->mpt_iou_page2.Flags,
- mpt->mpt_iou_page2.BiosVersion,
- mpt->mpt_iou_page2.AdapterOrder[0],
- mpt->mpt_iou_page2.AdapterOrder[1],
- mpt->mpt_iou_page2.AdapterOrder[2],
- mpt->mpt_iou_page2.AdapterOrder[3]);
- }
- /* mpt->verbose = 1; */
+ DNPRINTF(10, "%s: IO Unit Page 0 data: %llx\n",
+ DEVNAME(mpt),
+ mpt->mpt_iou_page0.UniqueValue);
+ DNPRINTF(10, "%s: IO Unit Page 1 data: %x\n",
+ DEVNAME(mpt),
+ mpt->mpt_iou_page1.Flags);
+ DNPRINTF(10, "%s: IO Unit Page 2 data: %x %x %x %x %x %x\n",
+ DEVNAME(mpt),
+ mpt->mpt_iou_page2.Flags,
+ mpt->mpt_iou_page2.BiosVersion,
+ mpt->mpt_iou_page2.AdapterOrder[0],
+ mpt->mpt_iou_page2.AdapterOrder[1],
+ mpt->mpt_iou_page2.AdapterOrder[2],
+ mpt->mpt_iou_page2.AdapterOrder[3]);
return (0);
}
@@ -1017,9 +1018,8 @@ mpt_read_config_info_ioc(struct mpt_softc *mpt)
mpt_prt(mpt, "Could not retrieve IOC Page %i header.",
i);
return (-1);
- } else if (mpt->verbose > 1) {
+ } else
mpt_print_header(mpt, "IOC Header Page", phdr[i]);
- }
/* retrieve IOC config pages using retrieved headers */
rv = mpt_read_cfg_page(mpt, i, phdr[i]);
@@ -1029,8 +1029,8 @@ mpt_read_config_info_ioc(struct mpt_softc *mpt)
}
}
- /* mpt->verbose = 2; */
- if (mpt->verbose > 1) {
+#ifdef MPT_DEBUG
+ if (mpt_debug > 10) {
mpt_prt(mpt, "IOC Page 0 data: %x %x %x %x %x %x %x %x",
mpt->mpt_ioc_page0.TotalNVStore,
mpt->mpt_ioc_page0.FreeNVStore,
@@ -1089,7 +1089,7 @@ mpt_read_config_info_ioc(struct mpt_softc *mpt)
mpt->mpt_ioc_page4.SEP[i].SEPBus);
}
}
- /* mpt->verbose = 1; */
+#endif /* MPT_DEBUG */
return (0);
}
@@ -1100,7 +1100,7 @@ mpt_read_config_info_ioc(struct mpt_softc *mpt)
int
mpt_read_config_info_raid(struct mpt_softc *mpt)
{
- int rv, i;
+ int rv;
/* retrieve raid volume headers */
rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_RAID_VOLUME, 0,
@@ -1108,10 +1108,9 @@ mpt_read_config_info_raid(struct mpt_softc *mpt)
if (rv) {
mpt_prt(mpt, "Could not retrieve RAID Volume Page 0 Header");
return (-1);
- } else if (mpt->verbose > 1) {
+ } else
mpt_print_header(mpt, "RAID Volume Header Page",
&mpt->mpt_raidvol_page0.Header);
- }
/* retrieve raid volume page using retrieved headers */
rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_raidvol_page0.Header);
@@ -1126,10 +1125,9 @@ mpt_read_config_info_raid(struct mpt_softc *mpt)
if (rv) {
mpt_prt(mpt, "Could not retrieve RAID Phys Disk Page 0 Header");
return (-1);
- } else if (mpt->verbose > 1) {
+ } else
mpt_print_header(mpt, "RAID Volume Physical Disk Page",
&mpt->mpt_raidphys_page0.Header);
- }
/* retrieve raid physical disk page using retrieved headers */
rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_raidphys_page0.Header);
@@ -1138,8 +1136,9 @@ mpt_read_config_info_raid(struct mpt_softc *mpt)
return (-1);
}
- /* mpt->verbose = 2; */
- if (mpt->verbose > 1) {
+#ifdef MPT_DEBUG
+ int i;
+ if (mpt_debug > 10) {
mpt_prt(mpt, "RAID Volume Page 0 data: %x %x %x %x %x"
"%x %x %x %x",
mpt->mpt_raidvol_page0.VolumeType,
@@ -1158,9 +1157,7 @@ mpt_read_config_info_raid(struct mpt_softc *mpt)
mpt->mpt_raidvol_page0.PhysDisk[i].PhysDiskMap);
}
printf("\n");
- }
- if (mpt->verbose > 1) {
mpt_prt(mpt, "RAID Phyical Disk Page 0 data: %x %x %x %x %x"
"%x %x %x",
mpt->mpt_raidphys_page0.PhysDiskNum,
@@ -1205,7 +1202,7 @@ mpt_read_config_info_raid(struct mpt_softc *mpt)
mpt->mpt_raidphys_page0.ErrorData.SmartCount
);
}
- /* mpt->verbose = 1; */
+#endif /* MPT_DEBUG */
return (0);
}
@@ -1220,43 +1217,39 @@ mpt_read_config_info_spi(struct mpt_softc *mpt)
rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_SCSI_PORT, 0,
0, &mpt->mpt_port_page0.Header);
- if (rv) {
+ if (rv)
return (-1);
- }
- if (mpt->verbose > 1) {
- 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,
- mpt->mpt_port_page0.Header.PageType);
- }
+
+ DNPRINTF(10, "%s: SPI Port Page 0 Header: %x %x %x %x\n",
+ DEVNAME(mpt),
+ mpt->mpt_port_page0.Header.PageVersion,
+ mpt->mpt_port_page0.Header.PageLength,
+ mpt->mpt_port_page0.Header.PageNumber,
+ mpt->mpt_port_page0.Header.PageType);
rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_SCSI_PORT, 1,
0, &mpt->mpt_port_page1.Header);
- if (rv) {
+ if (rv)
return (-1);
- }
- if (mpt->verbose > 1) {
- 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,
- mpt->mpt_port_page1.Header.PageType);
- }
+
+ DNPRINTF(10, "%s: SPI Port Page 1 Header: %x %x %x %x\n",
+ DEVNAME(mpt),
+ mpt->mpt_port_page1.Header.PageVersion,
+ mpt->mpt_port_page1.Header.PageLength,
+ mpt->mpt_port_page1.Header.PageNumber,
+ mpt->mpt_port_page1.Header.PageType);
rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_SCSI_PORT, 2,
0, &mpt->mpt_port_page2.Header);
- if (rv) {
+ if (rv)
return (-1);
- }
- if (mpt->verbose > 1) {
- 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,
- mpt->mpt_port_page1.Header.PageType);
- }
+ DNPRINTF(10, "%s: SPI Port Page 2 Header: %x %x %x %x\n",
+ DEVNAME(mpt),
+ mpt->mpt_port_page1.Header.PageVersion,
+ mpt->mpt_port_page1.Header.PageLength,
+ mpt->mpt_port_page1.Header.PageNumber,
+ mpt->mpt_port_page1.Header.PageType);
for (i = 0; i < 16; i++) {
rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_SCSI_DEVICE,
@@ -1264,28 +1257,26 @@ mpt_read_config_info_spi(struct mpt_softc *mpt)
if (rv) {
return (-1);
}
- if (mpt->verbose > 1) {
- 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,
- mpt->mpt_dev_page0[i].Header.PageType);
- }
+ DNPRINTF(10,
+ "%s: SPI Target %d Device Page 0 Header: %x %x %x %x\n",
+ DEVNAME(mpt),
+ i, mpt->mpt_dev_page0[i].Header.PageVersion,
+ mpt->mpt_dev_page0[i].Header.PageLength,
+ mpt->mpt_dev_page0[i].Header.PageNumber,
+ mpt->mpt_dev_page0[i].Header.PageType);
rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_SCSI_DEVICE,
1, i, &mpt->mpt_dev_page1[i].Header);
if (rv) {
return (-1);
}
- if (mpt->verbose > 1) {
- 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,
- mpt->mpt_dev_page1[i].Header.PageType);
- }
+ DNPRINTF(10,
+ "%s: SPI Target %d Device Page 1 Header: %x %x %x %x\n",
+ DEVNAME(mpt),
+ i, mpt->mpt_dev_page1[i].Header.PageVersion,
+ mpt->mpt_dev_page1[i].Header.PageLength,
+ mpt->mpt_dev_page1[i].Header.PageNumber,
+ mpt->mpt_dev_page1[i].Header.PageType);
}
/*
@@ -1297,38 +1288,39 @@ mpt_read_config_info_spi(struct mpt_softc *mpt)
rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_port_page0.Header);
if (rv) {
mpt_prt(mpt, "failed to read SPI Port Page 0");
- } else if (mpt->verbose > 1) {
- mpt_prt(mpt,
- "SPI Port Page 0: Capabilities %x PhysicalInterface %x",
+ } else
+ DNPRINTF(10,
+ "%s: SPI Port Page 0: Capabilities %x PhysicalInterface %x\n",
+ DEVNAME(mpt),
mpt->mpt_port_page0.Capabilities,
mpt->mpt_port_page0.PhysicalInterface);
- }
rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_port_page1.Header);
if (rv) {
mpt_prt(mpt, "failed to read SPI Port Page 1");
- } else if (mpt->verbose > 1) {
- mpt_prt(mpt,
- "SPI Port Page 1: Configuration %x OnBusTimerValue %x",
+ } else
+ DNPRINTF(10,
+ "%s: SPI Port Page 1: Configuration %x OnBusTimerValue %x\n",
+ DEVNAME(mpt),
mpt->mpt_port_page1.Configuration,
mpt->mpt_port_page1.OnBusTimerValue);
- }
rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_port_page2.Header);
if (rv) {
mpt_prt(mpt, "failed to read SPI Port Page 2");
- } else if (mpt->verbose > 1) {
- mpt_prt(mpt,
- "SPI Port Page 2: Flags %x Settings %x",
+ } else {
+ DNPRINTF(10,
+ "%s: SPI Port Page 2: Flags %x Settings %x\n",
+ DEVNAME(mpt),
mpt->mpt_port_page2.PortFlags,
mpt->mpt_port_page2.PortSettings);
- for (i = 0; i < 16; i++) {
- mpt_prt(mpt,
- "SPI Port Page 2 Tgt %d: timo %x SF %x Flags %x",
+ for (i = 0; i < 16; i++)
+ DNPRINTF(10,
+ "%s: SPI Port Page 2 Tgt %d: timo %x SF %x Flags %x\n",
+ DEVNAME(mpt),
i, mpt->mpt_port_page2.DeviceSettings[i].Timeout,
mpt->mpt_port_page2.DeviceSettings[i].SyncFactor,
mpt->mpt_port_page2.DeviceSettings[i].DeviceFlags);
- }
}
for (i = 0; i < 16; i++) {
@@ -1337,23 +1329,23 @@ mpt_read_config_info_spi(struct mpt_softc *mpt)
mpt_prt(mpt, "cannot read SPI Tgt %d Device Page 0", i);
continue;
}
- if (mpt->verbose > 1) {
- 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);
- }
+ DNPRINTF(10,
+ "%s: SPI Tgt %d Page 0: NParms %x Information %x\n",
+ DEVNAME(mpt),
+ 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) {
mpt_prt(mpt, "cannot read SPI Tgt %d Device Page 1", i);
continue;
}
- if (mpt->verbose > 1) {
- 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);
- }
+
+ DNPRINTF(10,
+ "%s: SPI Tgt %d Page 1: RParms %x Configuration %x\n",
+ DEVNAME(mpt),
+ i, mpt->mpt_dev_page1[i].RequestedParameters,
+ mpt->mpt_dev_page1[i].Configuration);
}
return (0);
}
@@ -1397,24 +1389,24 @@ mpt_set_initial_config_spi(struct mpt_softc *mpt)
tmp = mpt->mpt_dev_page1[i];
tmp.RequestedParameters = 0;
tmp.Configuration = 0;
- if (mpt->verbose > 1) {
- 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)) {
+ DNPRINTF(10,
+ "%s: Set Tgt %d SPI DevicePage 1 values to %x 0 %x\n",
+ DEVNAME(mpt),
+ i, tmp.RequestedParameters, tmp.Configuration);
+
+ if (mpt_write_cfg_page(mpt, i, &tmp.Header))
return (-1);
- }
- if (mpt_read_cfg_page(mpt, i, &tmp.Header)) {
+
+ if (mpt_read_cfg_page(mpt, i, &tmp.Header))
return (-1);
- }
+
mpt->mpt_dev_page1[i] = tmp;
- if (mpt->verbose > 1) {
- 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);
- }
+ DNPRINTF(10,
+ "%s: SPI Tgt %d Page 1: RParm %x Configuration %x\n",
+ DEVNAME(mpt),
+ i,
+ mpt->mpt_dev_page1[i].RequestedParameters,
+ mpt->mpt_dev_page1[i].Configuration);
}
return (0);
}
@@ -1439,9 +1431,8 @@ mpt_send_port_enable(struct mpt_softc *mpt, int port)
enable_req->PortNumber = port;
mpt_check_doorbell(mpt);
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "enabling port %d", port);
- }
+ DNPRINTF(10, "%s: enabling port %d\n", DEVNAME(mpt), port);
+
mpt_send_cmd(mpt, req);
count = 0;
@@ -1479,9 +1470,8 @@ mpt_send_event_request(struct mpt_softc *mpt, int onoff)
enable_req->Switch = onoff;
mpt_check_doorbell(mpt);
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "%sabling async events", onoff? "en" : "dis");
- }
+ DNPRINTF(10, "%s: %sabling async events\n",
+ DEVNAME(mpt), onoff? "en" : "dis");
mpt_send_cmd(mpt, req);
return (0);
@@ -1524,10 +1514,9 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
mpt_init_request(mpt, &mpt->request_pool[val]);
}
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "doorbell req = %s",
- mpt_ioc_diag(mpt_read(mpt, MPT_OFFSET_DOORBELL)));
- }
+ DNPRINTF(10, "%s: doorbell req = %s\n",
+ DEVNAME(mpt),
+ mpt_ioc_diag(mpt_read(mpt, MPT_OFFSET_DOORBELL)));
/*
* Start by making sure we're not at FAULT or RESET state
@@ -1565,12 +1554,12 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
continue;
}
- if (mpt->verbose > 1) {
- mpt_prt(mpt,
- "IOCFACTS: GlobalCredits=%d BlockSize=%u "
- "Request Frame Size %u", facts.GlobalCredits,
- facts.BlockSize, facts.RequestFrameSize);
- }
+ DNPRINTF(10,
+ "%s: IOCFACTS: GlobalCredits=%d BlockSize=%u "
+ "Request Frame Size %u\n",
+ DEVNAME(mpt), facts.GlobalCredits,
+ facts.BlockSize, facts.RequestFrameSize);
+
mpt->mpt_global_credits = facts.GlobalCredits;
mpt->request_frame_size = facts.RequestFrameSize;
@@ -1585,12 +1574,11 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
continue;
}
- if (mpt->verbose > 1) {
- mpt_prt(mpt,
- "PORTFACTS: Type %x PFlags %x IID %d MaxDev %d",
- pfp.PortType, pfp.ProtocolFlags, pfp.PortSCSIID,
- pfp.MaxDevices);
- }
+ DNPRINTF(10,
+ "%s: PORTFACTS: Type %x PFlags %x IID %d MaxDev %d\n",
+ DEVNAME(mpt),
+ pfp.PortType, pfp.ProtocolFlags, pfp.PortSCSIID,
+ pfp.MaxDevices);
if (pfp.PortType != MPI_PORTFACTS_PORTTYPE_SCSI &&
pfp.PortType != MPI_PORTFACTS_PORTTYPE_FC) {
@@ -1614,17 +1602,14 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
continue;
}
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "mpt_send_ioc_init ok");
- }
+ DNPRINTF(10, "%s: mpt_send_ioc_init ok\n", DEVNAME(mpt));
if (mpt_wait_state(mpt, MPT_DB_STATE_RUNNING) != MPT_OK) {
mpt_prt(mpt, "IOC failed to go to run state");
continue;
}
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "IOC now at RUNSTATE");
- }
+
+ DNPRINTF(10, "%s: IOC now at RUNSTATE\n", DEVNAME(mpt));
/*
* Give it reply buffers
@@ -1641,21 +1626,16 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
/* XXX MU correct place the call to fw_upload? */
if (mpt->upload_fw) {
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "firmware upload required.");
- }
+ DNPRINTF(10, "%s: firmware upload required\n",
+ DEVNAME(mpt));
- if (mpt_do_upload(mpt)) {
+ if (mpt_do_upload(mpt))
/* XXX MP should we panic? */
- mpt_prt(mpt, "firmware upload failure!");
- }
- /* continue; */
- }
- else {
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "firmware upload not required.");
- }
+ mpt_prt(mpt, "firmware upload failure");
}
+ else
+ DNPRINTF(10, "%sfirmware upload not required\n",
+ DEVNAME(mpt));
/*
* Enable asynchronous event reporting
@@ -1669,12 +1649,11 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
*/
if (mpt->is_fc == 0) {
- if (mpt_read_config_info_spi(mpt)) {
+ if (mpt_read_config_info_spi(mpt))
return (EIO);
- }
- if (mpt_set_initial_config_spi(mpt)) {
+
+ if (mpt_set_initial_config_spi(mpt))
return (EIO);
- }
}
/*
@@ -1689,11 +1668,9 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
* if the vmware flag is set skip page retrival since it does
* not support all of them.
*/
- if (mpt->vmware) {
- if (mpt->verbose > 1)
- mpt_prt(mpt, "running in vmware, skipping page"
- "retrieval");
- }
+ if (mpt->vmware)
+ DNPRINTF(10, "%s: running in vmware, skipping page "
+ "retrieval\n", DEVNAME(mpt));
else {
/*
* Read manufacturing pages
@@ -1736,9 +1713,7 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
continue;
}
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "enabled port 0");
- }
+ DNPRINTF(10, "%s: enabled port 0\n", DEVNAME(mpt));
/* Everything worked */
break;
@@ -1749,9 +1724,7 @@ mpt_init(struct mpt_softc *mpt, u_int32_t who)
return (EIO);
}
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "enabling interrupts");
- }
+ DNPRINTF(10, "%s: enabling interrupts\n", DEVNAME(mpt));
mpt_enable_ints(mpt);
return (0);
@@ -1822,10 +1795,8 @@ mpt_do_upload(struct mpt_softc *mpt)
flags = MPI_SGE_FLAGS_SIMPLE_ELEMENT;
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "assembling SG list (%d entries)",
- mpt->fw_dmap->dm_nsegs);
- }
+ DNPRINTF(20, "%s: assembling SG list (%d entries)\n",
+ DEVNAME(mpt), mpt->fw_dmap->dm_nsegs);
for (i = 0; i < mpt->fw_dmap->dm_nsegs; i++, se++) {
if (i == mpt->fw_dmap->dm_nsegs - 1) {
@@ -1841,8 +1812,8 @@ mpt_do_upload(struct mpt_softc *mpt)
sgeoffset += sizeof(*se);
}
- mpt_prt(mpt, "sending FW Upload request to IOC (size: %d, "
- "img size: %d)", sgeoffset, mpt->fw_image_size);
+ DNPRINTF(10, "%s: sending FW Upload request to IOC (size: %d, "
+ "img size: %d)\n", DEVNAME(mpt), sgeoffset, mpt->fw_image_size);
if ((error = mpt_send_handshake_cmd(mpt, sgeoffset, prequest)) != 0) {
return(error);
@@ -1858,18 +1829,16 @@ mpt_do_upload(struct mpt_softc *mpt)
int status, transfer_sz;
status = preply->IOCStatus;
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "fw_upload reply status %d", status);
- }
+ DNPRINTF(20, "%s: fw_upload reply status %d\n",
+ DEVNAME(mpt), status);
if (status == MPI_IOCSTATUS_SUCCESS) {
transfer_sz = preply->ActualImageSize;
if (transfer_sz != mpt->fw_image_size)
error = EFAULT;
- }
- else {
- error = EFAULT;
- }
+ }
+ else
+ error = EFAULT;
}
if (error == 0) {
@@ -1895,7 +1864,7 @@ mpt_downloadboot(struct mpt_softc *mpt)
MpiExtImageHeader_t *exthdr = NULL;
int fw_size;
u_int32_t diag0;
-#if MPT_DEBUG
+#ifdef MPT_DEBUG
u_int32_t diag1;
#endif
int count = 0;