Various changes to allow for overriding just loopid and/or iid.

Fix a random 23XX ISR reading bug. Be chattier about HBA_BOTCH
errors. More f/w cashdump layering.
This commit is contained in:
mjacob 2002-08-12 21:33:39 +00:00
parent 6ca2d9ac81
commit 93ad4971f1
7 changed files with 92 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: isp.c,v 1.95 2002/06/15 00:16:26 mjacob Exp $ */
/* $NetBSD: isp.c,v 1.96 2002/08/12 21:33:39 mjacob Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.95 2002/06/15 00:16:26 mjacob Exp $");
__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.96 2002/08/12 21:33:39 mjacob Exp $");
#ifdef __NetBSD__
#include <dev/ic/isp_netbsd.h>
@ -2841,12 +2841,6 @@ isp_scan_fabric(struct ispsoftc *isp, int ftype)
}
FC_SCRATCH_RELEASE(isp);
/*
* XXX: Workaround for some bogus fabric registrants
*/
if (ftype) {
(void) isp_scan_fabric(isp, 0);
}
fcp->isp_loopstate = LOOP_FSCAN_DONE;
return (0);
}
@ -3919,9 +3913,20 @@ isp_parse_async(struct ispsoftc *isp, u_int16_t mbox)
isp_async(isp, ISPASYNC_BUS_RESET, &bus);
break;
case ASYNC_SYSTEM_ERROR:
#ifdef ISP_FW_CRASH_DUMP
/*
* If we have crash dumps enabled, it's up to the handler
* for isp_async to reinit stuff and restart the firmware
* after performing the crash dump. The reason we do things
* this way is that we may need to activate a kernel thread
* to do all the crash dump goop.
*/
isp_async(isp, ISPASYNC_FW_CRASH, NULL);
#else
isp_async(isp, ISPASYNC_FW_CRASH, NULL);
isp_reinit(isp);
isp_async(isp, ISPASYNC_FW_RESTARTED, NULL);
#endif
rval = -1;
break;
@ -5959,8 +5964,9 @@ isp_parse_nvram_1020(struct ispsoftc *isp, u_int8_t *nvram_data)
ISP_NVRAM_FIFO_THRESHOLD(nvram_data) |
(ISP_NVRAM_FIFO_THRESHOLD_128(nvram_data) << 2);
sdp->isp_initiator_id =
ISP_NVRAM_INITIATOR_ID(nvram_data);
if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
sdp->isp_initiator_id =
ISP_NVRAM_INITIATOR_ID(nvram_data);
sdp->isp_bus_reset_delay =
ISP_NVRAM_BUS_RESET_DELAY(nvram_data);
@ -6085,8 +6091,9 @@ isp_parse_nvram_1080(struct ispsoftc *isp, int bus, u_int8_t *nvram_data)
sdp->isp_fifo_threshold =
ISP1080_NVRAM_FIFO_THRESHOLD(nvram_data);
sdp->isp_initiator_id =
ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus);
if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
sdp->isp_initiator_id =
ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus);
sdp->isp_bus_reset_delay =
ISP1080_NVRAM_BUS_RESET_DELAY(nvram_data, bus);
@ -6176,8 +6183,9 @@ isp_parse_nvram_12160(struct ispsoftc *isp, int bus, u_int8_t *nvram_data)
sdp->isp_fifo_threshold =
ISP12160_NVRAM_FIFO_THRESHOLD(nvram_data);
sdp->isp_initiator_id =
ISP12160_NVRAM_INITIATOR_ID(nvram_data, bus);
if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
sdp->isp_initiator_id =
ISP12160_NVRAM_INITIATOR_ID(nvram_data, bus);
sdp->isp_bus_reset_delay =
ISP12160_NVRAM_BUS_RESET_DELAY(nvram_data, bus);
@ -6492,6 +6500,7 @@ isp2200_fw_dump(struct ispsoftc *isp)
*ptr++ = isp->isp_mboxtmp[2];
isp_prt(isp, ISP_LOGALL, "isp_fw_dump: SRAM dumped succesfully");
FCPARAM(isp)->isp_dump_data[0] = isp->isp_type; /* now used */
(void) isp_async(isp, ISPASYNC_FW_DUMPED, 0);
}
static void
@ -6654,6 +6663,7 @@ isp2300_fw_dump(struct ispsoftc *isp)
*ptr++ = mbs.param[2];
isp_prt(isp, ISP_LOGALL, "isp_fw_dump: SRAM dumped succesfully");
FCPARAM(isp)->isp_dump_data[0] = isp->isp_type; /* now used */
(void) isp_async(isp, ISPASYNC_FW_DUMPED, 0);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: isp_ioctl.h,v 1.4 2002/06/15 00:17:07 mjacob Exp $ */
/* $NetBSD: isp_ioctl.h,v 1.5 2002/08/12 21:33:40 mjacob Exp $ */
/*
* Copyright (c) 2001 by Matthew Jacob
*
@ -156,3 +156,26 @@ struct isp_hba_device {
#define ISP_TOPO_FPORT 4 /* F-port */
#define ISP_FC_GETHINFO _IOR(ISP_IOC, 12, struct isp_hba_device)
/*
* Set some internal parameters. This doesn't take effect until
* the chip is reset.
*
* Each parameter is generalized to be a name string with an integer value.
*
* Known parameters are:
*
* Name Value Range
*
* "framelength" 512,1024,2048
* "exec_throttle" 16..255
* "fullduplex" 0,1
* "loopid" 0..125
*/
struct isp_fc_param {
char param_name[16]; /* null terminated */
u_int32_t parameter;
};
#define ISP_GET_FC_PARAM _IOWR(ISP_IOC, 98, struct isp_fc_param)
#define ISP_SET_FC_PARAM _IOWR(ISP_IOC, 99, struct isp_fc_param)

