From owner-p4-projects@FreeBSD.ORG Sun Oct 22 04:49:21 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8D44016A40F; Sun, 22 Oct 2006 04:49:21 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2117516A403 for ; Sun, 22 Oct 2006 04:49:21 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCFEB43D45 for ; Sun, 22 Oct 2006 04:49:20 +0000 (GMT) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9M4nKuj082566 for ; Sun, 22 Oct 2006 04:49:20 GMT (envelope-from mjacob@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9M4nKe9082563 for perforce@freebsd.org; Sun, 22 Oct 2006 04:49:20 GMT (envelope-from mjacob@freebsd.org) Date: Sun, 22 Oct 2006 04:49:20 GMT Message-Id: <200610220449.k9M4nKe9082563@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mjacob@freebsd.org using -f From: Matt Jacob To: Perforce Change Reviews Cc: Subject: PERFORCE change 108255 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2006 04:49:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=108255 Change 108255 by mjacob@newisp on 2006/10/22 04:48:28 Remove all of the 'intsok' goop. Since we can no longer know, at the sim level, when its okay to sleep, all mailbox commands have had to be polled commands now for some time anyway, so we might as well garbage collect this stuff. Affected files ... .. //depot/projects/newisp/dev/isp/isp_freebsd.c#15 edit .. //depot/projects/newisp/dev/isp/isp_freebsd.h#10 edit .. //depot/projects/newisp/dev/isp/isp_pci.c#15 edit .. //depot/projects/newisp/dev/isp/isp_sbus.c#7 edit Differences ... ==== //depot/projects/newisp/dev/isp/isp_freebsd.c#15 (text+ko) ==== @@ -661,9 +661,6 @@ ispsoftc_t *isp = arg; if (isp->isp_role != ISP_ROLE_NONE) { ISP_ENABLE_INTS(isp); -#if 0 - isp->isp_osinfo.intsok = 1; -#endif } /* Release our hook so that the boot can continue. */ config_intrhook_disestablish(&isp->isp_osinfo.ehook); @@ -2025,7 +2022,6 @@ XS_T *xs = arg; ispsoftc_t *isp = XS_ISP(xs); uint32_t handle; - int iok; /* * We've decided this command is dead. Make sure we're not trying @@ -2033,8 +2029,6 @@ * and seeing whether it's still alive. */ ISP_LOCK(isp); - iok = isp->isp_osinfo.intsok; - isp->isp_osinfo.intsok = 0; handle = isp_find_handle(isp, xs); if (handle) { uint32_t isr; @@ -2091,7 +2085,6 @@ } else { isp_prt(isp, ISP_LOGDEBUG2, "watchdog with no command"); } - isp->isp_osinfo.intsok = iok; ISP_UNLOCK(isp); } @@ -2106,7 +2099,6 @@ int s; s = splcam(); - isp->isp_osinfo.intsok = 1; #else #ifdef ISP_SMPLOCK mtx_lock(&isp->isp_lock); @@ -2342,13 +2334,10 @@ #ifdef ISP_TARGET_MODE case XPT_EN_LUN: /* Enable LUN as a target */ { - int seq, iok, i; + int seq, i; CAMLOCK_2_ISPLOCK(isp); - iok = isp->isp_osinfo.intsok; - isp->isp_osinfo.intsok = 0; seq = isp_en_lun(isp, ccb); if (seq < 0) { - isp->isp_osinfo.intsok = iok; ISPLOCK_2_CAMLOCK(isp); xpt_done(ccb); break; @@ -2361,7 +2350,6 @@ } DELAY(1000); } - isp->isp_osinfo.intsok = iok; ISPLOCK_2_CAMLOCK(isp); break; } ==== //depot/projects/newisp/dev/isp/isp_freebsd.h#10 (text+ko) ==== @@ -151,16 +151,14 @@ struct intr_config_hook ehook; uint16_t loop_down_time; uint16_t loop_down_limit; - uint32_t : 5, + uint32_t : 5, simqfrozen : 3, hysteresis : 8, - : 2, + : 4, disabled : 1, fcbsy : 1, mboxcmd_done : 1, - mboxbsy : 1, - mboxwaiting : 1, - intsok : 1; + mboxbsy : 1; #if __FreeBSD_version >= 500000 struct firmware * fw; struct mtx lock; @@ -222,12 +220,7 @@ #define MEMCPY memcpy #define SNPRINTF snprintf #define USEC_DELAY DELAY -#define USEC_SLEEP(isp, x) \ - if (isp->isp_osinfo.intsok) \ - ISP_UNLOCK(isp); \ - DELAY(x); \ - if (isp->isp_osinfo.intsok) \ - ISP_LOCK(isp) +#define USEC_SLEEP(isp, x) DELAY(x) #define NANOTIME_T struct timespec #define GET_NANOTIME nanotime @@ -254,12 +247,7 @@ #define MBOX_ACQUIRE isp_mbox_acquire #define MBOX_WAIT_COMPLETE isp_mbox_wait_complete -#define MBOX_NOTIFY_COMPLETE(isp) \ - if (isp->isp_osinfo.mboxwaiting) { \ - isp->isp_osinfo.mboxwaiting = 0; \ - wakeup(&isp->isp_mbxworkp); \ - } \ - isp->isp_osinfo.mboxcmd_done = 1 +#define MBOX_NOTIFY_COMPLETE(isp) isp->isp_osinfo.mboxcmd_done = 1 #define MBOX_RELEASE isp_mbox_release #define FC_SCRATCH_ACQUIRE(isp) \ @@ -481,6 +469,7 @@ if (isp->isp_osinfo.mboxbsy) { return (1); } else { + isp->isp_osinfo.mboxcmd_done = 0; isp->isp_osinfo.mboxbsy = 1; return (0); } @@ -490,6 +479,7 @@ isp_mbox_wait_complete(ispsoftc_t *isp, mbreg_t *mbp) { int lim = mbp->timeout; + int j; if (lim == 0) { lim = MBCMD_DEFAULT_TIMEOUT; @@ -497,49 +487,26 @@ if (isp->isp_mbxwrk0) { lim *= isp->isp_mbxwrk0; } - - isp->isp_osinfo.mboxcmd_done = 0; - if (isp->isp_osinfo.intsok) { - lim = (lim * 1000000) / hz; - isp->isp_osinfo.mboxwaiting = 1; -#ifdef ISP_SMPLOCK - (void) msleep(&isp->isp_mbxworkp, - &isp->isp_lock, PRIBIO, "isp_mboxwaiting", lim); -#else - (void) tsleep(&isp->isp_mbxworkp, - PRIBIO, "isp_mboxwaiting", lim); -#endif - isp->isp_osinfo.mboxwaiting = 0; - if (isp->isp_osinfo.mboxcmd_done == 0) { - isp_prt(isp, ISP_LOGWARN, - "Interrupting Mailbox Command (0x%x) Timeout", - isp->isp_lastmbxcmd); - mbp->param[0] = MBOX_TIMEOUT; + for (j = 0; j < lim; j += 100) { + uint32_t isr; + uint16_t sema, mbox; + if (isp->isp_osinfo.mboxcmd_done) { + break; } - } else { - int j; - - for (j = 0; j < lim; j += 100) { - uint32_t isr; - uint16_t sema, mbox; + if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) { + isp_intr(isp, isr, sema, mbox); if (isp->isp_osinfo.mboxcmd_done) { break; } - if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) { - isp_intr(isp, isr, sema, mbox); - if (isp->isp_mboxbsy == 0) { - break; - } - } - USEC_DELAY(100); } - if (isp->isp_osinfo.mboxcmd_done == 0) { - isp_prt(isp, ISP_LOGWARN, - "Polled Mailbox Command (0x%x) Timeout", - isp->isp_lastmbxcmd); - isp->isp_mboxbsy = 0; - mbp->param[0] = MBOX_TIMEOUT; - } + USEC_DELAY(100); + } + if (isp->isp_osinfo.mboxcmd_done == 0) { + isp_prt(isp, ISP_LOGWARN, + "Polled Mailbox Command (0x%x) Timeout", + isp->isp_lastmbxcmd); + isp->isp_mboxbsy = 0; + mbp->param[0] = MBOX_TIMEOUT; } } ==== //depot/projects/newisp/dev/isp/isp_pci.c#15 (text+ko) ==== @@ -1224,10 +1224,7 @@ if (ISP_READ_ISR(isp, &isr, &sema, &mbox) == 0) { isp->isp_intbogus++; } else { - int iok = isp->isp_osinfo.intsok; - isp->isp_osinfo.intsok = 0; isp_intr(isp, isr, sema, mbox); - isp->isp_osinfo.intsok = iok; } ISP_UNLOCK(isp); } ==== //depot/projects/newisp/dev/isp/isp_sbus.c#7 (text+ko) ==== @@ -63,7 +63,6 @@ static void isp_sbus_dmateardown(ispsoftc_t *, XS_T *, uint32_t); -static void isp_sbus_reset0(ispsoftc_t *); static void isp_sbus_reset1(ispsoftc_t *); static void isp_sbus_dumpregs(ispsoftc_t *, const char *); @@ -74,7 +73,7 @@ isp_sbus_mbxdma, isp_sbus_dmasetup, isp_sbus_dmateardown, - isp_sbus_reset0, + NULL, isp_sbus_reset1, isp_sbus_dumpregs, NULL, @@ -396,10 +395,7 @@ if (ISP_READ_ISR(isp, &isr, &sema, &mbox) == 0) { isp->isp_intbogus++; } else { - int iok = isp->isp_osinfo.intsok; - isp->isp_osinfo.intsok = 0; isp_intr(isp, isr, sema, mbox); - isp->isp_osinfo.intsok = iok; } ISP_UNLOCK(isp); } @@ -831,17 +827,9 @@ bus_dmamap_unload(sbs->dmat, *dp); } - -static void -isp_sbus_reset0(ispsoftc_t *isp) -{ - isp->isp_osinfo.intsok = 0; -} - static void isp_sbus_reset1(ispsoftc_t *isp) { -/* isp->isp_osinfo.intsok = 1; */ ISP_ENABLE_INTS(isp); }