From 28f0575cf17d24c04f000178f634966a87c44903 Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Sat, 13 Sep 2003 01:55:44 +0000 Subject: [PATCH] On reset, make sure that we have some parameters set correctly. This fixes a longstanding issue WRT resetting the chip after startup- it would fail if we were connected as an F-port to a switch. If we were connected as an F-port, we got assigned a hard loop ID of 255, which is really a bogus loop id. Then when we turned around to reset ourselves, the firmware would reject the ICB_INIT request because the loop id was bogus. *sputter* Minor fixlet from somebody in NetBSD with too much time on their hands (dma -> DMA). --- sys/dev/isp/isp.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index e234e60c3af3..878b67c8d24f 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -1249,6 +1249,17 @@ isp_fibre_init(struct ispsoftc *isp) icbp->icb_retry_delay = fcp->isp_retry_delay; icbp->icb_retry_count = fcp->isp_retry_count; icbp->icb_hardaddr = loopid; + if (icbp->icb_hardaddr >= 125) { + /* + * We end up with a Loop ID of 255 for F-Port topologies + */ + if (icbp->icb_hardaddr != 255) { + isp_prt(isp, ISP_LOGERR, + "bad hard address %u- resetting to zero", + icbp->icb_hardaddr); + } + icbp->icb_hardaddr = 0; + } /* * Right now we just set extended options to prefer point-to-point * over loop based upon some soft config options. @@ -1371,7 +1382,13 @@ isp_fibre_init(struct ispsoftc *isp) icbp->icb_fwoptions &= ~(ICBOPT_BOTH_WWNS|ICBOPT_FULL_LOGIN); } icbp->icb_rqstqlen = RQUEST_QUEUE_LEN(isp); + if (icbp->icb_rqstqlen < 1) { + isp_prt(isp, ISP_LOGERR, "bad request queue length"); + } icbp->icb_rsltqlen = RESULT_QUEUE_LEN(isp); + if (icbp->icb_rsltqlen < 1) { + isp_prt(isp, ISP_LOGERR, "bad result queue length"); + } icbp->icb_rqstaddr[RQRSP_ADDR0015] = DMA_WD0(isp->isp_rquest_dma); icbp->icb_rqstaddr[RQRSP_ADDR1631] = DMA_WD1(isp->isp_rquest_dma); icbp->icb_rqstaddr[RQRSP_ADDR3247] = DMA_WD2(isp->isp_rquest_dma); @@ -3859,7 +3876,7 @@ again: } /* - * Free any dma resources. As a side effect, this may + * Free any DMA resources. As a side effect, this may * also do any cache flushing necessary for data coherence. */ if (XS_XFRLEN(xs)) { ISP_DMAFREE(isp, xs, sp->req_handle);