View File

@ -1,4 +1,4 @@
/* $NetBSD: isp_netbsd.c,v 1.55 2002/06/15 00:20:18 mjacob Exp $ */
/* $NetBSD: isp_netbsd.c,v 1.56 2002/08/12 21:33:40 mjacob Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.55 2002/06/15 00:20:18 mjacob Exp $");
__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.56 2002/08/12 21:33:40 mjacob Exp $");
#include <dev/ic/isp_netbsd.h>
#include <sys/scsiio.h>
@ -404,6 +404,7 @@ ispcmd(struct ispsoftc *isp, XS_T *xs)
if (isp->isp_state != ISP_INITSTATE) {
ENABLE_INTS(isp);
ISP_UNLOCK(isp);
isp_prt(isp, ISP_LOGERR, "isp not at init state");
XS_SETERR(xs, HBA_BOTCH);
scsipi_done(xs);
return;
@ -622,6 +623,7 @@ isp_polled_cmd(struct ispsoftc *isp, XS_T *xs)
isp_reinit(isp);
}
if (XS_NOERR(xs)) {
isp_prt(isp, ISP_LOGERR, "polled command timed out");
XS_SETERR(xs, HBA_BOTCH);
}
}
@ -654,6 +656,10 @@ isp_done(XS_T *xs)
scsipi_channel_timed_thaw(&isp->isp_chanB);
}
}
if (xs->error == XS_DRIVER_STUFFUP) {
isp_prt(isp, ISP_LOGERR, "BOTCHED cmd for %d.%d.%d cmd 0x%x datalen %ld",
XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), XS_CDBP(xs)[0], (long) XS_XFRLEN(xs));
}
scsipi_done(xs);
}
}
@ -1100,7 +1106,17 @@ isp_async(struct ispsoftc *isp, ispasync_t cmd, void *arg)
isp_prt(isp, ISP_LOGERR,
"Internal Firmware Error on bus %d @ RISC Address 0x%x",
mbox6, mbox1);
#ifdef ISP_FW_CRASH_DUMP
if (IS_FC(isp)) {
if (isp->isp_osinfo.blocked == 0) {
isp->isp_osinfo.blocked = 1;
scsipi_channel_freeze(&isp->isp_chanA, 1);
}
isp_fw_dump(isp);
}
isp_reinit(isp);
isp_async(isp, ISPASYNC_FW_RESTART, NULL);
#endif
break;
}
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: isp_target.h,v 1.18 2002/05/17 18:49:43 mjacob Exp $ */
/* $NetBSD: isp_target.h,v 1.19 2002/08/12 21:33:40 mjacob Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@ -551,8 +551,8 @@ int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);
* Enable/Disable/Modify a logical unit.
* (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
*/
#define DFLT_CMND_CNT 32
#define DFLT_INOT_CNT 4
#define DFLT_CMND_CNT 0xfe /* unmonitored */
#define DFLT_INOT_CNT 16
int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ispmbox.h,v 1.41 2002/05/17 18:49:43 mjacob Exp $ */
/* $NetBSD: ispmbox.h,v 1.42 2002/08/12 21:33:40 mjacob Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@ -834,6 +834,7 @@ typedef struct {
#define FC4_IP 5 /* ISO/EEC 8802-2 LLC/SNAP "Out of Order Delivery" */
#define FC4_SCSI 8 /* SCSI-3 via Fivre Channel Protocol (FCP) */
#define FC4_FC_SVC 0x20 /* Fibre Channel Services */
#define SNS_GA_NXT 0x100
#define SNS_GPN_ID 0x112

