From owner-freebsd-scsi@FreeBSD.ORG Fri Oct 3 19:20:10 2008 Return-Path: Delivered-To: freebsd-scsi@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 151D91065699 for ; Fri, 3 Oct 2008 19:20:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8E21D8FC0C for ; Fri, 3 Oct 2008 19:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m93JK9YQ008180 for ; Fri, 3 Oct 2008 19:20:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m93JK9L5008179; Fri, 3 Oct 2008 19:20:09 GMT (envelope-from gnats) Date: Fri, 3 Oct 2008 19:20:09 GMT Message-Id: <200810031920.m93JK9L5008179@freefall.freebsd.org> To: freebsd-scsi@FreeBSD.org From: Alexander Sack Cc: Subject: Re: kern/126866: [isp] [panic] kernel panic on card initialization X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alexander Sack List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Oct 2008 19:20:10 -0000 The following reply was made to PR kern/126866; it has been noted by GNATS. From: Alexander Sack To: bug-followup@FreeBSD.org, westr@connection.ca Cc: Subject: Re: kern/126866: [isp] [panic] kernel panic on card initialization Date: Fri, 3 Oct 2008 14:39:14 -0400 --Apple-Mail-13--61181355 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit The main problem is if you issue a firmware MAILBOX command before you quiesce the ISP then you will wound up handling async events to early at attach time. I've moved checking for the reset signature further down the isp_reset() path as well as remove checking OUTMAILBOX3 (OUTMAILBOX3 is really isp->isp_type (but its a string), if you see the 'ISP' characters in OUTMAILBOX1 and 2 then we assume the soft reset sequence worked and we can move on). Note the ABOUT FIRMWARE command seems to fail on ISP24xx after a reset until the EXEC occurs. We might want to rehash this sequence at some point but for now, we either load via dodnld or we don't via loader.conf parameter., i.e. we are still not checking which firmware is newer the one on the card or the one shipped with the driver. I also removed putting the ISP24xx into PAUSE mode - I don't see the reason for this since we only touch SXP and FPM/FBM registers for non- ISP24xx cards. Note I have another patch to fix some firmware related issues as well which I will coordinate with this fix... -aps --Apple-Mail-13--61181355 Content-Disposition: attachment; filename=isp.c.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="isp.c.patch" Content-Transfer-Encoding: 7bit --- isp.c Tue Sep 30 18:09:42 2008 +++ isp.c.fix Fri Oct 3 14:27:48 2008 @@ -171,60 +171,6 @@ isp->isp_state = ISP_NILSTATE; - /* - * Basic types (SCSI, FibreChannel and PCI or SBus) - * have been set in the MD code. We figure out more - * here. Possibly more refined types based upon PCI - * identification. Chip revision has been gathered. - * - * After we've fired this chip up, zero out the conf1 register - * for SCSI adapters and do other settings for the 2100. - */ - - /* - * Get the current running firmware revision out of the - * chip before we hit it over the head (if this is our - * first time through). Note that we store this as the - * 'ROM' firmware revision- which it may not be. In any - * case, we don't really use this yet, but we may in - * the future. - */ - if (isp->isp_touched == 0) { - /* - * First see whether or not we're sitting in the ISP PROM. - * If we've just been reset, we'll have the string "ISP " - * spread through outgoing mailbox registers 1-3. We do - * this for PCI cards because otherwise we really don't - * know what state the card is in and we could hang if - * we try this command otherwise. - * - * For SBus cards, we just do this because they almost - * certainly will be running firmware by now. - */ - if (ISP_READ(isp, OUTMAILBOX1) != 0x4953 || - ISP_READ(isp, OUTMAILBOX2) != 0x5020 || - ISP_READ(isp, OUTMAILBOX3) != 0x2020) { - /* - * Just in case it was paused... - */ - if (IS_24XX(isp)) { - ISP_WRITE(isp, BIU2400_HCCR, - HCCR_2400_CMD_RELEASE); - } else { - ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE); - } - MEMZERO(&mbs, sizeof (mbs)); - mbs.param[0] = MBOX_ABOUT_FIRMWARE; - mbs.logval = MBLOGNONE; - isp_mboxcmd(isp, &mbs); - if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { - isp->isp_romfw_rev[0] = mbs.param[1]; - isp->isp_romfw_rev[1] = mbs.param[2]; - isp->isp_romfw_rev[2] = mbs.param[3]; - } - } - isp->isp_touched = 1; - } ISP_DISABLE_INTS(isp); @@ -279,13 +225,13 @@ } /* - * Put the board into PAUSE mode (so we can read the SXP registers + * XXX: For 23xx and earlier, put the board into + * PAUSE mode (so we can read the SXP registers * or write FPM/FBM registers). */ if (IS_24XX(isp)) { ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_HOST_INT); ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RISC_INT); - ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_PAUSE); } else { ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE); } @@ -675,6 +621,61 @@ ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE); } + /* + * Basic types (SCSI, FibreChannel and PCI or SBus) + * have been set in the MD code. We figure out more + * here. Possibly more refined types based upon PCI + * identification. Chip revision has been gathered. + * + * After we've fired this chip up, zero out the conf1 register + * for SCSI adapters and do other settings for the 2100. + */ + + /* + * Get the current running firmware revision out of the + * chip before we hit it over the head (if this is our + * first time through). Note that we store this as the + * 'ROM' firmware revision- which it may not be. In any + * case, we don't really use this yet, but we may in + * the future. + */ + if (isp->isp_touched == 0) { + /* + * First see whether or not we're sitting in the ISP PROM. + * If we've just been reset, we'll have the string "ISP " + * spread through outgoing mailbox registers 1-3. We do + * this for PCI cards because otherwise we really don't + * know what state the card is in and we could hang if + * we try this command otherwise. + * + * For SBus cards, we just do this because they almost + * certainly will be running firmware by now. + */ + if (ISP_READ(isp, OUTMAILBOX1) != 0x4953 || + ISP_READ(isp, OUTMAILBOX2) != 0x5020) { + isp_prt(isp, ISP_LOGERR, "reset signature was invalid, RISC maybe paused"); + /* + * Just in case it was paused... + */ + if (IS_24XX(isp)) { + ISP_WRITE(isp, BIU2400_HCCR, + HCCR_2400_CMD_RELEASE); + } else { + ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE); + MEMZERO(&mbs, sizeof (mbs)); + mbs.param[0] = MBOX_ABOUT_FIRMWARE; + mbs.logval = MBLOGNONE; + isp_mboxcmd(isp, &mbs); + if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { + isp->isp_romfw_rev[0] = mbs.param[1]; + isp->isp_romfw_rev[1] = mbs.param[2]; + isp->isp_romfw_rev[2] = mbs.param[3]; + } + } + } + isp->isp_touched = 1; + } + ISP_WRITE(isp, isp->isp_rqstinrp, 0); ISP_WRITE(isp, isp->isp_rqstoutrp, 0); ISP_WRITE(isp, isp->isp_respinrp, 0); @@ -738,6 +739,7 @@ mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + isp_prt(isp, ISP_LOGERR, "Mailbox Register Test mailbox command failed to complete"); ISP_RESET0(isp); return; } @@ -1832,7 +1834,6 @@ mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - isp_prt(isp, ISP_LOGERR, "setting firmware options failed"); return; } @@ -2056,7 +2057,6 @@ isp_mboxcmd(isp, &mbs); FC_SCRATCH_RELEASE(isp); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - isp_prt(isp, ISP_LOGERR, "initialization of firmware fails"); return; } isp->isp_reqidx = 0; --Apple-Mail-13--61181355 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-13--61181355--