From owner-p4-projects@FreeBSD.ORG Sat Dec 16 14:38:33 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 682F716A47B; Sat, 16 Dec 2006 14:38:33 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 139C316A407 for ; Sat, 16 Dec 2006 14:38:33 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id C613543CA3 for ; Sat, 16 Dec 2006 14:38:32 +0000 (GMT) (envelope-from jhb@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 kBGEcWgO089592 for ; Sat, 16 Dec 2006 14:38:32 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kBGEcVKB089589 for perforce@freebsd.org; Sat, 16 Dec 2006 14:38:31 GMT (envelope-from jhb@freebsd.org) Date: Sat, 16 Dec 2006 14:38:31 GMT Message-Id: <200612161438.kBGEcVKB089589@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 111794 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: Sat, 16 Dec 2006 14:38:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=111794 Change 111794 by jhb@jhb_zion on 2006/12/16 14:38:20 IFC @111791. Affected files ... .. //depot/projects/smpng/sys/arm/at91/at91_st.c#6 integrate .. //depot/projects/smpng/sys/arm/xscale/i80321/i80321_wdog.c#2 integrate .. //depot/projects/smpng/sys/dev/ata/ata-all.c#86 integrate .. //depot/projects/smpng/sys/dev/bge/if_bge.c#84 integrate .. //depot/projects/smpng/sys/dev/bge/if_bgereg.h#48 integrate .. //depot/projects/smpng/sys/dev/ichwd/ichwd.c#5 integrate .. //depot/projects/smpng/sys/dev/ipmi/ipmi.c#6 integrate .. //depot/projects/smpng/sys/dev/isp/isp.c#49 integrate .. //depot/projects/smpng/sys/dev/isp/isp_pci.c#45 integrate .. //depot/projects/smpng/sys/dev/isp/isp_sbus.c#19 integrate .. //depot/projects/smpng/sys/dev/mk48txx/mk48txx.c#7 integrate .. //depot/projects/smpng/sys/dev/mpt/mpt_cam.c#18 integrate .. //depot/projects/smpng/sys/dev/pci/pci.c#81 integrate .. //depot/projects/smpng/sys/dev/pci/pcivar.h#24 integrate .. //depot/projects/smpng/sys/dev/sound/pci/hda/hdac.c#4 integrate .. //depot/projects/smpng/sys/dev/watchdog/watchdog.c#4 integrate .. //depot/projects/smpng/sys/i386/i386/elan-mmcr.c#23 integrate .. //depot/projects/smpng/sys/kern/kern_clock.c#54 integrate .. //depot/projects/smpng/sys/kern/kern_condvar.c#44 integrate .. //depot/projects/smpng/sys/kern/kern_mutex.c#138 integrate .. //depot/projects/smpng/sys/kern/kern_synch.c#109 integrate .. //depot/projects/smpng/sys/kern/subr_sleepqueue.c#29 integrate .. //depot/projects/smpng/sys/kern/sysv_ipc.c#16 integrate .. //depot/projects/smpng/sys/kern/vfs_export.c#24 integrate .. //depot/projects/smpng/sys/netinet/libalias/alias.c#5 integrate .. //depot/projects/smpng/sys/netinet/libalias/alias_db.c#4 integrate .. //depot/projects/smpng/sys/netinet/libalias/alias_local.h#4 integrate .. //depot/projects/smpng/sys/netinet/libalias/alias_mod.c#2 integrate .. //depot/projects/smpng/sys/netinet/libalias/alias_proxy.c#4 integrate .. //depot/projects/smpng/sys/netinet/libalias/alias_util.c#5 integrate .. //depot/projects/smpng/sys/sun4v/include/trap.h#3 integrate .. //depot/projects/smpng/sys/sun4v/sun4v/exception.S#5 integrate .. //depot/projects/smpng/sys/sun4v/sun4v/pmap.c#8 integrate .. //depot/projects/smpng/sys/sun4v/sun4v/trap.c#6 integrate .. //depot/projects/smpng/sys/sun4v/sun4v/tte_hash.c#5 integrate .. //depot/projects/smpng/sys/sun4v/sun4v/vm_machdep.c#3 integrate .. //depot/projects/smpng/sys/sun4v/sun4v/wbuf.S#3 integrate .. //depot/projects/smpng/sys/sys/lock_profile.h#3 integrate .. //depot/projects/smpng/sys/sys/mutex.h#67 integrate .. //depot/projects/smpng/sys/sys/param.h#108 integrate .. //depot/projects/smpng/sys/sys/proc.h#175 integrate .. //depot/projects/smpng/sys/sys/sleepqueue.h#9 integrate .. //depot/projects/smpng/sys/sys/watchdog.h#4 integrate .. //depot/projects/smpng/sys/vm/vm_object.c#88 integrate Differences ... ==== //depot/projects/smpng/sys/arm/at91/at91_st.c#6 (text) ==== @@ -23,7 +23,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/at91/at91_st.c,v 1.5 2006/08/09 20:58:55 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/at91_st.c,v 1.6 2006/12/15 21:44:48 n_hibma Exp $"); #include #include @@ -170,10 +170,15 @@ uint32_t wdog; int t; - wdog = 0; t = cmd & WD_INTERVAL; - if (cmd != 0 && t >= 22 && t <= 37) + if (cmd > 0 && t >= 22 && t <= 37) { wdog = (1 << (t - 22)) | ST_WDMR_RSTEN; + *error = 0; + } else { + wdog = 0; + if (cmd > 0) + *error = EINVAL; + } WR4(ST_WDMR, wdog); WR4(ST_CR, ST_CR_WDRST); } ==== //depot/projects/smpng/sys/arm/xscale/i80321/i80321_wdog.c#2 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/i80321_wdog.c,v 1.2 2005/01/15 18:38:10 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/i80321_wdog.c,v 1.3 2006/12/15 21:44:48 n_hibma Exp $"); #include #include @@ -62,7 +62,6 @@ device_t dev; int armed; int wdog_period; - struct callout_handle wdog_callout; }; static __inline void @@ -83,8 +82,6 @@ return; wdtcr_write(WDTCR_ENABLE1); wdtcr_write(WDTCR_ENABLE2); - sc->wdog_callout = timeout(iopwdog_tickle, sc, - hz * (sc->wdog_period - 1)); } static int @@ -112,14 +109,21 @@ { struct iopwdog_softc *sc = private; - if (cmd == 0) - return; - if ((((uint64_t)1 << (cmd & WD_INTERVAL))) > - (uint64_t)sc->wdog_period * 1000000000) - return; - sc->armed = 1; - iopwdog_tickle(sc); - *error = 0; + cmd &= WD_INTERVAL; + if (cmd > 0 && cmd <= 63 + && (uint64_t)1 << (cmd & WD_INTERVAL) <= + (uint64_t)sc->wdog_period * 1000000000) { + /* Valid value -> Enable watchdog */ + iopwdog_tickle(sc); + sc->armed = 1; + *error = 0; + } else { + /* XXX Can't disable this watchdog? */ + if (sc->armed) + *error = EOPNOTSUPP; + else if (cmd > 0) + *error = EINVAL; + } } static int ==== //depot/projects/smpng/sys/dev/ata/ata-all.c#86 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.275 2006/11/17 11:13:47 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.276 2006/12/16 14:00:54 cognet Exp $"); #include "opt_ata.h" #include @@ -601,14 +601,12 @@ isprint(atadev->param.model[1]))) { struct ata_params *atacap = &atadev->param; char buffer[64]; -#ifndef __ARMEB__ int16_t *ptr; for (ptr = (int16_t *)atacap; ptr < (int16_t *)atacap + sizeof(struct ata_params)/2; ptr++) { *ptr = le16toh(*ptr); } -#endif if (!(!strncmp(atacap->model, "FX", 2) || !strncmp(atacap->model, "NEC", 3) || !strncmp(atacap->model, "Pioneer", 7) || ==== //depot/projects/smpng/sys/dev/bge/if_bge.c#84 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.163 2006/12/13 21:13:09 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.165 2006/12/15 00:27:06 jdp Exp $"); /* * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. @@ -114,6 +114,12 @@ #define BGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) #define ETHER_MIN_NOPAD (ETHER_MIN_LEN - ETHER_CRC_LEN) /* i.e., 60 */ +/* + * Disable the use of MSI until we sort out on which chip revisions support + * it properly. + */ +#define BGE_DISABLE_MSI 1 + MODULE_DEPEND(bge, pci, 1, 1, 1); MODULE_DEPEND(bge, ether, 1, 1, 1); MODULE_DEPEND(bge, miibus, 1, 1, 1); @@ -2113,7 +2119,7 @@ uint32_t hwcfg = 0; uint32_t mac_tmp = 0; u_char eaddr[6]; - int error = 0, rid, trys, reg; + int error = 0, msicount, rid, trys, reg; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2136,8 +2142,21 @@ sc->bge_btag = rman_get_bustag(sc->bge_res); sc->bge_bhandle = rman_get_bushandle(sc->bge_res); - /* Allocate interrupt. */ - rid = 0; + /* + * Allocate the interrupt, using MSI if possible. These devices + * support 8 MSI messages, but only the first one is used in + * normal operation. + */ + if ((msicount = pci_msi_count(dev)) > 1) + msicount = 1; +#ifdef BGE_DISABLE_MSI + msicount = 0; +#endif + if (msicount == 1 && pci_alloc_msi(dev, &msicount) == 0) { + rid = 1; + sc->bge_flags |= BGE_FLAG_MSI; + } else + rid = 0; sc->bge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); @@ -2492,7 +2511,11 @@ bus_teardown_intr(dev, sc->bge_irq, sc->bge_intrhand); if (sc->bge_irq != NULL) - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->bge_irq); + bus_release_resource(dev, SYS_RES_IRQ, + sc->bge_flags & BGE_FLAG_MSI ? 1 : 0, sc->bge_irq); + + if (sc->bge_flags & BGE_FLAG_MSI) + pci_release_msi(dev); if (sc->bge_res != NULL) bus_release_resource(dev, SYS_RES_MEMORY, ==== //depot/projects/smpng/sys/dev/bge/if_bgereg.h#48 (text+ko) ==== @@ -30,7 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.61 2006/12/12 05:11:12 scottl Exp $ + * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.62 2006/12/14 23:10:12 jdp Exp $ */ /* @@ -2477,6 +2477,7 @@ #define BGE_FLAG_5705_PLUS 0x00000200 #define BGE_FLAG_5714_FAMILY 0x00000400 #define BGE_FLAG_575X_PLUS 0x00000800 +#define BGE_FLAG_MSI 0x00001000 uint32_t bge_chipid; uint8_t bge_asicrev; uint8_t bge_chiprev; ==== //depot/projects/smpng/sys/dev/ichwd/ichwd.c#5 (text+ko) ==== @@ -54,7 +54,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ichwd/ichwd.c,v 1.6 2006/02/17 18:46:18 ambrisko Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ichwd/ichwd.c,v 1.7 2006/12/15 21:44:48 n_hibma Exp $"); #include #include @@ -178,38 +178,22 @@ struct ichwd_softc *sc = arg; unsigned int timeout; + /* convert from power-of-two-ns to WDT ticks */ + cmd &= WD_INTERVAL; + timeout = ((uint64_t)1 << cmd) / ICHWD_TICK; + if (cmd > 0 && cmd <= 63 + && timeout >= ICHWD_MIN_TIMEOUT && timeout <= ICHWD_MAX_TIMEOUT) { + if (timeout != sc->timeout) + ichwd_tmr_set(sc, timeout); - /* disable / enable */ - if (!(cmd & WD_ACTIVE)) { + ichwd_tmr_reload(sc); + *error = 0; + } else { if (sc->active) ichwd_tmr_disable(sc); - *error = 0; - return; - } - if (!sc->active) - ichwd_tmr_enable(sc); - - cmd &= WD_INTERVAL; - /* convert from power-of-to-ns to WDT ticks */ - if (cmd >= 64) { - *error = EINVAL; - return; + if (cmd > 0) + *error = EINVAL; } - timeout = ((uint64_t)1 << cmd) / ICHWD_TICK; - if (timeout < ICHWD_MIN_TIMEOUT || timeout > ICHWD_MAX_TIMEOUT) { - *error = EINVAL; - return; - } - - /* set new initial value */ - if (timeout != sc->timeout) - ichwd_tmr_set(sc, timeout); - - /* reload */ - ichwd_tmr_reload(sc); - - *error = 0; - return; } static unsigned int pmbase = 0; @@ -332,8 +316,6 @@ { struct ichwd_softc *sc; - device_printf(dev, "detaching\n"); - sc = device_get_softc(dev); /* halt the watchdog timer */ ==== //depot/projects/smpng/sys/dev/ipmi/ipmi.c#6 (text) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ipmi/ipmi.c,v 1.7 2006/12/06 15:10:11 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ipmi/ipmi.c,v 1.8 2006/12/15 21:44:48 n_hibma Exp $"); #include #include @@ -649,25 +649,16 @@ struct ipmi_softc *sc = arg; unsigned int timeout; - /* disable / enable */ - if (!(cmd & WD_ACTIVE)) { + cmd &= WD_INTERVAL; + if (cmd > 0 && cmd <= 63) { + timeout = ((uint64_t)1 << cmd) / 1800000000; + ipmi_set_watchdog(sc, timeout); + *error = 0; + } else { ipmi_set_watchdog(sc, 0); - *error = 0; - return; + if (cmd > 0) + *error = 0; } - - cmd &= WD_INTERVAL; - /* convert from power-of-to-ns to WDT ticks */ - if (cmd >= 64) { - *error = EINVAL; - return; - } - timeout = ((uint64_t)1 << cmd) / 1800000000; - - /* reload */ - ipmi_set_watchdog(sc, timeout); - - *error = 0; } #ifdef CLONING ==== //depot/projects/smpng/sys/dev/isp/isp.c#49 (text+ko) ==== @@ -43,7 +43,7 @@ #endif #ifdef __FreeBSD__ #include -__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.133 2006/12/05 07:50:23 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.134 2006/12/16 05:54:29 mjacob Exp $"); #include #endif #ifdef __OpenBSD__ @@ -524,6 +524,7 @@ } } if (val & BIU2400_DMA_ACTIVE) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "DMA Failed to Stop on Reset"); return; } @@ -544,6 +545,7 @@ } } if (val & BIU2400_SOFT_RESET) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "Failed to come out of reset"); return; } @@ -585,6 +587,7 @@ USEC_DELAY(100); if (--loops < 0) { ISP_DUMPREGS(isp, "chip reset timed out"); + ISP_RESET0(isp); return; } } @@ -626,6 +629,7 @@ } } if (val != 0) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "reset didn't clear"); return; } @@ -691,6 +695,7 @@ while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) { USEC_DELAY(100); if (--loops < 0) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "MBOX_BUSY never cleared on reset"); return; @@ -712,6 +717,7 @@ mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } @@ -728,11 +734,13 @@ mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } if (mbs.param[1] != 0xdead || mbs.param[2] != 0xbeef || mbs.param[3] != 0xffff || mbs.param[4] != 0x1111 || mbs.param[5] != 0xa5a5) { + ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "Register Test Failed (0x%x 0x%x 0x%x 0x%x 0x%x)", mbs.param[1], mbs.param[2], mbs.param[3], @@ -820,6 +828,7 @@ if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, "F/W Risc Ram Load Failed"); + ISP_RESET0(isp); return; } la += nw; @@ -881,6 +890,7 @@ if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, "F/W Risc Ram Load Failed"); + ISP_RESET0(isp); return; } la += nw; @@ -897,6 +907,7 @@ isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, dcrc); + ISP_RESET0(isp); return; } break; @@ -935,6 +946,7 @@ isp_prt(isp, ISP_LOGERR, "F/W download failed at word %d", isp->isp_mbxwrk1 - code_org); + ISP_RESET0(isp); return; } /* @@ -947,6 +959,7 @@ isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, dcrc); + ISP_RESET0(isp); return; } isp->isp_loaded_fw = 1; @@ -989,6 +1002,7 @@ isp_mboxcmd(isp, &mbs); if (IS_2322(isp) || IS_24XX(isp)) { if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } } @@ -1016,11 +1030,13 @@ mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } if (IS_24XX(isp) && mbs.param[1] == 0xdead) { isp_prt(isp, ISP_LOGERR, "f/w didn't *really* start"); + ISP_RESET0(isp); return; } @@ -1107,6 +1123,7 @@ mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); return; } if (isp->isp_maxcmds >= mbs.param[2]) { ==== //depot/projects/smpng/sys/dev/isp/isp_pci.c#45 (text+ko) ==== @@ -30,7 +30,7 @@ * FreeBSD Version. */ #include -__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.128 2006/12/10 03:41:48 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.129 2006/12/16 05:54:29 mjacob Exp $"); #include #include @@ -81,6 +81,7 @@ isp_pci_dmateardown(ispsoftc_t *, XS_T *, uint32_t); +static void isp_pci_reset0(ispsoftc_t *); static void isp_pci_reset1(ispsoftc_t *); static void isp_pci_dumpregs(ispsoftc_t *, const char *); @@ -91,7 +92,7 @@ isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs, NULL, @@ -105,7 +106,7 @@ isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs, NULL, @@ -119,7 +120,7 @@ isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs, NULL, @@ -133,7 +134,7 @@ isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs }; @@ -145,7 +146,7 @@ isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs }; @@ -157,7 +158,7 @@ isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, isp_pci_dumpregs }; @@ -169,7 +170,7 @@ isp_pci_mbxdma, isp_pci_dmasetup, isp_pci_dmateardown, - NULL, + isp_pci_reset0, isp_pci_reset1, NULL }; @@ -2882,6 +2883,12 @@ static void +isp_pci_reset0(ispsoftc_t *isp) +{ + ISP_DISABLE_INTS(isp); +} + +static void isp_pci_reset1(ispsoftc_t *isp) { if (!IS_24XX(isp)) { ==== //depot/projects/smpng/sys/dev/isp/isp_sbus.c#19 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/isp/isp_sbus.c,v 1.24 2006/12/10 03:41:48 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp_sbus.c,v 1.25 2006/12/16 05:54:29 mjacob Exp $"); #include #include @@ -63,6 +63,7 @@ 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 *); @@ -73,7 +74,7 @@ isp_sbus_mbxdma, isp_sbus_dmasetup, isp_sbus_dmateardown, - NULL, + isp_sbus_reset0, isp_sbus_reset1, isp_sbus_dumpregs, NULL, @@ -826,6 +827,12 @@ } static void +isp_sbus_reset0(ispsoftc_t *isp) +{ + ISP_DISABLE_INTS(isp); +} + +static void isp_sbus_reset1(ispsoftc_t *isp) { ISP_ENABLE_INTS(isp); ==== //depot/projects/smpng/sys/dev/mk48txx/mk48txx.c#7 (text+ko) ==== @@ -37,7 +37,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mk48txx/mk48txx.c,v 1.7 2006/09/01 20:14:06 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mk48txx/mk48txx.c,v 1.8 2006/12/15 21:44:49 n_hibma Exp $"); /* * Mostek MK48T02, MK48T08, MK48T18, MK48T59 time-of-day chip subroutines. @@ -297,7 +297,7 @@ wdog = 0; t = cmd & WD_INTERVAL; - if (cmd != 0 && t >= 26 && t <= 37) { + if (cmd > 0 && t >= 26 && t <= 37) { if (t <= WD_TO_2SEC) { wdog |= MK48TXX_WDOG_RB_1_16; t -= 26; @@ -317,6 +317,8 @@ if (sc->sc_flag & MK48TXX_WDOG_ENABLE_WDS) wdog |= MK48TXX_WDOG_WDS; *error = 0; + } else if (cmd > 0) { + *error = EINVAL; } mtx_lock(&sc->sc_mtx); (*sc->sc_nvwr)(dev, sc->sc_clkoffset + MK48TXX_WDOG, wdog); ==== //depot/projects/smpng/sys/dev/mpt/mpt_cam.c#18 (text+ko) ==== @@ -94,7 +94,7 @@ * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include -__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.46 2006/12/10 01:13:56 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.47 2006/12/16 07:39:55 mjacob Exp $"); #include #include @@ -110,6 +110,12 @@ #include #include +#if __FreeBSD_version >= 700000 +#ifndef CAM_NEW_TRAN_CODE +#define CAM_NEW_TRAN_CODE 1 +#endif +#endif + static void mpt_poll(struct cam_sim *); static timeout_t mpt_timeout; static void mpt_action(struct cam_sim *, union ccb *); @@ -2951,7 +2957,11 @@ break; } +#ifdef CAM_NEW_TRAN_CODE #define IS_CURRENT_SETTINGS(c) ((c)->type == CTS_TYPE_CURRENT_SETTINGS) +#else +#define IS_CURRENT_SETTINGS(c) ((c)->flags & CCB_TRANS_CURRENT_SETTINGS) +#endif #define DP_DISC_ENABLE 0x1 #define DP_DISC_DISABL 0x2 #define DP_DISC (DP_DISC_ENABLE|DP_DISC_DISABL) @@ -2968,8 +2978,10 @@ case XPT_SET_TRAN_SETTINGS: /* Nexus Settings */ { +#ifdef CAM_NEW_TRAN_CODE struct ccb_trans_settings_scsi *scsi; struct ccb_trans_settings_spi *spi; +#endif uint8_t dval; u_int period; u_int offset; @@ -2982,6 +2994,7 @@ break; } +#ifdef CAM_NEW_TRAN_CODE scsi = &cts->proto_specific.scsi; spi = &cts->xport_specific.spi; @@ -2992,6 +3005,7 @@ mpt_set_ccb_status(ccb, CAM_REQ_CMP); break; } +#endif /* * Skip attempting settings on RAID volume disks. @@ -3021,6 +3035,28 @@ period = 0; offset = 0; +#ifndef CAM_NEW_TRAN_CODE + if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) { + dval |= (cts->flags & CCB_TRANS_DISC_ENB) ? + DP_DISC_ENABLE : DP_DISC_DISABL; + } + + if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) { + dval |= (cts->flags & CCB_TRANS_TAG_ENB) ? + DP_TQING_ENABLE : DP_TQING_DISABL; + } + + if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) { + dval |= cts->bus_width ? DP_WIDE : DP_NARROW; + } + + if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) && + (cts->valid & CCB_TRANS_SYNC_OFFSET_VALID)) { + dval |= DP_SYNC; + period = cts->sync_period; + offset = cts->sync_offset; + } +#else if ((spi->valid & CTS_SPI_VALID_DISC) != 0) { dval |= ((spi->flags & CTS_SPI_FLAGS_DISC_ENB) != 0) ? DP_DISC_ENABLE : DP_DISC_DISABL; @@ -3056,6 +3092,7 @@ period &= MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK; period >>= MPI_SCSIDEVPAGE1_RP_SHIFT_MIN_SYNC_PERIOD; } +#endif CAMLOCK_2_MPTLOCK(mpt); if (dval & DP_DISC_ENABLE) { mpt->mpt_disc_enable |= (1 << tgt); @@ -3091,8 +3128,10 @@ } case XPT_GET_TRAN_SETTINGS: { +#ifdef CAM_NEW_TRAN_CODE + struct ccb_trans_settings_scsi *scsi; cts = &ccb->cts; - struct ccb_trans_settings_scsi *scsi; + cts->protocol = PROTO_SCSI; if (mpt->is_fc) { struct ccb_trans_settings_fc *fc = &cts->xport_specific.fc; @@ -3104,24 +3143,38 @@ } else if (mpt->is_sas) { struct ccb_trans_settings_sas *sas = &cts->xport_specific.sas; - cts->protocol_version = SCSI_REV_SPC2; cts->transport = XPORT_SAS; cts->transport_version = 0; sas->valid = CTS_SAS_VALID_SPEED; sas->bitrate = 300000; } else { + cts->protocol_version = SCSI_REV_2; + cts->transport = XPORT_SPI; + cts->transport_version = 2; if (mpt_get_spi_settings(mpt, cts) != 0) { mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR); - } else { - mpt_set_ccb_status(ccb, CAM_REQ_CMP); + break; } - break; } - cts->protocol = PROTO_SCSI; scsi = &cts->proto_specific.scsi; scsi->valid = CTS_SCSI_VALID_TQ; scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; +#else + cts = &ccb->cts; + if (mpt->is_fc) { + cts->flags = CCB_TRANS_TAG_ENB | CCB_TRANS_DISC_ENB; + cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; + cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT; + } else if (mpt->is_sas) { + cts->flags = CCB_TRANS_TAG_ENB | CCB_TRANS_DISC_ENB; + cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; + cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT; + } else if (mpt_get_spi_settings(mpt, cts) != 0) { + mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR); + break; + } +#endif mpt_set_ccb_status(ccb, CAM_REQ_CMP); break; } @@ -3296,18 +3349,15 @@ static int mpt_get_spi_settings(struct mpt_softc *mpt, struct ccb_trans_settings *cts) { +#ifdef CAM_NEW_TRAN_CODE struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi; +#endif target_id_t tgt; uint32_t dval, pval, oval; int rv; - cts->protocol = PROTO_SCSI; - cts->protocol_version = SCSI_REV_2; - cts->transport = XPORT_SPI; - cts->transport_version = 2; - - if (cts->type == CTS_TYPE_USER_SETTINGS) { + if (IS_CURRENT_SETTINGS(cts) == 0) { tgt = cts->ccb_h.target_id; } else if (xpt_path_sim(cts->ccb_h.path) == mpt->phydisk_sim) { if (mpt_map_physdisk(mpt, (union ccb *)cts, &tgt)) { @@ -3364,6 +3414,29 @@ pval = MPI_SCSIPORTPAGE0_CAP_GET_MIN_SYNC_PERIOD(pval); } +#ifndef CAM_NEW_TRAN_CODE + cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB); + cts->valid = 0; + cts->sync_period = pval; + cts->sync_offset = oval; + cts->valid |= CCB_TRANS_SYNC_RATE_VALID; + cts->valid |= CCB_TRANS_SYNC_OFFSET_VALID; + cts->valid |= CCB_TRANS_BUS_WIDTH_VALID; + if (dval & DP_WIDE) { + cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT; + } else { + cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT; + } + if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD) { + cts->valid |= CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; + if (dval & DP_DISC_ENABLE) { + cts->flags |= CCB_TRANS_DISC_ENB; + } + if (dval & DP_TQING_ENABLE) { + cts->flags |= CCB_TRANS_TAG_ENB; + } + } +#else spi->valid = 0; scsi->valid = 0; spi->flags = 0; @@ -3388,6 +3461,7 @@ spi->flags |= CTS_SPI_FLAGS_DISC_ENB; } } +#endif mpt_lprt(mpt, MPT_PRT_NEGOTIATION, "mpt_get_spi_settings[%d]: %s flags 0x%x per 0x%x off=%d\n", tgt, IS_CURRENT_SETTINGS(cts)? "ACTIVE" : "NVRAM ", dval, pval, oval); ==== //depot/projects/smpng/sys/dev/pci/pci.c#81 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.328 2006/12/14 16:53:48 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.330 2006/12/14 19:59:29 jhb Exp $"); #include "opt_bus.h" @@ -165,6 +165,7 @@ uint32_t devid; /* Vendor/device of the card */ int type; #define PCI_QUIRK_MAP_REG 1 /* PCI map register in weird place */ +#define PCI_QUIRK_DISABLE_MSI 2 /* MSI/MSI-X doesn't work */ int arg1; int arg2; }; @@ -176,6 +177,12 @@ /* As does the Serverworks OSB4 (the SMBus mapping register) */ { 0x02001166, PCI_QUIRK_MAP_REG, 0x90, 0 }, + /* + * MSI doesn't work with the Intel E7501 chipset, at least on + * the Tyan 2721 motherboard. + */ + { 0x254c8086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0 } }; @@ -224,6 +231,11 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_msix, CTLFLAG_RW, &pci_do_msix, 1, "Enable support for MSI-X interrupts"); +static int pci_honor_msi_blacklist = 1; +TUNABLE_INT("hw.pci.honor_msi_blacklist", &pci_honor_msi_blacklist); +SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RD, + &pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI"); + /* Find a device_t by bus/slot/function */ device_t @@ -1195,6 +1207,47 @@ } /* + * Returns true if the specified device is blacklisted because MSI + * doesn't work. + */ +int +pci_msi_device_blacklisted(device_t dev) +{ + struct pci_quirk *q; + + if (!pci_honor_msi_blacklist) + return (0); + + for (q = &pci_quirks[0]; q->devid; q++) { + if (q->devid == pci_get_devid(dev) && + q->type == PCI_QUIRK_DISABLE_MSI) + return (1); + } + return (0); +} + +/* + * Determine if MSI is blacklisted globally on this sytem. Currently, + * we just check for blacklisted chipsets as represented by the + * host-PCI bridge at device 0:0:0. In the future, it may become + * necessary to check other system attributes, such as the kenv values + * that give the motherboard manufacturer and model number. + */ +static int +pci_msi_blacklisted(void) +{ + device_t dev; + + if (!pci_honor_msi_blacklist) + return (0); + + dev = pci_find_bsf(0, 0, 0); + if (dev != NULL) + return (pci_msi_device_blacklisted(dev)); + return (0); +} + +/* * Attempt to allocate *count MSI messages. The actual number allocated is * returned in *count. After this function returns, each message will be * available to the driver as SYS_RES_IRQ resources starting at a rid 1. @@ -1217,6 +1270,10 @@ >>> TRUNCATED FOR MAIL (1000 lines) <<<