View File

@ -1,4 +1,4 @@
/* $NetBSD: ispvar.h,v 1.56 2002/06/15 00:18:02 mjacob Exp $ */
/* $NetBSD: ispvar.h,v 1.57 2002/08/12 21:33:41 mjacob Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@ -758,6 +758,7 @@ typedef enum {
ISPASYNC_CONF_CHANGE, /* Platform Configuration Change */
ISPASYNC_UNHANDLED_RESPONSE, /* Unhandled Response Entry */
ISPASYNC_FW_CRASH, /* Firmware has crashed */
ISPASYNC_FW_DUMPED, /* Firmware crashdump taken */
ISPASYNC_FW_RESTARTED /* Firmware has been restarted */
} ispasync_t;
int isp_async(struct ispsoftc *, ispasync_t, void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: isp_pci.c,v 1.81 2002/06/15 00:11:36 mjacob Exp $ */
/* $NetBSD: isp_pci.c,v 1.82 2002/08/12 21:33:41 mjacob Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.81 2002/06/15 00:11:36 mjacob Exp $");
__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.82 2002/08/12 21:33:41 mjacob Exp $");
#include <dev/ic/isp_netbsd.h>
#include <dev/pci/pcireg.h>
@ -747,13 +747,25 @@ isp_pci_rd_isr_2300(struct ispsoftc *isp, u_int16_t *isrp,
case ISPR2HST_MBX_OK:
case ISPR2HST_MBX_FAIL:
case ISPR2HST_ASYNC_EVENT:
case ISPR2HST_RIO_16:
case ISPR2HST_FPOST:
case ISPR2HST_FPOST_CTIO:
*isrp = r2hisr & 0xffff;
*mbox0p = (r2hisr >> 16);
*semap = 1;
return (1);
case ISPR2HST_RIO_16:
*isrp = r2hisr & 0xffff;
*mbox0p = ASYNC_RIO1;
*semap = 1;
return (1);
case ISPR2HST_FPOST:
*isrp = r2hisr & 0xffff;
*mbox0p = ASYNC_CMD_CMPLT;
*semap = 1;
return (1);
case ISPR2HST_FPOST_CTIO:
*isrp = r2hisr & 0xffff;
*mbox0p = ASYNC_CTIO_DONE;
*semap = 1;
return (1);
case ISPR2HST_RSPQ_UPDATE:
*isrp = r2hisr & 0xffff;
*mbox0p = 0;
@ -1024,6 +1036,7 @@ isp_pci_dmasetup(struct ispsoftc *isp, struct scsipi_xfer *xs, ispreq_t *rq,
BUS_DMA_NOWAIT : BUS_DMA_WAITOK) | BUS_DMA_STREAMING |
((xs->xs_control & XS_CTL_DATA_IN) ? BUS_DMA_READ : BUS_DMA_WRITE));
if (error) {
isp_prt(isp, ISP_LOGWARN, "unable to load dma (%d)", error);
XS_SETERR(xs, HBA_BOTCH);
if (error == EAGAIN || error == ENOMEM)
return (CMD_EAGAIN);
@ -1071,7 +1084,7 @@ isp_pci_dmasetup(struct ispsoftc *isp, struct scsipi_xfer *xs, ispreq_t *rq,
onxti = nxti;
nxti = ISP_NXT_QENTRY(onxti, RQUEST_QUEUE_LEN(isp));
if (nxti == optr) {
isp_prt(isp, ISP_LOGDEBUG0, "Request Queue Overflow++");
isp_prt(isp, /* ISP_LOGDEBUG0 */ ISP_LOGERR, "Request Queue Overflow++");
bus_dmamap_unload(isp->isp_dmatag, dmap);
XS_SETERR(xs, HBA_BOTCH);
return (CMD_EAGAIN);