From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 02:46:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77D36106564A; Sun, 17 Jun 2012 02:46:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 614858FC0A; Sun, 17 Jun 2012 02:46:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H2kS4D079984; Sun, 17 Jun 2012 02:46:28 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H2kSMT079981; Sun, 17 Jun 2012 02:46:28 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206170246.q5H2kSMT079981@svn.freebsd.org> From: Eitan Adler Date: Sun, 17 Jun 2012 02:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237178 - in head: share/man/man4 sys/dev/hptrr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 02:46:28 -0000 Author: eadler Date: Sun Jun 17 02:46:27 2012 New Revision: 237178 URL: http://svn.freebsd.org/changeset/base/237178 Log: attach_generic causes missing devices in /dev when the driver interacts with some non-highpoint controollers. Change attach_generic to be off by default. PR: kern/168910 Submitted by: Richard Yao Approved by: cperciva No objections by: -hackers Obtained from: Gentoo FreeBSD MFC after: 2 weeks Modified: head/share/man/man4/hptrr.4 head/sys/dev/hptrr/hptrr_osm_bsd.c Modified: head/share/man/man4/hptrr.4 ============================================================================== --- head/share/man/man4/hptrr.4 Sun Jun 17 00:28:57 2012 (r237177) +++ head/share/man/man4/hptrr.4 Sun Jun 17 02:46:27 2012 (r237178) @@ -50,8 +50,8 @@ hptrr_load="YES" The following tunables are settable from the loader: .Bl -ohang .It Va hw.hptrr.attach_generic -set to 0 to deny driver attach to chips with generic Marvell (non-HighPoint) -PCI identification. These chips are also supported by ata(4). +set to 1 to permit driver attach to chips with generic Marvell (non-HighPoint) +PCI identification. These chips are also supported by ata(4) and mvs(4). Some vendors are using same chips, but without providing RAID BIOS. .El .Sh DESCRIPTION @@ -112,7 +112,8 @@ This driver supersedes the older rr232x .Xr ata 4 , .Xr cam 4 , .Xr hptmv 4 , -.Xr loader 8 +.Xr loader 8 , +.Xr mvs 4 .Sh HISTORY The .Nm Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- head/sys/dev/hptrr/hptrr_osm_bsd.c Sun Jun 17 00:28:57 2012 (r237177) +++ head/sys/dev/hptrr/hptrr_osm_bsd.c Sun Jun 17 02:46:27 2012 (r237178) @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int attach_generic = 1; +static int attach_generic = 0; TUNABLE_INT("hw.hptrr.attach_generic", &attach_generic); static int hpt_probe(device_t dev) From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 03:08:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DAE61106566B; Sun, 17 Jun 2012 03:08:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD2168FC08; Sun, 17 Jun 2012 03:08:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H38Y1j081014; Sun, 17 Jun 2012 03:08:34 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H38Ynh081012; Sun, 17 Jun 2012 03:08:34 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206170308.q5H38Ynh081012@svn.freebsd.org> From: Adrian Chadd Date: Sun, 17 Jun 2012 03:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237179 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 03:08:34 -0000 Author: adrian Date: Sun Jun 17 03:08:33 2012 New Revision: 237179 URL: http://svn.freebsd.org/changeset/base/237179 Log: After some discussion with bschmidt@, it's likely better to just go through ieee80211_suspend_all() and ieee80211_resume_all(). All the other wireless drivers are doing that particular dance. PR: kern/169084 Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sun Jun 17 02:46:27 2012 (r237178) +++ head/sys/dev/ath/if_ath.c Sun Jun 17 03:08:33 2012 (r237179) @@ -1309,15 +1309,8 @@ ath_suspend(struct ath_softc *sc) __func__, ifp->if_flags); sc->sc_resume_up = (ifp->if_flags & IFF_UP) != 0; - if (ic->ic_opmode == IEEE80211_M_STA) - /* - * This has been disabled - see PR kern/169084. - */ -#if 0 - ath_stop(ifp); - else -#endif - ieee80211_suspend_all(ic); + + ieee80211_suspend_all(ic); /* * NB: don't worry about putting the chip in low power * mode; pci will power off our socket on suspend and @@ -1383,34 +1376,8 @@ ath_resume(struct ath_softc *sc) ath_led_config(sc); ath_hal_setledstate(ah, HAL_LED_INIT); - if (sc->sc_resume_up) { - /* - * This particular feature doesn't work at the present, - * at least on the 802.11n chips. It's quite possible - * that the STA Beacon timers aren't being configured - * properly. - * - * See PR kern/169084. - */ -#if 0 - if (ic->ic_opmode == IEEE80211_M_STA) { - ath_init(sc); - ath_hal_setledstate(ah, HAL_LED_RUN); - /* - * Program the beacon registers using the last rx'd - * beacon frame and enable sync on the next beacon - * we see. This should handle the case where we - * wakeup and find the same AP and also the case where - * we wakeup and need to roam. For the latter we - * should get bmiss events that trigger a roam. - */ - ath_beacon_config(sc, NULL); - sc->sc_syncbeacon = 1; - ieee80211_resume_all(ic); - } else -#endif - ieee80211_resume_all(ic); - } + if (sc->sc_resume_up) + ieee80211_resume_all(ic); /* XXX beacons ? */ } From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 03:54:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D7871065673; Sun, 17 Jun 2012 03:54:11 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68EEF8FC0A; Sun, 17 Jun 2012 03:54:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H3sBBL083059; Sun, 17 Jun 2012 03:54:11 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H3sBBr083057; Sun, 17 Jun 2012 03:54:11 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206170354.q5H3sBBr083057@svn.freebsd.org> From: Eitan Adler Date: Sun, 17 Jun 2012 03:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237180 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 03:54:11 -0000 Author: eadler Date: Sun Jun 17 03:54:10 2012 New Revision: 237180 URL: http://svn.freebsd.org/changeset/base/237180 Log: Fix mdoc style nits PR: kern/168910 Submitted by: gjb Approved by: gjb MFC after: 3 days X-MFC-With: r237178 Modified: head/share/man/man4/hptrr.4 Modified: head/share/man/man4/hptrr.4 ============================================================================== --- head/share/man/man4/hptrr.4 Sun Jun 17 03:08:33 2012 (r237179) +++ head/share/man/man4/hptrr.4 Sun Jun 17 03:54:10 2012 (r237180) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2009 +.Dd June 6, 2012 .Dt HPTRR 4 .Os .Sh NAME @@ -51,7 +51,10 @@ The following tunables are settable from .Bl -ohang .It Va hw.hptrr.attach_generic set to 1 to permit driver attach to chips with generic Marvell (non-HighPoint) -PCI identification. These chips are also supported by ata(4) and mvs(4). +PCI identification. These chips are also supported by +.Xr ata 4 +and +.Xr mvs 4 . Some vendors are using same chips, but without providing RAID BIOS. .El .Sh DESCRIPTION @@ -112,8 +115,8 @@ This driver supersedes the older rr232x .Xr ata 4 , .Xr cam 4 , .Xr hptmv 4 , -.Xr loader 8 , -.Xr mvs 4 +.Xr mvs 4 , +.Xr loader 8 .Sh HISTORY The .Nm From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 04:48:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DF25106566B; Sun, 17 Jun 2012 04:48:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FDE98FC0C; Sun, 17 Jun 2012 04:48:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H4mlIa085415; Sun, 17 Jun 2012 04:48:47 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H4mlof085413; Sun, 17 Jun 2012 04:48:47 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206170448.q5H4mlof085413@svn.freebsd.org> From: Adrian Chadd Date: Sun, 17 Jun 2012 04:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237182 - head/sys/dev/ath/ath_hal/ar9002 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 04:48:48 -0000 Author: adrian Date: Sun Jun 17 04:48:47 2012 New Revision: 237182 URL: http://svn.freebsd.org/changeset/base/237182 Log: Bring over the AR9285 specific PCIe suspend/resume/ASPM workarounds. Obtained from: Qualcomm Atheros, Linux ath9k Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Sun Jun 17 03:59:17 2012 (r237181) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Sun Jun 17 04:48:47 2012 (r237182) @@ -367,18 +367,71 @@ bad: static void ar9285ConfigPCIE(struct ath_hal *ah, HAL_BOOL restore, HAL_BOOL power_off) { + uint32_t val; + if (AH_PRIVATE(ah)->ah_ispcie && !restore) { ath_hal_ini_write(ah, &AH5416(ah)->ah_ini_pcieserdes, 1, 0); OS_DELAY(1000); + } + + /* + * Set PCIe workaround bits + * + * NOTE: + * + * In Merlin and Kite, bit 14 in WA register (disable L1) should only + * be set when device enters D3 and be cleared when device comes back + * to D0. + */ + if (power_off) { /* Power-off */ + OS_REG_CLR_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); + + val = OS_REG_READ(ah, AR_WA); + + /* + * Disable bit 6 and 7 before entering D3 to prevent + * system hang. + */ + val &= ~(AR_WA_BIT6 | AR_WA_BIT7); + + /* + * See above: set AR_WA_D3_L1_DISABLE when entering D3 state. + * + * XXX The reference HAL does it this way - it only sets + * AR_WA_D3_L1_DISABLE if it's set in AR9280_WA_DEFAULT, + * which it (currently) isn't. So the following statement + * is currently a NOP. + */ + if (AR9285_WA_DEFAULT & AR_WA_D3_L1_DISABLE) + val |= AR_WA_D3_L1_DISABLE; + + if (AR_SREV_9285E_20(ah)) + val |= AR_WA_BIT23; + + OS_REG_WRITE(ah, AR_WA, val); + } else { /* Power-on */ + val = AR9285_WA_DEFAULT; + /* + * See note above: make sure L1_DISABLE is not set. + */ + val &= (~AR_WA_D3_L1_DISABLE); + + /* Software workaroud for ASPM system hang. */ + val |= (AR_WA_BIT6 | AR_WA_BIT7); + + if (AR_SREV_9285E_20(ah)) + val |= AR_WA_BIT23; + + OS_REG_WRITE(ah, AR_WA, val); + + /* set bit 19 to allow forcing of pcie core into L1 state */ OS_REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); - OS_REG_WRITE(ah, AR_WA, AR9285_WA_DEFAULT); } } static void ar9285DisablePCIE(struct ath_hal *ah) { - /* XXX TODO */ } static void From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 05:34:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 67AE11065774; Sun, 17 Jun 2012 05:34:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 568E28FC08; Sun, 17 Jun 2012 05:34:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H5Ygcq087317; Sun, 17 Jun 2012 05:34:42 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H5Ygi9087315; Sun, 17 Jun 2012 05:34:42 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206170534.q5H5Ygi9087315@svn.freebsd.org> From: Adrian Chadd Date: Sun, 17 Jun 2012 05:34:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237183 - head/sys/dev/ath/ath_hal/ar9002 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 05:34:42 -0000 Author: adrian Date: Sun Jun 17 05:34:41 2012 New Revision: 237183 URL: http://svn.freebsd.org/changeset/base/237183 Log: Add an disabled workaround for the AR9285SE. This just requires a little HAL change (add a new config parameter) and some glue in if_ath_pci.c, however I'm leaving this up for someone else to do. Obtained from: Qualcomm Atheros Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Sun Jun 17 04:48:47 2012 (r237182) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Sun Jun 17 05:34:41 2012 (r237183) @@ -369,6 +369,25 @@ ar9285ConfigPCIE(struct ath_hal *ah, HAL { uint32_t val; + /* + * This workaround needs some integration work with the HAL + * config parameters and the if_ath_pci.c glue. + * Specifically, read the value of the PCI register 0x70c + * (4 byte PCI config space register) and store it in ath_hal_war70c. + * Then if it's non-zero, the below WAR would override register + * 0x570c upon suspend/resume. + */ +#if 0 + if (AR_SREV_9285E_20(ah)) { + val = AH_PRIVATE(ah)->ah_config.ath_hal_war70c; + if (val) { + val &= 0xffff00ff; + val |= 0x6f00; + OS_REG_WRITE(ah, 0x570c, val); + } + } +#endif + if (AH_PRIVATE(ah)->ah_ispcie && !restore) { ath_hal_ini_write(ah, &AH5416(ah)->ah_ini_pcieserdes, 1, 0); OS_DELAY(1000); From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 05:56:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 85065106564A; Sun, 17 Jun 2012 05:56:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F8C18FC17; Sun, 17 Jun 2012 05:56:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H5uSpo088220; Sun, 17 Jun 2012 05:56:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H5uRjN088217; Sun, 17 Jun 2012 05:56:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206170556.q5H5uRjN088217@svn.freebsd.org> From: Adrian Chadd Date: Sun, 17 Jun 2012 05:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237184 - in head/sys/dev/ath/ath_hal: . ar9002 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 05:56:28 -0000 Author: adrian Date: Sun Jun 17 05:56:27 2012 New Revision: 237184 URL: http://svn.freebsd.org/changeset/base/237184 Log: AR9287 tidyups: * Add an OS_A_REG_WRITE() routine - analog writes require a 100usec delay on AR9280 and later, so create a method to do it. * Use it for the AR9287 analog writes. * Re-indent and style(9) the code. Modified: head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Sun Jun 17 05:34:41 2012 (r237183) +++ head/sys/dev/ath/ath_hal/ah_internal.h Sun Jun 17 05:56:27 2012 (r237184) @@ -484,6 +484,8 @@ isBigEndian(void) /* Analog register writes may require a delay between each one (eg Merlin?) */ #define OS_A_REG_RMW_FIELD(_a, _r, _f, _v) \ do { OS_REG_WRITE(_a, _r, (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f))) ; OS_DELAY(100); } while (0) +#define OS_A_REG_WRITE(_a, _r, _v) \ + do { OS_REG_WRITE(_a, _r, _v); OS_DELAY(100); } while (0) /* wait for the register contents to have the specified value */ extern HAL_BOOL ath_hal_wait(struct ath_hal *, u_int reg, Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c Sun Jun 17 05:34:41 2012 (r237183) +++ head/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c Sun Jun 17 05:56:27 2012 (r237184) @@ -45,70 +45,70 @@ static void ar9287SetPowerCalTable(struct ath_hal *ah, const struct ieee80211_channel *chan, int16_t *pTxPowerIndexOffset) { - struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop; - uint8_t *pCalBChans = NULL; - uint16_t pdGainOverlap_t2; - uint16_t numPiers = 0, i; - uint16_t numXpdGain, xpdMask; - uint16_t xpdGainValues[AR5416_NUM_PD_GAINS] = {0, 0, 0, 0}; - uint32_t regChainOffset; + struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop; + uint8_t *pCalBChans = NULL; + uint16_t pdGainOverlap_t2; + uint16_t numPiers = 0, i; + uint16_t numXpdGain, xpdMask; + uint16_t xpdGainValues[AR5416_NUM_PD_GAINS] = {0, 0, 0, 0}; + uint32_t regChainOffset; HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; - struct ar9287_eeprom *pEepData = &ee->ee_base; + struct ar9287_eeprom *pEepData = &ee->ee_base; - xpdMask = pEepData->modalHeader.xpdGain; + xpdMask = pEepData->modalHeader.xpdGain; - if ((pEepData->baseEepHeader.version & AR9287_EEP_VER_MINOR_MASK) >= - AR9287_EEP_MINOR_VER_2) - pdGainOverlap_t2 = pEepData->modalHeader.pdGainOverlap; - else - pdGainOverlap_t2 = (uint16_t)(MS(OS_REG_READ(ah, AR_PHY_TPCRG5), - AR_PHY_TPCRG5_PD_GAIN_OVERLAP)); + if ((pEepData->baseEepHeader.version & AR9287_EEP_VER_MINOR_MASK) >= + AR9287_EEP_MINOR_VER_2) + pdGainOverlap_t2 = pEepData->modalHeader.pdGainOverlap; + else + pdGainOverlap_t2 = (uint16_t)(MS(OS_REG_READ(ah, AR_PHY_TPCRG5), + AR_PHY_TPCRG5_PD_GAIN_OVERLAP)); /* Note: Kiwi should only be 2ghz.. */ - if (IEEE80211_IS_CHAN_2GHZ(chan)) { - pCalBChans = pEepData->calFreqPier2G; - numPiers = AR9287_NUM_2G_CAL_PIERS; - pRawDatasetOpenLoop = (struct cal_data_op_loop_ar9287 *)pEepData->calPierData2G[0]; - AH5416(ah)->initPDADC = pRawDatasetOpenLoop->vpdPdg[0][0]; - } - numXpdGain = 0; - - /* Calculate the value of xpdgains from the xpdGain Mask */ - for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) { - if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) { - if (numXpdGain >= AR5416_NUM_PD_GAINS) - break; - xpdGainValues[numXpdGain] = - (uint16_t)(AR5416_PD_GAINS_IN_MASK-i); - numXpdGain++; - } - } - - OS_REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN, - (numXpdGain - 1) & 0x3); - OS_REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1, - xpdGainValues[0]); - OS_REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2, - xpdGainValues[1]); - OS_REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, - xpdGainValues[2]); - - for (i = 0; i < AR9287_MAX_CHAINS; i++) { - regChainOffset = i * 0x1000; - - if (pEepData->baseEepHeader.txMask & (1 << i)) { - int8_t txPower; - pRawDatasetOpenLoop = - (struct cal_data_op_loop_ar9287 *)pEepData->calPierData2G[i]; - ar9287olcGetTxGainIndex(ah, chan, - pRawDatasetOpenLoop, - pCalBChans, numPiers, - &txPower); - ar9287olcSetPDADCs(ah, txPower, i); - } - } + if (IEEE80211_IS_CHAN_2GHZ(chan)) { + pCalBChans = pEepData->calFreqPier2G; + numPiers = AR9287_NUM_2G_CAL_PIERS; + pRawDatasetOpenLoop = (struct cal_data_op_loop_ar9287 *)pEepData->calPierData2G[0]; + AH5416(ah)->initPDADC = pRawDatasetOpenLoop->vpdPdg[0][0]; + } + numXpdGain = 0; + + /* Calculate the value of xpdgains from the xpdGain Mask */ + for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) { + if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) { + if (numXpdGain >= AR5416_NUM_PD_GAINS) + break; + xpdGainValues[numXpdGain] = + (uint16_t)(AR5416_PD_GAINS_IN_MASK-i); + numXpdGain++; + } + } + + OS_REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN, + (numXpdGain - 1) & 0x3); + OS_REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1, + xpdGainValues[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2, + xpdGainValues[1]); + OS_REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, + xpdGainValues[2]); - *pTxPowerIndexOffset = 0; + for (i = 0; i < AR9287_MAX_CHAINS; i++) { + regChainOffset = i * 0x1000; + + if (pEepData->baseEepHeader.txMask & (1 << i)) { + int8_t txPower; + pRawDatasetOpenLoop = + (struct cal_data_op_loop_ar9287 *)pEepData->calPierData2G[i]; + ar9287olcGetTxGainIndex(ah, chan, + pRawDatasetOpenLoop, + pCalBChans, numPiers, + &txPower); + ar9287olcSetPDADCs(ah, txPower, i); + } + } + + *pTxPowerIndexOffset = 0; } @@ -329,20 +329,20 @@ ar9287SetTransmitPower(struct ath_hal *a const struct ieee80211_channel *chan, uint16_t *rfXpdGain) { #define POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) -#define N(a) (sizeof (a) / sizeof (a[0])) +#define N(a) (sizeof (a) / sizeof (a[0])) const struct modal_eep_ar9287_header *pModal; struct ath_hal_5212 *ahp = AH5212(ah); - int16_t ratesArray[Ar5416RateSize]; - int16_t txPowerIndexOffset = 0; - uint8_t ht40PowerIncForPdadc = 2; - int i; - - uint16_t cfgCtl; - uint16_t powerLimit; - uint16_t twiceAntennaReduction; - uint16_t twiceMaxRegulatoryPower; - int16_t maxPower; + int16_t ratesArray[Ar5416RateSize]; + int16_t txPowerIndexOffset = 0; + uint8_t ht40PowerIncForPdadc = 2; + int i; + + uint16_t cfgCtl; + uint16_t powerLimit; + uint16_t twiceAntennaReduction; + uint16_t twiceMaxRegulatoryPower; + int16_t maxPower; HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; struct ar9287_eeprom *pEepData = &ee->ee_base; @@ -351,7 +351,8 @@ ar9287SetTransmitPower(struct ath_hal *a cfgCtl = ath_hal_getctl(ah, chan); powerLimit = chan->ic_maxregpower * 2; twiceAntennaReduction = chan->ic_maxantgain; - twiceMaxRegulatoryPower = AH_MIN(MAX_RATE_POWER, AH_PRIVATE(ah)->ah_powerLimit); + twiceMaxRegulatoryPower = AH_MIN(MAX_RATE_POWER, + AH_PRIVATE(ah)->ah_powerLimit); pModal = &pEepData->modalHeader; HALDEBUG(ah, HAL_DEBUG_RESET, "%s Channel=%u CfgCtl=%u\n", __func__,chan->ic_freq, cfgCtl ); @@ -361,9 +362,9 @@ ar9287SetTransmitPower(struct ath_hal *a /* Fetch per-rate power table for the given channel */ if (! ar9287SetPowerPerRateTable(ah, pEepData, chan, - &ratesArray[0],cfgCtl, - twiceAntennaReduction, - twiceMaxRegulatoryPower, powerLimit)) { + &ratesArray[0],cfgCtl, + twiceAntennaReduction, + twiceMaxRegulatoryPower, powerLimit)) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unable to set tx power per rate table\n", __func__); return AH_FALSE; @@ -476,7 +477,8 @@ ar9287SetBoardValues(struct ath_hal *ah, pModal->antCtrlChain[i]); OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4_CHAIN(0) + regChainOffset, - (OS_REG_READ(ah, AR_PHY_TIMING_CTRL4_CHAIN(0) + regChainOffset) + (OS_REG_READ(ah, AR_PHY_TIMING_CTRL4_CHAIN(0) + + regChainOffset) & ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) | SM(pModal->iqCalICh[i], @@ -500,7 +502,6 @@ ar9287SetBoardValues(struct ath_hal *ah, pModal->rxTxMarginCh[i]); } - if (IEEE80211_IS_CHAN_HT40(chan)) OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40); @@ -539,8 +540,8 @@ ar9287SetBoardValues(struct ath_hal *ah, SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) | SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF)); - OS_REG_WRITE(ah, AR9287_AN_RF2G3_CH0, regval); - OS_DELAY(100); /* analog write */ + /* Analog write - requires a 100usec delay */ + OS_A_REG_WRITE(ah, AR9287_AN_RF2G3_CH0, regval); regval = OS_REG_READ(ah, AR9287_AN_RF2G3_CH1); regval &= ~(AR9287_AN_RF2G3_DB1 | @@ -556,8 +557,7 @@ ar9287SetBoardValues(struct ath_hal *ah, SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) | SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF)); - OS_REG_WRITE(ah, AR9287_AN_RF2G3_CH1, regval); - OS_DELAY(100); /* analog write */ + OS_A_REG_WRITE(ah, AR9287_AN_RF2G3_CH1, regval); OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_FRAME_TO_DATA_START, pModal->txFrameToDataStart); From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 07:14:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B58DD106566C; Sun, 17 Jun 2012 07:14:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A02778FC0A; Sun, 17 Jun 2012 07:14:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H7EwEn091453; Sun, 17 Jun 2012 07:14:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H7EwCd091451; Sun, 17 Jun 2012 07:14:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206170714.q5H7EwCd091451@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 17 Jun 2012 07:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237185 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 07:14:58 -0000 Author: kib Date: Sun Jun 17 07:14:58 2012 New Revision: 237185 URL: http://svn.freebsd.org/changeset/base/237185 Log: MFC r236848: Use the previous stack entry protection and max protection to correctly propagate the stack execution permissions when stack is grown down. Modified: stable/9/sys/vm/vm_map.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_map.c ============================================================================== --- stable/9/sys/vm/vm_map.c Sun Jun 17 05:56:27 2012 (r237184) +++ stable/9/sys/vm/vm_map.c Sun Jun 17 07:14:58 2012 (r237185) @@ -3530,7 +3530,7 @@ Retry: } rv = vm_map_insert(map, NULL, 0, addr, stack_entry->start, - p->p_sysent->sv_stackprot, VM_PROT_ALL, 0); + next_entry->protection, next_entry->max_protection, 0); /* Adjust the available stack space by the amount we grew. */ if (rv == KERN_SUCCESS) { From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 09:42:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 56F081065674; Sun, 17 Jun 2012 09:42:57 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40AF68FC0C; Sun, 17 Jun 2012 09:42:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H9gvou097573; Sun, 17 Jun 2012 09:42:57 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H9gv5N097570; Sun, 17 Jun 2012 09:42:57 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206170942.q5H9gv5N097570@svn.freebsd.org> From: Marius Strobl Date: Sun, 17 Jun 2012 09:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237186 - stable/9/sys/dev/sym X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 09:42:57 -0000 Author: marius Date: Sun Jun 17 09:42:56 2012 New Revision: 237186 URL: http://svn.freebsd.org/changeset/base/237186 Log: MFC: r237101 Fix a braino in r236469 (MFC'ed to stable/9 in r236468); the number of DMA tags required for handling MAXPHYS should be based on PAGE_SIZE rather than SYM_CONF_DMA_BOUNDARY. While at it, reuse the SYM_CONF_MAX_SG macro for specifying the maximum number of DMA tags so sym(4) itself doesn't size memory beyond what's required for handling MAXPHYS. PR: 168928 Modified: stable/9/sys/dev/sym/sym_conf.h stable/9/sys/dev/sym/sym_hipd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/sym/sym_conf.h ============================================================================== --- stable/9/sys/dev/sym/sym_conf.h Sun Jun 17 07:14:58 2012 (r237185) +++ stable/9/sys/dev/sym/sym_conf.h Sun Jun 17 09:42:56 2012 (r237186) @@ -90,11 +90,12 @@ #define SYM_CONF_DMA_BOUNDARY (1UL << 24) /* - * Max number of scatter/gather entries for en IO. + * Max number of scatter/gather entries for an I/O. * Each entry costs 8 bytes in the internal CCB data structure. - * For now 65 should suffice given the BSD O/Ses capabilities. + * We use at most 33 segments but also no more than required for handling + * MAXPHYS. */ -#define SYM_CONF_MAX_SG (33) +#define SYM_CONF_MAX_SG (MIN(33, (MAXPHYS / PAGE_SIZE) + 1)) /* * Max number of targets. Modified: stable/9/sys/dev/sym/sym_hipd.c ============================================================================== --- stable/9/sys/dev/sym/sym_hipd.c Sun Jun 17 07:14:58 2012 (r237185) +++ stable/9/sys/dev/sym/sym_hipd.c Sun Jun 17 09:42:56 2012 (r237186) @@ -1609,7 +1609,6 @@ struct sym_hcb { u_int features; /* Chip features map */ u_char myaddr; /* SCSI id of the adapter */ u_char maxburst; /* log base 2 of dwords burst */ - u_char maxsegcnt; /* Max DMA S/G segments */ u_char maxwide; /* Maximum transfer width */ u_char minsync; /* Min sync period factor (ST) */ u_char maxsync; /* Max sync period factor (ST) */ @@ -8135,7 +8134,7 @@ static void sym_action2(struct cam_sim * cpi->xport_specific.spi.ppr_options = SID_SPI_CLOCK_DT_ST; } - cpi->maxio = np->maxsegcnt * SYM_CONF_DMA_BOUNDARY; + cpi->maxio = SYM_CONF_MAX_SG * PAGE_SIZE; sym_xpt_done2(np, ccb, CAM_REQ_CMP); break; case XPT_ABORT: @@ -8536,11 +8535,9 @@ sym_pci_attach(device_t dev) /* * Allocate a tag for the DMA of user data. */ - np->maxsegcnt = MIN(SYM_CONF_MAX_SG, - (MAXPHYS / SYM_CONF_DMA_BOUNDARY) + 1); if (bus_dma_tag_create(np->bus_dmat, 1, SYM_CONF_DMA_BOUNDARY, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - BUS_SPACE_MAXSIZE, np->maxsegcnt, SYM_CONF_DMA_BOUNDARY, + BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, BUS_DMA_ALLOCNOW, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { device_printf(dev, "failed to create DMA tag.\n"); goto attach_failed; From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 09:43:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5167010657A1; Sun, 17 Jun 2012 09:43:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B2C98FC0A; Sun, 17 Jun 2012 09:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H9h5Yu097616; Sun, 17 Jun 2012 09:43:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H9h4cZ097613; Sun, 17 Jun 2012 09:43:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206170943.q5H9h4cZ097613@svn.freebsd.org> From: Marius Strobl Date: Sun, 17 Jun 2012 09:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237187 - stable/8/sys/dev/sym X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 09:43:05 -0000 Author: marius Date: Sun Jun 17 09:43:04 2012 New Revision: 237187 URL: http://svn.freebsd.org/changeset/base/237187 Log: MFC: r237101 Fix a braino in r236469 (MFC'ed to stable/8 in r236469); the number of DMA tags required for handling MAXPHYS should be based on PAGE_SIZE rather than SYM_CONF_DMA_BOUNDARY. While at it, reuse the SYM_CONF_MAX_SG macro for specifying the maximum number of DMA tags so sym(4) itself doesn't size memory beyond what's required for handling MAXPHYS. PR: 168928 Modified: stable/8/sys/dev/sym/sym_conf.h stable/8/sys/dev/sym/sym_hipd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/sym/sym_conf.h ============================================================================== --- stable/8/sys/dev/sym/sym_conf.h Sun Jun 17 09:42:56 2012 (r237186) +++ stable/8/sys/dev/sym/sym_conf.h Sun Jun 17 09:43:04 2012 (r237187) @@ -90,11 +90,12 @@ #define SYM_CONF_DMA_BOUNDARY (1UL << 24) /* - * Max number of scatter/gather entries for en IO. + * Max number of scatter/gather entries for an I/O. * Each entry costs 8 bytes in the internal CCB data structure. - * For now 65 should suffice given the BSD O/Ses capabilities. + * We use at most 33 segments but also no more than required for handling + * MAXPHYS. */ -#define SYM_CONF_MAX_SG (33) +#define SYM_CONF_MAX_SG (MIN(33, (MAXPHYS / PAGE_SIZE) + 1)) /* * Max number of targets. Modified: stable/8/sys/dev/sym/sym_hipd.c ============================================================================== --- stable/8/sys/dev/sym/sym_hipd.c Sun Jun 17 09:42:56 2012 (r237186) +++ stable/8/sys/dev/sym/sym_hipd.c Sun Jun 17 09:43:04 2012 (r237187) @@ -1609,7 +1609,6 @@ struct sym_hcb { u_int features; /* Chip features map */ u_char myaddr; /* SCSI id of the adapter */ u_char maxburst; /* log base 2 of dwords burst */ - u_char maxsegcnt; /* Max DMA S/G segments */ u_char maxwide; /* Maximum transfer width */ u_char minsync; /* Min sync period factor (ST) */ u_char maxsync; /* Max sync period factor (ST) */ @@ -8135,7 +8134,7 @@ static void sym_action2(struct cam_sim * cpi->xport_specific.spi.ppr_options = SID_SPI_CLOCK_DT_ST; } - cpi->maxio = np->maxsegcnt * SYM_CONF_DMA_BOUNDARY; + cpi->maxio = SYM_CONF_MAX_SG * PAGE_SIZE; sym_xpt_done2(np, ccb, CAM_REQ_CMP); break; case XPT_ABORT: @@ -8536,11 +8535,9 @@ sym_pci_attach(device_t dev) /* * Allocate a tag for the DMA of user data. */ - np->maxsegcnt = MIN(SYM_CONF_MAX_SG, - (MAXPHYS / SYM_CONF_DMA_BOUNDARY) + 1); if (bus_dma_tag_create(np->bus_dmat, 1, SYM_CONF_DMA_BOUNDARY, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - BUS_SPACE_MAXSIZE, np->maxsegcnt, SYM_CONF_DMA_BOUNDARY, + BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, BUS_DMA_ALLOCNOW, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { device_printf(dev, "failed to create DMA tag.\n"); goto attach_failed; From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 09:50:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0C6C1065672; Sun, 17 Jun 2012 09:50:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C15118FC08; Sun, 17 Jun 2012 09:50:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H9ouun098037; Sun, 17 Jun 2012 09:50:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H9ougE098034; Sun, 17 Jun 2012 09:50:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206170950.q5H9ougE098034@svn.freebsd.org> From: Marius Strobl Date: Sun, 17 Jun 2012 09:50:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237188 - in stable/9/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 09:50:57 -0000 Author: marius Date: Sun Jun 17 09:50:56 2012 New Revision: 237188 URL: http://svn.freebsd.org/changeset/base/237188 Log: MFC: r230179 BeagleBone uses an FTDI chip with an altered Product ID. Modified: stable/9/sys/dev/usb/serial/uftdi.c stable/9/sys/dev/usb/usbdevs Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/9/sys/dev/usb/serial/uftdi.c Sun Jun 17 09:43:04 2012 (r237187) +++ stable/9/sys/dev/usb/serial/uftdi.c Sun Jun 17 09:50:56 2012 (r237188) @@ -217,6 +217,7 @@ static STRUCT_USB_HOST_ID uftdi_devs[] = UFTDI_DEV(FTDI, SERIAL_8U100AX, SIO), UFTDI_DEV(FTDI, SERIAL_2232C, 8U232AM), UFTDI_DEV(FTDI, SERIAL_2232D, 8U232AM), + UFTDI_DEV(FTDI, BEAGLEBONE, 8U232AM), UFTDI_DEV(FTDI, SERIAL_4232H, 8U232AM), UFTDI_DEV(FTDI, SERIAL_8U232AM, 8U232AM), UFTDI_DEV(FTDI, SERIAL_8U232AM4, 8U232AM), Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Sun Jun 17 09:43:04 2012 (r237187) +++ stable/9/sys/dev/usb/usbdevs Sun Jun 17 09:50:56 2012 (r237188) @@ -1604,6 +1604,7 @@ product FTDI SERIAL_8U232AM 0x6001 8U232 product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial product FTDI SERIAL_2232D 0x9e90 FT2232D Dual port Serial +product FTDI BEAGLEBONE 0xA6D0 BeagleBone product FTDI SERIAL_4232H 0x6011 FT4232H Quad port Serial /* Gude Analog- und Digitalsysteme products also uses FTDI's id: */ product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 09:51:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63997106564A; Sun, 17 Jun 2012 09:51:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 341DA8FC0A; Sun, 17 Jun 2012 09:51:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H9p0IY098075; Sun, 17 Jun 2012 09:51:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H9oxZH098072; Sun, 17 Jun 2012 09:51:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206170951.q5H9oxZH098072@svn.freebsd.org> From: Marius Strobl Date: Sun, 17 Jun 2012 09:50:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237189 - in stable/8/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 09:51:00 -0000 Author: marius Date: Sun Jun 17 09:50:59 2012 New Revision: 237189 URL: http://svn.freebsd.org/changeset/base/237189 Log: MFC: r230179 BeagleBone uses an FTDI chip with an altered Product ID. Modified: stable/8/sys/dev/usb/serial/uftdi.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/8/sys/dev/usb/serial/uftdi.c Sun Jun 17 09:50:56 2012 (r237188) +++ stable/8/sys/dev/usb/serial/uftdi.c Sun Jun 17 09:50:59 2012 (r237189) @@ -217,6 +217,7 @@ static STRUCT_USB_HOST_ID uftdi_devs[] = UFTDI_DEV(FTDI, SERIAL_8U100AX, SIO), UFTDI_DEV(FTDI, SERIAL_2232C, 8U232AM), UFTDI_DEV(FTDI, SERIAL_2232D, 8U232AM), + UFTDI_DEV(FTDI, BEAGLEBONE, 8U232AM), UFTDI_DEV(FTDI, SERIAL_4232H, 8U232AM), UFTDI_DEV(FTDI, SERIAL_8U232AM, 8U232AM), UFTDI_DEV(FTDI, SERIAL_8U232AM4, 8U232AM), Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Sun Jun 17 09:50:56 2012 (r237188) +++ stable/8/sys/dev/usb/usbdevs Sun Jun 17 09:50:59 2012 (r237189) @@ -1600,6 +1600,7 @@ product FTDI SERIAL_8U232AM 0x6001 8U232 product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial product FTDI SERIAL_2232D 0x9e90 FT2232D Dual port Serial +product FTDI BEAGLEBONE 0xA6D0 BeagleBone product FTDI SERIAL_4232H 0x6011 FT4232H Quad port Serial /* Gude Analog- und Digitalsysteme products also uses FTDI's id: */ product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 11:04:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86F5D1065672; Sun, 17 Jun 2012 11:04:39 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71A118FC0A; Sun, 17 Jun 2012 11:04:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HB4dbL004160; Sun, 17 Jun 2012 11:04:39 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HB4dLU004158; Sun, 17 Jun 2012 11:04:39 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206171104.q5HB4dLU004158@svn.freebsd.org> From: Joel Dahl Date: Sun, 17 Jun 2012 11:04:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237190 - head/contrib/telnet/telnet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 11:04:39 -0000 Author: joel (doc committer) Date: Sun Jun 17 11:04:38 2012 New Revision: 237190 URL: http://svn.freebsd.org/changeset/base/237190 Log: Remove superfluous paragraph macro. Modified: head/contrib/telnet/telnet/telnet.1 Modified: head/contrib/telnet/telnet/telnet.1 ============================================================================== --- head/contrib/telnet/telnet/telnet.1 Sun Jun 17 09:50:59 2012 (r237189) +++ head/contrib/telnet/telnet/telnet.1 Sun Jun 17 11:04:38 2012 (r237190) @@ -344,7 +344,6 @@ Only enough of each command to uniquely and .Ic display commands). -.Pp .Bl -tag -width "mode type" .It Ic auth Ar argument ... The auth command manipulates the information sent through the @@ -664,7 +663,6 @@ An end of file (in command mode) will al Sends one or more special character sequences to the remote host. The following are the arguments which may be specified (more than one argument may be specified at a time): -.Pp .Bl -tag -width escape .It Ic abort Sends the From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 11:16:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6629C1065673; Sun, 17 Jun 2012 11:16:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27AE38FC0C; Sun, 17 Jun 2012 11:16:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HBGF2v004717; Sun, 17 Jun 2012 11:16:15 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HBGEIQ004715; Sun, 17 Jun 2012 11:16:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206171116.q5HBGEIQ004715@svn.freebsd.org> From: Marius Strobl Date: Sun, 17 Jun 2012 11:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237191 - stable/9/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 11:16:15 -0000 Author: marius Date: Sun Jun 17 11:16:14 2012 New Revision: 237191 URL: http://svn.freebsd.org/changeset/base/237191 Log: MFC: r237107 - As a baind-aid, disable ATAPI DMA when using ATA_CAM for these controllers as well as it causes the kernel to hang during boot. Reported and tested by: Kevin Oberman - Use NULL instead of 0 for a pointer. Modified: stable/9/sys/dev/ata/chipsets/ata-ite.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/ata/chipsets/ata-ite.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-ite.c Sun Jun 17 11:04:38 2012 (r237190) +++ stable/9/sys/dev/ata/chipsets/ata-ite.c Sun Jun 17 11:16:14 2012 (r237191) @@ -105,10 +105,10 @@ ata_ite_chipinit(device_t dev) ctlr->setmode = ata_ite_821x_setmode; /* No timing restrictions initally. */ - ctlr->chipset_data = (void *)0; + ctlr->chipset_data = NULL; } ctlr->ch_attach = ata_ite_ch_attach; - return 0; + return (0); } static int @@ -119,6 +119,9 @@ ata_ite_ch_attach(device_t dev) error = ata_pci_ch_attach(dev); ch->flags |= ATA_CHECKS_CABLE; +#ifdef ATA_CAM + ch->flags |= ATA_NO_ATAPI_DMA; +#endif return (error); } From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 11:16:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0361D106566C; Sun, 17 Jun 2012 11:16:18 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E26228FC14; Sun, 17 Jun 2012 11:16:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HBGHAA004751; Sun, 17 Jun 2012 11:16:17 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HBGHTH004749; Sun, 17 Jun 2012 11:16:17 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206171116.q5HBGHTH004749@svn.freebsd.org> From: Marius Strobl Date: Sun, 17 Jun 2012 11:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237192 - stable/8/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 11:16:18 -0000 Author: marius Date: Sun Jun 17 11:16:17 2012 New Revision: 237192 URL: http://svn.freebsd.org/changeset/base/237192 Log: MFC: r237107 - As a baind-aid, disable ATAPI DMA when using ATA_CAM for these controllers as well as it causes the kernel to hang during boot. Reported and tested by: Kevin Oberman - Use NULL instead of 0 for a pointer. Modified: stable/8/sys/dev/ata/chipsets/ata-ite.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/ata/chipsets/ata-ite.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-ite.c Sun Jun 17 11:16:14 2012 (r237191) +++ stable/8/sys/dev/ata/chipsets/ata-ite.c Sun Jun 17 11:16:17 2012 (r237192) @@ -105,10 +105,10 @@ ata_ite_chipinit(device_t dev) ctlr->setmode = ata_ite_821x_setmode; /* No timing restrictions initally. */ - ctlr->chipset_data = (void *)0; + ctlr->chipset_data = NULL; } ctlr->ch_attach = ata_ite_ch_attach; - return 0; + return (0); } static int @@ -119,6 +119,9 @@ ata_ite_ch_attach(device_t dev) error = ata_pci_ch_attach(dev); ch->flags |= ATA_CHECKS_CABLE; +#ifdef ATA_CAM + ch->flags |= ATA_NO_ATAPI_DMA; +#endif return (error); } From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 11:33:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EFFC106564A; Sun, 17 Jun 2012 11:33:56 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 598D08FC08; Sun, 17 Jun 2012 11:33:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HBXuqu005504; Sun, 17 Jun 2012 11:33:56 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HBXuha005498; Sun, 17 Jun 2012 11:33:56 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206171133.q5HBXuha005498@svn.freebsd.org> From: Joel Dahl Date: Sun, 17 Jun 2012 11:33:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237193 - in head/contrib/bsnmp: lib snmp_target snmp_usm snmp_vacm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 11:33:56 -0000 Author: joel (doc committer) Date: Sun Jun 17 11:33:55 2012 New Revision: 237193 URL: http://svn.freebsd.org/changeset/base/237193 Log: Minor mdoc fixes. Modified: head/contrib/bsnmp/lib/bsnmpclient.3 head/contrib/bsnmp/lib/bsnmplib.3 head/contrib/bsnmp/snmp_target/snmp_target.3 head/contrib/bsnmp/snmp_usm/snmp_usm.3 head/contrib/bsnmp/snmp_vacm/snmp_vacm.3 Modified: head/contrib/bsnmp/lib/bsnmpclient.3 ============================================================================== --- head/contrib/bsnmp/lib/bsnmpclient.3 Sun Jun 17 11:16:17 2012 (r237192) +++ head/contrib/bsnmp/lib/bsnmpclient.3 Sun Jun 17 11:33:55 2012 (r237193) @@ -368,7 +368,7 @@ This format expects an argument of type and appends the length of the string (as computed by .Xr strlen 3 ) and each of the characters in the string to the OID. -.It Li ( Va N Ns Li ) +.It ( Va N Ns ) This format expects no argument. .Va N must be a decimal number and is stored into an internal variable Modified: head/contrib/bsnmp/lib/bsnmplib.3 ============================================================================== --- head/contrib/bsnmp/lib/bsnmplib.3 Sun Jun 17 11:16:17 2012 (r237192) +++ head/contrib/bsnmp/lib/bsnmplib.3 Sun Jun 17 11:33:55 2012 (r237193) @@ -161,7 +161,6 @@ is not zero, .Fa v.octetstring.octets points to a string allocated by .Xr malloc 3 . -.Pp .Bd -literal -offset indent #define SNMP_ENGINE_ID_SIZ 32 @@ -176,7 +175,6 @@ struct snmp_engine { .Pp This structure represents an SNMP engine as specified by the SNMP Management Architecture described in RFC 3411. -.Pp .Bd -literal -offset indent #define SNMP_ADM_STR32_SIZ (32 + 1) #define SNMP_AUTH_KEY_SIZ 40 @@ -225,7 +223,6 @@ enum snmp_privacy { and .Fa priv_key contain the authentication and privacy keys for the user. -.Pp .Bd -literal -offset indent #define SNMP_COMMUNITY_MAXLEN 128 #define SNMP_MAX_BINDINGS 100 Modified: head/contrib/bsnmp/snmp_target/snmp_target.3 ============================================================================== --- head/contrib/bsnmp/snmp_target/snmp_target.3 Sun Jun 17 11:16:17 2012 (r237192) +++ head/contrib/bsnmp/snmp_target/snmp_target.3 Sun Jun 17 11:33:55 2012 (r237193) @@ -33,7 +33,7 @@ .Os .Sh NAME .Nm snmp_target -.Nd "Target addresses and notifications module for +.Nd "Target addresses and notifications module for" .Xr bsnmpd 1 .Sh LIBRARY .Pq begemotSnmpdModulePath."target" = "/usr/lib/snmp_target.so" Modified: head/contrib/bsnmp/snmp_usm/snmp_usm.3 ============================================================================== --- head/contrib/bsnmp/snmp_usm/snmp_usm.3 Sun Jun 17 11:16:17 2012 (r237192) +++ head/contrib/bsnmp/snmp_usm/snmp_usm.3 Sun Jun 17 11:33:55 2012 (r237193) @@ -33,7 +33,7 @@ .Os .Sh NAME .Nm snmp_usm -.Nd "user-based security module for +.Nd "user-based security module for" .Xr bsnmpd 1 .Sh LIBRARY .Pq begemotSnmpdModulePath."usm" = "/usr/lib/snmp_usm.so" Modified: head/contrib/bsnmp/snmp_vacm/snmp_vacm.3 ============================================================================== --- head/contrib/bsnmp/snmp_vacm/snmp_vacm.3 Sun Jun 17 11:16:17 2012 (r237192) +++ head/contrib/bsnmp/snmp_vacm/snmp_vacm.3 Sun Jun 17 11:33:55 2012 (r237193) @@ -33,7 +33,7 @@ .Os .Sh NAME .Nm snmp_vacm -.Nd "View-based Access Control module for +.Nd "View-based Access Control module for" .Xr bsnmpd 1 .Sh LIBRARY .Pq begemotSnmpdModulePath."vacm" = "/usr/lib/snmp_vacm.so" From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 11:36:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 570BD106564A; Sun, 17 Jun 2012 11:36:29 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 282368FC08; Sun, 17 Jun 2012 11:36:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HBaTQ1005648; Sun, 17 Jun 2012 11:36:29 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HBaSUV005645; Sun, 17 Jun 2012 11:36:28 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206171136.q5HBaSUV005645@svn.freebsd.org> From: Joel Dahl Date: Sun, 17 Jun 2012 11:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237194 - in head/contrib/bsnmp: lib snmp_usm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 11:36:29 -0000 Author: joel (doc committer) Date: Sun Jun 17 11:36:28 2012 New Revision: 237194 URL: http://svn.freebsd.org/changeset/base/237194 Log: Remove end of line whitespace. Modified: head/contrib/bsnmp/lib/bsnmplib.3 head/contrib/bsnmp/snmp_usm/snmp_usm.3 Modified: head/contrib/bsnmp/lib/bsnmplib.3 ============================================================================== --- head/contrib/bsnmp/lib/bsnmplib.3 Sun Jun 17 11:33:55 2012 (r237193) +++ head/contrib/bsnmp/lib/bsnmplib.3 Sun Jun 17 11:36:28 2012 (r237194) @@ -386,7 +386,7 @@ If successfull, a plain text scoped PDU The function .Fn snmp_pdu_init_secparams calculates the initialization vector for the privacy protocol in use before -the PDU pointed to by +the PDU pointed to by .Fa pdu may be encrypted or decrypted. .Pp @@ -501,7 +501,7 @@ the cryptographic functions from The library may optionally be built without references to the .Xr crypto 3 library. In such case only plain text SNMPv3 PDUs without message digests -may be proccessed correctly. +may be proccessed correctly. .Sh STANDARDS This implementation conforms to the applicable IETF RFCs and ITU-T recommendations. Modified: head/contrib/bsnmp/snmp_usm/snmp_usm.3 ============================================================================== --- head/contrib/bsnmp/snmp_usm/snmp_usm.3 Sun Jun 17 11:33:55 2012 (r237193) +++ head/contrib/bsnmp/snmp_usm/snmp_usm.3 Sun Jun 17 11:36:28 2012 (r237194) @@ -79,7 +79,7 @@ supported. .It Va usmUserAuthProtocol The value of this column contains the OID corresponding to the authentication protocol used by the USM user. The following protocols and their OIDs are known to -.Nm +.Nm module .Bl -tag -width ".It Va NoAuthProtocol" .It NoAuthProtocol 1.3.6.1.6.3.10.1.1.1 @@ -91,7 +91,7 @@ These columns may be used to change the .It Va usmUserPrivProtocol The value of this column contains the OID corresponding to the privacy protocol used by the USM user. The following protocols and their OIDs are known to -.Nm +.Nm module .Bl -tag -width ".It Va NoPrivProtocol" .It NoPrivProtocol 1.3.6.1.6.3.10.1.2.1 From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 13:03:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6D1F1106566B; Sun, 17 Jun 2012 13:03:51 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5878A8FC0A; Sun, 17 Jun 2012 13:03:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HD3pHT009187; Sun, 17 Jun 2012 13:03:51 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HD3pl9009185; Sun, 17 Jun 2012 13:03:51 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206171303.q5HD3pl9009185@svn.freebsd.org> From: Davide Italiano Date: Sun, 17 Jun 2012 13:03:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237195 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 13:03:51 -0000 Author: davide Date: Sun Jun 17 13:03:50 2012 New Revision: 237195 URL: http://svn.freebsd.org/changeset/base/237195 Log: The variable 'error' in sys_poll() is initialized in declaration to value zero but in any case is overwritten by successive copyin(), making the previous initialization useless. Remove this. As an added bonus this fixes a style(9) bug. Discussed with: kib Approved by: gnn (mentor) MFC after: 3 days Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Jun 17 11:36:28 2012 (r237194) +++ head/sys/kern/sys_generic.c Sun Jun 17 13:03:50 2012 (r237195) @@ -1255,7 +1255,7 @@ sys_poll(td, uap) struct pollfd *bits; struct pollfd smallbits[32]; struct timeval atv, rtv, ttv; - int error = 0, timo; + int error, timo; u_int nfds; size_t ni; From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 13:48:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BE6A1065670; Sun, 17 Jun 2012 13:48:40 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27F908FC0C; Sun, 17 Jun 2012 13:48:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HDmep7011039; Sun, 17 Jun 2012 13:48:40 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HDmdW3011037; Sun, 17 Jun 2012 13:48:39 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206171348.q5HDmdW3011037@svn.freebsd.org> From: Davide Italiano Date: Sun, 17 Jun 2012 13:48:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237196 - head/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 13:48:40 -0000 Author: davide Date: Sun Jun 17 13:48:39 2012 New Revision: 237196 URL: http://svn.freebsd.org/changeset/base/237196 Log: Disable hwpmc(4) support for Intel Xeon Sandy Bridge (Model 0x2D). Due to some differences in MSRs between Xeon Sandy Bridge and Core Sandy Bridge (Model 0x2A), wrmsr() may generate in a GP# fault exception and so a panic of the machine. Approved by: gnn (mentor) MFC after: 3 days Modified: head/sys/dev/hwpmc/hwpmc_intel.c Modified: head/sys/dev/hwpmc/hwpmc_intel.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_intel.c Sun Jun 17 13:03:50 2012 (r237195) +++ head/sys/dev/hwpmc/hwpmc_intel.c Sun Jun 17 13:48:39 2012 (r237196) @@ -143,7 +143,6 @@ pmc_intel_initialize(void) nclasses = 5; break; case 0x2A: /* Per Intel document 253669-039US 05/2011. */ - case 0x2D: /* Per Intel document 253669-041US 12/2011. */ cputype = PMC_CPU_INTEL_SANDYBRIDGE; nclasses = 5; break; From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 16:19:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B576106566B; Sun, 17 Jun 2012 16:19:10 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F11608FC15; Sun, 17 Jun 2012 16:19:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HGJ9Qf017232; Sun, 17 Jun 2012 16:19:09 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HGJ94j017230; Sun, 17 Jun 2012 16:19:09 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206171619.q5HGJ94j017230@svn.freebsd.org> From: Mitsuru IWASAKI Date: Sun, 17 Jun 2012 16:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237197 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 16:19:10 -0000 Author: iwasaki Date: Sun Jun 17 16:19:09 2012 New Revision: 237197 URL: http://svn.freebsd.org/changeset/base/237197 Log: Resotre LCD brightness level on resuming. MFC after: 3 days Modified: head/sys/dev/acpica/acpi_video.c Modified: head/sys/dev/acpica/acpi_video.c ============================================================================== --- head/sys/dev/acpica/acpi_video.c Sun Jun 17 13:48:39 2012 (r237196) +++ head/sys/dev/acpica/acpi_video.c Sun Jun 17 16:19:09 2012 (r237197) @@ -75,6 +75,7 @@ static void acpi_video_identify(driver_t static int acpi_video_probe(device_t); static int acpi_video_attach(device_t); static int acpi_video_detach(device_t); +static int acpi_video_resume(device_t); static int acpi_video_shutdown(device_t); static void acpi_video_notify_handler(ACPI_HANDLE, UINT32, void *); static void acpi_video_power_profile(void *); @@ -155,6 +156,7 @@ static device_method_t acpi_video_method DEVMETHOD(device_probe, acpi_video_probe), DEVMETHOD(device_attach, acpi_video_attach), DEVMETHOD(device_detach, acpi_video_detach), + DEVMETHOD(device_resume, acpi_video_resume), DEVMETHOD(device_shutdown, acpi_video_shutdown), { 0, 0 } }; @@ -305,6 +307,36 @@ acpi_video_detach(device_t dev) } static int +acpi_video_resume(device_t dev) +{ + struct acpi_video_softc *sc; + struct acpi_video_output *vo, *vn; + int level; + + sc = device_get_softc(dev); + + /* Restore brightness level */ + ACPI_SERIAL_BEGIN(video); + ACPI_SERIAL_BEGIN(video_output); + STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vn) { + if ((vo->adr & DOD_DEVID_MASK_FULL) != DOD_DEVID_LCD && + (vo->adr & DOD_DEVID_MASK) != DOD_DEVID_INTDFP) + continue; + + if ((vo_get_device_status(vo->handle) & DCS_ACTIVE) == 0) + continue; + + level = vo_get_brightness(vo->handle); + if (level != -1) + vo_set_brightness(vo->handle, level); + } + ACPI_SERIAL_END(video_output); + ACPI_SERIAL_END(video); + + return (0); +} + +static int acpi_video_shutdown(device_t dev) { struct acpi_video_softc *sc; From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 16:32:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9F2B41065799; Sun, 17 Jun 2012 16:32:33 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ACFA8FC0C; Sun, 17 Jun 2012 16:32:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HGWXBY017786; Sun, 17 Jun 2012 16:32:33 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HGWXKq017784; Sun, 17 Jun 2012 16:32:33 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206171632.q5HGWXKq017784@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 17 Jun 2012 16:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237198 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 16:32:33 -0000 Author: pjd Date: Sun Jun 17 16:32:32 2012 New Revision: 237198 URL: http://svn.freebsd.org/changeset/base/237198 Log: If VOP_ADVLOCK() call or earlier checks failed don't check for a race with close, because even if we had a race there is nothing to unlock. Discussed with: kib MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Jun 17 16:19:09 2012 (r237197) +++ head/sys/kern/kern_descrip.c Sun Jun 17 16:32:32 2012 (r237198) @@ -668,6 +668,10 @@ kern_fcntl(struct thread *td, int fd, in } VFS_UNLOCK_GIANT(vfslocked); vfslocked = 0; + if (error != 0) { + fdrop(fp, td); + break; + } /* Check for race with close */ FILEDESC_SLOCK(fdp); if (fget_locked(fdp, fd) != fp) { From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 16:59:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BE1F01065672; Sun, 17 Jun 2012 16:59:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA5228FC12; Sun, 17 Jun 2012 16:59:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HGxbWq018934; Sun, 17 Jun 2012 16:59:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HGxbAZ018932; Sun, 17 Jun 2012 16:59:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206171659.q5HGxbAZ018932@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 17 Jun 2012 16:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237199 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 16:59:37 -0000 Author: pjd Date: Sun Jun 17 16:59:37 2012 New Revision: 237199 URL: http://svn.freebsd.org/changeset/base/237199 Log: Extend the comment about checking for a race with close to explain why it is done and why we don't return an error in such case. Discussed with: kib MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Jun 17 16:32:32 2012 (r237198) +++ head/sys/kern/kern_descrip.c Sun Jun 17 16:59:37 2012 (r237199) @@ -672,7 +672,23 @@ kern_fcntl(struct thread *td, int fd, in fdrop(fp, td); break; } - /* Check for race with close */ + + /* + * Check for a race with close. + * + * The vnode is now advisory locked (or unlocked, but this case + * is not really important) as the caller requested. + * We had to drop the filedesc lock, so we need to recheck if + * the descriptor is still valid, because if it was closed + * in the meantime we need to remove advisory lock from the + * vnode - close on any descriptor leading to an advisory + * locked vnode, removes that lock. + * We will return 0 on purpose in that case, as the result of + * successful advisory lock might have been externally visible + * already. This is fine - effectively we pretend to the caller + * that the closing thread was a bit slower and that the + * advisory lock succeeded before the close. + */ FILEDESC_SLOCK(fdp); if (fget_locked(fdp, fd) != fp) { FILEDESC_SUNLOCK(fdp); From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 18:34:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C567A106566B; Sun, 17 Jun 2012 18:34:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B15CC8FC14; Sun, 17 Jun 2012 18:34:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HIY4Gk023646; Sun, 17 Jun 2012 18:34:04 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HIY42F023644; Sun, 17 Jun 2012 18:34:04 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201206171834.q5HIY42F023644@svn.freebsd.org> From: Rick Macklem Date: Sun, 17 Jun 2012 18:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237200 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 18:34:04 -0000 Author: rmacklem Date: Sun Jun 17 18:34:04 2012 New Revision: 237200 URL: http://svn.freebsd.org/changeset/base/237200 Log: Move the nfsrpc_close() call in ncl_reclaim() for the NFSv4 client to below the vnode_destroy_vobject() call, since that is where writes are flushed. Suggested by: kib MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clnode.c Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Sun Jun 17 16:59:37 2012 (r237199) +++ head/sys/fs/nfsclient/nfs_clnode.c Sun Jun 17 18:34:04 2012 (r237200) @@ -257,15 +257,6 @@ ncl_reclaim(struct vop_reclaim_args *ap) struct nfsnode *np = VTONFS(vp); struct nfsdmap *dp, *dp2; - if (NFS_ISV4(vp) && vp->v_type == VREG) - /* - * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4 - * Close operations are delayed until ncl_inactive(). - * However, since VOP_INACTIVE() is not guaranteed to be - * called, we need to do it again here. - */ - (void) nfsrpc_close(vp, 1, ap->a_td); - /* * If the NLM is running, give it a chance to abort pending * locks. @@ -278,6 +269,15 @@ ncl_reclaim(struct vop_reclaim_args *ap) */ vnode_destroy_vobject(vp); + if (NFS_ISV4(vp) && vp->v_type == VREG) + /* + * We can now safely close any remaining NFSv4 Opens for + * this file. Most opens will have already been closed by + * ncl_inactive(), but there are cases where it is not + * called, so we need to do it again here. + */ + (void) nfsrpc_close(vp, 1, ap->a_td); + vfs_hash_remove(vp); /* From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 19:16:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2D7E1065670; Sun, 17 Jun 2012 19:16:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D2398FC0A; Sun, 17 Jun 2012 19:16:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HJGW7H027224; Sun, 17 Jun 2012 19:16:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HJGW1u027222; Sun, 17 Jun 2012 19:16:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206171916.q5HJGW1u027222@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 17 Jun 2012 19:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237201 - stable/9/sys/dev/drm2/i915 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 19:16:32 -0000 Author: kib Date: Sun Jun 17 19:16:31 2012 New Revision: 237201 URL: http://svn.freebsd.org/changeset/base/237201 Log: MFC r237131: Use right size when freeing unneeded GTT mapping. Modified: stable/9/sys/dev/drm2/i915/i915_gem.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- stable/9/sys/dev/drm2/i915/i915_gem.c Sun Jun 17 18:34:04 2012 (r237200) +++ stable/9/sys/dev/drm2/i915/i915_gem.c Sun Jun 17 19:16:31 2012 (r237201) @@ -1064,7 +1064,7 @@ i915_gem_gtt_write(struct drm_device *de IDX_TO_OFF(obj_pi), size, PAT_WRITE_COMBINING); ret = -copyin_nofault((void *)(uintptr_t)data_ptr, (char *)mkva + obj_po, size); - pmap_unmapdev(mkva, PAGE_SIZE); + pmap_unmapdev(mkva, size); return (ret); } From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:02:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DBBF9106564A; Sun, 17 Jun 2012 21:02:48 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C708E8FC0A; Sun, 17 Jun 2012 21:02:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HL2mAW032401; Sun, 17 Jun 2012 21:02:48 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HL2mG9032399; Sun, 17 Jun 2012 21:02:48 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <201206172102.q5HL2mG9032399@svn.freebsd.org> From: Poul-Henning Kamp Date: Sun, 17 Jun 2012 21:02:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237203 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:02:49 -0000 Author: phk Date: Sun Jun 17 21:02:48 2012 New Revision: 237203 URL: http://svn.freebsd.org/changeset/base/237203 Log: On certain newer Intel Atom based motherboards, for instance the D2500CC which I have, syscons in text-mode fails to show the expected contents due to write errors into video-memory. At least one of the causes is that we copy from syscons internal buffer to the video memory with optimized bcopy(9) which uses >16bit operations. Until now, 32bit and wider operations have always worked on the video memory, but since I cannot find a single source which says that this SHALL work, and since these chipsets/bugs are now out there, this commit changes syscons to always use 16bit copies on i386 & amd64. This may be relevevant for PR's: 166262 166639 and various other bug reports floating elsewhere on the net, but I lack hardware to test those. Modified: head/sys/dev/fb/fbreg.h Modified: head/sys/dev/fb/fbreg.h ============================================================================== --- head/sys/dev/fb/fbreg.h Sun Jun 17 20:45:45 2012 (r237202) +++ head/sys/dev/fb/fbreg.h Sun Jun 17 21:02:48 2012 (r237203) @@ -35,9 +35,16 @@ /* some macros */ #if defined(__amd64__) || defined(__i386__) -#define bcopy_io(s, d, c) bcopy((void *)(s), (void *)(d), (c)) -#define bcopy_toio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) -#define bcopy_fromio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) + +static __inline void +copyw(uint16_t *src, uint16_t *dst, size_t size) +{ + while (size--) + *dst++ = *src++; +} +#define bcopy_io(s, d, c) copyw((void*)(s), (void*)(d), (c)) +#define bcopy_toio(s, d, c) copyw((void*)(s), (void*)(d), (c)) +#define bcopy_fromio(s, d, c) copyw((void*)(s), (void*)(d), (c)) #define bzero_io(d, c) bzero((void *)(d), (c)) #define fill_io(p, d, c) fill((p), (void *)(d), (c)) #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:04:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F0CD106566C; Sun, 17 Jun 2012 21:04:23 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A6AB8FC08; Sun, 17 Jun 2012 21:04:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HL4MuD032501; Sun, 17 Jun 2012 21:04:22 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HL4M0t032499; Sun, 17 Jun 2012 21:04:22 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206172104.q5HL4M0t032499@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 17 Jun 2012 21:04:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237204 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:04:23 -0000 Author: pjd Date: Sun Jun 17 21:04:22 2012 New Revision: 237204 URL: http://svn.freebsd.org/changeset/base/237204 Log: Don't check for race with close on advisory unlock (there is nothing smart we can do when such a race occurs). This saves lock/unlock cycle for the filedesc lock for every advisory unlock operation. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Jun 17 21:02:48 2012 (r237203) +++ head/sys/kern/kern_descrip.c Sun Jun 17 21:04:22 2012 (r237204) @@ -668,7 +668,8 @@ kern_fcntl(struct thread *td, int fd, in } VFS_UNLOCK_GIANT(vfslocked); vfslocked = 0; - if (error != 0) { + if (error != 0 || flp->l_type == F_UNLCK || + flp->l_type == F_UNLCKSYS) { fdrop(fp, td); break; } From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:06:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4664106564A; Sun, 17 Jun 2012 21:06:36 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A694B8FC17; Sun, 17 Jun 2012 21:06:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HL6afJ032634; Sun, 17 Jun 2012 21:06:36 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HL6a4O032632; Sun, 17 Jun 2012 21:06:36 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206172106.q5HL6a4O032632@svn.freebsd.org> From: Doug Barton Date: Sun, 17 Jun 2012 21:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237205 - stable/9/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:06:37 -0000 Author: dougb Date: Sun Jun 17 21:06:36 2012 New Revision: 237205 URL: http://svn.freebsd.org/changeset/base/237205 Log: Improve the functionality of the PORTS_MODULES knob by adding LOCALBASE/bin and sbin to PATH, which allows dependencies to be found; adding SRC_BASE and OSVERSION to match the new kernel, and putting the related builds under MAKEOBJDIRPREFIX so that they only need to be built once per kernel. In addition to the PR this includes ideas/contributions from crees and matthew. PR: ports/161452 Submitted by: Garrett Cooper Modified: stable/9/sys/conf/kern.post.mk Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/kern.post.mk ============================================================================== --- stable/9/sys/conf/kern.post.mk Sun Jun 17 21:04:22 2012 (r237204) +++ stable/9/sys/conf/kern.post.mk Sun Jun 17 21:06:36 2012 (r237205) @@ -36,9 +36,30 @@ modules-${target}: .endif .endfor -# Handle out of tree ports +# Handle ports (as defined by the user) that build kernel modules .if !defined(NO_MODULES) && defined(PORTS_MODULES) -PORTSMODULESENV=SYSDIR=${SYSDIR} +# +# The ports tree needs some environment variables defined to match the new kernel +# +# Ports search for some dependencies in PATH, so add the location of the installed files +LOCALBASE?= /usr/local +# SRC_BASE is how the ports tree refers to the location of the base source files +.if !defined(SRC_BASE) +SRC_BASE!= realpath "${SYSDIR:H}/" +.endif +# OSVERSION is used by some ports to determine build options +.if !defined(OSRELDATE) +# Definition copied from src/Makefile.inc1 +OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ + ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h +.endif +# Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build +WRKDIRPREFIX?= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF} +PORTSMODULESENV=\ + PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ + SRC_BASE=${SRC_BASE} \ + OSVERSION=${OSRELDATE} \ + WRKDIRPREFIX=${WRKDIRPREFIX} .for __target in all install reinstall clean ${__target}: ports-${__target} ports-${__target}: From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:07:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 510981065687; Sun, 17 Jun 2012 21:07:01 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2288A8FC0A; Sun, 17 Jun 2012 21:07:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HL70ZH032695; Sun, 17 Jun 2012 21:07:00 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HL70wQ032692; Sun, 17 Jun 2012 21:07:00 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206172107.q5HL70wQ032692@svn.freebsd.org> From: Doug Barton Date: Sun, 17 Jun 2012 21:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237206 - stable/8/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:07:01 -0000 Author: dougb Date: Sun Jun 17 21:07:00 2012 New Revision: 237206 URL: http://svn.freebsd.org/changeset/base/237206 Log: Improve the functionality of the PORTS_MODULES knob by adding LOCALBASE/bin and sbin to PATH, which allows dependencies to be found; adding SRC_BASE and OSVERSION to match the new kernel, and putting the related builds under MAKEOBJDIRPREFIX so that they only need to be built once per kernel. In addition to the PR this includes ideas/contributions from crees and matthew. PR: ports/161452 Submitted by: Garrett Cooper Modified: stable/8/sys/conf/kern.post.mk Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/conf/kern.post.mk ============================================================================== --- stable/8/sys/conf/kern.post.mk Sun Jun 17 21:06:36 2012 (r237205) +++ stable/8/sys/conf/kern.post.mk Sun Jun 17 21:07:00 2012 (r237206) @@ -28,9 +28,30 @@ modules-${target}: .endif .endfor -# Handle out of tree ports +# Handle ports (as defined by the user) that build kernel modules .if !defined(NO_MODULES) && defined(PORTS_MODULES) -PORTSMODULESENV=SYSDIR=${SYSDIR} +# +# The ports tree needs some environment variables defined to match the new kernel +# +# Ports search for some dependencies in PATH, so add the location of the installed files +LOCALBASE?= /usr/local +# SRC_BASE is how the ports tree refers to the location of the base source files +.if !defined(SRC_BASE) +SRC_BASE!= realpath "${SYSDIR:H}/" +.endif +# OSVERSION is used by some ports to determine build options +.if !defined(OSRELDATE) +# Definition copied from src/Makefile.inc1 +OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ + ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h +.endif +# Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build +WRKDIRPREFIX?= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF} +PORTSMODULESENV=\ + PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ + SRC_BASE=${SRC_BASE} \ + OSVERSION=${OSRELDATE} \ + WRKDIRPREFIX=${WRKDIRPREFIX} .for __target in all install reinstall clean ${__target}: ports-${__target} ports-${__target}: From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:07:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B6221065680; Sun, 17 Jun 2012 21:07:28 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CDB28FC14; Sun, 17 Jun 2012 21:07:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HL7SXt032754; Sun, 17 Jun 2012 21:07:28 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HL7SQj032752; Sun, 17 Jun 2012 21:07:28 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206172107.q5HL7SQj032752@svn.freebsd.org> From: Doug Barton Date: Sun, 17 Jun 2012 21:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237207 - stable/7/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:07:28 -0000 Author: dougb Date: Sun Jun 17 21:07:27 2012 New Revision: 237207 URL: http://svn.freebsd.org/changeset/base/237207 Log: Improve the functionality of the PORTS_MODULES knob by adding LOCALBASE/bin and sbin to PATH, which allows dependencies to be found; adding SRC_BASE and OSVERSION to match the new kernel, and putting the related builds under MAKEOBJDIRPREFIX so that they only need to be built once per kernel. In addition to the PR this includes ideas/contributions from crees and matthew. PR: ports/161452 Submitted by: Garrett Cooper Modified: stable/7/sys/conf/kern.post.mk Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/conf/kern.post.mk ============================================================================== --- stable/7/sys/conf/kern.post.mk Sun Jun 17 21:07:00 2012 (r237206) +++ stable/7/sys/conf/kern.post.mk Sun Jun 17 21:07:27 2012 (r237207) @@ -28,9 +28,30 @@ modules-${target}: .endif .endfor -# Handle out of tree ports +# Handle ports (as defined by the user) that build kernel modules .if !defined(NO_MODULES) && defined(PORTS_MODULES) -PORTSMODULESENV=SYSDIR=${SYSDIR} +# +# The ports tree needs some environment variables defined to match the new kernel +# +# Ports search for some dependencies in PATH, so add the location of the installed files +LOCALBASE?= /usr/local +# SRC_BASE is how the ports tree refers to the location of the base source files +.if !defined(SRC_BASE) +SRC_BASE!= realpath "${SYSDIR:H}/" +.endif +# OSVERSION is used by some ports to determine build options +.if !defined(OSRELDATE) +# Definition copied from src/Makefile.inc1 +OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ + ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h +.endif +# Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build +WRKDIRPREFIX?= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF} +PORTSMODULESENV=\ + PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ + SRC_BASE=${SRC_BASE} \ + OSVERSION=${OSRELDATE} \ + WRKDIRPREFIX=${WRKDIRPREFIX} .for __target in all install reinstall clean ${__target}: ports-${__target} ports-${__target}: From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:11:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id E7623106566B; Sun, 17 Jun 2012 21:11:46 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 89BD1162878; Sun, 17 Jun 2012 21:11:24 +0000 (UTC) Message-ID: <4FDE47FC.3090809@FreeBSD.org> Date: Sun, 17 Jun 2012 14:11:24 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120609 Thunderbird/13.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org References: <201206172106.q5HL6a4O032632@svn.freebsd.org> In-Reply-To: <201206172106.q5HL6a4O032632@svn.freebsd.org> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r237205 - stable/9/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:11:47 -0000 On 06/17/2012 14:06, Doug Barton wrote: > stable/9/sys/conf/ (props changed) There is what looks like a really large amount of crufty mergeinfo on stable/9/sys/conf. The diff was large and hairy enough that I didn't feel comfortable tackling it in the time I have allotted today. Given that 9 is still a fairly new branch, it would probably be good if someone with the knowledge and time were to see about cleaning it up. ... which leads to the gentle reminder, always do merges for files under sys/ IN sys/. Doug -- This .signature sanitized for your protection From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:28:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 202FC106564A; Sun, 17 Jun 2012 21:28:12 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07DDC8FC08; Sun, 17 Jun 2012 21:28:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HLSBg0033754; Sun, 17 Jun 2012 21:28:11 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HLSBD3033748; Sun, 17 Jun 2012 21:28:11 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201206172128.q5HLSBD3033748@svn.freebsd.org> From: Matt Jacob Date: Sun, 17 Jun 2012 21:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237208 - in stable/9/sys: conf dev/isp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:28:12 -0000 Author: mjacob Date: Sun Jun 17 21:28:11 2012 New Revision: 237208 URL: http://svn.freebsd.org/changeset/base/237208 Log: MFC of r236427 Clean up and complete the incomplete deferred enable code. Make the default role NONE if target mode is selected. This allows ctl(8) to switch to/from target mode via knob settings. If we default to role 'none', this causes a reset of the 24XX f/w which then causes initiators to wake up and notice when we come online. Modified: stable/9/sys/conf/NOTES stable/9/sys/dev/isp/isp.c stable/9/sys/dev/isp/isp_freebsd.c stable/9/sys/dev/isp/isp_freebsd.h stable/9/sys/dev/isp/ispvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/isp/ (props changed) Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Sun Jun 17 21:07:27 2012 (r237207) +++ stable/9/sys/conf/NOTES Sun Jun 17 21:28:11 2012 (r237208) @@ -1592,7 +1592,7 @@ options ISP_TARGET_MODE=1 # # ISP_INTERNAL_TARGET (trivial internal disk target, for testing) # -options ISP_DEFAULT_ROLES=2 +options ISP_DEFAULT_ROLES=0 # Options used in dev/sym/ (Symbios SCSI driver). #options SYM_SETUP_LP_PROBE_MAP #-Low Priority Probe Map (bits) Modified: stable/9/sys/dev/isp/isp.c ============================================================================== --- stable/9/sys/dev/isp/isp.c Sun Jun 17 21:07:27 2012 (r237207) +++ stable/9/sys/dev/isp/isp.c Sun Jun 17 21:28:11 2012 (r237208) @@ -2277,6 +2277,11 @@ isp_port_login(ispsoftc_t *isp, uint16_t } } +/* + * Pre-24XX fabric port logout + * + * Note that portid is not used + */ static int isp_port_logout(ispsoftc_t *isp, uint16_t handle, uint32_t portid) { @@ -2721,7 +2726,7 @@ not_on_fabric: * layer appropriately). * * We also do initiator map target id assignment here for new initiator - * devices and refresh old ones ot make sure that they point to the corret + * devices and refresh old ones ot make sure that they point to the correct * entities. */ static int Modified: stable/9/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/9/sys/dev/isp/isp_freebsd.c Sun Jun 17 21:07:27 2012 (r237207) +++ stable/9/sys/dev/isp/isp_freebsd.c Sun Jun 17 21:28:11 2012 (r237208) @@ -773,6 +773,9 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb */ #ifdef ISP_TARGET_MODE +static ISP_INLINE void isp_tmlock(ispsoftc_t *, const char *); +static ISP_INLINE void isp_tmunlk(ispsoftc_t *); +static ISP_INLINE int is_any_lun_enabled(ispsoftc_t *, int); static ISP_INLINE int is_lun_enabled(ispsoftc_t *, int, lun_id_t); static ISP_INLINE tstate_t *get_lun_statep(ispsoftc_t *, int, lun_id_t); static ISP_INLINE tstate_t *get_lun_statep_from_tag(ispsoftc_t *, int, uint32_t); @@ -786,10 +789,11 @@ static ISP_INLINE void isp_put_ntpd(isps static cam_status create_lun_state(ispsoftc_t *, int, struct cam_path *, tstate_t **); static void destroy_lun_state(ispsoftc_t *, tstate_t *); static void isp_enable_lun(ispsoftc_t *, union ccb *); -static void isp_enable_deferred_luns(ispsoftc_t *, int); +static cam_status isp_enable_deferred_luns(ispsoftc_t *, int); static cam_status isp_enable_deferred(ispsoftc_t *, int, lun_id_t); static void isp_disable_lun(ispsoftc_t *, union ccb *); static int isp_enable_target_mode(ispsoftc_t *, int); +static int isp_disable_target_mode(ispsoftc_t *, int); static void isp_ledone(ispsoftc_t *, lun_entry_t *); static timeout_t isp_refire_putback_atio; static void isp_complete_ctio(union ccb *); @@ -807,6 +811,40 @@ static void isp_handle_platform_target_t static void isp_target_mark_aborted(ispsoftc_t *, union ccb *); static void isp_target_mark_aborted_early(ispsoftc_t *, tstate_t *, uint32_t); +static ISP_INLINE void +isp_tmlock(ispsoftc_t *isp, const char *msg) +{ + while (isp->isp_osinfo.tmbusy) { + isp->isp_osinfo.tmwanted = 1; + mtx_sleep(isp, &isp->isp_lock, PRIBIO, msg, 0); + } + isp->isp_osinfo.tmbusy = 1; +} + +static ISP_INLINE void +isp_tmunlk(ispsoftc_t *isp) +{ + isp->isp_osinfo.tmbusy = 0; + if (isp->isp_osinfo.tmwanted) { + isp->isp_osinfo.tmwanted = 0; + wakeup(isp); + } +} + +static ISP_INLINE int +is_any_lun_enabled(ispsoftc_t *isp, int bus) +{ + struct tslist *lhp; + int i; + + for (i = 0; i < LUN_HASH_SIZE; i++) { + ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp); + if (SLIST_FIRST(lhp)) + return (1); + } + return (0); +} + static ISP_INLINE int is_lun_enabled(ispsoftc_t *isp, int bus, lun_id_t lun) { @@ -909,6 +947,7 @@ get_ntp_from_tagdata(ispsoftc_t *isp, ui } return (NULL); } + static ISP_INLINE void rls_lun_statep(ispsoftc_t *isp, tstate_t *tptr) { @@ -1050,7 +1089,7 @@ create_lun_state(ispsoftc_t *isp, int bu if (is_lun_enabled(isp, bus, lun)) { return (CAM_LUN_ALRDY_ENA); } - tptr = (tstate_t *) malloc(sizeof (tstate_t), M_DEVBUF, M_NOWAIT|M_ZERO); + tptr = malloc(sizeof (tstate_t), M_DEVBUF, M_NOWAIT|M_ZERO); if (tptr == NULL) { return (CAM_RESRC_UNAVAIL); } @@ -1079,10 +1118,12 @@ static ISP_INLINE void destroy_lun_state(ispsoftc_t *isp, tstate_t *tptr) { struct tslist *lhp; + KASSERT((tptr->hold != 0), ("tptr is not held")); KASSERT((tptr->hold == 1), ("tptr still held (%d)", tptr->hold)); ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp); SLIST_REMOVE(lhp, tptr, tstate, next); + ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "destroyed tstate\n"); xpt_free_path(tptr->owner); free(tptr, M_DEVBUF); } @@ -1098,12 +1139,14 @@ isp_enable_lun(ispsoftc_t *isp, union cc target_id_t target; lun_id_t lun; + /* * We only support either a wildcard target/lun or a target ID of zero and a non-wildcard lun */ bus = XS_CHANNEL(ccb); target = ccb->ccb_h.target_id; lun = ccb->ccb_h.target_lun; + ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, "enabling lun %u\n", lun); if (target != CAM_TARGET_WILDCARD && target != 0) { ccb->ccb_h.status = CAM_TID_INVALID; xpt_done(ccb); @@ -1127,11 +1170,7 @@ isp_enable_lun(ispsoftc_t *isp, union cc /* * Wait until we're not busy with the lun enables subsystem */ - while (isp->isp_osinfo.tmbusy) { - isp->isp_osinfo.tmwanted = 1; - mtx_sleep(isp, &isp->isp_lock, PRIBIO, "want_isp_enable_lun", 0); - } - isp->isp_osinfo.tmbusy = 1; + isp_tmlock(isp, "isp_enable_lun"); /* * This is as a good a place as any to check f/w capabilities. @@ -1200,7 +1239,7 @@ isp_enable_lun(ispsoftc_t *isp, union cc if (tm_enabled == 0) { ISP_SET_PC(isp, bus, tm_enable_defer, 1); ccb->ccb_h.status = CAM_REQ_CMP; - xpt_print(ccb->ccb_h.path, "Target Mode Not Enabled Yet- Lun Enables Deferred\n"); + xpt_print(ccb->ccb_h.path, "Target Mode not enabled yet- lun enable deferred\n"); goto done; } @@ -1210,37 +1249,78 @@ isp_enable_lun(ispsoftc_t *isp, union cc ccb->ccb_h.status = isp_enable_deferred(isp, bus, lun); done: - if (ccb->ccb_h.status != CAM_REQ_CMP && tptr) { - destroy_lun_state(isp, tptr); - tptr = NULL; + if (ccb->ccb_h.status != CAM_REQ_CMP) { + if (tptr) { + destroy_lun_state(isp, tptr); + tptr = NULL; + } + } else { + tptr->enabled = 1; } if (tptr) { rls_lun_statep(isp, tptr); } - isp->isp_osinfo.tmbusy = 0; - if (isp->isp_osinfo.tmwanted) { - isp->isp_osinfo.tmwanted = 0; - wakeup(isp); - } + + /* + * And we're outta here.... + */ + isp_tmunlk(isp); xpt_done(ccb); } -static void +static cam_status isp_enable_deferred_luns(ispsoftc_t *isp, int bus) { + tstate_t *tptr = NULL; + struct tslist *lhp; + int i, n; + + ISP_GET_PC(isp, bus, tm_enabled, i); + if (i == 1) { + return (CAM_REQ_CMP); + } + ISP_GET_PC(isp, bus, tm_enable_defer, i); + if (i == 0) { + return (CAM_REQ_CMP); + } /* - * XXX: not entirely implemented yet + * If this succeeds, it will set tm_enable */ - (void) isp_enable_deferred(isp, bus, 0); + if (isp_enable_target_mode(isp, bus)) { + return (CAM_REQ_CMP_ERR); + } + isp_tmlock(isp, "isp_enable_deferred_luns"); + for (n = i = 0; i < LUN_HASH_SIZE; i++) { + ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp); + SLIST_FOREACH(tptr, lhp, next) { + tptr->hold++; + if (tptr->enabled == 0) { + if (isp_enable_deferred(isp, bus, xpt_path_lun_id(tptr->owner)) == 0) { + tptr->enabled = 1; + n++; + } + } else { + n++; + } + tptr->hold--; + } + } + isp_tmunlk(isp); + if (n == 0) { + return (CAM_REQ_CMP_ERR); + } + ISP_SET_PC(isp, bus, tm_enable_defer, 0); + return (CAM_REQ_CMP); } -static uint32_t +static cam_status isp_enable_deferred(ispsoftc_t *isp, int bus, lun_id_t lun) { cam_status status; + int luns_already_enabled = ISP_FC_PC(isp, bus)->tm_luns_enabled; isp_prt(isp, ISP_LOGTINFO, "%s: bus %d lun %u", __func__, bus, lun); - if (IS_24XX(isp) || (IS_FC(isp) && ISP_FC_PC(isp, bus)->tm_luns_enabled)) { + if (IS_24XX(isp) || (IS_FC(isp) && luns_already_enabled)) { status = CAM_REQ_CMP; } else { int cmd_cnt, not_cnt; @@ -1261,10 +1341,9 @@ isp_enable_deferred(ispsoftc_t *isp, int } isp->isp_osinfo.rptr = NULL; } - if (status == CAM_REQ_CMP) { ISP_SET_PC(isp, bus, tm_luns_enabled, 1); - isp_prt(isp, ISP_LOGTINFO, "bus %d lun %u now enabled for target mode", bus, lun); + isp_prt(isp, ISP_LOGCONFIG|ISP_LOGTINFO, "bus %d lun %u now enabled for target mode", bus, lun); } return (status); } @@ -1281,11 +1360,13 @@ isp_disable_lun(ispsoftc_t *isp, union c bus = XS_CHANNEL(ccb); target = ccb->ccb_h.target_id; lun = ccb->ccb_h.target_lun; + ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, "disabling lun %u\n", lun); if (target != CAM_TARGET_WILDCARD && target != 0) { ccb->ccb_h.status = CAM_TID_INVALID; xpt_done(ccb); return; } + if (target == CAM_TARGET_WILDCARD && lun != CAM_LUN_WILDCARD) { ccb->ccb_h.status = CAM_LUN_INVALID; xpt_done(ccb); @@ -1297,18 +1378,11 @@ isp_disable_lun(ispsoftc_t *isp, union c xpt_done(ccb); return; } - if (isp->isp_dblev & ISP_LOGTDEBUG0) { - xpt_print(ccb->ccb_h.path, "enabling lun 0x%x on channel %d\n", lun, bus); - } /* * See if we're busy disabling a lun now. */ - while (isp->isp_osinfo.tmbusy) { - isp->isp_osinfo.tmwanted = 1; - mtx_sleep(isp, &isp->isp_lock, PRIBIO, "want_isp_disable_lun", 0); - } - isp->isp_osinfo.tmbusy = 1; + isp_tmlock(isp, "isp_disable_lun"); status = CAM_REQ_INPROG; /* @@ -1333,85 +1407,86 @@ isp_disable_lun(ispsoftc_t *isp, union c if (IS_FC(isp)) { lun = 0; } - isp->isp_osinfo.rptr = &status; if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun, 0, 0)) { status = CAM_RESRC_UNAVAIL; } else { mtx_sleep(ccb, &isp->isp_lock, PRIBIO, "isp_disable_lun", 0); } + isp->isp_osinfo.rptr = NULL; done: - ccb->ccb_h.status = status; if (status == CAM_REQ_CMP) { - xpt_print(ccb->ccb_h.path, "now disabled for target mode\n"); + tptr->enabled = 0; + /* + * If we have no more luns enabled for this bus, delete all tracked wwns for it (if we are FC) + * and disable target mode. + */ + if (is_any_lun_enabled(isp, bus) == 0) { + isp_del_all_wwn_entries(isp, bus); + if (isp_disable_target_mode(isp, bus)) { + status = CAM_REQ_CMP_ERR; + } + } } - if (tptr) { + ccb->ccb_h.status = status; + if (status == CAM_REQ_CMP) { + xpt_print(ccb->ccb_h.path, "lun now disabled for target mode\n"); destroy_lun_state(isp, tptr); + } else { + if (tptr) + rls_lun_statep(isp, tptr); } - isp->isp_osinfo.rptr = NULL; - isp->isp_osinfo.tmbusy = 0; - if (isp->isp_osinfo.tmwanted) { - isp->isp_osinfo.tmwanted = 0; - wakeup(isp); - } + isp_tmunlk(isp); xpt_done(ccb); } static int isp_enable_target_mode(ispsoftc_t *isp, int bus) { - int ct; + int tm_enabled; - ISP_GET_PC(isp, bus, tm_enabled, ct); - if (ct != 0) { + ISP_GET_PC(isp, bus, tm_enabled, tm_enabled); + if (tm_enabled != 0) { return (0); } - if (IS_SCSI(isp)) { mbreg_t mbs; - MBSINIT(&mbs, MBOX_ENABLE_TARGET_MODE, MBLOGALL, 0); mbs.param[0] = MBOX_ENABLE_TARGET_MODE; mbs.param[1] = ENABLE_TARGET_FLAG|ENABLE_TQING_FLAG; mbs.param[2] = bus << 7; if (isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs) < 0 || mbs.param[0] != MBOX_COMMAND_COMPLETE) { - isp_prt(isp, ISP_LOGERR, "Unable to add Target Role to Bus %d", bus); + isp_prt(isp, ISP_LOGERR, "Unable to enable Target Role on Bus %d", bus); return (EIO); } - SDPARAM(isp, bus)->role |= ISP_ROLE_TARGET; } ISP_SET_PC(isp, bus, tm_enabled, 1); - isp_prt(isp, ISP_LOGINFO, "Target Role added to Bus %d", bus); + isp_prt(isp, ISP_LOGINFO, "Target Role enabled on Bus %d", bus); return (0); } -#ifdef NEEDED static int isp_disable_target_mode(ispsoftc_t *isp, int bus) { - int ct; + int tm_enabled; - ISP_GET_PC(isp, bus, tm_enabled, ct); - if (ct == 0) { + ISP_GET_PC(isp, bus, tm_enabled, tm_enabled); + if (tm_enabled == 0) { return (0); } - if (IS_SCSI(isp)) { mbreg_t mbs; - MBSINIT(&mbs, MBOX_ENABLE_TARGET_MODE, MBLOGALL, 0); mbs.param[2] = bus << 7; if (isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs) < 0 || mbs.param[0] != MBOX_COMMAND_COMPLETE) { - isp_prt(isp, ISP_LOGERR, "Unable to subtract Target Role to Bus %d", bus); + isp_prt(isp, ISP_LOGERR, "Unable to disable Target Role on Bus %d", bus); return (EIO); } - SDPARAM(isp, bus)->role &= ~ISP_ROLE_TARGET; } ISP_SET_PC(isp, bus, tm_enabled, 0); - isp_prt(isp, ISP_LOGINFO, "Target Role subtracted from Bus %d", bus); + isp_prt(isp, ISP_LOGINFO, "Target Role disabled onon Bus %d", bus); return (0); } -#endif static void isp_ledone(ispsoftc_t *isp, lun_entry_t *lep) @@ -4431,7 +4506,7 @@ isp_action(struct cam_sim *sim, union cc tptr->atio_count++; SLIST_INSERT_HEAD(&tptr->atios, &ccb->ccb_h, sim_links.sle); ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, ccb->ccb_h.path, "Put FREE ATIO (tag id 0x%x), count now %d\n", - ((struct ccb_accept_tio *)ccb)->tag_id, tptr->atio_count); + ccb->atio.tag_id, tptr->atio_count); } else if (ccb->ccb_h.func_code == XPT_IMMEDIATE_NOTIFY) { if (ccb->cin1.tag_id) { inot_private_data_t *ntp = isp_find_ntpd(isp, tptr, ccb->cin1.tag_id, ccb->cin1.seq_id); @@ -4442,12 +4517,12 @@ isp_action(struct cam_sim *sim, union cc tptr->inot_count++; SLIST_INSERT_HEAD(&tptr->inots, &ccb->ccb_h, sim_links.sle); ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, ccb->ccb_h.path, "Put FREE INOT, (seq id 0x%x) count now %d\n", - ((struct ccb_immediate_notify *)ccb)->seq_id, tptr->inot_count); + ccb->cin1.seq_id, tptr->inot_count); } else if (ccb->ccb_h.func_code == XPT_IMMED_NOTIFY) { tptr->inot_count++; SLIST_INSERT_HEAD(&tptr->inots, &ccb->ccb_h, sim_links.sle); ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, ccb->ccb_h.path, "Put FREE INOT, (seq id 0x%x) count now %d\n", - ((struct ccb_immediate_notify *)ccb)->seq_id, tptr->inot_count); + ccb->cin1.seq_id, tptr->inot_count); } rls_lun_statep(isp, tptr); ccb->ccb_h.status = CAM_REQ_INPROG; @@ -4730,7 +4805,6 @@ isp_action(struct cam_sim *sim, union cc struct ccb_sim_knob *kp = &ccb->knob; fcparam *fcp; - if (!IS_FC(isp)) { ccb->ccb_h.status = CAM_REQ_INVALID; xpt_done(ccb); @@ -4788,11 +4862,12 @@ isp_action(struct cam_sim *sim, union cc break; } if (rchange) { + ISP_PATH_PRT(isp, ISP_LOGCONFIG, ccb->ccb_h.path, "changing role on from %d to %d\n", fcp->role, newrole); if (isp_fc_change_role(isp, bus, newrole) != 0) { ccb->ccb_h.status = CAM_REQ_CMP_ERR; #ifdef ISP_TARGET_MODE } else if (newrole == ISP_ROLE_TARGET || newrole == ISP_ROLE_BOTH) { - isp_enable_deferred_luns(isp, bus); + ccb->ccb_h.status = isp_enable_deferred_luns(isp, bus); #endif } } @@ -4800,7 +4875,7 @@ isp_action(struct cam_sim *sim, union cc xpt_done(ccb); break; } - case XPT_GET_SIM_KNOB: /* Set SIM knobs */ + case XPT_GET_SIM_KNOB: /* Get SIM knobs */ { struct ccb_sim_knob *kp = &ccb->knob; Modified: stable/9/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/9/sys/dev/isp/isp_freebsd.h Sun Jun 17 21:07:27 2012 (r237207) +++ stable/9/sys/dev/isp/isp_freebsd.h Sun Jun 17 21:28:11 2012 (r237208) @@ -121,8 +121,10 @@ typedef struct tstate { struct ccb_hdr_slist atios; struct ccb_hdr_slist inots; uint32_t hold; - int atio_count; - int inot_count; + uint32_t + enabled : 1, + atio_count : 15, + inot_count : 15; inot_private_data_t * restart_queue; inot_private_data_t * ntfree; inot_private_data_t ntpool[ATPDPSIZE]; Modified: stable/9/sys/dev/isp/ispvar.h ============================================================================== --- stable/9/sys/dev/isp/ispvar.h Sun Jun 17 21:07:27 2012 (r237207) +++ stable/9/sys/dev/isp/ispvar.h Sun Jun 17 21:28:11 2012 (r237208) @@ -724,8 +724,17 @@ struct ispsoftc { #define ISP_ROLE_BOTH (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR) #define ISP_ROLE_EITHER ISP_ROLE_BOTH #ifndef ISP_DEFAULT_ROLES +/* + * Counterintuitively, we prefer to default to role 'none' + * if we are enable target mode support. This gives us the + * maximum flexibility as to which port will do what. + */ +#ifdef ISP_TARGET_MODE +#define ISP_DEFAULT_ROLES ISP_ROLE_NONE +#else #define ISP_DEFAULT_ROLES ISP_ROLE_INITIATOR #endif +#endif /* From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:29:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDB0E1065670; Sun, 17 Jun 2012 21:29:15 +0000 (UTC) (envelope-from taku@tackymt.homeip.net) Received: from basalt.tackymt.homeip.net (unknown [IPv6:2001:3e0:577:0:20d:61ff:fecc:2253]) by mx1.freebsd.org (Postfix) with ESMTP id 908B28FC12; Sun, 17 Jun 2012 21:29:15 +0000 (UTC) Received: from basalt.tackymt.homeip.net (localhost [127.0.0.1]) by basalt.tackymt.homeip.net (Postfix) with ESMTP id AEDC583B8; Mon, 18 Jun 2012 06:29:14 +0900 (JST) X-Virus-Scanned: amavisd-new at tackymt.homeip.net Received: from localhost by basalt.tackymt.homeip.net (amavisd-new, unix socket) with ESMTP id X6jkgJBcX10K; Mon, 18 Jun 2012 06:29:12 +0900 (JST) Received: from basalt.tackymt.homeip.net (basalt.tackymt.homeip.net [IPv6:2001:3e0:577:0:20d:61ff:fecc:2253]) by basalt.tackymt.homeip.net (Postfix) with ESMTPSA; Mon, 18 Jun 2012 06:29:12 +0900 (JST) Date: Mon, 18 Jun 2012 06:29:12 +0900 From: Taku YAMAMOTO To: Poul-Henning Kamp Message-Id: <20120618062912.61088c11.taku@tackymt.homeip.net> In-Reply-To: <201206172102.q5HL2mG9032399@svn.freebsd.org> References: <201206172102.q5HL2mG9032399@svn.freebsd.org> X-Mailer: Sylpheed 3.0.3 (GTK+ 2.24.6; i386-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237203 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:29:16 -0000 On Sun, 17 Jun 2012 21:02:48 +0000 (UTC) Poul-Henning Kamp wrote: > Author: phk > Date: Sun Jun 17 21:02:48 2012 > New Revision: 237203 > URL: http://svn.freebsd.org/changeset/base/237203 (snip) > Modified: > head/sys/dev/fb/fbreg.h > > Modified: head/sys/dev/fb/fbreg.h > ============================================================================== > --- head/sys/dev/fb/fbreg.h Sun Jun 17 20:45:45 2012 (r237202) > +++ head/sys/dev/fb/fbreg.h Sun Jun 17 21:02:48 2012 (r237203) > @@ -35,9 +35,16 @@ > > /* some macros */ > #if defined(__amd64__) || defined(__i386__) > -#define bcopy_io(s, d, c) bcopy((void *)(s), (void *)(d), (c)) > -#define bcopy_toio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) > -#define bcopy_fromio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) > + > +static __inline void > +copyw(uint16_t *src, uint16_t *dst, size_t size) > +{ > + while (size--) > + *dst++ = *src++; > +} > +#define bcopy_io(s, d, c) copyw((void*)(s), (void*)(d), (c)) > +#define bcopy_toio(s, d, c) copyw((void*)(s), (void*)(d), (c)) > +#define bcopy_fromio(s, d, c) copyw((void*)(s), (void*)(d), (c)) > #define bzero_io(d, c) bzero((void *)(d), (c)) > #define fill_io(p, d, c) fill((p), (void *)(d), (c)) > #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) > Does this end up with copying 2*size bytes instead of size bytes? -- -|-__ YAMAMOTO, Taku | __ < - A chicken is an egg's way of producing more eggs. - From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:30:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BB9B106564A; Sun, 17 Jun 2012 21:30:25 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 361C78FC15; Sun, 17 Jun 2012 21:30:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HLUPAD033901; Sun, 17 Jun 2012 21:30:25 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HLUPjb033899; Sun, 17 Jun 2012 21:30:25 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201206172130.q5HLUPjb033899@svn.freebsd.org> From: Matt Jacob Date: Sun, 17 Jun 2012 21:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237209 - stable/9/sys/dev/isp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:30:25 -0000 Author: mjacob Date: Sun Jun 17 21:30:24 2012 New Revision: 237209 URL: http://svn.freebsd.org/changeset/base/237209 Log: MFC of 237135 If debug values were set, the default from tval floated down and triggered an attempt to set multiple virtual ports whether you wanted them or not. Modified: stable/9/sys/dev/isp/isp_pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/isp/ (props changed) Modified: stable/9/sys/dev/isp/isp_pci.c ============================================================================== --- stable/9/sys/dev/isp/isp_pci.c Sun Jun 17 21:28:11 2012 (r237208) +++ stable/9/sys/dev/isp/isp_pci.c Sun Jun 17 21:30:24 2012 (r237209) @@ -483,6 +483,7 @@ isp_get_generic_options(device_t dev, is if (bootverbose) { isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; } + tval = 0; (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "vports", &tval); if (tval > 0 && tval < 127) { *nvp = tval; From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:39:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D9400106564A; Sun, 17 Jun 2012 21:39:40 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2D9D8FC0C; Sun, 17 Jun 2012 21:39:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HLde8l034312; Sun, 17 Jun 2012 21:39:40 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HLdeCQ034308; Sun, 17 Jun 2012 21:39:40 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201206172139.q5HLdeCQ034308@svn.freebsd.org> From: Matt Jacob Date: Sun, 17 Jun 2012 21:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237210 - head/sys/dev/isp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:39:41 -0000 Author: mjacob Date: Sun Jun 17 21:39:40 2012 New Revision: 237210 URL: http://svn.freebsd.org/changeset/base/237210 Log: Prepare for FC-Tape support. This involved doing a lot of little cleanups and crosschecks against firmware documentation. We now check and report FC firmware attributes and at least are now prepared for the upper 48 bits of f/w attributes (which are probably for the 8100 or later cards). This involed changing how inbits and outbits are calculated for varios commands, hopefully clearer and cleaner. This also caused me to clean up the actual mailbox register usage. Finally, we are now unconditionally using a CRN for initiator mode. A longstanding issue with the 2400/2500 is that they do *not* support a "Prefer PTP followed by loop", which explains why enabling that caused the f/w to crash. A slightly more invasive change is to let the firmware load entirely drive whether multi_id support is enabled or not. Sponsored by: Spectralogic MFC after: 1 week Modified: head/sys/dev/isp/isp.c head/sys/dev/isp/isp_freebsd.h head/sys/dev/isp/isp_pci.c head/sys/dev/isp/ispmbox.h head/sys/dev/isp/ispreg.h head/sys/dev/isp/ispvar.h Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sun Jun 17 21:30:24 2012 (r237209) +++ head/sys/dev/isp/isp.c Sun Jun 17 21:39:40 2012 (r237210) @@ -159,6 +159,8 @@ void isp_reset(ispsoftc_t *isp, int do_load_defaults) { mbreg_t mbs; + char *buf; + uint64_t fwt; uint32_t code_org, val; int loops, i, dodnld = 1; const char *btype = "????"; @@ -685,9 +687,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d * Do some sanity checking by running a NOP command. * If it succeeds, the ROM firmware is now running. */ - ISP_MEMZERO(&mbs, sizeof (mbs)); - mbs.param[0] = MBOX_NO_OP; - mbs.logval = MBLOGALL; + MBSINIT(&mbs, MBOX_NO_OP, MBLOGALL, 0); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, "NOP command failed (%x)", mbs.param[0]); @@ -700,29 +700,32 @@ isp_reset(ispsoftc_t *isp, int do_load_d */ if (IS_SCSI(isp) || IS_24XX(isp)) { - ISP_MEMZERO(&mbs, sizeof (mbs)); - mbs.param[0] = MBOX_MAILBOX_REG_TEST; - mbs.param[1] = 0xdead; - mbs.param[2] = 0xbeef; - mbs.param[3] = 0xffff; - mbs.param[4] = 0x1111; - mbs.param[5] = 0xa5a5; - mbs.param[6] = 0x0000; - mbs.param[7] = 0x0000; - mbs.logval = MBLOGALL; + static const uint16_t patterns[MAX_MAILBOX] = { + 0x0000, 0xdead, 0xbeef, 0xffff, + 0xa5a5, 0x5a5a, 0x7f7f, 0x7ff7, + 0x3421, 0xabcd, 0xdcba, 0xfeef, + 0xbead, 0xdebe, 0x2222, 0x3333, + 0x5555, 0x6666, 0x7777, 0xaaaa, + 0xffff, 0xdddd, 0x9999, 0x1fbc, + 0x6666, 0x6677, 0x1122, 0x33ff, + 0x0000, 0x0001, 0x1000, 0x1010, + }; + MBSINIT(&mbs, MBOX_MAILBOX_REG_TEST, MBLOGALL, 0); + for (i = 1; i < ISP_NMBOX(isp); i++) { + mbs.param[i] = patterns[i]; + } 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], mbs.param[4], mbs.param[5]); - return; + for (i = 1; i < ISP_NMBOX(isp); i++) { + if (mbs.param[i] != patterns[i]) { + ISP_RESET0(isp); + isp_prt(isp, ISP_LOGERR, "Register Test Failed at Register %d: should have 0x%04x but got 0x%04x", i, patterns[i], mbs.param[i]); + return; + } } - } /* @@ -780,7 +783,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d } MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1); again: - ISP_MEMZERO(&mbs, sizeof (mbs)); + MBSINIT(&mbs, 0, MBLOGALL, 0); if (la < 0x10000 && nw < 0x10000) { mbs.param[0] = MBOX_LOAD_RISC_RAM_2100; mbs.param[1] = la; @@ -818,7 +821,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d mbs.param[8] = la >> 16; isp_prt(isp, ISP_LOGDEBUG0, "LOAD RISC RAM %u words at load address 0x%x", nw, la); } - mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { if (mbs.param[0] == MBOX_HOST_INTERFACE_ERROR) { @@ -872,7 +874,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d wl--; } MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1); - ISP_MEMZERO(&mbs, sizeof (mbs)); + MBSINIT(&mbs, 0, MBLOGALL, 0); if (la < 0x10000) { mbs.param[0] = MBOX_LOAD_RISC_RAM_2100; mbs.param[1] = la; @@ -893,7 +895,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d mbs.param[8] = la >> 16; isp_prt(isp, ISP_LOGDEBUG1, "LOAD RISC RAM %u words at load address 0x%x\n", nw, la); } - mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, "F/W Risc Ram Load Failed"); @@ -933,11 +934,9 @@ isp_reset(ispsoftc_t *isp, int do_load_d isp->isp_mbxworkp = &ucd.np[1]; isp->isp_mbxwrk0 = ucd.np[3] - 1; isp->isp_mbxwrk1 = code_org + 1; - ISP_MEMZERO(&mbs, sizeof (mbs)); - mbs.param[0] = MBOX_WRITE_RAM_WORD; + MBSINIT(&mbs, MBOX_WRITE_RAM_WORD, MBLOGNONE, 0); mbs.param[1] = code_org; mbs.param[2] = ucd.np[0]; - mbs.logval = MBLOGNONE; isp_prt(isp, ISP_LOGDEBUG1, "WRITE RAM %u words at load address 0x%x\n", ucd.np[3], code_org); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { @@ -954,7 +953,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d * If we loaded firmware, verify its checksum */ if (isp->isp_loaded_fw) { - ISP_MEMZERO(&mbs, sizeof (mbs)); + MBSINIT(&mbs, MBOX_VERIFY_CHECKSUM, MBLOGNONE, 0); mbs.param[0] = MBOX_VERIFY_CHECKSUM; if (IS_24XX(isp)) { mbs.param[1] = code_org >> 16; @@ -978,7 +977,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d */ - MBSINIT(&mbs, MBOX_EXEC_FIRMWARE, MBLOGALL, 1000000); + MBSINIT(&mbs, MBOX_EXEC_FIRMWARE, MBLOGALL, 5000000); if (IS_24XX(isp)) { mbs.param[1] = code_org >> 16; mbs.param[2] = code_org; @@ -1071,9 +1070,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d isp->isp_fwrev[2] = mbs.param[3]; } - isp_prt(isp, ISP_LOGCONFIG, "Board Type %s, Chip Revision 0x%x, %s F/W Revision %d.%d.%d", - btype, isp->isp_revision, dodnld? "loaded" : "resident", isp->isp_fwrev[0], isp->isp_fwrev[1], isp->isp_fwrev[2]); - if (IS_FC(isp)) { /* * We do not believe firmware attributes for 2100 code less @@ -1090,9 +1086,12 @@ isp_reset(ispsoftc_t *isp, int do_load_d #endif } else { isp->isp_fwattr = mbs.param[6]; - isp_prt(isp, ISP_LOGDEBUG0, "Firmware Attributes = 0x%x", mbs.param[6]); } - } else { + if (IS_24XX(isp) && (isp->isp_fwattr & ISP2400_FW_ATTR_EXTNDED)) { + isp->isp_fwattr ^= ISP2400_FW_ATTR_EXTNDED; + isp->isp_fwattr |= (((uint64_t) mbs.param[15]) << 16) | (((uint64_t) mbs.param[16]) << 32) | (((uint64_t) mbs.param[17]) << 48); + } + } else if (IS_SCSI(isp)) { #ifndef ISP_TARGET_MODE isp->isp_fwattr = ISP_FW_ATTR_TMODE; #else @@ -1100,6 +1099,95 @@ isp_reset(ispsoftc_t *isp, int do_load_d #endif } + isp_prt(isp, ISP_LOGCONFIG, "Board Type %s, Chip Revision 0x%x, %s F/W Revision %d.%d.%d", + btype, isp->isp_revision, dodnld? "loaded" : "resident", isp->isp_fwrev[0], isp->isp_fwrev[1], isp->isp_fwrev[2]); + + fwt = isp->isp_fwattr; + if (IS_24XX(isp)) { + buf = FCPARAM(isp, 0)->isp_scratch; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:"); + if (fwt & ISP2400_FW_ATTR_CLASS2) { + fwt ^=ISP2400_FW_ATTR_CLASS2; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s Class2", buf); + } + if (fwt & ISP2400_FW_ATTR_IP) { + fwt ^=ISP2400_FW_ATTR_IP; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s IP", buf); + } + if (fwt & ISP2400_FW_ATTR_MULTIID) { + fwt ^=ISP2400_FW_ATTR_MULTIID; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s MultiID", buf); + } + if (fwt & ISP2400_FW_ATTR_SB2) { + fwt ^=ISP2400_FW_ATTR_SB2; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s SB2", buf); + } + if (fwt & ISP2400_FW_ATTR_T10CRC) { + fwt ^=ISP2400_FW_ATTR_T10CRC; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s T10CRC", buf); + } + if (fwt & ISP2400_FW_ATTR_VI) { + fwt ^=ISP2400_FW_ATTR_VI; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VI", buf); + } + if (fwt & ISP2400_FW_ATTR_VP0) { + fwt ^= ISP2400_FW_ATTR_VP0; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VP0_Decoupling", buf); + } + if (fwt & ISP2400_FW_ATTR_EXPFW) { + fwt ^= ISP2400_FW_ATTR_EXPFW; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (Experimental)", buf); + } + fwt &= ~ISP2400_FW_ATTR_EXTNDED; + if (fwt) { + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%jx)", buf, (uintmax_t)fwt); + } + isp_prt(isp, ISP_LOGCONFIG, "%s", buf); + } else if (IS_FC(isp)) { + buf = FCPARAM(isp, 0)->isp_scratch; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:"); + if (fwt & ISP_FW_ATTR_TMODE) { + fwt ^=ISP_FW_ATTR_TMODE; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s TargetMode", buf); + } + if (fwt & ISP_FW_ATTR_SCCLUN) { + fwt ^=ISP_FW_ATTR_SCCLUN; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s SCC-Lun", buf); + } + if (fwt & ISP_FW_ATTR_FABRIC) { + fwt ^=ISP_FW_ATTR_FABRIC; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s Fabric", buf); + } + if (fwt & ISP_FW_ATTR_CLASS2) { + fwt ^=ISP_FW_ATTR_CLASS2; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s Class2", buf); + } + if (fwt & ISP_FW_ATTR_FCTAPE) { + fwt ^=ISP_FW_ATTR_FCTAPE; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s FC-Tape", buf); + } + if (fwt & ISP_FW_ATTR_IP) { + fwt ^=ISP_FW_ATTR_IP; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s IP", buf); + } + if (fwt & ISP_FW_ATTR_VI) { + fwt ^=ISP_FW_ATTR_VI; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VI", buf); + } + if (fwt & ISP_FW_ATTR_VI_SOLARIS) { + fwt ^=ISP_FW_ATTR_VI_SOLARIS; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s VI_SOLARIS", buf); + } + if (fwt & ISP_FW_ATTR_2KLOGINS) { + fwt ^=ISP_FW_ATTR_2KLOGINS; + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s 2K-Login", buf); + } + if (fwt != 0) { + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%jx)", buf, (uintmax_t)fwt); + } + isp_prt(isp, ISP_LOGCONFIG, "%s", buf); + } + if (!IS_24XX(isp)) { MBSINIT(&mbs, MBOX_GET_FIRMWARE_STATUS, MBLOGALL, 0); isp_mboxcmd(isp, &mbs); @@ -1768,6 +1856,7 @@ isp_fibre_init_2400(ispsoftc_t *isp) isp_icb_2400_t local, *icbp = &local; mbreg_t mbs; int chan; + int ownloopid = 0; /* * Check to see whether all channels have *some* kind of role @@ -1831,7 +1920,6 @@ isp_fibre_init_2400(ispsoftc_t *isp) * Get current resource count */ MBSINIT(&mbs, MBOX_GET_RESOURCE_COUNT, MBLOGALL, 0); - mbs.obits = 0x4cf; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return; @@ -1840,27 +1928,18 @@ isp_fibre_init_2400(ispsoftc_t *isp) } + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; icbp->icb_hardaddr = fcp->isp_loopid; if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) { icbp->icb_hardaddr = 0; + ownloopid = 0; } - /* - * Force this on. - */ - icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; + if (ownloopid) + icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; icbp->icb_fwoptions2 = fcp->isp_xfwoptions; switch (isp->isp_confopts & ISP_CFG_PORT_PREF) { -#if 0 - case ISP_CFG_NPORT: - /* - * XXX: This causes the f/w to crash. - */ - icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; - icbp->icb_fwoptions2 |= ICB2400_OPT2_PTP_2_LOOP; - break; -#endif case ISP_CFG_NPORT_ONLY: icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; icbp->icb_fwoptions2 |= ICB2400_OPT2_PTP_ONLY; @@ -1870,14 +1949,12 @@ isp_fibre_init_2400(ispsoftc_t *isp) icbp->icb_fwoptions2 |= ICB2400_OPT2_LOOP_ONLY; break; default: + /* ISP_CFG_PTP_2_LOOP not available in 24XX/25XX */ icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; icbp->icb_fwoptions2 |= ICB2400_OPT2_LOOP_2_PTP; break; } - /* force this on for now */ - icbp->icb_fwoptions2 |= ICB2400_OPT2_ZIO; - switch (icbp->icb_fwoptions2 & ICB2400_OPT2_TIMER_MASK) { case ICB2400_OPT2_ZIO: case ICB2400_OPT2_ZIO1: @@ -1891,12 +1968,10 @@ isp_fibre_init_2400(ispsoftc_t *isp) break; } - /* - * We don't support FCTAPE, so clear it. - */ - icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE; - icbp->icb_fwoptions3 = fcp->isp_zfwoptions; + if ((icbp->icb_fwoptions3 & ICB2400_OPT3_RSPSZ_MASK) == 0) { + icbp->icb_fwoptions3 |= ICB2400_OPT3_RSPSZ_24; + } icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_AUTO; if (isp->isp_confopts & ISP_CFG_ONEGB) { icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_ONEGB; @@ -1904,11 +1979,12 @@ isp_fibre_init_2400(ispsoftc_t *isp) icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_TWOGB; } else if (isp->isp_confopts & ISP_CFG_FOURGB) { icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_FOURGB; + } else if (IS_25XX(isp) && (isp->isp_confopts & ISP_CFG_EIGHTGB)) { + icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_EIGHTGB; } else { icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_AUTO; } - - if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0) { + if (ownloopid == 0) { icbp->icb_fwoptions3 |= ICB2400_OPT3_SOFTID; } icbp->icb_logintime = ICB_LOGIN_TOV; @@ -2569,11 +2645,7 @@ isp_fclink_test(ispsoftc_t *isp, int cha * Get our Loop ID and Port ID. */ MBSINIT(&mbs, MBOX_GET_LOOP_ID, MBLOGALL, 0); - if (ISP_CAP_MULTI_ID(isp)) { - mbs.param[9] = chan; - mbs.ibits = (1 << 9); - mbs.obits = (1 << 7); - } + mbs.param[9] = chan; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return (-1); @@ -2676,12 +2748,14 @@ isp_fclink_test(ispsoftc_t *isp, int cha lp->new_portid = lp->portid; lp->new_roles = lp->roles; if (IS_24XX(isp)) { - fcp->inorder = (mbs.param[7] & ISP24XX_INORDER) != 0; - if (ISP_FW_NEWER_THAN(isp, 4, 0, 27)) { - fcp->npiv_fabric = (mbs.param[7] & ISP24XX_NPIV_SAN) != 0; - if (fcp->npiv_fabric) { - isp_prt(isp, ISP_LOGCONFIG, "fabric supports NP-IV"); - } + if (check_for_fabric) { + /* + * The mbs is still hanging out from the MBOX_GET_LOOP_ID above. + */ + fcp->isp_fabric_params = mbs.param[7]; + isp_prt(isp, ISP_LOGCONFIG, "fabric params 0x%x", mbs.param[7]); + } else { + fcp->isp_fabric_params = 0; } if (chan) { fcp->isp_sns_hdl = NPH_SNS_HDLBASE + chan; @@ -4427,6 +4501,7 @@ isp_start(XS_T *xs) t7->req_lun[0] |= 0x40; } t7->req_lun[1] = XS_LUN(xs); + FCP_NEXT_CRN(isp, xs, t7->req_crn, XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs)); tptr = &t7->req_time; cdbp = t7->req_cdb; cdblen = ISP_MIN(cdblen, sizeof (t7->req_cdb)); @@ -4907,7 +4982,7 @@ again: if (isp->isp_mboxbsy) { int obits = isp->isp_obits; isp->isp_mboxtmp[0] = mbox; - for (i = 1; i < MAX_MAILBOX(isp); i++) { + for (i = 1; i < ISP_NMBOX(isp); i++) { if ((obits & (1 << i)) == 0) { continue; } @@ -6667,105 +6742,106 @@ isp_mbox_continue(ispsoftc_t *isp) return (0); } -#define HIWRD(x) ((x) >> 16) -#define LOWRD(x) ((x) & 0xffff) -#define ISPOPMAP(a, b) (((a) << 16) | (b)) -static const uint32_t mbpscsi[] = { - ISPOPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */ - ISPOPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */ - ISPOPMAP(0x03, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */ - ISPOPMAP(0x1f, 0x01), /* 0x03: MBOX_DUMP_RAM */ - ISPOPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */ - ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */ - ISPOPMAP(0x3f, 0x3f), /* 0x06: MBOX_MAILBOX_REG_TEST */ - ISPOPMAP(0x07, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */ - ISPOPMAP(0x01, 0x0f), /* 0x08: MBOX_ABOUT_FIRMWARE */ - ISPOPMAP(0x00, 0x00), /* 0x09: */ - ISPOPMAP(0x00, 0x00), /* 0x0a: */ - ISPOPMAP(0x00, 0x00), /* 0x0b: */ - ISPOPMAP(0x00, 0x00), /* 0x0c: */ - ISPOPMAP(0x00, 0x00), /* 0x0d: */ - ISPOPMAP(0x01, 0x05), /* 0x0e: MBOX_CHECK_FIRMWARE */ - ISPOPMAP(0x00, 0x00), /* 0x0f: */ - ISPOPMAP(0x1f, 0x1f), /* 0x10: MBOX_INIT_REQ_QUEUE */ - ISPOPMAP(0x3f, 0x3f), /* 0x11: MBOX_INIT_RES_QUEUE */ - ISPOPMAP(0x0f, 0x0f), /* 0x12: MBOX_EXECUTE_IOCB */ - ISPOPMAP(0x03, 0x03), /* 0x13: MBOX_WAKE_UP */ - ISPOPMAP(0x01, 0x3f), /* 0x14: MBOX_STOP_FIRMWARE */ - ISPOPMAP(0x0f, 0x0f), /* 0x15: MBOX_ABORT */ - ISPOPMAP(0x03, 0x03), /* 0x16: MBOX_ABORT_DEVICE */ - ISPOPMAP(0x07, 0x07), /* 0x17: MBOX_ABORT_TARGET */ - ISPOPMAP(0x07, 0x07), /* 0x18: MBOX_BUS_RESET */ - ISPOPMAP(0x03, 0x07), /* 0x19: MBOX_STOP_QUEUE */ - ISPOPMAP(0x03, 0x07), /* 0x1a: MBOX_START_QUEUE */ - ISPOPMAP(0x03, 0x07), /* 0x1b: MBOX_SINGLE_STEP_QUEUE */ - ISPOPMAP(0x03, 0x07), /* 0x1c: MBOX_ABORT_QUEUE */ - ISPOPMAP(0x03, 0x4f), /* 0x1d: MBOX_GET_DEV_QUEUE_STATUS */ - ISPOPMAP(0x00, 0x00), /* 0x1e: */ - ISPOPMAP(0x01, 0x07), /* 0x1f: MBOX_GET_FIRMWARE_STATUS */ - ISPOPMAP(0x01, 0x07), /* 0x20: MBOX_GET_INIT_SCSI_ID */ - ISPOPMAP(0x01, 0x07), /* 0x21: MBOX_GET_SELECT_TIMEOUT */ - ISPOPMAP(0x01, 0xc7), /* 0x22: MBOX_GET_RETRY_COUNT */ - ISPOPMAP(0x01, 0x07), /* 0x23: MBOX_GET_TAG_AGE_LIMIT */ - ISPOPMAP(0x01, 0x03), /* 0x24: MBOX_GET_CLOCK_RATE */ - ISPOPMAP(0x01, 0x07), /* 0x25: MBOX_GET_ACT_NEG_STATE */ - ISPOPMAP(0x01, 0x07), /* 0x26: MBOX_GET_ASYNC_DATA_SETUP_TIME */ - ISPOPMAP(0x01, 0x07), /* 0x27: MBOX_GET_PCI_PARAMS */ - ISPOPMAP(0x03, 0x4f), /* 0x28: MBOX_GET_TARGET_PARAMS */ - ISPOPMAP(0x03, 0x0f), /* 0x29: MBOX_GET_DEV_QUEUE_PARAMS */ - ISPOPMAP(0x01, 0x07), /* 0x2a: MBOX_GET_RESET_DELAY_PARAMS */ - ISPOPMAP(0x00, 0x00), /* 0x2b: */ - ISPOPMAP(0x00, 0x00), /* 0x2c: */ - ISPOPMAP(0x00, 0x00), /* 0x2d: */ - ISPOPMAP(0x00, 0x00), /* 0x2e: */ - ISPOPMAP(0x00, 0x00), /* 0x2f: */ - ISPOPMAP(0x03, 0x03), /* 0x30: MBOX_SET_INIT_SCSI_ID */ - ISPOPMAP(0x07, 0x07), /* 0x31: MBOX_SET_SELECT_TIMEOUT */ - ISPOPMAP(0xc7, 0xc7), /* 0x32: MBOX_SET_RETRY_COUNT */ - ISPOPMAP(0x07, 0x07), /* 0x33: MBOX_SET_TAG_AGE_LIMIT */ - ISPOPMAP(0x03, 0x03), /* 0x34: MBOX_SET_CLOCK_RATE */ - ISPOPMAP(0x07, 0x07), /* 0x35: MBOX_SET_ACT_NEG_STATE */ - ISPOPMAP(0x07, 0x07), /* 0x36: MBOX_SET_ASYNC_DATA_SETUP_TIME */ - ISPOPMAP(0x07, 0x07), /* 0x37: MBOX_SET_PCI_CONTROL_PARAMS */ - ISPOPMAP(0x4f, 0x4f), /* 0x38: MBOX_SET_TARGET_PARAMS */ - ISPOPMAP(0x0f, 0x0f), /* 0x39: MBOX_SET_DEV_QUEUE_PARAMS */ - ISPOPMAP(0x07, 0x07), /* 0x3a: MBOX_SET_RESET_DELAY_PARAMS */ - ISPOPMAP(0x00, 0x00), /* 0x3b: */ - ISPOPMAP(0x00, 0x00), /* 0x3c: */ - ISPOPMAP(0x00, 0x00), /* 0x3d: */ - ISPOPMAP(0x00, 0x00), /* 0x3e: */ - ISPOPMAP(0x00, 0x00), /* 0x3f: */ - ISPOPMAP(0x01, 0x03), /* 0x40: MBOX_RETURN_BIOS_BLOCK_ADDR */ - ISPOPMAP(0x3f, 0x01), /* 0x41: MBOX_WRITE_FOUR_RAM_WORDS */ - ISPOPMAP(0x03, 0x07), /* 0x42: MBOX_EXEC_BIOS_IOCB */ - ISPOPMAP(0x00, 0x00), /* 0x43: */ - ISPOPMAP(0x00, 0x00), /* 0x44: */ - ISPOPMAP(0x03, 0x03), /* 0x45: SET SYSTEM PARAMETER */ - ISPOPMAP(0x01, 0x03), /* 0x46: GET SYSTEM PARAMETER */ - ISPOPMAP(0x00, 0x00), /* 0x47: */ - ISPOPMAP(0x01, 0xcf), /* 0x48: GET SCAM CONFIGURATION */ - ISPOPMAP(0xcf, 0xcf), /* 0x49: SET SCAM CONFIGURATION */ - ISPOPMAP(0x03, 0x03), /* 0x4a: MBOX_SET_FIRMWARE_FEATURES */ - ISPOPMAP(0x01, 0x03), /* 0x4b: MBOX_GET_FIRMWARE_FEATURES */ - ISPOPMAP(0x00, 0x00), /* 0x4c: */ - ISPOPMAP(0x00, 0x00), /* 0x4d: */ - ISPOPMAP(0x00, 0x00), /* 0x4e: */ - ISPOPMAP(0x00, 0x00), /* 0x4f: */ - ISPOPMAP(0xdf, 0xdf), /* 0x50: LOAD RAM A64 */ - ISPOPMAP(0xdf, 0xdf), /* 0x51: DUMP RAM A64 */ - ISPOPMAP(0xdf, 0xff), /* 0x52: INITIALIZE REQUEST QUEUE A64 */ - ISPOPMAP(0xef, 0xff), /* 0x53: INITIALIZE RESPONSE QUEUE A64 */ - ISPOPMAP(0xcf, 0x01), /* 0x54: EXECUCUTE COMMAND IOCB A64 */ - ISPOPMAP(0x07, 0x01), /* 0x55: ENABLE TARGET MODE */ - ISPOPMAP(0x03, 0x0f), /* 0x56: GET TARGET STATUS */ - ISPOPMAP(0x00, 0x00), /* 0x57: */ - ISPOPMAP(0x00, 0x00), /* 0x58: */ - ISPOPMAP(0x00, 0x00), /* 0x59: */ - ISPOPMAP(0x03, 0x03), /* 0x5a: SET DATA OVERRUN RECOVERY MODE */ - ISPOPMAP(0x01, 0x03), /* 0x5b: GET DATA OVERRUN RECOVERY MODE */ - ISPOPMAP(0x0f, 0x0f), /* 0x5c: SET HOST DATA */ - ISPOPMAP(0x01, 0x01) /* 0x5d: GET NOST DATA */ +#define ISP_SCSI_IBITS(op) (mbpscsi[((op)<<1)]) +#define ISP_SCSI_OBITS(op) (mbpscsi[((op)<<1) + 1]) +#define ISP_SCSI_OPMAP(in, out) in, out +static const uint8_t mbpscsi[] = { + ISP_SCSI_OPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */ + ISP_SCSI_OPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */ + ISP_SCSI_OPMAP(0x03, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */ + ISP_SCSI_OPMAP(0x1f, 0x01), /* 0x03: MBOX_DUMP_RAM */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */ + ISP_SCSI_OPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */ + ISP_SCSI_OPMAP(0x3f, 0x3f), /* 0x06: MBOX_MAILBOX_REG_TEST */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */ + ISP_SCSI_OPMAP(0x01, 0x0f), /* 0x08: MBOX_ABOUT_FIRMWARE */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x09: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0a: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0b: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0c: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0d: */ + ISP_SCSI_OPMAP(0x01, 0x05), /* 0x0e: MBOX_CHECK_FIRMWARE */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x0f: */ + ISP_SCSI_OPMAP(0x1f, 0x1f), /* 0x10: MBOX_INIT_REQ_QUEUE */ + ISP_SCSI_OPMAP(0x3f, 0x3f), /* 0x11: MBOX_INIT_RES_QUEUE */ + ISP_SCSI_OPMAP(0x0f, 0x0f), /* 0x12: MBOX_EXECUTE_IOCB */ + ISP_SCSI_OPMAP(0x03, 0x03), /* 0x13: MBOX_WAKE_UP */ + ISP_SCSI_OPMAP(0x01, 0x3f), /* 0x14: MBOX_STOP_FIRMWARE */ + ISP_SCSI_OPMAP(0x0f, 0x0f), /* 0x15: MBOX_ABORT */ + ISP_SCSI_OPMAP(0x03, 0x03), /* 0x16: MBOX_ABORT_DEVICE */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x17: MBOX_ABORT_TARGET */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x18: MBOX_BUS_RESET */ + ISP_SCSI_OPMAP(0x03, 0x07), /* 0x19: MBOX_STOP_QUEUE */ + ISP_SCSI_OPMAP(0x03, 0x07), /* 0x1a: MBOX_START_QUEUE */ + ISP_SCSI_OPMAP(0x03, 0x07), /* 0x1b: MBOX_SINGLE_STEP_QUEUE */ + ISP_SCSI_OPMAP(0x03, 0x07), /* 0x1c: MBOX_ABORT_QUEUE */ + ISP_SCSI_OPMAP(0x03, 0x4f), /* 0x1d: MBOX_GET_DEV_QUEUE_STATUS */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x1e: */ + ISP_SCSI_OPMAP(0x01, 0x07), /* 0x1f: MBOX_GET_FIRMWARE_STATUS */ + ISP_SCSI_OPMAP(0x01, 0x07), /* 0x20: MBOX_GET_INIT_SCSI_ID */ + ISP_SCSI_OPMAP(0x01, 0x07), /* 0x21: MBOX_GET_SELECT_TIMEOUT */ + ISP_SCSI_OPMAP(0x01, 0xc7), /* 0x22: MBOX_GET_RETRY_COUNT */ + ISP_SCSI_OPMAP(0x01, 0x07), /* 0x23: MBOX_GET_TAG_AGE_LIMIT */ + ISP_SCSI_OPMAP(0x01, 0x03), /* 0x24: MBOX_GET_CLOCK_RATE */ + ISP_SCSI_OPMAP(0x01, 0x07), /* 0x25: MBOX_GET_ACT_NEG_STATE */ + ISP_SCSI_OPMAP(0x01, 0x07), /* 0x26: MBOX_GET_ASYNC_DATA_SETUP_TIME */ + ISP_SCSI_OPMAP(0x01, 0x07), /* 0x27: MBOX_GET_PCI_PARAMS */ + ISP_SCSI_OPMAP(0x03, 0x4f), /* 0x28: MBOX_GET_TARGET_PARAMS */ + ISP_SCSI_OPMAP(0x03, 0x0f), /* 0x29: MBOX_GET_DEV_QUEUE_PARAMS */ + ISP_SCSI_OPMAP(0x01, 0x07), /* 0x2a: MBOX_GET_RESET_DELAY_PARAMS */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2b: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2c: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2d: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2e: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x2f: */ + ISP_SCSI_OPMAP(0x03, 0x03), /* 0x30: MBOX_SET_INIT_SCSI_ID */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x31: MBOX_SET_SELECT_TIMEOUT */ + ISP_SCSI_OPMAP(0xc7, 0xc7), /* 0x32: MBOX_SET_RETRY_COUNT */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x33: MBOX_SET_TAG_AGE_LIMIT */ + ISP_SCSI_OPMAP(0x03, 0x03), /* 0x34: MBOX_SET_CLOCK_RATE */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x35: MBOX_SET_ACT_NEG_STATE */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x36: MBOX_SET_ASYNC_DATA_SETUP_TIME */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x37: MBOX_SET_PCI_CONTROL_PARAMS */ + ISP_SCSI_OPMAP(0x4f, 0x4f), /* 0x38: MBOX_SET_TARGET_PARAMS */ + ISP_SCSI_OPMAP(0x0f, 0x0f), /* 0x39: MBOX_SET_DEV_QUEUE_PARAMS */ + ISP_SCSI_OPMAP(0x07, 0x07), /* 0x3a: MBOX_SET_RESET_DELAY_PARAMS */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3b: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3c: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3d: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3e: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x3f: */ + ISP_SCSI_OPMAP(0x01, 0x03), /* 0x40: MBOX_RETURN_BIOS_BLOCK_ADDR */ + ISP_SCSI_OPMAP(0x3f, 0x01), /* 0x41: MBOX_WRITE_FOUR_RAM_WORDS */ + ISP_SCSI_OPMAP(0x03, 0x07), /* 0x42: MBOX_EXEC_BIOS_IOCB */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x43: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x44: */ + ISP_SCSI_OPMAP(0x03, 0x03), /* 0x45: SET SYSTEM PARAMETER */ + ISP_SCSI_OPMAP(0x01, 0x03), /* 0x46: GET SYSTEM PARAMETER */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x47: */ + ISP_SCSI_OPMAP(0x01, 0xcf), /* 0x48: GET SCAM CONFIGURATION */ + ISP_SCSI_OPMAP(0xcf, 0xcf), /* 0x49: SET SCAM CONFIGURATION */ + ISP_SCSI_OPMAP(0x03, 0x03), /* 0x4a: MBOX_SET_FIRMWARE_FEATURES */ + ISP_SCSI_OPMAP(0x01, 0x03), /* 0x4b: MBOX_GET_FIRMWARE_FEATURES */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x4c: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x4d: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x4e: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x4f: */ + ISP_SCSI_OPMAP(0xdf, 0xdf), /* 0x50: LOAD RAM A64 */ + ISP_SCSI_OPMAP(0xdf, 0xdf), /* 0x51: DUMP RAM A64 */ + ISP_SCSI_OPMAP(0xdf, 0xff), /* 0x52: INITIALIZE REQUEST QUEUE A64 */ + ISP_SCSI_OPMAP(0xef, 0xff), /* 0x53: INITIALIZE RESPONSE QUEUE A64 */ + ISP_SCSI_OPMAP(0xcf, 0x01), /* 0x54: EXECUCUTE COMMAND IOCB A64 */ + ISP_SCSI_OPMAP(0x07, 0x01), /* 0x55: ENABLE TARGET MODE */ + ISP_SCSI_OPMAP(0x03, 0x0f), /* 0x56: GET TARGET STATUS */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x57: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x58: */ + ISP_SCSI_OPMAP(0x00, 0x00), /* 0x59: */ + ISP_SCSI_OPMAP(0x03, 0x03), /* 0x5a: SET DATA OVERRUN RECOVERY MODE */ + ISP_SCSI_OPMAP(0x01, 0x03), /* 0x5b: GET DATA OVERRUN RECOVERY MODE */ + ISP_SCSI_OPMAP(0x0f, 0x0f), /* 0x5c: SET HOST DATA */ + ISP_SCSI_OPMAP(0x01, 0x01) /* 0x5d: GET NOST DATA */ }; +#define MAX_SCSI_OPCODE 0x5d static const char *scsi_mbcmd_names[] = { "NO-OP", @@ -6864,135 +6940,142 @@ static const char *scsi_mbcmd_names[] = "GET NOST DATA", }; +#define ISP_FC_IBITS(op) ((mbpfc[((op)<<3) + 0] << 24) | (mbpfc[((op)<<3) + 1] << 16) | (mbpfc[((op)<<3) + 2] << 8) | (mbpfc[((op)<<3) + 3])) +#define ISP_FC_OBITS(op) ((mbpfc[((op)<<3) + 4] << 24) | (mbpfc[((op)<<3) + 5] << 16) | (mbpfc[((op)<<3) + 6] << 8) | (mbpfc[((op)<<3) + 7])) + +#define ISP_FC_OPMAP(in0, out0) 0, 0, 0, in0, 0, 0, 0, out0 +#define ISP_FC_OPMAP_HALF(in1, in0, out1, out0) 0, 0, in1, in0, 0, 0, out1, out0 +#define ISP_FC_OPMAP_FULL(in3, in2, in1, in0, out3, out2, out1, out0) in3, in2, in1, in0, out3, out2, out1, out0 static const uint32_t mbpfc[] = { - ISPOPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */ - ISPOPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */ - ISPOPMAP(0x0f, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */ - ISPOPMAP(0xdf, 0x01), /* 0x03: MBOX_DUMP_RAM */ - ISPOPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */ - ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */ - ISPOPMAP(0xff, 0xff), /* 0x06: MBOX_MAILBOX_REG_TEST */ - ISPOPMAP(0x07, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */ - ISPOPMAP(0x01, 0x4f), /* 0x08: MBOX_ABOUT_FIRMWARE */ - ISPOPMAP(0xdf, 0x01), /* 0x09: MBOX_LOAD_RISC_RAM_2100 */ - ISPOPMAP(0xdf, 0x01), /* 0x0a: DUMP RAM */ - ISPOPMAP(0x1ff, 0x01), /* 0x0b: MBOX_LOAD_RISC_RAM */ - ISPOPMAP(0x00, 0x00), /* 0x0c: */ - ISPOPMAP(0x10f, 0x01), /* 0x0d: MBOX_WRITE_RAM_WORD_EXTENDED */ - ISPOPMAP(0x01, 0x05), /* 0x0e: MBOX_CHECK_FIRMWARE */ - ISPOPMAP(0x103, 0x0d), /* 0x0f: MBOX_READ_RAM_WORD_EXTENDED */ - ISPOPMAP(0x1f, 0x11), /* 0x10: MBOX_INIT_REQ_QUEUE */ - ISPOPMAP(0x2f, 0x21), /* 0x11: MBOX_INIT_RES_QUEUE */ - ISPOPMAP(0x0f, 0x01), /* 0x12: MBOX_EXECUTE_IOCB */ - ISPOPMAP(0x03, 0x03), /* 0x13: MBOX_WAKE_UP */ - ISPOPMAP(0x01, 0xff), /* 0x14: MBOX_STOP_FIRMWARE */ - ISPOPMAP(0x4f, 0x01), /* 0x15: MBOX_ABORT */ - ISPOPMAP(0x07, 0x01), /* 0x16: MBOX_ABORT_DEVICE */ - ISPOPMAP(0x07, 0x01), /* 0x17: MBOX_ABORT_TARGET */ - ISPOPMAP(0x03, 0x03), /* 0x18: MBOX_BUS_RESET */ - ISPOPMAP(0x07, 0x05), /* 0x19: MBOX_STOP_QUEUE */ - ISPOPMAP(0x07, 0x05), /* 0x1a: MBOX_START_QUEUE */ - ISPOPMAP(0x07, 0x05), /* 0x1b: MBOX_SINGLE_STEP_QUEUE */ - ISPOPMAP(0x07, 0x05), /* 0x1c: MBOX_ABORT_QUEUE */ - ISPOPMAP(0x07, 0x03), /* 0x1d: MBOX_GET_DEV_QUEUE_STATUS */ - ISPOPMAP(0x00, 0x00), /* 0x1e: */ - ISPOPMAP(0x01, 0x07), /* 0x1f: MBOX_GET_FIRMWARE_STATUS */ - ISPOPMAP(0x01, 0x4f), /* 0x20: MBOX_GET_LOOP_ID */ - ISPOPMAP(0x00, 0x00), /* 0x21: */ - ISPOPMAP(0x01, 0x07), /* 0x22: MBOX_GET_RETRY_COUNT */ - ISPOPMAP(0x00, 0x00), /* 0x23: */ - ISPOPMAP(0x00, 0x00), /* 0x24: */ - ISPOPMAP(0x00, 0x00), /* 0x25: */ - ISPOPMAP(0x00, 0x00), /* 0x26: */ - ISPOPMAP(0x00, 0x00), /* 0x27: */ - ISPOPMAP(0x01, 0x03), /* 0x28: MBOX_GET_FIRMWARE_OPTIONS */ - ISPOPMAP(0x03, 0x07), /* 0x29: MBOX_GET_PORT_QUEUE_PARAMS */ - ISPOPMAP(0x00, 0x00), /* 0x2a: */ - ISPOPMAP(0x00, 0x00), /* 0x2b: */ - ISPOPMAP(0x00, 0x00), /* 0x2c: */ - ISPOPMAP(0x00, 0x00), /* 0x2d: */ - ISPOPMAP(0x00, 0x00), /* 0x2e: */ - ISPOPMAP(0x00, 0x00), /* 0x2f: */ - ISPOPMAP(0x00, 0x00), /* 0x30: */ - ISPOPMAP(0x00, 0x00), /* 0x31: */ - ISPOPMAP(0x07, 0x07), /* 0x32: MBOX_SET_RETRY_COUNT */ - ISPOPMAP(0x00, 0x00), /* 0x33: */ - ISPOPMAP(0x00, 0x00), /* 0x34: */ - ISPOPMAP(0x00, 0x00), /* 0x35: */ - ISPOPMAP(0x00, 0x00), /* 0x36: */ - ISPOPMAP(0x00, 0x00), /* 0x37: */ - ISPOPMAP(0x0f, 0x01), /* 0x38: MBOX_SET_FIRMWARE_OPTIONS */ - ISPOPMAP(0x0f, 0x07), /* 0x39: MBOX_SET_PORT_QUEUE_PARAMS */ - ISPOPMAP(0x00, 0x00), /* 0x3a: */ - ISPOPMAP(0x00, 0x00), /* 0x3b: */ - ISPOPMAP(0x00, 0x00), /* 0x3c: */ - ISPOPMAP(0x00, 0x00), /* 0x3d: */ - ISPOPMAP(0x00, 0x00), /* 0x3e: */ - ISPOPMAP(0x00, 0x00), /* 0x3f: */ - ISPOPMAP(0x03, 0x01), /* 0x40: MBOX_LOOP_PORT_BYPASS */ - ISPOPMAP(0x03, 0x01), /* 0x41: MBOX_LOOP_PORT_ENABLE */ - ISPOPMAP(0x03, 0x07), /* 0x42: MBOX_GET_RESOURCE_COUNT */ - ISPOPMAP(0x01, 0x01), /* 0x43: MBOX_REQUEST_OFFLINE_MODE */ - ISPOPMAP(0x00, 0x00), /* 0x44: */ - ISPOPMAP(0x00, 0x00), /* 0x45: */ - ISPOPMAP(0x00, 0x00), /* 0x46: */ - ISPOPMAP(0xcf, 0x03), /* 0x47: GET PORT_DATABASE ENHANCED */ - ISPOPMAP(0xcd, 0x01), /* 0x48: MBOX_INIT_FIRMWARE_MULTI_ID */ - ISPOPMAP(0xcd, 0x01), /* 0x49: MBOX_GET_VP_DATABASE */ - ISPOPMAP(0x2cd, 0x01), /* 0x4a: MBOX_GET_VP_DATABASE_ENTRY */ - ISPOPMAP(0x00, 0x00), /* 0x4b: */ - ISPOPMAP(0x00, 0x00), /* 0x4c: */ - ISPOPMAP(0x00, 0x00), /* 0x4d: */ - ISPOPMAP(0x00, 0x00), /* 0x4e: */ - ISPOPMAP(0x00, 0x00), /* 0x4f: */ - ISPOPMAP(0x00, 0x00), /* 0x50: */ - ISPOPMAP(0x00, 0x00), /* 0x51: */ - ISPOPMAP(0x00, 0x00), /* 0x52: */ - ISPOPMAP(0x00, 0x00), /* 0x53: */ - ISPOPMAP(0xcf, 0x01), /* 0x54: EXECUTE IOCB A64 */ - ISPOPMAP(0x00, 0x00), /* 0x55: */ - ISPOPMAP(0x00, 0x00), /* 0x56: */ - ISPOPMAP(0x00, 0x00), /* 0x57: */ - ISPOPMAP(0x00, 0x00), /* 0x58: */ - ISPOPMAP(0x00, 0x00), /* 0x59: */ - ISPOPMAP(0x00, 0x00), /* 0x5a: */ - ISPOPMAP(0x03, 0x01), /* 0x5b: MBOX_DRIVER_HEARTBEAT */ - ISPOPMAP(0xcf, 0x01), /* 0x5c: MBOX_FW_HEARTBEAT */ - ISPOPMAP(0x07, 0x03), /* 0x5d: MBOX_GET_SET_DATA_RATE */ - ISPOPMAP(0x00, 0x00), /* 0x5e: */ - ISPOPMAP(0x00, 0x00), /* 0x5f: */ - ISPOPMAP(0xcd, 0x01), /* 0x60: MBOX_INIT_FIRMWARE */ - ISPOPMAP(0x00, 0x00), /* 0x61: */ - ISPOPMAP(0x01, 0x01), /* 0x62: MBOX_INIT_LIP */ - ISPOPMAP(0xcd, 0x03), /* 0x63: MBOX_GET_FC_AL_POSITION_MAP */ - ISPOPMAP(0xcf, 0x01), /* 0x64: MBOX_GET_PORT_DB */ - ISPOPMAP(0x07, 0x01), /* 0x65: MBOX_CLEAR_ACA */ - ISPOPMAP(0x07, 0x01), /* 0x66: MBOX_TARGET_RESET */ - ISPOPMAP(0x07, 0x01), /* 0x67: MBOX_CLEAR_TASK_SET */ - ISPOPMAP(0x07, 0x01), /* 0x68: MBOX_ABORT_TASK_SET */ - ISPOPMAP(0x01, 0x07), /* 0x69: MBOX_GET_FW_STATE */ - ISPOPMAP(0x03, 0xcf), /* 0x6a: MBOX_GET_PORT_NAME */ - ISPOPMAP(0xcf, 0x01), /* 0x6b: MBOX_GET_LINK_STATUS */ - ISPOPMAP(0x0f, 0x01), /* 0x6c: MBOX_INIT_LIP_RESET */ - ISPOPMAP(0x00, 0x00), /* 0x6d: */ - ISPOPMAP(0xcf, 0x03), /* 0x6e: MBOX_SEND_SNS */ - ISPOPMAP(0x0f, 0x07), /* 0x6f: MBOX_FABRIC_LOGIN */ - ISPOPMAP(0x03, 0x01), /* 0x70: MBOX_SEND_CHANGE_REQUEST */ - ISPOPMAP(0x03, 0x03), /* 0x71: MBOX_FABRIC_LOGOUT */ - ISPOPMAP(0x0f, 0x0f), /* 0x72: MBOX_INIT_LIP_LOGIN */ - ISPOPMAP(0x00, 0x00), /* 0x73: */ - ISPOPMAP(0x07, 0x01), /* 0x74: LOGIN LOOP PORT */ - ISPOPMAP(0xcf, 0x03), /* 0x75: GET PORT/NODE NAME LIST */ - ISPOPMAP(0x4f, 0x01), /* 0x76: SET VENDOR ID */ - ISPOPMAP(0xcd, 0x01), /* 0x77: INITIALIZE IP MAILBOX */ - ISPOPMAP(0x00, 0x00), /* 0x78: */ - ISPOPMAP(0x00, 0x00), /* 0x79: */ - ISPOPMAP(0x00, 0x00), /* 0x7a: */ - ISPOPMAP(0x00, 0x00), /* 0x7b: */ - ISPOPMAP(0x4f, 0x03), /* 0x7c: Get ID List */ - ISPOPMAP(0xcf, 0x01), /* 0x7d: SEND LFA */ - ISPOPMAP(0x0f, 0x01) /* 0x7e: LUN RESET */ + ISP_FC_OPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */ + ISP_FC_OPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */ + ISP_FC_OPMAP(0x0f, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */ + ISP_FC_OPMAP(0xdf, 0x01), /* 0x03: MBOX_DUMP_RAM */ + ISP_FC_OPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */ + ISP_FC_OPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */ + ISP_FC_OPMAP_FULL(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff), /* 0x06: MBOX_MAILBOX_REG_TEST */ + ISP_FC_OPMAP(0x07, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */ + ISP_FC_OPMAP_FULL(0x0, 0x0, 0x0, 0x01, 0x0, 0x3, 0x80, 0x4f), /* 0x08: MBOX_ABOUT_FIRMWARE */ + ISP_FC_OPMAP(0xdf, 0x01), /* 0x09: MBOX_LOAD_RISC_RAM_2100 */ + ISP_FC_OPMAP(0xdf, 0x01), /* 0x0a: DUMP RAM */ + ISP_FC_OPMAP_HALF(0x1, 0xff, 0x0, 0x01), /* 0x0b: MBOX_LOAD_RISC_RAM */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x0c: */ + ISP_FC_OPMAP_HALF(0x1, 0x0f, 0x0, 0x01), /* 0x0d: MBOX_WRITE_RAM_WORD_EXTENDED */ + ISP_FC_OPMAP(0x01, 0x05), /* 0x0e: MBOX_CHECK_FIRMWARE */ + ISP_FC_OPMAP_HALF(0x1, 0x03, 0x0, 0x0d), /* 0x0f: MBOX_READ_RAM_WORD_EXTENDED */ + ISP_FC_OPMAP(0x1f, 0x11), /* 0x10: MBOX_INIT_REQ_QUEUE */ + ISP_FC_OPMAP(0x2f, 0x21), /* 0x11: MBOX_INIT_RES_QUEUE */ + ISP_FC_OPMAP(0x0f, 0x01), /* 0x12: MBOX_EXECUTE_IOCB */ + ISP_FC_OPMAP(0x03, 0x03), /* 0x13: MBOX_WAKE_UP */ + ISP_FC_OPMAP(0x01, 0xff), /* 0x14: MBOX_STOP_FIRMWARE */ + ISP_FC_OPMAP(0x4f, 0x01), /* 0x15: MBOX_ABORT */ + ISP_FC_OPMAP(0x07, 0x01), /* 0x16: MBOX_ABORT_DEVICE */ + ISP_FC_OPMAP(0x07, 0x01), /* 0x17: MBOX_ABORT_TARGET */ + ISP_FC_OPMAP(0x03, 0x03), /* 0x18: MBOX_BUS_RESET */ + ISP_FC_OPMAP(0x07, 0x05), /* 0x19: MBOX_STOP_QUEUE */ + ISP_FC_OPMAP(0x07, 0x05), /* 0x1a: MBOX_START_QUEUE */ + ISP_FC_OPMAP(0x07, 0x05), /* 0x1b: MBOX_SINGLE_STEP_QUEUE */ + ISP_FC_OPMAP(0x07, 0x05), /* 0x1c: MBOX_ABORT_QUEUE */ + ISP_FC_OPMAP(0x07, 0x03), /* 0x1d: MBOX_GET_DEV_QUEUE_STATUS */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x1e: */ + ISP_FC_OPMAP(0x01, 0x07), /* 0x1f: MBOX_GET_FIRMWARE_STATUS */ + ISP_FC_OPMAP_HALF(0x2, 0x01, 0x0, 0xcf), /* 0x20: MBOX_GET_LOOP_ID */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x21: */ + ISP_FC_OPMAP(0x01, 0x07), /* 0x22: MBOX_GET_RETRY_COUNT */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x23: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x24: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x25: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x26: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x27: */ + ISP_FC_OPMAP(0x01, 0x03), /* 0x28: MBOX_GET_FIRMWARE_OPTIONS */ + ISP_FC_OPMAP(0x03, 0x07), /* 0x29: MBOX_GET_PORT_QUEUE_PARAMS */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x2a: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x2b: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x2c: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x2d: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x2e: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x2f: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x30: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x31: */ + ISP_FC_OPMAP(0x07, 0x07), /* 0x32: MBOX_SET_RETRY_COUNT */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x33: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x34: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x35: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x36: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x37: */ + ISP_FC_OPMAP(0x0f, 0x01), /* 0x38: MBOX_SET_FIRMWARE_OPTIONS */ + ISP_FC_OPMAP(0x0f, 0x07), /* 0x39: MBOX_SET_PORT_QUEUE_PARAMS */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x3a: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x3b: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x3c: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x3d: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x3e: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x3f: */ + ISP_FC_OPMAP(0x03, 0x01), /* 0x40: MBOX_LOOP_PORT_BYPASS */ + ISP_FC_OPMAP(0x03, 0x01), /* 0x41: MBOX_LOOP_PORT_ENABLE */ + ISP_FC_OPMAP_HALF(0x3, 0xcf, 0x0, 0x07), /* 0x42: MBOX_GET_RESOURCE_COUNT */ + ISP_FC_OPMAP(0x01, 0x01), /* 0x43: MBOX_REQUEST_OFFLINE_MODE */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x44: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x45: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x46: */ + ISP_FC_OPMAP(0xcf, 0x03), /* 0x47: GET PORT_DATABASE ENHANCED */ + ISP_FC_OPMAP(0xcd, 0x01), /* 0x48: MBOX_INIT_FIRMWARE_MULTI_ID */ + ISP_FC_OPMAP(0xcd, 0x01), /* 0x49: MBOX_GET_VP_DATABASE */ + ISP_FC_OPMAP_HALF(0x2, 0xcd, 0x0, 0x01), /* 0x4a: MBOX_GET_VP_DATABASE_ENTRY */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x4b: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x4c: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x4d: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x4e: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x4f: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x50: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x51: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x52: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x53: */ + ISP_FC_OPMAP(0xcf, 0x01), /* 0x54: EXECUTE IOCB A64 */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x55: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x56: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x57: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x58: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x59: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x5a: */ + ISP_FC_OPMAP(0x03, 0x01), /* 0x5b: MBOX_DRIVER_HEARTBEAT */ + ISP_FC_OPMAP(0xcf, 0x01), /* 0x5c: MBOX_FW_HEARTBEAT */ + ISP_FC_OPMAP(0x07, 0x03), /* 0x5d: MBOX_GET_SET_DATA_RATE */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x5e: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x5f: */ + ISP_FC_OPMAP(0xcd, 0x01), /* 0x60: MBOX_INIT_FIRMWARE */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x61: */ + ISP_FC_OPMAP(0x01, 0x01), /* 0x62: MBOX_INIT_LIP */ + ISP_FC_OPMAP(0xcd, 0x03), /* 0x63: MBOX_GET_FC_AL_POSITION_MAP */ + ISP_FC_OPMAP(0xcf, 0x01), /* 0x64: MBOX_GET_PORT_DB */ + ISP_FC_OPMAP(0x07, 0x01), /* 0x65: MBOX_CLEAR_ACA */ + ISP_FC_OPMAP(0x07, 0x01), /* 0x66: MBOX_TARGET_RESET */ + ISP_FC_OPMAP(0x07, 0x01), /* 0x67: MBOX_CLEAR_TASK_SET */ + ISP_FC_OPMAP(0x07, 0x01), /* 0x68: MBOX_ABORT_TASK_SET */ + ISP_FC_OPMAP(0x01, 0x07), /* 0x69: MBOX_GET_FW_STATE */ + ISP_FC_OPMAP(0x03, 0xcf), /* 0x6a: MBOX_GET_PORT_NAME */ + ISP_FC_OPMAP(0xcf, 0x01), /* 0x6b: MBOX_GET_LINK_STATUS */ + ISP_FC_OPMAP(0x0f, 0x01), /* 0x6c: MBOX_INIT_LIP_RESET */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x6d: */ + ISP_FC_OPMAP(0xcf, 0x03), /* 0x6e: MBOX_SEND_SNS */ + ISP_FC_OPMAP(0x0f, 0x07), /* 0x6f: MBOX_FABRIC_LOGIN */ + ISP_FC_OPMAP(0x03, 0x01), /* 0x70: MBOX_SEND_CHANGE_REQUEST */ + ISP_FC_OPMAP(0x03, 0x03), /* 0x71: MBOX_FABRIC_LOGOUT */ + ISP_FC_OPMAP(0x0f, 0x0f), /* 0x72: MBOX_INIT_LIP_LOGIN */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x73: */ + ISP_FC_OPMAP(0x07, 0x01), /* 0x74: LOGIN LOOP PORT */ + ISP_FC_OPMAP(0xcf, 0x03), /* 0x75: GET PORT/NODE NAME LIST */ + ISP_FC_OPMAP(0x4f, 0x01), /* 0x76: SET VENDOR ID */ + ISP_FC_OPMAP(0xcd, 0x01), /* 0x77: INITIALIZE IP MAILBOX */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x78: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x79: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x7a: */ + ISP_FC_OPMAP(0x00, 0x00), /* 0x7b: */ + ISP_FC_OPMAP(0x4f, 0x03), /* 0x7c: Get ID List */ + ISP_FC_OPMAP(0xcf, 0x01), /* 0x7d: SEND LFA */ + ISP_FC_OPMAP(0x0f, 0x01) /* 0x7e: LUN RESET */ }; +#define MAX_FC_OPCODE 0x7e /* * Footnotes * @@ -7136,19 +7219,18 @@ static void isp_mboxcmd_qnw(ispsoftc_t *isp, mbreg_t *mbp, int nodelay) { unsigned int ibits, obits, box, opcode; - const uint32_t *mcp; + opcode = mbp->param[0]; if (IS_FC(isp)) { - mcp = mbpfc; + ibits = ISP_FC_IBITS(opcode); + obits = ISP_FC_OBITS(opcode); } else { - mcp = mbpscsi; + ibits = ISP_SCSI_IBITS(opcode); + obits = ISP_SCSI_OBITS(opcode); } - opcode = mbp->param[0]; - ibits = HIWRD(mcp[opcode]) & NMBOX_BMASK(isp); - obits = LOWRD(mcp[opcode]) & NMBOX_BMASK(isp); ibits |= mbp->ibits; obits |= mbp->obits; - for (box = 0; box < MAX_MAILBOX(isp); box++) { + for (box = 0; box < ISP_NMBOX(isp); box++) { if (ibits & (1 << box)) { ISP_WRITE(isp, MBOX_OFF(box), mbp->param[box]); } @@ -7181,26 +7263,27 @@ isp_mboxcmd(ispsoftc_t *isp, mbreg_t *mb { const char *cname, *xname; char tname[16], mname[16]; - unsigned int lim, ibits, obits, box, opcode; - const uint32_t *mcp; + unsigned int ibits, obits, box, opcode; + opcode = mbp->param[0]; if (IS_FC(isp)) { - mcp = mbpfc; - lim = (sizeof (mbpfc) / sizeof (mbpfc[0])); + if (opcode > MAX_FC_OPCODE) { + mbp->param[0] = MBOX_INVALID_COMMAND; + isp_prt(isp, ISP_LOGERR, "Unknown Command 0x%x", opcode); + return; + } + ibits = ISP_FC_IBITS(opcode); + obits = ISP_FC_OBITS(opcode); } else { - mcp = mbpscsi; - lim = (sizeof (mbpscsi) / sizeof (mbpscsi[0])); - } - - if ((opcode = mbp->param[0]) >= lim) { - mbp->param[0] = MBOX_INVALID_COMMAND; - isp_prt(isp, ISP_LOGERR, "Unknown Command 0x%x", opcode); - return; + if (opcode > MAX_SCSI_OPCODE) { + mbp->param[0] = MBOX_INVALID_COMMAND; + isp_prt(isp, ISP_LOGERR, "Unknown Command 0x%x", opcode); + return; + } + ibits = ISP_SCSI_IBITS(opcode); + obits = ISP_SCSI_OBITS(opcode); } - ibits = HIWRD(mcp[opcode]) & NMBOX_BMASK(isp); - obits = LOWRD(mcp[opcode]) & NMBOX_BMASK(isp); - /* * Pick up any additional bits that the caller might have set. */ @@ -7221,7 +7304,7 @@ isp_mboxcmd(ispsoftc_t *isp, mbreg_t *mb goto out; } - for (box = 0; box < MAX_MAILBOX(isp); box++) { + for (box = 0; box < ISP_NMBOX(isp); box++) { if (ibits & (1 << box)) { isp_prt(isp, ISP_LOGDEBUG3, "IN mbox %d = 0x%04x", box, mbp->param[box]); @@ -7264,7 +7347,7 @@ isp_mboxcmd(ispsoftc_t *isp, mbreg_t *mb /* * Copy back output registers. */ - for (box = 0; box < MAX_MAILBOX(isp); box++) { + for (box = 0; box < ISP_NMBOX(isp); box++) { if (obits & (1 << box)) { mbp->param[box] = isp->isp_mboxtmp[box]; isp_prt(isp, ISP_LOGDEBUG3, "OUT mbox %d = 0x%04x", box, @@ -7964,8 +8047,7 @@ isp_parse_nvram_1020(ispsoftc_t *isp, ui (ISP_NVRAM_FIFO_THRESHOLD_128(nvram_data) << 2); if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0) - sdp->isp_initiator_id = - ISP_NVRAM_INITIATOR_ID(nvram_data); + sdp->isp_initiator_id = ISP_NVRAM_INITIATOR_ID(nvram_data); sdp->isp_bus_reset_delay = ISP_NVRAM_BUS_RESET_DELAY(nvram_data); @@ -8076,8 +8158,7 @@ isp_parse_nvram_1080(ispsoftc_t *isp, in ISP1080_NVRAM_FIFO_THRESHOLD(nvram_data); if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0) - sdp->isp_initiator_id = - ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus); + sdp->isp_initiator_id = ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus); sdp->isp_bus_reset_delay = ISP1080_NVRAM_BUS_RESET_DELAY(nvram_data, bus); @@ -8152,8 +8233,7 @@ isp_parse_nvram_12160(ispsoftc_t *isp, i ISP12160_NVRAM_FIFO_THRESHOLD(nvram_data); if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0) - sdp->isp_initiator_id = - ISP12160_NVRAM_INITIATOR_ID(nvram_data, bus); + sdp->isp_initiator_id = ISP12160_NVRAM_INITIATOR_ID(nvram_data, bus); sdp->isp_bus_reset_delay = ISP12160_NVRAM_BUS_RESET_DELAY(nvram_data, bus); Modified: head/sys/dev/isp/isp_freebsd.h ============================================================================== --- head/sys/dev/isp/isp_freebsd.h Sun Jun 17 21:30:24 2012 (r237209) +++ head/sys/dev/isp/isp_freebsd.h Sun Jun 17 21:39:40 2012 (r237210) @@ -153,6 +153,7 @@ struct isp_pcmd { bus_dmamap_t dmap; /* dma map for this command */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:40:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1969106566C; Sun, 17 Jun 2012 21:40:13 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D9E08FC12; Sun, 17 Jun 2012 21:40:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HLeDIm034378; Sun, 17 Jun 2012 21:40:13 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HLeDHo034376; Sun, 17 Jun 2012 21:40:13 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201206172140.q5HLeDHo034376@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 17 Jun 2012 21:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237211 - head/lib/libc/stdtime X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:40:13 -0000 Author: jilles Date: Sun Jun 17 21:40:13 2012 New Revision: 237211 URL: http://svn.freebsd.org/changeset/base/237211 Log: libc: Reduce relative relocations in strftime(). Modified: head/lib/libc/stdtime/strftime.c Modified: head/lib/libc/stdtime/strftime.c ============================================================================== --- head/lib/libc/stdtime/strftime.c Sun Jun 17 21:39:40 2012 (r237210) +++ head/lib/libc/stdtime/strftime.c Sun Jun 17 21:40:13 2012 (r237211) @@ -67,7 +67,7 @@ extern char * tzname[]; #define PAD_SPACE 2 #define PAD_ZERO 3 -static const char* fmt_padding[][4] = { +static const char fmt_padding[][4][5] = { /* DEFAULT, LESS, SPACE, ZERO */ #define PAD_FMT_MONTHDAY 0 #define PAD_FMT_HMS 0 From owner-svn-src-all@FreeBSD.ORG Sun Jun 17 21:47:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82769106566C; Sun, 17 Jun 2012 21:47:25 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68E0F8FC0C; Sun, 17 Jun 2012 21:47:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5HLlPV2034720; Sun, 17 Jun 2012 21:47:25 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5HLlOQL034717; Sun, 17 Jun 2012 21:47:25 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201206172147.q5HLlOQL034717@svn.freebsd.org> From: Matt Jacob Date: Sun, 17 Jun 2012 21:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237212 - head/sys/dev/ispfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 21:47:25 -0000 Author: mjacob Date: Sun Jun 17 21:47:24 2012 New Revision: 237212 URL: http://svn.freebsd.org/changeset/base/237212 Log: Roll to the latest 2400/2500 firmware available from the public QLogic website. Sponsored by: Spectralogic MFC after: 1 week Modified: head/sys/dev/ispfw/asm_2400.h head/sys/dev/ispfw/asm_2500.h Modified: head/sys/dev/ispfw/asm_2400.h ============================================================================== --- head/sys/dev/ispfw/asm_2400.h Sun Jun 17 21:40:13 2012 (r237211) +++ head/sys/dev/ispfw/asm_2400.h Sun Jun 17 21:47:24 2012 (r237212) @@ -24,29 +24,24 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/************************************************************************ - * * - * ISP2400 Firmware * - * * - ************************************************************************/ -#ifdef ISP_2400 /* - * Firmware Version 5.04.00 (12:18 Jul 02, 2010) + * Firmware Version 5.05.00 (15:31 Dec 14, 2010) */ +#ifdef ISP_2400 static const uint32_t isp_2400_risc_code[] = { - 0x0401f195, 0x00110000, 0x00100000, 0x0000aebb, - 0x00000005, 0x00000004, 0x00000000, 0x00000482, + 0x0401f195, 0x00110000, 0x00100000, 0x0000afb1, + 0x00000005, 0x00000005, 0x00000000, 0x00008482, 0x00000003, 0x00000000, 0x20434f50, 0x59524947, 0x48542032, 0x30303720, 0x514c4f47, 0x49432043, 0x4f52504f, 0x52415449, 0x4f4e2020, 0x20495350, 0x32347878, 0x20466972, 0x6d776172, 0x65202020, - 0x56657273, 0x696f6e20, 0x2020352e, 0x30342e30, + 0x56657273, 0x696f6e20, 0x2020352e, 0x30352e30, 0x30202024, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x42001800, 0x0010014c, 0x42002000, 0x0010bcc7, + 0x42001800, 0x0010014c, 0x42002000, 0x0010bdc7, 0x500c0800, 0x800c1800, 0x500c1000, 0x800c1800, 0x54042000, 0x80102000, 0x80040800, 0x80081040, 0x040207fc, 0x500c0800, 0x800409c0, 0x040207f6, @@ -129,11 +124,11 @@ static const uint32_t isp_2400_risc_code 0x00006150, 0x00000010, 0x00006170, 0x00000010, 0x00006190, 0x00000010, 0x000061b0, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00100000, 0x00100000, 0x0000aebb, + 0x00000000, 0x00100000, 0x00100000, 0x0000afb1, 0xffffffff, 0x00110004, 0x00020000, 0x00000b53, - 0xffffffff, 0x00110b57, 0x0010d600, 0x00001ab8, - 0xffffffff, 0x0011260f, 0x0000c000, 0x000007e8, - 0x00ffffff, 0x00112df7, 0x00008000, 0x000005de, + 0xffffffff, 0x00110b57, 0x0010d700, 0x00001ac0, + 0xffffffff, 0x00112617, 0x0000c000, 0x000007e8, + 0x00ffffff, 0x00112dff, 0x00008000, 0x000005e5, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4203f000, 0x00021fff, 0x40000000, 0x4203e000, 0x90000100, 0x40000000, 0x42000800, @@ -141,11 +136,11 @@ static const uint32_t isp_2400_risc_code 0x00007023, 0x50000000, 0x8c000500, 0x04020003, 0x42000800, 0x00020000, 0x45780800, 0x80040800, 0x82040580, 0x00022000, 0x040207fc, 0x4178a000, - 0x4200a800, 0x0010aebb, 0x42000800, 0x0010d600, - 0x40540000, 0x8004b480, 0x0201f800, 0x0010adf8, + 0x4200a800, 0x0010afb1, 0x42000800, 0x0010d700, + 0x40540000, 0x8004b480, 0x0201f800, 0x0010aeeb, 0x0401fac9, 0x0401fa00, 0x4803c856, 0x42000000, 0x00001000, 0x50000000, 0x82000480, 0x24320002, - 0x0402000d, 0x0201f800, 0x0010ae33, 0x04000008, + 0x0402000d, 0x0201f800, 0x0010af26, 0x04000008, 0x42000800, 0x00007a17, 0x50040000, 0x8c00050e, 0x04020003, 0x8400054e, 0x44000800, 0x4a030000, 0x00000000, 0x4a03c020, 0x00000004, 0x4203e000, @@ -159,7 +154,7 @@ static const uint32_t isp_2400_risc_code 0x4817c857, 0x4853c857, 0x8050a1c0, 0x0400000f, 0x4c140000, 0x5814a801, 0x4857c857, 0x40500000, 0x80540480, 0x04000005, 0x5814b002, 0x485bc857, - 0x0201f800, 0x0010adef, 0x5c002800, 0x82142c00, + 0x0201f800, 0x0010aee2, 0x5c002800, 0x82142c00, 0x00000004, 0x0401f7ee, 0x42002800, 0x0010017d, 0x58140801, 0x4817c857, 0x4807c857, 0x800409c0, 0x04000018, 0x58142002, 0x4813c857, 0x58141003, @@ -168,9 +163,9 @@ static const uint32_t isp_2400_risc_code 0x4a03c020, 0x00004010, 0x4a03c011, 0x40100011, 0x04006000, 0x4203e000, 0x40000000, 0x4a03c017, 0x00000000, 0x4203e000, 0x30000001, 0x0401f000, - 0x4803c856, 0x0201f800, 0x0010d604, 0x0401faf6, - 0x4a03c014, 0x001c001c, 0x42002000, 0x0010f0b8, - 0x0201f800, 0x0010ae00, 0x42000000, 0x00001000, + 0x4803c856, 0x0201f800, 0x0010d704, 0x0401faf6, + 0x4a03c014, 0x001c001c, 0x42002000, 0x0010f1c0, + 0x0201f800, 0x0010aef3, 0x42000000, 0x00001000, 0x50000000, 0x82000480, 0x24220001, 0x04000906, 0x42000000, 0x00001000, 0x50000000, 0x82000480, 0x24320001, 0x04000900, 0x59c40000, 0x82000500, @@ -179,28 +174,28 @@ static const uint32_t isp_2400_risc_code 0x0401f00a, 0x59e00003, 0x82000500, 0x00030000, 0x82000580, 0x00010000, 0x04020004, 0x59a8006d, 0x84000542, 0x4803506d, 0x4c140000, 0x0201f800, - 0x0010a5ad, 0x5c002800, 0x42000800, 0x00001100, + 0x0010a6a0, 0x5c002800, 0x42000800, 0x00001100, 0x42001800, 0x00000100, 0x82141480, 0x0017ffff, 0x0402100d, 0x42000800, 0x00000900, 0x82141480, 0x0013ffff, 0x04021008, 0x42000800, 0x00000480, 0x42001800, 0x00000080, 0x82141480, 0x0011ffff, 0x040018d5, 0x4807500d, 0x480f5251, 0x42001000, - 0x00000024, 0x0201f800, 0x00105f4a, 0x82040c00, - 0x0010f584, 0x4807500b, 0x4a03c810, 0x00100000, - 0x4a03c811, 0x0010aebb, 0x4a03c812, 0x0010d600, - 0x4a03c813, 0x0010f0b7, 0x4a03c829, 0x00000004, + 0x00000024, 0x0201f800, 0x00105fef, 0x82040c00, + 0x0010f694, 0x4807500b, 0x4a03c810, 0x00100000, + 0x4a03c811, 0x0010afb1, 0x4a03c812, 0x0010d700, + 0x4a03c813, 0x0010f1bf, 0x4a03c829, 0x00000004, 0x59e40001, 0x82000540, 0x0003403f, 0x4803c801, 0x42001000, 0x0000001c, 0x0401f9f0, 0x4202c000, - 0x0010f584, 0x59aab00b, 0x59aaa00b, 0x59aaa80b, + 0x0010f694, 0x59aab00b, 0x59aaa00b, 0x59aaa80b, 0x59aac80d, 0x49675050, 0x59a8000b, 0x4803500c, - 0x0201f800, 0x001070a4, 0x0401fac4, 0x0401fb14, - 0x0201f800, 0x001017f8, 0x0201f800, 0x001010e9, - 0x0401fbdb, 0x0201f800, 0x00100ca4, 0x0201f800, - 0x00105f8a, 0x0401f85c, 0x0201f800, 0x00101c0a, - 0x0201f800, 0x00104b8f, 0x0201f800, 0x001044a6, - 0x0201f800, 0x00105a28, 0x0201f800, 0x00105729, - 0x0201f800, 0x0010118e, 0x0201f800, 0x00100ff1, - 0x4203e000, 0xf0000001, 0x0201f800, 0x0010ae4f, + 0x0201f800, 0x00107133, 0x0401fac4, 0x0401fb14, + 0x0201f800, 0x001017f9, 0x0201f800, 0x001010ea, + 0x0401fbdb, 0x0201f800, 0x00100ca5, 0x0201f800, + 0x0010602f, 0x0401f85c, 0x0201f800, 0x00101c0f, + 0x0201f800, 0x00104bce, 0x0201f800, 0x001044e5, + 0x0201f800, 0x00105acd, 0x0201f800, 0x001057ce, + 0x0201f800, 0x0010118f, 0x0201f800, 0x00100ff2, + 0x4203e000, 0xf0000001, 0x0201f800, 0x0010af45, 0x4a03c018, 0x00000000, 0x4203e000, 0x20000511, 0x4203e000, 0x50010000, 0x4a03c020, 0x00000000, 0x04027010, 0x59e00020, 0x82000580, 0x00000002, @@ -212,25 +207,25 @@ static const uint32_t isp_2400_risc_code 0x4df00000, 0x4203e000, 0x50000000, 0x416c0000, 0x82000c80, 0x00000008, 0x0402186b, 0x0c01f804, 0x5c03e000, 0x0201f000, 0x00020008, 0x001002d0, - 0x0010eeff, 0x0010ee47, 0x001002cf, 0x0010ee13, + 0x0010f007, 0x0010ef4c, 0x001002cf, 0x0010ef18, 0x001002cf, 0x001002cf, 0x001002e2, 0x0401f85e, - 0x42000800, 0x0010b7fa, 0x5804001e, 0x8c000500, + 0x42000800, 0x0010b8fa, 0x5804001e, 0x8c000500, 0x0400000d, 0x84000500, 0x4800081e, 0x4202d800, 0x00000004, 0x0401f97b, 0x49f3c857, 0x5c000800, 0x5c000000, 0x82000540, 0x00003e00, 0x4c000000, 0x4c040000, 0x1c01f000, 0x4a038805, 0x000000f0, 0x1c01f000, 0x4a035048, 0x00000005, 0x4a035049, - 0x00000004, 0x4a03504a, 0x00000000, 0x4a03504b, - 0x00000482, 0x0201f800, 0x00104b59, 0x4a03541b, + 0x00000005, 0x4a03504a, 0x00000000, 0x4a03504b, + 0x00008482, 0x0201f800, 0x00104b98, 0x4a03541b, 0x0000ffff, 0x4a03500f, 0x00ffffff, 0x0201f800, - 0x00108bc4, 0x4a03501f, 0x20200000, 0x4a035020, + 0x00108c7d, 0x4a03501f, 0x20200000, 0x4a035020, 0x88000200, 0x4a035021, 0x00ff001f, 0x4a035022, 0x000007d0, 0x4a035023, 0x80000000, 0x4a035024, 0x00000200, 0x4a035025, 0x00ff0000, 0x4a035026, 0x00010000, 0x4a03502d, 0x514c4f47, 0x4a03502e, 0x49432020, 0x1c01f000, 0x4d440000, 0x417a8800, 0x4c5c0000, 0x4178b800, 0x0201f800, 0x00020319, - 0x04020005, 0x0201f800, 0x00104165, 0x04020002, + 0x04020005, 0x0201f800, 0x00104181, 0x04020002, 0x805cb800, 0x81468800, 0x83440580, 0x000007f0, 0x040207f6, 0x405c0800, 0x5c00b800, 0x5c028800, 0x1c01f000, 0x4803c857, 0x5c000000, 0x4c000000, @@ -241,7 +236,7 @@ static const uint32_t isp_2400_risc_code 0x4200b800, 0x00008002, 0x04006000, 0x4c000000, 0x4c040000, 0x59bc00ea, 0x4803c857, 0x82000500, 0x00000007, 0x82000580, 0x00000001, 0x04020005, - 0x42000800, 0x00000000, 0x0201f800, 0x00106126, + 0x42000800, 0x00000000, 0x0201f800, 0x001061cb, 0x59b800ea, 0x4803c857, 0x4a0370e8, 0x00000004, 0x5c000800, 0x4807c025, 0x80040920, 0x4807c026, 0x5c000000, 0x4803c023, 0x80000120, 0x4803c024, @@ -249,8 +244,8 @@ static const uint32_t isp_2400_risc_code 0x4803c022, 0x41f80000, 0x4803c029, 0x80000120, 0x4803c02a, 0x42000000, 0x00001000, 0x50000000, 0x82000480, 0x24320001, 0x4803c857, 0x0400104b, - 0x0201f800, 0x0010ae33, 0x04000046, 0x42000800, - 0x0010c526, 0x46000800, 0xfaceface, 0x80040800, + 0x0201f800, 0x0010af26, 0x04000046, 0x42000800, + 0x0010c626, 0x46000800, 0xfaceface, 0x80040800, 0x4c080000, 0x4c0c0000, 0x42001000, 0x00007a00, 0x58080013, 0x44000800, 0x80040800, 0x58080019, 0x44000800, 0x80040800, 0x5808001a, 0x44000800, @@ -273,29 +268,29 @@ static const uint32_t isp_2400_risc_code 0x00000000, 0x4203e000, 0x30000001, 0x0401f847, 0x0401f7ff, 0x42000000, 0x00000004, 0x0401f80c, 0x4a03c855, 0x0001eb5a, 0x59e40001, 0x82000540, - 0x00000700, 0x4803c801, 0x42000000, 0x0010bcb1, + 0x00000700, 0x4803c801, 0x42000000, 0x0010bdb1, 0x49780003, 0x49780004, 0x1c01f000, 0x42000800, - 0x0010bcb3, 0x44000800, 0x59e40801, 0x82041500, + 0x0010bdb3, 0x44000800, 0x59e40801, 0x82041500, 0xfff3c0ff, 0x480bc801, 0x8c040d24, 0x0400000c, 0x4c000000, 0x59e41052, 0x59e40054, 0x800000d4, - 0x82000400, 0x0010c542, 0x80081480, 0x480bc853, + 0x82000400, 0x0010c642, 0x80081480, 0x480bc853, 0x4a03c800, 0x00000040, 0x5c000000, 0x4a03c850, - 0x0010c542, 0x800000d4, 0x82002400, 0x0010c541, + 0x0010c642, 0x800000d4, 0x82002400, 0x0010c641, 0x4813c851, 0x4a03c853, 0x00000400, 0x42000000, - 0x0010c542, 0x82001400, 0x00001000, 0x45780000, + 0x0010c642, 0x82001400, 0x00001000, 0x45780000, 0x80000000, 0x80081d80, 0x040207fd, 0x4807c801, - 0x1c01f000, 0x42002000, 0x0010bcb1, 0x59e41801, + 0x1c01f000, 0x42002000, 0x0010bdb1, 0x59e41801, 0x58100c01, 0x82040500, 0x00003800, 0x820c1d00, 0xffffc7ff, 0x800c1d40, 0x480fc801, 0x1c01f000, 0x5c036000, 0x4db00000, 0x49b3c857, 0x4803c857, 0x1c01f000, 0x1c01f000, 0x59a80059, 0x8c000530, 0x040207fe, 0x4c080000, 0x42001000, 0x00000004, 0x0401f862, 0x5c001000, 0x4201d000, 0x00028b0a, - 0x0201f800, 0x0010592d, 0x4c080000, 0x42001000, + 0x0201f800, 0x001059d2, 0x4c080000, 0x42001000, 0x00000008, 0x0401f859, 0x5c001000, 0x4201d000, - 0x00028b0a, 0x0201f800, 0x0010592d, 0x4c080000, + 0x00028b0a, 0x0201f800, 0x001059d2, 0x4c080000, 0x42001000, 0x00000010, 0x0401f850, 0x5c001000, - 0x4201d000, 0x00028b0a, 0x0201f800, 0x0010592d, + 0x4201d000, 0x00028b0a, 0x0201f800, 0x001059d2, 0x0401f7e2, 0x8c00050c, 0x59a80859, 0x04020003, 0x84040d30, 0x0401f006, 0x84040d70, 0x48075059, 0x42001000, 0x00000000, 0x0401f040, 0x48075059, @@ -334,8 +329,8 @@ static const uint32_t isp_2400_risc_code 0x41792800, 0x41793000, 0x41793800, 0x41794000, 0x41794800, 0x41795000, 0x41795800, 0x41796000, 0x41796800, 0x41797000, 0x41797800, 0x41798000, - 0x41798800, 0x42019000, 0x0010b889, 0x42019800, - 0x0010b860, 0x4179a000, 0x4179a800, 0x4179b000, + 0x41798800, 0x42019000, 0x0010b989, 0x42019800, + 0x0010b960, 0x4179a000, 0x4179a800, 0x4179b000, 0x4179b800, 0x4179c800, 0x4179c000, 0x4179d000, 0x4179d800, 0x4179e000, 0x4179e800, 0x4179f000, 0x4179f800, 0x417a0000, 0x417a0800, 0x417a1000, @@ -344,17 +339,17 @@ static const uint32_t isp_2400_risc_code 0x417a5000, 0x417a5800, 0x417a6000, 0x417a6800, 0x417a7000, 0x417a7800, 0x417a8000, 0x417a8800, 0x417a9000, 0x417a9800, 0x417ae800, 0x417af800, - 0x42030000, 0x00007c00, 0x42031000, 0x0010bb5a, + 0x42030000, 0x00007c00, 0x42031000, 0x0010bc5a, 0x42031800, 0x0000bf1d, 0x42032000, 0x0000bf32, - 0x42032800, 0x0010bb22, 0x42033000, 0x00020b5d, - 0x42034000, 0x0010b7fa, 0x42033800, 0x0010b819, - 0x42034800, 0x0010b898, 0x42035000, 0x0010b780, - 0x42035800, 0x0010af80, 0x42030800, 0x0010b85b, + 0x42032800, 0x0010bc22, 0x42033000, 0x00020b5d, + 0x42034000, 0x0010b8fa, 0x42033800, 0x0010b919, + 0x42034800, 0x0010b998, 0x42035000, 0x0010b880, + 0x42035800, 0x0010b080, 0x42030800, 0x0010b95b, 0x417b6000, 0x42036800, 0x00006f00, 0x4203c800, 0x00003000, 0x42037000, 0x0000ff00, 0x42037800, 0x0000bf00, 0x42038000, 0x00007700, 0x42038800, 0x00004000, 0x42039000, 0x00006000, 0x42039800, - 0x0010c25e, 0x4203a000, 0x00007600, 0x4203a800, + 0x0010c35e, 0x4203a000, 0x00007600, 0x4203a800, 0x00007400, 0x4203b000, 0x00007200, 0x4203b800, 0x00007100, 0x4203c000, 0x00007000, 0x4203d000, 0x00000000, 0x4203e800, 0x0002018e, 0x417bd800, @@ -379,13 +374,13 @@ static const uint32_t isp_2400_risc_code 0x412d8800, 0x1c01f000, 0x835c0480, 0x00000020, 0x0400100a, 0x496bc857, 0x815eb840, 0x416a5800, 0x592ed000, 0x497a5800, 0x497a5801, 0x497a5805, - 0x812e59c0, 0x1c01f000, 0x42000000, 0x0010bc0f, - 0x0201f800, 0x0010ad1d, 0x417a5800, 0x0401f7f9, + 0x812e59c0, 0x1c01f000, 0x42000000, 0x0010bd0f, + 0x0201f800, 0x0010ae10, 0x417a5800, 0x0401f7f9, 0x0401f803, 0x412d8800, 0x1c01f000, 0x815eb840, 0x04001009, 0x416a5800, 0x492fc857, 0x592ed000, 0x497a5800, 0x497a5801, 0x497a5805, 0x812e59c0, - 0x1c01f000, 0x42000000, 0x0010bc0f, 0x0201f800, - 0x0010ad1d, 0x417ab800, 0x417a5800, 0x0401f7f8, + 0x1c01f000, 0x42000000, 0x0010bd0f, 0x0201f800, + 0x0010ae10, 0x417ab800, 0x417a5800, 0x0401f7f8, 0x492fc857, 0x496a5800, 0x412ed000, 0x815eb800, 0x59c80000, 0x82000540, 0x00001200, 0x48039000, 0x1c01f000, 0x492fc857, 0x812e59c0, 0x04000007, @@ -403,26 +398,26 @@ static const uint32_t isp_2400_risc_code 0x00000020, 0x497bb807, 0x8058b040, 0x040207fe, 0x4a03b805, 0x30000000, 0x59dc0006, 0x4a03b805, 0x60000001, 0x4803c856, 0x0401ff98, 0x04000d6a, - 0x42001000, 0x0010bb55, 0x452c1000, 0x4a025801, + 0x42001000, 0x0010bc55, 0x452c1000, 0x4a025801, 0x00000001, 0x4a025802, 0x00000100, 0x4a025808, - 0x00106784, 0x497a5809, 0x497a580a, 0x497a580b, - 0x0401ff8a, 0x04000d5c, 0x42001000, 0x0010bb56, + 0x00106826, 0x497a5809, 0x497a580a, 0x497a580b, + 0x0401ff8a, 0x04000d5c, 0x42001000, 0x0010bc56, 0x452c1000, 0x4a025801, 0x00000000, 0x4a025802, - 0x00000100, 0x4a025808, 0x00100f2e, 0x497a5803, + 0x00000100, 0x4a025808, 0x00100f2f, 0x497a5803, 0x497a5806, 0x497a5807, 0x497a5809, 0x59a8006d, 0x8c000500, 0x04000006, 0x4a03b805, 0xe0000001, 0x59dc0006, 0x8c000522, 0x040007fc, 0x1c01f000, 0x40681000, 0x0201f800, 0x00020016, 0x1c01f000, - 0x42001000, 0x00020026, 0x0201f800, 0x001057d8, - 0x0201f800, 0x00108cab, 0x0201f800, 0x0010a24b, + 0x42001000, 0x00020026, 0x0201f800, 0x0010587d, + 0x0201f800, 0x00108d64, 0x0201f800, 0x0010a32a, 0x04000014, 0x4a03b805, 0x30000002, 0x59dc0006, 0x4807b800, 0x480bb801, 0x42007000, 0x00020b54, 0x4a007002, 0x00000040, 0x480c7008, 0x58380007, 0x82000400, 0x00000005, 0x48007003, 0x4a007000, 0x00000003, 0x4803b803, 0x0201f000, 0x00020050, - 0x42000000, 0x0010bb77, 0x0201f800, 0x0010ad1d, - 0x0201f800, 0x00108cc3, 0x42000800, 0x00000001, - 0x42001000, 0x00020026, 0x0201f800, 0x001057b1, + 0x42000000, 0x0010bc77, 0x0201f800, 0x0010ae10, + 0x0201f800, 0x00108d7c, 0x42000800, 0x00000001, + 0x42001000, 0x00020026, 0x0201f800, 0x00105856, 0x42007000, 0x00020b54, 0x0201f000, 0x00020030, 0x58380802, 0x42001000, 0x0000ff00, 0x82040480, 0x0000ff00, 0x04021003, 0x40041000, 0x80000580, @@ -442,7 +437,7 @@ static const uint32_t isp_2400_risc_code 0x04000003, 0x48107005, 0x0401f008, 0x49787005, 0x49787004, 0x0401f005, 0x48101800, 0x801021c0, 0x04020002, 0x480c7004, 0x1c01f000, 0x4803c856, - 0x4dc00000, 0x42007000, 0x0010bb58, 0x4a007400, + 0x4dc00000, 0x42007000, 0x0010bc58, 0x4a007400, 0x00000000, 0x49787001, 0x42038000, 0x00007720, 0x4a038006, 0x60000001, 0x4a038009, 0xf4f60000, 0x42038000, 0x00007700, 0x4a038006, 0x60000001, @@ -458,7 +453,7 @@ static const uint32_t isp_2400_risc_code 0x4a038807, 0x00000004, 0x4a0370e5, 0x00080000, 0x59b800ea, 0x8c000510, 0x04000004, 0x59b800e0, 0x0401f879, 0x0401f7fb, 0x42038000, 0x00007720, - 0x0201f800, 0x00100c06, 0x59c00007, 0x4a038006, + 0x0201f800, 0x00100c07, 0x59c00007, 0x4a038006, 0x20000000, 0x59c00007, 0x4a038006, 0x8000000a, 0x59c00007, 0x4a038006, 0x8000000b, 0x59c00007, 0x4a038006, 0x40000001, 0x83c00580, 0x00007700, @@ -469,16 +464,16 @@ static const uint32_t isp_2400_risc_code 0x83c00580, 0x00007700, 0x04000004, 0x42038000, 0x00007700, 0x0401f7f1, 0x4178a000, 0x805cb9c0, 0x0402001d, 0x4200b000, 0x00000020, 0x83b8ac00, - 0x00000020, 0x0201f800, 0x0010adf8, 0x4a0370fb, - 0x00000001, 0x4a037020, 0x00100e39, 0x59a8002c, + 0x00000020, 0x0201f800, 0x0010aeeb, 0x4a0370fb, + 0x00000001, 0x4a037020, 0x00100e3a, 0x59a8002c, 0x82000500, 0x0000ffff, 0x48037021, 0x4a037035, - 0x0010c1a4, 0x4a037030, 0x0010b78f, 0x4a037031, - 0x0010af80, 0x4a037032, 0x0010b86b, 0x4a037036, - 0x0010b876, 0x59840002, 0x48037034, 0x4a037038, - 0x00100e30, 0x4a0370fb, 0x00000001, 0x4200b000, + 0x0010c2a4, 0x4a037030, 0x0010b88f, 0x4a037031, + 0x0010b080, 0x4a037032, 0x0010b96b, 0x4a037036, + 0x0010b976, 0x59840002, 0x48037034, 0x4a037038, + 0x00100e31, 0x4a0370fb, 0x00000001, 0x4200b000, 0x00000020, 0x83b8ac00, 0x00000000, 0x0201f800, - 0x0010adf8, 0x4200b000, 0x00000040, 0x83b8ac00, - 0x00000040, 0x0201f800, 0x0010adf8, 0x805cb9c0, + 0x0010aeeb, 0x4200b000, 0x00000040, 0x83b8ac00, + 0x00000040, 0x0201f800, 0x0010aeeb, 0x805cb9c0, 0x04020004, 0x4a0370e4, 0xaaaaaaaa, 0x0401f003, 0x4a0370e4, 0xa2aa2a82, 0x4a0370e5, 0xaaaaaaaa, 0x4a0370e6, 0xaaaaaaaa, 0x4a0370fb, 0x00000000, @@ -490,7 +485,7 @@ static const uint32_t isp_2400_risc_code 0x1c01f000, 0x4d300000, 0x4d380000, 0x40026000, 0x82000500, 0x7f000000, 0x82000580, 0x60000000, 0x04020012, 0x83326500, 0x00ffffff, 0x0201f800, - 0x001091d9, 0x0402000d, 0x59300203, 0x82000580, + 0x00109291, 0x0402000d, 0x59300203, 0x82000580, 0x00000004, 0x04020009, 0x59300c07, 0x82040580, 0x00000009, 0x04020005, 0x42027000, 0x00000047, 0x0201f800, 0x00020a34, 0x5c027000, 0x5c026000, @@ -498,16518 +493,1663 @@ static const uint32_t isp_2400_risc_code 0x4d400000, 0x4cfc0000, 0x4d380000, 0x4d3c0000, 0x4d440000, 0x4d4c0000, 0x4d480000, 0x4c5c0000, 0x4c600000, 0x4c640000, 0x4d040000, 0x4cc80000, - 0x4ccc0000, 0x4cf40000, 0x4cf80000, 0x4cfc0000, - 0x0201f800, 0x00020095, 0x5c01f800, 0x5c01f000, - 0x5c01e800, 0x5c019800, 0x5c019000, 0x5c020800, - 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x5c029000, - 0x5c029800, 0x5c028800, 0x5c027800, 0x5c027000, - 0x5c01f800, 0x5c028000, 0x5c026800, 0x5c025800, - 0x5c026000, 0x1c01f000, 0x493bc857, 0x0201f000, - 0x000200bc, 0x83300500, 0x000000ff, 0x82000c80, - 0x00000007, 0x02021800, 0x0010032d, 0x0c01f025, - 0x1c01f000, 0x82000d00, 0xc0000038, 0x02020800, - 0x00100322, 0x0201f800, 0x0010032d, 0x00000000, - 0x00000048, 0x00000054, 0x00000053, 0x00100786, - 0x001007aa, 0x001007a5, 0x001007c9, 0x00100791, - 0x0010079d, 0x00100786, 0x001007c4, 0x00100810, - 0x00100786, 0x00100813, 0x00100786, 0x00100786, - 0x00100816, 0x0010081c, 0x00100839, 0x0010084e, - 0x00100786, 0x00100857, 0x00100863, 0x00100786, - 0x00100786, 0x00100786, 0x0201f800, 0x0010032d, - 0x0010078f, 0x001008fa, 0x001007d6, 0x001007ff, - 0x0010078f, 0x0010078f, 0x0010078f, 0x0201f800, - 0x0010032d, 0x4803c856, 0x59300004, 0x8c00053e, - 0x04020005, 0x42027000, 0x00000055, 0x0201f000, - 0x00020a34, 0x0201f800, 0x0010644d, 0x040007fa, - 0x1c01f000, 0x4803c856, 0x0401f8c7, 0x40002800, - 0x41782000, 0x42027000, 0x00000056, 0x0201f000, - 0x00020a34, 0x4803c856, 0x42027000, 0x00000057, - 0x0201f000, 0x00020a34, 0x4803c856, 0x59325809, - 0x812e59c0, 0x04000016, 0x59300008, 0x8c00051a, - 0x0402000d, 0x592c0409, 0x8c00051c, 0x04020003, - 0x4a026012, 0xffffffff, 0x59300004, 0x8c00053e, - 0x04020008, 0x42027000, 0x00000048, 0x0201f000, - 0x00020a34, 0x4a025a07, 0x00000007, 0x0401f7f5, - 0x0201f800, 0x0010644d, 0x040007f7, 0x1c01f000, - 0x4803c856, 0x83300500, 0x00ffffff, 0x0201f000, - 0x00105d72, 0x1c01f000, 0x4c040000, 0x59b808ea, - 0x82040d00, 0x00000007, 0x82040580, 0x00000003, - 0x04000004, 0x42000000, 0x60000000, 0x0401f8c6, - 0x5c000800, 0x1c01f000, 0x0401f914, 0x0400001b, - 0x59325809, 0x812e59c0, 0x04000018, 0x592c0205, - 0x82000500, 0x000000ff, 0x82000d80, 0x00000029, - 0x04020012, 0x59300203, 0x82000580, 0x00000003, - 0x0400000b, 0x59300808, 0x84040d26, 0x48066008, - 0x0201f800, 0x00020111, 0x4a03900d, 0x00000040, - 0x4a0370e5, 0x00000008, 0x1c01f000, 0x0201f800, - 0x0010644d, 0x040007f4, 0x42000000, 0x0010bc15, - 0x0201f800, 0x0010ad1d, 0x5988014a, 0x80000000, - 0x4803114a, 0x4a03900d, 0x00000040, 0x42000000, - 0xc0000000, 0x0201f000, 0x00020105, 0x4c5c0000, - 0x4c600000, 0x4c640000, 0x4200c800, 0x0010c1ab, - 0x4200b800, 0x00003000, 0x4200c000, 0x00000105, - 0x0201f800, 0x001055e9, 0x4a0370e4, 0x02000000, - 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x1c01f000, - 0x4933c857, 0x0201f000, 0x00020a10, 0x4933c857, - 0x0401fbfa, 0x1c01f000, 0x41300800, 0x800409c0, - 0x02020800, 0x0010032d, 0x0201f800, 0x00100322, - 0x42000000, 0x0010bc15, 0x0201f800, 0x0010ad1d, - 0x4933c857, 0x813261c0, 0x02000800, 0x0010032d, - 0x0401f841, 0x40002800, 0x0201f800, 0x0010ac86, - 0x4c140000, 0x59a8006a, 0x80000540, 0x04000004, - 0x8c142d2a, 0x04000002, 0x0401fbe0, 0x5c002800, - 0x0401f8ae, 0x04000007, 0x5932680a, 0x59340200, - 0x8c00050e, 0x59300415, 0x02020800, 0x00108b7a, - 0x1c01f000, 0x42000000, 0x0010bc15, 0x0201f800, - 0x0010ad1d, 0x4933c857, 0x813261c0, 0x02000800, - 0x0010032d, 0x0401f89d, 0x0400000b, 0x0201f800, - 0x0010889a, 0x04000008, 0x59325809, 0x592c0209, - 0x8400054e, 0x48025a09, 0x417a7800, 0x0201f800, - 0x00108487, 0x1c01f000, 0x485fc857, 0x5c000000, - 0x4d780000, 0x4203e000, 0x50000000, 0x4200b800, - 0x00008005, 0x0201f000, 0x00100332, 0x4933c857, - 0x83300480, 0x00000020, 0x02021800, 0x0010032d, - 0x83300c00, 0x0010bc88, 0x50040000, 0x80000000, - 0x04001002, 0x44000800, 0x1c01f000, 0x4933c857, - 0x0401f7f4, 0x4807c856, 0x59b800ea, 0x8c000510, - 0x040007fd, 0x59b800e0, 0x4803c857, 0x1c01f000, - 0x4803c856, 0x42000000, 0x10000000, 0x41300800, - 0x0401f029, 0x8c000510, 0x02000000, 0x0002010b, - 0x4c040000, 0x0401f80b, 0x5c000800, 0x82100480, - 0x00000008, 0x02001000, 0x0002010b, 0x4c040000, - 0x0401feb5, 0x5c000800, 0x0201f000, 0x0002010b, - 0x59b800e2, 0x59b820e2, 0x80100580, 0x040207fd, - 0x80102114, 0x0401f001, 0x40101800, 0x800c190a, - 0x82100500, 0x0000001f, 0x820c1d00, 0x0000001f, - 0x800c2480, 0x82102500, 0x0000001f, 0x1c01f000, - 0x40680000, 0x406c0800, 0x0401f807, 0x42018800, - 0x00000001, 0x04020003, 0x42018800, 0x00000000, - 0x1c01f000, 0x82000500, 0xf0000000, 0x82040d00, - 0x0fffffff, 0x80040d40, 0x4807c857, 0x42001000, - 0x0010bb59, 0x50080000, 0x80000540, 0x04020005, - 0x4a0370e5, 0x00000003, 0x4a0370e4, 0x00000300, - 0x80000000, 0x44001000, 0x42001000, 0x00000400, - 0x59b800ea, 0x8c000510, 0x0400000c, 0x0401ffd1, - 0x82100480, 0x00000008, 0x04001007, 0x4c040000, - 0x4c080000, 0x0401fe7c, 0x5c001000, 0x5c000800, - 0x0401f020, 0x59b800ea, 0x8c000516, 0x0402001d, - 0x4a0370e4, 0x00300000, 0x480770e1, 0x42001000, - 0x0000ff00, 0x80081040, 0x04000012, 0x59b808e4, - 0x8c040d28, 0x040207fc, 0x42001000, 0x0010bb59, - 0x50080000, 0x80000040, 0x04020005, 0x4a0370e5, - 0x00000002, 0x4a0370e4, 0x00000200, 0x02001800, - 0x0010032d, 0x44001000, 0x8c040d2c, 0x1c01f000, + 0x4ccc0000, 0x4cf40000, 0x4cf80000, 0x0201f800, + 0x00020095, 0x5c01f000, 0x5c01e800, 0x5c019800, + 0x5c019000, 0x5c020800, 0x5c00c800, 0x5c00c000, + 0x5c00b800, 0x5c029000, 0x5c029800, 0x5c028800, + 0x5c027800, 0x5c027000, 0x5c01f800, 0x5c028000, + 0x5c026800, 0x5c025800, 0x5c026000, 0x1c01f000, + 0x493bc857, 0x0201f000, 0x000200bc, 0x83300500, + 0x000000ff, 0x82000c80, 0x00000007, 0x02021800, + 0x0010032d, 0x0c01f025, 0x1c01f000, 0x82000d00, + 0xc0000038, 0x02020800, 0x00100322, 0x0201f800, + 0x0010032d, 0x00000000, 0x00000048, 0x00000054, + 0x00000053, 0x00100784, 0x001007a8, 0x001007a3, + 0x001007c7, 0x0010078f, 0x0010079b, 0x00100784, + 0x001007c2, 0x0010080e, 0x00100784, 0x00100811, + 0x00100784, 0x00100784, 0x00100814, 0x0010081a, + 0x00100837, 0x0010084c, 0x00100784, 0x00100855, + 0x00100861, 0x00100784, 0x00100784, 0x00100784, + 0x0201f800, 0x0010032d, 0x0010078d, 0x001008f8, + 0x001007d4, 0x001007fd, 0x0010078d, 0x0010078d, + 0x0010078d, 0x0201f800, 0x0010032d, 0x4803c856, + 0x59300004, 0x8c00053e, 0x04020005, 0x42027000, + 0x00000055, 0x0201f000, 0x00020a34, 0x0201f800, + 0x001064f2, 0x040007fa, 0x1c01f000, 0x4803c856, + 0x0401f8c7, 0x40002800, 0x41782000, 0x42027000, + 0x00000056, 0x0201f000, 0x00020a34, 0x4803c856, + 0x42027000, 0x00000057, 0x0201f000, 0x00020a34, + 0x4803c856, 0x59325809, 0x812e59c0, 0x04000016, + 0x59300008, 0x8c00051a, 0x0402000d, 0x592c0409, + 0x8c00051c, 0x04020003, 0x4a026012, 0xffffffff, + 0x59300004, 0x8c00053e, 0x04020008, 0x42027000, + 0x00000048, 0x0201f000, 0x00020a34, 0x4a025a07, + 0x00000007, 0x0401f7f5, 0x0201f800, 0x001064f2, + 0x040007f7, 0x1c01f000, 0x4803c856, 0x83300500, + 0x00ffffff, 0x0201f000, 0x00105e17, 0x1c01f000, + 0x4c040000, 0x59b808ea, 0x82040d00, 0x00000007, + 0x82040580, 0x00000003, 0x04000004, 0x42000000, + 0x60000000, 0x0401f8c6, 0x5c000800, 0x1c01f000, + 0x0401f914, 0x0400001b, 0x59325809, 0x812e59c0, + 0x04000018, 0x592c0205, 0x82000500, 0x000000ff, + 0x82000d80, 0x00000029, 0x04020012, 0x59300203, + 0x82000580, 0x00000003, 0x0400000b, 0x59300808, + 0x84040d26, 0x48066008, 0x0201f800, 0x00020111, + 0x4a03900d, 0x00000040, 0x4a0370e5, 0x00000008, + 0x1c01f000, 0x0201f800, 0x001064f2, 0x040007f4, + 0x42000000, 0x0010bd15, 0x0201f800, 0x0010ae10, + 0x5988014a, 0x80000000, 0x4803114a, 0x4a03900d, + 0x00000040, 0x42000000, 0xc0000000, 0x0201f000, + 0x00020105, 0x4c5c0000, 0x4c600000, 0x4c640000, + 0x4200c800, 0x0010c2ab, 0x4200b800, 0x00003000, + 0x4200c000, 0x00000105, 0x0201f800, 0x00105655, + 0x4a0370e4, 0x02000000, 0x5c00c800, 0x5c00c000, + 0x5c00b800, 0x1c01f000, 0x4933c857, 0x0201f000, + 0x00020a10, 0x4933c857, 0x0401fbfd, 0x1c01f000, + 0x41300800, 0x800409c0, 0x02020800, 0x0010032d, + 0x0201f800, 0x00100322, 0x42000000, 0x0010bd15, + 0x0201f800, 0x0010ae10, 0x4933c857, 0x813261c0, + 0x02000800, 0x0010032d, 0x0401f841, 0x40002800, + 0x0201f800, 0x0010ad79, 0x4c140000, 0x59a8006a, + 0x80000540, 0x04000004, 0x8c142d2a, 0x04000002, + 0x0401fbe3, 0x5c002800, 0x0401f8ae, 0x04000007, + 0x5932680a, 0x59340200, 0x8c00050e, 0x59300415, + 0x02020800, 0x00108c33, 0x1c01f000, 0x42000000, + 0x0010bd15, 0x0201f800, 0x0010ae10, 0x4933c857, + 0x813261c0, 0x02000800, 0x0010032d, 0x0401f89d, + 0x0400000b, 0x0201f800, 0x00108953, 0x04000008, + 0x59325809, 0x592c0209, 0x8400054e, 0x48025a09, + 0x417a7800, 0x0201f800, 0x0010853c, 0x1c01f000, + 0x485fc857, 0x5c000000, 0x4d780000, 0x4203e000, + 0x50000000, 0x4200b800, 0x00008005, 0x0201f000, + 0x00100332, 0x4933c857, 0x83300480, 0x00000020, + 0x02021800, 0x0010032d, 0x83300c00, 0x0010bd88, + 0x50040000, 0x80000000, 0x04001002, 0x44000800, + 0x1c01f000, 0x4933c857, 0x0401f7f4, 0x4807c856, + 0x59b800ea, 0x8c000510, 0x040007fd, 0x59b800e0, + 0x4803c857, 0x1c01f000, 0x4803c856, 0x42000000, + 0x10000000, 0x41300800, 0x0401f029, 0x8c000510, + 0x02000000, 0x0002010b, 0x4c040000, 0x0401f80b, + 0x5c000800, 0x82100480, 0x00000008, 0x02001000, + 0x0002010b, 0x4c040000, 0x0401feb7, 0x5c000800, + 0x0201f000, 0x0002010b, 0x59b800e2, 0x59b820e2, + 0x80100580, 0x040207fd, 0x80102114, 0x0401f001, + 0x40101800, 0x800c190a, 0x82100500, 0x0000001f, + 0x820c1d00, 0x0000001f, 0x800c2480, 0x82102500, + 0x0000001f, 0x1c01f000, 0x40680000, 0x406c0800, + 0x0401f807, 0x42018800, 0x00000001, 0x04020003, + 0x42018800, 0x00000000, 0x1c01f000, 0x82000500, + 0xf0000000, 0x82040d00, 0x0fffffff, 0x80040d40, + 0x4807c857, 0x42001000, 0x0010bc59, 0x50080000, + 0x80000540, 0x04020005, 0x4a0370e5, 0x00000003, + 0x4a0370e4, 0x00000300, 0x80000000, 0x44001000, + 0x42001000, 0x00000400, 0x59b800ea, 0x8c000510, + 0x0400000c, 0x0401ffd1, 0x82100480, 0x00000008, + 0x04001007, 0x4c040000, 0x4c080000, 0x0401fe7e, + 0x5c001000, 0x5c000800, 0x0401f020, 0x59b800ea, + 0x8c000516, 0x0402001d, 0x4a0370e4, 0x00300000, + 0x480770e1, 0x42001000, 0x0000ff00, 0x80081040, + 0x04000012, 0x59b808e4, 0x8c040d28, 0x040207fc, + 0x42001000, 0x0010bc59, 0x50080000, 0x80000040, + 0x04020005, 0x4a0370e5, 0x00000002, 0x4a0370e4, + 0x00000200, 0x02001800, 0x0010032d, 0x44001000, + 0x8c040d2c, 0x1c01f000, 0x41f80000, 0x50000000, + 0x0201f800, 0x0010032d, 0x80081040, 0x040207d3, 0x41f80000, 0x50000000, 0x0201f800, 0x0010032d, - 0x80081040, 0x040207d3, 0x41f80000, 0x50000000, - 0x0201f800, 0x0010032d, 0x4d380000, 0x59300c07, - 0x82040580, 0x00000009, 0x04020006, 0x42027000, - 0x00000047, 0x0201f800, 0x00020a34, 0x80000580, - 0x5c027000, 0x1c01f000, 0x4c500000, 0x4a03900d, - 0x00000001, 0x59c8a020, 0x4a03900d, 0x00000002, - 0x59c80820, 0x8c50a52e, 0x04000002, 0x900409c0, - 0x82040d00, 0x0000ffff, 0x0201f800, 0x001055ab, - 0x5c00a000, 0x1c01f000, 0x42000000, 0x0010bc0c, - 0x0201f800, 0x0010ad1d, 0x0401ffec, 0x0400004b, - 0x4933c857, 0x59300407, 0x82000580, 0x00000000, - 0x04000046, 0x59c82021, 0x4a03900d, 0x00000001, - 0x59c82821, 0x82142d00, 0x0000ffff, 0x59325809, - 0x812e59c0, 0x0400003d, 0x5932680a, 0x0201f800, - 0x001040aa, 0x02020800, 0x00108b62, 0x599c0019, - 0x8c00050c, 0x04020018, 0x0201f800, 0x001040aa, - 0x04020015, 0x59300812, 0x4807c857, 0x592c0409, - 0x8c00051c, 0x0402000e, 0x8400055c, 0x48025c09, - 0x592c0a05, 0x82040d00, 0x000000ff, 0x82040580, - 0x00000048, 0x04000004, 0x82040580, 0x00000018, - 0x04020003, 0x59300812, 0x48065803, 0x4a026012, - 0x7fffffff, 0x48166014, 0x599c0019, 0x8c00050c, - 0x04020004, 0x59a80007, 0x8c00051e, 0x04020017, - 0x0201f800, 0x00100e59, 0x04020014, 0x0401fa2f, - 0x40280000, 0x4802600e, 0x04000005, 0x4832600c, - 0x50200000, 0x4802600b, 0x4822600d, 0x59300415, - 0x8c00051c, 0x04020004, 0x599c0019, 0x8c00050c, - 0x04020885, 0x4a03900d, 0x00000040, 0x4a0370e5, - 0x00000008, 0x1c01f000, 0x42000000, 0x0010bc15, - 0x0201f800, 0x0010ad1d, 0x5988014c, 0x80000000, - 0x4803114c, 0x4a03900d, 0x00000040, 0x42000000, - 0xc0000000, 0x0201f000, 0x00020105, 0x4cf80000, - 0x58f40000, 0x8001f540, 0x0401f820, 0x41781800, - 0x0401f8f9, 0x04020014, 0x44140800, 0x0401f82a, - 0x04000011, 0x40043800, 0x42001800, 0x00000001, - 0x40142000, 0x0401f8f0, 0x0402000b, 0x801c3800, - 0x501c0000, 0x44000800, 0x0401f810, 0x801c0580, - 0x04000004, 0x44103800, 0x801c3840, 0x44143800, - 0x0401f819, 0x5c01f000, 0x1c01f000, 0x80f9f1c0, - 0x04020003, 0x58f41202, 0x0401f003, 0x42001000, - 0x00000007, 0x1c01f000, 0x80f9f1c0, 0x04020006, - 0x58f40401, 0x82000480, 0x00000002, 0x80f40400, - 0x0401f005, 0x58f80401, 0x82000480, 0x00000002, - 0x80f80400, 0x50002800, 0x80000000, 0x50002000, - 0x1c01f000, 0x80f9f1c0, 0x04020008, 0x58f40401, + 0x4d380000, 0x59300c07, 0x82040580, 0x00000009, + 0x04020006, 0x42027000, 0x00000047, 0x0201f800, + 0x00020a34, 0x80000580, 0x5c027000, 0x1c01f000, + 0x4c500000, 0x4a03900d, 0x00000001, 0x59c8a020, + 0x4a03900d, 0x00000002, 0x59c80820, 0x8c50a52e, + 0x04000002, 0x900409c0, 0x82040d00, 0x0000ffff, + 0x0201f800, 0x00105617, 0x5c00a000, 0x1c01f000, + 0x42000000, 0x0010bd0c, 0x0201f800, 0x0010ae10, + 0x0401ffec, 0x0400004e, 0x4933c857, 0x59300407, + 0x82000580, 0x00000000, 0x04000049, 0x59c82021, + 0x4a03900d, 0x00000001, 0x59c82821, 0x82142d00, + 0x0000ffff, 0x59325809, 0x812e59c0, 0x04000040, + 0x5932680a, 0x0201f800, 0x001040c4, 0x02020800, + 0x00108c1b, 0x599c0019, 0x8c00050c, 0x04020018, + 0x0201f800, 0x001040c4, 0x04020015, 0x59300812, + 0x4807c857, 0x592c0409, 0x8c00051c, 0x0402000e, + 0x8400055c, 0x48025c09, 0x592c0a05, 0x82040d00, + 0x000000ff, 0x82040580, 0x00000048, 0x04000004, + 0x82040580, 0x00000018, 0x04020003, 0x59300812, + 0x48065803, 0x4a026012, 0x7fffffff, 0x48166014, + 0x0201f800, 0x001040c4, 0x04000004, 0x59300415, + 0x8c00051c, 0x04000004, 0x599c0019, 0x8c00050c, + 0x04000017, 0x0201f800, 0x00100e5a, 0x04020014, + 0x0401fa2f, 0x40280000, 0x4802600e, 0x04000005, + 0x4832600c, 0x50200000, 0x4802600b, 0x4822600d, + 0x59300415, 0x8c00051c, 0x04020004, 0x599c0019, + 0x8c00050c, 0x04020885, 0x4a03900d, 0x00000040, + 0x4a0370e5, 0x00000008, 0x1c01f000, 0x42000000, + 0x0010bd15, 0x0201f800, 0x0010ae10, 0x5988014c, + 0x80000000, 0x4803114c, 0x4a03900d, 0x00000040, + 0x42000000, 0xc0000000, 0x0201f000, 0x00020105, + 0x4cf80000, 0x58f40000, 0x8001f540, 0x0401f820, + 0x41781800, 0x0401f8f9, 0x04020014, 0x44140800, + 0x0401f82a, 0x04000011, 0x40043800, 0x42001800, + 0x00000001, 0x40142000, 0x0401f8f0, 0x0402000b, + 0x801c3800, 0x501c0000, 0x44000800, 0x0401f810, + 0x801c0580, 0x04000004, 0x44103800, 0x801c3840, + 0x44143800, 0x0401f819, 0x5c01f000, 0x1c01f000, + 0x80f9f1c0, 0x04020003, 0x58f41202, 0x0401f003, + 0x42001000, 0x00000007, 0x1c01f000, 0x80f9f1c0, + 0x04020006, 0x58f40401, 0x82000480, 0x00000002, + 0x80f40400, 0x0401f005, 0x58f80401, 0x82000480, + 0x00000002, 0x80f80400, 0x50002800, 0x80000000, + 0x50002000, 0x1c01f000, 0x80f9f1c0, 0x04020008, + 0x58f40401, 0x82000480, 0x00000002, 0x02001800, + 0x0010032d, 0x4801ec01, 0x0401f00b, 0x58f80401, 0x82000480, 0x00000002, 0x02001800, 0x0010032d, - 0x4801ec01, 0x0401f00b, 0x58f80401, 0x82000480, - 0x00000002, 0x02001800, 0x0010032d, 0x4801f401, - 0x82000580, 0x00000002, 0x04020002, 0x0401f81b, - 0x58f40202, 0x80000040, 0x4801ea02, 0x02000800, - 0x0010032d, 0x82000580, 0x00000001, 0x1c01f000, - 0x82f40580, 0xffffffff, 0x0400000f, 0x58f40201, + 0x4801f401, 0x82000580, 0x00000002, 0x04020002, + 0x0401f81b, 0x58f40202, 0x80000040, 0x4801ea02, + 0x02000800, 0x0010032d, 0x82000580, 0x00000001, + 0x1c01f000, 0x82f40580, 0xffffffff, 0x0400000f, + 0x58f40201, 0x82000580, 0x0000dcb3, 0x02020800, + 0x0010032d, 0x58f40000, 0x8001f540, 0x04000006, + 0x58f80201, 0x82000580, 0x0000ddb9, 0x02020800, + 0x0010032d, 0x0401f80a, 0x1c01f000, 0x4d2c0000, + 0x40fa5800, 0x0201f800, 0x00100580, 0x4979e800, + 0x4179f000, 0x5c025800, 0x1c01f000, 0x80f5e9c0, + 0x04000009, 0x80f9f1c0, 0x04020ff5, 0x4d2c0000, + 0x40f65800, 0x0201f800, 0x00100580, 0x4179e800, + 0x5c025800, 0x1c01f000, 0x4cf40000, 0x0201f800, + 0x001040c4, 0x04020036, 0x59300808, 0x82040500, + 0x00013100, 0x04020032, 0x8c040d22, 0x04000032, + 0x59300020, 0x8001ed40, 0x02000800, 0x0010032d, + 0x82000580, 0xffffffff, 0x04000029, 0x58f40201, 0x82000580, 0x0000dcb3, 0x02020800, 0x0010032d, - 0x58f40000, 0x8001f540, 0x04000006, 0x58f80201, - 0x82000580, 0x0000ddb9, 0x02020800, 0x0010032d, - 0x0401f80a, 0x1c01f000, 0x4d2c0000, 0x40fa5800, - 0x0201f800, 0x00100580, 0x4979e800, 0x4179f000, - 0x5c025800, 0x1c01f000, 0x80f5e9c0, 0x04000009, - 0x80f9f1c0, 0x04020ff5, 0x4d2c0000, 0x40f65800, - 0x0201f800, 0x00100580, 0x4179e800, 0x5c025800, - 0x1c01f000, 0x4cf40000, 0x0201f800, 0x001040aa, - 0x04020036, 0x59300808, 0x82040500, 0x00013100, - 0x04020032, 0x8c040d22, 0x04000032, 0x59300020, - 0x8001ed40, 0x02000800, 0x0010032d, 0x82000580, - 0xffffffff, 0x04000029, 0x58f40201, 0x82000580, - 0x0000dcb3, 0x02020800, 0x0010032d, 0x58f40a02, - 0x82040500, 0x0000fffe, 0x04000003, 0x0401ff74, - 0x58f40a02, 0x82040480, 0x0000000f, 0x04021059, - 0x80040800, 0x4805ea02, 0x82040580, 0x00000008, - 0x0400005d, 0x82040480, 0x00000008, 0x0400100a, - 0x58f40000, 0x8001ed40, 0x02000800, 0x0010032d, - 0x58f40201, 0x82000580, 0x0000ddb9, 0x02020800, - 0x0010032d, 0x58f40401, 0x82000c00, 0x00000002, - 0x4805ec01, 0x80f40400, 0x59300813, 0x44040000, - 0x80000000, 0x45780000, 0x5c01e800, 0x1c01f000, - 0x42001000, 0x00000400, 0x59b800e4, 0x8c000524, - 0x04020023, 0x4a0370e4, 0x00030000, 0x40000000, - 0x59b800e4, 0x8c000524, 0x0402001b, 0x59300808, - 0x84040d62, 0x48066008, 0x4a0370e4, 0x00020000, - 0x4d2c0000, 0x0201f800, 0x0010055a, 0x04000025, - 0x492e6020, 0x4a025a01, 0x0000dcb3, 0x59300009, - 0x80001d40, 0x02000800, 0x0010032d, 0x580c0810, - 0x48065803, 0x59301812, 0x40040000, 0x800c0580, - 0x0402000d, 0x497a5a02, 0x4a025c01, 0x00000004, - 0x0401f011, 0x4a0370e4, 0x00020000, 0x40000000, - 0x40000000, 0x80081040, 0x02000800, 0x0010032d, - 0x0401f7d6, 0x4a025a02, 0x00000001, 0x4a025c01, - 0x00000006, 0x497a5804, 0x400c0000, 0x80040480, - 0x48025805, 0x412de800, 0x5c025800, 0x0401f7a9, - 0x5c025800, 0x4a026020, 0xffffffff, 0x0401f7c3, - 0x4d2c0000, 0x58f65800, 0x0201f800, 0x00100580, - 0x40f65800, 0x0201f800, 0x00100580, 0x5c025800, - 0x0401f7f5, 0x4d2c0000, 0x0201f800, 0x0010055a, - 0x040007f8, 0x4a025a01, 0x0000ddb9, 0x4a025c01, - 0x00000002, 0x492de800, 0x412de800, 0x5c025800, - 0x0401f7a5, 0x0401ff1e, 0x82f40400, 0x00000004, - 0x800c0400, 0x40000800, 0x50040000, 0x80100580, - 0x04000016, 0x82040c00, 0x00000002, 0x80081040, - 0x040207fa, 0x80f9f1c0, 0x04000011, 0x58f41202, - 0x82081480, 0x00000007, 0x82f80400, 0x00000002, - 0x800c0400, 0x40000800, 0x50040000, 0x80100580, - 0x04000006, 0x82040c00, 0x00000002, 0x80081040, - 0x040207fa, 0x0401f002, 0x1c01f000, 0x82000540, - 0x00000001, 0x0401f7fd, 0x4cf40000, 0x4cf80000, - 0x4001e800, 0x812e59c0, 0x04000024, 0x592c0a07, - 0x800409c0, 0x04020021, 0x82f40580, 0xffffffff, - 0x0400001b, 0x58f40201, 0x82000580, 0x0000dcb3, - 0x02020800, 0x0010032d, 0x58f40000, 0x8001f540, - 0x04000006, 0x58f80201, 0x82000580, 0x0000ddb9, - 0x02020800, 0x0010032d, 0x41783800, 0x58f44003, - 0x0401f839, 0x04020009, 0x0401ff2c, 0x497a6020, - 0x59300808, 0x84040d22, 0x48066008, 0x5c01f000, - 0x5c01e800, 0x1c01f000, 0x0401ff24, 0x4a025a07, - 0x00000011, 0x0401f7f6, 0x0401ff06, 0x0401f7f4, - 0x4cf40000, 0x4cf80000, 0x4001e800, 0x82040580, - 0x00000001, 0x04020020, 0x82f40580, 0xffffffff, - 0x0400001a, 0x58f40201, 0x82000580, 0x0000dcb3, - 0x02020800, 0x0010032d, 0x58f40000, 0x8001f540, - 0x04000006, 0x58f80201, 0x82000580, 0x0000ddb9, - 0x02020800, 0x0010032d, 0x41783800, 0x58f44003, - 0x0401f811, 0x04020008, 0x0401ff04, 0x42000800, - 0x00000001, 0x497a6020, 0x5c01f000, 0x5c01e800, - 0x1c01f000, 0x0401fefd, 0x42000800, 0x00000011, - 0x0401f7f9, 0x4c040000, 0x0401fede, 0x5c000800, - 0x0401f7f5, 0x4803c856, 0x401c2000, 0x41781800, - 0x4c200000, 0x0401ff88, 0x5c004000, 0x0402002a, - 0x40202000, 0x42001800, 0x00000001, 0x0401ff82, - 0x04020025, 0x0401fe9e, 0x40082800, 0x82f43400, - 0x00000004, 0x50182000, 0x40100000, 0x801c0580, - 0x04000005, 0x42001800, 0x00000001, 0x0401ff76, - 0x04020019, 0x82183400, 0x00000002, 0x80142840, - 0x040207f5, 0x80f9f1c0, 0x04000012, 0x58f42a02, - 0x82142c80, 0x00000007, 0x82f83400, 0x00000002, - 0x50182000, 0x40100000, 0x801c0580, 0x04000005, - 0x42001800, 0x00000001, 0x0401ff63, 0x04020006, - 0x82183400, 0x00000002, 0x80142840, 0x040207f5, - 0x1c01f000, 0x82000540, 0x00000001, 0x0401f7fd, - 0x0201f800, 0x0010032d, 0x58380a05, 0x82040d00, - 0x000000ff, 0x82040580, 0x0000001b, 0x04000004, - 0x82040580, 0x0000002b, 0x040207f6, 0x50200000, - 0x80387c00, 0x583c2800, 0x583c2001, 0x583c1002, - 0x592c0a08, 0x58383010, 0x59303808, 0x497a6013, - 0x497a6014, 0x0201f000, 0x00020149, 0x58380208, - 0x8c000502, 0x040007e7, 0x50200000, 0x80387c00, - 0x583c2800, 0x583c2001, 0x58380405, 0x80001540, - 0x04020002, 0x58381408, 0x58c83401, 0x58380c09, - 0x59303808, 0x497a6013, 0x497a6014, 0x0201f000, - 0x00020149, 0x592c0409, 0x8c000502, 0x040007d5, - 0x592c040a, 0x80000540, 0x040007d2, 0x82000c80, - 0x00000002, 0x04001011, 0x58380001, 0x80007540, - 0x02000800, 0x0010032d, 0x58380205, 0x82000500, - 0x0000000f, 0x82000400, 0x00100e39, 0x50004000, - 0x40040000, 0x800409c0, 0x04000005, 0x82040c80, - 0x00000005, 0x040217f1, 0x80204400, 0x50200000, - 0x80387c00, 0x583c2800, 0x583c2001, 0x583c1002, - 0x592c0a08, 0x592c4c09, 0x592c300e, 0x59303808, - 0x497a6013, 0x497a6014, 0x4816600f, 0x48126010, - 0x480a6011, 0x481a6012, 0x80040840, 0x4806600e, - 0x02000000, 0x00020151, 0x80204000, 0x50201800, - 0x800c19c0, 0x0402000c, 0x58380001, 0x80007540, - 0x02000800, 0x0010032d, 0x58380205, 0x82000500, - 0x0000000f, 0x82000400, 0x00100e39, 0x50004000, - 0x50201800, 0x483a600c, 0x480e600b, 0x4822600d, - 0x0201f000, 0x00020151, 0x4803c856, 0x592c0209, - 0x8c00051e, 0x04020017, 0x50200000, 0x80306c00, - 0x40240000, 0x0c01f001, 0x00100b7e, 0x00100b7e, - 0x00100b87, 0x00100b7e, 0x00100b7e, 0x00100b7e, - 0x00100b7e, 0x00100b7e, 0x00100b87, 0x00100b7e, - 0x00100b87, 0x00100b7e, 0x00100b7e, 0x00100b87, - 0x00100b7e, 0x00100b7e, 0x0201f800, 0x0010032d, - 0x8400051e, 0x48025a09, 0x50200000, 0x80306c00, - 0x58343801, 0x481e6010, 0x0401f007, 0x58341802, - 0x58342800, 0x58343801, 0x480e6011, 0x4816600f, - 0x481e6010, 0x0401f28a, 0x4933c857, 0x5931f809, - 0x59301006, 0x800811c0, 0x0400000b, 0x41780800, - 0x42000000, 0x0000000a, 0x0201f800, 0x00105f69, - 0x80080102, 0x04020002, 0x84001542, 0x80081040, - 0x4809fc07, 0x4a026006, 0x00000002, 0x592c040a, - 0x82000500, 0x00000008, 0x0400000b, 0x0401f831, - 0x59300203, 0x82000580, 0x00000004, 0x04020005, - 0x42027000, 0x00000048, 0x0201f800, 0x00020a34, - 0x1c01f000, 0x4cfc0000, 0x58fc0205, 0x82000500, - 0x000000ff, 0x82000580, 0x00000048, 0x04020009, - 0x58fc0409, 0x8c000500, 0x04000006, 0x58fc080c, - 0x8c040d16, 0x04000017, 0x58fc0008, 0x0401f00a, - 0x58fc0409, 0x8c000512, 0x04020014, 0x58fc0c0a, - 0x8c040d16, 0x04020003, 0x5c01f800, 0x1c01f000, - 0x58fc000b, 0x59300812, 0x80040580, 0x04020009, - 0x59300008, 0x84000500, 0x48026008, 0x42027000, - 0x00000048, 0x5c01f800, 0x0201f000, 0x00020a34, - 0x5c01f800, 0x1c01f000, 0x58fdf80a, 0x0401f7ec, - 0x5c000000, 0x4c000000, 0x4803c857, 0x4933c857, - 0x59b808ea, 0x82040d00, 0x00000007, 0x82040580, - 0x00000000, 0x04000025, 0x82040580, 0x00000003, - 0x04000022, 0x59300407, 0x4c000000, 0x4a026407, - 0x00000000, 0x42003000, 0x00000041, 0x4a0370e5, - 0x00003000, 0x42000000, 0x50000000, 0x41300800, - 0x4c180000, 0x0401fcac, 0x5c003000, 0x0400000e, - 0x42000000, 0x0000001e, 0x80000040, 0x040207ff, - 0x80183040, 0x040207f4, 0x42000000, 0x40000000, - 0x41300800, 0x0401fca0, 0x59880146, 0x80000000, - 0x48031146, 0x4a0370e5, 0x00002000, 0x5c000000, - 0x48026407, 0x1c01f000, 0x59300008, 0x84000500, - 0x48026008, 0x0401f7fc, 0x59c00007, 0x4a038006, - 0x30000000, 0x40000000, 0x59c00007, 0x8c00050a, - 0x040207fe, 0x1c01f000, 0x5c000000, 0x4c000000, - 0x4803c857, 0x42000800, 0x00000001, 0x0201f800, - 0x00101993, 0x4dc00000, 0x4a0370e8, 0x00000000, - 0x42038000, 0x00007720, 0x0401ffec, 0x42038000, - 0x00007700, 0x0401ffe9, 0x0201f800, 0x00104716, - 0x04020017, 0x4a038891, 0x0000ffff, 0x497b8880, - 0x4ce80000, 0x4201d000, 0x00000016, 0x0201f800, - 0x0010592d, 0x497b8892, 0x4201d000, 0x00000016, - 0x0201f800, 0x0010592d, 0x5c01d000, 0x42000000, - 0x0010bc60, 0x0201f800, 0x0010ad1d, 0x0401f812, - 0x5c038000, 0x0201f000, 0x0010483a, 0x0401f830, - 0x4c080000, 0x4c140000, 0x42000000, 0x0010bc61, - 0x0201f800, 0x0010ad1d, 0x0401f807, 0x5c002800, - 0x5c001000, 0x48178892, 0x480b8880, 0x5c038000, - 0x1c01f000, 0x496fc857, 0x836c0580, 0x00000003, - 0x0402000b, 0x4c080000, 0x4c0c0000, 0x42001000, - 0x00008048, 0x42001800, 0x0000ffff, 0x0201f800, - 0x001031eb, 0x5c001800, 0x5c001000, 0x42000800, - 0x0000003c, 0x0201f800, 0x001010da, 0x59a8006a, - 0x80000540, 0x04000005, 0x59a8106b, 0x800811c0, - 0x02020800, 0x001018fe, 0x4a038891, 0x0000ffff, - 0x4a03900d, 0x00000040, 0x0201f800, 0x00100684, - 0x4a0370e8, 0x00000001, 0x1c01f000, 0x5c000000, - 0x4c000000, 0x4803c857, 0x59c41080, 0x497b8880, - 0x4ce80000, 0x4201d000, 0x00000016, 0x4c080000, - 0x0201f800, 0x0010592d, 0x5c001000, 0x5c01d000, - 0x59c42892, 0x497b8892, 0x0201f800, 0x00104716, - 0x04020002, 0x1c01f000, 0x42002000, 0x00000260, - 0x59c418a4, 0x820c1d00, 0x0000000f, 0x820c0580, - 0x00000000, 0x04000010, 0x59c41805, 0x820c1d00, - 0x00000001, 0x0402000e, 0x59c418a4, 0x820c1d00, - 0x0000000f, 0x820c0480, 0x00000007, 0x04001004, - 0x820c0480, 0x0000000c, 0x04001003, 0x80102040, - 0x040207ec, 0x497b8891, 0x1c01f000, 0x4c100000, - 0x42002000, 0x00000019, 0x4a038805, 0x00000001, - 0x0201f800, 0x00101730, 0x59c41805, 0x820c1d00, - 0x00000001, 0x04000005, 0x80102040, 0x040207f7, - 0x5c002000, 0x0401f7f0, 0x5c002000, 0x0401f7ec, - 0x4803c856, 0x1c01f000, 0x00100cb6, 0x00100cb6, - 0x00100cb6, 0x00100cda, 0x00100cb6, 0x00100cb6, - 0x00100cb6, 0x00100cb6, 0x00100cb6, 0x00100cda, - 0x00100cb6, 0x00100cb8, 0x00100cb6, 0x00100cb6, - 0x00100cb6, 0x00100cb6, 0x0201f800, 0x0010032d, - 0x82040580, 0x0000001b, 0x0400001a, 0x82040580, - 0x0000002b, 0x04000017, 0x82040580, 0x0000003b, - 0x02020800, 0x0010032d, 0x592c020b, 0x8c000500, - 0x04000073, 0x592c1a08, 0x82040500, 0x0000000f, - 0x82000400, 0x00100e39, 0x50001000, 0x50080000, - 0x59302014, 0x4802600b, 0x492e600c, 0x480a600d, - 0x480e600e, 0x48126013, 0x5c025800, 0x1c01f000, - 0x592c0010, 0x48026012, 0x592c0011, 0x48026014, - 0x592c1a08, 0x0401f7ed, 0x82040500, 0x0000000f, - 0x82000400, 0x00100e39, 0x50001000, 0x50080000, - 0x592c1a08, 0x4802600b, 0x492e600c, 0x480a600d, - 0x480e600e, 0x497a6013, 0x0401f7ec, 0x8c040d00, - 0x0402004f, 0x82040d00, 0x00000080, 0x0400004c, - 0x0201f000, 0x00020164, 0x59300014, 0x59301013, - 0x80080580, 0x0402000c, 0x42007800, 0x80000005, - 0x592c1209, 0x82080500, 0xffff7fff, 0x48025a09, - 0x8c08151e, 0x0402003b, 0x823c7d40, 0x00000020, - 0x0401f038, 0x480bc857, 0x42000000, 0x0010bc0d, - 0x0201f800, 0x0010ad1d, 0x59302014, 0x59300415, - 0x4803c857, 0x8c000514, 0x04020011, 0x599c1819, - 0x8c0c1d12, 0x0400000b, 0x592c0810, 0x59300016, - 0x80040c80, 0x04000005, 0x04001004, 0x80040000, - 0x80140480, 0x0400100a, 0x0201f800, 0x00107134, - 0x820c1d40, 0x00000001, 0x0401f020, 0x84000514, - 0x48026415, 0x48126016, 0x4813c857, 0x0401f93e, - 0x0402001a, 0x42007800, 0x80000005, 0x5930500e, - 0x592c0209, 0x4803c857, 0x8c00051e, 0x04020005, - 0x823c7d40, 0x00000020, 0x5930400d, 0x0401f004, - 0x8400051e, 0x48025a09, 0x0401f8ed, 0x50201800, - 0x480e600b, 0x4832600c, 0x4822600d, 0x482a600e, - 0x480fc857, 0x4833c857, 0x4823c857, 0x482bc857, - 0x80000580, 0x483e6004, 0x1c01f000, 0x0201f800, - 0x0010032d, 0x4933c857, 0x4d2c0000, 0x59900004, + 0x58f40a02, 0x82040500, 0x0000fffe, 0x04000003, + 0x0401ff74, 0x58f40a02, 0x82040480, 0x0000000f, + 0x04021059, 0x80040800, 0x4805ea02, 0x82040580, + 0x00000008, 0x0400005d, 0x82040480, 0x00000008, + 0x0400100a, 0x58f40000, 0x8001ed40, 0x02000800, + 0x0010032d, 0x58f40201, 0x82000580, 0x0000ddb9, + 0x02020800, 0x0010032d, 0x58f40401, 0x82000c00, + 0x00000002, 0x4805ec01, 0x80f40400, 0x59300813, + 0x44040000, 0x80000000, 0x45780000, 0x5c01e800, + 0x1c01f000, 0x42001000, 0x00000400, 0x59b800e4, + 0x8c000524, 0x04020023, 0x4a0370e4, 0x00030000, + 0x40000000, 0x59b800e4, 0x8c000524, 0x0402001b, + 0x59300808, 0x84040d62, 0x48066008, 0x4a0370e4, + 0x00020000, 0x4d2c0000, 0x0201f800, 0x0010055a, + 0x04000025, 0x492e6020, 0x4a025a01, 0x0000dcb3, + 0x59300009, 0x80001d40, 0x02000800, 0x0010032d, + 0x580c0810, 0x48065803, 0x59301812, 0x40040000, + 0x800c0580, 0x0402000d, 0x497a5a02, 0x4a025c01, + 0x00000004, 0x0401f011, 0x4a0370e4, 0x00020000, + 0x40000000, 0x40000000, 0x80081040, 0x02000800, + 0x0010032d, 0x0401f7d6, 0x4a025a02, 0x00000001, + 0x4a025c01, 0x00000006, 0x497a5804, 0x400c0000, + 0x80040480, 0x48025805, 0x412de800, 0x5c025800, + 0x0401f7a9, 0x5c025800, 0x4a026020, 0xffffffff, + 0x0401f7c3, 0x4d2c0000, 0x58f65800, 0x0201f800, + 0x00100580, 0x40f65800, 0x0201f800, 0x00100580, + 0x5c025800, 0x0401f7f5, 0x4d2c0000, 0x0201f800, + 0x0010055a, 0x040007f8, 0x4a025a01, 0x0000ddb9, + 0x4a025c01, 0x00000002, 0x492de800, 0x412de800, + 0x5c025800, 0x0401f7a5, 0x0401ff1e, 0x82f40400, + 0x00000004, 0x800c0400, 0x40000800, 0x50040000, + 0x80100580, 0x04000016, 0x82040c00, 0x00000002, + 0x80081040, 0x040207fa, 0x80f9f1c0, 0x04000011, + 0x58f41202, 0x82081480, 0x00000007, 0x82f80400, + 0x00000002, 0x800c0400, 0x40000800, 0x50040000, + 0x80100580, 0x04000006, 0x82040c00, 0x00000002, + 0x80081040, 0x040207fa, 0x0401f002, 0x1c01f000, + 0x82000540, 0x00000001, 0x0401f7fd, 0x4cf40000, + 0x4cf80000, 0x4001e800, 0x812e59c0, 0x04000024, + 0x592c0a07, 0x800409c0, 0x04020021, 0x82f40580, + 0xffffffff, 0x0400001b, 0x58f40201, 0x82000580, + 0x0000dcb3, 0x02020800, 0x0010032d, 0x58f40000, + 0x8001f540, 0x04000006, 0x58f80201, 0x82000580, + 0x0000ddb9, 0x02020800, 0x0010032d, 0x41783800, + 0x58f44003, 0x0401f839, 0x04020009, 0x0401ff2c, + 0x497a6020, 0x59300808, 0x84040d22, 0x48066008, + 0x5c01f000, 0x5c01e800, 0x1c01f000, 0x0401ff24, + 0x4a025a07, 0x00000011, 0x0401f7f6, 0x0401ff06, + 0x0401f7f4, 0x4cf40000, 0x4cf80000, 0x4001e800, + 0x82040580, 0x00000001, 0x04020020, 0x82f40580, + 0xffffffff, 0x0400001a, 0x58f40201, 0x82000580, + 0x0000dcb3, 0x02020800, 0x0010032d, 0x58f40000, + 0x8001f540, 0x04000006, 0x58f80201, 0x82000580, + 0x0000ddb9, 0x02020800, 0x0010032d, 0x41783800, + 0x58f44003, 0x0401f811, 0x04020008, 0x0401ff04, + 0x42000800, 0x00000001, 0x497a6020, 0x5c01f000, + 0x5c01e800, 0x1c01f000, 0x0401fefd, 0x42000800, + 0x00000011, 0x0401f7f9, 0x4c040000, 0x0401fede, + 0x5c000800, 0x0401f7f5, 0x4803c856, 0x401c2000, + 0x41781800, 0x4c200000, 0x0401ff88, 0x5c004000, + 0x0402002a, 0x40202000, 0x42001800, 0x00000001, + 0x0401ff82, 0x04020025, 0x0401fe9e, 0x40082800, + 0x82f43400, 0x00000004, 0x50182000, 0x40100000, + 0x801c0580, 0x04000005, 0x42001800, 0x00000001, + 0x0401ff76, 0x04020019, 0x82183400, 0x00000002, + 0x80142840, 0x040207f5, 0x80f9f1c0, 0x04000012, + 0x58f42a02, 0x82142c80, 0x00000007, 0x82f83400, + 0x00000002, 0x50182000, 0x40100000, 0x801c0580, + 0x04000005, 0x42001800, 0x00000001, 0x0401ff63, + 0x04020006, 0x82183400, 0x00000002, 0x80142840, + 0x040207f5, 0x1c01f000, 0x82000540, 0x00000001, + 0x0401f7fd, 0x0201f800, 0x0010032d, 0x58380a05, + 0x82040d00, 0x000000ff, 0x82040580, 0x0000001b, + 0x04000004, 0x82040580, 0x0000002b, 0x040207f6, + 0x50200000, 0x80387c00, 0x583c2800, 0x583c2001, + 0x583c1002, 0x592c0a08, 0x58383010, 0x59303808, + 0x497a6013, 0x497a6014, 0x0201f000, 0x00020149, + 0x58380208, 0x8c000502, 0x040007e7, 0x50200000, + 0x80387c00, 0x583c2800, 0x583c2001, 0x58380405, + 0x80001540, 0x04020002, 0x58381408, 0x58c83401, + 0x58380c09, 0x59303808, 0x497a6013, 0x497a6014, + 0x0201f000, 0x00020149, 0x592c0409, 0x8c000502, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 02:08:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8D0A106566B; Mon, 18 Jun 2012 02:08:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A96E28FC0A; Mon, 18 Jun 2012 02:08:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5I284bM047331; Mon, 18 Jun 2012 02:08:04 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5I284Gq047328; Mon, 18 Jun 2012 02:08:04 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206180208.q5I284Gq047328@svn.freebsd.org> From: Adrian Chadd Date: Mon, 18 Jun 2012 02:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237214 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 02:08:04 -0000 Author: adrian Date: Mon Jun 18 02:08:04 2012 New Revision: 237214 URL: http://svn.freebsd.org/changeset/base/237214 Log: Extend the radiotap code to be aware of the size of any extra vendor bitmaps that may occur. The way this works is: * the beginning of the radiotap frame has a 32 bit "radiotap" namespace bitmap; * if the vendor bitmap bit is set, then the next bitmap will be interpreted as a vendor bitmap; * this can keep going on and on (ie, more vendor and radiotap namespace bitmaps can be added) until the last bitmap with no "more bitmaps" set. Now, the radiotap code gets its grubby fingers into the supplied radiotap rx/tx buffer and replaces the channel configuration for each frame. I don't know why it's not up to the drivers themselves to do this, but I digress. So, if a vendor bitmap (or two, etc) exists, the offset calculations will be all completely wrong. This particular patch introduces ieee80211_radiotap_attachv(), which includes the number of vendor bitmaps (well, any other bitmaps, vendor or otherwise) between the end of the bitmap/header and the start of the actual radiotap field entries. This makes the radiotap calculations "right", so it correctly calculates where to overwrite the channel configuration. The long term fix is to go through and make each driver update the channel configuration, as some of the fields are already being updated. That, however, is a longer term fix that will need each driver fixed. I leave that as an exercise to someone in the future. Modified: head/sys/net80211/ieee80211_radiotap.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_radiotap.c ============================================================================== --- head/sys/net80211/ieee80211_radiotap.c Sun Jun 17 21:48:40 2012 (r237213) +++ head/sys/net80211/ieee80211_radiotap.c Mon Jun 18 02:08:04 2012 (r237214) @@ -47,13 +47,24 @@ __FBSDID("$FreeBSD$"); #include -static int radiotap_offset(struct ieee80211_radiotap_header *, int); +static int radiotap_offset(struct ieee80211_radiotap_header *, int, int); void ieee80211_radiotap_attach(struct ieee80211com *ic, struct ieee80211_radiotap_header *th, int tlen, uint32_t tx_radiotap, struct ieee80211_radiotap_header *rh, int rlen, uint32_t rx_radiotap) { + ieee80211_radiotap_attachv(ic, th, tlen, 0, tx_radiotap, + rh, rlen, 0, rx_radiotap); +} + +void +ieee80211_radiotap_attachv(struct ieee80211com *ic, + struct ieee80211_radiotap_header *th, + int tlen, int n_tx_v, uint32_t tx_radiotap, + struct ieee80211_radiotap_header *rh, + int rlen, int n_rx_v, uint32_t rx_radiotap) +{ #define B(_v) (1<<(_v)) int off; @@ -63,9 +74,9 @@ ieee80211_radiotap_attach(struct ieee802 /* calculate offset to channel data */ off = -1; if (tx_radiotap & B(IEEE80211_RADIOTAP_CHANNEL)) - off = radiotap_offset(th, IEEE80211_RADIOTAP_CHANNEL); + off = radiotap_offset(th, n_tx_v, IEEE80211_RADIOTAP_CHANNEL); else if (tx_radiotap & B(IEEE80211_RADIOTAP_XCHANNEL)) - off = radiotap_offset(th, IEEE80211_RADIOTAP_XCHANNEL); + off = radiotap_offset(th, n_tx_v, IEEE80211_RADIOTAP_XCHANNEL); if (off == -1) { if_printf(ic->ic_ifp, "%s: no tx channel, radiotap 0x%x\n", __func__, tx_radiotap); @@ -79,9 +90,9 @@ ieee80211_radiotap_attach(struct ieee802 /* calculate offset to channel data */ off = -1; if (rx_radiotap & B(IEEE80211_RADIOTAP_CHANNEL)) - off = radiotap_offset(rh, IEEE80211_RADIOTAP_CHANNEL); + off = radiotap_offset(rh, n_rx_v, IEEE80211_RADIOTAP_CHANNEL); else if (rx_radiotap & B(IEEE80211_RADIOTAP_XCHANNEL)) - off = radiotap_offset(rh, IEEE80211_RADIOTAP_XCHANNEL); + off = radiotap_offset(rh, n_rx_v, IEEE80211_RADIOTAP_XCHANNEL); if (off == -1) { if_printf(ic->ic_ifp, "%s: no rx channel, radiotap 0x%x\n", __func__, rx_radiotap); @@ -260,7 +271,8 @@ ieee80211_radiotap_rx_all(struct ieee802 * known -1 is returned. */ static int -radiotap_offset(struct ieee80211_radiotap_header *rh, int item) +radiotap_offset(struct ieee80211_radiotap_header *rh, + int n_vendor_attributes, int item) { static const struct { size_t align, width; @@ -334,6 +346,8 @@ radiotap_offset(struct ieee80211_radiota int off, i; off = sizeof(struct ieee80211_radiotap_header); + off += n_vendor_attributes * (sizeof(uint32_t)); + for (i = 0; i < IEEE80211_RADIOTAP_EXT; i++) { if ((present & (1< Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7957D1065673; Mon, 18 Jun 2012 04:07:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail35.syd.optusnet.com.au (mail35.syd.optusnet.com.au [211.29.133.51]) by mx1.freebsd.org (Postfix) with ESMTP id CA6398FC0C; Mon, 18 Jun 2012 04:07:11 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail35.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5I470ib018093 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 18 Jun 2012 14:07:02 +1000 Date: Mon, 18 Jun 2012 14:07:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Poul-Henning Kamp In-Reply-To: <201206172102.q5HL2mG9032399@svn.freebsd.org> Message-ID: <20120618130626.M952@besplex.bde.org> References: <201206172102.q5HL2mG9032399@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237203 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 04:07:12 -0000 On Sun, 17 Jun 2012, Poul-Henning Kamp wrote: > Log: > On certain newer Intel Atom based motherboards, for instance the > D2500CC which I have, syscons in text-mode fails to show the expected > contents due to write errors into video-memory. > > At least one of the causes is that we copy from syscons internal buffer > to the video memory with optimized bcopy(9) which uses >16bit operations. > > Until now, 32bit and wider operations have always worked on the video > memory, but since I cannot find a single source which says that this > SHALL work, and since these chipsets/bugs are now out there, this > commit changes syscons to always use 16bit copies on i386 & amd64. > > This may be relevevant for PR's: > 166262 > 166639 > and various other bug reports floating elsewhere on the net, but > I lack hardware to test those. There is no reason 16-bit copies should work either. IIRC, CRTC registers were once written 16 bits at a time, but some (rare) hardware doesn't like this. One would expect frame buffers to look more like memory than device ragisters, but it is apparently possible for this to be broken too. > > Modified: > head/sys/dev/fb/fbreg.h > > Modified: head/sys/dev/fb/fbreg.h > ============================================================================== > --- head/sys/dev/fb/fbreg.h Sun Jun 17 20:45:45 2012 (r237202) > +++ head/sys/dev/fb/fbreg.h Sun Jun 17 21:02:48 2012 (r237203) > @@ -35,9 +35,16 @@ > > /* some macros */ > #if defined(__amd64__) || defined(__i386__) > -#define bcopy_io(s, d, c) bcopy((void *)(s), (void *)(d), (c)) > -#define bcopy_toio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) > -#define bcopy_fromio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) Syscons used to use the bogus bcopyb() function to avoid this bug. This has been turned into nonsense -- bcopyb() still exists on i386, but is never used (it wasn't copied to amd64). The above was used instead. (bcopyb() is bogus because the interface is logically a bus-io one and has nothing to do with bcopy().) Syscons (fb) still uses the bogus fillw() function. fillw() is implemented bogusly. First, the corresponding API used by the main part of fb is named fillw_io(). That is not as bogus as bcopy*_io() since fillw() isn't a standard memory API like bcopy() is. But fillw() is bogus since it should have been named something like fillw_io() to begin with. Then: - on amd64 and i386, fillw() is a function "optimized" in support.[sS]. fillw_io() is #defined to this. - on other arches, fillw() is implemented using messy ifdefs: - on ia64, the ifdefs are used to obfuscate the logically correct function bus_space_set_region(2) as fillw_io() - on sparc64, a fillw() function is implemented in C, under a messy ifdef that seems to be completely broken -- fillw() is never used directly, and seems to be unattached to fillw_io() on sparc64 - on powerpc(), both fillw_io() and fillw() are #defined in terms of ofwfb_fillw(). Now fillw_io() exists, but fillw() seems to be unused garbage. - the #else clause if the messy ifdef is commented as being for !__i386__ && !__amd64__ && !__ia64__ && !__sparc64__ && !__powerpc__ (in that unsorted order. __amd64__ and __i386__ were not unsorted in the corresponding #if). I think this reduces to __arm__. So for arm, in this #else clause fillw_io() is #defined in terms of memset_io() (another bogus interface). The unused fillw() is defined in terms of memsetw(). This can be considered a non-bogus interface -- it can be like memset() and thus unsuitable for i/o, but take a "word" pattern instead of a u_char pattern. The full (?) set of bogus interfaces is easiest to see in this #else clause. It is bcopy_{io,toio,fromio}, bzero_io (another nonsense), and fill{_io,w,w_io}. > Modified: head/sys/dev/fb/fbreg.h > ============================================================================== > --- head/sys/dev/fb/fbreg.h Sun Jun 17 20:45:45 2012 (r237202) > +++ head/sys/dev/fb/fbreg.h Sun Jun 17 21:02:48 2012 (r237203) > @@ -35,9 +35,16 @@ > > /* some macros */ > #if defined(__amd64__) || defined(__i386__) > -#define bcopy_io(s, d, c) bcopy((void *)(s), (void *)(d), (c)) > -#define bcopy_toio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) > -#define bcopy_fromio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) > + > +static __inline void > +copyw(uint16_t *src, uint16_t *dst, size_t size) > +{ > + while (size--) > + *dst++ = *src++; > +} > +#define bcopy_io(s, d, c) copyw((void*)(s), (void*)(d), (c)) > +#define bcopy_toio(s, d, c) copyw((void*)(s), (void*)(d), (c)) > +#define bcopy_fromio(s, d, c) copyw((void*)(s), (void*)(d), (c)) This patch doesn't improve the above mess: - it is only for amd64 and i386 - it introduces yet another function and naming scheme that doesn't use bus space and doesn't have "io" in the basic function - it makes other old bugs more obvious: - space instead of tab after all #define's - bogus casts to (void *) for bcopy()'s args. These probably don't even hide bugs, since bcopy()'s prototype says to do the same conversions and the compiler probably doesn't warn about implicit conversions to void *. - bogus casts to (void *) for copyw()'s args. These may now hide bugs, since they are different from the ones that the prototype says to do, and the compiler would probably complain about implicit conversions fro a non-uint16_t * pointer to a uint16_t * one. > #define bzero_io(d, c) bzero((void *)(d), (c)) bzero() still does 32 or even 64 bit accesses. Hmm, I wonder if your hardware works with 32-bit accesses on i386 but not with 64-bit ones on amd64. > #define fill_io(p, d, c) fill((p), (void *)(d), (c)) > #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) I tried to get the powers that be to clean up this mess, but there was no interest. From old mail (the version that seems to have the most complete patch; perhaps not my best version of the patch): % On Wed, 17 Jun 2009, Bruce Evans wrote: % % ... % % Here are patches for RELENG_7 to remove the frame buffer grot from % i386 and partially clean it up in frame buffer code. This compiles % in a least 1 i386 kernel and is fast enough (22 MB/S for % % dd % % +#endif % % +/* XXX fix gratuitous MD spelling: */ % % +#ifdef __amd64__ % % +#define BUS_SPACE_MEM AMD64_BUS_SPACE_MEM % % +#endif % % +#ifdef __i386__ % % +#define BUS_SPACE_MEM I386_BUS_SPACE_MEM % % +#endif % % +#ifdef __ia64__ % % +#define BUS_SPACE_MEM IA64_BUS_SPACE_MEM % % +#endif % % +#if defined(__amd64__) || defined(__i386__) || defined(__ia64__) % % #define bcopy_fromio(s, d, c) \ % % - bus_space_read_region_1(IA64_BUS_SPACE_MEM, s, 0, (void*)(d), c) % % + bus_space_read_region_1(BUS_SPACE_MEM, s, 0, (void*)(d), c) % % #define bcopy_io(s, d, c) \ % % - bus_space_copy_region_1(IA64_BUS_SPACE_MEM, s, 0, d, 0, c) % % + bus_space_copy_region_1(BUS_SPACE_MEM, s, 0, d, 0, c) % % #define bcopy_toio(s, d, c) \ % % - bus_space_write_region_1(IA64_BUS_SPACE_MEM, d, 0, (void*)(s), c) % % + bus_space_write_region_1(BUS_SPACE_MEM, d, 0, (void*)(s), c) % % #define bzero_io(d, c) \ % % - bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, 0, c) % % + bus_space_set_region_1(BUS_SPACE_MEM, (intptr_t)(d), 0, 0, c) % % #define fill_io(p, d, c) \ % % - bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) % % + bus_space_set_region_1(BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) % % #define fillw_io(p, d, c) \ % % - bus_space_set_region_2(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) % % -#define readb(a) bus_space_read_1(IA64_BUS_SPACE_MEM, a, 0) % % -#define readw(a) bus_space_read_2(IA64_BUS_SPACE_MEM, a, 0) % % -#define writeb(a, v) bus_space_write_1(IA64_BUS_SPACE_MEM, a, 0, v) % % -#define writew(a, v) bus_space_write_2(IA64_BUS_SPACE_MEM, a, 0, v) % % -#define writel(a, v) bus_space_write_4(IA64_BUS_SPACE_MEM, a, 0, v) % % -#endif /* __ia64__ */ % % + bus_space_set_region_2(BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) % % +#define readb(a) bus_space_read_1(BUS_SPACE_MEM, a, 0) % % +#define readw(a) bus_space_read_2(BUS_SPACE_MEM, a, 0) % % +#define writeb(a, v) bus_space_write_1(BUS_SPACE_MEM, a, 0, v) % % +#define writew(a, v) bus_space_write_2(BUS_SPACE_MEM, a, 0, v) % % +#define writel(a, v) bus_space_write_4(BUS_SPACE_MEM, a, 0, v) % % +#endif /* __amd64__ || __i386__ || __ia64__ */ % % +/* fillw for __amd64__ || __i386__ || __ia64__ and || __sparc64__ too, ugh. */ % % static __inline void % % fillw(int val, uint16_t *buf, size_t size) % % @@ -102,5 +101,5 @@ % % #define fillw(p, d, c) memsetw((d), (p), (c)) % % #define fillw_io(p, d, c) memsetw_io((d), (p), (c)) % % -#endif /* !__i386__ */ % % +#endif % % % % /* video function table */ % % Index: dev/fb/vga.c % % =================================================================== % % RCS file: /home/ncvs/src/sys/dev/fb/vga.c,v % % retrieving revision 1.36 % % diff -u -2 -r1.36 vga.c % % --- dev/fb/vga.c 4 Dec 2005 02:12:41 -0000 1.36 % % +++ dev/fb/vga.c 17 Jun 2009 02:19:22 -0000 % % @@ -1331,15 +1331,4 @@ % % % % #ifndef VGA_NO_MODE_CHANGE % % -#if defined(__i386__) || defined(__amd64__) /* XXX */ % % -static void % % -fill(int val, void *d, size_t size) % % -{ % % - u_char *p = d; % % - % % - while (size-- > 0) % % - *p++ = val; % % -} % % -#endif /* __i386__ */ % % - % % static void % % filll_io(int val, vm_offset_t d, size_t size) Gak, yet another fill function to actually force 32-bit accesses. What does your hardware do with this and the bzero()s? The i586 optimized copying routines used 64-bit accesses even on i386, and of course for sp33d, bcopy should use SSE for 128-bit accesses. I wonder if there is only a problem with misaligned cases on your hardware. x86 bcopy() is intentionally sloppy with alignment since it expects callers to align if this is best for speed. But frame buffer accesses could naturally cause lots of cases with only 16-bit alignment. % % Index: i386/i386/support.s % % =================================================================== % % RCS file: /home/ncvs/src/sys/i386/i386/support.s,v % % retrieving revision 1.119.2.1 % % diff -u -2 -r1.119.2.1 support.s % % --- i386/i386/support.s 12 Jan 2009 15:48:22 -0000 1.119.2.1 % % +++ i386/i386/support.s 17 Jun 2009 01:43:27 -0000 % % @@ -429,49 +429,4 @@ % % END(i686_pagezero) % % % % -/* fillw(pat, base, cnt) */ % % -ENTRY(fillw) % % - pushl %edi % % - movl 8(%esp),%eax % % - movl 12(%esp),%edi % % - movl 16(%esp),%ecx % % - cld % % - rep % % - stosw % % - popl %edi % % - ret % % -END(fillw) % % - % % -ENTRY(bcopyb) % % - pushl %esi % % - pushl %edi % % - movl 12(%esp),%esi % % - movl 16(%esp),%edi % % - movl 20(%esp),%ecx % % - movl %edi,%eax % % - subl %esi,%eax % % - cmpl %ecx,%eax /* overlapping && src < dst? */ % % - jb 1f % % - cld /* nope, copy forwards */ % % - rep % % - movsb % % - popl %edi % % - popl %esi % % - ret % % - % % - ALIGN_TEXT % % -1: % % - addl %ecx,%edi /* copy backwards. */ % % - addl %ecx,%esi % % - decl %edi % % - decl %esi % % - std % % - rep % % - movsb % % - popl %edi % % - popl %esi % % - cld % % - ret % % -END(bcopyb) % % - % % ENTRY(bcopy) % % MEXITCOUNT % % Index: i386/include/cpufunc.h % % =================================================================== % % RCS file: /home/ncvs/src/sys/i386/include/cpufunc.h,v % % retrieving revision 1.145.2.1 % % diff -u -2 -r1.145.2.1 cpufunc.h % % --- i386/include/cpufunc.h 12 Jan 2009 15:48:22 -0000 1.145.2.1 % % +++ i386/include/cpufunc.h 17 Jun 2009 01:44:24 -0000 % % @@ -45,12 +45,4 @@ % % struct region_descriptor; % % % % -#define readb(va) (*(volatile u_int8_t *) (va)) % % -#define readw(va) (*(volatile u_int16_t *) (va)) % % -#define readl(va) (*(volatile u_int32_t *) (va)) % % - % % -#define writeb(va, d) (*(volatile u_int8_t *) (va) = (d)) % % -#define writew(va, d) (*(volatile u_int16_t *) (va) = (d)) % % -#define writel(va, d) (*(volatile u_int32_t *) (va) = (d)) % % - % % #if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) % % % % Index: i386/include/md_var.h % % =================================================================== % % RCS file: /home/ncvs/src/sys/i386/include/md_var.h,v % % retrieving revision 1.76.2.1 % % diff -u -2 -r1.76.2.1 md_var.h % % --- i386/include/md_var.h 21 Jan 2009 20:16:11 -0000 1.76.2.1 % % +++ i386/include/md_var.h 17 Jun 2009 01:44:01 -0000 % % @@ -80,5 +80,4 @@ % % struct dumperinfo; % % % % -void bcopyb(const void *from, void *to, size_t len); % % void busdma_swi(void); % % void cpu_setregs(void); % % @@ -95,5 +94,4 @@ % % void dump_drop_page(vm_paddr_t); % % void enable_sse(void); % % -void fillw(int /*u_short*/ pat, void *base, size_t cnt); % % void i486_bzero(void *buf, size_t len); % % void i586_bcopy(const void *from, void *to, size_t len); % % In fbreg.h, this just uses the ia64 macros for i386 (and for amd64, % untested) after s/IA64_//g. There are still messes for sparc64, % powerpc and default (arm only?), and new messes to get an MI name % for BUS_SPACE_MEM (the very idea of a frame buffer depends on having % a memory bus-space, so BUS_SPACE_MEM should be MI). fillw() doesn't % use bus space since it is for ordinary memory. It should probably % be implemented in vga.c. between fill() (removed above) and filll(). % fill() looks like it is for ordinary memory, but was only used for % bus space memory, only on amd64 and i386; thus it became unused. % It is also better spelled as memset(). fillw() and filll() would % probably be better spelled memset[wl]() like fillw() already is in % MD code for the default case. % % Bruce Bruce From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 04:55:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9C751065672; Mon, 18 Jun 2012 04:55:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1E2B8FC08; Mon, 18 Jun 2012 04:55:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5I4t8WG055177; Mon, 18 Jun 2012 04:55:08 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5I4t7Rp055134; Mon, 18 Jun 2012 04:55:07 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206180455.q5I4t7Rp055134@svn.freebsd.org> From: Eitan Adler Date: Mon, 18 Jun 2012 04:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237216 - in stable/9: bin/pwait bin/setfacl bin/sh games/pom lib/libbluetooth lib/libc/gen lib/libc/locale lib/libc/net lib/libc/posix1e lib/libc/stdio lib/libc/stdlib lib/libc/string ... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 04:55:09 -0000 Author: eadler Date: Mon Jun 18 04:55:07 2012 New Revision: 237216 URL: http://svn.freebsd.org/changeset/base/237216 Log: MFC r233648: Remove trailing whitespace per mdoc lint warning Approved by: cperciva (implicit) Modified: stable/9/bin/pwait/pwait.1 stable/9/bin/setfacl/setfacl.1 stable/9/bin/sh/sh.1 stable/9/games/pom/pom.6 stable/9/lib/libbluetooth/bluetooth.3 stable/9/lib/libc/gen/fts.3 stable/9/lib/libc/gen/getpagesizes.3 stable/9/lib/libc/gen/sysconf.3 stable/9/lib/libc/locale/ctype.3 stable/9/lib/libc/locale/ctype_l.3 stable/9/lib/libc/locale/digittoint.3 stable/9/lib/libc/locale/isalnum.3 stable/9/lib/libc/locale/isalpha.3 stable/9/lib/libc/locale/isblank.3 stable/9/lib/libc/locale/iscntrl.3 stable/9/lib/libc/net/sctp_bindx.3 stable/9/lib/libc/net/sctp_connectx.3 stable/9/lib/libc/net/sctp_freepaddrs.3 stable/9/lib/libc/net/sctp_getaddrlen.3 stable/9/lib/libc/net/sctp_getassocid.3 stable/9/lib/libc/net/sctp_getpaddrs.3 stable/9/lib/libc/net/sctp_opt_info.3 stable/9/lib/libc/net/sctp_recvmsg.3 stable/9/lib/libc/net/sctp_send.3 stable/9/lib/libc/net/sctp_sendmsg.3 stable/9/lib/libc/net/sourcefilter.3 stable/9/lib/libc/posix1e/acl_add_flag_np.3 stable/9/lib/libc/posix1e/acl_create_entry.3 stable/9/lib/libc/stdio/getline.3 stable/9/lib/libc/stdlib/at_quick_exit.3 stable/9/lib/libc/stdlib/getenv.3 stable/9/lib/libc/string/memchr.3 stable/9/lib/libc/sys/cap_new.2 stable/9/lib/libc/sys/cpuset.2 stable/9/lib/libc/sys/cpuset_getaffinity.2 stable/9/lib/libc/sys/kqueue.2 stable/9/lib/libc/sys/pathconf.2 stable/9/lib/libc/sys/ptrace.2 stable/9/lib/libc/sys/quotactl.2 stable/9/lib/libc/sys/sctp_generic_sendmsg.2 stable/9/lib/libc/sys/sctp_peeloff.2 stable/9/lib/libc/sys/select.2 stable/9/lib/libc/sys/sendfile.2 stable/9/lib/libelf/elf.3 stable/9/lib/libelf/elf_getdata.3 stable/9/lib/libgssapi/gss_release_buffer.3 stable/9/lib/libgssapi/gss_release_oid_set.3 stable/9/lib/libgssapi/mech.5 stable/9/lib/libpam/modules/pam_nologin/pam_nologin.8 stable/9/lib/librpcsec_gss/rpc_gss_seccreate.3 stable/9/lib/libtacplus/libtacplus.3 stable/9/lib/libulog/utempter_add_record.3 stable/9/lib/libusb/libusb20.3 stable/9/lib/libutil/login_cap.3 stable/9/lib/libutil/quotafile.3 stable/9/libexec/tftpd/tftpd.8 stable/9/sbin/camcontrol/camcontrol.8 stable/9/sbin/devfs/devfs.8 stable/9/sbin/gvinum/gvinum.8 stable/9/sbin/ifconfig/ifconfig.8 stable/9/sbin/ipfw/ipfw.8 stable/9/sbin/mdmfs/mdmfs.8 stable/9/sbin/mount_unionfs/mount_unionfs.8 stable/9/sbin/ping6/ping6.8 stable/9/sbin/quotacheck/quotacheck.8 stable/9/sbin/rcorder/rcorder.8 stable/9/share/man/man3/pthread_attr_affinity_np.3 stable/9/share/man/man3/pthread_cond_timedwait.3 stable/9/share/man/man3/pthread_cond_wait.3 stable/9/share/man/man4/acpi_hp.4 stable/9/share/man/man4/acpi_wmi.4 stable/9/share/man/man4/carp.4 stable/9/share/man/man4/ipmi.4 stable/9/share/man/man4/iwn.4 stable/9/share/man/man4/iwnfw.4 stable/9/share/man/man4/ktr.4 stable/9/share/man/man4/man4.powerpc/abtn.4 stable/9/share/man/man4/man4.powerpc/akbd.4 stable/9/share/man/man4/man4.powerpc/bm.4 stable/9/share/man/man4/man4.powerpc/cuda.4 stable/9/share/man/man4/man4.powerpc/smu.4 stable/9/share/man/man4/man4.powerpc/snd_ai2s.4 stable/9/share/man/man4/md.4 stable/9/share/man/man4/mos.4 stable/9/share/man/man4/mps.4 stable/9/share/man/man4/netmap.4 stable/9/share/man/man4/ng_patch.4 stable/9/share/man/man4/nvram2env.4 stable/9/share/man/man4/nxge.4 stable/9/share/man/man4/ufoma.4 stable/9/share/man/man4/upgt.4 stable/9/share/man/man4/wbwd.4 stable/9/share/man/man4/xen.4 stable/9/share/man/man5/ar.5 stable/9/share/man/man5/fdescfs.5 stable/9/share/man/man5/fs.5 stable/9/share/man/man5/fstab.5 stable/9/share/man/man5/nsmb.conf.5 stable/9/share/man/man5/quota.user.5 stable/9/share/man/man5/services.5 stable/9/share/man/man7/release.7 stable/9/share/man/man8/picobsd.8 stable/9/share/man/man9/BUS_DESCRIBE_INTR.9 stable/9/share/man/man9/BUS_SETUP_INTR.9 stable/9/share/man/man9/DB_COMMAND.9 stable/9/share/man/man9/DEVICE_PROBE.9 stable/9/share/man/man9/SYSINIT.9 stable/9/share/man/man9/buf_ring.9 stable/9/share/man/man9/condvar.9 stable/9/share/man/man9/devclass_get_maxunit.9 stable/9/share/man/man9/device_get_children.9 stable/9/share/man/man9/drbr.9 stable/9/share/man/man9/eventtimers.9 stable/9/share/man/man9/firmware.9 stable/9/share/man/man9/ieee80211.9 stable/9/share/man/man9/ieee80211_amrr.9 stable/9/share/man/man9/ieee80211_bmiss.9 stable/9/share/man/man9/ieee80211_input.9 stable/9/share/man/man9/ieee80211_node.9 stable/9/share/man/man9/ieee80211_output.9 stable/9/share/man/man9/ieee80211_proto.9 stable/9/share/man/man9/ieee80211_radiotap.9 stable/9/share/man/man9/ieee80211_regdomain.9 stable/9/share/man/man9/ieee80211_scan.9 stable/9/share/man/man9/ieee80211_vap.9 stable/9/share/man/man9/kproc.9 stable/9/share/man/man9/kthread.9 stable/9/share/man/man9/lock.9 stable/9/share/man/man9/locking.9 stable/9/share/man/man9/malloc.9 stable/9/share/man/man9/mi_switch.9 stable/9/share/man/man9/osd.9 stable/9/share/man/man9/rmlock.9 stable/9/share/man/man9/shm_map.9 stable/9/share/man/man9/sleep.9 stable/9/share/man/man9/spl.9 stable/9/share/man/man9/sysctl_ctx_init.9 stable/9/share/man/man9/taskqueue.9 stable/9/share/man/man9/timeout.9 stable/9/share/man/man9/usbdi.9 stable/9/share/man/man9/vm_map_find.9 stable/9/share/man/man9/watchdog.9 stable/9/sys/boot/common/loader.8 stable/9/sys/boot/forth/loader.conf.5 stable/9/tools/tools/ath/athrd/athrd.1 stable/9/tools/tools/ether_reflect/ether_reflect.1 stable/9/tools/tools/vimage/vimage.8 stable/9/usr.bin/bsdiff/bsdiff/bsdiff.1 stable/9/usr.bin/calendar/calendar.1 stable/9/usr.bin/comm/comm.1 stable/9/usr.bin/csup/cpasswd.1 stable/9/usr.bin/csup/csup.1 stable/9/usr.bin/find/find.1 stable/9/usr.bin/fstat/fuser.1 stable/9/usr.bin/ipcrm/ipcrm.1 stable/9/usr.bin/locale/locale.1 stable/9/usr.bin/lockf/lockf.1 stable/9/usr.bin/ministat/ministat.1 stable/9/usr.bin/printf/printf.1 stable/9/usr.bin/procstat/procstat.1 stable/9/usr.bin/sed/sed.1 stable/9/usr.bin/tftp/tftp.1 stable/9/usr.bin/top/top.local.1 stable/9/usr.bin/touch/touch.1 stable/9/usr.sbin/adduser/adduser.conf.5 stable/9/usr.sbin/bluetooth/ath3kfw/ath3kfw.8 stable/9/usr.sbin/bsdinstall/bsdinstall.8 stable/9/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3 stable/9/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 stable/9/usr.sbin/cdcontrol/cdcontrol.1 stable/9/usr.sbin/config/config.8 stable/9/usr.sbin/ctladm/ctladm.8 stable/9/usr.sbin/edquota/edquota.8 stable/9/usr.sbin/freebsd-update/freebsd-update.8 stable/9/usr.sbin/gpioctl/gpioctl.8 stable/9/usr.sbin/i2c/i2c.8 stable/9/usr.sbin/mountd/exports.5 stable/9/usr.sbin/mptutil/mptutil.8 stable/9/usr.sbin/newsyslog/newsyslog.conf.5 stable/9/usr.sbin/pciconf/pciconf.8 stable/9/usr.sbin/pkg_install/updating/pkg_updating.1 stable/9/usr.sbin/rtadvd/rtadvd.8 stable/9/usr.sbin/setfib/setfib.1 stable/9/usr.sbin/timed/timed/timed.8 stable/9/usr.sbin/wlandebug/wlandebug.8 Directory Properties: stable/9/bin/pwait/ (props changed) stable/9/bin/setfacl/ (props changed) stable/9/bin/sh/ (props changed) stable/9/games/pom/ (props changed) stable/9/lib/libbluetooth/ (props changed) stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/lib/libelf/ (props changed) stable/9/lib/libgssapi/ (props changed) stable/9/lib/libpam/ (props changed) stable/9/lib/librpcsec_gss/ (props changed) stable/9/lib/libtacplus/ (props changed) stable/9/lib/libulog/ (props changed) stable/9/lib/libusb/ (props changed) stable/9/lib/libutil/ (props changed) stable/9/libexec/tftpd/ (props changed) stable/9/sbin/camcontrol/ (props changed) stable/9/sbin/devfs/ (props changed) stable/9/sbin/gvinum/ (props changed) stable/9/sbin/ifconfig/ (props changed) stable/9/sbin/ipfw/ (props changed) stable/9/sbin/mdmfs/ (props changed) stable/9/sbin/mount_unionfs/ (props changed) stable/9/sbin/ping6/ (props changed) stable/9/sbin/quotacheck/ (props changed) stable/9/sbin/rcorder/ (props changed) stable/9/share/man/man3/ (props changed) stable/9/share/man/man5/ (props changed) stable/9/share/man/man7/ (props changed) stable/9/share/man/man8/ (props changed) stable/9/share/man/man9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) stable/9/tools/tools/ath/ (props changed) stable/9/tools/tools/ether_reflect/ (props changed) stable/9/tools/tools/vimage/ (props changed) stable/9/usr.bin/bsdiff/ (props changed) stable/9/usr.bin/calendar/ (props changed) stable/9/usr.bin/comm/ (props changed) stable/9/usr.bin/csup/ (props changed) stable/9/usr.bin/find/ (props changed) stable/9/usr.bin/fstat/ (props changed) stable/9/usr.bin/ipcrm/ (props changed) stable/9/usr.bin/locale/ (props changed) stable/9/usr.bin/lockf/ (props changed) stable/9/usr.bin/ministat/ (props changed) stable/9/usr.bin/printf/ (props changed) stable/9/usr.bin/procstat/ (props changed) stable/9/usr.bin/sed/ (props changed) stable/9/usr.bin/tftp/ (props changed) stable/9/usr.bin/top/ (props changed) stable/9/usr.bin/touch/ (props changed) stable/9/usr.sbin/adduser/ (props changed) stable/9/usr.sbin/bluetooth/ath3kfw/ (props changed) stable/9/usr.sbin/bsdinstall/ (props changed) stable/9/usr.sbin/bsnmpd/modules/snmp_wlan/ (props changed) stable/9/usr.sbin/bsnmpd/tools/bsnmptools/ (props changed) stable/9/usr.sbin/cdcontrol/ (props changed) stable/9/usr.sbin/config/ (props changed) stable/9/usr.sbin/ctladm/ (props changed) stable/9/usr.sbin/edquota/ (props changed) stable/9/usr.sbin/freebsd-update/ (props changed) stable/9/usr.sbin/gpioctl/ (props changed) stable/9/usr.sbin/i2c/ (props changed) stable/9/usr.sbin/mountd/ (props changed) stable/9/usr.sbin/mptutil/ (props changed) stable/9/usr.sbin/newsyslog/ (props changed) stable/9/usr.sbin/pciconf/ (props changed) stable/9/usr.sbin/pkg_install/updating/ (props changed) stable/9/usr.sbin/rtadvd/ (props changed) stable/9/usr.sbin/setfib/ (props changed) stable/9/usr.sbin/timed/timed/ (props changed) stable/9/usr.sbin/wlandebug/ (props changed) Modified: stable/9/bin/pwait/pwait.1 ============================================================================== --- stable/9/bin/pwait/pwait.1 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/bin/pwait/pwait.1 Mon Jun 18 04:55:07 2012 (r237216) @@ -46,7 +46,7 @@ .Sh DESCRIPTION The .Nm -utility will wait until each of the given processes has terminated. +utility will wait until each of the given processes has terminated. .Pp The following option is available: .Bl -tag -width indent Modified: stable/9/bin/setfacl/setfacl.1 ============================================================================== --- stable/9/bin/setfacl/setfacl.1 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/bin/setfacl/setfacl.1 Mon Jun 18 04:55:07 2012 (r237216) @@ -295,7 +295,7 @@ The ACL qualifier field describes the us the ACL entry. It may consist of one of the following: uid or user name, or gid or group name. In entries whose tag type is -one of +one of .Dq Li owner@ , .Dq Li group@ , or Modified: stable/9/bin/sh/sh.1 ============================================================================== --- stable/9/bin/sh/sh.1 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/bin/sh/sh.1 Mon Jun 18 04:55:07 2012 (r237216) @@ -1632,7 +1632,7 @@ All values are of type .It Constants Decimal, octal (starting with .Li 0 ) -and hexadecimal (starting with +and hexadecimal (starting with .Li 0x ) integer constants. .It Variables Modified: stable/9/games/pom/pom.6 ============================================================================== --- stable/9/games/pom/pom.6 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/games/pom/pom.6 Mon Jun 18 04:55:07 2012 (r237216) @@ -35,7 +35,7 @@ .Nm pom .Nd display the phase of the moon .Sh SYNOPSIS -.Nm +.Nm .Op Fl p .Op Fl d Ar yyyy.mm.dd .Op Fl t Ar hh:mm:ss Modified: stable/9/lib/libbluetooth/bluetooth.3 ============================================================================== --- stable/9/lib/libbluetooth/bluetooth.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libbluetooth/bluetooth.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -512,7 +512,7 @@ The function returns 0 on success, or -1 .Pp The .Fn bt_devfilter_pkt_set , -.Fn bt_devfilter_pkt_clr +.Fn bt_devfilter_pkt_clr and .Fn bt_devfilter_pkt_tst functions can be used to modify and test the @@ -527,7 +527,7 @@ packet type. .Pp The .Fn bt_devfilter_evt_set , -.Fn bt_devfilter_evt_clr +.Fn bt_devfilter_evt_clr and .Fn bt_devfilter_evt_tst functions can be used to modify and test the Modified: stable/9/lib/libc/gen/fts.3 ============================================================================== --- stable/9/lib/libc/gen/fts.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/gen/fts.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -802,12 +802,12 @@ principally to provide for alternative i .Nm functionality using different data structures. .Sh BUGS -The +The .Fn fts_open function will automatically set the .Dv FTS_NOCHDIR -option if the +option if the .Dv FTS_LOGICAL -option is provided, or if it cannot +option is provided, or if it cannot .Xr open 2 the current directory. Modified: stable/9/lib/libc/gen/getpagesizes.3 ============================================================================== --- stable/9/lib/libc/gen/getpagesizes.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/gen/getpagesizes.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -56,7 +56,7 @@ array referenced by These page sizes are expressed in bytes. In this case, .Fn getpagesizes -returns the number of such page sizes that it assigned to the array. +returns the number of such page sizes that it assigned to the array. .Sh RETURN VALUES If successful, the .Fn getpagesizes Modified: stable/9/lib/libc/gen/sysconf.3 ============================================================================== --- stable/9/lib/libc/gen/sysconf.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/gen/sysconf.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -211,7 +211,7 @@ Maximum number of functions that may be .It Li _SC_XOPEN_VERSION An integer value greater than or equal to 4, indicating the version of the X/Open Portability Guide to which this -system conforms. +system conforms. .It Li _SC_XOPEN_XCU_VERSION An integer value indicating the version of the XCU Specification to which this system conforms. Modified: stable/9/lib/libc/locale/ctype.3 ============================================================================== --- stable/9/lib/libc/locale/ctype.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/locale/ctype.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -55,7 +55,7 @@ .Nm toascii , .Nm tolower , .Nm toupper -.Nd character classification functions +.Nd character classification functions .Sh LIBRARY .Lb libc .Sh SYNOPSIS Modified: stable/9/lib/libc/locale/ctype_l.3 ============================================================================== --- stable/9/lib/libc/locale/ctype_l.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/locale/ctype_l.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -102,11 +102,11 @@ .Fn toupper_l "int c" "locale_t loc" .Sh DESCRIPTION The above functions perform character tests and conversions on the integer -.Fa c +.Fa c in the locale .Fa loc . They behave in the same way as the versions without the _l suffix, but use the -specified locale rather than the global or per-thread locale. +specified locale rather than the global or per-thread locale. .In ctype.h , or as true functions in the C library. See the specific manual pages for more information. Modified: stable/9/lib/libc/locale/digittoint.3 ============================================================================== --- stable/9/lib/libc/locale/digittoint.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/locale/digittoint.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -49,7 +49,7 @@ function converts a numeric character to The character can be any decimal digit or hexadecimal digit. With hexadecimal characters, the case of the values does not matter. .Pp -The +The .Fn digittoint_l function takes an explicit locale argument, whereas the .Fn digittoint Modified: stable/9/lib/libc/locale/isalnum.3 ============================================================================== --- stable/9/lib/libc/locale/isalnum.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/locale/isalnum.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -77,7 +77,7 @@ In the ASCII character set, this include .It "\&171\ ``y'' \t172\ ``z''" .El .Pp -The +The .Fn isalnum_l function takes an explicit locale argument, whereas the .Fn isalnum Modified: stable/9/lib/libc/locale/isalpha.3 ============================================================================== --- stable/9/lib/libc/locale/isalpha.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/locale/isalpha.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -74,7 +74,7 @@ In the ASCII character set, this include .It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" .It "\&171\ ``y'' \t172\ ``z''" .El -The +The .Fn isalpha_l function takes an explicit locale argument, whereas the .Fn isalpha Modified: stable/9/lib/libc/locale/isblank.3 ============================================================================== --- stable/9/lib/libc/locale/isblank.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/locale/isblank.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -59,7 +59,7 @@ The value of the argument must be repres or the value of .Dv EOF . .Pp -The +The .Fn isblank_l function takes an explicit locale argument, whereas the .Fn isblank Modified: stable/9/lib/libc/locale/iscntrl.3 ============================================================================== --- stable/9/lib/libc/locale/iscntrl.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/locale/iscntrl.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -68,7 +68,7 @@ In the ASCII character set, this include .It "\&036\ RS \t037\ US \t177\ DEL" .El .Pp -The +The .Fn iscntrl_l function takes an explicit locale argument, whereas the .Fn iscntrl Modified: stable/9/lib/libc/net/sctp_bindx.3 ============================================================================== --- stable/9/lib/libc/net/sctp_bindx.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_bindx.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -55,7 +55,7 @@ This allows a user to bind a subset of addresses. The .Fn sctp_bindx -call operates similarly to +call operates similarly to .Fn bind but allows a list of addresses and also allows a bind or an unbind. @@ -98,7 +98,7 @@ This value is returned if the field is not one of the allowed values (see above). .It Bq Er ENOMEM This value is returned if the number of addresses -being added causes a memory allocation failure in +being added causes a memory allocation failure in the call. .It Bq Er EBADF The argument Modified: stable/9/lib/libc/net/sctp_connectx.3 ============================================================================== --- stable/9/lib/libc/net/sctp_connectx.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_connectx.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -58,18 +58,18 @@ This allows a fault tolerant method of initiating an association. When one of the peers addresses is unreachable, the subsequent listed addresses will also be used -to set up the association with the peer. +to set up the association with the peer. .Pp -The user also needs to consider that any address listed in an +The user also needs to consider that any address listed in an .Fn sctp_connectx call is also considered "confirmed". A confirmed address is one in which the SCTP transport will trust is a part of the association and it will not send a confirmation heartbeat to it with -a random nonce. +a random nonce. .Pp If the peer SCTP stack does not list one or more of -the provided addresses in its response message then +the provided addresses in its response message then the extra addresses sent in the .Fn sctp_connectx call will be silently discarded from the association. Modified: stable/9/lib/libc/net/sctp_freepaddrs.3 ============================================================================== --- stable/9/lib/libc/net/sctp_freepaddrs.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_freepaddrs.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -46,9 +46,9 @@ .In sys/socket.h .In netinet/sctp.h .Ft void -.Fn sctp_freepaddrs "struct sockaddr *" +.Fn sctp_freepaddrs "struct sockaddr *" .Ft void -.Fn sctp_freeladdrs "struct sockaddr *" +.Fn sctp_freeladdrs "struct sockaddr *" .Sh DESCRIPTION The .Fn sctp_freepaddrs Modified: stable/9/lib/libc/net/sctp_getaddrlen.3 ============================================================================== --- stable/9/lib/libc/net/sctp_getaddrlen.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_getaddrlen.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -62,7 +62,7 @@ system calls. If for some reason a SCTP socket cannot be created or the .Fn getsockopt -call fails, an error will be returned +call fails, an error will be returned with .Va errno set as specified in the Modified: stable/9/lib/libc/net/sctp_getassocid.3 ============================================================================== --- stable/9/lib/libc/net/sctp_getassocid.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_getassocid.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -50,7 +50,7 @@ The .Fn sctp_getassocid call attempts to look up the specified socket address .Fa addr -and find the respective association identification. +and find the respective association identification. .Pp .Sh RETURN VALUES The call returns the association id upon success and Modified: stable/9/lib/libc/net/sctp_getpaddrs.3 ============================================================================== --- stable/9/lib/libc/net/sctp_getpaddrs.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_getpaddrs.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -53,7 +53,7 @@ The .Fn sctp_getpaddrs function is used to get the list of the peers addresses. -The +The .Fn sctp_getladdrs function is used to get the list of the local addresses. The association of interest is identified by the Modified: stable/9/lib/libc/net/sctp_opt_info.3 ============================================================================== --- stable/9/lib/libc/net/sctp_opt_info.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_opt_info.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -50,7 +50,7 @@ The .Fn sctp_opt_info call provides a multi-os compatible method for getting -specific +specific .Fn getsockopt data where an association identification needs to be passed into the operating system. @@ -70,7 +70,7 @@ who wish to write portable code amongst this call should be used for the following SCTP socket options. .Pp -.Dv SCTP_RTOINFO +.Dv SCTP_RTOINFO .Pp .Dv SCTP_ASSOCINFO .Pp Modified: stable/9/lib/libc/net/sctp_recvmsg.3 ============================================================================== --- stable/9/lib/libc/net/sctp_recvmsg.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_recvmsg.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -56,11 +56,11 @@ is used to receive a message from anothe The .Fn sctp_recvmsg call is used by one-to-one (SOCK_STREAM) type sockets after a -successful +successful .Fn connect -call or after the application has performed a -.Fn listen -followed by a successful +call or after the application has performed a +.Fn listen +followed by a successful .Fn accept . For a one-to-many (SOCK_SEQPACKET) type socket, an endpoint may call .Fn sctp_recvmsg @@ -77,7 +77,7 @@ with a positive backlog to enable the re .Pp The address of the sender is held in the .Fa from -argument with +argument with .Fa fromlen specifying its size. At the completion of a successful @@ -88,16 +88,16 @@ will hold the address of the peer and .Fa fromlen will hold the length of that address. Note that -the address is bounded by the initial value of +the address is bounded by the initial value of .Fa fromlen which is used as an in/out variable. .Pp -The length of the message +The length of the message .Fa msg to be received is bounded by .Fa len . If the message is too long to fit in the users -receive buffer, then the +receive buffer, then the .Fa flags argument will .Em not @@ -105,16 +105,16 @@ have the .Dv MSG_EOF flag applied. If the message is a complete message then -the +the .Fa flags argument will have .Dv MSG_EOF set. -Locally detected errors are +Locally detected errors are indicated by a return value of -1 with .Va errno set accordingly. -The +The .Fa flags argument may also hold the value .Dv MSG_NOTIFICATION . @@ -141,7 +141,7 @@ The system call may be used to determine when it is possible to receive a message. .Pp -The +The .Fa sinfo argument is defined as follows. .Bd -literal @@ -161,7 +161,7 @@ struct sctp_sndrcvinfo { The .Fa sinfo->sinfo_ppid field is an opaque 32 bit value that is passed transparently -through the stack from the peer endpoint. +through the stack from the peer endpoint. Note that the stack passes this value without regard to byte order. .Pp @@ -182,7 +182,7 @@ was delivered in order within the stream .Pp The .Fa sinfo->sinfo_stream -field is the SCTP stream that the message was received on. +field is the SCTP stream that the message was received on. Streams in SCTP are reliable (or partially reliable) flows of ordered messages. .Pp @@ -194,7 +194,7 @@ context with the socket option. Optionally a user process can use this value to index some application specific data structure for all data coming from a specific -association. +association. .Pp The .Fa sinfo->sinfo_ssn @@ -230,12 +230,12 @@ sockets this value can be used to send d the use of an address field. It is also quite useful in setting various socket options on the specific association -(see +(see .Xr sctp 4 ) . .Pp The .Fa sinfo->info_timetolive -field is not used by +field is not used by .Fn sctp_recvmsg . .Sh RETURN VALUES The call returns the number of bytes received, or -1 Modified: stable/9/lib/libc/net/sctp_send.3 ============================================================================== --- stable/9/lib/libc/net/sctp_send.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_send.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -62,14 +62,14 @@ is used to transmit a message to another .Fn sctp_send may be used to send data to an existing association for both one-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types. -The length of the message +The length of the message .Fa msg is given by .Fa len . If the message is too long to pass atomically through the underlying protocol, .Va errno -is set to +is set to .Er EMSGSIZE , -1 is returned, and the message is not transmitted. @@ -88,7 +88,7 @@ The system call may be used to determine when it is possible to send more data on one-to-one type (SOCK_STREAM) sockets. .Pp -The +The .Fa sinfo structure is used to control various SCTP features and has the following format: @@ -106,7 +106,7 @@ struct sctp_sndrcvinfo { }; .Ed .Pp -The +The .Fa sinfo->sinfo_ppid argument is an opaque 32 bit value that is passed transparently through the stack to the peer endpoint. It will be available on @@ -131,7 +131,7 @@ argument may include one or more of the #define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ .Ed .Pp -The flag +The flag .Dv SCTP_EOF is used to instruct the SCTP stack to queue this message and then start a graceful shutdown of the association. @@ -158,7 +158,7 @@ is used to specify that a specific addre Normally SCTP will use only one of a multi-homed peers addresses as the primary address to send to. -By default, no matter what the +By default, no matter what the .Fa to argument is, this primary address is used to send data. By specifying @@ -193,14 +193,14 @@ skipped and no longer transmitted. Note that this policy does not even assure that the data will ever be sent. In times of a congestion -with large amounts of data being queued, the +with large amounts of data being queued, the .Fa sinfo->sinfo_timetolive may expire before the first transmission is ever made. .Pp The .Dv SCTP_PR_SCTP_BUF based policy transforms the -.Fa sinfo->sinfo_timetolive +.Fa sinfo->sinfo_timetolive field into a total number of bytes allowed on the outbound send queue. If that number or more bytes are in queue, then @@ -208,19 +208,19 @@ other buffer-based sends are looked to b skipped. Note that this policy may also result in the data never being sent if no buffer based sends are in queue and -the maximum specified by -.Fa timetolive +the maximum specified by +.Fa timetolive bytes is in queue. .Pp The .Dv SCTP_PR_SCTP_RTX policy transforms the -.Fa sinfo->sinfo_timetolive +.Fa sinfo->sinfo_timetolive into a number of retransmissions to allow. This policy always assures that at a minimum one send attempt is made of the data. -After which no more than +After which no more than .Fa sinfo->sinfo_timetolive retransmissions will be made before the data is skipped. .Pp @@ -228,11 +228,11 @@ retransmissions will be made before the is the SCTP stream that you wish to send the message on. Streams in SCTP are reliable (or partially reliable) flows of ordered -messages. +messages. .Pp The .Fa sinfo->sinfo_assoc_id -field is used to +field is used to select the association to send to on a one-to-many socket. For a one-to-one socket, this field is ignored. .Pp @@ -256,16 +256,16 @@ The fields .Fa sinfo->sinfo_ssn , .Fa sinfo->sinfo_tsn , and -.Fa sinfo->sinfo_cumtsn +.Fa sinfo->sinfo_cumtsn are used only when receiving messages and are thus ignored by .Fn sctp_send . The function -.Fn sctp_sendx -has the same properties as +.Fn sctp_sendx +has the same properties as .Fn sctp_send with the additional arguments of an array of sockaddr structures passed in. -With the +With the .Fa addrs argument being given as an array of addresses to be sent to and the @@ -277,7 +277,7 @@ when an implicit association is being se This allows the user the equivalent behavior as doing a .Fn sctp_connectx -followed by a +followed by a .Fn sctp_send to the association. Note that if the Modified: stable/9/lib/libc/net/sctp_sendmsg.3 ============================================================================== --- stable/9/lib/libc/net/sctp_sendmsg.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sctp_sendmsg.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -72,10 +72,10 @@ Data sent in such an instance will resul the data being sent on the third leg of the SCTP four-way handshake. Note that if the socket is a one-to-one type (SOCK_STREAM) socket then an association must -be in existence (by use of the +be in existence (by use of the .Xr connect 2 system call). -Calling +Calling .Fn sctp_sendmsg or .Fn sctp_sendmsgx @@ -90,14 +90,14 @@ The address of the target is given by with .Fa tolen specifying its size. -The length of the message +The length of the message .Fa msg is given by .Fa len . If the message is too long to pass atomically through the underlying protocol, .Va errno -is set to +is set to .Er EMSGSIZE , -1 is returned, and the message is not transmitted. @@ -117,7 +117,7 @@ The system call may be used to determine when it is possible to send more data on one-to-one type (SOCK_STREAM) sockets. .Pp -The +The .Fa ppid argument is an opaque 32 bit value that is passed transparently through the stack to the peer endpoint. @@ -143,7 +143,7 @@ argument may include one or more of the #define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ .Ed .Pp -The flag +The flag .Dv SCTP_EOF is used to instruct the SCTP stack to queue this message and then start a graceful shutdown of the association. @@ -170,7 +170,7 @@ is used to specify that an specific addr Normally SCTP will use only one of a multi-homed peers addresses as the primary address to send to. -By default, no matter what the +By default, no matter what the .Fa to argument is, this primary address is used to send data. By specifying @@ -205,14 +205,14 @@ skipped and no longer transmitted. Note that this policy does not even assure that the data will ever be sent. In times of a congestion -with large amounts of data being queued, the +with large amounts of data being queued, the .Fa timetolive may expire before the first transmission is ever made. .Pp The .Dv SCTP_PR_SCTP_BUF based policy transforms the -.Fa timetolive +.Fa timetolive field into a total number of bytes allowed on the outbound send queue. If that number or more bytes are in queue, then @@ -220,19 +220,19 @@ other buffer based sends are looked to b skipped. Note that this policy may also result in the data never being sent if no buffer based sends are in queue and -the maximum specified by -.Fa timetolive +the maximum specified by +.Fa timetolive bytes is in queue. .Pp The .Dv SCTP_PR_SCTP_RTX policy transforms the -.Fa timetolive +.Fa timetolive into a number of retransmissions to allow. This policy always assures that at a minimum one send attempt is made of the data. -After which no more than +After which no more than .Fa timetolive retransmissions will be made before the data is skipped. .Pp @@ -241,7 +241,7 @@ is the SCTP stream that you wish to send message on. Streams in SCTP are reliable (or partially reliable) flows of ordered messages. -The +The .Fa context field is used only in the event the message cannot be sent. This is an opaque @@ -251,7 +251,7 @@ is given if that notification is enabled Normally a user process can use this value to index some application specific data structure when a send cannot be fulfilled. .Fn sctp_sendmsgx -is identical to +is identical to .Fn sctp_sendmsg with the exception that it takes an array of sockaddr structures in the argument @@ -262,7 +262,7 @@ which specifies how many addresses are i This allows a caller to implicitly set up an association passing multiple addresses as if -.Fn sctp_connectx +.Fn sctp_connectx had been called to set up the association. .Sh RETURN VALUES The call returns the number of characters sent, or -1 @@ -325,7 +325,7 @@ is not connected and is a one-to-one sty .Xr sctp 4 .Sh BUGS Because in the one-to-many style socket -.Fn sctp_sendmsg +.Fn sctp_sendmsg or .Fn sctp_sendmsgx may have multiple associations under one endpoint, a Modified: stable/9/lib/libc/net/sourcefilter.3 ============================================================================== --- stable/9/lib/libc/net/sourcefilter.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/net/sourcefilter.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -158,7 +158,7 @@ For the protocol-independent functions .Fn getsourcefilter and .Fn setsourcefilter , -the +the argument .Fa grouplen argument specifies the size of the structure pointed to by .Fa group . @@ -220,7 +220,7 @@ operation. .Sh SEE ALSO .Xr ip 4 , .Xr ip6 4 , -.Xr multicast 4 , +.Xr multicast 4, .Xr ifmcstat 8 .Rs .%A D. Thaler Modified: stable/9/lib/libc/posix1e/acl_add_flag_np.3 ============================================================================== --- stable/9/lib/libc/posix1e/acl_add_flag_np.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/posix1e/acl_add_flag_np.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -30,7 +30,7 @@ .Os .Sh NAME .Nm acl_add_flag_np -.Nd add flags to a flagset +.Nd add flags to a flagset .Sh LIBRARY .Lb libc .Sh SYNOPSIS Modified: stable/9/lib/libc/posix1e/acl_create_entry.3 ============================================================================== --- stable/9/lib/libc/posix1e/acl_create_entry.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/posix1e/acl_create_entry.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -39,7 +39,7 @@ .In sys/acl.h .Ft int .Fn acl_create_entry "acl_t *acl_p" "acl_entry_t *entry_p" -.Ft int +.Ft int .Fn acl_create_entry_np "acl_t *acl_p" "acl_entry_t *entry_p" "int index" .Sh DESCRIPTION The Modified: stable/9/lib/libc/stdio/getline.3 ============================================================================== --- stable/9/lib/libc/stdio/getline.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/stdio/getline.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -78,7 +78,7 @@ and .Fn getline functions return the number of characters written, excluding the terminating -.Dv NUL +.Dv NUL character. The value \-1 is returned if an error occurs, or if end-of-file is reached. .Sh EXAMPLES Modified: stable/9/lib/libc/stdlib/at_quick_exit.3 ============================================================================== --- stable/9/lib/libc/stdlib/at_quick_exit.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/stdlib/at_quick_exit.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -1,6 +1,6 @@ .\" Copyright (c) 2011 David Chisnall .\" All rights reserved. -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -9,7 +9,7 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" +.\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -21,7 +21,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.\" +.\" .\" $FreeBSD$ .\" .Dd December 7, 2011 @@ -40,16 +40,16 @@ The .Fn at_quick_exit function registers a cleanup function to be called when the program exits as a -result of calling +result of calling .Xr quick_exit 3 . The cleanup functions are called in the reverse order and will not be called if -the program exits by calling +the program exits by calling .Xr exit 3 , .Xr _Exit 3 , or .Xr abort 3 . .Sh RETURN VALUES -The +The .Fn at_quick_exit function returns the value 0 if successful and a non-zero value on failure. .Sh SEE ALSO Modified: stable/9/lib/libc/stdlib/getenv.3 ============================================================================== --- stable/9/lib/libc/stdlib/getenv.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/stdlib/getenv.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -202,7 +202,7 @@ function appeared in Until .Fx 7.0 , .Fn putenv -would make a copy of +would make a copy of .Fa string and insert it into the environment using .Fn setenv . Modified: stable/9/lib/libc/string/memchr.3 ============================================================================== --- stable/9/lib/libc/string/memchr.3 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/string/memchr.3 Mon Jun 18 04:55:07 2012 (r237216) @@ -94,7 +94,7 @@ conforms to .St -isoC . .Pp The -.Fn memrchr +.Fn memrchr function is a GNU extension and conforms to no standard. .Sh HISTORY The Modified: stable/9/lib/libc/sys/cap_new.2 ============================================================================== --- stable/9/lib/libc/sys/cap_new.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/cap_new.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -462,14 +462,14 @@ argument is not a capability. Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. +.Sh AUTHORS +These functions and the capability facility were created by +.An "Robert N. M. Watson" +at the University of Cambridge Computer Laboratory with support from a grant +from Google, Inc. .Sh BUGS This man page should list the set of permitted system calls more specifically for each capability right. .Pp Capability rights sometimes have unclear indirect impacts, which should be documented, or at least hinted at. -.Sh AUTHORS -These functions and the capability facility were created by -.An "Robert N. M. Watson" -at the University of Cambridge Computer Laboratory with support from a grant -from Google, Inc. Modified: stable/9/lib/libc/sys/cpuset.2 ============================================================================== --- stable/9/lib/libc/sys/cpuset.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/cpuset.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -77,7 +77,7 @@ while application developers will manipu To select the correct set a value of type .Ft cpulevel_t is used. -The following values for +The following values for .Fa level are supported: .Bl -column CPU_LEVEL_CPUSET -offset indent @@ -137,7 +137,7 @@ Children inherit this set after a call t .Xr fork 2 . .Pp .Fn cpuset_setid -attempts to set the id of the object specified by the +attempts to set the id of the object specified by the .Fa which argument. Currently @@ -149,12 +149,12 @@ Upon successful completion all of the th be running on CPUs permitted by the set. .Pp .Fn cpuset_getid -retrieves a set id from the object indicated by +retrieves a set id from the object indicated by .Fa which and stores it in the space pointed to by .Fa setid . The retrieved id may be that of either the root or assigned set -depending on the value of +depending on the value of .Fa level . .Fa level should be Modified: stable/9/lib/libc/sys/cpuset_getaffinity.2 ============================================================================== --- stable/9/lib/libc/sys/cpuset_getaffinity.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/cpuset_getaffinity.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -45,7 +45,7 @@ .Fn cpuset_getaffinity and .Fn cpuset_setaffinity -allow the manipulation of sets of CPUs available to processes, threads, +allow the manipulation of sets of CPUs available to processes, threads, interrupts, jails and other resources. These functions may manipulate sets of CPUs that contain many processes or per-object anonymous masks that effect only a single object. Modified: stable/9/lib/libc/sys/kqueue.2 ============================================================================== --- stable/9/lib/libc/sys/kqueue.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/kqueue.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -203,7 +203,7 @@ will not return it. The filter itself is not disabled. .It EV_DISPATCH Disable the event source immediately after delivery of an event. -See +See .Dv EV_DISABLE above. .It EV_DELETE @@ -217,7 +217,7 @@ any pending events. When passed as input, it forces .Dv EV_ERROR to always be returned. -When a filter is successfully added the +When a filter is successfully added the .Va data field will be zero. .It EV_ONESHOT @@ -449,10 +449,10 @@ Establishes a user event identified by .Va ident which is not associated with any kernel mechanism but is triggered by user level code. -The lower 24 bits of the +The lower 24 bits of the .Va fflags may be used for user defined flags and manipulated using the following: -.Bl -tag -width XXNOTE_FFLAGSMASK +.Bl -tag -width XXNOTE_FFLAGSMASK .It Dv NOTE_FFNOP Ignore the input .Va fflags . Modified: stable/9/lib/libc/sys/pathconf.2 ============================================================================== --- stable/9/lib/libc/sys/pathconf.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/pathconf.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -174,7 +174,7 @@ return a positive number that represents bytes. The offsets of holes returned will be aligned to this same value. A special value of 1 is returned if the file system does not specify the minimum -hole size but still reports holes. +hole size but still reports holes. .El .Sh RETURN VALUES If the call to Modified: stable/9/lib/libc/sys/ptrace.2 ============================================================================== --- stable/9/lib/libc/sys/ptrace.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/ptrace.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -441,7 +441,7 @@ This request is used to iterate over the process. The .Fa addr -argument specifies a pointer to a +argument specifies a pointer to a .Vt "struct ptrace_vm_entry" , which is defined as follows: .Bd -literal Modified: stable/9/lib/libc/sys/quotactl.2 ============================================================================== --- stable/9/lib/libc/sys/quotactl.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/quotactl.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -113,7 +113,7 @@ Only the super-user may turn quotas off. .It Dv Q_GETQUOTASIZE Get the wordsize used to represent the quotas for the user or group (as determined by the command type). -Possible values are 32 for the old-style quota file +Possible values are 32 for the old-style quota file and 64 for the new-style quota file. The .Fa addr @@ -199,7 +199,7 @@ The .Fa id argument to .Dv Q_GETQUOTA , -.Dv Q_SETQUOTA +.Dv Q_SETQUOTA or .Dv Q_SETUSE is a negative value. Modified: stable/9/lib/libc/sys/sctp_generic_sendmsg.2 ============================================================================== --- stable/9/lib/libc/sys/sctp_generic_sendmsg.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/sctp_generic_sendmsg.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -54,7 +54,7 @@ and .Fn sctp_generic_sendmsg_iov are the true system calls used by the .Xr sctp_sendmsg 3 -and +and .Xr sctp_send 3 function calls. These are more efficient since they are @@ -68,7 +68,7 @@ For detailed usage please see either the .Xr sctp_send 3 or .Xr sctp_sendmsg 3 -function calls. +function calls. .Sh RETURN VALUES The call returns the number of bytes written on success and -1 upon failure. .Sh ERRORS Modified: stable/9/lib/libc/sys/sctp_peeloff.2 ============================================================================== --- stable/9/lib/libc/sys/sctp_peeloff.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/sctp_peeloff.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -61,7 +61,7 @@ The system call can return the following errors: .Bl -tag -width Er .It Bq Er ENOTCONN -The +The .Fa id given to the call does not map to a valid association. Modified: stable/9/lib/libc/sys/select.2 ============================================================================== --- stable/9/lib/libc/sys/select.2 Mon Jun 18 04:00:56 2012 (r237215) +++ stable/9/lib/libc/sys/select.2 Mon Jun 18 04:55:07 2012 (r237216) @@ -222,6 +222,6 @@ Thus, it is unwise to assume that the ti by the .Fn select system call. -.Fx +.Fx does not modify the return value, which can cause problems for applications ported from other systems. Modified: stable/9/lib/libc/sys/sendfile.2 ============================================================================== --- stable/9/lib/libc/sys/sendfile.2 Mon Jun 18 04:00:56 2012 (r237215) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 05:01:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6199F106564A; Mon, 18 Jun 2012 05:01:58 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BCB68FC0C; Mon, 18 Jun 2012 05:01:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5I51wKf055979; Mon, 18 Jun 2012 05:01:58 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5I51wVU055977; Mon, 18 Jun 2012 05:01:58 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206180501.q5I51wVU055977@svn.freebsd.org> From: Eitan Adler Date: Mon, 18 Jun 2012 05:01:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237217 - stable/9/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 05:01:58 -0000 Author: eadler Date: Mon Jun 18 05:01:57 2012 New Revision: 237217 URL: http://svn.freebsd.org/changeset/base/237217 Log: MFC 236352: Bump date for content missed in r236290 Approved by: cperciva (implicit) Modified: stable/9/share/man/man5/periodic.conf.5 Directory Properties: stable/9/share/man/man5/ (props changed) Modified: stable/9/share/man/man5/periodic.conf.5 ============================================================================== --- stable/9/share/man/man5/periodic.conf.5 Mon Jun 18 04:55:07 2012 (r237216) +++ stable/9/share/man/man5/periodic.conf.5 Mon Jun 18 05:01:57 2012 (r237217) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 7, 2012 +.Dd May 30, 2012 .Dt PERIODIC.CONF 5 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 05:02:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EFC2010657BC; Mon, 18 Jun 2012 05:02:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F33E8FC12; Mon, 18 Jun 2012 05:02:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5I52LdO056035; Mon, 18 Jun 2012 05:02:21 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5I52Ll6056033; Mon, 18 Jun 2012 05:02:21 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206180502.q5I52Ll6056033@svn.freebsd.org> From: Eitan Adler Date: Mon, 18 Jun 2012 05:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237218 - stable/8/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 05:02:22 -0000 Author: eadler Date: Mon Jun 18 05:02:21 2012 New Revision: 237218 URL: http://svn.freebsd.org/changeset/base/237218 Log: MFC 236352: Bump date for content missed in r236290 Approved by: cperciva (implicit) Modified: stable/8/share/man/man5/periodic.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/periodic.conf.5 ============================================================================== --- stable/8/share/man/man5/periodic.conf.5 Mon Jun 18 05:01:57 2012 (r237217) +++ stable/8/share/man/man5/periodic.conf.5 Mon Jun 18 05:02:21 2012 (r237218) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 7, 2012 +.Dd May 30, 2012 .Dt PERIODIC.CONF 5 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 06:41:47 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 93C00106564A; Mon, 18 Jun 2012 06:41:47 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 4CBB18FC14; Mon, 18 Jun 2012 06:41:47 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id B2EC113E71; Mon, 18 Jun 2012 06:41:39 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id q5I6fciZ080209; Mon, 18 Jun 2012 06:41:39 GMT (envelope-from phk@phk.freebsd.dk) To: Bruce Evans From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 18 Jun 2012 14:07:00 +1000." <20120618130626.M952@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1 Date: Mon, 18 Jun 2012 06:41:38 +0000 Message-ID: <80208.1340001698@critter.freebsd.dk> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237203 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 06:41:47 -0000 In message <20120618130626.M952@besplex.bde.org>, Bruce Evans writes: >There is no reason 16-bit copies should work either. Indeed not, but they do. As for the rest of your observations: Yes, the syscons code is a mess. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 07:34:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0183106566C; Mon, 18 Jun 2012 07:34:38 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C140A8FC19; Mon, 18 Jun 2012 07:34:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5I7YciA062476; Mon, 18 Jun 2012 07:34:38 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5I7YcRv062474; Mon, 18 Jun 2012 07:34:38 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201206180734.q5I7YcRv062474@svn.freebsd.org> From: Peter Holm Date: Mon, 18 Jun 2012 07:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237219 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 07:34:39 -0000 Author: pho Date: Mon Jun 18 07:34:38 2012 New Revision: 237219 URL: http://svn.freebsd.org/changeset/base/237219 Log: In tty_makedev() the following construction: dev = make_dev_cred(); dev->si_drv1 = tp; leaves a small window where the newly created device may be opened and si_drv1 is NULL. As this is a vary rare situation, using a lock to close the window seems overkill. Instead just wait for the assignment of si_drv1. Suggested by: kib MFC after: 1 week Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Mon Jun 18 05:02:21 2012 (r237218) +++ head/sys/kern/tty.c Mon Jun 18 07:34:38 2012 (r237219) @@ -219,9 +219,15 @@ ttydev_leave(struct tty *tp) static int ttydev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { - struct tty *tp = dev->si_drv1; + struct tty *tp; int error = 0; + while ((tp = dev->si_drv1) == NULL) { + error = tsleep(&dev->si_drv1, PCATCH, "ttdrv1", 1); + if (error != EWOULDBLOCK) + return (error); + } + tty_lock(tp); if (tty_gone(tp)) { /* Device is already gone. */ @@ -738,9 +744,14 @@ static struct cdevsw ttydev_cdevsw = { static int ttyil_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { - struct tty *tp = dev->si_drv1; + struct tty *tp; int error = 0; + while ((tp = dev->si_drv1) == NULL) { + error = tsleep(&dev->si_drv1, PCATCH, "ttdrv1", 1); + if (error != EWOULDBLOCK) + return (error); + } tty_lock(tp); if (tty_gone(tp)) error = ENODEV; @@ -1203,6 +1214,7 @@ tty_makedev(struct tty *tp, struct ucred dev = make_dev_cred(&ttydev_cdevsw, 0, cred, uid, gid, mode, "%s%s", prefix, name); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); tp->t_dev = dev; /* Slave call-in devices. */ @@ -1211,12 +1223,14 @@ tty_makedev(struct tty *tp, struct ucred uid, gid, mode, "%s%s.init", prefix, name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); dev->si_drv2 = &tp->t_termios_init_in; dev = make_dev_cred(&ttyil_cdevsw, TTYUNIT_LOCK, cred, uid, gid, mode, "%s%s.lock", prefix, name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); dev->si_drv2 = &tp->t_termios_lock_in; } @@ -1226,6 +1240,7 @@ tty_makedev(struct tty *tp, struct ucred UID_UUCP, GID_DIALER, 0660, "cua%s", name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); /* Slave call-out devices. */ if (tp->t_flags & TF_INITLOCK) { @@ -1234,6 +1249,7 @@ tty_makedev(struct tty *tp, struct ucred UID_UUCP, GID_DIALER, 0660, "cua%s.init", name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); dev->si_drv2 = &tp->t_termios_init_out; dev = make_dev_cred(&ttyil_cdevsw, @@ -1241,6 +1257,7 @@ tty_makedev(struct tty *tp, struct ucred UID_UUCP, GID_DIALER, 0660, "cua%s.lock", name); dev_depends(tp->t_dev, dev); dev->si_drv1 = tp; + wakeup(&dev->si_drv1); dev->si_drv2 = &tp->t_termios_lock_out; } } From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 07:54:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8D17310658C4; Mon, 18 Jun 2012 07:54:11 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78AAC8FC08; Mon, 18 Jun 2012 07:54:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5I7sBrT063450; Mon, 18 Jun 2012 07:54:11 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5I7sBoQ063448; Mon, 18 Jun 2012 07:54:11 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <201206180754.q5I7sBoQ063448@svn.freebsd.org> From: Poul-Henning Kamp Date: Mon, 18 Jun 2012 07:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 07:54:11 -0000 Author: phk Date: Mon Jun 18 07:54:10 2012 New Revision: 237223 URL: http://svn.freebsd.org/changeset/base/237223 Log: Fix the previous commit to only copy the data we were asked to and not twice as much. Spotted by: Taku YAMAMOTO Modified: head/sys/dev/fb/fbreg.h Modified: head/sys/dev/fb/fbreg.h ============================================================================== --- head/sys/dev/fb/fbreg.h Mon Jun 18 07:43:23 2012 (r237222) +++ head/sys/dev/fb/fbreg.h Mon Jun 18 07:54:10 2012 (r237223) @@ -39,6 +39,7 @@ static __inline void copyw(uint16_t *src, uint16_t *dst, size_t size) { + size >>= 1; while (size--) *dst++ = *src++; } From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 07:54:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D597F1065672; Mon, 18 Jun 2012 07:54:46 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 8FD428FC1F; Mon, 18 Jun 2012 07:54:46 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 2F2DC13FB0; Mon, 18 Jun 2012 07:54:45 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id q5I7shl3024167; Mon, 18 Jun 2012 07:54:44 GMT (envelope-from phk@phk.freebsd.dk) To: Taku YAMAMOTO From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 18 Jun 2012 06:29:12 +0900." <20120618062912.61088c11.taku@tackymt.homeip.net> Content-Type: text/plain; charset=ISO-8859-1 Date: Mon, 18 Jun 2012 07:54:43 +0000 Message-ID: <24166.1340006083@critter.freebsd.dk> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237203 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 07:54:46 -0000 In message <20120618062912.61088c11.taku@tackymt.homeip.net>, Taku YAMAMOTO wri tes: >On Sun, 17 Jun 2012 21:02:48 +0000 (UTC) >Poul-Henning Kamp wrote: > >> Author: phk >> Date: Sun Jun 17 21:02:48 2012 >> New Revision: 237203 >> URL: http://svn.freebsd.org/changeset/base/237203 >> + >> +static __inline void >> +copyw(uint16_t *src, uint16_t *dst, size_t size) >> +{ >> + while (size--) >> + *dst++ = *src++; >> +} > >Does this end up with copying 2*size bytes instead of size bytes? Indeed it did. Thanks for spotting my mistake. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 09:36:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 675FB1065670; Mon, 18 Jun 2012 09:36:52 +0000 (UTC) (envelope-from gprspb@mail.ru) Received: from fallback3.mail.ru (fallback3.mail.ru [94.100.176.58]) by mx1.freebsd.org (Postfix) with ESMTP id 098098FC14; Mon, 18 Jun 2012 09:36:52 +0000 (UTC) Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) by fallback3.mail.ru (mPOP.Fallback_MX) with ESMTP id 9EA41B317B1E; Mon, 18 Jun 2012 13:35:33 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=rYvQt8vuDfCiziI29s7P13gtpLdzPu4OeHJ2jWwVAUU=; b=DIaqfur5ORvJrmYTIqG8wcgvbfmJ1fU39zcIzDb+HX1b2btDH+QAJcI4u3h1rLqG2X1msSkjH850MAj5tXfzu644lVDlV6mXytQCoyIiY8/1GkF4eD1GRONiAQGK9Ezp; Received: from [93.185.182.46] (port=27508 helo=gpr.nnz-home.ru) by smtp17.mail.ru with esmtpa (envelope-from ) id 1SgYMo-000068-5k; Mon, 18 Jun 2012 13:35:26 +0400 Received: from gpr by gpr.nnz-home.ru with local (Exim 4.77 (FreeBSD)) (envelope-from ) id 1SgYLz-0000I6-Ad; Mon, 18 Jun 2012 13:34:35 +0400 Date: Mon, 18 Jun 2012 13:34:35 +0400 From: Gennady Proskurin To: Poul-Henning Kamp Message-ID: <20120618093435.GA1017@gpr.nnz-home.ru> References: <201206180754.q5I7sBoQ063448@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206180754.q5I7sBoQ063448@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam: Not detected X-Mras: Ok Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 09:36:52 -0000 On Mon, Jun 18, 2012 at 07:54:11AM +0000, Poul-Henning Kamp wrote: > Author: phk > Date: Mon Jun 18 07:54:10 2012 > New Revision: 237223 > URL: http://svn.freebsd.org/changeset/base/237223 > > Log: > Fix the previous commit to only copy the data we were asked to and not > twice as much. > > Spotted by: Taku YAMAMOTO > > Modified: > head/sys/dev/fb/fbreg.h > > Modified: head/sys/dev/fb/fbreg.h > ============================================================================== > --- head/sys/dev/fb/fbreg.h Mon Jun 18 07:43:23 2012 (r237222) > +++ head/sys/dev/fb/fbreg.h Mon Jun 18 07:54:10 2012 (r237223) > @@ -39,6 +39,7 @@ > static __inline void > copyw(uint16_t *src, uint16_t *dst, size_t size) > { > + size >>= 1; > while (size--) > *dst++ = *src++; > } If size is odd, this does not copy the last byte. Not sure, whether this is intended. From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 10:56:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99409106564A; Mon, 18 Jun 2012 10:56:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A7648FC08; Mon, 18 Jun 2012 10:56:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IAuUpl075140; Mon, 18 Jun 2012 10:56:30 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IAuUwX075136; Mon, 18 Jun 2012 10:56:30 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206181056.q5IAuUwX075136@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 18 Jun 2012 10:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237224 - stable/9/sys/dev/sdhci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 10:56:30 -0000 Author: glebius Date: Mon Jun 18 10:56:29 2012 New Revision: 237224 URL: http://svn.freebsd.org/changeset/base/237224 Log: Merge 231266 from head: Add support for RICOH R5CE823 card reader, that can be found in some Lenovo laptops. The conroller needs a quirk to lower its frequency, and after that it operates normally. Modified: stable/9/sys/dev/sdhci/sdhci.c stable/9/sys/dev/sdhci/sdhci.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/9/sys/dev/sdhci/sdhci.c Mon Jun 18 07:54:10 2012 (r237223) +++ stable/9/sys/dev/sdhci/sdhci.c Mon Jun 18 10:56:29 2012 (r237224) @@ -74,6 +74,8 @@ __FBSDID("$FreeBSD$"); #define SDHCI_QUIRK_INCR_TIMEOUT_CONTROL (1<<7) /* Controller has broken read timings */ #define SDHCI_QUIRK_BROKEN_TIMINGS (1<<8) +/* Controller needs lowered frequency */ +#define SDHCI_QUIRK_LOWER_FREQUENCY (1<<9) static const struct sdhci_device { uint32_t model; @@ -85,6 +87,8 @@ static const struct sdhci_device { SDHCI_QUIRK_FORCE_DMA }, { 0xe8221180, 0xffff, "RICOH SD", SDHCI_QUIRK_FORCE_DMA }, + { 0xe8231180, 0xffff, "RICOH R5CE823 SD", + SDHCI_QUIRK_LOWER_FREQUENCY }, { 0x8034104c, 0xffff, "TI XX21/XX11 SD", SDHCI_QUIRK_FORCE_DMA }, { 0x05501524, 0xffff, "ENE CB712 SD", @@ -350,6 +354,24 @@ sdhci_init(struct sdhci_slot *slot) } static void +sdhci_lower_frequency(device_t dev) +{ + + /* Enable SD2.0 mode. */ + pci_write_config(dev, SDHC_PCI_MODE_KEY, 0xfc, 1); + pci_write_config(dev, SDHC_PCI_MODE, SDHC_PCI_MODE_SD20, 1); + pci_write_config(dev, SDHC_PCI_MODE_KEY, 0x00, 1); + + /* + * Some SD/MMC cards don't work with the default base + * clock frequency of 200MHz. Lower it to 50Hz. + */ + pci_write_config(dev, SDHC_PCI_BASE_FREQ_KEY, 0x01, 1); + pci_write_config(dev, SDHC_PCI_BASE_FREQ, 50, 1); + pci_write_config(dev, SDHC_PCI_BASE_FREQ_KEY, 0x00, 1); +} + +static void sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock) { uint32_t res; @@ -631,6 +653,9 @@ sdhci_attach(device_t dev) break; } } + /* Some controllers need to be bumped into the right mode. */ + if (sc->quirks & SDHCI_QUIRK_LOWER_FREQUENCY) + sdhci_lower_frequency(dev); /* Read slots info from PCI registers. */ slots = pci_read_config(dev, PCI_SLOT_INFO, 1); bar = PCI_SLOT_INFO_FIRST_BAR(slots); Modified: stable/9/sys/dev/sdhci/sdhci.h ============================================================================== --- stable/9/sys/dev/sdhci/sdhci.h Mon Jun 18 07:54:10 2012 (r237223) +++ stable/9/sys/dev/sdhci/sdhci.h Mon Jun 18 10:56:29 2012 (r237224) @@ -38,6 +38,15 @@ #define PCI_SLOT_INFO_FIRST_BAR(x) ((x) & 7) /* + * RICOH specific PCI registers + */ +#define SDHC_PCI_MODE_KEY 0xf9 +#define SDHC_PCI_MODE 0x150 +#define SDHC_PCI_MODE_SD20 0x10 +#define SDHC_PCI_BASE_FREQ_KEY 0xfc +#define SDHC_PCI_BASE_FREQ 0xe1 + +/* * Controller registers */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 12:45:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E8E8106564A; Mon, 18 Jun 2012 12:45:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 198C08FC08; Mon, 18 Jun 2012 12:45:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ICjZ5N079605; Mon, 18 Jun 2012 12:45:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ICjZDt079602; Mon, 18 Jun 2012 12:45:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206181245.q5ICjZDt079602@svn.freebsd.org> From: Alexander Motin Date: Mon, 18 Jun 2012 12:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237225 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 12:45:36 -0000 Author: mav Date: Mon Jun 18 12:45:35 2012 New Revision: 237225 URL: http://svn.freebsd.org/changeset/base/237225 Log: Remove never used CD/DA_FLAG_TAGGED_QUEUING flags. MFC after: 1 week Modified: head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Mon Jun 18 10:56:29 2012 (r237224) +++ head/sys/cam/scsi/scsi_cd.c Mon Jun 18 12:45:35 2012 (r237225) @@ -97,7 +97,6 @@ typedef enum { CD_FLAG_NEW_DISC = 0x0002, CD_FLAG_DISC_LOCKED = 0x0004, CD_FLAG_DISC_REMOVABLE = 0x0008, - CD_FLAG_TAGGED_QUEUING = 0x0010, CD_FLAG_CHANGER = 0x0040, CD_FLAG_ACTIVE = 0x0080, CD_FLAG_SCHED_ON_COMP = 0x0100, @@ -653,8 +652,6 @@ cdregister(struct cam_periph *periph, vo bioq_init(&softc->bio_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= CD_FLAG_DISC_REMOVABLE; - if ((cgd->inq_data.flags & SID_CmdQue) != 0) - softc->flags |= CD_FLAG_TAGGED_QUEUING; periph->softc = softc; softc->periph = periph; Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Jun 18 10:56:29 2012 (r237224) +++ head/sys/cam/scsi/scsi_da.c Mon Jun 18 12:45:35 2012 (r237225) @@ -77,7 +77,6 @@ typedef enum { DA_FLAG_NEW_PACK = 0x002, DA_FLAG_PACK_LOCKED = 0x004, DA_FLAG_PACK_REMOVABLE = 0x008, - DA_FLAG_TAGGED_QUEUING = 0x010, DA_FLAG_NEED_OTAG = 0x020, DA_FLAG_WENT_IDLE = 0x040, DA_FLAG_RETRY_UA = 0x080, @@ -1540,8 +1539,6 @@ daregister(struct cam_periph *periph, vo bioq_init(&softc->delete_run_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; - if ((cgd->inq_data.flags & SID_CmdQue) != 0) - softc->flags |= DA_FLAG_TAGGED_QUEUING; softc->unmap_max_ranges = UNMAP_MAX_RANGES; softc->unmap_max_lba = 1024*1024*2; From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 13:50:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E4D201065672; Mon, 18 Jun 2012 13:50:41 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEC208FC08; Mon, 18 Jun 2012 13:50:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IDofEU082369; Mon, 18 Jun 2012 13:50:41 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IDoflP082367; Mon, 18 Jun 2012 13:50:41 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201206181350.q5IDoflP082367@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Mon, 18 Jun 2012 13:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237226 - head/sys/netgraph/netflow X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 13:50:42 -0000 Author: melifaro Date: Mon Jun 18 13:50:41 2012 New Revision: 237226 URL: http://svn.freebsd.org/changeset/base/237226 Log: Simplify IP pointer recovery in case of mbuf reallocation. Reviewed by: glebius (previous version) Approved by: ae(mentor) MFC after: 2 weeks Modified: head/sys/netgraph/netflow/ng_netflow.c Modified: head/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.c Mon Jun 18 12:45:35 2012 (r237225) +++ head/sys/netgraph/netflow/ng_netflow.c Mon Jun 18 13:50:41 2012 (r237226) @@ -560,8 +560,8 @@ ng_netflow_rcvdata (hook_p hook, item_p struct ip6_hdr *ip6 = NULL; struct m_tag *mtag; int pullup_len = 0, off; - uint8_t upper_proto = 0, is_frag = 0; - int error = 0, bypass = 0, acct = 0; + uint8_t acct = 0, bypass = 0, is_frag = 0, upper_proto = 0; + int error = 0, l3_off = 0; unsigned int src_if_index; caddr_t upper_ptr = NULL; fib_export_p fe; @@ -666,6 +666,7 @@ ng_netflow_rcvdata (hook_p hook, item_p M_CHECK(sizeof(struct ip)); eh = mtod(m, struct ether_header *); ip = (struct ip *)(eh + 1); + l3_off = sizeof(struct ether_header); break; #ifdef INET6 case ETHERTYPE_IPV6: @@ -676,6 +677,7 @@ ng_netflow_rcvdata (hook_p hook, item_p M_CHECK(sizeof(struct ip6_hdr)); eh = mtod(m, struct ether_header *); ip6 = (struct ip6_hdr *)(eh + 1); + l3_off = sizeof(struct ether_header); break; #endif case ETHERTYPE_VLAN: @@ -686,6 +688,7 @@ ng_netflow_rcvdata (hook_p hook, item_p sizeof(struct ether_header)); evh = mtod(m, struct ether_vlan_header *); etype = ntohs(evh->evl_proto); + l3_off = sizeof(struct ether_vlan_header); if (etype == ETHERTYPE_IP) { M_CHECK(sizeof(struct ip)); @@ -707,6 +710,7 @@ ng_netflow_rcvdata (hook_p hook, item_p case DLT_RAW: /* IP packets */ M_CHECK(sizeof(struct ip)); ip = mtod(m, struct ip *); + /* l3_off is already zero */ #ifdef INET6 /* If INET6 is not defined IPv6 packets will be discarded in ng_netflow_flow_add() */ if (ip->ip_v == IP6VERSION) { @@ -824,7 +828,10 @@ ng_netflow_rcvdata (hook_p hook, item_p case IPPROTO_NONE: goto loopend; #endif - /* Any unknow header (new extension or IPv6/IPv4 header for tunnels) */ + /* + * Any unknow header (new extension or IPv6/IPv4 + * header for tunnels) ends loop. + */ default: goto loopend; } @@ -842,56 +849,11 @@ loopend: /* Just in case of real reallocation in M_CHECK() / m_pullup() */ if (m != m_old) { atomic_fetchadd_32(&priv->info.nfinfo_realloc_mbuf, 1); - ip = NULL; - ip6 = NULL; - switch (iface->info.ifinfo_dlt) { - case DLT_EN10MB: /* Ethernet */ - { - struct ether_header *eh; - - eh = mtod(m, struct ether_header *); - switch (ntohs(eh->ether_type)) { - case ETHERTYPE_IP: - ip = (struct ip *)(eh + 1); - break; -#ifdef INET6 - case ETHERTYPE_IPV6: - ip6 = (struct ip6_hdr *)(eh + 1); - break; -#endif - case ETHERTYPE_VLAN: - { - struct ether_vlan_header *evh; - - evh = mtod(m, struct ether_vlan_header *); - if (ntohs(evh->evl_proto) == ETHERTYPE_IP) { - ip = (struct ip *)(evh + 1); - break; -#ifdef INET6 - } else if (ntohs(evh->evl_proto) == ETHERTYPE_IPV6) { - ip6 = (struct ip6_hdr *)(evh + 1); - break; -#endif - } - } - default: - panic("ng_netflow entered deadcode"); - } - break; - } - case DLT_RAW: /* IP packets */ - ip = mtod(m, struct ip *); -#ifdef INET6 - if (ip->ip_v == IP6VERSION) { - /* IPv6 packet */ - ip = NULL; - ip6 = mtod(m, struct ip6_hdr *); - } -#endif - break; - default: - panic("ng_netflow entered deadcode"); - } + /* Restore ip/ipv6 pointer */ + if (ip != NULL) + ip = (struct ip *)(mtod(m, caddr_t) + l3_off); + else if (ip6 != NULL) + ip6 = (struct ip6_hdr *)(mtod(m, caddr_t) + l3_off); } upper_ptr = (caddr_t)(mtod(m, caddr_t) + off); From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 13:56:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2DBC1065673; Mon, 18 Jun 2012 13:56:36 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C6B78FC16; Mon, 18 Jun 2012 13:56:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IDua2h082646; Mon, 18 Jun 2012 13:56:36 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IDuaIf082641; Mon, 18 Jun 2012 13:56:36 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201206181356.q5IDuaIf082641@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Mon, 18 Jun 2012 13:56:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237227 - in head: share/man/man4 sys/netgraph/netflow X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 13:56:36 -0000 Author: melifaro Date: Mon Jun 18 13:56:36 2012 New Revision: 237227 URL: http://svn.freebsd.org/changeset/base/237227 Log: Make radix lookup on src and dst flow addresses optional and configurable on per-interface basis. Remove __inline__ for several functions being called once per flow (e.g once per 10-20 packets on common traffic flows). Update manual page to simplify search for BPF data link types. Sponsored by Yandex LLC Reviewed by: glebius Approved by: ae(mentor) MFC after: 2 weeks Modified: head/share/man/man4/ng_netflow.4 head/sys/netgraph/netflow/netflow.c head/sys/netgraph/netflow/ng_netflow.c head/sys/netgraph/netflow/ng_netflow.h Modified: head/share/man/man4/ng_netflow.4 ============================================================================== --- head/share/man/man4/ng_netflow.4 Mon Jun 18 13:50:41 2012 (r237226) +++ head/share/man/man4/ng_netflow.4 Mon Jun 18 13:56:36 2012 (r237227) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2011 +.Dd June 16, 2012 .Dt NG_NETFLOW 4 .Os .Sh NAME @@ -112,7 +112,18 @@ The hook number is passed as an argument Sets data link type on the .Va iface Ns Ar N hook. -Currently, supported types are raw IP datagrams and Ethernet. +Currently, supported types are +.Cm DLT_RAW +(raw IP datagrams) and +.Cm DLT_EN10MB +(Ethernet). +DLT_ definitions can be found in +.In net/bpf.h +header. +Currently used values are 1 for +.Cm DLT_EN10MB +and 12 for +.Cm DLT_RAW . This message type uses .Vt "struct ng_netflow_setdlt" as an argument: @@ -180,18 +191,36 @@ struct ng_netflow_setconfig { #define NG_NETFLOW_CONF_EGRESS 2 #define NG_NETFLOW_CONF_ONCE 4 #define NG_NETFLOW_CONF_THISONCE 8 +#define NG_NETFLOW_CONF_NOSRCLOOKUP 16 +#define NG_NETFLOW_CONF_NODSTLOOKUP 32 }; .Ed .Pp Configuration is a bitmask of several options. Option NG_NETFLOW_CONF_INGRESS enabled by default enables ingress NetFlow generation (for data coming from -ifaceX hook). Option NG_NETFLOW_CONF_EGRESS enables egress NetFlow (for data -coming from outX hook). Option NG_NETFLOW_CONF_ONCE defines that packet should -be accounted only once if it several times passes via netflow node. Option -NG_NETFLOW_CONF_THISONCE defines that packet should be accounted only once -if it several times passes via exactly this netflow node. Last two options are -important to avoid duplicate accounting when both ingress and egress NetFlow -are enabled. +ifaceX hook). +Option +.Va NG_NETFLOW_CONF_EGRESS +enables egress NetFlow (for data coming from outX hook). +Option +.Va NG_NETFLOW_CONF_ONCE +defines that packet should be accounted only once if it several times passes +via netflow node. +Option +.Va NG_NETFLOW_CONF_THISONCE +defines that packet should be accounted only once if it several times passes +via exactly this netflow node. +These two options are important to avoid duplicate accounting when both ingress +and egress NetFlow are enabled. +Option +.Va NG_NETFLOW_CONF_NOSRCLOOKUP +skips radix lookup on flow source address used to fill in network mask. +Option +.Va NG_NETFLOW_CONF_NODSTLOOKUP +skips radix lookup on destination (which fills egress interface id, destination +mask and gateway). +If one doesn't need data provided by lookups, he/she can disable them, to reduce +load on routers. .It Dv NGM_NETFLOW_SETTEMPLATE Sets various timeouts to announce data flow templates (NetFlow v9-specific). This message requires Modified: head/sys/netgraph/netflow/netflow.c ============================================================================== --- head/sys/netgraph/netflow/netflow.c Mon Jun 18 13:50:41 2012 (r237226) +++ head/sys/netgraph/netflow/netflow.c Mon Jun 18 13:56:36 2012 (r237227) @@ -98,9 +98,9 @@ MALLOC_DEFINE(M_NETFLOW_HASH, "netflow_h static int export_add(item_p, struct flow_entry *); static int export_send(priv_p, fib_export_p, item_p, int); -static int hash_insert(priv_p, struct flow_hash_entry *, struct flow_rec *, int, uint8_t); +static int hash_insert(priv_p, struct flow_hash_entry *, struct flow_rec *, int, uint8_t, uint8_t); #ifdef INET6 -static int hash6_insert(priv_p, struct flow_hash_entry *, struct flow6_rec *, int, uint8_t); +static int hash6_insert(priv_p, struct flow_hash_entry *, struct flow6_rec *, int, uint8_t, uint8_t); #endif static __inline void expire_flow(priv_p, fib_export_p, struct flow_entry *, int); @@ -325,9 +325,9 @@ ng_netflow_copyinfo(priv_p priv, struct * as this was done in previous version. Need to test & profile * to be sure. */ -static __inline int +static int hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, - int plen, uint8_t tcp_flags) + int plen, uint8_t flags, uint8_t tcp_flags) { struct flow_entry *fle; struct sockaddr_in sin; @@ -358,44 +358,48 @@ hash_insert(priv_p priv, struct flow_has * First we do route table lookup on destination address. So we can * fill in out_ifx, dst_mask, nexthop, and dst_as in future releases. */ - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_addr = fle->f.r.r_dst; - rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, r->fib); - if (rt != NULL) { - fle->f.fle_o_ifx = rt->rt_ifp->if_index; - - if (rt->rt_flags & RTF_GATEWAY && - rt->rt_gateway->sa_family == AF_INET) - fle->f.next_hop = - ((struct sockaddr_in *)(rt->rt_gateway))->sin_addr; - - if (rt_mask(rt)) - fle->f.dst_mask = bitcount32(((struct sockaddr_in *) - rt_mask(rt))->sin_addr.s_addr); - else if (rt->rt_flags & RTF_HOST) - /* Give up. We can't determine mask :( */ - fle->f.dst_mask = 32; + if ((flags & NG_NETFLOW_CONF_NODSTLOOKUP) == 0) { + bzero(&sin, sizeof(sin)); + sin.sin_len = sizeof(struct sockaddr_in); + sin.sin_family = AF_INET; + sin.sin_addr = fle->f.r.r_dst; + rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, r->fib); + if (rt != NULL) { + fle->f.fle_o_ifx = rt->rt_ifp->if_index; + + if (rt->rt_flags & RTF_GATEWAY && + rt->rt_gateway->sa_family == AF_INET) + fle->f.next_hop = + ((struct sockaddr_in *)(rt->rt_gateway))->sin_addr; + + if (rt_mask(rt)) + fle->f.dst_mask = bitcount32(((struct sockaddr_in *) + rt_mask(rt))->sin_addr.s_addr); + else if (rt->rt_flags & RTF_HOST) + /* Give up. We can't determine mask :( */ + fle->f.dst_mask = 32; - RTFREE_LOCKED(rt); + RTFREE_LOCKED(rt); + } } /* Do route lookup on source address, to fill in src_mask. */ - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_addr = fle->f.r.r_src; - rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, r->fib); - if (rt != NULL) { - if (rt_mask(rt)) - fle->f.src_mask = bitcount32(((struct sockaddr_in *) - rt_mask(rt))->sin_addr.s_addr); - else if (rt->rt_flags & RTF_HOST) - /* Give up. We can't determine mask :( */ - fle->f.src_mask = 32; + if ((flags & NG_NETFLOW_CONF_NOSRCLOOKUP) == 0) { + bzero(&sin, sizeof(sin)); + sin.sin_len = sizeof(struct sockaddr_in); + sin.sin_family = AF_INET; + sin.sin_addr = fle->f.r.r_src; + rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, r->fib); + if (rt != NULL) { + if (rt_mask(rt)) + fle->f.src_mask = bitcount32(((struct sockaddr_in *) + rt_mask(rt))->sin_addr.s_addr); + else if (rt->rt_flags & RTF_HOST) + /* Give up. We can't determine mask :( */ + fle->f.src_mask = 32; - RTFREE_LOCKED(rt); + RTFREE_LOCKED(rt); + } } /* Push new flow at the and of hash. */ @@ -410,10 +414,10 @@ hash_insert(priv_p priv, struct flow_has bitcount32((x).__u6_addr.__u6_addr32[1]) + \ bitcount32((x).__u6_addr.__u6_addr32[2]) + \ bitcount32((x).__u6_addr.__u6_addr32[3]) -/* XXX: Do we need inline here ? */ -static __inline int +#define RT_MASK6(x) (ipv6_masklen(((struct sockaddr_in6 *)rt_mask(x))->sin6_addr)) +static int hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r, - int plen, uint8_t tcp_flags) + int plen, uint8_t flags, uint8_t tcp_flags) { struct flow6_entry *fle6; struct sockaddr_in6 *src, *dst; @@ -445,49 +449,55 @@ hash6_insert(priv_p priv, struct flow_ha * First we do route table lookup on destination address. So we can * fill in out_ifx, dst_mask, nexthop, and dst_as in future releases. */ - bzero(&rin6, sizeof(struct route_in6)); - dst = (struct sockaddr_in6 *)&rin6.ro_dst; - dst->sin6_len = sizeof(struct sockaddr_in6); - dst->sin6_family = AF_INET6; - dst->sin6_addr = r->dst.r_dst6; - - rin6.ro_rt = rtalloc1_fib((struct sockaddr *)dst, 0, 0, r->fib); - - if (rin6.ro_rt != NULL) { - rt = rin6.ro_rt; - fle6->f.fle_o_ifx = rt->rt_ifp->if_index; - - if (rt->rt_flags & RTF_GATEWAY && - rt->rt_gateway->sa_family == AF_INET6) - fle6->f.n.next_hop6 = - ((struct sockaddr_in6 *)(rt->rt_gateway))->sin6_addr; - - if (rt_mask(rt)) - fle6->f.dst_mask = ipv6_masklen(((struct sockaddr_in6 *)rt_mask(rt))->sin6_addr); - else - fle6->f.dst_mask = 128; + if ((flags & NG_NETFLOW_CONF_NODSTLOOKUP) == 0) + { + bzero(&rin6, sizeof(struct route_in6)); + dst = (struct sockaddr_in6 *)&rin6.ro_dst; + dst->sin6_len = sizeof(struct sockaddr_in6); + dst->sin6_family = AF_INET6; + dst->sin6_addr = r->dst.r_dst6; + + rin6.ro_rt = rtalloc1_fib((struct sockaddr *)dst, 0, 0, r->fib); + + if (rin6.ro_rt != NULL) { + rt = rin6.ro_rt; + fle6->f.fle_o_ifx = rt->rt_ifp->if_index; + + if (rt->rt_flags & RTF_GATEWAY && + rt->rt_gateway->sa_family == AF_INET6) + fle6->f.n.next_hop6 = + ((struct sockaddr_in6 *)(rt->rt_gateway))->sin6_addr; - RTFREE_LOCKED(rt); + if (rt_mask(rt)) + fle6->f.dst_mask = RT_MASK6(rt); + else + fle6->f.dst_mask = 128; + + RTFREE_LOCKED(rt); + } } - /* Do route lookup on source address, to fill in src_mask. */ - bzero(&rin6, sizeof(struct route_in6)); - src = (struct sockaddr_in6 *)&rin6.ro_dst; - src->sin6_len = sizeof(struct sockaddr_in6); - src->sin6_family = AF_INET6; - src->sin6_addr = r->src.r_src6; - - rin6.ro_rt = rtalloc1_fib((struct sockaddr *)src, 0, 0, r->fib); - - if (rin6.ro_rt != NULL) { - rt = rin6.ro_rt; - - if (rt_mask(rt)) - fle6->f.src_mask = ipv6_masklen(((struct sockaddr_in6 *)rt_mask(rt))->sin6_addr); - else - fle6->f.src_mask = 128; + if ((flags & NG_NETFLOW_CONF_NODSTLOOKUP) == 0) + { + /* Do route lookup on source address, to fill in src_mask. */ + bzero(&rin6, sizeof(struct route_in6)); + src = (struct sockaddr_in6 *)&rin6.ro_dst; + src->sin6_len = sizeof(struct sockaddr_in6); + src->sin6_family = AF_INET6; + src->sin6_addr = r->src.r_src6; + + rin6.ro_rt = rtalloc1_fib((struct sockaddr *)src, 0, 0, r->fib); + + if (rin6.ro_rt != NULL) { + rt = rin6.ro_rt; - RTFREE_LOCKED(rt); + if (rt_mask(rt)) + fle6->f.src_mask = RT_MASK6(rt); + else + fle6->f.src_mask = 128; + + RTFREE_LOCKED(rt); + } } /* Push new flow at the and of hash. */ @@ -495,6 +505,8 @@ hash6_insert(priv_p priv, struct flow_ha return (0); } +#undef ipv6_masklen +#undef RT_MASK6 #endif @@ -651,7 +663,7 @@ ng_netflow_cache_flush(priv_p priv) /* Insert packet from into flow cache. */ int ng_netflow_flow_add(priv_p priv, fib_export_p fe, struct ip *ip, caddr_t upper_ptr, uint8_t upper_proto, - uint8_t is_frag, unsigned int src_if_index) + uint8_t flags, unsigned int src_if_index) { register struct flow_entry *fle, *fle1; struct flow_hash_entry *hsh; @@ -770,7 +782,7 @@ ng_netflow_flow_add(priv_p priv, fib_exp } } } else /* A new flow entry. */ - error = hash_insert(priv, hsh, &r, plen, tcp_flags); + error = hash_insert(priv, hsh, &r, plen, flags, tcp_flags); mtx_unlock(&hsh->mtx); @@ -781,7 +793,7 @@ ng_netflow_flow_add(priv_p priv, fib_exp /* Insert IPv6 packet from into flow cache. */ int ng_netflow_flow6_add(priv_p priv, fib_export_p fe, struct ip6_hdr *ip6, caddr_t upper_ptr, uint8_t upper_proto, - uint8_t is_frag, unsigned int src_if_index) + uint8_t flags, unsigned int src_if_index) { register struct flow_entry *fle = NULL, *fle1; register struct flow6_entry *fle6; @@ -811,7 +823,7 @@ ng_netflow_flow6_add(priv_p priv, fib_ex #if 0 r.r_tos = ip->ip_tos; #endif - if (is_frag == 0) { + if ((flags & NG_NETFLOW_IS_FRAG) == 0) { switch(upper_proto) { case IPPROTO_TCP: { @@ -896,7 +908,7 @@ ng_netflow_flow6_add(priv_p priv, fib_ex } } } else /* A new flow entry. */ - error = hash6_insert(priv, hsh, &r, plen, tcp_flags); + error = hash6_insert(priv, hsh, &r, plen, flags, tcp_flags); mtx_unlock(&hsh->mtx); Modified: head/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.c Mon Jun 18 13:50:41 2012 (r237226) +++ head/sys/netgraph/netflow/ng_netflow.c Mon Jun 18 13:56:36 2012 (r237227) @@ -560,7 +560,7 @@ ng_netflow_rcvdata (hook_p hook, item_p struct ip6_hdr *ip6 = NULL; struct m_tag *mtag; int pullup_len = 0, off; - uint8_t acct = 0, bypass = 0, is_frag = 0, upper_proto = 0; + uint8_t acct = 0, bypass = 0, flags = 0, upper_proto = 0; int error = 0, l3_off = 0; unsigned int src_if_index; caddr_t upper_ptr = NULL; @@ -619,6 +619,9 @@ ng_netflow_rcvdata (hook_p hook, item_p } } + /* Import configuration flags related to flow creation */ + flags = iface->info.conf & NG_NETFLOW_FLOW_FLAGS; + NGI_GET_M(item, m); m_old = m; @@ -759,7 +762,7 @@ ng_netflow_rcvdata (hook_p hook, item_p } } else if (ip != NULL) { /* Nothing to save except upper layer proto, since this is packet fragment */ - is_frag = 1; + flags |= NG_NETFLOW_IS_FRAG; upper_proto = ip->ip_p; if ((ip->ip_v != IPVERSION) || ((ip->ip_hl << 2) < sizeof(struct ip))) @@ -821,7 +824,7 @@ ng_netflow_rcvdata (hook_p hook, item_p upper_proto = ip6f->ip6f_nxt; hdr_off = sizeof(struct ip6_frag); off += hdr_off; - is_frag = 1; + flags |= NG_NETFLOW_IS_FRAG; goto loopend; #if 0 @@ -886,10 +889,10 @@ loopend: } if (ip != NULL) - error = ng_netflow_flow_add(priv, fe, ip, upper_ptr, upper_proto, is_frag, src_if_index); + error = ng_netflow_flow_add(priv, fe, ip, upper_ptr, upper_proto, flags, src_if_index); #ifdef INET6 else if (ip6 != NULL) - error = ng_netflow_flow6_add(priv, fe, ip6, upper_ptr, upper_proto, is_frag, src_if_index); + error = ng_netflow_flow6_add(priv, fe, ip6, upper_ptr, upper_proto, flags, src_if_index); #endif else goto bypass; Modified: head/sys/netgraph/netflow/ng_netflow.h ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.h Mon Jun 18 13:50:41 2012 (r237226) +++ head/sys/netgraph/netflow/ng_netflow.h Mon Jun 18 13:56:36 2012 (r237227) @@ -111,10 +111,16 @@ struct ng_netflow_settimeouts { uint32_t active_timeout; /* flow active timeout */ }; -#define NG_NETFLOW_CONF_INGRESS 1 -#define NG_NETFLOW_CONF_EGRESS 2 -#define NG_NETFLOW_CONF_ONCE 4 -#define NG_NETFLOW_CONF_THISONCE 8 +#define NG_NETFLOW_CONF_INGRESS 0x01 /* Account on ingress */ +#define NG_NETFLOW_CONF_EGRESS 0x02 /* Account on egress */ +#define NG_NETFLOW_CONF_ONCE 0x04 /* Add tag to account only once */ +#define NG_NETFLOW_CONF_THISONCE 0x08 /* Account once in current node */ +#define NG_NETFLOW_CONF_NOSRCLOOKUP 0x10 /* No radix lookup on src */ +#define NG_NETFLOW_CONF_NODSTLOOKUP 0x20 /* No radix lookup on dst */ + +#define NG_NETFLOW_IS_FRAG 0x01 +#define NG_NETFLOW_FLOW_FLAGS (NG_NETFLOW_CONF_NOSRCLOOKUP|\ + NG_NETFLOW_CONF_NODSTLOOKUP) /* This structure is passed to NGM_NETFLOW_SETCONFIG */ struct ng_netflow_setconfig { From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 16:22:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1ECD106564A; Mon, 18 Jun 2012 16:22:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FAD68FC08; Mon, 18 Jun 2012 16:22:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IGM0lS088515; Mon, 18 Jun 2012 16:22:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IGM0TP088511; Mon, 18 Jun 2012 16:22:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206181622.q5IGM0TP088511@svn.freebsd.org> From: Alan Cox Date: Mon, 18 Jun 2012 16:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237228 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 16:22:00 -0000 Author: alc Date: Mon Jun 18 16:21:59 2012 New Revision: 237228 URL: http://svn.freebsd.org/changeset/base/237228 Log: Add PV chunk and list locking to pmap_page_exists_quick(), pmap_page_is_mapped(), and pmap_remove_pages(). These functions are no longer serialized by the pvh global lock. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Jun 18 13:56:36 2012 (r237227) +++ head/sys/amd64/amd64/pmap.c Mon Jun 18 16:21:59 2012 (r237228) @@ -168,6 +168,14 @@ __FBSDID("$FreeBSD$"); #define pa_index(pa) ((pa) >> PDRSHIFT) #define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) +#define NPV_LIST_LOCKS MAXCPU + +#define PHYS_TO_PV_LIST_LOCK(pa) \ + (&pv_list_locks[pa_index(pa) % NPV_LIST_LOCKS]) + +#define VM_PAGE_TO_PV_LIST_LOCK(m) \ + PHYS_TO_PV_LIST_LOCK(VM_PAGE_TO_PHYS(m)) + struct pmap kernel_pmap_store; vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ @@ -214,7 +222,8 @@ static struct { * Data for the pv entry allocation mechanism */ static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); -static long pv_entry_count; +static struct mtx pv_chunks_mutex; +static struct rwlock pv_list_locks[NPV_LIST_LOCKS]; static struct md_page *pv_table; /* @@ -763,6 +772,17 @@ pmap_init(void) } /* + * Initialize the pv chunk list mutex. + */ + mtx_init(&pv_chunks_mutex, "pv chunk list", NULL, MTX_DEF); + + /* + * Initialize the pool of pv list locks. + */ + for (i = 0; i < NPV_LIST_LOCKS; i++) + rw_init(&pv_list_locks[i], "pv list"); + + /* * Calculate the size of the pv head table for superpages. */ for (i = 0; phys_avail[i + 1]; i += 2); @@ -2023,6 +2043,7 @@ pv_to_chunk(pv_entry_t pv) static const uint64_t pc_freemask[_NPCM] = { PC_FREE0, PC_FREE1, PC_FREE2 }; +static long pv_entry_count; SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, "Current number of pv entries"); @@ -2215,10 +2236,12 @@ free_pv_chunk(struct pv_chunk *pc) { vm_page_t m; + mtx_lock(&pv_chunks_mutex); TAILQ_REMOVE(&pv_chunks, pc, pc_lru); - PV_STAT(pv_entry_spare -= _NPCPV); - PV_STAT(pc_chunk_count--); - PV_STAT(pc_chunk_frees++); + mtx_unlock(&pv_chunks_mutex); + PV_STAT(atomic_subtract_int(&pv_entry_spare, _NPCPV)); + PV_STAT(atomic_subtract_int(&pc_chunk_count, 1)); + PV_STAT(atomic_add_int(&pc_chunk_frees, 1)); /* entire chunk is free, return it */ m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m->phys_addr); @@ -4000,6 +4023,7 @@ boolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m) { struct md_page *pvh; + struct rwlock *lock; pv_entry_t pv; int loops = 0; boolean_t rv; @@ -4007,7 +4031,9 @@ pmap_page_exists_quick(pmap_t pmap, vm_p KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; - rw_wlock(&pvh_global_lock); + rw_rlock(&pvh_global_lock); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + rw_rlock(lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { if (PV_PMAP(pv) == pmap) { rv = TRUE; @@ -4029,7 +4055,8 @@ pmap_page_exists_quick(pmap_t pmap, vm_p break; } } - rw_wunlock(&pvh_global_lock); + rw_runlock(lock); + rw_runlock(&pvh_global_lock); return (rv); } @@ -4088,15 +4115,19 @@ pmap_pvh_wired_mappings(struct md_page * boolean_t pmap_page_is_mapped(vm_page_t m) { + struct rwlock *lock; boolean_t rv; if ((m->oflags & VPO_UNMANAGED) != 0) return (FALSE); - rw_wlock(&pvh_global_lock); + rw_rlock(&pvh_global_lock); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + rw_rlock(lock); rv = !TAILQ_EMPTY(&m->md.pv_list) || ((m->flags & PG_FICTITIOUS) == 0 && !TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)); - rw_wunlock(&pvh_global_lock); + rw_runlock(lock); + rw_runlock(&pvh_global_lock); return (rv); } @@ -4118,19 +4149,21 @@ pmap_remove_pages(pmap_t pmap) pv_entry_t pv; struct md_page *pvh; struct pv_chunk *pc, *npc; - int field, idx; + struct rwlock *lock, *new_lock; int64_t bit; uint64_t inuse, bitmask; - int allfree; + int allfree, field, freed, idx; if (pmap != PCPU_GET(curpmap)) { printf("warning: pmap_remove_pages called with non-current pmap\n"); return; } - rw_wlock(&pvh_global_lock); + rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); + lock = NULL; TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { allfree = 1; + freed = 0; for (field = 0; field < _NPCM; field++) { inuse = ~pc->pc_map[field] & pc_freemask[field]; while (inuse != 0) { @@ -4186,10 +4219,15 @@ pmap_remove_pages(pmap_t pmap) vm_page_dirty(m); } + new_lock = VM_PAGE_TO_PV_LIST_LOCK(m); + if (new_lock != lock) { + if (lock != NULL) + rw_wunlock(lock); + lock = new_lock; + rw_wlock(lock); + } + /* Mark free */ - PV_STAT(pv_entry_frees++); - PV_STAT(pv_entry_spare++); - pv_entry_count--; pc->pc_map[field] |= bitmask; if ((tpte & PG_PS) != 0) { pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE); @@ -4223,15 +4261,25 @@ pmap_remove_pages(pmap_t pmap) } } pmap_unuse_pt(pmap, pv->pv_va, ptepde, &free); + freed++; } } + PV_STAT(atomic_add_long(&pv_entry_frees, freed)); + PV_STAT(atomic_add_int(&pv_entry_spare, freed)); + atomic_subtract_long(&pv_entry_count, freed); if (allfree) { + if (lock != NULL) { + rw_wunlock(lock); + lock = NULL; + } TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); free_pv_chunk(pc); } } + if (lock != NULL) + rw_wunlock(lock); pmap_invalidate_all(pmap); - rw_wunlock(&pvh_global_lock); + rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); pmap_free_zero_pages(free); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 17:09:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46EF8106566B; Mon, 18 Jun 2012 17:09:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18CF28FC12; Mon, 18 Jun 2012 17:09:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IH9dff090603; Mon, 18 Jun 2012 17:09:39 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IH9dxd090601; Mon, 18 Jun 2012 17:09:39 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206181709.q5IH9dxd090601@svn.freebsd.org> From: Michael Tuexen Date: Mon, 18 Jun 2012 17:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237229 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 17:09:40 -0000 Author: tuexen Date: Mon Jun 18 17:09:39 2012 New Revision: 237229 URL: http://svn.freebsd.org/changeset/base/237229 Log: Cleanup the UDP decapsulation code. MFC after: 3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Mon Jun 18 16:21:59 2012 (r237228) +++ head/sys/netinet/sctputil.c Mon Jun 18 17:09:39 2012 (r237229) @@ -6837,83 +6837,61 @@ sctp_recv_udp_tunneled_packet(struct mbu struct ip *iph; struct mbuf *sp, *last; struct udphdr *uhdr; - uint16_t port = 0; - int header_size = sizeof(struct udphdr) + sizeof(struct sctphdr); + uint16_t port; - /* - * Split out the mbuf chain. Leave the IP header in m, place the - * rest in the sp. - */ if ((m->m_flags & M_PKTHDR) == 0) { /* Can't handle one that is not a pkt hdr */ goto out; } - /* pull the src port */ + /* Pull the src port */ iph = mtod(m, struct ip *); uhdr = (struct udphdr *)((caddr_t)iph + off); - port = uhdr->uh_sport; + /* + * Split out the mbuf chain. Leave the IP header in m, place the + * rest in the sp. + */ sp = m_split(m, off, M_DONTWAIT); if (sp == NULL) { /* Gak, drop packet, we can't do a split */ goto out; } - if (sp->m_pkthdr.len < header_size) { - /* Gak, packet can't have an SCTP header in it - to small */ + if (sp->m_pkthdr.len < sizeof(struct udphdr) + sizeof(struct sctphdr)) { + /* Gak, packet can't have an SCTP header in it - too small */ m_freem(sp); goto out; } - /* ok now pull up the UDP header and SCTP header together */ - sp = m_pullup(sp, header_size); + /* Now pull up the UDP header and SCTP header together */ + sp = m_pullup(sp, sizeof(struct udphdr) + sizeof(struct sctphdr)); if (sp == NULL) { /* Gak pullup failed */ goto out; } - /* trim out the UDP header */ + /* Trim out the UDP header */ m_adj(sp, sizeof(struct udphdr)); /* Now reconstruct the mbuf chain */ - /* 1) find last one */ - last = m; - while (last->m_next != NULL) { - last = last->m_next; - } + for (last = m; last->m_next; last = last->m_next); last->m_next = sp; m->m_pkthdr.len += sp->m_pkthdr.len; - last = m; - while (last != NULL) { - last = last->m_next; - } - /* Now its ready for sctp_input or sctp6_input */ iph = mtod(m, struct ip *); switch (iph->ip_v) { #ifdef INET case IPVERSION: - { - uint16_t len; - - /* its IPv4 */ - len = SCTP_GET_IPV4_LENGTH(iph); - len -= sizeof(struct udphdr); - SCTP_GET_IPV4_LENGTH(iph) = len; - sctp_input_with_port(m, off, port); - break; - } + iph->ip_len -= sizeof(struct udphdr); + sctp_input_with_port(m, off, port); + break; #endif #ifdef INET6 case IPV6_VERSION >> 4: - { - /* its IPv6 - NOT supported */ - goto out; - break; + /* Not yet supported. */ + goto out; + break; - } #endif default: - { - m_freem(m); - break; - } + goto out; + break; } return; out: From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 17:11:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0ED4106564A; Mon, 18 Jun 2012 17:11:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A379A8FC12; Mon, 18 Jun 2012 17:11:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IHBONq090721; Mon, 18 Jun 2012 17:11:24 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IHBO9i090717; Mon, 18 Jun 2012 17:11:24 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206181711.q5IHBO9i090717@svn.freebsd.org> From: Michael Tuexen Date: Mon, 18 Jun 2012 17:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237230 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 17:11:24 -0000 Author: tuexen Date: Mon Jun 18 17:11:24 2012 New Revision: 237230 URL: http://svn.freebsd.org/changeset/base/237230 Log: Add rate limitation for SCTP OOTB responses. MFC after: 3 days Modified: head/sys/netinet/icmp_var.h head/sys/netinet/ip_icmp.c head/sys/netinet/sctp_input.c Modified: head/sys/netinet/icmp_var.h ============================================================================== --- head/sys/netinet/icmp_var.h Mon Jun 18 17:09:39 2012 (r237229) +++ head/sys/netinet/icmp_var.h Mon Jun 18 17:11:24 2012 (r237230) @@ -102,7 +102,8 @@ extern int badport_bandlim(int); #define BANDLIM_RST_CLOSEDPORT 3 /* No connection, and no listeners */ #define BANDLIM_RST_OPENPORT 4 /* No connection, listener */ #define BANDLIM_ICMP6_UNREACH 5 -#define BANDLIM_MAX 5 +#define BANDLIM_SCTP_OOTB 6 +#define BANDLIM_MAX 6 #endif #endif Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Mon Jun 18 17:09:39 2012 (r237229) +++ head/sys/netinet/ip_icmp.c Mon Jun 18 17:11:24 2012 (r237230) @@ -965,7 +965,8 @@ badport_bandlim(int which) { "icmp tstamp response" }, { "closed port RST response" }, { "open port RST response" }, - { "icmp6 unreach response" } + { "icmp6 unreach response" }, + { "sctp ootb response" } }; /* Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Mon Jun 18 17:09:39 2012 (r237229) +++ head/sys/netinet/sctp_input.c Mon Jun 18 17:11:24 2012 (r237230) @@ -6060,15 +6060,8 @@ sctp_skip_csum_4: struct sctp_init_chunk *init_chk, chunk_buf; SCTP_STAT_INCR(sctps_noport); -#ifdef ICMP_BANDLIM - /* - * we use the bandwidth limiting to protect against sending - * too many ABORTS all at once. In this case these count the - * same as an ICMP message. - */ - if (badport_bandlim(0) < 0) + if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0) goto bad; -#endif /* ICMP_BANDLIM */ SCTPDBG(SCTP_DEBUG_INPUT1, "Sending a ABORT from packet entry!\n"); if (ch->chunk_type == SCTP_INITIATION) { From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 17:21:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CC841065673; Mon, 18 Jun 2012 17:21:03 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1745E8FC14; Mon, 18 Jun 2012 17:21:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IHL2LN091145; Mon, 18 Jun 2012 17:21:02 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IHL2VU091143; Mon, 18 Jun 2012 17:21:02 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206181721.q5IHL2VU091143@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 18 Jun 2012 17:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237231 - stable/8/usr.sbin/acpi/acpidump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 17:21:03 -0000 Author: jkim Date: Mon Jun 18 17:21:02 2012 New Revision: 237231 URL: http://svn.freebsd.org/changeset/base/237231 Log: MFC: r235948 Catch up with realpath(3) changes (r236400) and unbreak acpidump(8). Modified: stable/8/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/8/usr.sbin/acpi/acpidump/ (props changed) Modified: stable/8/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/8/usr.sbin/acpi/acpidump/acpi.c Mon Jun 18 17:11:24 2012 (r237230) +++ stable/8/usr.sbin/acpi/acpidump/acpi.c Mon Jun 18 17:21:02 2012 (r237231) @@ -994,13 +994,13 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, if (tmpdir == NULL) tmpdir = _PATH_TMP; strncpy(tmpstr, tmpdir, sizeof(tmpstr)); - strncat(tmpstr, "/acpidump.", sizeof(tmpstr) - strlen(tmpdir)); if (realpath(tmpstr, buf) == NULL) { - perror("realpath tmp file"); + perror("realpath tmp dir"); return; } strncpy(tmpstr, buf, sizeof(tmpstr)); - len = strlen(buf); + strncat(tmpstr, "/acpidump.", sizeof(tmpstr) - strlen(buf)); + len = strlen(tmpstr); tmpext = tmpstr + len; strncpy(tmpext, "XXXXXX", sizeof(tmpstr) - len); fd = mkstemp(tmpstr); From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 17:23:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98991106566B; Mon, 18 Jun 2012 17:23:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 834B58FC19; Mon, 18 Jun 2012 17:23:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IHNONf091290; Mon, 18 Jun 2012 17:23:24 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IHNOMf091288; Mon, 18 Jun 2012 17:23:24 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206181723.q5IHNOMf091288@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 18 Jun 2012 17:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237232 - stable/9/usr.sbin/acpi/acpidump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 17:23:24 -0000 Author: jkim Date: Mon Jun 18 17:23:24 2012 New Revision: 237232 URL: http://svn.freebsd.org/changeset/base/237232 Log: MFC: r235948 Catch up with realpath(3) changes (r236400) and unbreak acpidump(8). Modified: stable/9/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/9/usr.sbin/acpi/acpidump/ (props changed) Modified: stable/9/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/9/usr.sbin/acpi/acpidump/acpi.c Mon Jun 18 17:21:02 2012 (r237231) +++ stable/9/usr.sbin/acpi/acpidump/acpi.c Mon Jun 18 17:23:24 2012 (r237232) @@ -1196,13 +1196,13 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, if (tmpdir == NULL) tmpdir = _PATH_TMP; strncpy(tmpstr, tmpdir, sizeof(tmpstr)); - strncat(tmpstr, "/acpidump.", sizeof(tmpstr) - strlen(tmpdir)); if (realpath(tmpstr, buf) == NULL) { - perror("realpath tmp file"); + perror("realpath tmp dir"); return; } strncpy(tmpstr, buf, sizeof(tmpstr)); - len = strlen(buf); + strncat(tmpstr, "/acpidump.", sizeof(tmpstr) - strlen(buf)); + len = strlen(tmpstr); tmpext = tmpstr + len; strncpy(tmpext, "XXXXXX", sizeof(tmpstr) - len); fd = mkstemp(tmpstr); From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 19:11:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CDCC41065670; Mon, 18 Jun 2012 19:11:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA2828FC08; Mon, 18 Jun 2012 19:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IJB7SL095736; Mon, 18 Jun 2012 19:11:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IJB7NL095734; Mon, 18 Jun 2012 19:11:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206181911.q5IJB7NL095734@svn.freebsd.org> From: Marius Strobl Date: Mon, 18 Jun 2012 19:11:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237234 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 19:11:07 -0000 Author: marius Date: Mon Jun 18 19:11:07 2012 New Revision: 237234 URL: http://svn.freebsd.org/changeset/base/237234 Log: Avoid hard sentence break. MFC after: 3 days Modified: head/share/man/man4/ahci.4 Modified: head/share/man/man4/ahci.4 ============================================================================== --- head/share/man/man4/ahci.4 Mon Jun 18 18:25:57 2012 (r237233) +++ head/share/man/man4/ahci.4 Mon Jun 18 19:11:07 2012 (r237234) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 6, 2011 +.Dd June 18, 2012 .Dt AHCI 4 .Os .Sh NAME @@ -101,7 +101,8 @@ setting to nonzero value limits maximum Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. .It Va hw.ahci.force setting to nonzero value forces driver attach to some known AHCI-capable -chips even if they are configured for legacy IDE emulation. Default is 1. +chips even if they are configured for legacy IDE emulation. +Default is 1. .El .Sh DESCRIPTION This driver provides the From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 19:14:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4F585106566B; Mon, 18 Jun 2012 19:14:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B0138FC17; Mon, 18 Jun 2012 19:14:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IJE7p0095885; Mon, 18 Jun 2012 19:14:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IJE7xR095883; Mon, 18 Jun 2012 19:14:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206181914.q5IJE7xR095883@svn.freebsd.org> From: Marius Strobl Date: Mon, 18 Jun 2012 19:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237235 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 19:14:07 -0000 Author: marius Date: Mon Jun 18 19:14:06 2012 New Revision: 237235 URL: http://svn.freebsd.org/changeset/base/237235 Log: Document the hw.ahci.force tunable here, too, as it's also used by ataahci(4) and atanvidia(4). MFC after: 3 days Modified: head/share/man/man4/ata.4 Modified: head/share/man/man4/ata.4 ============================================================================== --- head/share/man/man4/ata.4 Mon Jun 18 19:11:07 2012 (r237234) +++ head/share/man/man4/ata.4 Mon Jun 18 19:14:06 2012 (r237235) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 17, 2011 +.Dd June 18, 2012 .Dt ATA 4 .Os .Sh NAME @@ -89,8 +89,12 @@ subsystem module. The following tunables are settable from the .Xr loader 8 : .Bl -ohang +.It Va hw.ahci.force +set to nonzero value for forcing drivers to attach to some known AHCI-capable +chips even if they are configured for legacy IDE emulation (the default is 1, +force the attach). .It Va hw.ata.ata_dma_check_80pin -set to 0 to disable the 80pin cable check (the default is 1, check the cable) +set to 0 to disable the 80pin cable check (the default is 1, check the cable). .It Va hint.atapci.X.msi set to 1 to allow Message Signalled Interrupts (MSI) to be used by the specified PCI ATA controller, if supported. From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 19:18:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DDCCD106566C; Mon, 18 Jun 2012 19:18:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE7BA8FC20; Mon, 18 Jun 2012 19:18:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IJIVLc096104; Mon, 18 Jun 2012 19:18:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IJIVjp096101; Mon, 18 Jun 2012 19:18:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206181918.q5IJIVjp096101@svn.freebsd.org> From: Marius Strobl Date: Mon, 18 Jun 2012 19:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237236 - head/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 19:18:32 -0000 Author: marius Date: Mon Jun 18 19:18:31 2012 New Revision: 237236 URL: http://svn.freebsd.org/changeset/base/237236 Log: Refine r237102 a bit: - Anounce JTAG interfaces deliberately skipped. - Bring back empty lines too eagerly removed. MFC after: 3 days Modified: head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/uftdi_reg.h Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Mon Jun 18 19:14:06 2012 (r237235) +++ head/sys/dev/usb/serial/uftdi.c Mon Jun 18 19:18:31 2012 (r237236) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); */ /* - * FTDI FT8U100AX serial adapter driver + * FTDI FT2232x, FT8U100AX and FT8U232AM serial adapter driver */ #include @@ -278,9 +278,15 @@ uftdi_probe(device_t dev) */ id = usbd_lookup_id_by_info(uftdi_devs, sizeof(uftdi_devs), &uaa->info); - if (id == NULL || ((id->driver_info & UFTDI_FLAG_JTAG) != 0 && - uaa->info.bIfaceIndex == UFTDI_IFACE_INDEX_JTAG)) + if (id == NULL) return (ENXIO); + if ((id->driver_info & UFTDI_FLAG_JTAG) != 0 && + uaa->info.bIfaceIndex == UFTDI_IFACE_INDEX_JTAG) { + printf("%s: skipping JTAG interface at %u.%u\n", + device_get_name(dev), usbd_get_bus_index(uaa->device), + usbd_get_device_index(uaa->device)); + return (ENXIO); + } uaa->driver_info = id->driver_info; return (BUS_PROBE_SPECIFIC); } Modified: head/sys/dev/usb/serial/uftdi_reg.h ============================================================================== --- head/sys/dev/usb/serial/uftdi_reg.h Mon Jun 18 19:14:06 2012 (r237235) +++ head/sys/dev/usb/serial/uftdi_reg.h Mon Jun 18 19:18:31 2012 (r237236) @@ -70,6 +70,7 @@ #define FTDI_SIO_RESET_SIO 0 #define FTDI_SIO_RESET_PURGE_RX 1 #define FTDI_SIO_RESET_PURGE_TX 2 + /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_SET_BAUDRATE @@ -133,6 +134,7 @@ enum { #define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11) #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) #define FTDI_SIO_SET_BREAK (0x1 << 14) + /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_MODEM_CTRL @@ -168,6 +170,7 @@ enum { #define FTDI_SIO_SET_RTS_MASK 0x2 #define FTDI_SIO_SET_RTS_HIGH (2 | ( FTDI_SIO_SET_RTS_MASK << 8)) #define FTDI_SIO_SET_RTS_LOW (0 | ( FTDI_SIO_SET_RTS_MASK << 8)) + /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_FLOW_CTRL @@ -197,6 +200,7 @@ enum { #define FTDI_SIO_RTS_CTS_HS 0x1 #define FTDI_SIO_DTR_DSR_HS 0x2 #define FTDI_SIO_XON_XOFF_HS 0x4 + /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_EVENT_CHAR @@ -219,6 +223,7 @@ enum { * data read so far - rather than wait 40ms or until 62 bytes are read * which is what normally happens. */ + /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_ERROR_CHAR @@ -237,6 +242,7 @@ enum { * Set the parity error replacement character for the specified communications * port. */ + /* * BmRequestType: 1100 0000b * bRequest: FTDI_SIO_GET_MODEM_STATUS @@ -267,8 +273,8 @@ enum { #define FTDI_SIO_DSR_MASK 0x20 #define FTDI_SIO_RI_MASK 0x40 #define FTDI_SIO_RLSD_MASK 0x80 + /* - * * DATA FORMAT * * IN Endpoint From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 19:22:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11E1D1065672; Mon, 18 Jun 2012 19:22:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1C968FC16; Mon, 18 Jun 2012 19:22:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IJMA5h096301; Mon, 18 Jun 2012 19:22:10 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IJMA2o096299; Mon, 18 Jun 2012 19:22:10 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206181922.q5IJMA2o096299@svn.freebsd.org> From: Marius Strobl Date: Mon, 18 Jun 2012 19:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237237 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 19:22:11 -0000 Author: marius Date: Mon Jun 18 19:22:10 2012 New Revision: 237237 URL: http://svn.freebsd.org/changeset/base/237237 Log: Unbreak after r236658 by comparing the right things. Modified: head/sys/arm/at91/at91sam9260.c Modified: head/sys/arm/at91/at91sam9260.c ============================================================================== --- head/sys/arm/at91/at91sam9260.c Mon Jun 18 19:18:31 2012 (r237236) +++ head/sys/arm/at91/at91sam9260.c Mon Jun 18 19:22:10 2012 (r237237) @@ -197,7 +197,7 @@ static void at91_identify(driver_t *drv, device_t parent) { - if (soc_data.type == AT91_CPU_SAM9260) { + if (soc_data.type == AT91_T_SAM9260) { at91_add_child(parent, 0, "at91sam9260", 0, 0, 0, -1, 0, 0); at91_cpu_add_builtin_children(parent); } @@ -266,7 +266,7 @@ at91_attach(device_t dev) &sc->sc_matrix_sh) != 0) panic("Enable to map matrix registers"); - /* activate NAND*/ + /* activate NAND */ i = bus_space_read_4(sc->sc_st, sc->sc_matrix_sh, AT91SAM9260_EBICSA); bus_space_write_4(sc->sc_st, sc->sc_matrix_sh, From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 19:33:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D61F106564A; Mon, 18 Jun 2012 19:33:27 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id D47148FC19; Mon, 18 Jun 2012 19:33:26 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5IJXK5g099905; Mon, 18 Jun 2012 21:33:20 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5IJXKos099904; Mon, 18 Jun 2012 21:33:20 +0200 (CEST) (envelope-from marius) Date: Mon, 18 Jun 2012 21:33:19 +0200 From: Marius Strobl To: Warner Losh Message-ID: <20120618193319.GD69382@alchemy.franken.de> References: <201206150837.q5F8boYj055844@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206150837.q5F8boYj055844@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237130 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 19:33:27 -0000 On Fri, Jun 15, 2012 at 08:37:50AM +0000, Warner Losh wrote: > Author: imp > Date: Fri Jun 15 08:37:50 2012 > New Revision: 237130 > URL: http://svn.freebsd.org/changeset/base/237130 > > Log: > Make it possible to link together a sam and an rm kernel. The results > aren't very pretty yet, but this takes DELAY and cpu_reset and makes > them pointers. > > # I worry that these are set too late in the boot, especially cpu_reset. > Indeed, if we now panic before at91_rst(4) attaches, automatic reboot no longer works (seen with the bug in r236658 keeping at91sam9260(4) from probing) ... Marius From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 19:47:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C4E301065674; Mon, 18 Jun 2012 19:47:25 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFA958FC17; Mon, 18 Jun 2012 19:47:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IJlPYR097337; Mon, 18 Jun 2012 19:47:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IJlPKQ097335; Mon, 18 Jun 2012 19:47:25 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206181947.q5IJlPKQ097335@svn.freebsd.org> From: Marius Strobl Date: Mon, 18 Jun 2012 19:47:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237238 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 19:47:25 -0000 Author: marius Date: Mon Jun 18 19:47:25 2012 New Revision: 237238 URL: http://svn.freebsd.org/changeset/base/237238 Log: Try to bring this file closer to style(9). Modified: head/sys/arm/at91/at91_machdep.c Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Mon Jun 18 19:22:10 2012 (r237237) +++ head/sys/arm/at91/at91_machdep.c Mon Jun 18 19:47:25 2012 (r237238) @@ -92,10 +92,12 @@ __FBSDID("$FreeBSD$"); #include #include -#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ +/* Page table for mapping proc0 zero page */ +#define KERNEL_PT_SYS 0 #define KERNEL_PT_KERN 1 #define KERNEL_PT_KERN_NUM 22 -#define KERNEL_PT_AFKERNEL KERNEL_PT_KERN + KERNEL_PT_KERN_NUM /* L2 table for mapping after kernel */ +/* L2 table for mapping after kernel */ +#define KERNEL_PT_AFKERNEL KERNEL_PT_KERN + KERNEL_PT_KERN_NUM #define KERNEL_PT_AFKERNEL_NUM 5 /* this should be evenly divisable by PAGE_SIZE / L2_TABLE_SIZE_REAL (or 4) */ @@ -150,7 +152,8 @@ const struct pmap_devmap at91_devmap[] = VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* We can't just map the OHCI registers VA == PA, because + /* + * We can't just map the OHCI registers VA == PA, because * AT91xx_xxx_BASE belongs to the userland address space. * We could just choose a different virtual address, but a better * solution would probably be to just use pmap_mapdev() to allocate @@ -180,8 +183,10 @@ const struct pmap_devmap at91_devmap[] = VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* The next two should be good for the 9260, 9261 and 9G20 since - * addresses mapping is the same. */ + /* + * The next two should be good for the 9260, 9261 and 9G20 since + * addresses mapping is the same. + */ { /* Internal Memory 1MB */ AT91SAM9G20_OHCI_BASE, @@ -210,16 +215,18 @@ extern int memsize[]; long at91_ramsize(void) { - uint32_t cr, mr; + uint32_t cr, mr, *SDRAMC; int banks, rows, cols, bw; #ifdef LINUX_BOOT_ABI - // If we found any ATAGs that were for memory, return the first bank. + /* + * If we found any ATAGs that were for memory, return the first bank. + */ if (membanks > 0) - return memsize[0]; + return (memsize[0]); #endif if (at91_is_rm92()) { - uint32_t *SDRAMC = (uint32_t *)(AT91_BASE + AT91RM92_SDRAMC_BASE); + SDRAMC = (uint32_t *)(AT91_BASE + AT91RM92_SDRAMC_BASE); cr = SDRAMC[AT91RM92_SDRAMC_CR / 4]; mr = SDRAMC[AT91RM92_SDRAMC_MR / 4]; banks = (cr & AT91RM92_SDRAMC_CR_NB_4) ? 2 : 1; @@ -227,9 +234,11 @@ at91_ramsize(void) cols = (cr & AT91RM92_SDRAMC_CR_NC_MASK) + 8; bw = (mr & AT91RM92_SDRAMC_MR_DBW_16) ? 1 : 2; } else { - /* This should be good for the 9260, 9261, 9G20, 9G35 and 9X25 as addresses - * and registers are the same */ - uint32_t *SDRAMC = (uint32_t *)(AT91_BASE + AT91SAM9G20_SDRAMC_BASE); + /* + * This should be good for the 9260, 9261, 9G20, 9G35 and 9X25 + * as addresses and registers are the same. + */ + SDRAMC = (uint32_t *)(AT91_BASE + AT91SAM9G20_SDRAMC_BASE); cr = SDRAMC[AT91SAM9G20_SDRAMC_CR / 4]; mr = SDRAMC[AT91SAM9G20_SDRAMC_MR / 4]; banks = (cr & AT91SAM9G20_SDRAMC_CR_NB_4) ? 2 : 1; @@ -241,7 +250,7 @@ at91_ramsize(void) return (1 << (cols + rows + banks + bw)); } -const char *soc_type_name[] = { +static const char *soc_type_name[] = { [AT91_T_CAP9] = "at91cap9", [AT91_T_RM9200] = "at91rm9200", [AT91_T_SAM9260] = "at91sam9260", @@ -255,8 +264,8 @@ const char *soc_type_name[] = { [AT91_T_SAM9X5] = "at91sam9x5", [AT91_T_NONE] = "UNKNOWN" }; - -const char *soc_subtype_name[] = { + +static const char *soc_subtype_name[] = { [AT91_ST_NONE] = "UNKNOWN", [AT91_ST_RM9200_BGA] = "at91rm9200_bga", [AT91_ST_RM9200_PQFP] = "at91rm9200_pqfp", @@ -288,13 +297,15 @@ at91_try_id(uint32_t dbgu_base) { uint32_t socid; - soc_data.cidr = *(volatile uint32_t *)(AT91_BASE + dbgu_base + DBGU_C1R); + soc_data.cidr = *(volatile uint32_t *)(AT91_BASE + dbgu_base + + DBGU_C1R); socid = soc_data.cidr & ~AT91_CPU_VERSION_MASK; soc_data.type = AT91_T_NONE; soc_data.subtype = AT91_ST_NONE; soc_data.family = (soc_data.cidr & AT91_CPU_FAMILY_MASK) >> 20; - soc_data.exid = *(volatile uint32_t *)(AT91_BASE + dbgu_base + DBGU_C2R); + soc_data.exid = *(volatile uint32_t *)(AT91_BASE + dbgu_base + + DBGU_C2R); switch (socid) { case AT91_CPU_CAP9: @@ -336,7 +347,7 @@ at91_try_id(uint32_t dbgu_base) soc_data.type = AT91_T_SAM9X5; break; default: - return 0; + return (0); } switch (soc_data.type) { @@ -378,15 +389,18 @@ at91_try_id(uint32_t dbgu_base) default: break; } - snprintf(soc_data.name, sizeof(soc_data.name), "%s%s%s", soc_type_name[soc_data.type], + snprintf(soc_data.name, sizeof(soc_data.name), "%s%s%s", + soc_type_name[soc_data.type], soc_data.subtype == AT91_ST_NONE ? "" : " subtype ", - soc_data.subtype == AT91_ST_NONE ? "" : soc_subtype_name[soc_data.subtype]); - return 1; + soc_data.subtype == AT91_ST_NONE ? "" : + soc_subtype_name[soc_data.subtype]); + return (1); } static void at91_soc_id(void) { + if (!at91_try_id(AT91_DBGU0)) at91_try_id(AT91_DBGU1); } @@ -413,13 +427,13 @@ initarm(struct arm_boot_params *abp) freemempos = (lastaddr + PAGE_MASK) & ~PAGE_MASK; /* Define a macro to simplify memory allocation */ -#define valloc_pages(var, np) \ - alloc_pages((var).pv_va, (np)); \ +#define valloc_pages(var, np) \ + alloc_pages((var).pv_va, (np)); \ (var).pv_pa = (var).pv_va + (KERNPHYSADDR - KERNVIRTADDR); -#define alloc_pages(var, np) \ - (var) = freemempos; \ - freemempos += (np * PAGE_SIZE); \ +#define alloc_pages(var, np) \ + (var) = freemempos; \ + freemempos += (np * PAGE_SIZE); \ memset((char *)(var), 0, ((np) * PAGE_SIZE)); while (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) != 0) @@ -608,6 +622,7 @@ cpu_initclocks(void) void DELAY(int n) { + if (soc_data.delay) soc_data.delay(n); } @@ -615,6 +630,7 @@ DELAY(int n) void cpu_reset(void) { + if (soc_data.reset) soc_data.reset(); while (1) From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 20:14:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30D6F106567A; Mon, 18 Jun 2012 20:14:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1292C8FC1D; Mon, 18 Jun 2012 20:14:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IKEgI2098517; Mon, 18 Jun 2012 20:14:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IKEgpt098515; Mon, 18 Jun 2012 20:14:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206182014.q5IKEgpt098515@svn.freebsd.org> From: Marius Strobl Date: Mon, 18 Jun 2012 20:14:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237239 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 20:14:43 -0000 Author: marius Date: Mon Jun 18 20:14:42 2012 New Revision: 237239 URL: http://svn.freebsd.org/changeset/base/237239 Log: Revert the part of r236495 that introduced checking of SPI_SR_TXEMPTY for TX transfer completion as for reasons unknown this occasionally causes SPI_SR_RXBUFF and SPI_SR_ENDRX to not rise. In any case, once the RX part of the transfer is done it's obvious that the preceding TX part had finished and checking of SPI_SR_TXEMPTY was introduced to rule out a possible cause for the data corruption mentioned in r236495 but which didn't turn out to be the problem anyway. MFC after: 3 days Modified: head/sys/arm/at91/at91_spi.c Modified: head/sys/arm/at91/at91_spi.c ============================================================================== --- head/sys/arm/at91/at91_spi.c Mon Jun 18 19:47:25 2012 (r237238) +++ head/sys/arm/at91/at91_spi.c Mon Jun 18 20:14:42 2012 (r237239) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -59,7 +58,6 @@ struct at91_spi_softc bus_dma_tag_t dmatag; /* bus dma tag for transfers */ bus_dmamap_t map[4]; /* Maps for the transaction */ struct sx xfer_mtx; /* Enforce one transfer at a time */ - uint32_t xfer_mask; /* Bits to wait on for completion */ uint32_t xfer_done; /* interrupt<->mainthread signaling */ }; @@ -124,7 +122,6 @@ at91_spi_attach(device_t dev) * Set up the hardware. */ - sc->xfer_mask = SPI_SR_RXBUFF | (at91_is_rm92() ? 0 : SPI_SR_TXEMPTY); WR4(sc, SPI_CR, SPI_CR_SWRST); /* "Software Reset must be Written Twice" erratum */ WR4(sc, SPI_CR, SPI_CR_SWRST); @@ -272,7 +269,6 @@ at91_spi_transfer(device_t dev, device_t struct at91_spi_softc *sc; bus_addr_t addr; int err, i, j, mode[4]; - uint32_t mask; KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, ("%s: TX/RX command sizes should be equal", __func__)); @@ -356,12 +352,11 @@ at91_spi_transfer(device_t dev, device_t * Start the transfer, wait for it to complete. */ sc->xfer_done = 0; - mask = sc->xfer_mask; - WR4(sc, SPI_IER, mask); + WR4(sc, SPI_IER, SPI_SR_RXBUFF); WR4(sc, PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); do err = tsleep(&sc->xfer_done, PCATCH | PZERO, "at91_spi", hz); - while (sc->xfer_done != mask && err != EINTR); + while (sc->xfer_done == 0 && err != EINTR); /* * Stop the transfer and clean things up. @@ -383,20 +378,19 @@ static void at91_spi_intr(void *arg) { struct at91_spi_softc *sc; - uint32_t mask, sr; + uint32_t sr; sc = (struct at91_spi_softc*)arg; - mask = sc->xfer_mask; sr = RD4(sc, SPI_SR) & RD4(sc, SPI_IMR); - if ((sr & mask) != 0) { - sc->xfer_done |= sr & mask; - WR4(sc, SPI_IDR, mask); + if ((sr & SPI_SR_RXBUFF) != 0) { + sc->xfer_done = 1; + WR4(sc, SPI_IDR, SPI_SR_RXBUFF); wakeup(&sc->xfer_done); } - if ((sr & ~mask) != 0) { + if ((sr & ~SPI_SR_RXBUFF) != 0) { device_printf(sc->dev, "Unexpected ISR %#x\n", sr); - WR4(sc, SPI_IDR, sr & ~mask); + WR4(sc, SPI_IDR, sr & ~SPI_SR_RXBUFF); } } From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 20:19:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04440106564A; Mon, 18 Jun 2012 20:19:08 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3FE18FC17; Mon, 18 Jun 2012 20:19:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IKJ7qB098729; Mon, 18 Jun 2012 20:19:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IKJ7LL098727; Mon, 18 Jun 2012 20:19:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206182019.q5IKJ7LL098727@svn.freebsd.org> From: Marius Strobl Date: Mon, 18 Jun 2012 20:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237240 - head/sys/dev/flash X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 20:19:08 -0000 Author: marius Date: Mon Jun 18 20:19:07 2012 New Revision: 237240 URL: http://svn.freebsd.org/changeset/base/237240 Log: Revert r236529, re-enabling verification of the flashed content as the underlying problem was dealt with in r237239 (in fact, disabling verification also actually only made the problem less likely to occur). Modified: head/sys/dev/flash/at45d.c Modified: head/sys/dev/flash/at45d.c ============================================================================== --- head/sys/dev/flash/at45d.c Mon Jun 18 20:14:42 2012 (r237239) +++ head/sys/dev/flash/at45d.c Mon Jun 18 20:19:07 2012 (r237240) @@ -390,7 +390,6 @@ at45d_task(void *arg) berr = EIO; goto out; } -#ifdef notyet /* May cause physwr to hang for reasons unknown. */ if (bp->bio_cmd == BIO_WRITE) { addr = page << sc->pageoffset; txBuf[0] = BUFFER_COMPARE; @@ -409,7 +408,6 @@ at45d_task(void *arg) goto out; } } -#endif page++; buf += len; offset = 0; From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 20:29:42 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BF33F1065673; Mon, 18 Jun 2012 20:29:42 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 780128FC15; Mon, 18 Jun 2012 20:29:42 +0000 (UTC) Received: from [10.0.0.63] (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id q5IKRBtS030445 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 18 Jun 2012 14:27:13 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20120618193319.GD69382@alchemy.franken.de> Date: Mon, 18 Jun 2012 14:27:11 -0600 Content-Transfer-Encoding: 7bit Message-Id: <579203DE-5FA1-4235-BE71-EBB4BC0CCD3C@bsdimp.com> References: <201206150837.q5F8boYj055844@svn.freebsd.org> <20120618193319.GD69382@alchemy.franken.de> To: Marius Strobl X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Mon, 18 Jun 2012 14:27:13 -0600 (MDT) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Warner Losh Subject: Re: svn commit: r237130 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 20:29:42 -0000 On Jun 18, 2012, at 1:33 PM, Marius Strobl wrote: > On Fri, Jun 15, 2012 at 08:37:50AM +0000, Warner Losh wrote: >> Author: imp >> Date: Fri Jun 15 08:37:50 2012 >> New Revision: 237130 >> URL: http://svn.freebsd.org/changeset/base/237130 >> >> Log: >> Make it possible to link together a sam and an rm kernel. The results >> aren't very pretty yet, but this takes DELAY and cpu_reset and makes >> them pointers. >> >> # I worry that these are set too late in the boot, especially cpu_reset. >> > > Indeed, if we now panic before at91_rst(4) attaches, automatic reboot no > longer works (seen with the bug in r236658 keeping at91sam9260(4) from > probing) ... makes sense. I plan to fix the reboot issue. Whats' the bug in r234458? warner From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 20:48:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6F2DA106566C; Mon, 18 Jun 2012 20:48:22 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40A948FC17; Mon, 18 Jun 2012 20:48:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IKmMqZ099957; Mon, 18 Jun 2012 20:48:22 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IKmMlr099955; Mon, 18 Jun 2012 20:48:22 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <201206182048.q5IKmMlr099955@svn.freebsd.org> From: "Simon L. Nielsen" Date: Mon, 18 Jun 2012 20:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237241 - releng/8.1/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 20:48:22 -0000 Author: simon Date: Mon Jun 18 20:48:21 2012 New Revision: 237241 URL: http://svn.freebsd.org/changeset/base/237241 Log: Correct the patch for FreeBSD-SA-12:04.sysret for releng/8.1 where it was accidently applied to the wrong location. Reported by: Steven Chamberlain Reviewed by: jhb, kib Security: FreeBSD-SA-12:04.sysret Approved by: so (simon) Modified: releng/8.1/sys/amd64/amd64/trap.c Modified: releng/8.1/sys/amd64/amd64/trap.c ============================================================================== --- releng/8.1/sys/amd64/amd64/trap.c Mon Jun 18 20:19:07 2012 (r237240) +++ releng/8.1/sys/amd64/amd64/trap.c Mon Jun 18 20:48:21 2012 (r237241) @@ -972,23 +972,6 @@ syscall(struct trapframe *frame) ksi.ksi_code = TRAP_TRACE; ksi.ksi_addr = (void *)frame->tf_rip; trapsignal(td, &ksi); - - /* - * If the user-supplied value of %rip is not a canonical - * address, then some CPUs will trigger a ring 0 #GP during - * the sysret instruction. However, the fault handler would - * execute with the user's %gs and %rsp in ring 0 which would - * not be safe. Instead, preemptively kill the thread with a - * SIGBUS. - */ - if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { - ksiginfo_init_trap(&ksi); - ksi.ksi_signo = SIGBUS; - ksi.ksi_code = BUS_OBJERR; - ksi.ksi_trapno = T_PROTFLT; - ksi.ksi_addr = (void *)td->td_frame->tf_rip; - trapsignal(td, &ksi); - } } /* @@ -1027,4 +1010,21 @@ syscall(struct trapframe *frame) STOPEVENT(p, S_SCX, sa.code); PTRACESTOP_SC(p, td, S_PT_SCX); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 21:00:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B4061065672; Mon, 18 Jun 2012 21:00:55 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA4CD8FC12; Mon, 18 Jun 2012 21:00:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IL0sOZ000622; Mon, 18 Jun 2012 21:00:54 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IL0suU000619; Mon, 18 Jun 2012 21:00:54 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <201206182100.q5IL0suU000619@svn.freebsd.org> From: "Simon L. Nielsen" Date: Mon, 18 Jun 2012 21:00:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237242 - in releng/8.1: . sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 21:00:55 -0000 Author: simon Date: Mon Jun 18 21:00:54 2012 New Revision: 237242 URL: http://svn.freebsd.org/changeset/base/237242 Log: Add UPDATING and newvers.sh information for the FreeBSD-SA-12:04.sysret correction. Approved by: so (simon) Modified: releng/8.1/UPDATING releng/8.1/sys/conf/newvers.sh Modified: releng/8.1/UPDATING ============================================================================== --- releng/8.1/UPDATING Mon Jun 18 20:48:21 2012 (r237241) +++ releng/8.1/UPDATING Mon Jun 18 21:00:54 2012 (r237242) @@ -15,6 +15,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. + +20120618: p12 FreeBSD-SA-12:04.sysret + Correct patch for FreeBSD-SA-12:04.sysret. + 20120612: p11 FreeBSD-SA-12:03.bind FreeBSD-SA-12:04.sysret FreeBSD-EN-12:02.ipv6refcount Modified: releng/8.1/sys/conf/newvers.sh ============================================================================== --- releng/8.1/sys/conf/newvers.sh Mon Jun 18 20:48:21 2012 (r237241) +++ releng/8.1/sys/conf/newvers.sh Mon Jun 18 21:00:54 2012 (r237242) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.1" -BRANCH="RELEASE-p11" +BRANCH="RELEASE-p12" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 21:08:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A15C61065670; Mon, 18 Jun 2012 21:08:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89DE08FC20; Mon, 18 Jun 2012 21:08:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IL8mVa001011; Mon, 18 Jun 2012 21:08:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IL8mWK001009; Mon, 18 Jun 2012 21:08:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206182108.q5IL8mWK001009@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 18 Jun 2012 21:08:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237243 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 21:08:48 -0000 Author: kib Date: Mon Jun 18 21:08:48 2012 New Revision: 237243 URL: http://svn.freebsd.org/changeset/base/237243 Log: Adjust the fix in r236953, by not generating the signal manually, but performing the return to usermode using full return path. This consolidates the handling of exceptional situations in less number of places, and is less code as well. Reviewed by: jhb MFC after: 1 week Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Jun 18 21:00:54 2012 (r237242) +++ head/sys/amd64/amd64/trap.c Mon Jun 18 21:08:48 2012 (r237243) @@ -977,16 +977,10 @@ amd64_syscall(struct thread *td, int tra * If the user-supplied value of %rip is not a canonical * address, then some CPUs will trigger a ring 0 #GP during * the sysret instruction. However, the fault handler would - * execute with the user's %gs and %rsp in ring 0 which would - * not be safe. Instead, preemptively kill the thread with a - * SIGBUS. + * execute in ring 0 with the user's %gs and %rsp which would + * not be safe. Instead, use the full return path which + * catches the problem safely. */ - if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { - ksiginfo_init_trap(&ksi); - ksi.ksi_signo = SIGBUS; - ksi.ksi_code = BUS_OBJERR; - ksi.ksi_trapno = T_PROTFLT; - ksi.ksi_addr = (void *)td->td_frame->tf_rip; - trapsignal(td, &ksi); - } + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) + set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 21:10:12 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BF357106566B; Mon, 18 Jun 2012 21:10:12 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 436D98FC12; Mon, 18 Jun 2012 21:10:12 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5ILA7fa000309; Mon, 18 Jun 2012 23:10:07 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5ILA7oS000308; Mon, 18 Jun 2012 23:10:07 +0200 (CEST) (envelope-from marius) Date: Mon, 18 Jun 2012 23:10:07 +0200 From: Marius Strobl To: Warner Losh Message-ID: <20120618211007.GV46065@alchemy.franken.de> References: <201206150837.q5F8boYj055844@svn.freebsd.org> <20120618193319.GD69382@alchemy.franken.de> <579203DE-5FA1-4235-BE71-EBB4BC0CCD3C@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <579203DE-5FA1-4235-BE71-EBB4BC0CCD3C@bsdimp.com> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Warner Losh Subject: Re: svn commit: r237130 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 21:10:13 -0000 On Mon, Jun 18, 2012 at 02:27:11PM -0600, Warner Losh wrote: > > On Jun 18, 2012, at 1:33 PM, Marius Strobl wrote: > > > On Fri, Jun 15, 2012 at 08:37:50AM +0000, Warner Losh wrote: > >> Author: imp > >> Date: Fri Jun 15 08:37:50 2012 > >> New Revision: 237130 > >> URL: http://svn.freebsd.org/changeset/base/237130 > >> > >> Log: > >> Make it possible to link together a sam and an rm kernel. The results > >> aren't very pretty yet, but this takes DELAY and cpu_reset and makes > >> them pointers. > >> > >> # I worry that these are set too late in the boot, especially cpu_reset. > >> > > > > Indeed, if we now panic before at91_rst(4) attaches, automatic reboot no > > longer works (seen with the bug in r236658 keeping at91sam9260(4) from > > probing) ... > > > makes sense. I plan to fix the reboot issue. > > Whats' the bug in r234458? > See r237237 Marius From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 22:17:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BBB7C1065675; Mon, 18 Jun 2012 22:17:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DE038FC0A; Mon, 18 Jun 2012 22:17:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5IMHTaj003930; Mon, 18 Jun 2012 22:17:29 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5IMHTJE003928; Mon, 18 Jun 2012 22:17:29 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201206182217.q5IMHTJE003928@svn.freebsd.org> From: Rick Macklem Date: Mon, 18 Jun 2012 22:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237244 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 22:17:29 -0000 Author: rmacklem Date: Mon Jun 18 22:17:28 2012 New Revision: 237244 URL: http://svn.freebsd.org/changeset/base/237244 Log: Fix the NFSv4 client for the case where mmap'd files are written, but not msync'd by a process. A VOP_PUTPAGES() called when VOP_RECLAIM() happens will usually fail, since the NFSv4 Open has already been closed by VOP_INACTIVE(). Add a vm_object_page_clean() call to the NFSv4 client's VOP_INACTIVE(), so that the write happens before the NFSv4 Open is closed. kib@ suggested using vgone() instead and I will explore this, but this patch fixes things in the meantime. For some reason, the VOP_PUTPAGES() is still attaempted in VOP_RECLAIM(), but having this fail doesn't cause any problems except a "stateid0 in write" being logged. Reviewed by: kib MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clnode.c Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Mon Jun 18 21:08:48 2012 (r237243) +++ head/sys/fs/nfsclient/nfs_clnode.c Mon Jun 18 22:17:28 2012 (r237244) @@ -210,18 +210,28 @@ ncl_inactive(struct vop_inactive_args *a struct nfsnode *np; struct sillyrename *sp; struct vnode *vp = ap->a_vp; + boolean_t retv; np = VTONFS(vp); if (NFS_ISV4(vp) && vp->v_type == VREG) { /* * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4 - * Close operations are delayed until now. Any dirty buffers - * must be flushed before the close, so that the stateid is - * available for the writes. + * Close operations are delayed until now. Any dirty + * buffers/pages must be flushed before the close, so that the + * stateid is available for the writes. */ - (void) ncl_flush(vp, MNT_WAIT, NULL, ap->a_td, 1, 0); - (void) nfsrpc_close(vp, 1, ap->a_td); + if (vp->v_object != NULL) { + VM_OBJECT_LOCK(vp->v_object); + retv = vm_object_page_clean(vp->v_object, 0, 0, + OBJPC_SYNC); + VM_OBJECT_UNLOCK(vp->v_object); + } else + retv = TRUE; + if (retv == TRUE) { + (void)ncl_flush(vp, MNT_WAIT, NULL, ap->a_td, 1, 0); + (void)nfsrpc_close(vp, 1, ap->a_td); + } } mtx_lock(&np->n_mtx); From owner-svn-src-all@FreeBSD.ORG Mon Jun 18 23:18:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2AFC5106566B; Mon, 18 Jun 2012 23:18:50 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 159998FC12; Mon, 18 Jun 2012 23:18:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5INInmc007442; Mon, 18 Jun 2012 23:18:49 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5INInJg007439; Mon, 18 Jun 2012 23:18:49 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201206182318.q5INInJg007439@svn.freebsd.org> From: Sean Bruno Date: Mon, 18 Jun 2012 23:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237245 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 23:18:50 -0000 Author: sbruno Date: Mon Jun 18 23:18:49 2012 New Revision: 237245 URL: http://svn.freebsd.org/changeset/base/237245 Log: Document support for Intel Enhanced Speedstep Tech interface of cpufreq(4) via a new man page est(4) Document the two exposed tuneables of est(4). I'd appreciate more reviews of content if possible. I gleaned the information contained herein from sys/x86/cpufreq/est.c and the Intel reference documentation Reviewed by: wblock hrs gjb MFC after: 2 weeks Added: head/share/man/man4/est.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Jun 18 22:17:28 2012 (r237244) +++ head/share/man/man4/Makefile Mon Jun 18 23:18:49 2012 (r237245) @@ -116,6 +116,7 @@ MAN= aac.4 \ enc.4 \ epair.4 \ esp.4 \ + est.4 \ et.4 \ eventtimers.4 \ exca.4 \ Added: head/share/man/man4/est.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/est.4 Mon Jun 18 23:18:49 2012 (r237245) @@ -0,0 +1,100 @@ +.\" +.\" Copyright (c) 2012 Sean Bruno +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd June 12, 2012 +.Dt EST 4 +.Os +.Sh NAME +.Nm est +.Nd Enhanced Speedstep Technology +.Sh SYNOPSIS +To compile this capability into your kernel +place the following line in your kernel +configuration file: +.Bd -ragged -offset indent +.Cd "device cpufreq" +.Ed +.Sh DESCRIPTION +The +.Nm +interface provides support for the Intel Enhanced Speedstep Technology. +.Pp +Note that +.Nm +capabilities are automatically loaded by the +.Xr cpufreq 4 +driver. +.Sh LOADER TUNABLES +The +.Nm +interface is intended to allow +.Xr cpufreq 4 +to access and implement Intel Enhanced SpeedStep Technology via +.Xr acpi 4 +and the acpi_perf interface accessors. +If the default settings are not optimal, the following sysctls can be +used to modify or monitor +.Nm +behavior. +.Bl -tag -width indent +.It hw.est.msr_info +Attempt to infer information from direct probing of the msr. +Should only be used in diagnostic cases +.Pq default 0 +.It hw.est.strict +Do not allow different cpus to be set to different frequencies. +It appears that this will only work on i386 systems +.Pq default 0 +.El +.Sh DIAGNOSTICS +.Bl -diag +.It "est%d: on cpu%d" +.Pp +Indicates normal startup of this interface. +.It "est: CPU supports Enhanced Speedstep, but is not recognized." +.It "est: cpu_vendor GenuineIntel, msr 471c471c0600471c" +.It "device_attach: est%d attach returned 6" +.Pp +Indicates all attempts to attach to this interface have failed. +This usually indicates an improper BIOS setting restricting O/S +control of the CPU speeds. +Consult your BIOS documentation for more details. +.El +.Sh COMPATIBILITY +.Nm +is only found on supported Intel CPUs. +.Sh SEE ALSO +.Xr cpufreq 4 +.Sh SUPPORT +For general information and support, +go to the Intel 64 and IA-32 Architectures Software Developer +Manuals site. +.Pa http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html +.Sh AUTHORS +.Pp +This manual page was written by +.An Sean Bruno Aq sbruno@FreeBSD.org . From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 02:17:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46C8A106564A; Tue, 19 Jun 2012 02:17:50 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id A52E28FC15; Tue, 19 Jun 2012 02:17:48 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.55]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id q5J1sRUg000878 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 19 Jun 2012 11:24:33 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <20120618093435.GA1017@gpr.nnz-home.ru> Date: Tue, 19 Jun 2012 11:24:27 +0930 Content-Transfer-Encoding: quoted-printable Message-Id: <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au> References: <201206180754.q5I7sBoQ063448@svn.freebsd.org> <20120618093435.GA1017@gpr.nnz-home.ru> To: Gennady Proskurin X-Mailer: Apple Mail (2.1278) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Poul-Henning Kamp Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 02:17:50 -0000 On 18/06/2012, at 19:04, Gennady Proskurin wrote: >> Modified: head/sys/dev/fb/fbreg.h >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/dev/fb/fbreg.h Mon Jun 18 07:43:23 2012 = (r237222) >> +++ head/sys/dev/fb/fbreg.h Mon Jun 18 07:54:10 2012 = (r237223) >> @@ -39,6 +39,7 @@ >> static __inline void >> copyw(uint16_t *src, uint16_t *dst, size_t size) >> { >> + size >>=3D 1; >> while (size--) >> *dst++ =3D *src++; >> } >=20 > If size is odd, this does not copy the last byte. Not sure, whether = this is intended. Add KASSERT(size & 0x1 =3D=3D 0, ("odd size copy")); before size >>=3D 1; :) -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 02:54:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 432B8106566C; Tue, 19 Jun 2012 02:54:55 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24F828FC0A; Tue, 19 Jun 2012 02:54:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J2stj5016228; Tue, 19 Jun 2012 02:54:55 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J2ssLp016195; Tue, 19 Jun 2012 02:54:54 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206190254.q5J2ssLp016195@svn.freebsd.org> From: Warren Block Date: Tue, 19 Jun 2012 02:54:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237247 - in stable/9: lib/libpam/modules/pam_exec sbin/atacontrol sbin/geom/class/part sbin/geom/class/raid sbin/geom/class/virstor sbin/gvinum sbin/hastctl sbin/hastd sbin/mount sbin/... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 02:54:55 -0000 Author: wblock (doc committer) Date: Tue Jun 19 02:54:54 2012 New Revision: 237247 URL: http://svn.freebsd.org/changeset/base/237247 Log: MFC r235873, r235967: Fixes to man8 groff mandoc style, usage mistakes, or typos. PR: 168016 Submitted by: Nobuyuki Koganemaru Approved by: gjb (mentor) Modified: stable/9/lib/libpam/modules/pam_exec/pam_exec.8 stable/9/sbin/atacontrol/atacontrol.8 stable/9/sbin/geom/class/part/gpart.8 stable/9/sbin/geom/class/raid/graid.8 stable/9/sbin/geom/class/virstor/gvirstor.8 stable/9/sbin/gvinum/gvinum.8 stable/9/sbin/hastctl/hastctl.8 stable/9/sbin/hastd/hastd.8 stable/9/sbin/mount/mount.8 stable/9/sbin/natd/natd.8 stable/9/share/man/man8/picobsd.8 stable/9/share/man/man8/rc.8 stable/9/sys/boot/common/loader.8 stable/9/sys/boot/forth/beastie.4th.8 stable/9/sys/boot/forth/brand.4th.8 stable/9/sys/boot/forth/check-password.4th.8 stable/9/sys/boot/forth/color.4th.8 stable/9/sys/boot/forth/delay.4th.8 stable/9/sys/boot/forth/menu.4th.8 stable/9/sys/boot/forth/version.4th.8 stable/9/usr.bin/ctlstat/ctlstat.8 stable/9/usr.sbin/cpucontrol/cpucontrol.8 stable/9/usr.sbin/ctladm/ctladm.8 stable/9/usr.sbin/flowctl/flowctl.8 stable/9/usr.sbin/freebsd-update/freebsd-update.8 stable/9/usr.sbin/i2c/i2c.8 stable/9/usr.sbin/jail/jail.8 stable/9/usr.sbin/rtadvctl/rtadvctl.8 stable/9/usr.sbin/rtadvd/rtadvd.8 stable/9/usr.sbin/smbmsg/smbmsg.8 stable/9/usr.sbin/utxrm/utxrm.8 stable/9/usr.sbin/wpa/ndis_events/ndis_events.8 Directory Properties: stable/9/lib/libpam/ (props changed) stable/9/sbin/atacontrol/ (props changed) stable/9/sbin/geom/class/part/ (props changed) stable/9/sbin/geom/class/raid/ (props changed) stable/9/sbin/geom/class/virstor/ (props changed) stable/9/sbin/gvinum/ (props changed) stable/9/sbin/hastctl/ (props changed) stable/9/sbin/hastd/ (props changed) stable/9/sbin/mount/ (props changed) stable/9/sbin/natd/ (props changed) stable/9/share/man/man8/ (props changed) stable/9/sys/boot/ (props changed) stable/9/usr.bin/ctlstat/ (props changed) stable/9/usr.sbin/cpucontrol/ (props changed) stable/9/usr.sbin/ctladm/ (props changed) stable/9/usr.sbin/flowctl/ (props changed) stable/9/usr.sbin/freebsd-update/ (props changed) stable/9/usr.sbin/i2c/ (props changed) stable/9/usr.sbin/jail/ (props changed) stable/9/usr.sbin/rtadvctl/ (props changed) stable/9/usr.sbin/rtadvd/ (props changed) stable/9/usr.sbin/smbmsg/ (props changed) stable/9/usr.sbin/utxrm/ (props changed) stable/9/usr.sbin/wpa/ (props changed) Modified: stable/9/lib/libpam/modules/pam_exec/pam_exec.8 ============================================================================== --- stable/9/lib/libpam/modules/pam_exec/pam_exec.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/lib/libpam/modules/pam_exec/pam_exec.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -131,10 +131,10 @@ This is useful in shell scripts for inst .Xr pam 8 , .Xr pam_sm_acct_mgmt 8 , .Xr pam_sm_authenticate 8 , -.Xr pam_sm_chauthtok 8, +.Xr pam_sm_chauthtok 8 , .Xr pam_sm_close_session 8 , .Xr pam_sm_open_session 8 , -.Xr pam_sm_setcred 8 . +.Xr pam_sm_setcred 8 .Sh AUTHORS The .Nm Modified: stable/9/sbin/atacontrol/atacontrol.8 ============================================================================== --- stable/9/sbin/atacontrol/atacontrol.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/atacontrol/atacontrol.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -367,8 +367,8 @@ You should not set a spindown timeout on or syslog logging on it as the disk will be worn out spinning down and up all the time. .Sh SEE ALSO -.Xr ata 4 -.Xr cam 4 +.Xr ata 4 , +.Xr cam 4 , .Xr camcontrol 8 .Sh HISTORY The Modified: stable/9/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/9/sbin/geom/class/part/gpart.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/geom/class/part/gpart.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -650,7 +650,7 @@ for MBR, for GPT. .It Cm ms-ldm-metadata A partition that contains Logical Disk Manager (LDM) database. -The scheme-specifig type is +The scheme-specific type is .Qq Li "!5808c8aa-7e8f-42e0-85d2-e1e90434cfb3" for GPT. .El @@ -971,7 +971,7 @@ By default mirrored volumes are shown as .Sx "PARTITION TYPES" section). If this variable set to 1 each component of the mirrored volume will be -present as independet partition. +present as independent partition. .Em NOTE : This may break a mirrored volume and lead to data damage. .El Modified: stable/9/sbin/geom/class/raid/graid.8 ============================================================================== --- stable/9/sbin/geom/class/raid/graid.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/geom/class/raid/graid.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -294,7 +294,7 @@ Debug level of the .Nm RAID GEOM class. .It Va kern.geom.raid.idle_threshold : No 1000000 -Time in microseconds to consider a volume idle for rebuild puroses. +Time in microseconds to consider a volume idle for rebuild purposes. .It Va kern.geom.raid.name_format : No 0 Providers name format: 0 -- raid/r{num}, 1 -- raid/{label}. .It Va kern.geom.raid.read_err_thresh : No 10 Modified: stable/9/sbin/geom/class/virstor/gvirstor.8 ============================================================================== --- stable/9/sbin/geom/class/virstor/gvirstor.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/geom/class/virstor/gvirstor.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -113,7 +113,7 @@ Adds new components to existing virtual The specified virstor device must exist and be active .Pq i.e. module loaded, device present in Pa /dev . This action can be safely performed while the virstor device is in use -.Pq Qo hot Qc operation +.Pq Qo hot Qc operation . .It Cm remove Removes components from existing virtual device with the given .Ar name . @@ -268,7 +268,8 @@ change once it is set, and that the size components will always remain constant during their existence. For alternative ways to implement virtual or resizable file systems see .Xr zfs 1M , -.Xr gconcat 8 and +.Xr gconcat 8 +and .Xr growfs 8 . .Pp Note that Modified: stable/9/sbin/gvinum/gvinum.8 ============================================================================== --- stable/9/sbin/gvinum/gvinum.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/gvinum/gvinum.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -58,7 +58,8 @@ All subdisks in the plex must be up for a parity check. .It Ic concat Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives Create a concatenated volume from the specified drives. -If no name is specified, a unique name will be set by gvinum. +If no name is specified, a unique name will be set by +.Ic gvinum . .It Ic create Oo Fl f Oc Op Ar description-file Create a volume as described in .Ar description-file . @@ -148,8 +149,8 @@ Normally this would be done by entering EOF character. .It Ic raid5 Oo Fl fv Oc Oo Fl s Ar stripesize Oc Oo Fl n Ar name Oc Ar drives Create a RAID-5 volume from the specified drives. -If no name is specified,a unique name will be set by -.Ic gvinum. +If no name is specified, a unique name will be set by +.Ic gvinum . This organization requires at least three drives. .It Ic rename Oo Fl r Oc Ar drive | subdisk | plex | volume newname Change the name of the specified object. @@ -202,8 +203,9 @@ Terminate access to the objects, or stop if no parameters are specified. .It Ic stripe Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives Create a striped volume from the specified drives. If no name is specified, -a unique name will be set by Ic gvinum. This organization requires at least two -drives. +a unique name will be set by +.Ic gvinum . +This organization requires at least two drives. .El .Sh DESCRIPTION The @@ -278,7 +280,8 @@ objects .El .Sh EXAMPLES To create a mirror on disks /dev/ad1 and /dev/ad2, create a filesystem, mount, -unmount and then stop Ic gvinum: +unmount and then stop +.Ic gvinum : .Pp .Dl "gvinum mirror /dev/ad1 /dev/ad2" .Dl "newfs /dev/gvinum/gvinumvolume0" Modified: stable/9/sbin/hastctl/hastctl.8 ============================================================================== --- stable/9/sbin/hastctl/hastctl.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/hastctl/hastctl.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -211,7 +211,7 @@ nodeB# application_start .Xr ggatel 8 , .Xr hastd 8 , .Xr mount 8 , -.Xr newfs 8 . +.Xr newfs 8 .Sh AUTHORS The .Nm Modified: stable/9/sbin/hastd/hastd.8 ============================================================================== --- stable/9/sbin/hastd/hastd.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/hastd/hastd.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -223,7 +223,7 @@ nodeA# mount -o noatime /dev/hast/shared .Xr hastctl 8 , .Xr mount 8 , .Xr newfs 8 , -.Xr g_bio 9 . +.Xr g_bio 9 .Sh AUTHORS The .Nm Modified: stable/9/sbin/mount/mount.8 ============================================================================== --- stable/9/sbin/mount/mount.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/mount/mount.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -448,7 +448,7 @@ However, for the following file system t .Cm smbfs , .Cm udf , and -.Cm unionfs , +.Cm unionfs . .Nm will not call .Xr nmount 2 Modified: stable/9/sbin/natd/natd.8 ============================================================================== --- stable/9/sbin/natd/natd.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sbin/natd/natd.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -787,7 +787,7 @@ ipfw add allow ip from any to any .Pp Here the packet from internal network to Internet goes out via .Ql sis0 -(rule number 2000) and gets catched by the +(rule number 2000) and gets caught by the .Ic globalport socket (3000). After that, either a match is found in a translation table Modified: stable/9/share/man/man8/picobsd.8 ============================================================================== --- stable/9/share/man/man8/picobsd.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/share/man/man8/picobsd.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -54,7 +54,7 @@ The most important options for common op .Fl src , .Fl init , .Fl n and -.Fl v. +.Fl v . .Bl -tag -width indent .\" .It Fl -all_in_mfs @@ -94,7 +94,10 @@ subtree as necessary to subsequently bui images. .\" .It Fl -iso -Generate an ISO image, picobsd.iso, in addition to the disk image picobsd.bin +Generate an ISO image, +.Pa picobsd.iso , +in addition to the disk image +.Pa picobsd.bin . .\" .It Fl -modules Also build kernel modules. Modified: stable/9/share/man/man8/rc.8 ============================================================================== --- stable/9/share/man/man8/rc.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/share/man/man8/rc.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -253,7 +253,7 @@ The boot does not stop if such a script but a script can stop the boot if necessary by invoking the .Fn stop_boot function (from -.Xr rc.subr 8 ). +.Xr rc.subr 8 ) . .El .Pp Each script should contain Modified: stable/9/sys/boot/common/loader.8 ============================================================================== --- stable/9/sys/boot/common/loader.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sys/boot/common/loader.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -423,7 +423,7 @@ variable take effect immediately. Defines the base i/o port used to access console UART (i386 and amd64 only). If the variable is not set, its assumed value is 0x3F8, which -corresponds to PC port COM1, unless overriden by +corresponds to PC port COM1, unless overridden by .Va BOOT_COMCONSOLE_PORT variable during the compilation of .Nm . Modified: stable/9/sys/boot/forth/beastie.4th.8 ============================================================================== --- stable/9/sys/boot/forth/beastie.4th.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sys/boot/forth/beastie.4th.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -29,7 +29,7 @@ .Os .Sh NAME .Nm beastie.4th -.Nd FreeBSD ASCII art boot module. +.Nd FreeBSD ASCII art boot module .Sh DESCRIPTION The file that goes by the name of .Nm Modified: stable/9/sys/boot/forth/brand.4th.8 ============================================================================== --- stable/9/sys/boot/forth/brand.4th.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sys/boot/forth/brand.4th.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -29,7 +29,7 @@ .Os .Sh NAME .Nm brand.4th -.Nd FreeBSD ASCII art boot module. +.Nd FreeBSD ASCII art boot module .Sh DESCRIPTION The file that goes by the name of .Nm Modified: stable/9/sys/boot/forth/check-password.4th.8 ============================================================================== --- stable/9/sys/boot/forth/check-password.4th.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sys/boot/forth/check-password.4th.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -29,7 +29,7 @@ .Os .Sh NAME .Nm check-password.4th -.Nd FreeBSD password-checking boot module. +.Nd FreeBSD password-checking boot module .Sh DESCRIPTION The file that goes by the name of .Nm Modified: stable/9/sys/boot/forth/color.4th.8 ============================================================================== --- stable/9/sys/boot/forth/color.4th.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sys/boot/forth/color.4th.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -29,7 +29,7 @@ .Os .Sh NAME .Nm color.4th -.Nd FreeBSD color-detection boot module. +.Nd FreeBSD color-detection boot module .Sh DESCRIPTION The file that goes by the name of .Nm Modified: stable/9/sys/boot/forth/delay.4th.8 ============================================================================== --- stable/9/sys/boot/forth/delay.4th.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sys/boot/forth/delay.4th.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -29,7 +29,7 @@ .Os .Sh NAME .Nm delay.4th -.Nd FreeBSD debugging boot module. +.Nd FreeBSD debugging boot module .Sh DESCRIPTION The file that goes by the name of .Nm Modified: stable/9/sys/boot/forth/menu.4th.8 ============================================================================== --- stable/9/sys/boot/forth/menu.4th.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sys/boot/forth/menu.4th.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -29,7 +29,7 @@ .Os .Sh NAME .Nm menu.4th -.Nd FreeBSD dynamic menu boot module. +.Nd FreeBSD dynamic menu boot module .Sh DESCRIPTION The file that goes by the name of .Nm Modified: stable/9/sys/boot/forth/version.4th.8 ============================================================================== --- stable/9/sys/boot/forth/version.4th.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/sys/boot/forth/version.4th.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -29,7 +29,7 @@ .Os .Sh NAME .Nm version.4th -.Nd FreeBSD version string boot module. +.Nd FreeBSD version string boot module .Sh DESCRIPTION The file that goes by the name of .Nm Modified: stable/9/usr.bin/ctlstat/ctlstat.8 ============================================================================== --- stable/9/usr.bin/ctlstat/ctlstat.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.bin/ctlstat/ctlstat.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -86,8 +86,8 @@ Notation (JSON) format. No statistics are computed in this mode, only raw numbers are displayed. .It Fl l Ar lun Request statistics for the specified LUN. -This option is incompatible with total ( -.Fl t ) +This option is incompatible with total +.Fl ( t ) mode. .It Fl n Ar numdevs Display statistics for this many devices. Modified: stable/9/usr.sbin/cpucontrol/cpucontrol.8 ============================================================================== --- stable/9/usr.sbin/cpucontrol/cpucontrol.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/cpucontrol/cpucontrol.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -31,7 +31,7 @@ .Nm cpucontrol .Nd control utility for the .Xr cpuctl 4 -device. +device .Sh SYNOPSIS .Nm .Op Fl vh Modified: stable/9/usr.sbin/ctladm/ctladm.8 ============================================================================== --- stable/9/usr.sbin/ctladm/ctladm.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/ctladm/ctladm.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -538,7 +538,7 @@ List all LUNs registered with CTL. Because this command uses the ioctl port, it will only work when the FETDs (Front End Target Drivers) are enabled. This command is the equivalent of doing a REPORT LUNS on one LUN and then -and then an INQUIRY on each LUN in the system. +an INQUIRY on each LUN in the system. .It Ic delay Delay commands at the given location. There are two places where commands may be delayed currently: before data is transferred @@ -745,7 +745,7 @@ single port. As a general rule, the WWNN should be the same across all ports on the system. .It Fl W Ar wwpn -Set the World Wide Node Name for the given port. +Set the World Wide Port Name for the given port. The .Fl n argument must be specified, since this is only possible to implement on a @@ -915,10 +915,10 @@ Create a LUN using the block backend, sp .Pa src/usr.sbin/ctladm/ctladm.8 as the backing store, and specify the .Tn SCSI -VPD page 0x80 and 0x83 serial number ( -.Fl S) -and device ID ( -.Fl d). +VPD page 0x80 and 0x83 serial number +.Fl ( S ) +and device ID +.Fl ( d ) . .Pp .Dl ctladm remove -b block -l 12 .Pp Modified: stable/9/usr.sbin/flowctl/flowctl.8 ============================================================================== --- stable/9/usr.sbin/flowctl/flowctl.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/flowctl/flowctl.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -60,7 +60,7 @@ This command is the analog of the .Dq "show ip cache flow" command of a Cisco router. It dumps the contents of the flow cache in Cisco-like format. -Specifing either +Specifying either .Cm ipv4 or .Cm ipv6 Modified: stable/9/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- stable/9/usr.sbin/freebsd-update/freebsd-update.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/freebsd-update/freebsd-update.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -62,7 +62,7 @@ Release Engineering Team, e.g., .Fx 9.0-CURRENT. .Sh OPTIONS -The following options are supported +The following options are supported: .Bl -tag -width "-f conffile" .It Fl b Ar basedir Operate on a system mounted at Modified: stable/9/usr.sbin/i2c/i2c.8 ============================================================================== --- stable/9/usr.sbin/i2c/i2c.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/i2c/i2c.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -88,7 +88,7 @@ reset the controller. .It Fl s scan the bus for devices. .It Fl v -be verbose +be verbose. .It Fl w Ar 0|8|16 device addressing width (in bits). .El Modified: stable/9/usr.sbin/jail/jail.8 ============================================================================== --- stable/9/usr.sbin/jail/jail.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/jail/jail.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -255,7 +255,7 @@ They can also be given the values .Dq true and .Dq false . -Other partameters may have more than one value, specified as a +Other parameters may have more than one value, specified as a comma-separated list or with .Dq += in the configuration file (see @@ -269,7 +269,7 @@ parameters that are passed to the kernel can be seen with .Xr jls 8 , and can (usually) be changed with -.Dq Nm Fl m. +.Dq Nm Fl m . Then there are pseudo-parameters that are only used by .Nm itself. @@ -580,7 +580,7 @@ command parameters are command lines that are run in either the system or prison environment. They may be given multiple values, which run would the specified commands in sequence. -All commands must succed (return a zero exit status), or the jail will +All commands must succeed (return a zero exit status), or the jail will not be created or removed. .Pp The pseudo-parameters are: @@ -657,7 +657,8 @@ The maximum amount of time to wait for a after sending them a .Dv SIGTERM signal (which happens after the -.Va exec.stop commands have completed). +.Va exec.stop +commands have completed). After this many seconds have passed, the prison will be removed, which will kill any remaining processes. If this is set to zero, no Modified: stable/9/usr.sbin/rtadvctl/rtadvctl.8 ============================================================================== --- stable/9/usr.sbin/rtadvctl/rtadvctl.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/rtadvctl/rtadvctl.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -31,7 +31,8 @@ .Sh NAME .Nm rtadvctl .Nd control program for -.Xr rtadvd 8 daemon +.Xr rtadvd 8 +daemon .Sh SYNOPSIS .Nm .Op Fl v Modified: stable/9/usr.sbin/rtadvd/rtadvd.8 ============================================================================== --- stable/9/usr.sbin/rtadvd/rtadvd.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/rtadvd/rtadvd.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -140,7 +140,7 @@ option, which enables routing renumberin .It Fl p Specify an alternative file in which to store the process ID. The default is -.Pa /var/run/rtadvd.pid. +.Pa /var/run/rtadvd.pid . .It Fl R Accept router renumbering requests. If you enable it, certain IPsec setup is suggested for security reasons. Modified: stable/9/usr.sbin/smbmsg/smbmsg.8 ============================================================================== --- stable/9/usr.sbin/smbmsg/smbmsg.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/smbmsg/smbmsg.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -70,7 +70,7 @@ and writeable, respectively. The only valid additional option for this modus of operation (besides the .Fl p -option that choses the modus) is +option that chooses the modus) is .Fl f Ar dev . See below for a description. .Pp Modified: stable/9/usr.sbin/utxrm/utxrm.8 ============================================================================== --- stable/9/usr.sbin/utxrm/utxrm.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/utxrm/utxrm.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -62,7 +62,7 @@ database, its use is limited to the supe .Sh SEE ALSO .Xr getent 1 , .Xr w 1 , -.Xr pututxline 3 . +.Xr pututxline 3 .Sh HISTORY The .Nm Modified: stable/9/usr.sbin/wpa/ndis_events/ndis_events.8 ============================================================================== --- stable/9/usr.sbin/wpa/ndis_events/ndis_events.8 Tue Jun 19 00:41:29 2012 (r237246) +++ stable/9/usr.sbin/wpa/ndis_events/ndis_events.8 Tue Jun 19 02:54:54 2012 (r237247) @@ -71,7 +71,7 @@ When it detects an event that was genera interface, it transmits it via UDP packet on the loopback interface, where .Xr wpa_supplicant 8 -is presumeably listening. +is presumably listening. The standard .Xr wpa_supplicant 8 distribution includes its own version of this utility for use with From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 03:06:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F6F61065670; Tue, 19 Jun 2012 03:06:09 +0000 (UTC) (envelope-from bjk@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 54DD58FC0A; Tue, 19 Jun 2012 03:06:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5J369jR029323; Tue, 19 Jun 2012 03:06:09 GMT (envelope-from bjk@freebsd.org) Received: from localhost (bjk@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) with ESMTP id q5J369hk029320; Tue, 19 Jun 2012 03:06:09 GMT (envelope-from bjk@freebsd.org) X-Authentication-Warning: freefall.freebsd.org: bjk owned process doing -bs Date: Tue, 19 Jun 2012 03:06:09 +0000 (UTC) From: Benjamin Kaduk To: Rick Macklem In-Reply-To: <201206182217.q5IMHTJE003928@svn.freebsd.org> Message-ID: References: <201206182217.q5IMHTJE003928@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237244 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 03:06:09 -0000 On Mon, 18 Jun 2012, Rick Macklem wrote: > Author: rmacklem > Date: Mon Jun 18 22:17:28 2012 > New Revision: 237244 > URL: http://svn.freebsd.org/changeset/base/237244 > > Log: > Fix the NFSv4 client for the case where mmap'd files are > written, but not msync'd by a process. A VOP_PUTPAGES() > called when VOP_RECLAIM() happens will usually fail, since > the NFSv4 Open has already been closed by VOP_INACTIVE(). > Add a vm_object_page_clean() call to the NFSv4 client's > VOP_INACTIVE(), so that the write happens before the NFSv4 > Open is closed. kib@ suggested using vgone() instead and > I will explore this, but this patch fixes things in the Hi Rick, OpenAFS is currently using vgone() in the vnode cleanup path (though it is actually in RECLAIM not INACTIVE because of how AFS has traditionally separated the two). However, it seems that the other *BSD implementations do not call vgone() in the same place, instead the corresponding flush functions call cache_purge() and sometimes other things. My colleague is trying to get our FreeBSD implementation to match, so I would be interested in your test case to confirm that we do not rely on the full vgone() there. Thanks, Ben > meantime. For some reason, the VOP_PUTPAGES() is still > attaempted in VOP_RECLAIM(), but having this fail doesn't > cause any problems except a "stateid0 in write" being logged. From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 05:17:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 737F41065674; Tue, 19 Jun 2012 05:17:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2F4828FC1E; Tue, 19 Jun 2012 05:17:08 +0000 (UTC) Received: by dadv36 with SMTP id v36so8438973dad.13 for ; Mon, 18 Jun 2012 22:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=6TNvfhXys01OZGS66dxq/a10XBrKneXxIYaJaUxGa8g=; b=htthRhOYnBzW4Abij3orOrrUaf3IC7Sh9lRzEAyZfmw5dMgEkHiBeMrhWwZUEPlR02 RY7AqYBV1cm7wN58FNSS4oI8kQ1CnqexQ4nXH8aGz7Nb8hr5H06LECp18/m/NHkWjdzp tpHvcYP/b50Y6KGwEjdr3SpLrs2bUgm+IAPhDdNWCWx6QjicIdiLwH+/zoXOdt5IBWez ud4CFgMTe+83sFHTo08echiqwqEyHBHwBfbFphcVtVNrjB7Q2ahg148fUVnr4Xvbche7 MVtaH5VJyqNkv9zCPRO5FhOtQbI6tLG3mCzNS1i3+DquW3ohQ7oBb9bcNx2dDmYqDj7g xzwg== MIME-Version: 1.0 Received: by 10.68.226.226 with SMTP id rv2mr59883707pbc.101.1340083027606; Mon, 18 Jun 2012 22:17:07 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.143.91.18 with HTTP; Mon, 18 Jun 2012 22:17:07 -0700 (PDT) In-Reply-To: <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au> References: <201206180754.q5I7sBoQ063448@svn.freebsd.org> <20120618093435.GA1017@gpr.nnz-home.ru> <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au> Date: Mon, 18 Jun 2012 22:17:07 -0700 X-Google-Sender-Auth: N8VEusY1NUNrfqP_-thSr-8xP0Q Message-ID: From: Adrian Chadd To: "Daniel O'Connor" Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gennady Proskurin , src-committers@freebsd.org, Poul-Henning Kamp Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 05:17:08 -0000 .. what, a kassert without handling the actual errorneous condition when INVARIANTS aren't compiled in? :) Adrian From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 05:27:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39B62106564A; Tue, 19 Jun 2012 05:27:15 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id E7DA48FC08; Tue, 19 Jun 2012 05:27:14 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id BE94F13F3A; Tue, 19 Jun 2012 05:27:13 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id q5J5RBpI031751; Tue, 19 Jun 2012 05:27:12 GMT (envelope-from phk@phk.freebsd.dk) To: "Daniel O'Connor" From: "Poul-Henning Kamp" In-Reply-To: Your message of "Tue, 19 Jun 2012 11:24:27 +0930." <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au> Content-Type: text/plain; charset=ISO-8859-1 Date: Tue, 19 Jun 2012 05:27:11 +0000 Message-ID: <31750.1340083631@critter.freebsd.dk> Cc: svn-src-head@freebsd.org, Gennady Proskurin , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 05:27:15 -0000 In message <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au>, "Daniel O'Conno r" writes: >> If size is odd, this does not copy the last byte. Not sure, whether = >this is intended. Feel free to improve... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 05:48:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA63D1065670; Tue, 19 Jun 2012 05:48:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9073F8FC0C; Tue, 19 Jun 2012 05:48:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J5mbK6023639; Tue, 19 Jun 2012 05:48:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J5mbu1023622; Tue, 19 Jun 2012 05:48:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206190548.q5J5mbu1023622@svn.freebsd.org> From: Xin LI Date: Tue, 19 Jun 2012 05:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237248 - in vendor/libz/dist: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 05:48:37 -0000 Author: delphij Date: Tue Jun 19 05:48:36 2012 New Revision: 237248 URL: http://svn.freebsd.org/changeset/base/237248 Log: Vendor import of zlib 1.2.7. Modified: vendor/libz/dist/ChangeLog vendor/libz/dist/README vendor/libz/dist/crc32.c vendor/libz/dist/crc32.h vendor/libz/dist/deflate.c vendor/libz/dist/gzguts.h vendor/libz/dist/gzlib.c vendor/libz/dist/gzread.c vendor/libz/dist/gzwrite.c vendor/libz/dist/inflate.c vendor/libz/dist/inftrees.c vendor/libz/dist/test/minigzip.c vendor/libz/dist/zconf.h vendor/libz/dist/zlib.3 vendor/libz/dist/zlib.h vendor/libz/dist/zutil.c vendor/libz/dist/zutil.h Modified: vendor/libz/dist/ChangeLog ============================================================================== --- vendor/libz/dist/ChangeLog Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/ChangeLog Tue Jun 19 05:48:36 2012 (r237248) @@ -1,6 +1,68 @@ ChangeLog file for zlib +Changes in 1.2.7 (2 May 2012) +- Replace use of memmove() with a simple copy for portability +- Test for existence of strerror +- Restore gzgetc_ for backward compatibility with 1.2.6 +- Fix build with non-GNU make on Solaris +- Require gcc 4.0 or later on Mac OS X to use the hidden attribute +- Include unistd.h for Watcom C +- Use __WATCOMC__ instead of __WATCOM__ +- Do not use the visibility attribute if NO_VIZ defined +- Improve the detection of no hidden visibility attribute +- Avoid using __int64 for gcc or solo compilation +- Cast to char * in gzprintf to avoid warnings [Zinser] +- Fix make_vms.com for VAX [Zinser] +- Don't use library or built-in byte swaps +- Simplify test and use of gcc hidden attribute +- Fix bug in gzclose_w() when gzwrite() fails to allocate memory +- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen() +- Fix bug in test/minigzip.c for configure --solo +- Fix contrib/vstudio project link errors [Mohanathas] +- Add ability to choose the builder in make_vms.com [Schweda] +- Add DESTDIR support to mingw32 win32/Makefile.gcc +- Fix comments in win32/Makefile.gcc for proper usage +- Allow overriding the default install locations for cmake +- Generate and install the pkg-config file with cmake +- Build both a static and a shared version of zlib with cmake +- Include version symbols for cmake builds +- If using cmake with MSVC, add the source directory to the includes +- Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta] +- Move obsolete emx makefile to old [Truta] +- Allow the use of -Wundef when compiling or using zlib +- Avoid the use of the -u option with mktemp +- Improve inflate() documentation on the use of Z_FINISH +- Recognize clang as gcc +- Add gzopen_w() in Windows for wide character path names +- Rename zconf.h in CMakeLists.txt to move it out of the way +- Add source directory in CMakeLists.txt for building examples +- Look in build directory for zlib.pc in CMakeLists.txt +- Remove gzflags from zlibvc.def in vc9 and vc10 +- Fix contrib/minizip compilation in the MinGW environment +- Update ./configure for Solaris, support --64 [Mooney] +- Remove -R. from Solaris shared build (possible security issue) +- Avoid race condition for parallel make (-j) running example +- Fix type mismatch between get_crc_table() and crc_table +- Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler] +- Fix the path to zlib.map in CMakeLists.txt +- Force the native libtool in Mac OS X to avoid GNU libtool [Beebe] +- Add instructions to win32/Makefile.gcc for shared install [Torri] + +Changes in 1.2.6.1 (12 Feb 2012) +- Avoid the use of the Objective-C reserved name "id" +- Include io.h in gzguts.h for Microsoft compilers +- Fix problem with ./configure --prefix and gzgetc macro +- Include gz_header definition when compiling zlib solo +- Put gzflags() functionality back in zutil.c +- Avoid library header include in crc32.c for Z_SOLO +- Use name in GCC_CLASSIC as C compiler for coverage testing, if set +- Minor cleanup in contrib/minizip/zip.c [Vollant] +- Update make_vms.com [Zinser] +- Remove unnecessary gzgetc_ function +- Use optimized byte swap operations for Microsoft and GNU [Snyder] +- Fix minor typo in zlib.h comments [Rzesniowiecki] + Changes in 1.2.6 (29 Jan 2012) - Update the Pascal interface in contrib/pascal - Fix function numbers for gzgetc_ in zlibvc.def files Modified: vendor/libz/dist/README ============================================================================== --- vendor/libz/dist/README Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/README Tue Jun 19 05:48:36 2012 (r237248) @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.6 is a general purpose data compression library. All the code is +zlib 1.2.7 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an ar issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.6 are documented in the file ChangeLog. +The changes made in version 1.2.7 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . Modified: vendor/libz/dist/crc32.c ============================================================================== --- vendor/libz/dist/crc32.c Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/crc32.c Tue Jun 19 05:48:36 2012 (r237248) @@ -1,5 +1,5 @@ /* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011 Mark Adler + * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Thanks to Rodney Brown for his contribution of faster @@ -32,39 +32,17 @@ #define local static -/* Find a four-byte integer type for crc32_little() and crc32_big(). */ -#ifndef NOBYFOUR -# ifdef STDC /* need ANSI C limits.h to determine sizes */ -# include -# define BYFOUR -# if (UINT_MAX == 0xffffffffUL) - typedef unsigned int u4; -# else -# if (ULONG_MAX == 0xffffffffUL) - typedef unsigned long u4; -# else -# if (USHRT_MAX == 0xffffffffUL) - typedef unsigned short u4; -# else -# undef BYFOUR /* can't find a four-byte integer type! */ -# endif -# endif -# endif -# endif /* STDC */ -#endif /* !NOBYFOUR */ - /* Definitions for doing the crc four data bytes at a time. */ +#if !defined(NOBYFOUR) && defined(Z_U4) +# define BYFOUR +#endif #ifdef BYFOUR - typedef u4 crc_table_t; -# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ - (((w)&0xff00)<<8)+(((w)&0xff)<<24)) local unsigned long crc32_little OF((unsigned long, const unsigned char FAR *, unsigned)); local unsigned long crc32_big OF((unsigned long, const unsigned char FAR *, unsigned)); # define TBLS 8 #else - typedef unsigned long crc_table_t; # define TBLS 1 #endif /* BYFOUR */ @@ -78,10 +56,10 @@ local uLong crc32_combine_ OF((uLong crc #ifdef DYNAMIC_CRC_TABLE local volatile int crc_table_empty = 1; -local crc_table_t FAR crc_table[TBLS][256]; +local z_crc_t FAR crc_table[TBLS][256]; local void make_crc_table OF((void)); #ifdef MAKECRCH - local void write_table OF((FILE *, const crc_table_t FAR *)); + local void write_table OF((FILE *, const z_crc_t FAR *)); #endif /* MAKECRCH */ /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: @@ -111,9 +89,9 @@ local void make_crc_table OF((void)); */ local void make_crc_table() { - crc_table_t c; + z_crc_t c; int n, k; - crc_table_t poly; /* polynomial exclusive-or pattern */ + z_crc_t poly; /* polynomial exclusive-or pattern */ /* terms of polynomial defining this crc (except x^32): */ static volatile int first = 1; /* flag to limit concurrent making */ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; @@ -127,11 +105,11 @@ local void make_crc_table() /* make exclusive-or pattern from polynomial (0xedb88320UL) */ poly = 0; for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (crc_table_t)1 << (31 - p[n]); + poly |= (z_crc_t)1 << (31 - p[n]); /* generate a crc for every 8-bit value */ for (n = 0; n < 256; n++) { - c = (crc_table_t)n; + c = (z_crc_t)n; for (k = 0; k < 8; k++) c = c & 1 ? poly ^ (c >> 1) : c >> 1; crc_table[0][n] = c; @@ -142,11 +120,11 @@ local void make_crc_table() and then the byte reversal of those as well as the first table */ for (n = 0; n < 256; n++) { c = crc_table[0][n]; - crc_table[4][n] = REV(c); + crc_table[4][n] = ZSWAP32(c); for (k = 1; k < 4; k++) { c = crc_table[0][c & 0xff] ^ (c >> 8); crc_table[k][n] = c; - crc_table[k + 4][n] = REV(c); + crc_table[k + 4][n] = ZSWAP32(c); } } #endif /* BYFOUR */ @@ -168,7 +146,7 @@ local void make_crc_table() if (out == NULL) return; fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const crc_table_t FAR "); + fprintf(out, "local const z_crc_t FAR "); fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); write_table(out, crc_table[0]); # ifdef BYFOUR @@ -188,7 +166,7 @@ local void make_crc_table() #ifdef MAKECRCH local void write_table(out, table) FILE *out; - const crc_table_t FAR *table; + const z_crc_t FAR *table; { int n; @@ -209,13 +187,13 @@ local void write_table(out, table) /* ========================================================================= * This function can be used by asm versions of crc32() */ -const unsigned long FAR * ZEXPORT get_crc_table() +const z_crc_t FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ - return (const unsigned long FAR *)crc_table; + return (const z_crc_t FAR *)crc_table; } /* ========================================================================= */ @@ -237,7 +215,7 @@ unsigned long ZEXPORT crc32(crc, buf, le #ifdef BYFOUR if (sizeof(void *) == sizeof(ptrdiff_t)) { - u4 endian; + z_crc_t endian; endian = 1; if (*((unsigned char *)(&endian))) @@ -271,17 +249,17 @@ local unsigned long crc32_little(crc, bu const unsigned char FAR *buf; unsigned len; { - register u4 c; - register const u4 FAR *buf4; + register z_crc_t c; + register const z_crc_t FAR *buf4; - c = (u4)crc; + c = (z_crc_t)crc; c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } - buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4 = (const z_crc_t FAR *)(const void FAR *)buf; while (len >= 32) { DOLIT32; len -= 32; @@ -311,17 +289,17 @@ local unsigned long crc32_big(crc, buf, const unsigned char FAR *buf; unsigned len; { - register u4 c; - register const u4 FAR *buf4; + register z_crc_t c; + register const z_crc_t FAR *buf4; - c = REV((u4)crc); + c = ZSWAP32((z_crc_t)crc); c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; } - buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4 = (const z_crc_t FAR *)(const void FAR *)buf; buf4--; while (len >= 32) { DOBIG32; @@ -338,7 +316,7 @@ local unsigned long crc32_big(crc, buf, c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); } while (--len); c = ~c; - return (unsigned long)(REV(c)); + return (unsigned long)(ZSWAP32(c)); } #endif /* BYFOUR */ Modified: vendor/libz/dist/crc32.h ============================================================================== --- vendor/libz/dist/crc32.h Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/crc32.h Tue Jun 19 05:48:36 2012 (r237248) @@ -2,7 +2,7 @@ * Generated automatically by crc32.c */ -local const crc_table_t FAR crc_table[TBLS][256] = +local const z_crc_t FAR crc_table[TBLS][256] = { { 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, Modified: vendor/libz/dist/deflate.c ============================================================================== --- vendor/libz/dist/deflate.c Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/deflate.c Tue Jun 19 05:48:36 2012 (r237248) @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.6 Copyright 1995-2012 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot Modified: vendor/libz/dist/gzguts.h ============================================================================== --- vendor/libz/dist/gzguts.h Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/gzguts.h Tue Jun 19 05:48:36 2012 (r237248) @@ -12,7 +12,7 @@ # endif #endif -#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +#ifdef HAVE_HIDDEN # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL @@ -27,7 +27,11 @@ #endif #include -#ifdef __TURBOC__ +#ifdef _WIN32 +# include +#endif + +#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) # include #endif @@ -66,7 +70,6 @@ /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ # if !defined(vsnprintf) && !defined(NO_vsnprintf) # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) -# include # define vsnprintf _vsnprintf # endif # endif @@ -101,7 +104,7 @@ # include # define zstrerror() gz_strwinerror((DWORD)GetLastError()) #else -# ifdef STDC +# ifndef NO_STRERROR # include # define zstrerror() strerror(errno) # else Modified: vendor/libz/dist/gzlib.c ============================================================================== --- vendor/libz/dist/gzlib.c Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/gzlib.c Tue Jun 19 05:48:36 2012 (r237248) @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004, 2010, 2011 Mark Adler + * Copyright (C) 2004, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -17,7 +17,7 @@ /* Local functions */ local void gz_reset OF((gz_statep)); -local gzFile gz_open OF((const char *, int, const char *)); +local gzFile gz_open OF((const void *, int, const char *)); #if defined UNDER_CE @@ -89,11 +89,19 @@ local void gz_reset(state) /* Open a gzip file either by name or file descriptor. */ local gzFile gz_open(path, fd, mode) - const char *path; + const void *path; int fd; const char *mode; { gz_statep state; + size_t len; + int oflag; +#ifdef O_CLOEXEC + int cloexec = 0; +#endif +#ifdef O_EXCL + int exclusive = 0; +#endif /* check input */ if (path == NULL) @@ -133,6 +141,16 @@ local gzFile gz_open(path, fd, mode) return NULL; case 'b': /* ignore -- will request binary anyway */ break; +#ifdef O_CLOEXEC + case 'e': + cloexec = 1; + break; +#endif +#ifdef O_EXCL + case 'x': + exclusive = 1; + break; +#endif case 'f': state->strategy = Z_FILTERED; break; @@ -168,29 +186,57 @@ local gzFile gz_open(path, fd, mode) } /* save the path name for error messages */ - state->path = malloc(strlen(path) + 1); +#ifdef _WIN32 + if (fd == -2) { + len = wcstombs(NULL, path, 0); + if (len == (size_t)-1) + len = 0; + } + else +#endif + len = strlen(path); + state->path = malloc(len + 1); if (state->path == NULL) { free(state); return NULL; } - strcpy(state->path, path); +#ifdef _WIN32 + if (fd == -2) + if (len) + wcstombs(state->path, path, len + 1); + else + *(state->path) = 0; + else +#endif + strcpy(state->path, path); - /* open the file with the appropriate mode (or just use fd) */ - state->fd = fd != -1 ? fd : - open(path, + /* compute the flags for open() */ + oflag = #ifdef O_LARGEFILE - O_LARGEFILE | + O_LARGEFILE | #endif #ifdef O_BINARY - O_BINARY | + O_BINARY | +#endif +#ifdef O_CLOEXEC + (cloexec ? O_CLOEXEC : 0) | +#endif + (state->mode == GZ_READ ? + O_RDONLY : + (O_WRONLY | O_CREAT | +#ifdef O_EXCL + (exclusive ? O_EXCL : 0) | #endif - (state->mode == GZ_READ ? - O_RDONLY : - (O_WRONLY | O_CREAT | ( - state->mode == GZ_WRITE ? - O_TRUNC : - O_APPEND))), - 0666); + (state->mode == GZ_WRITE ? + O_TRUNC : + O_APPEND))); + + /* open the file with the appropriate flags (or just use fd) */ + state->fd = fd > -1 ? fd : ( +#ifdef _WIN32 + fd == -2 ? _wopen(path, oflag, 0666) : +#endif + open(path, oflag, 0666)); if (state->fd == -1) { free(state->path); free(state); @@ -245,6 +291,16 @@ gzFile ZEXPORT gzdopen(fd, mode) } /* -- see zlib.h -- */ +#ifdef _WIN32 +gzFile ZEXPORT gzopen_w(path, mode) + const wchar_t *path; + const char *mode; +{ + return gz_open(path, -2, mode); +} +#endif + +/* -- see zlib.h -- */ int ZEXPORT gzbuffer(file, size) gzFile file; unsigned size; Modified: vendor/libz/dist/gzread.c ============================================================================== --- vendor/libz/dist/gzread.c Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/gzread.c Tue Jun 19 05:48:36 2012 (r237248) @@ -1,5 +1,5 @@ /* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -57,8 +57,13 @@ local int gz_avail(state) if (state->err != Z_OK && state->err != Z_BUF_ERROR) return -1; if (state->eof == 0) { - if (strm->avail_in) - memmove(state->in, strm->next_in, strm->avail_in); + if (strm->avail_in) { /* copy what's there to the start */ + unsigned char *p = state->in, *q = strm->next_in; + unsigned n = strm->avail_in; + do { + *p++ = *q++; + } while (--n); + } if (gz_load(state, state->in + strm->avail_in, state->size - strm->avail_in, &got) == -1) return -1; @@ -340,7 +345,7 @@ int ZEXPORT gzread(file, buf, len) /* get more output, looking for header if required */ if (gz_fetch(state) == -1) return -1; - continue; /* no progress yet -- go back to memcpy() above */ + continue; /* no progress yet -- go back to copy above */ /* the copy above assures that we will leave with space in the output buffer, allowing at least one gzungetc() to succeed */ } @@ -373,7 +378,8 @@ int ZEXPORT gzread(file, buf, len) } /* -- see zlib.h -- */ -int ZEXPORT gzgetc_(file) +#undef gzgetc +int ZEXPORT gzgetc(file) gzFile file; { int ret; @@ -402,12 +408,11 @@ int ZEXPORT gzgetc_(file) return ret < 1 ? -1 : buf[0]; } -#undef gzgetc -int ZEXPORT gzgetc(file) +int ZEXPORT gzgetc_(file) gzFile file; { - return gzgetc_(file); -} + return gzgetc(file); +} /* -- see zlib.h -- */ int ZEXPORT gzungetc(c, file) Modified: vendor/libz/dist/gzwrite.c ============================================================================== --- vendor/libz/dist/gzwrite.c Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/gzwrite.c Tue Jun 19 05:48:36 2012 (r237248) @@ -338,19 +338,19 @@ int ZEXPORTVA gzprintf (gzFile file, con va_start(va, format); #ifdef NO_vsnprintf # ifdef HAS_vsprintf_void - (void)vsprintf(state->in, format, va); + (void)vsprintf((char *)(state->in), format, va); va_end(va); for (len = 0; len < size; len++) if (state->in[len] == 0) break; # else - len = vsprintf(state->in, format, va); + len = vsprintf((char *)(state->in), format, va); va_end(va); # endif #else # ifdef HAS_vsnprintf_void - (void)vsnprintf(state->in, size, format, va); + (void)vsnprintf((char *)(state->in), size, format, va); va_end(va); - len = strlen(state->in); + len = strlen((char *)(state->in)); # else len = vsnprintf((char *)(state->in), size, format, va); va_end(va); @@ -416,22 +416,23 @@ int ZEXPORTVA gzprintf (file, format, a1 state->in[size - 1] = 0; #ifdef NO_snprintf # ifdef HAS_sprintf_void - sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); for (len = 0; len < size; len++) if (state->in[len] == 0) break; # else - len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); # endif #else # ifdef HAS_snprintf_void - snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(state->in); + len = strlen((char *)(state->in)); # else - len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, + a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, + a19, a20); # endif #endif @@ -546,13 +547,15 @@ int ZEXPORT gzclose_w(file) } /* flush, free memory, and close file */ - if (gz_comp(state, Z_FINISH) == -1) - ret = state->err; - if (!state->direct) { - (void)deflateEnd(&(state->strm)); - free(state->out); + if (state->size) { + if (gz_comp(state, Z_FINISH) == -1) + ret = state->err; + if (!state->direct) { + (void)deflateEnd(&(state->strm)); + free(state->out); + } + free(state->in); } - free(state->in); gz_error(state, Z_OK, NULL); free(state->path); if (close(state->fd) == -1) @@ -560,34 +563,3 @@ int ZEXPORT gzclose_w(file) free(state); return ret; } - -/* used by zlibVersion() to get the vsnprintf story from the horse's mouth */ -unsigned long ZEXPORT gzflags() -{ - unsigned long flags = 0; -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifdef NO_vsnprintf - flags += 1L << 25; -# ifdef HAS_vsprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1L << 26; -# endif -# endif -#else - flags += 1L << 24; -# ifdef NO_snprintf - flags += 1L << 25; -# ifdef HAS_sprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1L << 26; -# endif -# endif -#endif - return flags; -} Modified: vendor/libz/dist/inflate.c ============================================================================== --- vendor/libz/dist/inflate.c Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/inflate.c Tue Jun 19 05:48:36 2012 (r237248) @@ -1,5 +1,5 @@ /* inflate.c -- zlib decompression - * Copyright (C) 1995-2011 Mark Adler + * Copyright (C) 1995-2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -519,11 +519,6 @@ unsigned out; bits -= bits & 7; \ } while (0) -/* Reverse the bytes in a 32-bit value */ -#define REVERSE(q) \ - ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - /* inflate() uses a state machine to process as much input data and generate as much output data as possible before returning. The state machine is @@ -817,7 +812,7 @@ int flush; #endif case DICTID: NEEDBITS(32); - strm->adler = state->check = REVERSE(hold); + strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; case DICT: @@ -1189,7 +1184,7 @@ int flush; #ifdef GUNZIP state->flags ? hold : #endif - REVERSE(hold)) != state->check) { + ZSWAP32(hold)) != state->check) { strm->msg = (char *)"incorrect data check"; state->mode = BAD; break; @@ -1275,7 +1270,7 @@ const Bytef *dictionary; uInt dictLength; { struct inflate_state FAR *state; - unsigned long id; + unsigned long dictid; unsigned char *next; unsigned avail; int ret; @@ -1286,11 +1281,11 @@ uInt dictLength; if (state->wrap != 0 && state->mode != DICT) return Z_STREAM_ERROR; - /* check for correct dictionary id */ + /* check for correct dictionary identifier */ if (state->mode == DICT) { - id = adler32(0L, Z_NULL, 0); - id = adler32(id, dictionary, dictLength); - if (id != state->check) + dictid = adler32(0L, Z_NULL, 0); + dictid = adler32(dictid, dictionary, dictLength); + if (dictid != state->check) return Z_DATA_ERROR; } Modified: vendor/libz/dist/inftrees.c ============================================================================== --- vendor/libz/dist/inftrees.c Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/inftrees.c Tue Jun 19 05:48:36 2012 (r237248) @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.6 Copyright 1995-2012 Mark Adler "; + " inflate 1.2.7 Copyright 1995-2012 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -62,7 +62,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 69}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 78, 68}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, Modified: vendor/libz/dist/test/minigzip.c ============================================================================== --- vendor/libz/dist/test/minigzip.c Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/test/minigzip.c Tue Jun 19 05:48:36 2012 (r237248) @@ -197,7 +197,7 @@ gzFile gz_open(path, fd, mode) gzFile gz; int ret; - gz = malloc(sizeof(gzFile)); + gz = malloc(sizeof(struct gzFile_s)); if (gz == NULL) return NULL; gz->write = strchr(mode, 'w') != NULL; Modified: vendor/libz/dist/zconf.h ============================================================================== --- vendor/libz/dist/zconf.h Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/zconf.h Tue Jun 19 05:48:36 2012 (r237248) @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2011 Jean-loup Gailly. + * Copyright (C) 1995-2012 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -65,7 +65,6 @@ # define gzdopen z_gzdopen # define gzeof z_gzeof # define gzerror z_gzerror -# define gzflags z_gzflags # define gzflush z_gzflush # define gzgetc z_gzgetc # define gzgetc_ z_gzgetc_ @@ -74,6 +73,9 @@ # define gzoffset64 z_gzoffset64 # define gzopen z_gzopen # define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif # define gzprintf z_gzprintf # define gzputc z_gzputc # define gzputs z_gzputs @@ -127,9 +129,9 @@ # define free_func z_free_func # ifndef Z_SOLO # define gzFile z_gzFile -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp # endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp # define in_func z_in_func # define intf z_intf # define out_func z_out_func @@ -142,9 +144,7 @@ # define voidpf z_voidpf /* all zlib structs in zlib.h and zconf.h */ -# ifndef Z_SOLO -# define gz_header_s z_gz_header_s -# endif +# define gz_header_s z_gz_header_s # define internal_state z_internal_state #endif @@ -388,11 +388,34 @@ typedef uLong FAR uLongf; typedef Byte *voidp; #endif -#if 1 /* was set to #if 1 by ./configure */ +/* ./configure may #define Z_U4 here */ + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# else +# if (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# else +# if (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +# endif +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ # define Z_HAVE_UNISTD_H #endif -#if 1 /* was set to #if 1 by ./configure */ +#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ # define Z_HAVE_STDARG_H #endif @@ -402,30 +425,47 @@ typedef uLong FAR uLongf; # endif #endif +#ifdef _WIN32 +# include /* for wchar_t */ +#endif + /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ -#if -_LARGEFILE64_SOURCE - -1 == 1 +#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 -# define Z_LARGE +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +# define Z_HAVE_UNISTD_H #endif - -#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)) && !defined(Z_SOLO) -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif # endif #endif +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + #if !defined(SEEK_SET) && !defined(Z_SOLO) # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ @@ -436,14 +476,14 @@ typedef uLong FAR uLongf; # define z_off_t long #endif -#if !defined(_WIN32) && (defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0) +#if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t #else -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) # define z_off64_t __int64 # else -# define z_off64_t z_off_t -#endif +# define z_off64_t z_off_t +# endif #endif /* MVS linker does not support external names larger than 8 bytes */ Modified: vendor/libz/dist/zlib.3 ============================================================================== --- vendor/libz/dist/zlib.3 Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/zlib.3 Tue Jun 19 05:48:36 2012 (r237248) @@ -1,4 +1,4 @@ -.TH ZLIB 3 "29 Jan 2012" +.TH ZLIB 3 "2 May 2012" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS @@ -125,7 +125,7 @@ before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). .SH AUTHORS -Version 1.2.6 +Version 1.2.7 Copyright (C) 1995-2012 Jean-loup Gailly (jloup@gzip.org) and Mark Adler (madler@alumni.caltech.edu). .LP Modified: vendor/libz/dist/zlib.h ============================================================================== --- vendor/libz/dist/zlib.h Tue Jun 19 02:54:54 2012 (r237247) +++ vendor/libz/dist/zlib.h Tue Jun 19 05:48:36 2012 (r237248) @@ -1,5 +1,5 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.6, January 29th, 2012 + version 1.2.7, May 2nd, 2012 Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.6" -#define ZLIB_VERNUM 0x1260 +#define ZLIB_VERSION "1.2.7" +#define ZLIB_VERNUM 0x1270 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 6 +#define ZLIB_VER_REVISION 7 #define ZLIB_VER_SUBREVISION 0 /* @@ -452,14 +452,17 @@ ZEXTERN int ZEXPORT inflate OF((z_stream error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all the uncompressed data. (The size - of the uncompressed data may have been saved by the compressor for this - purpose.) The next operation on this stream must be inflateEnd to deallocate - the decompression state. The use of Z_FINISH is not required to perform an - inflation in one step. However it may be used to inform inflate that a - faster approach can be used for the single inflate() call. Z_FINISH also - informs inflate to not maintain a sliding window if the stream completes, - which reduces inflate's memory footprint. + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. In this implementation, inflate() always flushes as much output as possible to the output buffer, and always uses the faster approach on the *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 05:49:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CFD7E1065676; Tue, 19 Jun 2012 05:49:53 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FFC18FC17; Tue, 19 Jun 2012 05:49:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J5nrpJ023721; Tue, 19 Jun 2012 05:49:53 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J5nrVO023720; Tue, 19 Jun 2012 05:49:53 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206190549.q5J5nrVO023720@svn.freebsd.org> From: Xin LI Date: Tue, 19 Jun 2012 05:49:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237249 - vendor/libz/1.2.7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 05:49:54 -0000 Author: delphij Date: Tue Jun 19 05:49:53 2012 New Revision: 237249 URL: http://svn.freebsd.org/changeset/base/237249 Log: Tag zlib 1.2.7. Added: vendor/libz/1.2.7/ - copied from r237248, vendor/libz/dist/ From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 05:53:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 455CD106567A; Tue, 19 Jun 2012 05:53:48 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30E548FC0A; Tue, 19 Jun 2012 05:53:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J5rmdZ023924; Tue, 19 Jun 2012 05:53:48 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J5rmxP023922; Tue, 19 Jun 2012 05:53:48 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206190553.q5J5rmxP023922@svn.freebsd.org> From: Joel Dahl Date: Tue, 19 Jun 2012 05:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237250 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 05:53:48 -0000 Author: joel (doc committer) Date: Tue Jun 19 05:53:47 2012 New Revision: 237250 URL: http://svn.freebsd.org/changeset/base/237250 Log: Minor mdoc fixes. Modified: head/share/man/man4/est.4 Modified: head/share/man/man4/est.4 ============================================================================== --- head/share/man/man4/est.4 Tue Jun 19 05:49:53 2012 (r237249) +++ head/share/man/man4/est.4 Tue Jun 19 05:53:47 2012 (r237250) @@ -89,12 +89,10 @@ Consult your BIOS documentation for more is only found on supported Intel CPUs. .Sh SEE ALSO .Xr cpufreq 4 -.Sh SUPPORT -For general information and support, -go to the Intel 64 and IA-32 Architectures Software Developer -Manuals site. -.Pa http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html +.Rs +.%T "Intel 64 and IA-32 Architectures Software Developer Manuals" +.%U "http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html" +.Re .Sh AUTHORS -.Pp This manual page was written by .An Sean Bruno Aq sbruno@FreeBSD.org . From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 05:55:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B40EB1065686; Tue, 19 Jun 2012 05:55:15 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 988328FC12; Tue, 19 Jun 2012 05:55:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J5tFBr024026; Tue, 19 Jun 2012 05:55:15 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J5tFNA024025; Tue, 19 Jun 2012 05:55:15 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206190555.q5J5tFNA024025@svn.freebsd.org> From: Joel Dahl Date: Tue, 19 Jun 2012 05:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237251 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 05:55:15 -0000 Author: joel (doc committer) Date: Tue Jun 19 05:55:14 2012 New Revision: 237251 URL: http://svn.freebsd.org/changeset/base/237251 Log: Remove end of line whitespace. Modified: head/share/man/man4/est.4 Modified: head/share/man/man4/est.4 ============================================================================== --- head/share/man/man4/est.4 Tue Jun 19 05:53:47 2012 (r237250) +++ head/share/man/man4/est.4 Tue Jun 19 05:55:14 2012 (r237251) @@ -63,11 +63,11 @@ behavior. .Bl -tag -width indent .It hw.est.msr_info Attempt to infer information from direct probing of the msr. -Should only be used in diagnostic cases +Should only be used in diagnostic cases .Pq default 0 .It hw.est.strict Do not allow different cpus to be set to different frequencies. -It appears that this will only work on i386 systems +It appears that this will only work on i386 systems .Pq default 0 .El .Sh DIAGNOSTICS From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 05:55:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E981106564A; Tue, 19 Jun 2012 05:55:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB42D8FC08; Tue, 19 Jun 2012 05:55:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J5tuhU024101; Tue, 19 Jun 2012 05:55:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J5tu6H024098; Tue, 19 Jun 2012 05:55:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206190555.q5J5tu6H024098@svn.freebsd.org> From: Xin LI Date: Tue, 19 Jun 2012 05:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237252 - vendor/libz/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 05:55:57 -0000 Author: delphij Date: Tue Jun 19 05:55:56 2012 New Revision: 237252 URL: http://svn.freebsd.org/changeset/base/237252 Log: Add the test directory. Added: vendor/libz/test/ vendor/libz/test/example.c (contents, props changed) vendor/libz/test/infcover.c (contents, props changed) vendor/libz/test/minigzip.c (contents, props changed) Added: vendor/libz/test/example.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libz/test/example.c Tue Jun 19 05:55:56 2012 (r237252) @@ -0,0 +1,601 @@ +/* example.c -- usage example of the zlib compression library + * Copyright (C) 1995-2006, 2011 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zlib.h" +#include + +#ifdef STDC +# include +# include +#endif + +#if defined(VMS) || defined(RISCOS) +# define TESTFILE "foo-gz" +#else +# define TESTFILE "foo.gz" +#endif + +#define CHECK_ERR(err, msg) { \ + if (err != Z_OK) { \ + fprintf(stderr, "%s error: %d\n", msg, err); \ + exit(1); \ + } \ +} + +const char hello[] = "hello, hello!"; +/* "hello world" would be more standard, but the repeated "hello" + * stresses the compression code better, sorry... + */ + +const char dictionary[] = "hello"; +uLong dictId; /* Adler32 value of the dictionary */ + +void test_deflate OF((Byte *compr, uLong comprLen)); +void test_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_deflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_flush OF((Byte *compr, uLong *comprLen)); +void test_sync OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_dict_deflate OF((Byte *compr, uLong comprLen)); +void test_dict_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +int main OF((int argc, char *argv[])); + + +#ifdef Z_SOLO + +void *myalloc OF((void *, unsigned, unsigned)); +void myfree OF((void *, void *)); + +void *myalloc(q, n, m) + void *q; + unsigned n, m; +{ + q = Z_NULL; + return calloc(n, m); +} + +void myfree(void *q, void *p) +{ + q = Z_NULL; + free(p); +} + +static alloc_func zalloc = myalloc; +static free_func zfree = myfree; + +#else /* !Z_SOLO */ + +static alloc_func zalloc = (alloc_func)0; +static free_func zfree = (free_func)0; + +void test_compress OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_gzio OF((const char *fname, + Byte *uncompr, uLong uncomprLen)); + +/* =========================================================================== + * Test compress() and uncompress() + */ +void test_compress(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + uLong len = (uLong)strlen(hello)+1; + + err = compress(compr, &comprLen, (const Bytef*)hello, len); + CHECK_ERR(err, "compress"); + + strcpy((char*)uncompr, "garbage"); + + err = uncompress(uncompr, &uncomprLen, compr, comprLen); + CHECK_ERR(err, "uncompress"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad uncompress\n"); + exit(1); + } else { + printf("uncompress(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test read/write of .gz files + */ +void test_gzio(fname, uncompr, uncomprLen) + const char *fname; /* compressed file name */ + Byte *uncompr; + uLong uncomprLen; +{ +#ifdef NO_GZCOMPRESS + fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); +#else + int err; + int len = (int)strlen(hello)+1; + gzFile file; + z_off_t pos; + + file = gzopen(fname, "wb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + gzputc(file, 'h'); + if (gzputs(file, "ello") != 4) { + fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); + exit(1); + } + if (gzprintf(file, ", %s!", "hello") != 8) { + fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); + exit(1); + } + gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ + gzclose(file); + + file = gzopen(fname, "rb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + strcpy((char*)uncompr, "garbage"); + + if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { + fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); + exit(1); + } else { + printf("gzread(): %s\n", (char*)uncompr); + } + + pos = gzseek(file, -8L, SEEK_CUR); + if (pos != 6 || gztell(file) != pos) { + fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", + (long)pos, (long)gztell(file)); + exit(1); + } + + if (gzgetc(file) != ' ') { + fprintf(stderr, "gzgetc error\n"); + exit(1); + } + + if (gzungetc(' ', file) != ' ') { + fprintf(stderr, "gzungetc error\n"); + exit(1); + } + + gzgets(file, (char*)uncompr, (int)uncomprLen); + if (strlen((char*)uncompr) != 7) { /* " hello!" */ + fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello + 6)) { + fprintf(stderr, "bad gzgets after gzseek\n"); + exit(1); + } else { + printf("gzgets() after gzseek: %s\n", (char*)uncompr); + } + + gzclose(file); +#endif +} + +#endif /* Z_SOLO */ + +/* =========================================================================== + * Test deflate() with small buffers + */ +void test_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + uLong len = (uLong)strlen(hello)+1; + + c_stream.zalloc = zalloc; + c_stream.zfree = zfree; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + + while (c_stream.total_in != len && c_stream.total_out < comprLen) { + c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + } + /* Finish the stream, still forcing small buffers: */ + for (;;) { + c_stream.avail_out = 1; + err = deflate(&c_stream, Z_FINISH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "deflate"); + } + + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with small buffers + */ +void test_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = zalloc; + d_stream.zfree = zfree; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 0; + d_stream.next_out = uncompr; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { + d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate\n"); + exit(1); + } else { + printf("inflate(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test deflate() with large buffers and dynamic change of compression level + */ +void test_large_deflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = zalloc; + c_stream.zfree = zfree; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_SPEED); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + /* At this point, uncompr is still mostly zeroes, so it should compress + * very well: + */ + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + if (c_stream.avail_in != 0) { + fprintf(stderr, "deflate not greedy\n"); + exit(1); + } + + /* Feed in already compressed data and switch to no compression: */ + deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); + c_stream.next_in = compr; + c_stream.avail_in = (uInt)comprLen/2; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + /* Switch back to compressing mode: */ + deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with large buffers + */ +void test_large_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = zalloc; + d_stream.zfree = zfree; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + for (;;) { + d_stream.next_out = uncompr; /* discard the output */ + d_stream.avail_out = (uInt)uncomprLen; + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "large inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (d_stream.total_out != 2*uncomprLen + comprLen/2) { + fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); + exit(1); + } else { + printf("large_inflate(): OK\n"); + } +} + +/* =========================================================================== + * Test deflate() with full flush + */ +void test_flush(compr, comprLen) + Byte *compr; + uLong *comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + uInt len = (uInt)strlen(hello)+1; + + c_stream.zalloc = zalloc; + c_stream.zfree = zfree; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + c_stream.avail_in = 3; + c_stream.avail_out = (uInt)*comprLen; + err = deflate(&c_stream, Z_FULL_FLUSH); + CHECK_ERR(err, "deflate"); + + compr[3]++; /* force an error in first compressed block */ + c_stream.avail_in = len - 3; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + CHECK_ERR(err, "deflate"); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); + + *comprLen = c_stream.total_out; +} + +/* =========================================================================== + * Test inflateSync() + */ +void test_sync(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = zalloc; + d_stream.zfree = zfree; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 2; /* just read the zlib header */ + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + inflate(&d_stream, Z_NO_FLUSH); + CHECK_ERR(err, "inflate"); + + d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ + err = inflateSync(&d_stream); /* but skip the damaged part */ + CHECK_ERR(err, "inflateSync"); + + err = inflate(&d_stream, Z_FINISH); + if (err != Z_DATA_ERROR) { + fprintf(stderr, "inflate should report DATA_ERROR\n"); + /* Because of incorrect adler32 */ + exit(1); + } + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + printf("after inflateSync(): hel%s\n", (char *)uncompr); +} + +/* =========================================================================== + * Test deflate() with preset dictionary + */ +void test_dict_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = zalloc; + c_stream.zfree = zfree; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + err = deflateSetDictionary(&c_stream, + (const Bytef*)dictionary, (int)sizeof(dictionary)); + CHECK_ERR(err, "deflateSetDictionary"); + + dictId = c_stream.adler; + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + c_stream.next_in = (Bytef*)hello; + c_stream.avail_in = (uInt)strlen(hello)+1; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with a preset dictionary + */ +void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = zalloc; + d_stream.zfree = zfree; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + for (;;) { + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + if (err == Z_NEED_DICT) { + if (d_stream.adler != dictId) { + fprintf(stderr, "unexpected dictionary"); + exit(1); + } + err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, + (int)sizeof(dictionary)); + } + CHECK_ERR(err, "inflate with dict"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate with dict\n"); + exit(1); + } else { + printf("inflate with dictionary: %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Usage: example [output.gz [input.gz]] + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + Byte *compr, *uncompr; + uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ + uLong uncomprLen = comprLen; + static const char* myVersion = ZLIB_VERSION; + + if (zlibVersion()[0] != myVersion[0]) { + fprintf(stderr, "incompatible zlib version\n"); + exit(1); + + } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { + fprintf(stderr, "warning: different zlib version\n"); + } + + printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", + ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); + + compr = (Byte*)calloc((uInt)comprLen, 1); + uncompr = (Byte*)calloc((uInt)uncomprLen, 1); + /* compr and uncompr are cleared to avoid reading uninitialized + * data and to ensure that uncompr compresses well. + */ + if (compr == Z_NULL || uncompr == Z_NULL) { + printf("out of memory\n"); + exit(1); + } + +#ifdef Z_SOLO + argc = strlen(argv[0]); +#else + test_compress(compr, comprLen, uncompr, uncomprLen); + + test_gzio((argc > 1 ? argv[1] : TESTFILE), + uncompr, uncomprLen); +#endif + + test_deflate(compr, comprLen); + test_inflate(compr, comprLen, uncompr, uncomprLen); + + test_large_deflate(compr, comprLen, uncompr, uncomprLen); + test_large_inflate(compr, comprLen, uncompr, uncomprLen); + + test_flush(compr, &comprLen); + test_sync(compr, comprLen, uncompr, uncomprLen); + comprLen = uncomprLen; + + test_dict_deflate(compr, comprLen); + test_dict_inflate(compr, comprLen, uncompr, uncomprLen); + + free(compr); + free(uncompr); + + return 0; +} Added: vendor/libz/test/infcover.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libz/test/infcover.c Tue Jun 19 05:55:56 2012 (r237252) @@ -0,0 +1,671 @@ +/* infcover.c -- test zlib's inflate routines with full code coverage + * Copyright (C) 2011 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* to use, do: ./configure --cover && make cover */ + +#include +#include +#include +#include +#include "zlib.h" + +/* get definition of internal structure so we can mess with it (see pull()), + and so we can call inflate_trees() (see cover5()) */ +#define ZLIB_INTERNAL +#include "inftrees.h" +#include "inflate.h" + +#define local static + +/* -- memory tracking routines -- */ + +/* + These memory tracking routines are provided to zlib and track all of zlib's + allocations and deallocations, check for LIFO operations, keep a current + and high water mark of total bytes requested, optionally set a limit on the + total memory that can be allocated, and when done check for memory leaks. + + They are used as follows: + + z_stream strm; + mem_setup(&strm) initializes the memory tracking and sets the + zalloc, zfree, and opaque members of strm to use + memory tracking for all zlib operations on strm + mem_limit(&strm, limit) sets a limit on the total bytes requested -- a + request that exceeds this limit will result in an + allocation failure (returns NULL) -- setting the + limit to zero means no limit, which is the default + after mem_setup() + mem_used(&strm, "msg") prints to stderr "msg" and the total bytes used + mem_high(&strm, "msg") prints to stderr "msg" and the high water mark + mem_done(&strm, "msg") ends memory tracking, releases all allocations + for the tracking as well as leaked zlib blocks, if + any. If there was anything unusual, such as leaked + blocks, non-FIFO frees, or frees of addresses not + allocated, then "msg" and information about the + problem is printed to stderr. If everything is + normal, nothing is printed. mem_done resets the + strm members to Z_NULL to use the default memory + allocation routines on the next zlib initialization + using strm. + */ + +/* these items are strung together in a linked list, one for each allocation */ +struct mem_item { + void *ptr; /* pointer to allocated memory */ + size_t size; /* requested size of allocation */ + struct mem_item *next; /* pointer to next item in list, or NULL */ +}; + +/* this structure is at the root of the linked list, and tracks statistics */ +struct mem_zone { + struct mem_item *first; /* pointer to first item in list, or NULL */ + size_t total, highwater; /* total allocations, and largest total */ + size_t limit; /* memory allocation limit, or 0 if no limit */ + int notlifo, rogue; /* counts of non-LIFO frees and rogue frees */ +}; + +/* memory allocation routine to pass to zlib */ +local void *mem_alloc(void *mem, unsigned count, unsigned size) +{ + void *ptr; + struct mem_item *item; + struct mem_zone *zone = mem; + size_t len = count * (size_t)size; + + /* induced allocation failure */ + if (zone == NULL || (zone->limit && zone->total + len > zone->limit)) + return NULL; + + /* perform allocation using the standard library, fill memory with a + non-zero value to make sure that the code isn't depending on zeros */ + ptr = malloc(len); + if (ptr == NULL) + return NULL; + memset(ptr, 0xa5, len); + + /* create a new item for the list */ + item = malloc(sizeof(struct mem_item)); + if (item == NULL) { + free(ptr); + return NULL; + } + item->ptr = ptr; + item->size = len; + + /* insert item at the beginning of the list */ + item->next = zone->first; + zone->first = item; + + /* update the statistics */ + zone->total += item->size; + if (zone->total > zone->highwater) + zone->highwater = zone->total; + + /* return the allocated memory */ + return ptr; +} + +/* memory free routine to pass to zlib */ +local void mem_free(void *mem, void *ptr) +{ + struct mem_item *item, *next; + struct mem_zone *zone = mem; + + /* if no zone, just do a free */ + if (zone == NULL) { + free(ptr); + return; + } + + /* point next to the item that matches ptr, or NULL if not found -- remove + the item from the linked list if found */ + next = zone->first; + if (next) { + if (next->ptr == ptr) + zone->first = next->next; /* first one is it, remove from list */ + else { + do { /* search the linked list */ + item = next; + next = item->next; + } while (next != NULL && next->ptr != ptr); + if (next) { /* if found, remove from linked list */ + item->next = next->next; + zone->notlifo++; /* not a LIFO free */ + } + + } + } + + /* if found, update the statistics and free the item */ + if (next) { + zone->total -= next->size; + free(next); + } + + /* if not found, update the rogue count */ + else + zone->rogue++; + + /* in any case, do the requested free with the standard library function */ + free(ptr); +} + +/* set up a controlled memory allocation space for monitoring, set the stream + parameters to the controlled routines, with opaque pointing to the space */ +local void mem_setup(z_stream *strm) +{ + struct mem_zone *zone; + + zone = malloc(sizeof(struct mem_zone)); + assert(zone != NULL); + zone->first = NULL; + zone->total = 0; + zone->highwater = 0; + zone->limit = 0; + zone->notlifo = 0; + zone->rogue = 0; + strm->opaque = zone; + strm->zalloc = mem_alloc; + strm->zfree = mem_free; +} + +/* set a limit on the total memory allocation, or 0 to remove the limit */ +local void mem_limit(z_stream *strm, size_t limit) +{ + struct mem_zone *zone = strm->opaque; + + zone->limit = limit; +} + +/* show the current total requested allocations in bytes */ +local void mem_used(z_stream *strm, char *prefix) +{ + struct mem_zone *zone = strm->opaque; + + fprintf(stderr, "%s: %lu allocated\n", prefix, zone->total); +} + +/* show the high water allocation in bytes */ +local void mem_high(z_stream *strm, char *prefix) +{ + struct mem_zone *zone = strm->opaque; + + fprintf(stderr, "%s: %lu high water mark\n", prefix, zone->highwater); +} + +/* release the memory allocation zone -- if there are any surprises, notify */ +local void mem_done(z_stream *strm, char *prefix) +{ + int count = 0; + struct mem_item *item, *next; + struct mem_zone *zone = strm->opaque; + + /* show high water mark */ + mem_high(strm, prefix); + + /* free leftover allocations and item structures, if any */ + item = zone->first; + while (item != NULL) { + free(item->ptr); + next = item->next; + free(item); + item = next; + count++; + } + + /* issue alerts about anything unexpected */ + if (count || zone->total) + fprintf(stderr, "** %s: %lu bytes in %d blocks not freed\n", + prefix, zone->total, count); + if (zone->notlifo) + fprintf(stderr, "** %s: %d frees not LIFO\n", prefix, zone->notlifo); + if (zone->rogue) + fprintf(stderr, "** %s: %d frees not recognized\n", + prefix, zone->rogue); + + /* free the zone and delete from the stream */ + free(zone); + strm->opaque = Z_NULL; + strm->zalloc = Z_NULL; + strm->zfree = Z_NULL; +} + +/* -- inflate test routines -- */ + +/* Decode a hexadecimal string, set *len to length, in[] to the bytes. This + decodes liberally, in that hex digits can be adjacent, in which case two in + a row writes a byte. Or they can delimited by any non-hex character, where + the delimiters are ignored except when a single hex digit is followed by a + delimiter in which case that single digit writes a byte. The returned + data is allocated and must eventually be freed. NULL is returned if out of + memory. If the length is not needed, then len can be NULL. */ +local unsigned char *h2b(const char *hex, unsigned *len) +{ + unsigned char *in; + unsigned next, val; + + in = malloc((strlen(hex) + 1) >> 1); + if (in == NULL) + return NULL; + next = 0; + val = 1; + do { + if (*hex >= '0' && *hex <= '9') + val = (val << 4) + *hex - '0'; + else if (*hex >= 'A' && *hex <= 'F') + val = (val << 4) + *hex - 'A' + 10; + else if (*hex >= 'a' && *hex <= 'f') + val = (val << 4) + *hex - 'a' + 10; + else if (val != 1 && val < 32) /* one digit followed by delimiter */ + val += 240; /* make it look like two digits */ + if (val > 255) { /* have two digits */ + in[next++] = val & 0xff; /* save the decoded byte */ + val = 1; /* start over */ + } + } while (*hex++); /* go through the loop with the terminating null */ + if (len != NULL) + *len = next; + in = reallocf(in, next); + return in; +} + +/* generic inflate() run, where hex is the hexadecimal input data, what is the + text to include in an error message, step is how much input data to feed + inflate() on each call, or zero to feed it all, win is the window bits + parameter to inflateInit2(), len is the size of the output buffer, and err + is the error code expected from the first inflate() call (the second + inflate() call is expected to return Z_STREAM_END). If win is 47, then + header information is collected with inflateGetHeader(). If a zlib stream + is looking for a dictionary, then an empty dictionary is provided. + inflate() is run until all of the input data is consumed. */ +local void inf(char *hex, char *what, unsigned step, int win, unsigned len, + int err) +{ + int ret; + unsigned have; + unsigned char *in, *out; + z_stream strm, copy; + gz_header head; + + mem_setup(&strm); + strm.avail_in = 0; + strm.next_in = Z_NULL; + ret = inflateInit2(&strm, win); + if (ret != Z_OK) { + mem_done(&strm, what); + return; + } + out = malloc(len); assert(out != NULL); + if (win == 47) { + head.extra = out; + head.extra_max = len; + head.name = out; + head.name_max = len; + head.comment = out; + head.comm_max = len; + ret = inflateGetHeader(&strm, &head); assert(ret == Z_OK); + } + in = h2b(hex, &have); assert(in != NULL); + if (step == 0 || step > have) + step = have; + strm.avail_in = step; + have -= step; + strm.next_in = in; + do { + strm.avail_out = len; + strm.next_out = out; + ret = inflate(&strm, Z_NO_FLUSH); assert(err == 9 || ret == err); + if (ret != Z_OK && ret != Z_BUF_ERROR && ret != Z_NEED_DICT) + break; + if (ret == Z_NEED_DICT) { + ret = inflateSetDictionary(&strm, in, 1); + assert(ret == Z_DATA_ERROR); + mem_limit(&strm, 1); + ret = inflateSetDictionary(&strm, out, 0); + assert(ret == Z_MEM_ERROR); + mem_limit(&strm, 0); + ((struct inflate_state *)strm.state)->mode = DICT; + ret = inflateSetDictionary(&strm, out, 0); + assert(ret == Z_OK); + ret = inflate(&strm, Z_NO_FLUSH); assert(ret == Z_BUF_ERROR); + } + ret = inflateCopy(©, &strm); assert(ret == Z_OK); + ret = inflateEnd(©); assert(ret == Z_OK); + err = 9; /* don't care next time around */ + have += strm.avail_in; + strm.avail_in = step > have ? have : step; + have -= strm.avail_in; + } while (strm.avail_in); + free(in); + free(out); + ret = inflateReset2(&strm, -8); assert(ret == Z_OK); + ret = inflateEnd(&strm); assert(ret == Z_OK); + mem_done(&strm, what); +} + +/* cover all of the lines in inflate.c up to inflate() */ +local void cover_support(void) +{ + int ret; + z_stream strm; + + mem_setup(&strm); + strm.avail_in = 0; + strm.next_in = Z_NULL; + ret = inflateInit(&strm); assert(ret == Z_OK); + mem_used(&strm, "inflate init"); + ret = inflatePrime(&strm, 5, 31); assert(ret == Z_OK); + ret = inflatePrime(&strm, -1, 0); assert(ret == Z_OK); + ret = inflateSetDictionary(&strm, Z_NULL, 0); + assert(ret == Z_STREAM_ERROR); + ret = inflateEnd(&strm); assert(ret == Z_OK); + mem_done(&strm, "prime"); + + inf("63 0", "force window allocation", 0, -15, 1, Z_OK); + inf("63 18 5", "force window replacement", 0, -8, 259, Z_OK); + inf("63 18 68 30 d0 0 0", "force split window update", 4, -8, 259, Z_OK); + inf("3 0", "use fixed blocks", 0, -15, 1, Z_STREAM_END); + inf("", "bad window size", 0, 1, 0, Z_STREAM_ERROR); + + mem_setup(&strm); + strm.avail_in = 0; + strm.next_in = Z_NULL; + ret = inflateInit_(&strm, ZLIB_VERSION - 1, (int)sizeof(z_stream)); + assert(ret == Z_VERSION_ERROR); + mem_done(&strm, "wrong version"); + + strm.avail_in = 0; + strm.next_in = Z_NULL; + ret = inflateInit(&strm); assert(ret == Z_OK); + ret = inflateEnd(&strm); assert(ret == Z_OK); + fputs("inflate built-in memory routines\n", stderr); +} + +/* cover all inflate() header and trailer cases and code after inflate() */ +local void cover_wrap(void) +{ + int ret; + z_stream strm, copy; + unsigned char dict[257]; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:09:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 746CC1065670; Tue, 19 Jun 2012 06:09:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A5FF8FC0C; Tue, 19 Jun 2012 06:09:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J69lUo024778; Tue, 19 Jun 2012 06:09:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J69lCj024775; Tue, 19 Jun 2012 06:09:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206190609.q5J69lCj024775@svn.freebsd.org> From: Eitan Adler Date: Tue, 19 Jun 2012 06:09:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237253 - head/usr.sbin/bsdinstall/partedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:09:48 -0000 Author: eadler Date: Tue Jun 19 06:09:47 2012 New Revision: 237253 URL: http://svn.freebsd.org/changeset/base/237253 Log: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva MFC After: 3 days Modified: head/usr.sbin/bsdinstall/partedit/diskeditor.c head/usr.sbin/bsdinstall/partedit/part_wizard.c Modified: head/usr.sbin/bsdinstall/partedit/diskeditor.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/diskeditor.c Tue Jun 19 05:55:56 2012 (r237252) +++ head/usr.sbin/bsdinstall/partedit/diskeditor.c Tue Jun 19 06:09:47 2012 (r237253) @@ -74,7 +74,7 @@ diskeditor_show(const char *title, const int x, y; int i; int height, width, min_width; - int partlist_height, partlist_width, min_partlist_width; + int partlist_height, partlist_width; int cur_scroll = 0; int key, fkey; int cur_button = 0, cur_part = 0; @@ -102,7 +102,6 @@ diskeditor_show(const char *title, const min_width = 50; height = width = 0; partlist_height = 10; - min_partlist_width = 0; dlg_tab_correct_str(prompt); dlg_button_layout(buttons, &min_width); dlg_auto_size(title, prompt, &height, &width, 2, min_width); Modified: head/usr.sbin/bsdinstall/partedit/part_wizard.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/part_wizard.c Tue Jun 19 05:55:56 2012 (r237252) +++ head/usr.sbin/bsdinstall/partedit/part_wizard.c Tue Jun 19 06:09:47 2012 (r237253) @@ -294,8 +294,6 @@ wizard_makeparts(struct gmesh *mesh, con struct gmesh submesh; struct gclass *classp; struct ggeom *gp; - struct gconfig *gc; - const char *scheme; struct gprovider *pp; intmax_t swapsize, available; char swapsizestr[10], rootsizestr[10]; @@ -309,10 +307,6 @@ wizard_makeparts(struct gmesh *mesh, con if (strcmp(gp->lg_name, disk) == 0) break; - LIST_FOREACH(gc, &gp->lg_config, lg_config) - if (strcmp(gc->lg_name, "scheme") == 0) - scheme = gc->lg_val; - pp = provider_for_name(mesh, disk); available = gpart_max_free(gp, NULL)*pp->lg_sectorsize; From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:09:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78F6210657A6; Tue, 19 Jun 2012 06:09:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 647778FC12; Tue, 19 Jun 2012 06:09:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J69xQN024823; Tue, 19 Jun 2012 06:09:59 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J69xR9024821; Tue, 19 Jun 2012 06:09:59 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206190609.q5J69xR9024821@svn.freebsd.org> From: Eitan Adler Date: Tue, 19 Jun 2012 06:09:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237254 - head/usr.sbin/crunch/crunchide X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:09:59 -0000 Author: eadler Date: Tue Jun 19 06:09:58 2012 New Revision: 237254 URL: http://svn.freebsd.org/changeset/base/237254 Log: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva MFC After: 3 days Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- head/usr.sbin/crunch/crunchide/exec_elf32.c Tue Jun 19 06:09:47 2012 (r237253) +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Tue Jun 19 06:09:58 2012 (r237254) @@ -238,7 +238,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr; Elf_Sym *symtabp = NULL; char *strtabp = NULL; - Elf_Size nsyms, nlocalsyms, ewi; + Elf_Size nsyms, ewi; ssize_t shdrsize; int rv, i, weird; size_t nstrtab_size, nstrtab_nextoff, fn_size; @@ -327,7 +327,6 @@ ELFNAMEEND(hide)(int fd, const char *fn) /* Prepare data structures for symbol movement. */ nsyms = xewtoh(symtabshdr->sh_size) / xewtoh(symtabshdr->sh_entsize); - nlocalsyms = xe32toh(symtabshdr->sh_info); /* move symbols, making them local */ for (ewi = 0; ewi < nsyms; ewi++) { From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:10:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FC3B1065866; Tue, 19 Jun 2012 06:10:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AA358FC08; Tue, 19 Jun 2012 06:10:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J6AOkD024881; Tue, 19 Jun 2012 06:10:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J6AOGf024879; Tue, 19 Jun 2012 06:10:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206190610.q5J6AOGf024879@svn.freebsd.org> From: Eitan Adler Date: Tue, 19 Jun 2012 06:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237255 - head/usr.sbin/ctladm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:10:25 -0000 Author: eadler Date: Tue Jun 19 06:10:24 2012 New Revision: 237255 URL: http://svn.freebsd.org/changeset/base/237255 Log: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva MFC After: 3 days Modified: head/usr.sbin/ctladm/ctladm.c Modified: head/usr.sbin/ctladm/ctladm.c ============================================================================== --- head/usr.sbin/ctladm/ctladm.c Tue Jun 19 06:09:58 2012 (r237254) +++ head/usr.sbin/ctladm/ctladm.c Tue Jun 19 06:10:24 2012 (r237255) @@ -772,7 +772,6 @@ static int cctl_delay(int fd, int target, int lun, int argc, char **argv, char *combinedopt) { - int datamove_delay; struct ctl_io_delay_info delay_info; char *delayloc = NULL; char *delaytype = NULL; @@ -781,7 +780,6 @@ cctl_delay(int fd, int target, int lun, int c; retval = 0; - datamove_delay = 0; memset(&delay_info, 0, sizeof(delay_info)); @@ -3803,7 +3801,7 @@ CTL_DEFAULT_DEV); int main(int argc, char **argv) { - int option_index, c; + int c; ctladm_cmdfunction command; ctladm_cmdargs cmdargs; ctladm_optret optreturn; @@ -3814,10 +3812,9 @@ main(int argc, char **argv) int target, lun; int optstart = 2; int retval, fd; - int retries, timeout; + int retries; int initid; - option_index = 0; retval = 0; cmdargs = CTLADM_ARG_NONE; command = CTLADM_CMD_HELP; @@ -3826,7 +3823,6 @@ main(int argc, char **argv) retries = 0; target = 0; lun = 0; - timeout = 0; initid = 7; if (argc < 2) { From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:10:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CD7D106585B; Tue, 19 Jun 2012 06:10:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6821B8FC0A; Tue, 19 Jun 2012 06:10:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J6ASII024922; Tue, 19 Jun 2012 06:10:28 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J6ASoq024920; Tue, 19 Jun 2012 06:10:28 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206190610.q5J6ASoq024920@svn.freebsd.org> From: Eitan Adler Date: Tue, 19 Jun 2012 06:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237256 - head/usr.sbin/ifmcstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:10:28 -0000 Author: eadler Date: Tue Jun 19 06:10:27 2012 New Revision: 237256 URL: http://svn.freebsd.org/changeset/base/237256 Log: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva MFC After: 3 days Modified: head/usr.sbin/ifmcstat/ifmcstat.c Modified: head/usr.sbin/ifmcstat/ifmcstat.c ============================================================================== --- head/usr.sbin/ifmcstat/ifmcstat.c Tue Jun 19 06:10:24 2012 (r237255) +++ head/usr.sbin/ifmcstat/ifmcstat.c Tue Jun 19 06:10:27 2012 (r237256) @@ -387,7 +387,6 @@ ll_addrlist(struct ifaddr *ifap) struct sockaddr sa; struct sockaddr_dl sdl; struct ifaddr *ifap0; - int error; if (af && af != AF_LINK) return; @@ -404,7 +403,7 @@ ll_addrlist(struct ifaddr *ifap) if (sdl.sdl_alen == 0) goto nextifap; addrbuf[0] = '\0'; - error = getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, + getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, addrbuf, sizeof(addrbuf), NULL, 0, NI_NUMERICHOST); printf("\tlink %s\n", addrbuf); nextifap: @@ -427,7 +426,7 @@ ll_addrlist(struct ifaddr *ifap) goto nextmulti; KREAD(ifm.ifma_addr, &sdl, struct sockaddr_dl); addrbuf[0] = '\0'; - error = getnameinfo((struct sockaddr *)&sdl, + getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, addrbuf, sizeof(addrbuf), NULL, 0, NI_NUMERICHOST); printf("\t\tgroup %s refcnt %d\n", From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:10:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5EEC910656D9; Tue, 19 Jun 2012 06:10:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 960CA8FC15; Tue, 19 Jun 2012 06:10:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J6AVru024966; Tue, 19 Jun 2012 06:10:31 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J6AV3k024964; Tue, 19 Jun 2012 06:10:31 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206190610.q5J6AV3k024964@svn.freebsd.org> From: Eitan Adler Date: Tue, 19 Jun 2012 06:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237257 - head/usr.sbin/kbdmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:10:33 -0000 Author: eadler Date: Tue Jun 19 06:10:31 2012 New Revision: 237257 URL: http://svn.freebsd.org/changeset/base/237257 Log: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva MFC After: 3 days Modified: head/usr.sbin/kbdmap/kbdmap.c Modified: head/usr.sbin/kbdmap/kbdmap.c ============================================================================== --- head/usr.sbin/kbdmap/kbdmap.c Tue Jun 19 06:10:27 2012 (r237256) +++ head/usr.sbin/kbdmap/kbdmap.c Tue Jun 19 06:10:31 2012 (r237257) @@ -327,7 +327,6 @@ show_dialog(struct keymap **km_sorted, i FILE *fp; char *cmd, *dialog; char tmp_name[] = "/tmp/_kbd_lang.XXXX"; - const char *ext; int fd, i, size; fd = mkstemp(tmp_name); @@ -339,8 +338,6 @@ show_dialog(struct keymap **km_sorted, i asprintf(&dialog, "/usr/bin/dialog --clear --title \"Keyboard Menu\" " "--menu \"%s\" 0 0 0", menu); - ext = extract_name(dir); - /* start right font, assume that current font is equal * to default font in /etc/rc.conf * From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:10:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D719E1065784; Tue, 19 Jun 2012 06:10:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD88F8FC18; Tue, 19 Jun 2012 06:10:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J6AYA6025005; Tue, 19 Jun 2012 06:10:34 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J6AYMu025003; Tue, 19 Jun 2012 06:10:34 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206190610.q5J6AYMu025003@svn.freebsd.org> From: Eitan Adler Date: Tue, 19 Jun 2012 06:10:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237258 - head/usr.sbin/kldxref X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:10:35 -0000 Author: eadler Date: Tue Jun 19 06:10:34 2012 New Revision: 237258 URL: http://svn.freebsd.org/changeset/base/237258 Log: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva MFC After: 3 days Modified: head/usr.sbin/kldxref/ef.c Modified: head/usr.sbin/kldxref/ef.c ============================================================================== --- head/usr.sbin/kldxref/ef.c Tue Jun 19 06:10:31 2012 (r237257) +++ head/usr.sbin/kldxref/ef.c Tue Jun 19 06:10:34 2012 (r237258) @@ -532,7 +532,7 @@ ef_open(const char *filename, struct elf int error; int phlen, res; int nsegs; - Elf_Phdr *phdr, *phdyn, *phphdr, *phlimit; + Elf_Phdr *phdr, *phdyn, *phlimit; if (filename == NULL) return EFTYPE; @@ -576,7 +576,6 @@ ef_open(const char *filename, struct elf phlimit = phdr + hdr->e_phnum; nsegs = 0; phdyn = NULL; - phphdr = NULL; while (phdr < phlimit) { if (verbose > 1) ef_print_phdr(phdr); @@ -590,7 +589,6 @@ ef_open(const char *filename, struct elf ef->ef_segs[nsegs++] = phdr; break; case PT_PHDR: - phphdr = phdr; break; case PT_DYNAMIC: phdyn = phdr; From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:18:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 142D01065670; Tue, 19 Jun 2012 06:18:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1B2E8FC1D; Tue, 19 Jun 2012 06:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J6IbPX025386; Tue, 19 Jun 2012 06:18:37 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J6IbCe025374; Tue, 19 Jun 2012 06:18:37 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206190618.q5J6IbCe025374@svn.freebsd.org> From: Eitan Adler Date: Tue, 19 Jun 2012 06:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237259 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:18:38 -0000 Author: eadler Date: Tue Jun 19 06:18:37 2012 New Revision: 237259 URL: http://svn.freebsd.org/changeset/base/237259 Log: Allow users with RO privilege to the device to read the RO attributes. PR: bin/167302 Submitted by: markham breitbach Discussed with: pjd (briefly) Approved by: cperciva MFC after: 1 week Modified: head/usr.sbin/mfiutil/mfi_cmd.c head/usr.sbin/mfiutil/mfi_config.c head/usr.sbin/mfiutil/mfi_drive.c head/usr.sbin/mfiutil/mfi_evt.c head/usr.sbin/mfiutil/mfi_flash.c head/usr.sbin/mfiutil/mfi_patrol.c head/usr.sbin/mfiutil/mfi_show.c head/usr.sbin/mfiutil/mfi_volume.c head/usr.sbin/mfiutil/mfiutil.c head/usr.sbin/mfiutil/mfiutil.h Modified: head/usr.sbin/mfiutil/mfi_cmd.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_cmd.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfi_cmd.c Tue Jun 19 06:18:37 2012 (r237259) @@ -301,12 +301,12 @@ mfi_ctrl_get_info(int fd, struct mfi_ctr } int -mfi_open(int unit) +mfi_open(int unit, int acs) { char path[MAXPATHLEN]; snprintf(path, sizeof(path), "/dev/mfi%d", unit); - return (open(path, O_RDWR)); + return (open(path, acs)); } void Modified: head/usr.sbin/mfiutil/mfi_config.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_config.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfi_config.c Tue Jun 19 06:18:37 2012 (r237259) @@ -35,6 +35,7 @@ #endif #include #include +#include #include #ifdef DEBUG #include @@ -157,7 +158,7 @@ clear_config(int ac, char **av) int ch, error, fd; u_int i; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -575,7 +576,7 @@ create_volume(int ac, char **av) narrays = 0; error = 0; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -857,7 +858,7 @@ delete_volume(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -925,7 +926,7 @@ add_spare(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1050,7 +1051,7 @@ remove_spare(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1196,7 +1197,7 @@ debug_config(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1233,7 +1234,7 @@ dump(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: head/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_drive.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfi_drive.c Tue Jun 19 06:18:37 2012 (r237259) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,7 @@ mfi_drive_name(struct mfi_pd_info *pinfo else snprintf(buf, sizeof(buf), "%2u", device_id); - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { warn("mfi_open"); return (buf); @@ -383,7 +384,7 @@ drive_set_state(char *drive, uint16_t ne uint8_t mbox[6]; int error, fd; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -484,7 +485,7 @@ start_rebuild(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -541,7 +542,7 @@ abort_rebuild(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -597,7 +598,7 @@ drive_progress(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -663,7 +664,7 @@ drive_clear(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -723,7 +724,7 @@ drive_locate(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: head/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_evt.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfi_evt.c Tue Jun 19 06:18:37 2012 (r237259) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -73,7 +74,7 @@ show_logstate(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -541,7 +542,7 @@ show_events(int ac, char **av) int ch, error, fd, num_events, verbose; u_int i; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: head/usr.sbin/mfiutil/mfi_flash.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_flash.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfi_flash.c Tue Jun 19 06:18:37 2012 (r237259) @@ -150,7 +150,7 @@ flash_adapter(int ac, char **av) goto error; } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: head/usr.sbin/mfiutil/mfi_patrol.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_patrol.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfi_patrol.c Tue Jun 19 06:18:37 2012 (r237259) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -86,7 +87,7 @@ show_patrol(int ac, char **av) int error, fd; u_int i; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -196,7 +197,7 @@ start_patrol(int ac, char **av) { int error, fd; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -222,7 +223,7 @@ stop_patrol(int ac, char **av) { int error, fd; - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -292,7 +293,7 @@ patrol_config(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); Modified: head/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_show.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfi_show.c Tue Jun 19 06:18:37 2012 (r237259) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -61,7 +62,7 @@ show_adapter(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -148,7 +149,7 @@ show_battery(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -320,7 +321,7 @@ show_config(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -421,7 +422,7 @@ show_volumes(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -504,7 +505,7 @@ show_drives(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -612,7 +613,7 @@ show_firmware(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -672,7 +673,7 @@ show_progress(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); Modified: head/usr.sbin/mfiutil/mfi_volume.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_volume.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfi_volume.c Tue Jun 19 06:18:37 2012 (r237259) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -294,7 +295,7 @@ volume_cache(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -402,7 +403,7 @@ volume_name(int ac, char **av) return (ENOSPC); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -453,7 +454,7 @@ volume_progress(int ac, char **av) return (EINVAL); } - fd = mfi_open(mfi_unit); + fd = mfi_open(mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); Modified: head/usr.sbin/mfiutil/mfiutil.c ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.c Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfiutil.c Tue Jun 19 06:18:37 2012 (r237259) @@ -95,7 +95,7 @@ static int version(int ac, char **av) { - printf("mfiutil version 1.0.13"); + printf("mfiutil version 1.0.14"); #ifdef DEBUG printf(" (DEBUG)"); #endif Modified: head/usr.sbin/mfiutil/mfiutil.h ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.h Tue Jun 19 06:10:34 2012 (r237258) +++ head/usr.sbin/mfiutil/mfiutil.h Tue Jun 19 06:18:37 2012 (r237259) @@ -139,7 +139,7 @@ int mfi_lookup_drive(int fd, char *drive int mfi_lookup_volume(int fd, const char *name, uint8_t *target_id); int mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize, uint8_t *mbox, size_t mboxlen, uint8_t *statusp); -int mfi_open(int unit); +int mfi_open(int unit, int acs); int mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp); int mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info, uint8_t *statusp); From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:18:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2327C106564A; Tue, 19 Jun 2012 06:18:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 043D48FC1B; Tue, 19 Jun 2012 06:18:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J6IgHb025430; Tue, 19 Jun 2012 06:18:42 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J6Ig7W025423; Tue, 19 Jun 2012 06:18:42 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206190618.q5J6Ig7W025423@svn.freebsd.org> From: Eitan Adler Date: Tue, 19 Jun 2012 06:18:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237260 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:18:43 -0000 Author: eadler Date: Tue Jun 19 06:18:42 2012 New Revision: 237260 URL: http://svn.freebsd.org/changeset/base/237260 Log: Add __unused macros to appropriate places in order to allow building with WARNS=6 on base gcc, gcc46, and clang Approved by: cperciva MFC after: 1 week Modified: head/usr.sbin/mfiutil/Makefile head/usr.sbin/mfiutil/mfi_config.c head/usr.sbin/mfiutil/mfi_evt.c head/usr.sbin/mfiutil/mfi_patrol.c head/usr.sbin/mfiutil/mfi_show.c head/usr.sbin/mfiutil/mfiutil.c Modified: head/usr.sbin/mfiutil/Makefile ============================================================================== --- head/usr.sbin/mfiutil/Makefile Tue Jun 19 06:18:37 2012 (r237259) +++ head/usr.sbin/mfiutil/Makefile Tue Jun 19 06:18:42 2012 (r237260) @@ -6,7 +6,6 @@ SRCS= mfiutil.c mfi_cmd.c mfi_config.c m MAN8= mfiutil.8 CFLAGS+= -fno-builtin-strftime -WARNS?=3 DPADD= ${LIBUTIL} LDADD= -lutil Modified: head/usr.sbin/mfiutil/mfi_config.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_config.c Tue Jun 19 06:18:37 2012 (r237259) +++ head/usr.sbin/mfiutil/mfi_config.c Tue Jun 19 06:18:42 2012 (r237260) @@ -152,7 +152,7 @@ mfi_config_lookup_volume(struct mfi_conf } static int -clear_config(int ac, char **av) +clear_config(int ac __unused, char **av __unused) { struct mfi_ld_list list; int ch, error, fd; @@ -411,7 +411,7 @@ find_next_volume(struct config_id_state /* Populate an array with drives. */ static void -build_array(int fd, char *arrayp, struct array_info *array_info, +build_array(int fd __unused, char *arrayp, struct array_info *array_info, struct config_id_state *state, int verbose) { struct mfi_array *ar = (struct mfi_array *)arrayp; Modified: head/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_evt.c Tue Jun 19 06:18:37 2012 (r237259) +++ head/usr.sbin/mfiutil/mfi_evt.c Tue Jun 19 06:18:42 2012 (r237260) @@ -64,7 +64,7 @@ mfi_get_events(int fd, struct mfi_evt_li } static int -show_logstate(int ac, char **av) +show_logstate(int ac, char **av __unused) { struct mfi_evt_log_state info; int error, fd; Modified: head/usr.sbin/mfiutil/mfi_patrol.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_patrol.c Tue Jun 19 06:18:37 2012 (r237259) +++ head/usr.sbin/mfiutil/mfi_patrol.c Tue Jun 19 06:18:42 2012 (r237260) @@ -75,7 +75,7 @@ patrol_get_props(int fd, struct mfi_pr_p } static int -show_patrol(int ac, char **av) +show_patrol(int ac __unused, char **av __unused) { struct mfi_pr_properties prop; struct mfi_pr_status status; @@ -193,7 +193,7 @@ show_patrol(int ac, char **av) MFI_COMMAND(show, patrol, show_patrol); static int -start_patrol(int ac, char **av) +start_patrol(int ac __unused, char **av __unused) { int error, fd; @@ -219,7 +219,7 @@ start_patrol(int ac, char **av) MFI_COMMAND(start, patrol, start_patrol); static int -stop_patrol(int ac, char **av) +stop_patrol(int ac __unused, char **av __unused) { int error, fd; Modified: head/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_show.c Tue Jun 19 06:18:37 2012 (r237259) +++ head/usr.sbin/mfiutil/mfi_show.c Tue Jun 19 06:18:42 2012 (r237260) @@ -51,7 +51,7 @@ format_stripe(char *buf, size_t buflen, } static int -show_adapter(int ac, char **av) +show_adapter(int ac, char **av __unused) { struct mfi_ctrl_info info; char stripe[5]; @@ -136,7 +136,7 @@ show_adapter(int ac, char **av) MFI_COMMAND(show, adapter, show_adapter); static int -show_battery(int ac, char **av) +show_battery(int ac, char **av __unused) { struct mfi_bbu_capacity_info cap; struct mfi_bbu_design_info design; @@ -304,7 +304,7 @@ print_pd(struct mfi_pd_info *info, int s } static int -show_config(int ac, char **av) +show_config(int ac, char **av __unused) { struct mfi_config_data *config; struct mfi_array *ar; @@ -410,7 +410,7 @@ show_config(int ac, char **av) MFI_COMMAND(show, config, show_config); static int -show_volumes(int ac, char **av) +show_volumes(int ac, char **av __unused) { struct mfi_ld_list list; struct mfi_ld_info info; @@ -493,7 +493,7 @@ show_volumes(int ac, char **av) MFI_COMMAND(show, volumes, show_volumes); static int -show_drives(int ac, char **av) +show_drives(int ac, char **av __unused) { struct mfi_pd_list *list; struct mfi_pd_info info; @@ -601,7 +601,7 @@ display_firmware(struct mfi_info_compone } static int -show_firmware(int ac, char **av) +show_firmware(int ac, char **av __unused) { struct mfi_ctrl_info info; struct mfi_info_component header; @@ -657,7 +657,7 @@ show_firmware(int ac, char **av) MFI_COMMAND(show, firmware, show_firmware); static int -show_progress(int ac, char **av) +show_progress(int ac, char **av __unused) { struct mfi_ld_list llist; struct mfi_pd_list *plist; Modified: head/usr.sbin/mfiutil/mfiutil.c ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.c Tue Jun 19 06:18:37 2012 (r237259) +++ head/usr.sbin/mfiutil/mfiutil.c Tue Jun 19 06:18:42 2012 (r237260) @@ -92,7 +92,7 @@ usage(void) } static int -version(int ac, char **av) +version(int ac __unused, char **av __unused) { printf("mfiutil version 1.0.14"); From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:46:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 390FF1065674; Tue, 19 Jun 2012 06:46:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0971D8FC08; Tue, 19 Jun 2012 06:46:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J6ksU4026584; Tue, 19 Jun 2012 06:46:54 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J6ksNT026580; Tue, 19 Jun 2012 06:46:54 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206190646.q5J6ksNT026580@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 19 Jun 2012 06:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237261 - stable/9/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:46:55 -0000 Author: hselasky Date: Tue Jun 19 06:46:54 2012 New Revision: 237261 URL: http://svn.freebsd.org/changeset/base/237261 Log: MFC r236944: LibUSB v1.0 API compliance and bugfixes. Modified: stable/9/lib/libusb/Makefile stable/9/lib/libusb/libusb10.c stable/9/lib/libusb/libusb10_io.c Directory Properties: stable/9/lib/libusb/ (props changed) Modified: stable/9/lib/libusb/Makefile ============================================================================== --- stable/9/lib/libusb/Makefile Tue Jun 19 06:18:42 2012 (r237260) +++ stable/9/lib/libusb/Makefile Tue Jun 19 06:46:54 2012 (r237261) @@ -18,6 +18,9 @@ NOGCCERROR= WARNS?= 2 +DPADD= ${LIBPTHREAD} +LDADD= -lpthread + MLINKS+= libusb.3 usb.3 # libusb 0.1 compat Modified: stable/9/lib/libusb/libusb10.c ============================================================================== --- stable/9/lib/libusb/libusb10.c Tue Jun 19 06:18:42 2012 (r237260) +++ stable/9/lib/libusb/libusb10.c Tue Jun 19 06:46:54 2012 (r237261) @@ -92,6 +92,7 @@ int libusb_init(libusb_context **context) { struct libusb_context *ctx; + pthread_condattr_t attr; char *debug; int ret; @@ -110,8 +111,28 @@ libusb_init(libusb_context **context) TAILQ_INIT(&ctx->pollfds); TAILQ_INIT(&ctx->tr_done); - pthread_mutex_init(&ctx->ctx_lock, NULL); - pthread_cond_init(&ctx->ctx_cond, NULL); + if (pthread_mutex_init(&ctx->ctx_lock, NULL) != 0) { + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + if (pthread_condattr_init(&attr) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + pthread_condattr_destroy(&attr); + free(ctx); + return (LIBUSB_ERROR_OTHER); + } + if (pthread_cond_init(&ctx->ctx_cond, &attr) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + pthread_condattr_destroy(&attr); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + pthread_condattr_destroy(&attr); ctx->ctx_handler = NO_THREAD; Modified: stable/9/lib/libusb/libusb10_io.c ============================================================================== --- stable/9/lib/libusb/libusb10_io.c Tue Jun 19 06:18:42 2012 (r237260) +++ stable/9/lib/libusb/libusb10_io.c Tue Jun 19 06:46:54 2012 (r237261) @@ -307,12 +307,16 @@ libusb_wait_for_event(libusb_context *ct &ctx->ctx_lock); return (0); } - err = clock_gettime(CLOCK_REALTIME, &ts); + err = clock_gettime(CLOCK_MONOTONIC, &ts); if (err < 0) return (LIBUSB_ERROR_OTHER); - ts.tv_sec = tv->tv_sec; - ts.tv_nsec = tv->tv_usec * 1000; + /* + * The "tv" arguments points to a relative time structure and + * not an absolute time structure. + */ + ts.tv_sec += tv->tv_sec; + ts.tv_nsec += tv->tv_usec * 1000; if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec++; From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 06:52:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA8AB1065672; Tue, 19 Jun 2012 06:52:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B8BE8FC12; Tue, 19 Jun 2012 06:52:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J6qLfa026852; Tue, 19 Jun 2012 06:52:21 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J6qLF2026848; Tue, 19 Jun 2012 06:52:21 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206190652.q5J6qLF2026848@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 19 Jun 2012 06:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237262 - stable/8/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 06:52:21 -0000 Author: hselasky Date: Tue Jun 19 06:52:21 2012 New Revision: 237262 URL: http://svn.freebsd.org/changeset/base/237262 Log: MFC r236944: LibUSB v1.0 API compliance and bugfixes. Modified: stable/8/lib/libusb/Makefile stable/8/lib/libusb/libusb10.c stable/8/lib/libusb/libusb10_io.c Directory Properties: stable/8/lib/libusb/ (props changed) Modified: stable/8/lib/libusb/Makefile ============================================================================== --- stable/8/lib/libusb/Makefile Tue Jun 19 06:46:54 2012 (r237261) +++ stable/8/lib/libusb/Makefile Tue Jun 19 06:52:21 2012 (r237262) @@ -16,6 +16,9 @@ MAN= libusb.3 libusb20.3 MKLINT= no NOGCCERROR= +DPADD= ${LIBPTHREAD} +LDADD= -lpthread + MLINKS+= libusb.3 usb.3 # libusb 0.1 compat Modified: stable/8/lib/libusb/libusb10.c ============================================================================== --- stable/8/lib/libusb/libusb10.c Tue Jun 19 06:46:54 2012 (r237261) +++ stable/8/lib/libusb/libusb10.c Tue Jun 19 06:52:21 2012 (r237262) @@ -92,6 +92,7 @@ int libusb_init(libusb_context **context) { struct libusb_context *ctx; + pthread_condattr_t attr; char *debug; int ret; @@ -110,8 +111,28 @@ libusb_init(libusb_context **context) TAILQ_INIT(&ctx->pollfds); TAILQ_INIT(&ctx->tr_done); - pthread_mutex_init(&ctx->ctx_lock, NULL); - pthread_cond_init(&ctx->ctx_cond, NULL); + if (pthread_mutex_init(&ctx->ctx_lock, NULL) != 0) { + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + if (pthread_condattr_init(&attr) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + pthread_condattr_destroy(&attr); + free(ctx); + return (LIBUSB_ERROR_OTHER); + } + if (pthread_cond_init(&ctx->ctx_cond, &attr) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + pthread_condattr_destroy(&attr); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + pthread_condattr_destroy(&attr); ctx->ctx_handler = NO_THREAD; Modified: stable/8/lib/libusb/libusb10_io.c ============================================================================== --- stable/8/lib/libusb/libusb10_io.c Tue Jun 19 06:46:54 2012 (r237261) +++ stable/8/lib/libusb/libusb10_io.c Tue Jun 19 06:52:21 2012 (r237262) @@ -307,12 +307,16 @@ libusb_wait_for_event(libusb_context *ct &ctx->ctx_lock); return (0); } - err = clock_gettime(CLOCK_REALTIME, &ts); + err = clock_gettime(CLOCK_MONOTONIC, &ts); if (err < 0) return (LIBUSB_ERROR_OTHER); - ts.tv_sec = tv->tv_sec; - ts.tv_nsec = tv->tv_usec * 1000; + /* + * The "tv" arguments points to a relative time structure and + * not an absolute time structure. + */ + ts.tv_sec += tv->tv_sec; + ts.tv_nsec += tv->tv_usec * 1000; if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec++; From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 07:34:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ECC69106564A; Tue, 19 Jun 2012 07:34:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2DA78FC08; Tue, 19 Jun 2012 07:34:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J7YEjw028629; Tue, 19 Jun 2012 07:34:14 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J7YErt028615; Tue, 19 Jun 2012 07:34:14 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201206190734.q5J7YErt028615@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 19 Jun 2012 07:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237263 - in head: sbin/ifconfig sys/amd64/conf sys/conf sys/contrib/rdma sys/contrib/rdma/krping sys/dev/cxgb sys/dev/cxgb/common sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/cxgb... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 07:34:15 -0000 Author: np Date: Tue Jun 19 07:34:13 2012 New Revision: 237263 URL: http://svn.freebsd.org/changeset/base/237263 Log: - Updated TOE support in the kernel. - Stateful TCP offload drivers for Terminator 3 and 4 (T3 and T4) ASICs. These are available as t3_tom and t4_tom modules that augment cxgb(4) and cxgbe(4) respectively. The cxgb/cxgbe drivers continue to work as usual with or without these extra features. - iWARP driver for Terminator 3 ASIC (kernel verbs). T4 iWARP in the works and will follow soon. Build-tested with make universe. 30s overview ============ What interfaces support TCP offload? Look for TOE4 and/or TOE6 in the capabilities of an interface: # ifconfig -m | grep TOE Enable/disable TCP offload on an interface (just like any other ifnet capability): # ifconfig cxgbe0 toe # ifconfig cxgbe0 -toe Which connections are offloaded? Look for toe4 and/or toe6 in the output of netstat and sockstat: # netstat -np tcp | grep toe # sockstat -46c | grep toe Reviewed by: bz, gnn Sponsored by: Chelsio communications. MFC after: ~3 months (after 9.1, and after ensuring MFC is feasible) Added: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ib_intfc.h (contents, props changed) head/sys/dev/cxgbe/tom/ head/sys/dev/cxgbe/tom/t4_connect.c (contents, props changed) head/sys/dev/cxgbe/tom/t4_cpl_io.c (contents, props changed) head/sys/dev/cxgbe/tom/t4_listen.c (contents, props changed) head/sys/dev/cxgbe/tom/t4_tom.c (contents, props changed) head/sys/dev/cxgbe/tom/t4_tom.h (contents, props changed) head/sys/dev/cxgbe/tom/t4_tom_l2t.c (contents, props changed) head/sys/dev/cxgbe/tom/t4_tom_l2t.h (contents, props changed) head/sys/modules/cxgbe/tom/ head/sys/modules/cxgbe/tom/Makefile (contents, props changed) head/sys/modules/toecore/ head/sys/modules/toecore/Makefile (contents, props changed) head/sys/netinet/toecore.c (contents, props changed) head/sys/netinet/toecore.h (contents, props changed) Deleted: head/sys/dev/cxgb/cxgb_offload.c head/sys/dev/cxgb/t3cdev.h head/sys/dev/cxgb/ulp/toecore/ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c head/sys/dev/cxgb/ulp/tom/cxgb_ddp.c head/sys/dev/cxgb/ulp/tom/cxgb_defs.h head/sys/dev/cxgb/ulp/tom/cxgb_t3_ddp.h head/sys/dev/cxgb/ulp/tom/cxgb_tcp.h head/sys/dev/cxgb/ulp/tom/cxgb_tcp_offload.c head/sys/dev/cxgb/ulp/tom/cxgb_tcp_offload.h head/sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c head/sys/modules/cxgb/toecore/ head/sys/netinet/toedev.h Modified: head/sbin/ifconfig/ifconfig.c head/sys/amd64/conf/GENERIC head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/contrib/rdma/krping/krping.c head/sys/contrib/rdma/krping/krping.h head/sys/contrib/rdma/krping/krping_dev.c head/sys/contrib/rdma/rdma_addr.c head/sys/contrib/rdma/rdma_cache.c head/sys/dev/cxgb/common/cxgb_ctl_defs.h head/sys/dev/cxgb/cxgb_adapter.h head/sys/dev/cxgb/cxgb_main.c head/sys/dev/cxgb/cxgb_offload.h head/sys/dev/cxgb/cxgb_osdep.h head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/cxgb/sys/mvec.h head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.h head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.h head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cq.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_dbg.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.h head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_mem.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.h head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_resource.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_user.h head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_wr.h head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c head/sys/dev/cxgb/ulp/tom/cxgb_l2t.c head/sys/dev/cxgb/ulp/tom/cxgb_l2t.h head/sys/dev/cxgb/ulp/tom/cxgb_listen.c head/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h head/sys/dev/cxgb/ulp/tom/cxgb_tom.c head/sys/dev/cxgb/ulp/tom/cxgb_tom.h head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_l2t.c head/sys/dev/cxgbe/t4_l2t.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/i386/conf/GENERIC head/sys/i386/conf/XEN head/sys/modules/Makefile head/sys/modules/cxgb/Makefile head/sys/modules/cxgb/cxgb/Makefile head/sys/modules/cxgb/iw_cxgb/Makefile head/sys/modules/cxgb/tom/Makefile head/sys/modules/cxgbe/Makefile head/sys/modules/rdma/krping/Makefile head/sys/net/if_var.h head/sys/net/if_vlan.c head/sys/netinet/if_ether.c head/sys/netinet/if_ether.h head/sys/netinet/in.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_offload.c head/sys/netinet/tcp_offload.h head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_syncache.h head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/sys/ofed/drivers/infiniband/core/cma.c head/sys/ofed/drivers/infiniband/core/iwcm.c head/sys/ofed/include/linux/net.h head/sys/ofed/include/net/netevent.h head/sys/ofed/include/rdma/iw_cm.h head/usr.bin/netstat/inet.c head/usr.bin/sockstat/sockstat.c Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Tue Jun 19 06:52:21 2012 (r237262) +++ head/sbin/ifconfig/ifconfig.c Tue Jun 19 07:34:13 2012 (r237263) @@ -916,7 +916,7 @@ unsetifdescr(const char *val, int value, #define IFCAPBITS \ "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ -"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \ +"\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \ "\26RXCSUM_IPV6\27TXCSUM_IPV6" /* @@ -1212,6 +1212,8 @@ static struct cmd basic_cmds[] = { DEF_CMD("-tso4", -IFCAP_TSO4, setifcap), DEF_CMD("tso", IFCAP_TSO, setifcap), DEF_CMD("-tso", -IFCAP_TSO, setifcap), + DEF_CMD("toe", IFCAP_TOE, setifcap), + DEF_CMD("-toe", -IFCAP_TOE, setifcap), DEF_CMD("lro", IFCAP_LRO, setifcap), DEF_CMD("-lro", -IFCAP_LRO, setifcap), DEF_CMD("wol", IFCAP_WOL, setifcap), Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/amd64/conf/GENERIC Tue Jun 19 07:34:13 2012 (r237263) @@ -28,6 +28,7 @@ options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols +options TCP_OFFLOAD # TCP offload options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/conf/NOTES Tue Jun 19 07:34:13 2012 (r237263) @@ -545,6 +545,8 @@ options INET6 #IPv6 communications pr options ROUTETABLES=2 # max 16. 1 is back compatible. +options TCP_OFFLOAD # TCP offload support. + # In order to enable IPSEC you MUST also add device crypto to # your kernel configuration options IPSEC #IP security (requires device crypto) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/conf/files Tue Jun 19 07:34:13 2012 (r237263) @@ -1038,8 +1038,6 @@ dev/cs/if_cs_isa.c optional cs isa dev/cs/if_cs_pccard.c optional cs pccard dev/cxgb/cxgb_main.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" -dev/cxgb/cxgb_offload.c optional cxgb pci \ - compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/cxgb_sge.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_mc5.c optional cxgb pci \ @@ -3037,7 +3035,7 @@ netinet/tcp_hostcache.c optional inet | netinet/tcp_input.c optional inet | inet6 netinet/tcp_lro.c optional inet | inet6 netinet/tcp_output.c optional inet | inet6 -netinet/tcp_offload.c optional inet | inet6 +netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 netinet/tcp_reass.c optional inet | inet6 netinet/tcp_sack.c optional inet | inet6 netinet/tcp_subr.c optional inet | inet6 Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/conf/options Tue Jun 19 07:34:13 2012 (r237263) @@ -434,7 +434,7 @@ RADIX_MPATH opt_mpath.h ROUTETABLES opt_route.h SLIP_IFF_OPTS opt_slip.h TCPDEBUG -TCP_OFFLOAD_DISABLE opt_inet.h #Disable code to dispatch tcp offloading +TCP_OFFLOAD opt_inet.h # Enable code to dispatch TCP offloading TCP_SIGNATURE opt_inet.h VLAN_ARRAY opt_vlan.h XBONEHACK Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/contrib/rdma/krping/krping.c Tue Jun 19 07:34:13 2012 (r237263) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -53,11 +52,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include -#include +#include +#include #include "getopt.h" #include "krping.h" @@ -83,6 +84,7 @@ static const struct krping_option krping {"bw", OPT_NOPARAM, 'B'}, {"tx-depth", OPT_INT, 't'}, {"poll", OPT_NOPARAM, 'P'}, + {"memlimit", OPT_INT, 'm'}, {NULL, 0, 0} }; @@ -254,10 +256,14 @@ static void krping_cq_event_handler(stru ib_req_notify_cq(cb->cq, IB_CQ_NEXT_COMP); while ((ret = ib_poll_cq(cb->cq, 1, &wc)) == 1) { if (wc.status) { - if (wc.status != IB_WC_WR_FLUSH_ERR) - log(LOG_ERR, "cq completion failed status %d\n", + if (wc.status == IB_WC_WR_FLUSH_ERR) { + DEBUG_LOG("cq flushed\n"); + continue; + } else { + log(LOG_CRIT, "cq completion failed status %d\n", wc.status); - goto error; + goto error; + } } switch (wc.opcode) { @@ -432,8 +438,17 @@ static int krping_setup_buffers(struct k } } - cb->rdma_buf = contigmalloc(cb->size, M_DEVBUF, M_WAITOK, 0, -1UL, - PAGE_SIZE, 0); + /* RNIC adapters have a limit upto which it can register physical memory + * If DMA-MR memory mode is set then normally driver registers maximum + * supported memory. After that if contigmalloc allocates memory beyond the + * specified RNIC limit then Krping may not work. + */ + if (cb->use_dmamr && cb->memlimit) + cb->rdma_buf = contigmalloc(cb->size, M_DEVBUF, M_WAITOK, 0, cb->memlimit, + PAGE_SIZE, 0); + else + cb->rdma_buf = contigmalloc(cb->size, M_DEVBUF, M_WAITOK, 0, -1UL, + PAGE_SIZE, 0); if (!cb->rdma_buf) { log(LOG_ERR, "rdma_buf malloc failed\n"); @@ -458,8 +473,12 @@ static int krping_setup_buffers(struct k } if (!cb->server || cb->wlat || cb->rlat || cb->bw) { - cb->start_buf = contigmalloc(cb->size, M_DEVBUF, M_WAITOK, - 0, -1UL, PAGE_SIZE, 0); + if (cb->use_dmamr && cb->memlimit) + cb->start_buf = contigmalloc(cb->size, M_DEVBUF, M_WAITOK, + 0, cb->memlimit, PAGE_SIZE, 0); + else + cb->start_buf = contigmalloc(cb->size, M_DEVBUF, M_WAITOK, + 0, -1UL, PAGE_SIZE, 0); if (!cb->start_buf) { log(LOG_ERR, "start_buf malloc failed\n"); ret = ENOMEM; @@ -1636,6 +1655,8 @@ int krping_doit(char *cmd) cb->state = IDLE; cb->size = 64; cb->txdepth = RPING_SQ_DEPTH; + cb->use_dmamr = 1; + cb->memlimit = 0; mtx_init(&cb->lock, "krping mtx", NULL, MTX_DUPOK|MTX_DEF); while ((op = krping_getopt("krping", &cmd, krping_opts, NULL, &optarg, @@ -1713,6 +1734,15 @@ int krping_doit(char *cmd) case 'd': debug++; break; + case 'm': + cb->memlimit = optint; + if (cb->memlimit < 1) { + log(LOG_ERR, "Invalid memory limit %ju\n", + cb->memlimit); + ret = EINVAL; + } else + DEBUG_LOG(PFX "memory limit %d\n", (int)optint); + break; default: log(LOG_ERR, "unknown opt %s\n", optarg); ret = EINVAL; Modified: head/sys/contrib/rdma/krping/krping.h ============================================================================== --- head/sys/contrib/rdma/krping/krping.h Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/contrib/rdma/krping/krping.h Tue Jun 19 07:34:13 2012 (r237263) @@ -1,7 +1,7 @@ /* * $FreeBSD$ */ -#include +#include #include /* @@ -92,6 +92,8 @@ struct krping_cb { int count; /* ping count */ int size; /* ping data size */ int validate; /* validate ping data */ + uint64_t memlimit; /* limit of the physical memory that + can be registered with dma_mr mode */ /* CM stuff */ struct rdma_cm_id *cm_id; /* connection on client side,*/ Modified: head/sys/contrib/rdma/krping/krping_dev.c ============================================================================== --- head/sys/contrib/rdma/krping/krping_dev.c Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/contrib/rdma/krping/krping_dev.c Tue Jun 19 07:34:13 2012 (r237263) @@ -14,7 +14,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include /* uprintf */ #include #include /* defines used in kernel.h */ @@ -51,6 +50,9 @@ typedef struct s_krping { /* vars */ static struct cdev *krping_dev; +#undef MODULE_VERSION +#include + static int krping_loader(struct module *m, int what, void *arg) { @@ -175,6 +177,4 @@ krping_write(struct cdev *dev, struct ui return(err); } -MODULE_DEPEND(krping, rdma_core, 1, 1, 1); -MODULE_DEPEND(krping, rdma_cma, 1, 1, 1); DEV_MODULE(krping,krping_loader,NULL); Modified: head/sys/contrib/rdma/rdma_addr.c ============================================================================== --- head/sys/contrib/rdma/rdma_addr.c Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/contrib/rdma/rdma_addr.c Tue Jun 19 07:34:13 2012 (r237263) @@ -117,7 +117,8 @@ int rdma_copy_addr(struct rdma_dev_addr const unsigned char *dst_dev_addr) { dev_addr->dev_type = RDMA_NODE_RNIC; - memcpy(dev_addr->src_dev_addr, IF_LLADDR(dev), MAX_ADDR_LEN); + memset(dev_addr->src_dev_addr, 0, MAX_ADDR_LEN); + memcpy(dev_addr->src_dev_addr, IF_LLADDR(dev), dev->if_addrlen); memcpy(dev_addr->broadcast, dev->if_broadcastaddr, MAX_ADDR_LEN); if (dst_dev_addr) memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN); @@ -207,7 +208,7 @@ static int addr_resolve_remote(struct so goto put; } ret = arpresolve(iproute.ro_rt->rt_ifp, iproute.ro_rt, NULL, - rt_key(iproute.ro_rt), dmac, &lle); + (struct sockaddr *)dst_in, dmac, &lle); if (ret) { goto put; } Modified: head/sys/contrib/rdma/rdma_cache.c ============================================================================== --- head/sys/contrib/rdma/rdma_cache.c Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/contrib/rdma/rdma_cache.c Tue Jun 19 07:34:13 2012 (r237263) @@ -132,7 +132,7 @@ int ib_find_cached_gid(struct ib_device for (p = 0; p <= end_port(device) - start_port(device); ++p) { cache = device->cache.gid_cache[p]; for (i = 0; i < cache->table_len; ++i) { - if (!memcmp(gid, &cache->table[i], 6)) { /* XXX */ + if (!memcmp(gid, &cache->table[i], sizeof *gid)) { *port_num = p + start_port(device); if (index) *index = i; Modified: head/sys/dev/cxgb/common/cxgb_ctl_defs.h ============================================================================== --- head/sys/dev/cxgb/common/cxgb_ctl_defs.h Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/dev/cxgb/common/cxgb_ctl_defs.h Tue Jun 19 07:34:13 2012 (r237263) @@ -60,14 +60,12 @@ struct mtutab { const unsigned short *mtus; /* the MTU table values */ }; -struct net_device; - /* - * Structure used to request the adapter net_device owning a given MAC address. + * Structure used to request the ifnet that owns a given MAC address. */ struct iff_mac { - struct net_device *dev; /* the net_device */ - const unsigned char *mac_addr; /* MAC address to lookup */ + struct ifnet *dev; + const unsigned char *mac_addr; u16 vlan_tag; }; @@ -85,7 +83,7 @@ struct ddp_params { struct adap_ports { unsigned int nports; /* number of ports on this adapter */ - struct net_device *lldevs[MAX_NPORTS]; + struct ifnet *lldevs[MAX_NPORTS]; }; /* Modified: head/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- head/sys/dev/cxgb/cxgb_adapter.h Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/dev/cxgb/cxgb_adapter.h Tue Jun 19 07:34:13 2012 (r237263) @@ -57,7 +57,6 @@ $FreeBSD$ #include #include -#include #include struct adapter; @@ -130,6 +129,7 @@ enum { CXGB_OFLD_INIT = (1 << 7), TP_PARITY_INIT = (1 << 8), CXGB_BUSY = (1 << 9), + TOM_INIT_DONE = (1 << 10), /* port flags */ DOOMED = (1 << 0), @@ -179,7 +179,6 @@ struct sge_rspq { uint32_t async_notif; uint32_t cntxt_id; uint32_t offload_pkts; - uint32_t offload_bundles; uint32_t pure_rsps; uint32_t unhandled_irqs; uint32_t starved; @@ -291,6 +290,7 @@ struct sge_qset { uint32_t txq_stopped; /* which Tx queues are stopped */ uint64_t port_stats[SGE_PSTAT_MAX]; struct port_info *port; + struct adapter *adap; int idx; /* qset # */ int qs_flags; int coalescing; @@ -307,10 +307,13 @@ struct sge { struct filter_info; +typedef int (*cpl_handler_t)(struct sge_qset *, struct rsp_desc *, + struct mbuf *); + struct adapter { + SLIST_ENTRY(adapter) link; device_t dev; int flags; - TAILQ_ENTRY(adapter) adapter_entry; /* PCI register resources */ int regs_rid; @@ -376,11 +379,16 @@ struct adapter { struct port_info port[MAX_NPORTS]; device_t portdev[MAX_NPORTS]; - struct t3cdev tdev; +#ifdef TCP_OFFLOAD + void *tom_softc; + void *iwarp_softc; +#endif char fw_version[64]; char port_types[MAX_NPORTS + 1]; uint32_t open_device_map; - uint32_t registered_device_map; +#ifdef TCP_OFFLOAD + int offload_map; +#endif struct mtx lock; driver_intr_t *cxgb_intr; int msi_count; @@ -392,6 +400,11 @@ struct adapter { char elmerlockbuf[ADAPTER_LOCK_NAME_LEN]; int timestamp; + +#ifdef TCP_OFFLOAD +#define NUM_CPL_HANDLERS 0xa7 + cpl_handler_t cpl_handler[NUM_CPL_HANDLERS] __aligned(CACHE_LINE_SIZE); +#endif }; struct t3_rx_mode { @@ -502,10 +515,12 @@ void t3_os_link_changed(adapter_t *adapt int speed, int duplex, int fc, int mac_was_reset); void t3_os_phymod_changed(struct adapter *adap, int port_id); void t3_sge_err_intr_handler(adapter_t *adapter); -int t3_offload_tx(struct t3cdev *, struct mbuf *); +#ifdef TCP_OFFLOAD +int t3_offload_tx(struct adapter *, struct mbuf *); +#endif void t3_os_set_hw_addr(adapter_t *adapter, int port_idx, u8 hw_addr[]); int t3_mgmt_tx(adapter_t *adap, struct mbuf *m); - +int t3_register_cpl_handler(struct adapter *, int, cpl_handler_t); int t3_sge_alloc(struct adapter *); int t3_sge_free(struct adapter *); @@ -556,15 +571,9 @@ txq_to_qset(struct sge_txq *q, int qidx) return container_of(q, struct sge_qset, txq[qidx]); } -static __inline struct adapter * -tdev2adap(struct t3cdev *d) -{ - return container_of(d, struct adapter, tdev); -} - #undef container_of -#define OFFLOAD_DEVMAP_BIT 15 +#define OFFLOAD_DEVMAP_BIT (1 << MAX_NPORTS) static inline int offload_running(adapter_t *adapter) { return isset(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT); @@ -573,4 +582,5 @@ static inline int offload_running(adapte void cxgb_tx_watchdog(void *arg); int cxgb_transmit(struct ifnet *ifp, struct mbuf *m); void cxgb_qflush(struct ifnet *ifp); +void t3_iterate(void (*)(struct adapter *, void *), void *); #endif Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Tue Jun 19 06:52:21 2012 (r237262) +++ head/sys/dev/cxgb/cxgb_main.c Tue Jun 19 07:34:13 2012 (r237263) @@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" + #include #include #include @@ -107,6 +109,9 @@ static inline void mk_set_tcb_field(stru unsigned int, u64, u64); static inline void set_tcb_field_ulp(struct cpl_set_tcb_field *, unsigned int, unsigned int, u64, u64); +#ifdef TCP_OFFLOAD +static int cpl_not_handled(struct sge_qset *, struct rsp_desc *, struct mbuf *); +#endif /* Attachment glue for the PCI controller end of the device. Each port of * the device is attached separately, as defined later. @@ -119,10 +124,11 @@ static __inline void reg_block_dump(stru unsigned int end); static void cxgb_get_regs(adapter_t *sc, struct ch_ifconf_regs *regs, uint8_t *buf); static int cxgb_get_regs_len(void); -static int offload_open(struct port_info *pi); static void touch_bars(device_t dev); -static int offload_close(struct t3cdev *tdev); static void cxgb_update_mac_settings(struct port_info *p); +#ifdef TCP_OFFLOAD +static int toe_capability(struct port_info *, int); +#endif static device_method_t cxgb_controller_methods[] = { DEVMETHOD(device_probe, cxgb_controller_probe), @@ -138,8 +144,11 @@ static driver_t cxgb_controller_driver = sizeof(struct adapter) }; +static int cxgbc_mod_event(module_t, int, void *); static devclass_t cxgb_controller_devclass; -DRIVER_MODULE(cxgbc, pci, cxgb_controller_driver, cxgb_controller_devclass, 0, 0); +DRIVER_MODULE(cxgbc, pci, cxgb_controller_driver, cxgb_controller_devclass, + cxgbc_mod_event, 0); +MODULE_VERSION(cxgbc, 1); /* * Attachment glue for the ports. Attachment is done directly to the @@ -177,6 +186,14 @@ static struct cdevsw cxgb_cdevsw = { static devclass_t cxgb_port_devclass; DRIVER_MODULE(cxgb, cxgbc, cxgb_port_driver, cxgb_port_devclass, 0, 0); +MODULE_VERSION(cxgb, 1); + +static struct mtx t3_list_lock; +static SLIST_HEAD(, adapter) t3_list; +#ifdef TCP_OFFLOAD +static struct mtx t3_uld_list_lock; +static SLIST_HEAD(, uld_info) t3_uld_list; +#endif /* * The driver uses the best interrupt scheme available on a platform in the @@ -195,15 +212,6 @@ SYSCTL_INT(_hw_cxgb, OID_AUTO, msi_allow "MSI-X, MSI, INTx selector"); /* - * The driver enables offload as a default. - * To disable it, use ofld_disable = 1. - */ -static int ofld_disable = 0; -TUNABLE_INT("hw.cxgb.ofld_disable", &ofld_disable); -SYSCTL_INT(_hw_cxgb, OID_AUTO, ofld_disable, CTLFLAG_RDTUN, &ofld_disable, 0, - "disable ULP offload"); - -/* * The driver uses an auto-queue algorithm by default. * To disable it and force a single queue-set per port, use multiq = 0 */ @@ -445,6 +453,25 @@ cxgb_controller_attach(device_t dev) sc->msi_count = 0; ai = cxgb_get_adapter_info(dev); + snprintf(sc->lockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb controller lock %d", + device_get_unit(dev)); + ADAPTER_LOCK_INIT(sc, sc->lockbuf); + + snprintf(sc->reglockbuf, ADAPTER_LOCK_NAME_LEN, "SGE reg lock %d", + device_get_unit(dev)); + snprintf(sc->mdiolockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb mdio lock %d", + device_get_unit(dev)); + snprintf(sc->elmerlockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb elmer lock %d", + device_get_unit(dev)); + + MTX_INIT(&sc->sge.reg_lock, sc->reglockbuf, NULL, MTX_SPIN); + MTX_INIT(&sc->mdio_lock, sc->mdiolockbuf, NULL, MTX_DEF); + MTX_INIT(&sc->elmer_lock, sc->elmerlockbuf, NULL, MTX_DEF); + + mtx_lock(&t3_list_lock); + SLIST_INSERT_HEAD(&t3_list, sc, link); + mtx_unlock(&t3_list_lock); + /* find the PCIe link width and set max read request to 4KB*/ if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) { uint16_t lnk; @@ -471,24 +498,10 @@ cxgb_controller_attach(device_t dev) if ((sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->regs_rid, RF_ACTIVE)) == NULL) { device_printf(dev, "Cannot allocate BAR region 0\n"); - return (ENXIO); + error = ENXIO; + goto out; } - snprintf(sc->lockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb controller lock %d", - device_get_unit(dev)); - ADAPTER_LOCK_INIT(sc, sc->lockbuf); - - snprintf(sc->reglockbuf, ADAPTER_LOCK_NAME_LEN, "SGE reg lock %d", - device_get_unit(dev)); - snprintf(sc->mdiolockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb mdio lock %d", - device_get_unit(dev)); - snprintf(sc->elmerlockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb elmer lock %d", - device_get_unit(dev)); - - MTX_INIT(&sc->sge.reg_lock, sc->reglockbuf, NULL, MTX_SPIN); - MTX_INIT(&sc->mdio_lock, sc->mdiolockbuf, NULL, MTX_DEF); - MTX_INIT(&sc->elmer_lock, sc->elmerlockbuf, NULL, MTX_DEF); - sc->bt = rman_get_bustag(sc->regs_res); sc->bh = rman_get_bushandle(sc->regs_res); sc->mmio_len = rman_get_size(sc->regs_res); @@ -604,7 +617,7 @@ cxgb_controller_attach(device_t dev) } else { sc->flags |= TPS_UPTODATE; } - + /* * Create a child device for each MAC. The ethernet attachment * will be done in these children. @@ -636,12 +649,7 @@ cxgb_controller_attach(device_t dev) t3_sge_init_adapter(sc); t3_led_ready(sc); - - cxgb_offload_init(); - if (is_offload(sc)) { - setbit(&sc->registered_device_map, OFFLOAD_DEVMAP_BIT); - cxgb_adapter_ofld(sc); - } + error = t3_get_fw_version(sc, &vers); if (error) goto out; @@ -662,6 +670,11 @@ cxgb_controller_attach(device_t dev) device_printf(sc->dev, "Firmware Version %s\n", &sc->fw_version[0]); callout_reset(&sc->cxgb_tick_ch, hz, cxgb_tick, sc); t3_add_attach_sysctls(sc); + +#ifdef TCP_OFFLOAD + for (i = 0; i < NUM_CPL_HANDLERS; i++) + sc->cpl_handler[i] = cpl_not_handled; +#endif out: if (error) cxgb_free(sc); @@ -775,20 +788,9 @@ cxgb_free(struct adapter *sc) sc->tq = NULL; } - if (is_offload(sc)) { - clrbit(&sc->registered_device_map, OFFLOAD_DEVMAP_BIT); - cxgb_adapter_unofld(sc); - } - -#ifdef notyet - if (sc->flags & CXGB_OFLD_INIT) - cxgb_offload_deactivate(sc); -#endif free(sc->filters, M_DEVBUF); t3_sge_free(sc); - cxgb_offload_exit(); - if (sc->udbs_res != NULL) bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->udbs_rid, sc->udbs_res); @@ -800,6 +802,9 @@ cxgb_free(struct adapter *sc) MTX_DESTROY(&sc->mdio_lock); MTX_DESTROY(&sc->sge.reg_lock); MTX_DESTROY(&sc->elmer_lock); + mtx_lock(&t3_list_lock); + SLIST_REMOVE(&t3_list, sc, adapter, link); + mtx_unlock(&t3_list_lock); ADAPTER_LOCK_DEINIT(sc); } @@ -1017,6 +1022,10 @@ cxgb_port_attach(device_t dev) ifp->if_qflush = cxgb_qflush; ifp->if_capabilities = CXGB_CAP; +#ifdef TCP_OFFLOAD + if (is_offload(sc)) + ifp->if_capabilities |= IFCAP_TOE4; +#endif ifp->if_capenable = CXGB_CAP_ENABLE; ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO; @@ -1420,65 +1429,6 @@ setup_rss(adapter_t *adap) cpus, rspq_map); } - -/* - * Sends an mbuf to an offload queue driver - * after dealing with any active network taps. - */ -static inline int -offload_tx(struct t3cdev *tdev, struct mbuf *m) -{ - int ret; - - ret = t3_offload_tx(tdev, m); - return (ret); -} - -static int -write_smt_entry(struct adapter *adapter, int idx) -{ - struct port_info *pi = &adapter->port[idx]; - struct cpl_smt_write_req *req; - struct mbuf *m; - - if ((m = m_gethdr(M_NOWAIT, MT_DATA)) == NULL) - return (ENOMEM); - - req = mtod(m, struct cpl_smt_write_req *); - m->m_pkthdr.len = m->m_len = sizeof(struct cpl_smt_write_req); - - req->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); - OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, idx)); - req->mtu_idx = NMTUS - 1; /* should be 0 but there's a T3 bug */ - req->iff = idx; - memset(req->src_mac1, 0, sizeof(req->src_mac1)); - memcpy(req->src_mac0, pi->hw_addr, ETHER_ADDR_LEN); - - m_set_priority(m, 1); - - offload_tx(&adapter->tdev, m); - - return (0); -} - -static int -init_smt(struct adapter *adapter) -{ - int i; - - for_each_port(adapter, i) - write_smt_entry(adapter, i); - return 0; -} - -static void -init_port_mtus(adapter_t *adapter) -{ - unsigned int mtus = ETHERMTU | (ETHERMTU << 16); - - t3_write_reg(adapter, A_TP_MTU_PORT_TABLE, mtus); -} - static void send_pktsched_cmd(struct adapter *adap, int sched, int qidx, int lo, int hi, int port) @@ -1705,45 +1655,6 @@ cxgb_down(struct adapter *sc) t3_intr_disable(sc); } -static int -offload_open(struct port_info *pi) -{ - struct adapter *sc = pi->adapter; - struct t3cdev *tdev = &sc->tdev; - - setbit(&sc->open_device_map, OFFLOAD_DEVMAP_BIT); - - t3_tp_set_offload_mode(sc, 1); - tdev->lldev = pi->ifp; - init_port_mtus(sc); - t3_load_mtus(sc, sc->params.mtus, sc->params.a_wnd, sc->params.b_wnd, - sc->params.rev == 0 ? sc->port[0].ifp->if_mtu : 0xffff); - init_smt(sc); - cxgb_add_clients(tdev); - - return (0); -} - -static int -offload_close(struct t3cdev *tdev) -{ - struct adapter *adapter = tdev2adap(tdev); - - if (!isset(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT)) - return (0); - - /* Call back all registered clients */ - cxgb_remove_clients(tdev); - - tdev->lldev = NULL; - cxgb_set_dummy_ops(tdev); - t3_tp_set_offload_mode(adapter, 0); - - clrbit(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT); - - return (0); -} - /* * if_init for cxgb ports. */ @@ -1793,15 +1704,9 @@ cxgb_init_locked(struct port_info *p) ADAPTER_UNLOCK(sc); } - if (sc->open_device_map == 0) { - if ((rc = cxgb_up(sc)) != 0) + if (sc->open_device_map == 0 && ((rc = cxgb_up(sc)) != 0)) goto done; - if (is_offload(sc) && !ofld_disable && offload_open(p)) - log(LOG_WARNING, - "Could not initialize offload capabilities\n"); - } - PORT_LOCK(p); if (isset(&sc->open_device_map, p->port_id) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { @@ -1929,7 +1834,6 @@ cxgb_uninit_synchronized(struct port_inf DELAY(100 * 1000); t3_mac_disable(&pi->mac, MAC_DIRECTION_RX); - pi->phy.ops->power_down(&pi->phy, 1); PORT_UNLOCK(pi); @@ -1937,9 +1841,6 @@ cxgb_uninit_synchronized(struct port_inf pi->link_config.link_ok = 0; t3_os_link_changed(sc, pi->port_id, 0, 0, 0, 0, 0); - if ((sc->open_device_map & PORT_MASK) == 0) - offload_close(&sc->tdev); - if (sc->open_device_map == 0) cxgb_down(pi->adapter); @@ -2081,6 +1982,15 @@ fail: /* Safe to do this even if cxgb_up not called yet */ cxgb_set_lro(p, ifp->if_capenable & IFCAP_LRO); } +#ifdef TCP_OFFLOAD + if (mask & IFCAP_TOE4) { + int enable = (ifp->if_capenable ^ mask) & IFCAP_TOE4; + + error = toe_capability(p, enable); + if (error == 0) + ifp->if_capenable ^= mask; + } +#endif if (mask & IFCAP_VLAN_HWTAGGING) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { @@ -3362,3 +3272,235 @@ set_tcb_field_ulp(struct cpl_set_tcb_fie txpkt->len = htonl(V_ULPTX_NFLITS(sizeof(*req) / 8)); mk_set_tcb_field(req, tid, word, mask, val); } + +void +t3_iterate(void (*func)(struct adapter *, void *), void *arg) +{ + struct adapter *sc; + + mtx_lock(&t3_list_lock); + SLIST_FOREACH(sc, &t3_list, link) { + /* + * func should not make any assumptions about what state sc is + * in - the only guarantee is that sc->sc_lock is a valid lock. + */ + func(sc, arg); + } + mtx_unlock(&t3_list_lock); +} + +#ifdef TCP_OFFLOAD +static int +toe_capability(struct port_info *pi, int enable) +{ + int rc; + struct adapter *sc = pi->adapter; + + ADAPTER_LOCK_ASSERT_OWNED(sc); + + if (!is_offload(sc)) + return (ENODEV); + + if (enable) { + if (!(sc->flags & FULL_INIT_DONE)) { + log(LOG_WARNING, + "You must enable a cxgb interface first\n"); + return (EAGAIN); + } + + if (isset(&sc->offload_map, pi->port_id)) + return (0); + + if (!(sc->flags & TOM_INIT_DONE)) { + rc = t3_activate_uld(sc, ULD_TOM); + if (rc == EAGAIN) { + log(LOG_WARNING, + "You must kldload t3_tom.ko before trying " + "to enable TOE on a cxgb interface.\n"); + } + if (rc != 0) + return (rc); + KASSERT(sc->tom_softc != NULL, + ("%s: TOM activated but softc NULL", __func__)); + KASSERT(sc->flags & TOM_INIT_DONE, + ("%s: TOM activated but flag not set", __func__)); + } + + setbit(&sc->offload_map, pi->port_id); + + /* + * XXX: Temporary code to allow iWARP to be enabled when TOE is + * enabled on any port. Need to figure out how to enable, + * disable, load, and unload iWARP cleanly. + */ + if (!isset(&sc->offload_map, MAX_NPORTS) && + t3_activate_uld(sc, ULD_IWARP) == 0) + setbit(&sc->offload_map, MAX_NPORTS); + } else { + if (!isset(&sc->offload_map, pi->port_id)) + return (0); + + KASSERT(sc->flags & TOM_INIT_DONE, + ("%s: TOM never initialized?", __func__)); + clrbit(&sc->offload_map, pi->port_id); + } + + return (0); +} + +/* + * Add an upper layer driver to the global list. + */ +int +t3_register_uld(struct uld_info *ui) +{ + int rc = 0; + struct uld_info *u; + + mtx_lock(&t3_uld_list_lock); + SLIST_FOREACH(u, &t3_uld_list, link) { + if (u->uld_id == ui->uld_id) { + rc = EEXIST; + goto done; + } + } + + SLIST_INSERT_HEAD(&t3_uld_list, ui, link); + ui->refcount = 0; +done: + mtx_unlock(&t3_uld_list_lock); + return (rc); +} + +int +t3_unregister_uld(struct uld_info *ui) +{ + int rc = EINVAL; + struct uld_info *u; + + mtx_lock(&t3_uld_list_lock); + + SLIST_FOREACH(u, &t3_uld_list, link) { + if (u == ui) { + if (ui->refcount > 0) { + rc = EBUSY; + goto done; + } + + SLIST_REMOVE(&t3_uld_list, ui, uld_info, link); + rc = 0; + goto done; + } + } +done: + mtx_unlock(&t3_uld_list_lock); + return (rc); +} + +int +t3_activate_uld(struct adapter *sc, int id) +{ + int rc = EAGAIN; + struct uld_info *ui; + + mtx_lock(&t3_uld_list_lock); + + SLIST_FOREACH(ui, &t3_uld_list, link) { + if (ui->uld_id == id) { + rc = ui->activate(sc); + if (rc == 0) + ui->refcount++; + goto done; + } + } +done: + mtx_unlock(&t3_uld_list_lock); + + return (rc); +} + +int +t3_deactivate_uld(struct adapter *sc, int id) +{ + int rc = EINVAL; + struct uld_info *ui; + + mtx_lock(&t3_uld_list_lock); + + SLIST_FOREACH(ui, &t3_uld_list, link) { + if (ui->uld_id == id) { + rc = ui->deactivate(sc); + if (rc == 0) + ui->refcount--; + goto done; + } + } +done: + mtx_unlock(&t3_uld_list_lock); + + return (rc); +} + +static int +cpl_not_handled(struct sge_qset *qs __unused, struct rsp_desc *r __unused, + struct mbuf *m) +{ + m_freem(m); + return (EDOOFUS); +} + +int +t3_register_cpl_handler(struct adapter *sc, int opcode, cpl_handler_t h) +{ + uintptr_t *loc, new; + + if (opcode >= NUM_CPL_HANDLERS) + return (EINVAL); + + new = h ? (uintptr_t)h : (uintptr_t)cpl_not_handled; + loc = (uintptr_t *) &sc->cpl_handler[opcode]; + atomic_store_rel_ptr(loc, new); + + return (0); +} +#endif + +static int +cxgbc_mod_event(module_t mod, int cmd, void *arg) +{ + int rc = 0; + + switch (cmd) { + case MOD_LOAD: + mtx_init(&t3_list_lock, "T3 adapters", 0, MTX_DEF); + SLIST_INIT(&t3_list); +#ifdef TCP_OFFLOAD + mtx_init(&t3_uld_list_lock, "T3 ULDs", 0, MTX_DEF); + SLIST_INIT(&t3_uld_list); +#endif + break; + + case MOD_UNLOAD: +#ifdef TCP_OFFLOAD + mtx_lock(&t3_uld_list_lock); + if (!SLIST_EMPTY(&t3_uld_list)) { + rc = EBUSY; + mtx_unlock(&t3_uld_list_lock); + break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 07:59:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 85BF8106564A; Tue, 19 Jun 2012 07:59:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id F1EFD8FC14; Tue, 19 Jun 2012 07:59:34 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5J7xSA2057662; Tue, 19 Jun 2012 10:59:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5J7xRd4086124; Tue, 19 Jun 2012 10:59:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5J7xRnF086123; Tue, 19 Jun 2012 10:59:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 19 Jun 2012 10:59:27 +0300 From: Konstantin Belousov To: Benjamin Kaduk Message-ID: <20120619075927.GO2337@deviant.kiev.zoral.com.ua> References: <201206182217.q5IMHTJE003928@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JLgb/x5pnTX2rSUi" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, Rick Macklem , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237244 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 07:59:36 -0000 --JLgb/x5pnTX2rSUi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 19, 2012 at 03:06:09AM +0000, Benjamin Kaduk wrote: > On Mon, 18 Jun 2012, Rick Macklem wrote: >=20 > >Author: rmacklem > >Date: Mon Jun 18 22:17:28 2012 > >New Revision: 237244 > >URL: http://svn.freebsd.org/changeset/base/237244 > > > >Log: > > Fix the NFSv4 client for the case where mmap'd files are > > written, but not msync'd by a process. A VOP_PUTPAGES() > > called when VOP_RECLAIM() happens will usually fail, since > > the NFSv4 Open has already been closed by VOP_INACTIVE(). > > Add a vm_object_page_clean() call to the NFSv4 client's > > VOP_INACTIVE(), so that the write happens before the NFSv4 > > Open is closed. kib@ suggested using vgone() instead and > > I will explore this, but this patch fixes things in the >=20 > Hi Rick, >=20 > OpenAFS is currently using vgone() in the vnode cleanup path (though it i= s=20 > actually in RECLAIM not INACTIVE because of how AFS has traditionally=20 > separated the two). Calling vgone() from VOP_RECLAIM is exactly NOP. > However, it seems that the other *BSD implementations do not call vgone()= =20 > in the same place, instead the corresponding flush functions call=20 > cache_purge() and sometimes other things. My colleague is trying to get= =20 > our FreeBSD implementation to match, so I would be interested in your tes= t=20 > case to confirm that we do not rely on the full vgone() there. >=20 > Thanks, >=20 > Ben >=20 > > meantime. For some reason, the VOP_PUTPAGES() is still > > attaempted in VOP_RECLAIM(), but having this fail doesn't > > cause any problems except a "stateid0 in write" being logged. --JLgb/x5pnTX2rSUi Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/gMV8ACgkQC3+MBN1Mb4h74wCdGoaluRfwe75F83VID8Go5NfN KcgAn1Tsa1z7ipDa49FSUex0k8wjSKZ1 =RcIY -----END PGP SIGNATURE----- --JLgb/x5pnTX2rSUi-- From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 08:12:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 242E0106566C; Tue, 19 Jun 2012 08:12:45 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F45E8FC15; Tue, 19 Jun 2012 08:12:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J8CiL4030296; Tue, 19 Jun 2012 08:12:44 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J8CiqH030294; Tue, 19 Jun 2012 08:12:44 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206190812.q5J8CiqH030294@svn.freebsd.org> From: Alan Cox Date: Tue, 19 Jun 2012 08:12:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237264 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 08:12:45 -0000 Author: alc Date: Tue Jun 19 08:12:44 2012 New Revision: 237264 URL: http://svn.freebsd.org/changeset/base/237264 Log: Condition the implementation of pv_entry_count on PV_STATS. On amd64, pv_entry_count is purely informational. It does not serve any functional purpose. Add PV chunk locking to get_pv_entry(). Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Jun 19 07:34:13 2012 (r237263) +++ head/sys/amd64/amd64/pmap.c Tue Jun 19 08:12:44 2012 (r237264) @@ -2043,10 +2043,6 @@ pv_to_chunk(pv_entry_t pv) static const uint64_t pc_freemask[_NPCM] = { PC_FREE0, PC_FREE1, PC_FREE2 }; -static long pv_entry_count; -SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, - "Current number of pv entries"); - #ifdef PV_STATS static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; @@ -2059,13 +2055,15 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_ SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_tryfail, CTLFLAG_RD, &pc_chunk_tryfail, 0, "Number of times tried to get a chunk page but failed."); -static long pv_entry_frees, pv_entry_allocs; +static long pv_entry_frees, pv_entry_allocs, pv_entry_count; static int pv_entry_spare; SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, &pv_entry_frees, 0, "Current number of pv entry frees"); SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, &pv_entry_allocs, 0, "Current number of pv entry allocs"); +SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, + "Current number of pv entries"); SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0, "Current number of spare pv entries"); #endif @@ -2164,7 +2162,7 @@ pmap_pv_reclaim(pmap_t locked_pmap) pmap_resident_count_dec(pmap, freed); PV_STAT(pv_entry_frees += freed); PV_STAT(pv_entry_spare += freed); - pv_entry_count -= freed; + PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); if (pc->pc_map[0] == PC_FREE0 && pc->pc_map[1] == PC_FREE1 && pc->pc_map[2] == PC_FREE2) { @@ -2212,7 +2210,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(pv_entry_frees++); PV_STAT(pv_entry_spare++); - pv_entry_count--; + PV_STAT(atomic_subtract_long(&pv_entry_count, 1)); pc = pv_to_chunk(pv); idx = pv - &pc->pc_pventry[0]; field = idx / 64; @@ -2261,9 +2259,9 @@ get_pv_entry(pmap_t pmap, boolean_t try) struct pv_chunk *pc; vm_page_t m; - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - PV_STAT(pv_entry_allocs++); + PV_STAT(atomic_add_long(&pv_entry_allocs, 1)); retry: pc = TAILQ_FIRST(&pmap->pm_pvchunk); if (pc != NULL) { @@ -2283,8 +2281,8 @@ retry: TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } - pv_entry_count++; - PV_STAT(pv_entry_spare--); + PV_STAT(atomic_add_long(&pv_entry_count, 1)); + PV_STAT(atomic_subtract_int(&pv_entry_spare, 1)); return (pv); } } @@ -2300,19 +2298,21 @@ retry: if (m == NULL) goto retry; } - PV_STAT(pc_chunk_count++); - PV_STAT(pc_chunk_allocs++); + PV_STAT(atomic_add_int(&pc_chunk_count, 1)); + PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); dump_add_page(m->phys_addr); pc = (void *)PHYS_TO_DMAP(m->phys_addr); pc->pc_pmap = pmap; pc->pc_map[0] = PC_FREE0 & ~1ul; /* preallocated bit 0 */ pc->pc_map[1] = PC_FREE1; pc->pc_map[2] = PC_FREE2; + mtx_lock(&pv_chunks_mutex); TAILQ_INSERT_TAIL(&pv_chunks, pc, pc_lru); + mtx_unlock(&pv_chunks_mutex); pv = &pc->pc_pventry[0]; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); - pv_entry_count++; - PV_STAT(pv_entry_spare += _NPCPV - 1); + PV_STAT(atomic_add_long(&pv_entry_count, 1)); + PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV - 1)); return (pv); } @@ -4266,7 +4266,7 @@ pmap_remove_pages(pmap_t pmap) } PV_STAT(atomic_add_long(&pv_entry_frees, freed)); PV_STAT(atomic_add_int(&pv_entry_spare, freed)); - atomic_subtract_long(&pv_entry_count, freed); + PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); if (allfree) { if (lock != NULL) { rw_wunlock(lock); From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 09:09:58 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC024106564A; Tue, 19 Jun 2012 09:09:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 788D68FC17; Tue, 19 Jun 2012 09:09:57 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA05790; Tue, 19 Jun 2012 12:09:35 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1SguRK-000ARC-LZ; Tue, 19 Jun 2012 12:09:34 +0300 Message-ID: <4FE041CB.5080506@FreeBSD.org> Date: Tue, 19 Jun 2012 12:09:31 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120613 Thunderbird/13.0 MIME-Version: 1.0 To: Poul-Henning Kamp References: <31750.1340083631@critter.freebsd.dk> In-Reply-To: <31750.1340083631@critter.freebsd.dk> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, Daniel O'Connor , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 09:09:58 -0000 on 19/06/2012 08:27 Poul-Henning Kamp said the following: > In message <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au>, "Daniel O'Conno > r" writes: > >>> If size is odd, this does not copy the last byte. Not sure, whether = >> this is intended. > > Feel free to improve... Interesting reaction to a bug reported in one's freshly committed code... -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 10:04:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E59C106566B; Tue, 19 Jun 2012 10:04:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 289478FC14; Tue, 19 Jun 2012 10:04:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JA4a3E035040; Tue, 19 Jun 2012 10:04:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JA4auO035038; Tue, 19 Jun 2012 10:04:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206191004.q5JA4auO035038@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Jun 2012 10:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237265 - stable/9/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 10:04:37 -0000 Author: kib Date: Tue Jun 19 10:04:36 2012 New Revision: 237265 URL: http://svn.freebsd.org/changeset/base/237265 Log: MFC r236976: For incompleted block allocations or frees, the inode block count usage must be recalculated. The blk_check pass of suj checker explicitely marks inodes which owned such blocks as needing block count adjustment. But ino_adjblks() is only called by cg_trunc pass, which is performed before blk_check. As result, the block use count for such inodes is left wrong. This causes full fsck run after journaled run to still find inconsistencies like 'INCORRECT BLOCK COUNT I=14557 (328 should be 0)' in phase 1. Fix this issue by running additional adj_blk pass after blk_check, which updates the field. Modified: stable/9/sbin/fsck_ffs/suj.c Directory Properties: stable/9/sbin/fsck_ffs/ (props changed) Modified: stable/9/sbin/fsck_ffs/suj.c ============================================================================== --- stable/9/sbin/fsck_ffs/suj.c Tue Jun 19 08:12:44 2012 (r237264) +++ stable/9/sbin/fsck_ffs/suj.c Tue Jun 19 10:04:36 2012 (r237265) @@ -1789,6 +1789,20 @@ cg_trunc(struct suj_cg *sc) } } +static void +cg_adj_blk(struct suj_cg *sc) +{ + struct suj_ino *sino; + int i; + + for (i = 0; i < SUJ_HASHSIZE; i++) { + LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) { + if (sino->si_blkadj) + ino_adjblks(sino); + } + } +} + /* * Free any partially allocated blocks and then resolve inode block * counts. @@ -2720,6 +2734,7 @@ suj_check(const char *filesys) printf("** Processing journal entries.\n"); cg_apply(cg_trunc); cg_apply(cg_check_blk); + cg_apply(cg_adj_blk); cg_apply(cg_check_ino); } if (preen == 0 && (jrecs > 0 || jbytes > 0) && reply("WRITE CHANGES") == 0) From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 10:06:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0F725106566C; Tue, 19 Jun 2012 10:06:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE6C78FC0A; Tue, 19 Jun 2012 10:06:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JA6YbY035180; Tue, 19 Jun 2012 10:06:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JA6YNC035178; Tue, 19 Jun 2012 10:06:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206191006.q5JA6YNC035178@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Jun 2012 10:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237266 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 10:06:35 -0000 Author: kib Date: Tue Jun 19 10:06:34 2012 New Revision: 237266 URL: http://svn.freebsd.org/changeset/base/237266 Log: MFC r237159: Fix reading of netgroup(5) file which contains more then one netgroup. Modified: stable/9/lib/libc/gen/getnetgrent.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/getnetgrent.c ============================================================================== --- stable/9/lib/libc/gen/getnetgrent.c Tue Jun 19 10:04:36 2012 (r237265) +++ stable/9/lib/libc/gen/getnetgrent.c Tue Jun 19 10:06:34 2012 (r237266) @@ -538,7 +538,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep; + char *linep, *olinep, *pos, *spos; int len, olen; int cont; struct linelist *lp; @@ -615,15 +615,20 @@ read_for_group(const char *group) } else cont = 0; if (len > 0) { - linep = reallocf(linep, olen + len + 1); + linep = malloc(olen + len + 1); if (linep == NULL) { free(lp->l_groupname); free(lp); return (NULL); } + if (olen > 0) { + bcopy(olinep, linep, olen); + free(olinep); + } bcopy(pos, linep + olen, len); olen += len; *(linep + olen) = '\0'; + olinep = linep; } if (cont) { if (fgets(line, LINSIZ, netf)) { From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 10:07:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58742106566C; Tue, 19 Jun 2012 10:07:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 290048FC15; Tue, 19 Jun 2012 10:07:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JA7pfN035286; Tue, 19 Jun 2012 10:07:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JA7odp035284; Tue, 19 Jun 2012 10:07:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206191007.q5JA7odp035284@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Jun 2012 10:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237267 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 10:07:51 -0000 Author: kib Date: Tue Jun 19 10:07:50 2012 New Revision: 237267 URL: http://svn.freebsd.org/changeset/base/237267 Log: MFC r237160: More style. Modified: stable/9/lib/libc/gen/getnetgrent.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/getnetgrent.c ============================================================================== --- stable/9/lib/libc/gen/getnetgrent.c Tue Jun 19 10:06:34 2012 (r237266) +++ stable/9/lib/libc/gen/getnetgrent.c Tue Jun 19 10:07:50 2012 (r237267) @@ -161,8 +161,7 @@ setnetgrent(const char *group) if (group == NULL || !strlen(group)) return; - if (grouphead.gr == (struct netgrp *)0 || - strcmp(group, grouphead.grname)) { + if (grouphead.gr == NULL || strcmp(group, grouphead.grname)) { endnetgrent(); #ifdef YP /* Presumed guilty until proven innocent. */ @@ -172,7 +171,7 @@ setnetgrent(const char *group) * use NIS exclusively. */ if (((stat(_PATH_NETGROUP, &_yp_statp) < 0) && - errno == ENOENT) || _yp_statp.st_size == 0) + errno == ENOENT) || _yp_statp.st_size == 0) _use_only_yp = _netgr_yp_enabled = 1; if ((netf = fopen(_PATH_NETGROUP,"r")) != NULL ||_use_only_yp){ /* @@ -247,27 +246,24 @@ endnetgrent(void) lp = lp->l_next; free(olp->l_groupname); free(olp->l_line); - free((char *)olp); + free(olp); } - linehead = (struct linelist *)0; + linehead = NULL; if (grouphead.grname) { free(grouphead.grname); - grouphead.grname = (char *)0; + grouphead.grname = NULL; } gp = grouphead.gr; while (gp) { ogp = gp; gp = gp->ng_next; - if (ogp->ng_str[NG_HOST]) - free(ogp->ng_str[NG_HOST]); - if (ogp->ng_str[NG_USER]) - free(ogp->ng_str[NG_USER]); - if (ogp->ng_str[NG_DOM]) - free(ogp->ng_str[NG_DOM]); - free((char *)ogp); + free(ogp->ng_str[NG_HOST]); + free(ogp->ng_str[NG_USER]); + free(ogp->ng_str[NG_DOM]); + free(ogp); } - grouphead.gr = (struct netgrp *)0; - nextgrp = (struct netgrp *)0; + grouphead.gr = NULL; + nextgrp = NULL; #ifdef YP _netgr_yp_enabled = 0; #endif @@ -282,7 +278,7 @@ _listmatch(const char *list, const char int glen = strlen(group); /* skip possible leading whitespace */ - while(isspace((unsigned char)*ptr)) + while (isspace((unsigned char)*ptr)) ptr++; while (ptr < list + len) { @@ -291,7 +287,7 @@ _listmatch(const char *list, const char ptr++; if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr)) return (1); - while(*ptr == ',' || isspace((unsigned char)*ptr)) + while (*ptr == ',' || isspace((unsigned char)*ptr)) ptr++; } @@ -436,8 +432,7 @@ parse_netgrp(const char *group) break; lp = lp->l_next; } - if (lp == (struct linelist *)0 && - (lp = read_for_group(group)) == (struct linelist *)0) + if (lp == NULL && (lp = read_for_group(group)) == NULL) return (1); if (lp->l_parsed) { #ifdef DEBUG From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 11:39:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E7E77106564A; Tue, 19 Jun 2012 11:39:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D395E8FC08; Tue, 19 Jun 2012 11:39:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JBduXw041788; Tue, 19 Jun 2012 11:39:56 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JBdugJ041786; Tue, 19 Jun 2012 11:39:56 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201206191139.q5JBdugJ041786@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 19 Jun 2012 11:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237268 - head/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 11:39:57 -0000 Author: bapt Date: Tue Jun 19 11:39:56 2012 New Revision: 237268 URL: http://svn.freebsd.org/changeset/base/237268 Log: Revert user comparison back to user names as some user can share uids (root/toor for example) get the username information from old_pw structures to still allow renaming of a user. Reported by: Claude Buisson Approved by: des (mentor) MFC after: 3 weeks Modified: head/lib/libutil/pw_util.c Modified: head/lib/libutil/pw_util.c ============================================================================== --- head/lib/libutil/pw_util.c Tue Jun 19 10:07:50 2012 (r237267) +++ head/lib/libutil/pw_util.c Tue Jun 19 11:39:56 2012 (r237268) @@ -437,14 +437,21 @@ pw_copy(int ffd, int tfd, const struct p size_t len; int eof, readlen; - spw = pw; + if (old_pw == NULL && pw == NULL) + return (-1); + + spw = old_pw; + /* deleting a user */ if (pw == NULL) { line = NULL; - if (old_pw == NULL) + } else { + if ((line = pw_make(pw)) == NULL) return (-1); - spw = old_pw; - } else if ((line = pw_make(pw)) == NULL) - return (-1); + } + + /* adding a user */ + if (spw == NULL) + spw = pw; eof = 0; len = 0; @@ -511,7 +518,7 @@ pw_copy(int ffd, int tfd, const struct p */ *q = t; - if (fpw == NULL || fpw->pw_uid != spw->pw_uid) { + if (fpw == NULL || strcmp(fpw->pw_name, spw->pw_name) != 0) { /* nope */ if (fpw != NULL) free(fpw); From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 14:46:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADE5F1065677; Tue, 19 Jun 2012 14:46:19 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 982AA8FC1D; Tue, 19 Jun 2012 14:46:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JEkJ1L050839; Tue, 19 Jun 2012 14:46:19 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JEkJTY050836; Tue, 19 Jun 2012 14:46:19 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206191446.q5JEkJTY050836@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 19 Jun 2012 14:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237269 - in head: etc lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 14:46:19 -0000 Author: des Date: Tue Jun 19 14:46:18 2012 New Revision: 237269 URL: http://svn.freebsd.org/changeset/base/237269 Log: Switch the default password hash from md5 to sha512. MFC after: 1 week Modified: head/etc/login.conf head/lib/libutil/login.conf.5 Modified: head/etc/login.conf ============================================================================== --- head/etc/login.conf Tue Jun 19 11:39:56 2012 (r237268) +++ head/etc/login.conf Tue Jun 19 14:46:18 2012 (r237269) @@ -23,7 +23,7 @@ # AND SEMANTICS'' section of getcap(3) for more escape sequences). default:\ - :passwd_format=md5:\ + :passwd_format=sha512:\ :copyright=/etc/COPYRIGHT:\ :welcome=/etc/motd:\ :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\ Modified: head/lib/libutil/login.conf.5 ============================================================================== --- head/lib/libutil/login.conf.5 Tue Jun 19 11:39:56 2012 (r237268) +++ head/lib/libutil/login.conf.5 Tue Jun 19 14:46:18 2012 (r237269) @@ -267,7 +267,7 @@ The backoff delay is the number of tries multiplied by 5 seconds. .It "login-retries number 10 The number of login attempts" allowed before the login fails. -.It "passwd_format string md5 The encryption format that new or" +.It "passwd_format string sha512 The encryption format that new or" changed passwords will use. Valid values include "des", "md5", "blf", "sha256" and "sha512"; see .Xr crypt 3 From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 14:47:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30FE01065670; Tue, 19 Jun 2012 14:47:08 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B93D8FC22; Tue, 19 Jun 2012 14:47:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JEl7ua050910; Tue, 19 Jun 2012 14:47:07 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JEl7DO050908; Tue, 19 Jun 2012 14:47:07 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206191447.q5JEl7DO050908@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 19 Jun 2012 14:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237270 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 14:47:08 -0000 Author: des Date: Tue Jun 19 14:47:07 2012 New Revision: 237270 URL: http://svn.freebsd.org/changeset/base/237270 Log: Passive mode is the default, and has been for a while. MFC after: 1 week Modified: head/etc/login.conf Modified: head/etc/login.conf ============================================================================== --- head/etc/login.conf Tue Jun 19 14:46:18 2012 (r237269) +++ head/etc/login.conf Tue Jun 19 14:47:07 2012 (r237270) @@ -26,7 +26,7 @@ default:\ :passwd_format=sha512:\ :copyright=/etc/COPYRIGHT:\ :welcome=/etc/motd:\ - :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\ + :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ :path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\ :nologin=/var/run/nologin:\ :cputime=unlimited:\ From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 15:15:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7E661065674; Tue, 19 Jun 2012 15:15:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3D368FC23; Tue, 19 Jun 2012 15:15:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JFFZ6E052405; Tue, 19 Jun 2012 15:15:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JFFZDk052403; Tue, 19 Jun 2012 15:15:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206191515.q5JFFZDk052403@svn.freebsd.org> From: John Baldwin Date: Tue, 19 Jun 2012 15:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237271 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 15:15:36 -0000 Author: jhb Date: Tue Jun 19 15:15:35 2012 New Revision: 237271 URL: http://svn.freebsd.org/changeset/base/237271 Log: Fix another off-by-one error in the previous fix so that the new start address is properly aligned. While here, use a simpler expression to align the new end address that we use elsewhere for aligning the end. Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Tue Jun 19 14:47:07 2012 (r237270) +++ head/sys/dev/pci/pci_pci.c Tue Jun 19 15:15:35 2012 (r237271) @@ -913,7 +913,7 @@ pcib_grow_window(struct pcib_softc *sc, if (bootverbose) printf("\tfront candidate range: %#lx-%#lx\n", front, end_free); - front &= ~(1ul << w->step) - 1; + front &= ~((1ul << w->step) - 1); front = rman_get_start(w->res) - front; } else front = 0; @@ -941,7 +941,7 @@ pcib_grow_window(struct pcib_softc *sc, if (bootverbose) printf("\tback candidate range: %#lx-%#lx\n", start_free, back); - back = roundup2(back + 1, 1ul << w->step) - 1; + back |= (1ul << w->step) - 1; back -= rman_get_end(w->res); } else back = 0; From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 16:06:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B0F7106564A; Tue, 19 Jun 2012 16:06:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B35A8FC14; Tue, 19 Jun 2012 16:06:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JG6SZD060043; Tue, 19 Jun 2012 16:06:28 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JG6Ron060041; Tue, 19 Jun 2012 16:06:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206191606.q5JG6Ron060041@svn.freebsd.org> From: John Baldwin Date: Tue, 19 Jun 2012 16:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237272 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 16:06:28 -0000 Author: jhb Date: Tue Jun 19 16:06:27 2012 New Revision: 237272 URL: http://svn.freebsd.org/changeset/base/237272 Log: Add a 'wmask' variable to hold the expression '(1ul << w->step) - 1' in pcib_grow_window(). This makes the code slightly easier to read and prevents the type of bug fixed in r237271. MFC after: 3 days Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Tue Jun 19 15:15:35 2012 (r237271) +++ head/sys/dev/pci/pci_pci.c Tue Jun 19 16:06:27 2012 (r237272) @@ -815,7 +815,7 @@ static int pcib_grow_window(struct pcib_softc *sc, struct pcib_window *w, int type, u_long start, u_long end, u_long count, u_int flags) { - u_long align, start_free, end_free, front, back; + u_long align, start_free, end_free, front, back, wmask; int error, rid; /* @@ -828,6 +828,7 @@ pcib_grow_window(struct pcib_softc *sc, end = w->rman.rm_end; if (start + count - 1 > end || start + count < start) return (EINVAL); + wmask = (1ul << w->step) - 1; /* * If there is no resource at all, just try to allocate enough @@ -838,8 +839,8 @@ pcib_grow_window(struct pcib_softc *sc, flags &= ~RF_ALIGNMENT_MASK; flags |= RF_ALIGNMENT_LOG2(w->step); } - start &= ~((1ul << w->step) - 1); - end |= ((1ul << w->step) - 1); + start &= ~wmask; + end |= wmask; count = roundup2(count, 1ul << w->step); rid = w->reg; w->res = bus_alloc_resource(sc->dev, type, &rid, start, end, @@ -913,7 +914,7 @@ pcib_grow_window(struct pcib_softc *sc, if (bootverbose) printf("\tfront candidate range: %#lx-%#lx\n", front, end_free); - front &= ~((1ul << w->step) - 1); + front &= ~wmask; front = rman_get_start(w->res) - front; } else front = 0; @@ -941,7 +942,7 @@ pcib_grow_window(struct pcib_softc *sc, if (bootverbose) printf("\tback candidate range: %#lx-%#lx\n", start_free, back); - back |= (1ul << w->step) - 1; + back |= wmask; back -= rman_get_end(w->res); } else back = 0; @@ -1000,10 +1001,8 @@ updatewin: /* Save the new window. */ w->base = rman_get_start(w->res); w->limit = rman_get_end(w->res); - KASSERT((w->base & ((1ul << w->step) - 1)) == 0, - ("start address is not aligned")); - KASSERT((w->limit & ((1ul << w->step) - 1)) == (1ul << w->step) - 1, - ("end address is not aligned")); + KASSERT((w->base & wmask) == 0, ("start address is not aligned")); + KASSERT((w->limit & wmask) == wmask, ("end address is not aligned")); pcib_write_windows(sc, w->mask); return (0); } From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 16:13:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 47A0F106566C; Tue, 19 Jun 2012 16:13:20 +0000 (UTC) Date: Tue, 19 Jun 2012 16:13:20 +0000 From: Alexey Dokuchaev To: Dag-Erling Smorgrav Message-ID: <20120619161320.GA54109@FreeBSD.org> References: <201206191446.q5JEkJTY050836@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201206191446.q5JEkJTY050836@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237269 - in head: etc lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 16:13:20 -0000 On Tue, Jun 19, 2012 at 02:46:19PM +0000, Dag-Erling Smorgrav wrote: > Author: des > Date: Tue Jun 19 14:46:18 2012 > New Revision: 237269 > URL: http://svn.freebsd.org/changeset/base/237269 > > Log: > Switch the default password hash from md5 to sha512. Pardon my possible unawareness, but was this change discussed anywhere? I understand the rationale to move away from MD5, but reasons for SHA512 seem moot. I've personally had been using Blowfish for password hashes since OpenBSD switched to it, for example, as fast and apparently reliable hash. Is there anything wrong with it? Why SHA512 is clear winner here? FWIW, ports use SHA256 for now. Could it be that switch to SHA512 will impose perfomance problems? ./danfe From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 16:21:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55C97106564A; Tue, 19 Jun 2012 16:21:16 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1E3528FC08; Tue, 19 Jun 2012 16:21:14 +0000 (UTC) Received: by bkvi18 with SMTP id i18so6610821bkv.13 for ; Tue, 19 Jun 2012 09:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=AHOOm6WRNMaGmwpHbpgLcK1f5MEV6lxX7+yzhirkTbw=; b=pnSCNfJ6MUbI1gZexsVGaaqA/5LOlLOdRzA+NsoEAVFbuQAVoF0JsztQQQVgnAOZv5 aAuJhxLl4mMOtSLmtzJphULC6Z8UjJIjFS7ozPP1SgAXqYaHyvSypT7WJWzeZuI1Aavj l6+iHxiACOpJ2taffyCLUWFouYP4llZHYhuNpsuIMX0pJ48FxE0jSzKdt8l0ie5rHJtw AvMltMfI+sPBufAplAhNSOYSHAkioDV5QRTaF9rU39i9bR4CmmAWkW2SkV6PuYKMMGdP kxg/YKUVguu6YJ60v7kAGo0K2YOStJwViMN4CV1ghLHpt+wBF1KTcInT88tMNUFc3T9v tY7w== MIME-Version: 1.0 Received: by 10.204.153.15 with SMTP id i15mr52711bkw.74.1340122874110; Tue, 19 Jun 2012 09:21:14 -0700 (PDT) Received: by 10.204.171.138 with HTTP; Tue, 19 Jun 2012 09:21:13 -0700 (PDT) Received: by 10.204.171.138 with HTTP; Tue, 19 Jun 2012 09:21:13 -0700 (PDT) In-Reply-To: <20120619161320.GA54109@FreeBSD.org> References: <201206191446.q5JEkJTY050836@svn.freebsd.org> <20120619161320.GA54109@FreeBSD.org> Date: Tue, 19 Jun 2012 17:21:13 +0100 Message-ID: From: Chris Rees To: Alexey Dokuchaev Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r237269 - in head: etc lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 16:21:16 -0000 On Jun 19, 2012 5:15 PM, "Alexey Dokuchaev" wrote: > > On Tue, Jun 19, 2012 at 02:46:19PM +0000, Dag-Erling Smorgrav wrote: > > Author: des > > Date: Tue Jun 19 14:46:18 2012 > > New Revision: 237269 > > URL: http://svn.freebsd.org/changeset/base/237269 > > > > Log: > > Switch the default password hash from md5 to sha512. > > Pardon my possible unawareness, but was this change discussed anywhere? http://lists.freebsd.org/pipermail/freebsd-security/2012-June/006271.html > I understand the rationale to move away from MD5, but reasons for SHA512 > seem moot. I've personally had been using Blowfish for password hashes > since OpenBSD switched to it, for example, as fast and apparently reliable > hash. Is there anything wrong with it? Why SHA512 is clear winner here? > FWIW, ports use SHA256 for now. Could it be that switch to SHA512 will > impose perfomance problems? Why would you want password matching to be fast? That makes brute-forcing easier. Chris From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 17:13:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA887106566B; Tue, 19 Jun 2012 17:13:14 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 963698FC15; Tue, 19 Jun 2012 17:13:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JHDEff071288; Tue, 19 Jun 2012 17:13:14 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JHDEbk071286; Tue, 19 Jun 2012 17:13:14 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201206191713.q5JHDEbk071286@svn.freebsd.org> From: Sean Bruno Date: Tue, 19 Jun 2012 17:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237273 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 17:13:14 -0000 Author: sbruno Date: Tue Jun 19 17:13:14 2012 New Revision: 237273 URL: http://svn.freebsd.org/changeset/base/237273 Log: Correct misunderstanding of hw.est.strict Setting strict causes a validation of the requested value vs the value currently running after a frequency change is requested. Change applicability to be single core not i386. Thanks to mav@ for reviewing and commenting on my lack of understanding. MFC after: 2 weeks Modified: head/share/man/man4/est.4 Modified: head/share/man/man4/est.4 ============================================================================== --- head/share/man/man4/est.4 Tue Jun 19 16:06:27 2012 (r237272) +++ head/share/man/man4/est.4 Tue Jun 19 17:13:14 2012 (r237273) @@ -66,8 +66,8 @@ Attempt to infer information from direct Should only be used in diagnostic cases .Pq default 0 .It hw.est.strict -Do not allow different cpus to be set to different frequencies. -It appears that this will only work on i386 systems +Validate frequency requested is accepted by the cpu when set. +It appears that this will only work on single core cpus. .Pq default 0 .El .Sh DIAGNOSTICS From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 17:17:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 1E004106566B; Tue, 19 Jun 2012 17:17:26 +0000 (UTC) Date: Tue, 19 Jun 2012 17:17:26 +0000 From: Alexey Dokuchaev To: Chris Rees Message-ID: <20120619171726.GA72257@FreeBSD.org> References: <201206191446.q5JEkJTY050836@svn.freebsd.org> <20120619161320.GA54109@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r237269 - in head: etc lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 17:17:26 -0000 On Tue, Jun 19, 2012 at 05:21:13PM +0100, Chris Rees wrote: > On Jun 19, 2012 5:15 PM, "Alexey Dokuchaev" wrote: > > Pardon my possible unawareness, but was this change discussed anywhere? > > http://lists.freebsd.org/pipermail/freebsd-security/2012-June/006271.html Thanks for the link, I didn't check -security@ for some reason. > > I understand the rationale to move away from MD5, but reasons for SHA512 > > seem moot. I've personally had been using Blowfish for password hashes > > since OpenBSD switched to it, for example, as fast and apparently reliable > > hash. Is there anything wrong with it? Why SHA512 is clear winner here? > > FWIW, ports use SHA256 for now. Could it be that switch to SHA512 will > > impose performance problems? > > Why would you want password matching to be fast? That makes brute-forcing > easier. Maybe I don't. I just want to know if I should switch from Blowfish to SHA512. It seems that the former is quite popular judging from discussion link given above. It also seems that des@' rationale for the switch boils down to "I vastly prefer sha512 to blf, as that is what the rest of the world uses." If there's nothing wrong with Blowfish, I guess I'll stick to it as I prefer compatibility among *BSD to some weird Unix clones. :-) ./danfe From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 18:27:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3046110656A6; Tue, 19 Jun 2012 18:27:54 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id C9FF08FC19; Tue, 19 Jun 2012 18:27:53 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id D24D86641; Tue, 19 Jun 2012 18:27:52 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 6EFF38479; Tue, 19 Jun 2012 20:27:52 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alexey Dokuchaev References: <201206191446.q5JEkJTY050836@svn.freebsd.org> <20120619161320.GA54109@FreeBSD.org> <20120619171726.GA72257@FreeBSD.org> Date: Tue, 19 Jun 2012 20:27:52 +0200 In-Reply-To: <20120619171726.GA72257@FreeBSD.org> (Alexey Dokuchaev's message of "Tue, 19 Jun 2012 17:17:26 +0000") Message-ID: <86d34v40nr.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Chris Rees Subject: Re: svn commit: r237269 - in head: etc lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 18:27:54 -0000 Alexey Dokuchaev writes: > Maybe I don't. I just want to know if I should switch from Blowfish to > SHA512. It seems that the former is quite popular judging from discussion > link given above. It also seems that des@' rationale for the switch boils > down to "I vastly prefer sha512 to blf, as that is what the rest of the > world uses." If there's nothing wrong with Blowfish, I guess I'll stick = to > it as I prefer compatibility among *BSD to some weird Unix clones. :-) My understanding is that blf and sha512 are approximately equally hard (or equally easy, if you like) to brute-force with a CPU, but sha512 is supposedly less GPU-friendly. That plus compatibility - but mostly compatibility, to be honest - tipped the scales in favor of sha512. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 18:40:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 01DDE106566C; Tue, 19 Jun 2012 18:40:20 +0000 (UTC) Date: Tue, 19 Jun 2012 18:40:19 +0000 From: Alexey Dokuchaev To: Dag-Erling Sm??rgrav Message-ID: <20120619184019.GA4692@FreeBSD.org> References: <201206191446.q5JEkJTY050836@svn.freebsd.org> <20120619161320.GA54109@FreeBSD.org> <20120619171726.GA72257@FreeBSD.org> <86d34v40nr.fsf@ds4.des.no> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <86d34v40nr.fsf@ds4.des.no> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Chris Rees Subject: Re: svn commit: r237269 - in head: etc lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 18:40:20 -0000 On Tue, Jun 19, 2012 at 08:27:52PM +0200, Dag-Erling Sm??rgrav wrote: > Alexey Dokuchaev writes: > > Maybe I don't. I just want to know if I should switch from Blowfish to > > SHA512. It seems that the former is quite popular judging from discussion > > link given above. It also seems that des@' rationale for the switch boils > > down to "I vastly prefer sha512 to blf, as that is what the rest of the > > world uses." If there's nothing wrong with Blowfish, I guess I'll stick to > > it as I prefer compatibility among *BSD to some weird Unix clones. :-) > > My understanding is that blf and sha512 are approximately equally hard > (or equally easy, if you like) to brute-force with a CPU, but sha512 is > supposedly less GPU-friendly. That plus compatibility - but mostly > compatibility, to be honest - tipped the scales in favor of sha512. This CPU vs. GPU particularity is something I wanted to know about, actually. Thanks for this piece of knowledge Dag-Erling, and sorry for the noise. ./danfe From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 18:42:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9F2210656D8; Tue, 19 Jun 2012 18:42:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 939818FC1F; Tue, 19 Jun 2012 18:42:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JIgP2Y085923; Tue, 19 Jun 2012 18:42:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JIgPBw085918; Tue, 19 Jun 2012 18:42:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206191842.q5JIgPBw085918@svn.freebsd.org> From: John Baldwin Date: Tue, 19 Jun 2012 18:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237274 - in head: lib/libc/sys sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 18:42:26 -0000 Author: jhb Date: Tue Jun 19 18:42:24 2012 New Revision: 237274 URL: http://svn.freebsd.org/changeset/base/237274 Log: Further refine the implementation of POSIX_FADV_NOREUSE. First, extend the changes in r230782 to better handle the common case of using NOREUSE with sequential reads. A NOREUSE file descriptor will now track the last implicit DONTNEED request it made as a result of a NOREUSE read. If a subsequent NOREUSE read is adjacent to the previous range, it will apply the DONTNEED request to the entire range of both the previous read and the current read. The effect is that each read of a file accessed sequentially will apply the DONTNEED request to the entire range that has been read. This allows NOREUSE to properly handle misaligned reads by flushing each buffer to cache once it has been completely read. Second, apply the same changes made to read(2) by r230782 and this change to writes. This provides much better performance in the sequential write case as it allows writes to still be clustered. It also provides much better performance for misaligned writes. It does mean that NOREUSE will be generally ineffective for non-sequential writes as the current implementation relies on a future NOREUSE write's implicit DONTNEED request to flush the dirty buffer from the current write. MFC after: 2 weeks Modified: head/lib/libc/sys/posix_fadvise.2 head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/sys/file.h Modified: head/lib/libc/sys/posix_fadvise.2 ============================================================================== --- head/lib/libc/sys/posix_fadvise.2 Tue Jun 19 17:13:14 2012 (r237273) +++ head/lib/libc/sys/posix_fadvise.2 Tue Jun 19 18:42:24 2012 (r237274) @@ -28,7 +28,7 @@ .\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd June 19, 2012 .Dt POSIX_FADVISE 2 .Os .Sh NAME @@ -84,10 +84,9 @@ specified range and future access to thi .It Dv POSIX_FADV_NOREUSE Tells the system that the specified data will only be accessed once and then not reused. -Accesses to data within the specified range are treated as if the file -descriptor has the -.Dv O_DIRECT -flag enabled. +The system may decrease the in-memory priority of data once it has been +read or written. +Future access to this data may require a read operation. .El .Sh RETURN VALUES .Rv -std posix_fadvise Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Jun 19 17:13:14 2012 (r237273) +++ head/sys/kern/vfs_syscalls.c Tue Jun 19 18:42:24 2012 (r237274) @@ -4872,6 +4872,8 @@ kern_posix_fadvise(struct thread *td, in new->fa_advice = advice; new->fa_start = offset; new->fa_end = end; + new->fa_prevstart = 0; + new->fa_prevend = 0; fp->f_advice = new; new = fa; } Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Jun 19 17:13:14 2012 (r237273) +++ head/sys/kern/vfs_vnops.c Tue Jun 19 18:42:24 2012 (r237274) @@ -542,7 +542,7 @@ vn_read(fp, uio, active_cred, flags, td) int error, ioflag; struct mtx *mtxp; int advice, vfslocked; - off_t offset; + off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -607,9 +607,38 @@ vn_read(fp, uio, active_cred, flags, td) fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0); if (error == 0 && advice == POSIX_FADV_NOREUSE && - offset != uio->uio_offset) - error = VOP_ADVISE(vp, offset, uio->uio_offset - 1, - POSIX_FADV_DONTNEED); + offset != uio->uio_offset) { + /* + * Use POSIX_FADV_DONTNEED to flush clean pages and + * buffers for the backing file after a + * POSIX_FADV_NOREUSE read(2). To optimize the common + * case of using POSIX_FADV_NOREUSE with sequential + * access, track the previous implicit DONTNEED + * request and grow this request to include the + * current read(2) in addition to the previous + * DONTNEED. With purely sequential access this will + * cause the DONTNEED requests to continously grow to + * cover all of the previously read regions of the + * file. This allows filesystem blocks that are + * accessed by multiple calls to read(2) to be flushed + * once the last read(2) finishes. + */ + start = offset; + end = uio->uio_offset - 1; + mtx_lock(mtxp); + if (fp->f_advice != NULL && + fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { + if (start != 0 && fp->f_advice->fa_prevend + 1 == start) + start = fp->f_advice->fa_prevstart; + else if (fp->f_advice->fa_prevstart != 0 && + fp->f_advice->fa_prevstart == end + 1) + end = fp->f_advice->fa_prevend; + fp->f_advice->fa_prevstart = start; + fp->f_advice->fa_prevend = end; + } + mtx_unlock(mtxp); + error = VOP_ADVISE(vp, start, end, POSIX_FADV_DONTNEED); + } VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -630,6 +659,7 @@ vn_write(fp, uio, active_cred, flags, td int error, ioflag, lock_flags; struct mtx *mtxp; int advice, vfslocked; + off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -664,6 +694,7 @@ vn_write(fp, uio, active_cred, flags, td if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; advice = POSIX_FADV_NORMAL; + mtxp = NULL; if (fp->f_advice != NULL) { mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); @@ -676,19 +707,14 @@ vn_write(fp, uio, active_cred, flags, td switch (advice) { case POSIX_FADV_NORMAL: case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_NOREUSE: ioflag |= sequential_heuristic(uio, fp); break; case POSIX_FADV_RANDOM: /* XXX: Is this correct? */ break; - case POSIX_FADV_NOREUSE: - /* - * Request the underlying FS to discard the buffers - * and pages after the I/O is complete. - */ - ioflag |= IO_DIRECT; - break; } + offset = uio->uio_offset; #ifdef MAC error = mac_vnode_check_write(active_cred, fp->f_cred, vp); @@ -701,6 +727,55 @@ vn_write(fp, uio, active_cred, flags, td VOP_UNLOCK(vp, 0); if (vp->v_type != VCHR) vn_finished_write(mp); + if (error == 0 && advice == POSIX_FADV_NOREUSE && + offset != uio->uio_offset) { + /* + * Use POSIX_FADV_DONTNEED to flush clean pages and + * buffers for the backing file after a + * POSIX_FADV_NOREUSE write(2). To optimize the + * common case of using POSIX_FADV_NOREUSE with + * sequential access, track the previous implicit + * DONTNEED request and grow this request to include + * the current write(2) in addition to the previous + * DONTNEED. With purely sequential access this will + * cause the DONTNEED requests to continously grow to + * cover all of the previously written regions of the + * file. + * + * Note that the blocks just written are almost + * certainly still dirty, so this only works when + * VOP_ADVISE() calls from subsequent writes push out + * the data written by this write(2) once the backing + * buffers are clean. However, as compared to forcing + * IO_DIRECT, this gives much saner behavior. Write + * clustering is still allowed, and clean pages are + * merely moved to the cache page queue rather than + * outright thrown away. This means a subsequent + * read(2) can still avoid hitting the disk if the + * pages have not been reclaimed. + * + * This does make POSIX_FADV_NOREUSE largely useless + * with non-sequential access. However, sequential + * access is the more common use case and the flag is + * merely advisory. + */ + start = offset; + end = uio->uio_offset - 1; + mtx_lock(mtxp); + if (fp->f_advice != NULL && + fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { + if (start != 0 && fp->f_advice->fa_prevend + 1 == start) + start = fp->f_advice->fa_prevstart; + else if (fp->f_advice->fa_prevstart != 0 && + fp->f_advice->fa_prevstart == end + 1) + end = fp->f_advice->fa_prevend; + fp->f_advice->fa_prevstart = start; + fp->f_advice->fa_prevend = end; + } + mtx_unlock(mtxp); + error = VOP_ADVISE(vp, start, end, POSIX_FADV_DONTNEED); + } + unlock: VFS_UNLOCK_GIANT(vfslocked); return (error); Modified: head/sys/sys/file.h ============================================================================== --- head/sys/sys/file.h Tue Jun 19 17:13:14 2012 (r237273) +++ head/sys/sys/file.h Tue Jun 19 18:42:24 2012 (r237274) @@ -126,6 +126,8 @@ struct fadvise_info { int fa_advice; /* (f) FADV_* type. */ off_t fa_start; /* (f) Region start. */ off_t fa_end; /* (f) Region end. */ + off_t fa_prevstart; /* (f) Previous NOREUSE start. */ + off_t fa_prevend; /* (f) Previous NOREUSE end. */ }; struct file { From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 22:22:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49D111065672; Tue, 19 Jun 2012 22:22:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34ABE8FC0A; Tue, 19 Jun 2012 22:22:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JMM0S1000745; Tue, 19 Jun 2012 22:22:00 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JMLxVj000743; Tue, 19 Jun 2012 22:22:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206192222.q5JMLxVj000743@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 19 Jun 2012 22:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237276 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 22:22:00 -0000 Author: pjd Date: Tue Jun 19 22:21:59 2012 New Revision: 237276 URL: http://svn.freebsd.org/changeset/base/237276 Log: The falloc() function obtains two references to newly created 'fp'. On success we have to drop one after procdesc_finit() and on failure we have to close allocated slot with fdclose(), which also drops one reference for us and drop the remaining reference with fdrop(). Without this change closing process descriptor didn't result in killing pdfork(2)ed child. Reviewed by: rwatson MFC after: 1 month Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Tue Jun 19 19:40:54 2012 (r237275) +++ head/sys/kern/kern_fork.c Tue Jun 19 22:21:59 2012 (r237276) @@ -921,8 +921,10 @@ fork1(struct thread *td, int flags, int */ *procp = newproc; #ifdef PROCDESC - if (flags & RFPROCDESC) + if (flags & RFPROCDESC) { procdesc_finit(newproc->p_procdesc, fp_procdesc); + fdrop(fp_procdesc, td); + } #endif racct_proc_fork_done(newproc); return (0); @@ -944,8 +946,10 @@ fail1: vmspace_free(vm2); uma_zfree(proc_zone, newproc); #ifdef PROCDESC - if (((flags & RFPROCDESC) != 0) && (fp_procdesc != NULL)) + if (((flags & RFPROCDESC) != 0) && (fp_procdesc != NULL)) { + fdclose(td->td_proc->p_fd, fp_procdesc, *procdescp, td); fdrop(fp_procdesc, td); + } #endif pause("fork", hz / 2); return (error); From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 22:24:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3066D106566B; Tue, 19 Jun 2012 22:24:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B5888FC0C; Tue, 19 Jun 2012 22:24:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JMNxDf000865; Tue, 19 Jun 2012 22:23:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JMNxs3000863; Tue, 19 Jun 2012 22:23:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206192223.q5JMNxs3000863@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 19 Jun 2012 22:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237277 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 22:24:00 -0000 Author: pjd Date: Tue Jun 19 22:23:59 2012 New Revision: 237277 URL: http://svn.freebsd.org/changeset/base/237277 Log: Check proper flag (PDF_DAEMON, not PD_DAEMON) when deciding if the process should be killed or not. This fixes killing pdfork(2)ed process on last close of the corresponding process descriptor. Reviewed by: rwatson MFC after: 1 month Modified: head/sys/kern/sys_procdesc.c Modified: head/sys/kern/sys_procdesc.c ============================================================================== --- head/sys/kern/sys_procdesc.c Tue Jun 19 22:21:59 2012 (r237276) +++ head/sys/kern/sys_procdesc.c Tue Jun 19 22:23:59 2012 (r237277) @@ -338,7 +338,7 @@ procdesc_reap(struct proc *p) /* * procdesc_close() - last close on a process descriptor. If the process is - * still running, terminate with SIGKILL (unless PD_DAEMON is set) and let + * still running, terminate with SIGKILL (unless PDF_DAEMON is set) and let * init(8) clean up the mess; if not, we have to clean up the zombie ourselves. */ static int @@ -386,7 +386,7 @@ procdesc_close(struct file *fp, struct t */ p->p_sigparent = SIGCHLD; proc_reparent(p, initproc); - if ((pd->pd_flags & PD_DAEMON) == 0) + if ((pd->pd_flags & PDF_DAEMON) == 0) kern_psignal(p, SIGKILL); PROC_UNLOCK(p); sx_xunlock(&proctree_lock); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 00:09:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 694C5106568D; Wed, 20 Jun 2012 00:09:48 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54A6B8FC17; Wed, 20 Jun 2012 00:09:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K09mwp005360; Wed, 20 Jun 2012 00:09:48 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K09mVQ005357; Wed, 20 Jun 2012 00:09:48 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201206200009.q5K09mVQ005357@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 20 Jun 2012 00:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237279 - in head: etc/mtree include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 00:09:48 -0000 Author: obrien Date: Wed Jun 20 00:09:47 2012 New Revision: 237279 URL: http://svn.freebsd.org/changeset/base/237279 Log: Install filemon.h into /usr/include for userland consumption. Modified: head/etc/mtree/BSD.include.dist head/include/Makefile Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Tue Jun 19 23:45:17 2012 (r237278) +++ head/etc/mtree/BSD.include.dist Wed Jun 20 00:09:47 2012 (r237279) @@ -102,6 +102,8 @@ .. ciss .. + filemon + .. firewire .. hwpmc Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Tue Jun 19 23:45:17 2012 (r237278) +++ head/include/Makefile Wed Jun 20 00:09:47 2012 (r237279) @@ -39,7 +39,7 @@ LDIRS= bsm cam geom net net80211 netatal sys vm LSUBDIRS= cam/ata cam/scsi \ - dev/acpica dev/an dev/bktr dev/ciss dev/firewire dev/hwpmc \ + dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 00:17:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDBB41065676; Wed, 20 Jun 2012 00:17:29 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEF338FC18; Wed, 20 Jun 2012 00:17:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K0HTvK005818; Wed, 20 Jun 2012 00:17:29 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K0HTvx005813; Wed, 20 Jun 2012 00:17:29 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201206200017.q5K0HTvx005813@svn.freebsd.org> From: Scott Long Date: Wed, 20 Jun 2012 00:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237281 - head/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 00:17:30 -0000 Author: scottl Date: Wed Jun 20 00:17:29 2012 New Revision: 237281 URL: http://svn.freebsd.org/changeset/base/237281 Log: Update the 'fwdownload' command to also flash disks connected over an ATA/SATA transport. The detection logic is automatic, so it should Just Work. While here, also improve the progress meter that is displayed during firmware download. Submitted by: Alistair Crooks Obtained from: Netflix, Inc. MFC after: 3 days Modified: head/sbin/camcontrol/Makefile head/sbin/camcontrol/camcontrol.c head/sbin/camcontrol/camcontrol.h head/sbin/camcontrol/fwdownload.c Modified: head/sbin/camcontrol/Makefile ============================================================================== --- head/sbin/camcontrol/Makefile Wed Jun 20 00:13:44 2012 (r237280) +++ head/sbin/camcontrol/Makefile Wed Jun 20 00:17:29 2012 (r237281) @@ -3,7 +3,7 @@ PROG= camcontrol SRCS= camcontrol.c util.c .if !defined(RELEASE_CRUNCH) -SRCS+= fwdownload.c modeedit.c +SRCS+= fwdownload.c modeedit.c progress.c .else CFLAGS+= -DMINIMALISTIC .endif Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Wed Jun 20 00:13:44 2012 (r237280) +++ head/sbin/camcontrol/camcontrol.c Wed Jun 20 00:17:29 2012 (r237281) @@ -3071,6 +3071,26 @@ get_cgd_bailout: return(retval); } +/* return the type of disk (really the command type) */ +static const char * +get_disk_type(struct cam_device *device) +{ + struct ccb_getdev cgd; + + (void) memset(&cgd, 0x0, sizeof(cgd)); + get_cgd(device, &cgd); + switch(cgd.protocol) { + case PROTO_SCSI: + return "scsi"; + case PROTO_ATA: + case PROTO_ATAPI: + case PROTO_SATAPM: + return "ata"; + default: + return "unknown"; + } +} + static void cpi_print(struct ccb_pathinq *cpi) { @@ -6197,7 +6217,8 @@ main(int argc, char **argv) break; case CAM_CMD_DOWNLOAD_FW: error = fwdownload(cam_dev, argc, argv, combinedopt, - arglist & CAM_ARG_VERBOSE, retry_count, timeout); + arglist & CAM_ARG_VERBOSE, retry_count, timeout, + get_disk_type(cam_dev)); break; #endif /* MINIMALISTIC */ case CAM_CMD_USAGE: Modified: head/sbin/camcontrol/camcontrol.h ============================================================================== --- head/sbin/camcontrol/camcontrol.h Wed Jun 20 00:13:44 2012 (r237280) +++ head/sbin/camcontrol/camcontrol.h Wed Jun 20 00:17:29 2012 (r237281) @@ -41,7 +41,8 @@ struct get_hook }; int fwdownload(struct cam_device *device, int argc, char **argv, - char *combinedopt, int verbose, int retry_count, int timeout); + char *combinedopt, int verbose, int retry_count, int timeout, + const char */*type*/); void mode_sense(struct cam_device *device, int mode_page, int page_control, int dbd, int retry_count, int timeout, u_int8_t *data, int datalen); Modified: head/sbin/camcontrol/fwdownload.c ============================================================================== --- head/sbin/camcontrol/fwdownload.c Wed Jun 20 00:13:44 2012 (r237280) +++ head/sbin/camcontrol/fwdownload.c Wed Jun 20 00:17:29 2012 (r237281) @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "progress.h" + #include "camcontrol.h" #define CMD_TIMEOUT 50000 /* 50 seconds */ @@ -73,6 +75,7 @@ typedef enum { VENDOR_HP, VENDOR_IBM, VENDOR_PLEXTOR, + VENDOR_QUALSTAR, VENDOR_QUANTUM, VENDOR_SEAGATE, VENDOR_UNKNOWN @@ -93,17 +96,43 @@ static const struct fw_vendor vendors_li {VENDOR_HP, "HP", 0x8000, 0x07, 0x07, 0, 1}, {VENDOR_IBM, "IBM", 0x8000, 0x05, 0x05, 1, 0}, {VENDOR_PLEXTOR, "PLEXTOR", 0x2000, 0x04, 0x05, 0, 1}, + {VENDOR_QUALSTAR, "QUALSTAR", 0x2030, 0x05, 0x05, 0, 0}, {VENDOR_QUANTUM, "QUANTUM", 0x2000, 0x04, 0x05, 0, 1}, {VENDOR_SEAGATE, "SEAGATE", 0x8000, 0x07, 0x07, 0, 1}, + /* the next 2 are SATA disks going through SAS HBA */ + {VENDOR_SEAGATE, "ATA ST", 0x8000, 0x07, 0x07, 0, 1}, + {VENDOR_HITACHI, "ATA HDS", 0x8000, 0x05, 0x05, 1, 0}, {VENDOR_UNKNOWN, NULL, 0x0000, 0x00, 0x00, 0, 0} }; +#ifndef ATA_DOWNLOAD_MICROCODE +#define ATA_DOWNLOAD_MICROCODE 0x92 +#endif + +#define USE_OFFSETS_FEATURE 0x3 + +#ifndef LOW_SECTOR_SIZE +#define LOW_SECTOR_SIZE 512 +#endif + +#define ATA_MAKE_LBA(o, p) \ + ((((((o) / LOW_SECTOR_SIZE) >> 8) & 0xff) << 16) | \ + ((((o) / LOW_SECTOR_SIZE) & 0xff) << 8) | \ + ((((p) / LOW_SECTOR_SIZE) >> 8) & 0xff)) + +#define ATA_MAKE_SECTORS(p) (((p) / 512) & 0xff) + +#ifndef UNKNOWN_MAX_PKT_SIZE +#define UNKNOWN_MAX_PKT_SIZE 0x8000 +#endif + static const struct fw_vendor *fw_get_vendor(struct cam_device *cam_dev); static char *fw_read_img(const char *fw_img_path, const struct fw_vendor *vp, int *num_bytes); static int fw_download_img(struct cam_device *cam_dev, const struct fw_vendor *vp, char *buf, int img_size, - int sim_mode, int verbose, int retry_count, int timeout); + int sim_mode, int verbose, int retry_count, int timeout, + const char */*name*/, const char */*type*/); /* * Find entry in vendors list that belongs to @@ -173,6 +202,9 @@ fw_read_img(const char *fw_img_path, con (img_size % 512 == 80)) skip_bytes = 80; break; + case VENDOR_QUALSTAR: + skip_bytes = img_size % 1030; + break; default: break; } @@ -207,26 +239,57 @@ bailout1: static int fw_download_img(struct cam_device *cam_dev, const struct fw_vendor *vp, char *buf, int img_size, int sim_mode, int verbose, int retry_count, - int timeout) + int timeout, const char *imgname, const char *type) { struct scsi_write_buffer cdb; + progress_t progress; + int size; union ccb *ccb; int pkt_count = 0; + int max_pkt_size; u_int32_t pkt_size = 0; char *pkt_ptr = buf; u_int32_t offset; int last_pkt = 0; + int16_t *ptr; if ((ccb = cam_getccb(cam_dev)) == NULL) { warnx("Could not allocate CCB"); return (1); } - scsi_test_unit_ready(&ccb->csio, 0, NULL, MSG_SIMPLE_Q_TAG, - SSD_FULL_SIZE, 5000); + if (strcmp(type, "scsi") == 0) { + scsi_test_unit_ready(&ccb->csio, 0, NULL, MSG_SIMPLE_Q_TAG, + SSD_FULL_SIZE, 5000); + } else if (strcmp(type, "ata") == 0) { + /* cam_getccb cleans up the header, caller has to zero the payload */ + bzero(&(&ccb->ccb_h)[1], + sizeof(struct ccb_ataio) - sizeof(struct ccb_hdr)); + + ptr = (uint16_t *)malloc(sizeof(struct ata_params)); + + if (ptr == NULL) { + cam_freeccb(ccb); + warnx("can't malloc memory for identify\n"); + return(1); + } + bzero(ptr, sizeof(struct ata_params)); + cam_fill_ataio(&ccb->ataio, + 1, + NULL, + /*flags*/CAM_DIR_IN, + MSG_SIMPLE_Q_TAG, + /*data_ptr*/(uint8_t *)ptr, + /*dxfer_len*/sizeof(struct ata_params), + timeout ? timeout : 30 * 1000); + ata_28bit_cmd(&ccb->ataio, ATA_ATA_IDENTIFY, 0, 0, 0); + } else { + warnx("weird disk type '%s'", type); + return 1; + } /* Disable freezing the device queue. */ ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; if (cam_send_ccb(cam_dev, ccb) < 0) { - warnx("Error sending test unit ready"); + warnx("Error sending identify/test unit ready"); if (verbose) cam_error_print(cam_dev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); @@ -241,83 +304,102 @@ fw_download_img(struct cam_device *cam_d cam_freeccb(ccb); return (1); } - pkt_size = vp->max_pkt_size; - if (verbose || sim_mode) { - fprintf(stdout, - "--------------------------------------------------\n"); - fprintf(stdout, - "PktNo. PktSize BytesRemaining LastPkt\n"); - fprintf(stdout, - "--------------------------------------------------\n"); + max_pkt_size = vp->max_pkt_size; + if (vp->max_pkt_size == 0 && strcmp(type, "ata") == 0) { + max_pkt_size = UNKNOWN_MAX_PKT_SIZE; } + pkt_size = vp->max_pkt_size; + progress_init(&progress, imgname, size = img_size); /* Download single fw packets. */ do { - if (img_size <= vp->max_pkt_size) { + if (img_size <= max_pkt_size) { last_pkt = 1; pkt_size = img_size; } - if (verbose || sim_mode) - fprintf(stdout, "%3u %5u (0x%05X) %7u (0x%06X) " - "%d\n", pkt_count, pkt_size, pkt_size, - img_size - pkt_size, img_size - pkt_size, - last_pkt); + progress_update(&progress, size - img_size); + progress_draw(&progress); bzero(&cdb, sizeof(cdb)); - cdb.opcode = WRITE_BUFFER; - cdb.control = 0; - /* Parameter list length. */ - scsi_ulto3b(pkt_size, &cdb.length[0]); - offset = vp->inc_cdb_offset ? (pkt_ptr - buf) : 0; - scsi_ulto3b(offset, &cdb.offset[0]); - cdb.byte2 = last_pkt ? vp->cdb_byte2_last : vp->cdb_byte2; - cdb.buffer_id = vp->inc_cdb_buffer_id ? pkt_count : 0; - /* Zero out payload of ccb union after ccb header. */ - bzero((u_char *)ccb + sizeof(struct ccb_hdr), - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); - /* Copy previously constructed cdb into ccb_scsiio struct. */ - bcopy(&cdb, &ccb->csio.cdb_io.cdb_bytes[0], - sizeof(struct scsi_write_buffer)); - /* Fill rest of ccb_scsiio struct. */ + if (strcmp(type, "scsi") == 0) { + cdb.opcode = WRITE_BUFFER; + cdb.control = 0; + /* Parameter list length. */ + scsi_ulto3b(pkt_size, &cdb.length[0]); + offset = vp->inc_cdb_offset ? (pkt_ptr - buf) : 0; + scsi_ulto3b(offset, &cdb.offset[0]); + cdb.byte2 = last_pkt ? vp->cdb_byte2_last : vp->cdb_byte2; + cdb.buffer_id = vp->inc_cdb_buffer_id ? pkt_count : 0; + /* Zero out payload of ccb union after ccb header. */ + bzero((u_char *)ccb + sizeof(struct ccb_hdr), + sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + /* Copy previously constructed cdb into ccb_scsiio struct. */ + bcopy(&cdb, &ccb->csio.cdb_io.cdb_bytes[0], + sizeof(struct scsi_write_buffer)); + /* Fill rest of ccb_scsiio struct. */ + if (!sim_mode) { + cam_fill_csio(&ccb->csio, /* ccb_scsiio */ + retry_count, /* retries */ + NULL, /* cbfcnp */ + CAM_DIR_OUT | CAM_DEV_QFRZDIS, /* flags */ + CAM_TAG_ACTION_NONE, /* tag_action */ + (u_char *)pkt_ptr, /* data_ptr */ + pkt_size, /* dxfer_len */ + SSD_FULL_SIZE, /* sense_len */ + sizeof(struct scsi_write_buffer), /* cdb_len */ + timeout ? timeout : CMD_TIMEOUT); /* timeout */ + } + } else if (strcmp(type, "ata") == 0) { + bzero(&(&ccb->ccb_h)[1], + sizeof(struct ccb_ataio) - sizeof(struct ccb_hdr)); + if (!sim_mode) { + uint32_t off; + + cam_fill_ataio(&ccb->ataio, + (last_pkt) ? 256 : retry_count, + NULL, + /*flags*/CAM_DIR_OUT | CAM_DEV_QFRZDIS, + CAM_TAG_ACTION_NONE, + /*data_ptr*/(uint8_t *)pkt_ptr, + /*dxfer_len*/pkt_size, + timeout ? timeout : 30 * 1000); + off = (uint32_t)(pkt_ptr - buf); + ata_28bit_cmd(&ccb->ataio, ATA_DOWNLOAD_MICROCODE, + USE_OFFSETS_FEATURE, + ATA_MAKE_LBA(off, pkt_size), + ATA_MAKE_SECTORS(pkt_size)); + } + } if (!sim_mode) { - cam_fill_csio(&ccb->csio, /* ccb_scsiio */ - retry_count, /* retries */ - NULL, /* cbfcnp */ - CAM_DIR_OUT | CAM_DEV_QFRZDIS, /* flags */ - CAM_TAG_ACTION_NONE, /* tag_action */ - (u_char *)pkt_ptr, /* data_ptr */ - pkt_size, /* dxfer_len */ - SSD_FULL_SIZE, /* sense_len */ - sizeof(struct scsi_write_buffer), /* cdb_len */ - timeout ? timeout : CMD_TIMEOUT); /* timeout */ /* Execute the command. */ if (cam_send_ccb(cam_dev, ccb) < 0) { warnx("Error writing image to device"); if (verbose) cam_error_print(cam_dev, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); + CAM_EPF_ALL, stderr); goto bailout; } + if (ccb->ataio.res.status != 0 /*&& !last_pkt*/) { + cam_error_print(cam_dev, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } } /* Prepare next round. */ pkt_count++; pkt_ptr += pkt_size; img_size -= pkt_size; } while(!last_pkt); - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (verbose) - cam_error_print(cam_dev, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - goto bailout; - } + progress_complete(&progress, size - img_size); cam_freeccb(ccb); return (0); bailout: + progress_complete(&progress, size - img_size); cam_freeccb(ccb); return (1); } int fwdownload(struct cam_device *device, int argc, char **argv, - char *combinedopt, int verbose, int retry_count, int timeout) + char *combinedopt, int verbose, int retry_count, int timeout, + const char *type) { const struct fw_vendor *vp; char *fw_img_path = NULL; @@ -345,12 +427,13 @@ fwdownload(struct cam_device *device, in } if (fw_img_path == NULL) - errx(1, - "you must specify a firmware image file using -f option"); + errx(1, "you must specify a firmware image file using -f option"); vp = fw_get_vendor(device); - if (vp == NULL || vp->type == VENDOR_UNKNOWN) - errx(1, "Unsupported device"); + if (vp == NULL) + errx(1, "NULL vendor"); + if (vp->type == VENDOR_UNKNOWN) + warnx("Unsupported device - flashing through an HBA?"); buf = fw_read_img(fw_img_path, vp, &img_size); if (buf == NULL) @@ -360,11 +443,6 @@ fwdownload(struct cam_device *device, in fprintf(stdout, "You are about to download firmware image (%s)" " into the following device:\n", fw_img_path); - if (scsidoinquiry(device, argc, argv, combinedopt, 0, - 5000) != 0) { - warnx("Error sending inquiry"); - goto fail; - } fprintf(stdout, "\nIt may damage your drive. "); if (!get_confirmation()) goto fail; @@ -373,10 +451,11 @@ fwdownload(struct cam_device *device, in fprintf(stdout, "Running in simulation mode\n"); if (fw_download_img(device, vp, buf, img_size, sim_mode, verbose, - retry_count, timeout) != 0) { + retry_count, timeout, fw_img_path, type) != 0) { fprintf(stderr, "Firmware download failed\n"); goto fail; - } else + } + else fprintf(stdout, "Firmware download successful\n"); free(buf); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 00:37:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F650106566C; Wed, 20 Jun 2012 00:37:01 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFA008FC0A; Wed, 20 Jun 2012 00:37:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K0b0H9006700; Wed, 20 Jun 2012 00:37:00 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K0b0rr006698; Wed, 20 Jun 2012 00:37:00 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201206200037.q5K0b0rr006698@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 20 Jun 2012 00:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237282 - head/usr.bin/make X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 00:37:01 -0000 Author: obrien Date: Wed Jun 20 00:37:00 2012 New Revision: 237282 URL: http://svn.freebsd.org/changeset/base/237282 Log: Correct typo in version. Modified: head/usr.bin/make/Makefile Modified: head/usr.bin/make/Makefile ============================================================================== --- head/usr.bin/make/Makefile Wed Jun 20 00:17:29 2012 (r237281) +++ head/usr.bin/make/Makefile Wed Jun 20 00:37:00 2012 (r237282) @@ -15,7 +15,7 @@ NO_SHARED?= YES .endif # Version has the RYYYYMMDDX format, where R is from RELENG_ -CFLAGS+=-DMAKE_VERSION=\"10201120530\" +CFLAGS+=-DMAKE_VERSION=\"10201205300\" # There is no obvious performance improvement currently. # CFLAGS+=-DUSE_KQUEUE From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 02:21:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0CE21065674; Wed, 20 Jun 2012 02:21:53 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC4478FC0C; Wed, 20 Jun 2012 02:21:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K2LrrI012795; Wed, 20 Jun 2012 02:21:53 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K2LrXM012793; Wed, 20 Jun 2012 02:21:53 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201206200221.q5K2LrXM012793@svn.freebsd.org> From: Kevin Lo Date: Wed, 20 Jun 2012 02:21:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237284 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 02:21:53 -0000 Author: kevlo Date: Wed Jun 20 02:21:53 2012 New Revision: 237284 URL: http://svn.freebsd.org/changeset/base/237284 Log: Fix potential symlink race condition in "rm -P" by adding a check that the file we have opened is the one we expected. Also open in non-blocking mode to avoid a potential hang with FIFOs. Obtained from: NetBSD via OpenBSD Modified: head/bin/rm/rm.c Modified: head/bin/rm/rm.c ============================================================================== --- head/bin/rm/rm.c Wed Jun 20 00:41:31 2012 (r237283) +++ head/bin/rm/rm.c Wed Jun 20 02:21:53 2012 (r237284) @@ -408,7 +408,7 @@ rm_file(char **argv) int rm_overwrite(char *file, struct stat *sbp) { - struct stat sb; + struct stat sb, sb2; struct statfs fsb; off_t len; int bsize, fd, wlen; @@ -427,8 +427,15 @@ rm_overwrite(char *file, struct stat *sb file, sbp->st_ino); return (0); } - if ((fd = open(file, O_WRONLY, 0)) == -1) + if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1) goto err; + if (fstat(fd, &sb2)) + goto err; + if (sb2.st_dev != sbp->st_dev || sb2.st_ino != sbp->st_ino || + !S_ISREG(sb2.st_mode)) { + errno = EPERM; + goto err; + } if (fstatfs(fd, &fsb) == -1) goto err; bsize = MAX(fsb.f_iosize, 1024); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 04:11:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E51371065670; Wed, 20 Jun 2012 04:11:34 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDFF58FC0C; Wed, 20 Jun 2012 04:11:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K4BYOI017746; Wed, 20 Jun 2012 04:11:34 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K4BYTw017744; Wed, 20 Jun 2012 04:11:34 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201206200411.q5K4BYTw017744@svn.freebsd.org> From: Scott Long Date: Wed, 20 Jun 2012 04:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237285 - head/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 04:11:35 -0000 Author: scottl Date: Wed Jun 20 04:11:34 2012 New Revision: 237285 URL: http://svn.freebsd.org/changeset/base/237285 Log: Add progress.c and progress.h, missed in the previous commit to camcontrol. Submitted by: Garrett Cooper Obtained from: Netflix, Inc. Added: head/sbin/camcontrol/progress.c (contents, props changed) head/sbin/camcontrol/progress.h (contents, props changed) Added: head/sbin/camcontrol/progress.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/camcontrol/progress.c Wed Jun 20 04:11:34 2012 (r237285) @@ -0,0 +1,186 @@ +/* $NetBSD: progressbar.c,v 1.21 2009/04/12 10:18:52 lukem Exp $ */ + +/*- + * Copyright (c) 1997-2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +__FBSDID("$FreeBSD$"); + +#include "progress.h" + +static const char * const suffixes[] = { + "", /* 2^0 (byte) */ + "KiB", /* 2^10 Kibibyte */ + "MiB", /* 2^20 Mebibyte */ + "GiB", /* 2^30 Gibibyte */ + "TiB", /* 2^40 Tebibyte */ + "PiB", /* 2^50 Pebibyte */ + "EiB", /* 2^60 Exbibyte */ +}; + +#define NSUFFIXES (sizeof(suffixes) / sizeof(suffixes[0])) +#define SECSPERHOUR (60 * 60) +#define DEFAULT_TTYWIDTH 80 + +/* initialise progress meter structure */ +int +progress_init(progress_t *prog, const char *prefix, uint64_t total) +{ + struct winsize winsize; + int oerrno = errno; + + (void) memset(prog, 0x0, sizeof(*prog)); + prog->size = total; + prog->prefix = strdup(prefix); + prog->start = time(NULL); + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) != -1 && + winsize.ws_col != 0) { + prog->ttywidth = winsize.ws_col; + } else { + prog->ttywidth = DEFAULT_TTYWIDTH; + } + errno = oerrno; + return 1; +} + +/* update the values in the progress meter */ +int +progress_update(progress_t *prog, uint64_t done) +{ + prog->done = done; + prog->percent = (prog->done * 100) / prog->size; + prog->now = time(NULL); + prog->elapsed = prog->now - prog->start; + if (done == 0 || prog->elapsed == 0 || prog->done / prog->elapsed == 0) { + prog->eta = 0; + } else { + prog->eta = prog->size / (prog->done / prog->elapsed) - prog->elapsed; + } + return 1; +} + +/* update the values in the progress meter */ +int +progress_reset_size(progress_t *prog, uint64_t size) +{ + prog->size = size; + return 1; +} + +/* make it look pretty at the end - display done bytes (usually total) */ +int +progress_complete(progress_t *prog, uint64_t done) +{ + progress_update(prog, done); + progress_draw(prog); + printf("\n"); + return 1; +} + +/* draw the progress meter */ +int +progress_draw(progress_t *prog) +{ +#define BAROVERHEAD 45 /* non `*' portion of progress bar */ + /* + * stars should contain at least + * sizeof(buf) - BAROVERHEAD entries + */ + static const char stars[] = +"*****************************************************************************" +"*****************************************************************************" +"*****************************************************************************"; + unsigned bytesabbrev; + unsigned bpsabbrev; + int64_t secs; + uint64_t bytespersec; + uint64_t abbrevsize; + int64_t secsleft; + size_t barlength; + size_t starc; + char hours[12]; + char buf[256]; + int len; + + barlength = MIN(sizeof(buf) - 1, (unsigned)prog->ttywidth) - BAROVERHEAD - strlen(prog->prefix); + starc = (barlength * prog->percent) / 100; + abbrevsize = prog->done; + for (bytesabbrev = 0; abbrevsize >= 100000 && bytesabbrev < NSUFFIXES; bytesabbrev++) { + abbrevsize >>= 10; + } + if (bytesabbrev == NSUFFIXES) { + bytesabbrev--; + } + bytespersec = 0; + if (prog->done > 0) { + bytespersec = prog->done; + if (prog->elapsed > 0) { + bytespersec /= prog->elapsed; + } + } + for (bpsabbrev = 1; bytespersec >= 1024000 && bpsabbrev < NSUFFIXES; bpsabbrev++) { + bytespersec >>= 10; + } + if (prog->done == 0 || prog->elapsed <= 0 || prog->done > prog->size) { + secsleft = 0; + } else { + secsleft = prog->eta; + } + if ((secs = secsleft / SECSPERHOUR) > 0) { + (void) snprintf(hours, sizeof(hours), "%2lld:", (long long)secs); + } else { + (void) snprintf(hours, sizeof(hours), " "); + } + secs = secsleft % SECSPERHOUR; + len = snprintf(buf, sizeof(buf), + "\r%s %3lld%% |%.*s%*s| %5lld %-3s %3lld.%02d %.2sB/s %s%02d:%02d ETA", + (prog->prefix) ? prog->prefix : "", + (long long)prog->percent, + (int)starc, stars, (int)(barlength - starc), "", + (long long)abbrevsize, + suffixes[bytesabbrev], + (long long)(bytespersec / 1024), + (int)((bytespersec % 1024) * 100 / 1024), + suffixes[bpsabbrev], + hours, + (int)secs / 60, (int)secs % 60); + return (int)write(STDOUT_FILENO, buf, len); +} Added: head/sbin/camcontrol/progress.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/camcontrol/progress.h Wed Jun 20 04:11:34 2012 (r237285) @@ -0,0 +1,60 @@ +/* $NetBSD: progressbar.c,v 1.21 2009/04/12 10:18:52 lukem Exp $ */ + +/*- + * Copyright (c) 1997-2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef PROGRESS_H_ +#define PROGRESS_H_ 20100228 + +#include + +#include + +/* structure used to display a progress meter */ +typedef struct progress_t { + char *prefix; /* any prefix explanation */ + uint64_t size; /* total of bytes/units to be counted */ + uint64_t done; /* number of units counted to date */ + uint64_t percent; /* cache the percentage complete */ + time_t start; /* time we started this */ + time_t now; /* time now */ + time_t eta; /* estimated # of secs until completion */ + int64_t elapsed; /* cached # of elapsed seconds */ + int32_t ttywidth; /* width of tty in columns */ +} progress_t; + +int progress_init(progress_t */*meter*/, const char */*prefix*/, uint64_t /*size*/); +int progress_update(progress_t */*meter*/, uint64_t /*done*/); +int progress_draw(progress_t */*meter*/); +int progress_reset_size(progress_t */*meter*/, uint64_t /*size*/); +int progress_complete(progress_t */*meter*/, uint64_t /*done*/); + +#endif From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 06:38:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6203A1065673; Wed, 20 Jun 2012 06:38:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D1988FC08; Wed, 20 Jun 2012 06:38:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K6cgUI024026; Wed, 20 Jun 2012 06:38:42 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K6cg7u024024; Wed, 20 Jun 2012 06:38:42 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206200638.q5K6cg7u024024@svn.freebsd.org> From: Eitan Adler Date: Wed, 20 Jun 2012 06:38:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237286 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 06:38:42 -0000 Author: eadler Date: Wed Jun 20 06:38:41 2012 New Revision: 237286 URL: http://svn.freebsd.org/changeset/base/237286 Log: Don't close an uninitialized descriptor. [1] Add a sanity check for the validity of the passed fd. PR: kern/139080 [1] Submitted by: Andrey Simonenko [1] Reviewed by: pjd (briefly) Approved by: cperciva MFC after: 1 week Modified: head/lib/libc/gen/syslog.c Modified: head/lib/libc/gen/syslog.c ============================================================================== --- head/lib/libc/gen/syslog.c Wed Jun 20 04:11:34 2012 (r237285) +++ head/lib/libc/gen/syslog.c Wed Jun 20 06:38:41 2012 (r237286) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -413,8 +414,11 @@ void closelog(void) { THREAD_LOCK(); - (void)_close(LogFile); - LogFile = -1; + assert(LogFile >= -1); + if (LogFile != -1) { + (void)_close(LogFile); + LogFile = -1; + } LogTag = NULL; status = NOCONN; THREAD_UNLOCK(); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 06:58:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C7A7106566B; Wed, 20 Jun 2012 06:58:18 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17B038FC0A; Wed, 20 Jun 2012 06:58:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K6wHDP024881; Wed, 20 Jun 2012 06:58:17 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K6wH1j024879; Wed, 20 Jun 2012 06:58:17 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206200658.q5K6wH1j024879@svn.freebsd.org> From: Eitan Adler Date: Wed, 20 Jun 2012 06:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237287 - stable/9/share/examples/csh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 06:58:18 -0000 Author: eadler Date: Wed Jun 20 06:58:17 2012 New Revision: 237287 URL: http://svn.freebsd.org/changeset/base/237287 Log: MFC r236999: Include a warning when using the example code as it may not work in unusual situations. Also slightly optimize the command. Approved by: cperciva (implicit) Modified: stable/9/share/examples/csh/dot.cshrc Directory Properties: stable/9/share/examples/csh/ (props changed) Modified: stable/9/share/examples/csh/dot.cshrc ============================================================================== --- stable/9/share/examples/csh/dot.cshrc Wed Jun 20 06:38:41 2012 (r237286) +++ stable/9/share/examples/csh/dot.cshrc Wed Jun 20 06:58:17 2012 (r237287) @@ -4,8 +4,12 @@ # # Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running +# +# This has a couple caveats, the most notable being that if a user +# has multiple ssh-agent(1) processes running, this will very likely +# set SSH_AUTH_SOCK to point to the wrong file/domain socket. if (${?SSH_AUTH_SOCK} != "1") then - setenv SSH_AUTH_SOCK `sockstat | grep "^${USER} " | awk '/ssh-agent/ { print $6 }'` + setenv SSH_AUTH_SOCK `sockstat -u | awk '/^${USER}.+ ssh-agent/ { print $6 }' endif # Change only root's prompt From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 06:58:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C677D10656F0; Wed, 20 Jun 2012 06:58:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B080B8FC08; Wed, 20 Jun 2012 06:58:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K6wcWl024928; Wed, 20 Jun 2012 06:58:38 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K6wcDj024926; Wed, 20 Jun 2012 06:58:38 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206200658.q5K6wcDj024926@svn.freebsd.org> From: Eitan Adler Date: Wed, 20 Jun 2012 06:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237288 - stable/8/share/examples/csh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 06:58:38 -0000 Author: eadler Date: Wed Jun 20 06:58:38 2012 New Revision: 237288 URL: http://svn.freebsd.org/changeset/base/237288 Log: MFC r236999: Include a warning when using the example code as it may not work in unusual situations. Also slightly optimize the command. Approved by: cperciva (implicit) Modified: stable/8/share/examples/csh/dot.cshrc Directory Properties: stable/8/share/examples/csh/ (props changed) Modified: stable/8/share/examples/csh/dot.cshrc ============================================================================== --- stable/8/share/examples/csh/dot.cshrc Wed Jun 20 06:58:17 2012 (r237287) +++ stable/8/share/examples/csh/dot.cshrc Wed Jun 20 06:58:38 2012 (r237288) @@ -4,8 +4,12 @@ # # Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running +# +# This has a couple caveats, the most notable being that if a user +# has multiple ssh-agent(1) processes running, this will very likely +# set SSH_AUTH_SOCK to point to the wrong file/domain socket. if (${?SSH_AUTH_SOCK} != "1") then - setenv SSH_AUTH_SOCK `sockstat | grep "^${USER} " | awk '/ssh-agent/ { print $6 }'` + setenv SSH_AUTH_SOCK `sockstat -u | awk '/^${USER}.+ ssh-agent/ { print $6 }' endif # Change only root's prompt From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 06:58:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CFF210657A9; Wed, 20 Jun 2012 06:58:57 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05BB08FC08; Wed, 20 Jun 2012 06:58:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K6wuBf024976; Wed, 20 Jun 2012 06:58:56 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K6wu9F024973; Wed, 20 Jun 2012 06:58:56 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206200658.q5K6wu9F024973@svn.freebsd.org> From: Eitan Adler Date: Wed, 20 Jun 2012 06:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237289 - stable/7/share/examples/csh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 06:58:57 -0000 Author: eadler Date: Wed Jun 20 06:58:56 2012 New Revision: 237289 URL: http://svn.freebsd.org/changeset/base/237289 Log: MFC r236999: Include a warning when using the example code as it may not work in unusual situations. Also slightly optimize the command. Approved by: cperciva (implicit) Modified: stable/7/share/examples/csh/dot.cshrc Directory Properties: stable/7/share/examples/csh/ (props changed) Modified: stable/7/share/examples/csh/dot.cshrc ============================================================================== --- stable/7/share/examples/csh/dot.cshrc Wed Jun 20 06:58:38 2012 (r237288) +++ stable/7/share/examples/csh/dot.cshrc Wed Jun 20 06:58:56 2012 (r237289) @@ -4,8 +4,12 @@ # # Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running +# +# This has a couple caveats, the most notable being that if a user +# has multiple ssh-agent(1) processes running, this will very likely +# set SSH_AUTH_SOCK to point to the wrong file/domain socket. if (${?SSH_AUTH_SOCK} != "1") then - setenv SSH_AUTH_SOCK `sockstat | grep "^${USER} " | awk '/ssh-agent/ { print $6 }'` + setenv SSH_AUTH_SOCK `sockstat -u | awk '/^${USER}.+ ssh-agent/ { print $6 }' endif # Change only root's prompt From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 07:25:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E80501065672; Wed, 20 Jun 2012 07:25:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D34088FC14; Wed, 20 Jun 2012 07:25:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K7PKKX026136; Wed, 20 Jun 2012 07:25:20 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K7PKAm026134; Wed, 20 Jun 2012 07:25:20 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206200725.q5K7PKAm026134@svn.freebsd.org> From: Alan Cox Date: Wed, 20 Jun 2012 07:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237290 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 07:25:21 -0000 Author: alc Date: Wed Jun 20 07:25:20 2012 New Revision: 237290 URL: http://svn.freebsd.org/changeset/base/237290 Log: Add PV list locking to pmap_copy(), pmap_enter_object(), and pmap_enter_quick(). These functions are no longer serialized by the pvh global lock. There is no need to release the PV list lock before calling free_pv_chunk() in pmap_remove_pages(). Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Jun 20 06:58:56 2012 (r237289) +++ head/sys/amd64/amd64/pmap.c Wed Jun 20 07:25:20 2012 (r237290) @@ -241,7 +241,8 @@ static void free_pv_chunk(struct pv_chun static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try); static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); -static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); +static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, + struct rwlock **lockp); static void pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, @@ -253,9 +254,9 @@ static boolean_t pmap_demote_pde(pmap_t static boolean_t pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va); static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, - vm_prot_t prot); + vm_prot_t prot, struct rwlock **lockp); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, - vm_page_t m, vm_prot_t prot, vm_page_t mpte); + vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp); static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); static boolean_t pmap_is_modified_pvh(struct md_page *pvh); @@ -278,7 +279,7 @@ static void pmap_remove_entry(struct pma vm_offset_t va); static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, - vm_page_t m); + vm_page_t m, struct rwlock **lockp); static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde); static void pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde); @@ -2463,14 +2464,23 @@ pmap_insert_entry(pmap_t pmap, vm_offset * Conditionally create a pv entry. */ static boolean_t -pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) +pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m, + struct rwlock **lockp) { + struct rwlock *new_lock; pv_entry_t pv; - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; + new_lock = VM_PAGE_TO_PV_LIST_LOCK(m); + if (new_lock != *lockp) { + if (*lockp != NULL) + rw_wunlock(*lockp); + *lockp = new_lock; + rw_wlock(*lockp); + } TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); return (TRUE); } else @@ -2481,14 +2491,23 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm * Create the pv entry for a 2MB page mapping. */ static boolean_t -pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa) +pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, + struct rwlock **lockp) { struct md_page *pvh; + struct rwlock *new_lock; pv_entry_t pv; - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); if ((pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; + new_lock = PHYS_TO_PV_LIST_LOCK(pa); + if (new_lock != *lockp) { + if (*lockp != NULL) + rw_wunlock(*lockp); + *lockp = new_lock; + rw_wlock(*lockp); + } pvh = pa_to_pvh(pa); TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list); return (TRUE); @@ -3434,12 +3453,13 @@ validate: * (3) a pv entry cannot be allocated without reclaiming another pv entry. */ static boolean_t -pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) +pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, + struct rwlock **lockp) { pd_entry_t *pde, newpde; vm_page_t free, mpde; - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((mpde = pmap_allocpde(pmap, va, M_NOWAIT)) == NULL) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" @@ -3464,7 +3484,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t /* * Abort this mapping if its PV entry could not be created. */ - if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m))) { + if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m), + lockp)) { free = NULL; if (pmap_unwire_pte_hold(pmap, va, mpde, &free)) { pmap_invalidate_page(pmap, va); @@ -3490,7 +3511,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t */ pde_store(pde, newpde); - pmap_pde_mappings++; + atomic_add_long(&pmap_pde_mappings, 1); CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx" " in pmap %p", va, pmap); return (TRUE); @@ -3512,6 +3533,7 @@ void pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, vm_page_t m_start, vm_prot_t prot) { + struct rwlock *lock; vm_offset_t va; vm_page_t m, mpte; vm_pindex_t diff, psize; @@ -3520,21 +3542,24 @@ pmap_enter_object(pmap_t pmap, vm_offset psize = atop(end - start); mpte = NULL; m = m_start; - rw_wlock(&pvh_global_lock); + lock = NULL; + rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { va = start + ptoa(diff); if ((va & PDRMASK) == 0 && va + NBPDR <= end && (VM_PAGE_TO_PHYS(m) & PDRMASK) == 0 && pg_ps_enabled && vm_reserv_level_iffullpop(m) == 0 && - pmap_enter_pde(pmap, va, m, prot)) + pmap_enter_pde(pmap, va, m, prot, &lock)) m = &m[NBPDR / PAGE_SIZE - 1]; else mpte = pmap_enter_quick_locked(pmap, va, m, prot, - mpte); + mpte, &lock); m = TAILQ_NEXT(m, listq); } - rw_wunlock(&pvh_global_lock); + if (lock != NULL) + rw_wunlock(lock); + rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -3550,17 +3575,21 @@ pmap_enter_object(pmap_t pmap, vm_offset void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + struct rwlock *lock; - rw_wlock(&pvh_global_lock); + lock = NULL; + rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); - (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL); - rw_wunlock(&pvh_global_lock); + (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL, &lock); + if (lock != NULL) + rw_wunlock(lock); + rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, - vm_prot_t prot, vm_page_t mpte) + vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp) { vm_page_t free; pt_entry_t *pte; @@ -3569,7 +3598,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* @@ -3626,7 +3655,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ * Enter on the PV list if part of our managed memory. */ if ((m->oflags & VPO_UNMANAGED) == 0 && - !pmap_try_insert_pv_entry(pmap, va, m)) { + !pmap_try_insert_pv_entry(pmap, va, m, lockp)) { if (mpte != NULL) { free = NULL; if (pmap_unwire_pte_hold(pmap, va, mpte, &free)) { @@ -3825,6 +3854,7 @@ void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { + struct rwlock *lock; vm_page_t free; vm_offset_t addr; vm_offset_t end_addr = src_addr + len; @@ -3833,7 +3863,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm if (dst_addr != src_addr) return; - rw_wlock(&pvh_global_lock); + lock = NULL; + rw_rlock(&pvh_global_lock); if (dst_pmap < src_pmap) { PMAP_LOCK(dst_pmap); PMAP_LOCK(src_pmap); @@ -3885,7 +3916,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm pde = &pde[pmap_pde_index(addr)]; if (*pde == 0 && ((srcptepaddr & PG_MANAGED) == 0 || pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr & - PG_PS_FRAME))) { + PG_PS_FRAME, &lock))) { *pde = srcptepaddr & ~PG_W; pmap_resident_count_inc(dst_pmap, NBPDR / PAGE_SIZE); } else @@ -3922,7 +3953,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm dst_pte = &dst_pte[pmap_pte_index(addr)]; if (*dst_pte == 0 && pmap_try_insert_pv_entry(dst_pmap, addr, - PHYS_TO_VM_PAGE(ptetemp & PG_FRAME))) { + PHYS_TO_VM_PAGE(ptetemp & PG_FRAME), + &lock)) { /* * Clear the wired, modified, and * accessed (referenced) bits @@ -3949,7 +3981,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm } } out: - rw_wunlock(&pvh_global_lock); + if (lock != NULL) + rw_wunlock(lock); + rw_runlock(&pvh_global_lock); PMAP_UNLOCK(src_pmap); PMAP_UNLOCK(dst_pmap); } @@ -4158,9 +4192,9 @@ pmap_remove_pages(pmap_t pmap) printf("warning: pmap_remove_pages called with non-current pmap\n"); return; } + lock = NULL; rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); - lock = NULL; TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { allfree = 1; freed = 0; @@ -4268,10 +4302,6 @@ pmap_remove_pages(pmap_t pmap) PV_STAT(atomic_add_int(&pv_entry_spare, freed)); PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); if (allfree) { - if (lock != NULL) { - rw_wunlock(lock); - lock = NULL; - } TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); free_pv_chunk(pc); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 07:47:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E9D911065670; Wed, 20 Jun 2012 07:47:00 +0000 (UTC) (envelope-from gprspb@mail.ru) Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) by mx1.freebsd.org (Postfix) with ESMTP id 4C9258FC12; Wed, 20 Jun 2012 07:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=UzfZG8fbocgBxWUD86fqTDgnNhRzkRnYNcBIHuzWe5Q=; b=dzdK8e0jc0L2Neei46FeWij4ntQWKiMcB446At0piyQrUYCxgZ26yv+oZGGrzx5HoZd5UvcXRikeTqQkijflXvgaFJJau1Ic6IGEgcdbubUFKm5dFFT/0a7vjn7bb0jb; Received: from [93.185.182.46] (port=26323 helo=gpr.nnz-home.ru) by smtp16.mail.ru with esmtpa (envelope-from ) id 1ShFco-00020G-7N; Wed, 20 Jun 2012 11:46:50 +0400 Received: from gpr by gpr.nnz-home.ru with local (Exim 4.77 (FreeBSD)) (envelope-from ) id 1ShFXC-000BpC-17; Wed, 20 Jun 2012 11:41:02 +0400 Date: Wed, 20 Jun 2012 11:41:01 +0400 From: Gennady Proskurin To: Poul-Henning Kamp Message-ID: <20120620074101.GA832@gpr.nnz-home.ru> References: <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au> <31750.1340083631@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline In-Reply-To: <31750.1340083631@critter.freebsd.dk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam: Not detected X-Mras: Ok Cc: svn-src-head@freebsd.org, Daniel O'Connor , Gennady Proskurin , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 07:47:01 -0000 --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 19, 2012 at 05:27:11AM +0000, Poul-Henning Kamp wrote: > In message <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au>, "Daniel O'Conno > r" writes: > > >> If size is odd, this does not copy the last byte. Not sure, whether = > >this is intended. > > Feel free to improve... --45Z9DzgjV8m4Oswq Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="fb.patch" Index: fbreg.h =================================================================== --- fbreg.h (revision 237289) +++ fbreg.h (working copy) @@ -39,9 +39,12 @@ static __inline void copyw(uint16_t *src, uint16_t *dst, size_t size) { + const int is_odd = (size & 0x1); size >>= 1; while (size--) *dst++ = *src++; + if (is_odd) + *(char*)dst = *(char*)src; // copy last byte } #define bcopy_io(s, d, c) copyw((void*)(s), (void*)(d), (c)) #define bcopy_toio(s, d, c) copyw((void*)(s), (void*)(d), (c)) --45Z9DzgjV8m4Oswq-- From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 08:29:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5537106566B; Wed, 20 Jun 2012 08:29:22 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 3BD6B8FC1E; Wed, 20 Jun 2012 08:29:22 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.55]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id q5K8T7HX007585 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 20 Jun 2012 17:59:13 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <20120620074101.GA832@gpr.nnz-home.ru> Date: Wed, 20 Jun 2012 17:59:07 +0930 Content-Transfer-Encoding: quoted-printable Message-Id: References: <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au> <31750.1340083631@critter.freebsd.dk> <20120620074101.GA832@gpr.nnz-home.ru> To: Gennady Proskurin X-Mailer: Apple Mail (2.1278) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: svn-src-head@freebsd.org, Poul-Henning Kamp , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 08:29:22 -0000 On 20/06/2012, at 17:11, Gennady Proskurin wrote: > On Tue, Jun 19, 2012 at 05:27:11AM +0000, Poul-Henning Kamp wrote: >> In message <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au>, = "Daniel O'Conno >> r" writes: >>=20 >>>> If size is odd, this does not copy the last byte. Not sure, whether = =3D >>> this is intended. >>=20 >> Feel free to improve... >=20 > Surely if you pass it an odd size you made a mistake - either the wrong = function was used or you computed the size incorrectly. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 09:01:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 441421065670; Wed, 20 Jun 2012 09:01:45 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F2078FC0C; Wed, 20 Jun 2012 09:01:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K91jS8030340; Wed, 20 Jun 2012 09:01:45 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K91i5Z030338; Wed, 20 Jun 2012 09:01:44 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201206200901.q5K91i5Z030338@svn.freebsd.org> From: Fabien Thomas Date: Wed, 20 Jun 2012 09:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237295 - head/sys/dev/viawd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 09:01:45 -0000 Author: fabient Date: Wed Jun 20 09:01:44 2012 New Revision: 237295 URL: http://svn.freebsd.org/changeset/base/237295 Log: Fix viawd(4) that was only working as a module. Obtained from: jhb MFC after: 3 days Modified: head/sys/dev/viawd/viawd.c Modified: head/sys/dev/viawd/viawd.c ============================================================================== --- head/sys/dev/viawd/viawd.c Wed Jun 20 08:29:24 2012 (r237294) +++ head/sys/dev/viawd/viawd.c Wed Jun 20 09:01:44 2012 (r237295) @@ -168,14 +168,18 @@ viawd_attach(device_t dev) } /* Allocate I/O register space. */ - sc->wd_rid = 0; - sc->wd_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->wd_rid, - pmbase, pmbase + VIAWD_MEM_LEN - 1, VIAWD_MEM_LEN, + sc->wd_rid = VIAWD_CONFIG_BASE; + sc->wd_res = bus_alloc_resource_any(sb_dev, SYS_RES_MEMORY, &sc->wd_rid, RF_ACTIVE | RF_SHAREABLE); if (sc->wd_res == NULL) { device_printf(dev, "Unable to map watchdog memory\n"); goto fail; } + if (rman_get_size(sc->wd_res) < VIAWD_MEM_LEN) { + device_printf(dev, "Bad size for watchdog memory: %#x\n", + (unsigned)rman_get_size(sc->wd_res)); + goto fail; + } /* Check if watchdog fired last boot. */ reg = viawd_read_4(sc, VIAWD_MEM_CTRL); @@ -192,7 +196,7 @@ viawd_attach(device_t dev) return (0); fail: if (sc->wd_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, + bus_release_resource(sb_dev, SYS_RES_MEMORY, sc->wd_rid, sc->wd_res); return (ENXIO); } @@ -224,7 +228,7 @@ viawd_detach(device_t dev) } if (sc->wd_res != NULL) - bus_release_resource(sc->dev, SYS_RES_MEMORY, + bus_release_resource(sc->sb_dev, SYS_RES_MEMORY, sc->wd_rid, sc->wd_res); return (0); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 09:19:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E93BF106566C; Wed, 20 Jun 2012 09:19:15 +0000 (UTC) (envelope-from gprspb@mail.ru) Received: from fallback4.mail.ru (fallback4.mail.ru [94.100.176.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8A0EA8FC12; Wed, 20 Jun 2012 09:19:15 +0000 (UTC) Received: from smtp23.mail.ru (smtp23.mail.ru [94.100.176.176]) by fallback4.mail.ru (mPOP.Fallback_MX) with ESMTP id DB2768B3C44B; Wed, 20 Jun 2012 13:19:13 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=IT88HzSX9N5abpczEMZTXZ7hc6KCFjATl5zRNSBDzGg=; b=rOfceUKruvrai9f4OzX9koZg5ORzRk+/pV+3gKqlAcBlX+A+5A3BgEE7L1COuyuaE1yM6Pp1Ad06A0KcXReFY3r0TbxkqFIbCcd5xFUqSkOS8MXLbOLPS6H6g2ATjwQF; Received: from [93.185.182.46] (port=20381 helo=gpr.nnz-home.ru) by smtp23.mail.ru with esmtpa (envelope-from ) id 1ShH40-0000uC-H6; Wed, 20 Jun 2012 13:19:00 +0400 Received: from gpr by gpr.nnz-home.ru with local (Exim 4.77 (FreeBSD)) (envelope-from ) id 1ShH3j-000BrY-8T; Wed, 20 Jun 2012 13:18:43 +0400 Date: Wed, 20 Jun 2012 13:18:43 +0400 From: Gennady Proskurin To: Daniel O'Connor Message-ID: <20120620091843.GB832@gpr.nnz-home.ru> References: <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au> <31750.1340083631@critter.freebsd.dk> <20120620074101.GA832@gpr.nnz-home.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam: Not detected X-Mras: Ok Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gennady Proskurin , src-committers@freebsd.org, Poul-Henning Kamp Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 09:19:16 -0000 On Wed, Jun 20, 2012 at 05:59:07PM +0930, Daniel O'Connor wrote: > > On 20/06/2012, at 17:11, Gennady Proskurin wrote: > > On Tue, Jun 19, 2012 at 05:27:11AM +0000, Poul-Henning Kamp wrote: > >> In message <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au>, "Daniel O'Conno > >> r" writes: > >> > >>>> If size is odd, this does not copy the last byte. Not sure, whether = > >>> this is intended. > >> > >> Feel free to improve... > > > > > > > Surely if you pass it an odd size you made a mistake - either the wrong function was used or you computed the size incorrectly. Functions are called "bcopy_io" and so, such names tell nothing about data size they work with ("copyw" tells something). If it is not supposed to work with odd size, I agree, my patch is overkill, something like KASSERT (or just one-line comment) is better. I just wanted to be sure, that potential bug in this code is known to developpers. From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 09:28:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DDA421065686; Wed, 20 Jun 2012 09:28:33 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 9705D8FC08; Wed, 20 Jun 2012 09:28:33 +0000 (UTC) Received: from critter.freebsd.dk (unknown [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 6CC2D3B763; Wed, 20 Jun 2012 09:28:27 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id q5K9SPrL070850; Wed, 20 Jun 2012 09:28:25 GMT (envelope-from phk@phk.freebsd.dk) To: Gennady Proskurin From: "Poul-Henning Kamp" In-Reply-To: Your message of "Wed, 20 Jun 2012 11:41:01 +0400." <20120620074101.GA832@gpr.nnz-home.ru> Content-Type: text/plain; charset=ISO-8859-1 Date: Wed, 20 Jun 2012 09:28:25 +0000 Message-ID: <70849.1340184505@critter.freebsd.dk> Cc: svn-src-head@freebsd.org, Daniel O'Connor , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237223 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 09:28:34 -0000 In message <20120620074101.GA832@gpr.nnz-home.ru>, Gennady Proskurin writes: >> >> If size is odd, this does not copy the last byte. Not sure, whether = >> >this is intended. >> >> Feel free to improve... It is not my impression that an odd byte count can happen at all... And yes, I fully agree with Bruce that it is a mess, so with "improve" I didn't mean "bandaid for non-existent issues" I meant: Rewrite with extreme prejudice. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 09:38:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E91C1065675; Wed, 20 Jun 2012 09:38:36 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88A508FC20; Wed, 20 Jun 2012 09:38:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K9caUG031931; Wed, 20 Jun 2012 09:38:36 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K9ca4q031926; Wed, 20 Jun 2012 09:38:36 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201206200938.q5K9ca4q031926@svn.freebsd.org> From: Christian Brueffer Date: Wed, 20 Jun 2012 09:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237296 - in stable/9: . share/man/man9 sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 09:38:36 -0000 Author: brueffer Date: Wed Jun 20 09:38:35 2012 New Revision: 237296 URL: http://svn.freebsd.org/changeset/base/237296 Log: MFC: r232051 Catch up with r195837 (2.5 years ago) which renamed net_add_domain() to domain_add(). Modified: stable/9/ObsoleteFiles.inc (contents, props changed) stable/9/share/man/man9/Makefile stable/9/share/man/man9/domain.9 stable/9/sys/kern/uipc_domain.c Directory Properties: stable/9/share/man/man9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/ObsoleteFiles.inc ============================================================================== --- stable/9/ObsoleteFiles.inc Wed Jun 20 09:01:44 2012 (r237295) +++ stable/9/ObsoleteFiles.inc Wed Jun 20 09:38:35 2012 (r237296) @@ -677,6 +677,8 @@ OLD_LIBS+=usr/lib32/pam_tacplus.so.4 OLD_LIBS+=usr/lib32/pam_unix.so.4 # 20090718: the gdm pam.d file is no longer required. OLD_FILES+=etc/pam.d/gdm +# 20090714: net_add_domain(9) renamed to domain_add(9) +OLD_FILES+=usr/share/man/man9/net_add_domain.9.gz # 20090713: vimage container structs removed. OLD_FILES+=usr/include/netinet/vinet.h OLD_FILES+=usr/include/netinet6/vinet6.h Modified: stable/9/share/man/man9/Makefile ============================================================================== --- stable/9/share/man/man9/Makefile Wed Jun 20 09:01:44 2012 (r237295) +++ stable/9/share/man/man9/Makefile Wed Jun 20 09:38:35 2012 (r237296) @@ -614,7 +614,7 @@ MLINKS+=disk.9 disk_alloc.9 \ disk.9 disk_destroy.9 \ disk.9 disk_gone.9 MLINKS+=domain.9 DOMAIN_SET.9 \ - domain.9 net_add_domain.9 \ + domain.9 domain_add.9 \ domain.9 pfctlinput.9 \ domain.9 pfctlinput2.9 \ domain.9 pffindproto.9 \ Modified: stable/9/share/man/man9/domain.9 ============================================================================== --- stable/9/share/man/man9/domain.9 Wed Jun 20 09:01:44 2012 (r237295) +++ stable/9/share/man/man9/domain.9 Wed Jun 20 09:38:35 2012 (r237296) @@ -26,11 +26,11 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2008 +.Dd February 23, 2012 .Dt DOMAIN 9 .Os .Sh NAME -.Nm net_add_domain , +.Nm domain_add , .Nm pfctlinput , .Nm pfctlinput2 , .Nm pffindproto , @@ -43,7 +43,7 @@ .In sys/protosw.h .In sys/domain.h .Ft void -.Fn net_add_domain "void *data" +.Fn domain_add "void *data" .Ft void .Fn pfctlinput "int cmd" "struct sockaddr *sa" .Ft void @@ -142,7 +142,7 @@ have their .Fn pr_ctlinput function called. .Pp -.Fn net_add_domain +.Fn domain_add adds a new protocol domain to the system. The argument .Fa data @@ -153,13 +153,13 @@ within the function, but is declared in order to prevent compiler warnings when new domains are registered with .Fn SYSINIT . In most cases -.Fn net_add_domain +.Fn domain_add is not called directly, instead .Fn DOMAIN_SET is used. .Pp If the new domain has defined an initialization routine, it is called by -.Fn net_add_domain ; +.Fn domain_add ; as well, each of the protocols within the domain that have defined an initialization routine will have theirs called. .Pp Modified: stable/9/sys/kern/uipc_domain.c ============================================================================== --- stable/9/sys/kern/uipc_domain.c Wed Jun 20 09:01:44 2012 (r237295) +++ stable/9/sys/kern/uipc_domain.c Wed Jun 20 09:38:35 2012 (r237296) @@ -220,7 +220,7 @@ domain_add(void *data) domains = dp; KASSERT(domain_init_status >= 1, - ("attempt to net_add_domain(%s) before domaininit()", + ("attempt to domain_add(%s) before domaininit()", dp->dom_name)); #ifndef INVARIANTS if (domain_init_status < 1) From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 10:59:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 46AB0106567A; Wed, 20 Jun 2012 10:59:12 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FA628FC08; Wed, 20 Jun 2012 10:59:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KAxCDP038069; Wed, 20 Jun 2012 10:59:12 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KAxBXM038064; Wed, 20 Jun 2012 10:59:11 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201206201059.q5KAxBXM038064@svn.freebsd.org> From: Christian Brueffer Date: Wed, 20 Jun 2012 10:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237298 - in stable/8: . share/man/man9 sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 10:59:12 -0000 Author: brueffer Date: Wed Jun 20 10:59:11 2012 New Revision: 237298 URL: http://svn.freebsd.org/changeset/base/237298 Log: MFC: r232051 Catch up with r195837 (2.5 years ago) which renamed net_add_domain() to domain_add(). Modified: stable/8/ObsoleteFiles.inc (contents, props changed) stable/8/share/man/man9/Makefile stable/8/share/man/man9/domain.9 stable/8/sys/kern/uipc_domain.c Directory Properties: stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Wed Jun 20 10:15:45 2012 (r237297) +++ stable/8/ObsoleteFiles.inc Wed Jun 20 10:59:11 2012 (r237298) @@ -345,6 +345,8 @@ OLD_LIBS+=usr/lib32/pam_unix.so.4 .endif # 20090718: the gdm pam.d file is no longer required. OLD_FILES+=etc/pam.d/gdm +# 20090714: net_add_domain(9) renamed to domain_add(9) +OLD_FILES+=usr/share/man/man9/net_add_domain.9.gz # 20090713: vimage container structs removed. OLD_FILES+=usr/include/netinet/vinet.h OLD_FILES+=usr/include/netinet6/vinet6.h Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Wed Jun 20 10:15:45 2012 (r237297) +++ stable/8/share/man/man9/Makefile Wed Jun 20 10:59:11 2012 (r237298) @@ -612,7 +612,7 @@ MLINKS+=disk.9 disk_alloc.9 \ disk.9 disk_gone.9 \ disk.9 disk_destroy.9 MLINKS+=domain.9 DOMAIN_SET.9 \ - domain.9 net_add_domain.9 \ + domain.9 domain_add.9 \ domain.9 pfctlinput.9 \ domain.9 pfctlinput2.9 \ domain.9 pffindproto.9 \ Modified: stable/8/share/man/man9/domain.9 ============================================================================== --- stable/8/share/man/man9/domain.9 Wed Jun 20 10:15:45 2012 (r237297) +++ stable/8/share/man/man9/domain.9 Wed Jun 20 10:59:11 2012 (r237298) @@ -26,11 +26,11 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2008 +.Dd February 23, 2012 .Dt DOMAIN 9 .Os .Sh NAME -.Nm net_add_domain , +.Nm domain_add , .Nm pfctlinput , .Nm pfctlinput2 , .Nm pffindproto , @@ -43,7 +43,7 @@ .In sys/protosw.h .In sys/domain.h .Ft void -.Fn net_add_domain "void *data" +.Fn domain_add "void *data" .Ft void .Fn pfctlinput "int cmd" "struct sockaddr *sa" .Ft void @@ -142,7 +142,7 @@ have their .Fn pr_ctlinput function called. .Pp -.Fn net_add_domain +.Fn domain_add adds a new protocol domain to the system. The argument .Fa data @@ -153,13 +153,13 @@ within the function, but is declared in order to prevent compiler warnings when new domains are registered with .Fn SYSINIT . In most cases -.Fn net_add_domain +.Fn domain_add is not called directly, instead .Fn DOMAIN_SET is used. .Pp If the new domain has defined an initialization routine, it is called by -.Fn net_add_domain ; +.Fn domain_add ; as well, each of the protocols within the domain that have defined an initialization routine will have theirs called. .Pp Modified: stable/8/sys/kern/uipc_domain.c ============================================================================== --- stable/8/sys/kern/uipc_domain.c Wed Jun 20 10:15:45 2012 (r237297) +++ stable/8/sys/kern/uipc_domain.c Wed Jun 20 10:59:11 2012 (r237298) @@ -220,7 +220,7 @@ domain_add(void *data) domains = dp; KASSERT(domain_init_status >= 1, - ("attempt to net_add_domain(%s) before domaininit()", + ("attempt to domain_add(%s) before domaininit()", dp->dom_name)); #ifndef INVARIANTS if (domain_init_status < 1) From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 13:41:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 37C151065674; Wed, 20 Jun 2012 13:41:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 223628FC14; Wed, 20 Jun 2012 13:41:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KDfKDY045102; Wed, 20 Jun 2012 13:41:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KDfKmY045100; Wed, 20 Jun 2012 13:41:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201341.q5KDfKmY045100@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 13:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237303 - stable/9/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 13:41:21 -0000 Author: mav Date: Wed Jun 20 13:41:20 2012 New Revision: 237303 URL: http://svn.freebsd.org/changeset/base/237303 Log: MFC r236605: Replace #ifdef CAMDEBUG + if + panic() with single KASSERT(). Modified: stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Jun 20 12:46:27 2012 (r237302) +++ stable/9/sys/cam/cam_xpt.c Wed Jun 20 13:41:20 2012 (r237303) @@ -3226,13 +3226,8 @@ xpt_run_dev_allocq(struct cam_eb *bus) ("running device %p\n", device)); drvq = &device->drvq; - -#ifdef CAMDEBUG - if (drvq->entries <= 0) { - panic("xpt_run_dev_allocq: " - "Device on queue without any work to do"); - } -#endif + KASSERT(drvq->entries > 0, ("xpt_run_dev_allocq: " + "Device on queue without any work to do")); if ((work_ccb = xpt_get_ccb(device)) != NULL) { devq->alloc_openings--; devq->alloc_active++; From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 13:42:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69DE91065676; Wed, 20 Jun 2012 13:42:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54B878FC20; Wed, 20 Jun 2012 13:42:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KDgfeH045208; Wed, 20 Jun 2012 13:42:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KDgf4S045206; Wed, 20 Jun 2012 13:42:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201342.q5KDgf4S045206@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 13:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237304 - stable/8/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 13:42:41 -0000 Author: mav Date: Wed Jun 20 13:42:40 2012 New Revision: 237304 URL: http://svn.freebsd.org/changeset/base/237304 Log: MFC r236605: Replace #ifdef CAMDEBUG + if + panic() with single KASSERT(). Modified: stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Wed Jun 20 13:41:20 2012 (r237303) +++ stable/8/sys/cam/cam_xpt.c Wed Jun 20 13:42:40 2012 (r237304) @@ -3179,13 +3179,8 @@ xpt_run_dev_allocq(struct cam_eb *bus) ("running device %p\n", device)); drvq = &device->drvq; - -#ifdef CAMDEBUG - if (drvq->entries <= 0) { - panic("xpt_run_dev_allocq: " - "Device on queue without any work to do"); - } -#endif + KASSERT(drvq->entries > 0, ("xpt_run_dev_allocq: " + "Device on queue without any work to do")); if ((work_ccb = xpt_get_ccb(device)) != NULL) { devq->alloc_openings--; devq->alloc_active++; From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 13:59:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0B5F1065676; Wed, 20 Jun 2012 13:59:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B92228FC12; Wed, 20 Jun 2012 13:59:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KDxPpG046008; Wed, 20 Jun 2012 13:59:25 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KDxPqD045999; Wed, 20 Jun 2012 13:59:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201359.q5KDxPqD045999@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 13:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237305 - in stable/9/sys/cam: ata scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 13:59:26 -0000 Author: mav Date: Wed Jun 20 13:59:25 2012 New Revision: 237305 URL: http://svn.freebsd.org/changeset/base/237305 Log: MFC r236602, r236613: Tune and add some missing CAM_DEBUG() points for better consistency. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/ata/ata_pmp.c stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_pt.c stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Wed Jun 20 13:42:40 2012 (r237304) +++ stable/9/sys/cam/ata/ata_da.c Wed Jun 20 13:59:25 2012 (r237305) @@ -436,9 +436,8 @@ adaopen(struct disk *dp) softc = (struct ada_softc *)periph->softc; softc->flags |= ADA_FLAG_OPEN; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, - ("adaopen: disk=%s%d (unit %d)\n", dp->d_name, dp->d_unit, - periph->unit_number)); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("adaopen\n")); if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { /* Invalidate our pack information. */ @@ -469,6 +468,10 @@ adaclose(struct disk *dp) } softc = (struct ada_softc *)periph->softc; + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("adaclose\n")); + /* We only sync the cache if the drive is capable of it. */ if ((softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { @@ -542,6 +545,8 @@ adastrategy(struct bio *bp) cam_periph_lock(periph); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adastrategy(%p)\n", bp)); + /* * If the device has been made invalid, error out */ @@ -1167,6 +1172,8 @@ adastart(struct cam_periph *periph, unio struct ada_softc *softc = (struct ada_softc *)periph->softc; struct ccb_ataio *ataio = &start_ccb->ataio; + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adastart\n")); + switch (softc->state) { case ADA_STATE_NORMAL: { @@ -1175,7 +1182,7 @@ adastart(struct cam_periph *periph, unio /* Execute immediate CCB if waiting. */ if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); start_ccb->ccb_h.ccb_state = ADA_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, @@ -1467,6 +1474,9 @@ adadone(struct cam_periph *periph, union softc = (struct ada_softc *)periph->softc; ataio = &done_ccb->ataio; + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adadone\n")); + switch (ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK) { case ADA_CCB_BUFFER_IO: case ADA_CCB_TRIM: Modified: stable/9/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/9/sys/cam/ata/ata_pmp.c Wed Jun 20 13:42:40 2012 (r237304) +++ stable/9/sys/cam/ata/ata_pmp.c Wed Jun 20 13:59:25 2012 (r237305) @@ -429,7 +429,9 @@ pmpstart(struct cam_periph *periph, unio softc = (struct pmp_softc *)periph->softc; ataio = &start_ccb->ataio; - + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("pmpstart\n")); + if (softc->restart) { softc->restart = 0; softc->state = min(softc->state, PMP_STATE_PRECONFIG); @@ -560,7 +562,7 @@ pmpdone(struct cam_periph *periph, union softc = (struct pmp_softc *)periph->softc; ataio = &done_ccb->ataio; - CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("pmpdone\n")); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("pmpdone\n")); priority = done_ccb->ccb_h.pinfo.priority; Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Wed Jun 20 13:42:40 2012 (r237304) +++ stable/9/sys/cam/ata/ata_xpt.c Wed Jun 20 13:59:25 2012 (r237305) @@ -96,6 +96,7 @@ typedef enum { PROBE_PM_PRV, PROBE_IDENTIFY_SES, PROBE_IDENTIFY_SAFTE, + PROBE_DONE, PROBE_INVALID } probe_action; @@ -115,6 +116,7 @@ static char *probe_action_text[] = { "PROBE_PM_PRV", "PROBE_IDENTIFY_SES", "PROBE_IDENTIFY_SAFTE", + "PROBE_DONE", "PROBE_INVALID" }; @@ -122,7 +124,7 @@ static char *probe_action_text[] = { do { \ char **text; \ text = probe_action_text; \ - CAM_DEBUG((softc)->periph->path, CAM_DEBUG_INFO, \ + CAM_DEBUG((softc)->periph->path, CAM_DEBUG_PROBE, \ ("Probe %s to %s\n", text[(softc)->action], \ text[(newaction)])); \ (softc)->action = (newaction); \ @@ -251,6 +253,8 @@ proberegister(struct cam_periph *periph, if (status != CAM_REQ_CMP) { return (status); } + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n")); + /* * Ensure nobody slip in until probe finish. */ @@ -653,11 +657,8 @@ negotiate: ata_28bit_cmd(ataio, ATA_SEP_ATTN, 0xEC, 0x00, sizeof(softc->ident_data) / 4); break; - case PROBE_INVALID: - CAM_DEBUG(path, CAM_DEBUG_INFO, - ("probestart: invalid action state\n")); default: - break; + panic("probestart: invalid action state 0x%x\n", softc->action); } xpt_action(start_ccb); } @@ -776,6 +777,7 @@ probedone(struct cam_periph *periph, uni */ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0) xpt_async(AC_LOST_DEVICE, path, NULL); + PROBE_SET_ACTION(softc, PROBE_INVALID); found = 0; goto done; } @@ -787,8 +789,8 @@ noerror: { int sign = (done_ccb->ataio.res.lba_high << 8) + done_ccb->ataio.res.lba_mid; - if (bootverbose) - xpt_print(path, "SIGNATURE: %04x\n", sign); + CAM_DEBUG(path, CAM_DEBUG_PROBE, + ("SIGNATURE: %04x\n", sign)); if (sign == 0x0000 && done_ccb->ccb_h.target_id != 15) { path->device->protocol = PROTO_ATA; @@ -1053,6 +1055,7 @@ notsata: xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); break; case PROBE_INQUIRY: case PROBE_FULL_INQUIRY: @@ -1094,6 +1097,7 @@ notsata: xpt_action(done_ccb); xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); break; } case PROBE_PM_PID: @@ -1165,6 +1169,7 @@ notsata: xpt_action(done_ccb); xpt_async(AC_SCSI_AEN, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); break; case PROBE_IDENTIFY_SES: case PROBE_IDENTIFY_SAFTE: @@ -1210,12 +1215,10 @@ notsata: xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); break; - case PROBE_INVALID: - CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_INFO, - ("probedone: invalid action state\n")); default: - break; + panic("probedone: invalid action state 0x%x\n", softc->action); } done: if (softc->restart) { @@ -1225,6 +1228,7 @@ done: return; } xpt_release_ccb(done_ccb); + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe completed\n")); while ((done_ccb = (union ccb *)TAILQ_FIRST(&softc->request_ccbs))) { TAILQ_REMOVE(&softc->request_ccbs, &done_ccb->ccb_h, periph_links.tqe); Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Wed Jun 20 13:42:40 2012 (r237304) +++ stable/9/sys/cam/scsi/scsi_cd.c Wed Jun 20 13:59:25 2012 (r237305) @@ -1013,6 +1013,9 @@ cdopen(struct disk *dp) return (error); } + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("cdopen\n")); + /* * Check for media, and set the appropriate flags. We don't bail * if we don't have media, but then we don't allow anything but the @@ -1050,6 +1053,9 @@ cdclose(struct disk *dp) cam_periph_lock(periph); cam_periph_hold(periph, PRIBIO); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("cdclose\n")); + if ((softc->flags & CD_FLAG_DISC_REMOVABLE) != 0) cdprevent(periph, PR_ALLOW); @@ -1394,7 +1400,8 @@ cdstrategy(struct bio *bp) } cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdstrategy\n")); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, + ("cdstrategy(%p)\n", bp)); softc = (struct cd_softc *)periph->softc; @@ -1860,12 +1867,11 @@ cdioctl(struct disk *dp, u_long cmd, voi return(ENXIO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdioctl\n")); softc = (struct cd_softc *)periph->softc; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, - ("trying to do ioctl %#lx\n", cmd)); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, + ("cdioctl(%#lx)\n", cmd)); if ((error = cam_periph_hold(periph, PRIBIO | PCATCH)) != 0) { cam_periph_unlock(periph); Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Wed Jun 20 13:42:40 2012 (r237304) +++ stable/9/sys/cam/scsi/scsi_da.c Wed Jun 20 13:59:25 2012 (r237305) @@ -938,9 +938,8 @@ daopen(struct disk *dp) softc = (struct da_softc *)periph->softc; softc->flags |= DA_FLAG_OPEN; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, - ("daopen: disk=%s%d (unit %d)\n", dp->d_name, dp->d_unit, - unit)); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("daopen\n")); if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { /* Invalidate our pack information. */ @@ -1000,6 +999,9 @@ daclose(struct disk *dp) softc = (struct da_softc *)periph->softc; + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("daclose\n")); + if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0 && (softc->flags & DA_FLAG_PACK_INVALID) == 0) { union ccb *ccb; @@ -1109,7 +1111,9 @@ dastrategy(struct bio *bp) biofinish(bp, NULL, ENXIO); return; } - + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dastrategy(%p)\n", bp)); + /* * Place it in the queue of disk activities for this disk */ @@ -1725,6 +1729,8 @@ dastart(struct cam_periph *periph, union softc = (struct da_softc *)periph->softc; + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dastart\n")); + switch (softc->state) { case DA_STATE_NORMAL: { @@ -1733,7 +1739,7 @@ dastart(struct cam_periph *periph, union /* Execute immediate CCB if waiting. */ if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); start_ccb->ccb_h.ccb_state = DA_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, @@ -2064,6 +2070,9 @@ dadone(struct cam_periph *periph, union softc = (struct da_softc *)periph->softc; priority = done_ccb->ccb_h.pinfo.priority; + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone\n")); + csio = &done_ccb->csio; switch (csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) { case DA_CCB_BUFFER_IO: Modified: stable/9/sys/cam/scsi/scsi_pt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_pt.c Wed Jun 20 13:42:40 2012 (r237304) +++ stable/9/sys/cam/scsi/scsi_pt.c Wed Jun 20 13:59:25 2012 (r237305) @@ -425,12 +425,14 @@ ptstart(struct cam_periph *periph, union softc = (struct pt_softc *)periph->softc; + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ptstart\n")); + /* * See if there is a buf with work for us to do.. */ bp = bioq_first(&softc->bio_queue); if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); start_ccb->ccb_h.ccb_state = PT_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, @@ -483,6 +485,9 @@ ptdone(struct cam_periph *periph, union struct ccb_scsiio *csio; softc = (struct pt_softc *)periph->softc; + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ptdone\n")); + csio = &done_ccb->csio; switch (csio->ccb_h.ccb_state) { case PT_CCB_BUFFER_IO: Modified: stable/9/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_xpt.c Wed Jun 20 13:42:40 2012 (r237304) +++ stable/9/sys/cam/scsi/scsi_xpt.c Wed Jun 20 13:59:25 2012 (r237305) @@ -141,6 +141,7 @@ typedef enum { PROBE_INQUIRY_BASIC_DV1, PROBE_INQUIRY_BASIC_DV2, PROBE_DV_EXIT, + PROBE_DONE, PROBE_INVALID } probe_action; @@ -157,6 +158,7 @@ static char *probe_action_text[] = { "PROBE_INQUIRY_BASIC_DV1", "PROBE_INQUIRY_BASIC_DV2", "PROBE_DV_EXIT", + "PROBE_DONE", "PROBE_INVALID" }; @@ -164,7 +166,7 @@ static char *probe_action_text[] = { do { \ char **text; \ text = probe_action_text; \ - CAM_DEBUG((softc)->periph->path, CAM_DEBUG_INFO, \ + CAM_DEBUG((softc)->periph->path, CAM_DEBUG_PROBE, \ ("Probe %s to %s\n", text[(softc)->action], \ text[(newaction)])); \ (softc)->action = (newaction); \ @@ -642,7 +644,7 @@ proberegister(struct cam_periph *periph, if (status != CAM_REQ_CMP) { return (status); } - + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n")); /* * Ensure we've waited at least a bus settle @@ -981,11 +983,8 @@ again: probedone(periph, start_ccb); return; } - case PROBE_INVALID: - CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO, - ("probestart: invalid action state\n")); default: - break; + panic("probestart: invalid action state 0x%x\n", softc->action); } xpt_action(start_ccb); } @@ -1065,7 +1064,7 @@ proberequestbackoff(struct cam_periph *p } if (device->flags & CAM_DEV_DV_HIT_BOTTOM) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("hit async: giving up on DV\n")); return (0); } @@ -1085,7 +1084,7 @@ proberequestbackoff(struct cam_periph *p if (spi->sync_period >= 0xf) { spi->sync_period = 0; spi->sync_offset = 0; - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("setting to async for DV\n")); /* * Once we hit async, we don't want to try @@ -1093,7 +1092,7 @@ proberequestbackoff(struct cam_periph *p */ device->flags |= CAM_DEV_DV_HIT_BOTTOM; } else if (bootverbose) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("DV: period 0x%x\n", spi->sync_period)); printf("setting period to 0x%x\n", spi->sync_period); } @@ -1103,7 +1102,7 @@ proberequestbackoff(struct cam_periph *p if ((cts.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { break; } - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("DV: failed to set period 0x%x\n", spi->sync_period)); if (spi->sync_period == 0) { return (0); @@ -1250,6 +1249,7 @@ probedone(struct cam_periph *periph, uni if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0) /* Send the async notification. */ xpt_async(AC_LOST_DEVICE, path, NULL); + PROBE_SET_ACTION(softc, PROBE_INVALID); xpt_release_ccb(done_ccb); break; @@ -1283,8 +1283,9 @@ probedone(struct cam_periph *periph, uni /* * Reallocate and retry to cover all luns */ - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, path, - ("reallocating REPORT_LUNS for %u luns\n", nlun)); + CAM_DEBUG(path, CAM_DEBUG_PROBE, + ("Probe: reallocating REPORT_LUNS for %u luns\n", + nlun)); free(lp, M_CAMXPT); path->target->rpl_size = (nlun << 3) + 8; xpt_release_ccb(done_ccb); @@ -1307,8 +1308,8 @@ probedone(struct cam_periph *periph, uni lun_id_t lun; int idx; - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, path, - ("%u luns reported\n", nlun)); + CAM_DEBUG(path, CAM_DEBUG_PROBE, + ("Probe: %u lun(s) reported\n", nlun)); CAM_GET_SIMPLE_LUN(lp, 0, lun); /* @@ -1330,8 +1331,8 @@ probedone(struct cam_periph *periph, uni lp->luns[idx].lundata, 8); memcpy(lp->luns[idx].lundata, tlun, 8); - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, - path, ("lun 0 in position %u\n", idx)); + CAM_DEBUG(path, CAM_DEBUG_PROBE, + ("lun 0 in position %u\n", idx)); } else { /* * There is no lun 0 in our list. Destroy @@ -1616,7 +1617,7 @@ probe_device_check: && done_ccb->ccb_h.target_lun == 0 && (path->device->inq_data.flags & SID_Sync) != 0 && (path->device->flags & CAM_DEV_IN_DV) == 0) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Begin Domain Validation\n")); path->device->flags |= CAM_DEV_IN_DV; xpt_release_ccb(done_ccb); @@ -1625,7 +1626,7 @@ probe_device_check: return; } if (softc->action == PROBE_DV_EXIT) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Leave Domain Validation\n")); } if (path->device->flags & CAM_DEV_UNCONFIGURED) { @@ -1641,6 +1642,7 @@ probe_device_check: xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); xpt_release_ccb(done_ccb); break; case PROBE_INQUIRY_BASIC_DV1: @@ -1680,7 +1682,7 @@ probe_device_check: return; } if (softc->action == PROBE_INQUIRY_BASIC_DV2) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Leave Domain Validation Successfully\n")); } if (path->device->flags & CAM_DEV_UNCONFIGURED) { @@ -1696,20 +1698,19 @@ probe_device_check: xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); xpt_release_ccb(done_ccb); break; } - case PROBE_INVALID: - CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_INFO, - ("probedone: invalid action state\n")); default: - break; + panic("probedone: invalid action state 0x%x\n", softc->action); } done_ccb = (union ccb *)TAILQ_FIRST(&softc->request_ccbs); TAILQ_REMOVE(&softc->request_ccbs, &done_ccb->ccb_h, periph_links.tqe); done_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(done_ccb); if (TAILQ_FIRST(&softc->request_ccbs) == NULL) { + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe completed\n")); cam_periph_invalidate(periph); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_XPT + 1, FALSE); @@ -1922,7 +1923,7 @@ scsi_scan_bus(struct cam_periph *periph, xpt_done(request_ccb); return; } - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, request_ccb->ccb_h.path, + CAM_DEBUG(request_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("SCAN start for %p\n", scan_info)); scan_info->request_ccb = request_ccb; scan_info->cpi = &work_ccb->cpi; @@ -2035,8 +2036,8 @@ scsi_scan_bus(struct cam_periph *periph, CAM_GET_SIMPLE_LUN(target->luns, scan_info->lunindex[target_id], lun_id); next_target = 0; - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, - request_ccb->ccb_h.path, + CAM_DEBUG(request_ccb->ccb_h.path, + CAM_DEBUG_PROBE, ("next lun to try at index %u is %u\n", scan_info->lunindex[target_id], lun_id)); scan_info->lunindex[target_id]++; @@ -2143,8 +2144,8 @@ scsi_scan_bus(struct cam_periph *periph, xpt_free_ccb(request_ccb); xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, - request_ccb->ccb_h.path, + CAM_DEBUG(request_ccb->ccb_h.path, + CAM_DEBUG_TRACE, ("SCAN done for %p\n", scan_info)); free(scan_info, M_CAMXPT); request_ccb->ccb_h.status = CAM_REQ_CMP; From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:11:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A1851065675; Wed, 20 Jun 2012 14:11:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 129D38FC08; Wed, 20 Jun 2012 14:11:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEBJuk046552; Wed, 20 Jun 2012 14:11:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEBI7f046544; Wed, 20 Jun 2012 14:11:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201411.q5KEBI7f046544@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:11:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237306 - in stable/8/sys/cam: ata scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:11:19 -0000 Author: mav Date: Wed Jun 20 14:11:18 2012 New Revision: 237306 URL: http://svn.freebsd.org/changeset/base/237306 Log: MFC r236602, r236613: Tune and add some missing CAM_DEBUG() points for better consistency. Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/ata/ata_pmp.c stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/cam/scsi/scsi_cd.c stable/8/sys/cam/scsi/scsi_da.c stable/8/sys/cam/scsi/scsi_pt.c stable/8/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Wed Jun 20 13:59:25 2012 (r237305) +++ stable/8/sys/cam/ata/ata_da.c Wed Jun 20 14:11:18 2012 (r237306) @@ -426,9 +426,8 @@ adaopen(struct disk *dp) softc = (struct ada_softc *)periph->softc; softc->flags |= ADA_FLAG_OPEN; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, - ("adaopen: disk=%s%d (unit %d)\n", dp->d_name, dp->d_unit, - periph->unit_number)); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("adaopen\n")); if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { /* Invalidate our pack information. */ @@ -459,6 +458,10 @@ adaclose(struct disk *dp) } softc = (struct ada_softc *)periph->softc; + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("adaclose\n")); + /* We only sync the cache if the drive is capable of it. */ if ((softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { @@ -532,6 +535,8 @@ adastrategy(struct bio *bp) cam_periph_lock(periph); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adastrategy(%p)\n", bp)); + /* * If the device has been made invalid, error out */ @@ -1113,6 +1118,8 @@ adastart(struct cam_periph *periph, unio struct ada_softc *softc = (struct ada_softc *)periph->softc; struct ccb_ataio *ataio = &start_ccb->ataio; + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adastart\n")); + switch (softc->state) { case ADA_STATE_NORMAL: { @@ -1121,7 +1128,7 @@ adastart(struct cam_periph *periph, unio /* Execute immediate CCB if waiting. */ if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); start_ccb->ccb_h.ccb_state = ADA_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, @@ -1413,6 +1420,9 @@ adadone(struct cam_periph *periph, union softc = (struct ada_softc *)periph->softc; ataio = &done_ccb->ataio; + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adadone\n")); + switch (ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK) { case ADA_CCB_BUFFER_IO: case ADA_CCB_TRIM: Modified: stable/8/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/8/sys/cam/ata/ata_pmp.c Wed Jun 20 13:59:25 2012 (r237305) +++ stable/8/sys/cam/ata/ata_pmp.c Wed Jun 20 14:11:18 2012 (r237306) @@ -429,7 +429,9 @@ pmpstart(struct cam_periph *periph, unio softc = (struct pmp_softc *)periph->softc; ataio = &start_ccb->ataio; - + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("pmpstart\n")); + if (softc->restart) { softc->restart = 0; softc->state = min(softc->state, PMP_STATE_PRECONFIG); @@ -560,7 +562,7 @@ pmpdone(struct cam_periph *periph, union softc = (struct pmp_softc *)periph->softc; ataio = &done_ccb->ataio; - CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("pmpdone\n")); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("pmpdone\n")); priority = done_ccb->ccb_h.pinfo.priority; Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Wed Jun 20 13:59:25 2012 (r237305) +++ stable/8/sys/cam/ata/ata_xpt.c Wed Jun 20 14:11:18 2012 (r237306) @@ -94,6 +94,7 @@ typedef enum { PROBE_FULL_INQUIRY, PROBE_PM_PID, PROBE_PM_PRV, + PROBE_DONE, PROBE_INVALID } probe_action; @@ -111,6 +112,7 @@ static char *probe_action_text[] = { "PROBE_FULL_INQUIRY", "PROBE_PM_PID", "PROBE_PM_PRV", + "PROBE_DONE", "PROBE_INVALID" }; @@ -118,7 +120,7 @@ static char *probe_action_text[] = { do { \ char **text; \ text = probe_action_text; \ - CAM_DEBUG((softc)->periph->path, CAM_DEBUG_INFO, \ + CAM_DEBUG((softc)->periph->path, CAM_DEBUG_PROBE, \ ("Probe %s to %s\n", text[(softc)->action], \ text[(newaction)])); \ (softc)->action = (newaction); \ @@ -247,6 +249,8 @@ proberegister(struct cam_periph *periph, if (status != CAM_REQ_CMP) { return (status); } + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n")); + /* * Ensure nobody slip in until probe finish. */ @@ -623,11 +627,8 @@ negotiate: 10 * 1000); ata_pm_read_cmd(ataio, 1, 15); break; - case PROBE_INVALID: - CAM_DEBUG(path, CAM_DEBUG_INFO, - ("probestart: invalid action state\n")); default: - break; + panic("probestart: invalid action state 0x%x\n", softc->action); } xpt_action(start_ccb); } @@ -729,6 +730,7 @@ probedone(struct cam_periph *periph, uni */ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0) xpt_async(AC_LOST_DEVICE, path, NULL); + PROBE_SET_ACTION(softc, PROBE_INVALID); found = 0; goto done; } @@ -740,8 +742,8 @@ noerror: { int sign = (done_ccb->ataio.res.lba_high << 8) + done_ccb->ataio.res.lba_mid; - if (bootverbose) - xpt_print(path, "SIGNATURE: %04x\n", sign); + CAM_DEBUG(path, CAM_DEBUG_PROBE, + ("SIGNATURE: %04x\n", sign)); if (sign == 0x0000 && done_ccb->ccb_h.target_id != 15) { path->device->protocol = PROTO_ATA; @@ -986,6 +988,7 @@ notsata: xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); break; case PROBE_INQUIRY: case PROBE_FULL_INQUIRY: @@ -1029,6 +1032,7 @@ notsata: xpt_action(done_ccb); xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); break; } case PROBE_PM_PID: @@ -1100,12 +1104,10 @@ notsata: xpt_action(done_ccb); xpt_async(AC_SCSI_AEN, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); break; - case PROBE_INVALID: - CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_INFO, - ("probedone: invalid action state\n")); default: - break; + panic("probedone: invalid action state 0x%x\n", softc->action); } done: if (softc->restart) { @@ -1115,6 +1117,7 @@ done: return; } xpt_release_ccb(done_ccb); + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe completed\n")); while ((done_ccb = (union ccb *)TAILQ_FIRST(&softc->request_ccbs))) { TAILQ_REMOVE(&softc->request_ccbs, &done_ccb->ccb_h, periph_links.tqe); Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Wed Jun 20 13:59:25 2012 (r237305) +++ stable/8/sys/cam/scsi/scsi_cd.c Wed Jun 20 14:11:18 2012 (r237306) @@ -1006,6 +1006,9 @@ cdopen(struct disk *dp) return (error); } + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("cdopen\n")); + /* * Check for media, and set the appropriate flags. We don't bail * if we don't have media, but then we don't allow anything but the @@ -1043,6 +1046,9 @@ cdclose(struct disk *dp) cam_periph_lock(periph); cam_periph_hold(periph, PRIBIO); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("cdclose\n")); + if ((softc->flags & CD_FLAG_DISC_REMOVABLE) != 0) cdprevent(periph, PR_ALLOW); @@ -1387,7 +1393,8 @@ cdstrategy(struct bio *bp) } cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdstrategy\n")); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, + ("cdstrategy(%p)\n", bp)); softc = (struct cd_softc *)periph->softc; @@ -1852,12 +1859,11 @@ cdioctl(struct disk *dp, u_long cmd, voi return(ENXIO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdioctl\n")); softc = (struct cd_softc *)periph->softc; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, - ("trying to do ioctl %#lx\n", cmd)); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, + ("cdioctl(%#lx)\n", cmd)); if ((error = cam_periph_hold(periph, PRIBIO | PCATCH)) != 0) { cam_periph_unlock(periph); Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Wed Jun 20 13:59:25 2012 (r237305) +++ stable/8/sys/cam/scsi/scsi_da.c Wed Jun 20 14:11:18 2012 (r237306) @@ -914,9 +914,8 @@ daopen(struct disk *dp) softc = (struct da_softc *)periph->softc; softc->flags |= DA_FLAG_OPEN; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, - ("daopen: disk=%s%d (unit %d)\n", dp->d_name, dp->d_unit, - unit)); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("daopen\n")); if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { /* Invalidate our pack information. */ @@ -972,6 +971,9 @@ daclose(struct disk *dp) softc = (struct da_softc *)periph->softc; + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, + ("daclose\n")); + if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0 && (softc->flags & DA_FLAG_PACK_INVALID) == 0) { union ccb *ccb; @@ -1061,7 +1063,9 @@ dastrategy(struct bio *bp) biofinish(bp, NULL, ENXIO); return; } - + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dastrategy(%p)\n", bp)); + /* * Place it in the queue of disk activities for this disk */ @@ -1576,6 +1580,8 @@ dastart(struct cam_periph *periph, union softc = (struct da_softc *)periph->softc; + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dastart\n")); + switch (softc->state) { case DA_STATE_NORMAL: { @@ -1587,7 +1593,7 @@ dastart(struct cam_periph *periph, union */ bp = bioq_first(&softc->bio_queue); if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); start_ccb->ccb_h.ccb_state = DA_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, @@ -1784,6 +1790,9 @@ dadone(struct cam_periph *periph, union softc = (struct da_softc *)periph->softc; priority = done_ccb->ccb_h.pinfo.priority; + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone\n")); + csio = &done_ccb->csio; switch (csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) { case DA_CCB_BUFFER_IO: Modified: stable/8/sys/cam/scsi/scsi_pt.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_pt.c Wed Jun 20 13:59:25 2012 (r237305) +++ stable/8/sys/cam/scsi/scsi_pt.c Wed Jun 20 14:11:18 2012 (r237306) @@ -425,12 +425,14 @@ ptstart(struct cam_periph *periph, union softc = (struct pt_softc *)periph->softc; + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ptstart\n")); + /* * See if there is a buf with work for us to do.. */ bp = bioq_first(&softc->bio_queue); if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); start_ccb->ccb_h.ccb_state = PT_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, @@ -483,6 +485,9 @@ ptdone(struct cam_periph *periph, union struct ccb_scsiio *csio; softc = (struct pt_softc *)periph->softc; + + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ptdone\n")); + csio = &done_ccb->csio; switch (csio->ccb_h.ccb_state) { case PT_CCB_BUFFER_IO: Modified: stable/8/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_xpt.c Wed Jun 20 13:59:25 2012 (r237305) +++ stable/8/sys/cam/scsi/scsi_xpt.c Wed Jun 20 14:11:18 2012 (r237306) @@ -140,6 +140,7 @@ typedef enum { PROBE_INQUIRY_BASIC_DV1, PROBE_INQUIRY_BASIC_DV2, PROBE_DV_EXIT, + PROBE_DONE, PROBE_INVALID } probe_action; @@ -155,6 +156,7 @@ static char *probe_action_text[] = { "PROBE_INQUIRY_BASIC_DV1", "PROBE_INQUIRY_BASIC_DV2", "PROBE_DV_EXIT", + "PROBE_DONE", "PROBE_INVALID" }; @@ -162,7 +164,7 @@ static char *probe_action_text[] = { do { \ char **text; \ text = probe_action_text; \ - CAM_DEBUG((softc)->periph->path, CAM_DEBUG_INFO, \ + CAM_DEBUG((softc)->periph->path, CAM_DEBUG_PROBE, \ ("Probe %s to %s\n", text[(softc)->action], \ text[(newaction)])); \ (softc)->action = (newaction); \ @@ -639,7 +641,7 @@ proberegister(struct cam_periph *periph, if (status != CAM_REQ_CMP) { return (status); } - + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n")); /* * Ensure we've waited at least a bus settle @@ -927,11 +929,8 @@ again: probedone(periph, start_ccb); return; } - case PROBE_INVALID: - CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO, - ("probestart: invalid action state\n")); default: - break; + panic("probestart: invalid action state 0x%x\n", softc->action); } xpt_action(start_ccb); } @@ -1011,7 +1010,7 @@ proberequestbackoff(struct cam_periph *p } if (device->flags & CAM_DEV_DV_HIT_BOTTOM) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("hit async: giving up on DV\n")); return (0); } @@ -1031,7 +1030,7 @@ proberequestbackoff(struct cam_periph *p if (spi->sync_period >= 0xf) { spi->sync_period = 0; spi->sync_offset = 0; - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("setting to async for DV\n")); /* * Once we hit async, we don't want to try @@ -1039,7 +1038,7 @@ proberequestbackoff(struct cam_periph *p */ device->flags |= CAM_DEV_DV_HIT_BOTTOM; } else if (bootverbose) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("DV: period 0x%x\n", spi->sync_period)); printf("setting period to 0x%x\n", spi->sync_period); } @@ -1049,7 +1048,7 @@ proberequestbackoff(struct cam_periph *p if ((cts.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { break; } - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("DV: failed to set period 0x%x\n", spi->sync_period)); if (spi->sync_period == 0) { return (0); @@ -1194,6 +1193,7 @@ probedone(struct cam_periph *periph, uni if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0) /* Send the async notification. */ xpt_async(AC_LOST_DEVICE, path, NULL); + PROBE_SET_ACTION(softc, PROBE_INVALID); xpt_release_ccb(done_ccb); break; @@ -1227,8 +1227,9 @@ probedone(struct cam_periph *periph, uni /* * Reallocate and retry to cover all luns */ - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, path, - ("reallocating REPORT_LUNS for %u luns\n", nlun)); + CAM_DEBUG(path, CAM_DEBUG_PROBE, + ("Probe: reallocating REPORT_LUNS for %u luns\n", + nlun)); free(lp, M_CAMXPT); path->target->rpl_size = (nlun << 3) + 8; xpt_release_ccb(done_ccb); @@ -1251,8 +1252,8 @@ probedone(struct cam_periph *periph, uni lun_id_t lun; int idx; - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, path, - ("%u luns reported\n", nlun)); + CAM_DEBUG(path, CAM_DEBUG_PROBE, + ("Probe: %u lun(s) reported\n", nlun)); CAM_GET_SIMPLE_LUN(lp, 0, lun); /* @@ -1274,8 +1275,8 @@ probedone(struct cam_periph *periph, uni lp->luns[idx].lundata, 8); memcpy(lp->luns[idx].lundata, tlun, 8); - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, - path, ("lun 0 in position %u\n", idx)); + CAM_DEBUG(path, CAM_DEBUG_PROBE, + ("lun 0 in position %u\n", idx)); } else { /* * There is no lun 0 in our list. Destroy @@ -1523,7 +1524,7 @@ probedone(struct cam_periph *periph, uni && done_ccb->ccb_h.target_lun == 0 && (path->device->inq_data.flags & SID_Sync) != 0 && (path->device->flags & CAM_DEV_IN_DV) == 0) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Begin Domain Validation\n")); path->device->flags |= CAM_DEV_IN_DV; xpt_release_ccb(done_ccb); @@ -1532,7 +1533,7 @@ probedone(struct cam_periph *periph, uni return; } if (softc->action == PROBE_DV_EXIT) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Leave Domain Validation\n")); } if (path->device->flags & CAM_DEV_UNCONFIGURED) { @@ -1548,6 +1549,7 @@ probedone(struct cam_periph *periph, uni xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); xpt_release_ccb(done_ccb); break; case PROBE_INQUIRY_BASIC_DV1: @@ -1587,7 +1589,7 @@ probedone(struct cam_periph *periph, uni return; } if (softc->action == PROBE_INQUIRY_BASIC_DV2) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Leave Domain Validation Successfully\n")); } if (path->device->flags & CAM_DEV_UNCONFIGURED) { @@ -1603,20 +1605,19 @@ probedone(struct cam_periph *periph, uni xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); } + PROBE_SET_ACTION(softc, PROBE_DONE); xpt_release_ccb(done_ccb); break; } - case PROBE_INVALID: - CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_INFO, - ("probedone: invalid action state\n")); default: - break; + panic("probedone: invalid action state 0x%x\n", softc->action); } done_ccb = (union ccb *)TAILQ_FIRST(&softc->request_ccbs); TAILQ_REMOVE(&softc->request_ccbs, &done_ccb->ccb_h, periph_links.tqe); done_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(done_ccb); if (TAILQ_FIRST(&softc->request_ccbs) == NULL) { + CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe completed\n")); cam_periph_invalidate(periph); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_XPT + 1, FALSE); @@ -1829,7 +1830,7 @@ scsi_scan_bus(struct cam_periph *periph, xpt_done(request_ccb); return; } - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, request_ccb->ccb_h.path, + CAM_DEBUG(request_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("SCAN start for %p\n", scan_info)); scan_info->request_ccb = request_ccb; scan_info->cpi = &work_ccb->cpi; @@ -1942,8 +1943,8 @@ scsi_scan_bus(struct cam_periph *periph, CAM_GET_SIMPLE_LUN(target->luns, scan_info->lunindex[target_id], lun_id); next_target = 0; - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, - request_ccb->ccb_h.path, + CAM_DEBUG(request_ccb->ccb_h.path, + CAM_DEBUG_PROBE, ("next lun to try at index %u is %u\n", scan_info->lunindex[target_id], lun_id)); scan_info->lunindex[target_id]++; @@ -2050,8 +2051,8 @@ scsi_scan_bus(struct cam_periph *periph, xpt_free_ccb(request_ccb); xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; - CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, - request_ccb->ccb_h.path, + CAM_DEBUG(request_ccb->ccb_h.path, + CAM_DEBUG_TRACE, ("SCAN done for %p\n", scan_info)); free(scan_info, M_CAMXPT); request_ccb->ccb_h.status = CAM_REQ_CMP; From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:13:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 853E2106566C; Wed, 20 Jun 2012 14:13:08 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F65D8FC12; Wed, 20 Jun 2012 14:13:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KED8vQ046682; Wed, 20 Jun 2012 14:13:08 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KED8hj046680; Wed, 20 Jun 2012 14:13:08 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201206201413.q5KED8hj046680@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Wed, 20 Jun 2012 14:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237307 - stable/9/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:13:08 -0000 Author: melifaro Date: Wed Jun 20 14:13:07 2012 New Revision: 237307 URL: http://svn.freebsd.org/changeset/base/237307 Log: MFC r236819 Validate IPv4 network mask being passed to ipfw kernel interface. Incorrect mask can possibly be one of the reasons for kern/127209 existance. Approved by: ae(mentor) Modified: stable/9/sys/netinet/ipfw/ip_fw_table.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_table.c Wed Jun 20 14:11:18 2012 (r237306) +++ stable/9/sys/netinet/ipfw/ip_fw_table.c Wed Jun 20 14:13:07 2012 (r237307) @@ -153,6 +153,9 @@ ipfw_add_table_entry(struct ip_fw_chain case IPFW_TABLE_CIDR: if (plen == sizeof(in_addr_t)) { #ifdef INET + /* IPv4 case */ + if (mlen > 32) + return (EINVAL); ent = malloc(sizeof(*ent), M_IPFW_TBL, M_WAITOK | M_ZERO); ent->value = value; /* Set 'total' structure length */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:14:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 605FE1065673; Wed, 20 Jun 2012 14:14:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30F2A8FC15; Wed, 20 Jun 2012 14:14:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEESB9046782; Wed, 20 Jun 2012 14:14:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEERc4046777; Wed, 20 Jun 2012 14:14:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201414.q5KEERc4046777@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:14:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237308 - stable/9/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:14:28 -0000 Author: mav Date: Wed Jun 20 14:14:27 2012 New Revision: 237308 URL: http://svn.freebsd.org/changeset/base/237308 Log: MFC r236555: Add -p argument for `camcontrol debug` to allow enabling CAM_DEBUG_PROBE added at r208911. Modified: stable/9/sbin/camcontrol/camcontrol.8 stable/9/sbin/camcontrol/camcontrol.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.8 Wed Jun 20 14:13:07 2012 (r237307) +++ stable/9/sbin/camcontrol/camcontrol.8 Wed Jun 20 14:14:27 2012 (r237308) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2010 +.Dd June 4, 2012 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -175,6 +175,7 @@ .Op Fl S .Op Fl X .Op Fl c +.Op Fl p .Aq all|off|bus Ns Op :target Ns Op :lun .Nm .Ic tags @@ -789,6 +790,8 @@ Enable CAM_DEBUG_XPT printfs. Enable CAM_DEBUG_CDB printfs. This will cause the kernel to print out the SCSI CDBs sent to the specified device(s). +.It Fl p +Enable CAM_DEBUG_PROBE printfs. .It all Enable debugging for all devices. .It off Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Wed Jun 20 14:13:07 2012 (r237307) +++ stable/9/sbin/camcontrol/camcontrol.c Wed Jun 20 14:14:27 2012 (r237308) @@ -122,6 +122,7 @@ typedef enum { CAM_ARG_DEBUG_CDB = 0x08000000, CAM_ARG_DEBUG_XPT = 0x10000000, CAM_ARG_DEBUG_PERIPH = 0x20000000, + CAM_ARG_DEBUG_PROBE = 0x40000000, } cam_argmask; struct camcontrol_opts { @@ -175,7 +176,7 @@ struct camcontrol_opts option_table[] = {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, {"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, {"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, - {"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "IPTSXc"}, + {"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "IPTSXcp"}, {"format", CAM_CMD_FORMAT, CAM_ARG_NONE, "qrwy"}, {"idle", CAM_CMD_IDLE, CAM_ARG_NONE, "t:"}, {"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"}, @@ -2640,6 +2641,10 @@ camdebug(int argc, char **argv, char *co arglist |= CAM_ARG_DEBUG_CDB; ccb.cdbg.flags |= CAM_DEBUG_CDB; break; + case 'p': + arglist |= CAM_ARG_DEBUG_PROBE; + ccb.cdbg.flags |= CAM_DEBUG_PROBE; + break; default: break; } @@ -2669,7 +2674,7 @@ camdebug(int argc, char **argv, char *co ccb.cdbg.flags = CAM_DEBUG_NONE; arglist &= ~(CAM_ARG_DEBUG_INFO|CAM_ARG_DEBUG_PERIPH| CAM_ARG_DEBUG_TRACE|CAM_ARG_DEBUG_SUBTRACE| - CAM_ARG_DEBUG_XPT); + CAM_ARG_DEBUG_XPT|CAM_ARG_DEBUG_PROBE); } else if (strncmp(tstr, "all", 3) != 0) { tmpstr = (char *)strtok(tstr, ":"); if ((tmpstr != NULL) && (*tmpstr != '\0')){ From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:15:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC8C81065674; Wed, 20 Jun 2012 14:15:14 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6FA78FC1C; Wed, 20 Jun 2012 14:15:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEFEo5046874; Wed, 20 Jun 2012 14:15:14 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEFEan046872; Wed, 20 Jun 2012 14:15:14 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201206201415.q5KEFEan046872@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Wed, 20 Jun 2012 14:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237309 - stable/8/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:15:14 -0000 Author: melifaro Date: Wed Jun 20 14:15:14 2012 New Revision: 237309 URL: http://svn.freebsd.org/changeset/base/237309 Log: MFC r236819 Validate IPv4 network mask being passed to ipfw kernel interface. Incorrect mask can possibly be one of the reasons for kern/127209 existance. Approved by: ae(mentor) Modified: stable/8/sys/netinet/ipfw/ip_fw_table.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_table.c Wed Jun 20 14:14:27 2012 (r237308) +++ stable/8/sys/netinet/ipfw/ip_fw_table.c Wed Jun 20 14:15:14 2012 (r237309) @@ -153,6 +153,9 @@ ipfw_add_table_entry(struct ip_fw_chain case IPFW_TABLE_CIDR: if (plen == sizeof(in_addr_t)) { #ifdef INET + /* IPv4 case */ + if (mlen > 32) + return (EINVAL); ent = malloc(sizeof(*ent), M_IPFW_TBL, M_WAITOK | M_ZERO); ent->value = value; /* Set 'total' structure length */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:15:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3167A1065680; Wed, 20 Jun 2012 14:15:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0336F8FC14; Wed, 20 Jun 2012 14:15:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEFde9046931; Wed, 20 Jun 2012 14:15:39 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEFdSl046928; Wed, 20 Jun 2012 14:15:39 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201415.q5KEFdSl046928@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:15:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237310 - stable/8/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:15:40 -0000 Author: mav Date: Wed Jun 20 14:15:39 2012 New Revision: 237310 URL: http://svn.freebsd.org/changeset/base/237310 Log: MFC r236555: Add -p argument for `camcontrol debug` to allow enabling CAM_DEBUG_PROBE added at r208911. Modified: stable/8/sbin/camcontrol/camcontrol.8 stable/8/sbin/camcontrol/camcontrol.c Directory Properties: stable/8/sbin/camcontrol/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.8 Wed Jun 20 14:15:14 2012 (r237309) +++ stable/8/sbin/camcontrol/camcontrol.8 Wed Jun 20 14:15:39 2012 (r237310) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2010 +.Dd June 4, 2012 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -138,6 +138,7 @@ .Op Fl S .Op Fl X .Op Fl c +.Op Fl p .Aq all|off|bus Ns Op :target Ns Op :lun .Nm .Ic tags @@ -581,6 +582,8 @@ Enable CAM_DEBUG_XPT printfs. Enable CAM_DEBUG_CDB printfs. This will cause the kernel to print out the SCSI CDBs sent to the specified device(s). +.It Fl p +Enable CAM_DEBUG_PROBE printfs. .It all Enable debugging for all devices. .It off Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Wed Jun 20 14:15:14 2012 (r237309) +++ stable/8/sbin/camcontrol/camcontrol.c Wed Jun 20 14:15:39 2012 (r237310) @@ -113,6 +113,7 @@ typedef enum { CAM_ARG_DEBUG_CDB = 0x08000000, CAM_ARG_DEBUG_XPT = 0x10000000, CAM_ARG_DEBUG_PERIPH = 0x20000000, + CAM_ARG_DEBUG_PROBE = 0x40000000, } cam_argmask; struct camcontrol_opts { @@ -155,7 +156,7 @@ struct camcontrol_opts option_table[] = {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, {"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, {"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, - {"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "IPTSXc"}, + {"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "IPTSXcp"}, {"format", CAM_CMD_FORMAT, CAM_ARG_NONE, "qrwy"}, {"idle", CAM_CMD_IDLE, CAM_ARG_NONE, "t:"}, {"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"}, @@ -2568,6 +2569,10 @@ camdebug(int argc, char **argv, char *co arglist |= CAM_ARG_DEBUG_CDB; ccb.cdbg.flags |= CAM_DEBUG_CDB; break; + case 'p': + arglist |= CAM_ARG_DEBUG_PROBE; + ccb.cdbg.flags |= CAM_DEBUG_PROBE; + break; default: break; } @@ -2597,7 +2602,7 @@ camdebug(int argc, char **argv, char *co ccb.cdbg.flags = CAM_DEBUG_NONE; arglist &= ~(CAM_ARG_DEBUG_INFO|CAM_ARG_DEBUG_PERIPH| CAM_ARG_DEBUG_TRACE|CAM_ARG_DEBUG_SUBTRACE| - CAM_ARG_DEBUG_XPT); + CAM_ARG_DEBUG_XPT|CAM_ARG_DEBUG_PROBE); } else if (strncmp(tstr, "all", 3) != 0) { tmpstr = (char *)strtok(tstr, ":"); if ((tmpstr != NULL) && (*tmpstr != '\0')){ From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:19:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6383E106564A; Wed, 20 Jun 2012 14:19:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34DB28FC14; Wed, 20 Jun 2012 14:19:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEJuYW047164; Wed, 20 Jun 2012 14:19:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEJtA8047161; Wed, 20 Jun 2012 14:19:56 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201419.q5KEJtA8047161@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:19:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237311 - in stable/9/sys/cam: ata scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:19:56 -0000 Author: mav Date: Wed Jun 20 14:19:55 2012 New Revision: 237311 URL: http://svn.freebsd.org/changeset/base/237311 Log: MFC r236604, r236639: Do not reinvent a wheel and let default error handler do its job. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Wed Jun 20 14:15:39 2012 (r237310) +++ stable/9/sys/cam/ata/ata_da.c Wed Jun 20 14:19:55 2012 (r237311) @@ -490,7 +490,7 @@ adaclose(struct disk *dp) ata_48bit_cmd(&ccb->ataio, ATA_FLUSHCACHE48, 0, 0, 0); else ata_28bit_cmd(&ccb->ataio, ATA_FLUSHCACHE, 0, 0, 0); - cam_periph_runccb(ccb, /*error_routine*/NULL, /*cam_flags*/0, + cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, /*sense_flags*/0, softc->disk->d_devstat); if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Wed Jun 20 14:15:39 2012 (r237310) +++ stable/9/sys/cam/scsi/scsi_da.c Wed Jun 20 14:19:55 2012 (r237311) @@ -1017,30 +1017,9 @@ daclose(struct disk *dp) SSD_FULL_SIZE, 5 * 60 * 1000); - cam_periph_runccb(ccb, /*error_routine*/NULL, /*cam_flags*/0, - /*sense_flags*/SF_RETRY_UA, + cam_periph_runccb(ccb, daerror, /*cam_flags*/0, + /*sense_flags*/SF_RETRY_UA | SF_QUIET_IR, softc->disk->d_devstat); - - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if ((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) { - int asc, ascq; - int sense_key, error_code; - - scsi_extract_sense_len(&ccb->csio.sense_data, - ccb->csio.sense_len - ccb->csio.sense_resid, - &error_code, &sense_key, &asc, &ascq, - /*show_errors*/ 1); - if (sense_key != SSD_KEY_ILLEGAL_REQUEST) - scsi_sense_print(&ccb->csio); - } else { - xpt_print(periph->path, "Synchronize cache " - "failed, status == 0x%x, scsi status == " - "0x%x\n", ccb->csio.ccb_h.status, - ccb->csio.scsi_status); - } - } - xpt_release_ccb(ccb); } @@ -2498,8 +2477,8 @@ daprevent(struct cam_periph *periph, int SSD_FULL_SIZE, 5000); - error = cam_periph_runccb(ccb, /*error_routine*/NULL, CAM_RETRY_SELTO, - SF_RETRY_UA, softc->disk->d_devstat); + error = cam_periph_runccb(ccb, daerror, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_QUIET_IR, softc->disk->d_devstat); if (error == 0) { if (action == PR_ALLOW) From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:23:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8720106566C; Wed, 20 Jun 2012 14:23:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A316F8FC1A; Wed, 20 Jun 2012 14:23:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KENAoJ047406; Wed, 20 Jun 2012 14:23:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KENAni047404; Wed, 20 Jun 2012 14:23:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201423.q5KENAni047404@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237313 - stable/8/sys/cam/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:23:10 -0000 Author: mav Date: Wed Jun 20 14:23:10 2012 New Revision: 237313 URL: http://svn.freebsd.org/changeset/base/237313 Log: MFC r236639: Use default error handler when flushing disk caches. Modified: stable/8/sys/cam/ata/ata_da.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Wed Jun 20 14:22:38 2012 (r237312) +++ stable/8/sys/cam/ata/ata_da.c Wed Jun 20 14:23:10 2012 (r237313) @@ -480,7 +480,7 @@ adaclose(struct disk *dp) ata_48bit_cmd(&ccb->ataio, ATA_FLUSHCACHE48, 0, 0, 0); else ata_28bit_cmd(&ccb->ataio, ATA_FLUSHCACHE, 0, 0, 0); - cam_periph_runccb(ccb, /*error_routine*/NULL, /*cam_flags*/0, + cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, /*sense_flags*/0, softc->disk->d_devstat); if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:27:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E1161065673; Wed, 20 Jun 2012 14:27:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E25F78FC17; Wed, 20 Jun 2012 14:27:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KERtTc047772; Wed, 20 Jun 2012 14:27:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KERtYY047769; Wed, 20 Jun 2012 14:27:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201427.q5KERtYY047769@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237315 - stable/9/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:27:56 -0000 Author: mav Date: Wed Jun 20 14:27:55 2012 New Revision: 237315 URL: http://svn.freebsd.org/changeset/base/237315 Log: MFC r236689 (by ken): Fix a memory leak in the kernel case in scsi_command_string(). Submitted by: Kashyap Desai Modified: stable/9/sys/cam/scsi/scsi_all.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Wed Jun 20 14:24:13 2012 (r237314) +++ stable/9/sys/cam/scsi/scsi_all.c Wed Jun 20 14:27:55 2012 (r237315) @@ -3059,6 +3059,10 @@ scsi_command_string(struct cam_device *d sizeof(cdb_str))); } +#ifdef _KERNEL + xpt_free_ccb((union ccb *)cgd); +#endif + return(0); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:29:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CDF7106566B; Wed, 20 Jun 2012 14:29:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 575068FC16; Wed, 20 Jun 2012 14:29:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KET23i047868; Wed, 20 Jun 2012 14:29:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KET25d047866; Wed, 20 Jun 2012 14:29:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201429.q5KET25d047866@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:29:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237316 - stable/8/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:29:02 -0000 Author: mav Date: Wed Jun 20 14:29:01 2012 New Revision: 237316 URL: http://svn.freebsd.org/changeset/base/237316 Log: MFC r236689 (by ken): Fix a memory leak in the kernel case in scsi_command_string(). Submitted by: Kashyap Desai Modified: stable/8/sys/cam/scsi/scsi_all.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.c Wed Jun 20 14:27:55 2012 (r237315) +++ stable/8/sys/cam/scsi/scsi_all.c Wed Jun 20 14:29:01 2012 (r237316) @@ -3037,6 +3037,10 @@ scsi_command_string(struct cam_device *d sizeof(cdb_str))); } +#ifdef _KERNEL + xpt_free_ccb((union ccb *)cgd); +#endif + return(0); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:36:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 635AA106564A; Wed, 20 Jun 2012 14:36:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B4278FC16; Wed, 20 Jun 2012 14:36:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEaA2X048234; Wed, 20 Jun 2012 14:36:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEa9Cj048224; Wed, 20 Jun 2012 14:36:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201436.q5KEa9Cj048224@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237317 - in stable/9: share/man/man4 sys/cam sys/cam/scsi sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:36:10 -0000 Author: mav Date: Wed Jun 20 14:36:09 2012 New Revision: 237317 URL: http://svn.freebsd.org/changeset/base/237317 Log: MFC r236712: To make CAM debugging easier, compile in some debug flags (CAM_DEBUG_INFO, CAM_DEBUG_CDB, CAM_DEBUG_PERIPH and CAM_DEBUG_PROBE) by default. List of these flags can be modified with CAM_DEBUG_COMPILE kernel option. CAMDEBUG kernel option still enables all possible debug, if not overriden. Additional 50KB of kernel size is a good price for the ability to debug problems without rebuilding the kernel. In case where size is important, debugging can be compiled out by setting CAM_DEBUG_COMPILE option to 0. Modified: stable/9/share/man/man4/scsi.4 stable/9/sys/cam/cam_debug.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt.h stable/9/sys/cam/scsi/scsi_sa.c stable/9/sys/cam/scsi/scsi_target.c stable/9/sys/conf/NOTES stable/9/sys/conf/options Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/share/man/man4/scsi.4 ============================================================================== --- stable/9/share/man/man4/scsi.4 Wed Jun 20 14:29:01 2012 (r237316) +++ stable/9/share/man/man4/scsi.4 Wed Jun 20 14:36:09 2012 (r237317) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd March 4, 2010 +.Dd June 7, 2012 .Dt CAM 4 .Os .Sh NAME @@ -43,6 +43,7 @@ .Cd "options CAM_DEBUG_BUS=-1" .Cd "options CAM_DEBUG_TARGET=-1" .Cd "options CAM_DEBUG_LUN=-1" +.Cd "options CAM_DEBUG_COMPILE=CAM_DEBUG_INFO|CAM_DEBUG_CDB|CAM_DEBUG_PROBE" .Cd "options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB" .Cd "options CAM_MAX_HIGHPOWER=4" .Cd "options SCSI_NO_SENSE_STRINGS" @@ -72,12 +73,11 @@ There are a number of generic kernel con subsystem: .Bl -tag -width SCSI_NO_SENSE_STRINGS .It Dv CAMDEBUG -This option enables the +This option compiles in all the .Nm debugging printf code. This will not actually cause any debugging information to be printed out when included by itself. -Enabling printouts requires additional configuration. See below for details. .It Dv "CAM_MAX_HIGHPOWER=4" This sets the maximum allowable number of concurrent "high power" commands. @@ -248,54 +248,53 @@ see other .Nm device entries. .Sh DIAGNOSTICS -When the kernel is compiled with options CAMDEBUG, an XPT_DEBUG CCB can be -used to enable various amounts of tracing information on any -specific device. -Devices not being traced will not produce trace information. -There are currently four debugging flags that may be turned on: +An XPT_DEBUG CCB can be used to enable various amounts of tracing information +on any specific bus/device from the list of options compiled into the kernel. +There are currently seven debugging flags that may be compiled in and used: .Bl -tag -width CAM_DEBUG_SUBTRACE .It Dv CAM_DEBUG_INFO -This debugging flag enables general informational printfs for the device +This flag enables general informational printfs for the device or devices in question. .It Dv CAM_DEBUG_TRACE -This debugging flag enables function-level command flow tracing. +This flag enables function-level command flow tracing. i.e.\& kernel printfs will happen at the entrance and exit of various functions. .It Dv CAM_DEBUG_SUBTRACE -This debugging flag enables debugging output internal to various functions. +This flag enables debugging output internal to various functions. .It Dv CAM_DEBUG_CDB -This debugging flag will cause the kernel to print out all +This flag will cause the kernel to print out all +.Tn ATA +and .Tn SCSI commands sent to a particular device or devices. +.It Dv CAM_DEBUG_XPT +This flag will enable command scheduler tracing. +.It Dv CAM_DEBUG_PERIPH +This flag will enable peripheral drivers messages. +.It Dv CAM_DEBUG_PROBE +This flag will enable devices probe process tracing. .El .Pp Some of these flags, most notably .Dv CAM_DEBUG_TRACE and -.Dv CAM_DEBUG_SUBTRACE -will produce kernel printfs in EXTREME numbers, -and because of that, they are not especially useful. -There are not many things logged at the -.Dv CAM_DEBUG_INFO -level, so it is not especially useful. -The most useful debugging flag is the -.Dv CAM_DEBUG_CDB -flag. +.Dv CAM_DEBUG_SUBTRACE , +will produce kernel printfs in EXTREME numbers. +.Pp Users can enable debugging from their kernel config file, by using the following kernel config options: -.Bl -tag -width CAM_DEBUG_TARGET +.Bl -tag -width CAM_DEBUG_COMPILE .It Dv CAMDEBUG -This enables +This builds into the kernel all possible .Nm debugging. -Without this option, users will not even be able -to turn on debugging from userland via -.Xr camcontrol 8 . -.It Dv CAM_DEBUG_FLAGS -This allows the user to set the various debugging flags described above -in a kernel config file. +.It Dv CAM_DEBUG_COMPILE +This allows to specify support for which debugging flags described above +should be built into the kernel. Flags may be ORed together if the user wishes to see printfs for multiple debugging levels. +.It Dv CAM_DEBUG_FLAGS +This allows to set the various debugging flags from a kernel config file. .It Dv CAM_DEBUG_BUS Specify a bus to debug. To debug all busses, set this to -1. @@ -307,17 +306,9 @@ Specify a lun to debug. To debug all luns, set this to -1. .El .Pp -When specifying a bus, target or lun to debug, you -.Em MUST -specify all three bus/target/lun options above. -Using wildcards, you -should be able to enable debugging on most anything. -.Pp -Users may also enable debugging printfs on the fly, if the -.Dv CAMDEBUG -option is their config file, by using the +Users may also enable debugging on the fly by using the .Xr camcontrol 8 -utility. +utility, if wanted options built into the kernel. See .Xr camcontrol 8 for details. Modified: stable/9/sys/cam/cam_debug.h ============================================================================== --- stable/9/sys/cam/cam_debug.h Wed Jun 20 14:29:01 2012 (r237316) +++ stable/9/sys/cam/cam_debug.h Wed Jun 20 14:36:09 2012 (r237317) @@ -44,7 +44,35 @@ typedef enum { CAM_DEBUG_PROBE = 0x40 /* print out probe actions */ } cam_debug_flags; -#if defined(CAMDEBUG) && defined(_KERNEL) +#if defined(_KERNEL) + +#ifndef CAM_DEBUG_FLAGS +#define CAM_DEBUG_FLAGS CAM_DEBUG_NONE +#endif + +#ifndef CAM_DEBUG_COMPILE +#ifdef CAMDEBUG +#define CAM_DEBUG_COMPILE (-1) +#else +#define CAM_DEBUG_COMPILE (CAM_DEBUG_INFO | CAM_DEBUG_CDB | \ + CAM_DEBUG_PERIPH | CAM_DEBUG_PROBE | \ + CAM_DEBUG_FLAGS) +#endif +#endif + +#ifndef CAM_DEBUG_BUS +#define CAM_DEBUG_BUS (-1) +#endif +#ifndef CAM_DEBUG_TARGET +#define CAM_DEBUG_TARGET (-1) +#endif +#ifndef CAM_DEBUG_LUN +#define CAM_DEBUG_LUN (-1) +#endif + +#ifndef CAM_DEBUG_DELAY +#define CAM_DEBUG_DELAY 0 +#endif /* Path we want to debug */ extern struct cam_path *cam_dpath; @@ -52,48 +80,48 @@ extern struct cam_path *cam_dpath; extern u_int32_t cam_dflags; /* Printf delay value (to prevent scrolling) */ extern u_int32_t cam_debug_delay; - + /* Debugging macros. */ #define CAM_DEBUGGED(path, flag) \ - ((cam_dflags & (flag)) \ + (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ && (cam_dpath != NULL) \ && (xpt_path_comp(cam_dpath, path) >= 0) \ && (xpt_path_comp(cam_dpath, path) < 2)) #define CAM_DEBUG(path, flag, printfargs) \ - if ((cam_dflags & (flag)) \ + if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ && (cam_dpath != NULL) \ && (xpt_path_comp(cam_dpath, path) >= 0) \ && (xpt_path_comp(cam_dpath, path) < 2)) { \ xpt_print_path(path); \ - printf printfargs; \ + printf printfargs; \ if (cam_debug_delay != 0) \ DELAY(cam_debug_delay); \ } #define CAM_DEBUG_PRINT(flag, printfargs) \ - if (cam_dflags & (flag)) { \ + if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \ printf("cam_debug: "); \ - printf printfargs; \ + printf printfargs; \ if (cam_debug_delay != 0) \ DELAY(cam_debug_delay); \ } #define CAM_DEBUG_PATH_PRINT(flag, path, printfargs) \ - if (cam_dflags & (flag)) { \ + if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \ xpt_print(path, "cam_debug: "); \ - printf printfargs; \ + printf printfargs; \ if (cam_debug_delay != 0) \ DELAY(cam_debug_delay); \ } -#else /* !CAMDEBUG || !_KERNEL */ +#else /* !_KERNEL */ #define CAM_DEBUGGED(A, B) 0 #define CAM_DEBUG(A, B, C) #define CAM_DEBUG_PRINT(A, B) #define CAM_DEBUG_PATH_PRINT(A, B, C) -#endif /* CAMDEBUG && _KERNEL */ +#endif /* _KERNEL */ #endif /* _CAM_CAM_DEBUG_H */ Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Jun 20 14:29:01 2012 (r237316) +++ stable/9/sys/cam/cam_xpt.c Wed Jun 20 14:36:09 2012 (r237317) @@ -188,21 +188,15 @@ static struct cdevsw xpt_cdevsw = { }; /* Storage for debugging datastructures */ -#ifdef CAMDEBUG struct cam_path *cam_dpath; -#ifdef CAM_DEBUG_FLAGS u_int32_t cam_dflags = CAM_DEBUG_FLAGS; -#else -u_int32_t cam_dflags = CAM_DEBUG_NONE; -#endif TUNABLE_INT("kern.cam.dflags", &cam_dflags); SYSCTL_UINT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RW, - &cam_dflags, 0, "Cam Debug Flags"); -u_int32_t cam_debug_delay; + &cam_dflags, 0, "Enabled debug flags"); +u_int32_t cam_debug_delay = CAM_DEBUG_DELAY; TUNABLE_INT("kern.cam.debug_delay", &cam_debug_delay); SYSCTL_UINT(_kern_cam, OID_AUTO, debug_delay, CTLFLAG_RW, - &cam_debug_delay, 0, "Cam Debug Flags"); -#endif + &cam_debug_delay, 0, "Delay in us after each debug message"); /* Our boot-time initialization hook */ static int cam_module_event_handler(module_t, int /*modeventtype_t*/, void *); @@ -2472,9 +2466,7 @@ xpt_action(union ccb *start_ccb) void xpt_action_default(union ccb *start_ccb) { -#ifdef CAMDEBUG char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; -#endif struct cam_path *path; path = start_ccb->ccb_h.path; @@ -2980,16 +2972,17 @@ xpt_action_default(union ccb *start_ccb) break; } case XPT_DEBUG: { -#ifdef CAMDEBUG -#ifdef CAM_DEBUG_DELAY - cam_debug_delay = CAM_DEBUG_DELAY; -#endif + /* Check that all request bits are supported. */ + if (start_ccb->cdbg.flags & ~CAM_DEBUG_COMPILE) { + start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; + break; + } + cam_dflags = start_ccb->cdbg.flags; if (cam_dpath != NULL) { xpt_free_path(cam_dpath); cam_dpath = NULL; } - if (cam_dflags != CAM_DEBUG_NONE) { if (xpt_create_path(&cam_dpath, xpt_periph, start_ccb->ccb_h.path_id, @@ -3007,9 +3000,6 @@ xpt_action_default(union ccb *start_ccb) cam_dpath = NULL; start_ccb->ccb_h.status = CAM_REQ_CMP; } -#else /* !CAMDEBUG */ - start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; -#endif /* CAMDEBUG */ break; } case XPT_FREEZE_QUEUE: @@ -4749,9 +4739,7 @@ xpt_config(void *arg) * Now that interrupts are enabled, go find our devices */ -#ifdef CAMDEBUG - /* Setup debugging flags and path */ -#ifdef CAM_DEBUG_BUS + /* Setup debugging path */ if (cam_dflags != CAM_DEBUG_NONE) { /* * Locking is specifically omitted here. No SIMs have @@ -4768,10 +4756,6 @@ xpt_config(void *arg) } } else cam_dpath = NULL; -#else /* !CAM_DEBUG_BUS */ - cam_dpath = NULL; -#endif /* CAM_DEBUG_BUS */ -#endif /* CAMDEBUG */ periphdriver_init(1); xpt_hold_boot(); Modified: stable/9/sys/cam/cam_xpt.h ============================================================================== --- stable/9/sys/cam/cam_xpt.h Wed Jun 20 14:29:01 2012 (r237316) +++ stable/9/sys/cam/cam_xpt.h Wed Jun 20 14:36:09 2012 (r237317) @@ -63,28 +63,6 @@ struct async_node { SLIST_HEAD(async_list, async_node); SLIST_HEAD(periph_list, cam_periph); -#if defined(CAM_DEBUG_FLAGS) && !defined(CAMDEBUG) -#error "You must have options CAMDEBUG to use options CAM_DEBUG_FLAGS" -#endif - -/* - * In order to enable the CAM_DEBUG_* options, the user must have CAMDEBUG - * enabled. Also, the user must have either none, or all of CAM_DEBUG_BUS, - * CAM_DEBUG_TARGET, and CAM_DEBUG_LUN specified. - */ -#if defined(CAM_DEBUG_BUS) || defined(CAM_DEBUG_TARGET) \ - || defined(CAM_DEBUG_LUN) -#ifdef CAMDEBUG -#if !defined(CAM_DEBUG_BUS) || !defined(CAM_DEBUG_TARGET) \ - || !defined(CAM_DEBUG_LUN) -#error "You must define all or none of CAM_DEBUG_BUS, CAM_DEBUG_TARGET \ - and CAM_DEBUG_LUN" -#endif /* !CAM_DEBUG_BUS || !CAM_DEBUG_TARGET || !CAM_DEBUG_LUN */ -#else /* !CAMDEBUG */ -#error "You must use options CAMDEBUG if you use the CAM_DEBUG_* options" -#endif /* CAMDEBUG */ -#endif /* CAM_DEBUG_BUS || CAM_DEBUG_TARGET || CAM_DEBUG_LUN */ - void xpt_action(union ccb *new_ccb); void xpt_action_default(union ccb *new_ccb); union ccb *xpt_alloc_ccb(void); Modified: stable/9/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_sa.c Wed Jun 20 14:29:01 2012 (r237316) +++ stable/9/sys/cam/scsi/scsi_sa.c Wed Jun 20 14:36:09 2012 (r237317) @@ -1482,10 +1482,6 @@ saregister(struct cam_periph *periph, vo softc->quirks = ((struct sa_quirk_entry *)match)->quirks; softc->last_media_blksize = ((struct sa_quirk_entry *)match)->prefblk; -#ifdef CAMDEBUG - xpt_print(periph->path, "found quirk entry %d\n", - (int) (((struct sa_quirk_entry *) match) - sa_quirk_table)); -#endif } else softc->quirks = SA_QUIRK_NONE; @@ -1798,13 +1794,11 @@ sadone(struct cam_periph *periph, union */ if (error || (softc->flags & SA_FLAG_ERR_PENDING)) cam_release_devq(done_ccb->ccb_h.path, 0, 0, 0, 0); -#ifdef CAMDEBUG if (error || bp->bio_resid) { CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("error %d resid %ld count %ld\n", error, bp->bio_resid, bp->bio_bcount)); } -#endif biofinish(bp, softc->device_stats, 0); break; } Modified: stable/9/sys/cam/scsi/scsi_target.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_target.c Wed Jun 20 14:29:01 2012 (r237316) +++ stable/9/sys/cam/scsi/scsi_target.c Wed Jun 20 14:36:09 2012 (r237317) @@ -305,7 +305,6 @@ targioctl(struct cdev *dev, u_long cmd, break; case TARGIOCDEBUG: { -#ifdef CAMDEBUG struct ccb_debug cdbg; /* If no periph available, disallow debugging changes */ @@ -326,9 +325,6 @@ targioctl(struct cdev *dev, u_long cmd, xpt_action((union ccb *)&cdbg); cam_periph_unlock(softc->periph); status = cdbg.ccb_h.status & CAM_STATUS_MASK; -#else - status = CAM_FUNC_NOTAVAIL; -#endif break; } default: Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Wed Jun 20 14:29:01 2012 (r237316) +++ stable/9/sys/conf/NOTES Wed Jun 20 14:36:09 2012 (r237317) @@ -1291,14 +1291,13 @@ device ctl #CAM Target Layer # CAM OPTIONS: # debugging options: -# -- NOTE -- If you specify one of the bus/target/lun options, you must -# specify them all! -# CAMDEBUG: When defined enables debugging macros -# CAM_DEBUG_BUS: Debug the given bus. Use -1 to debug all busses. -# CAM_DEBUG_TARGET: Debug the given target. Use -1 to debug all targets. -# CAM_DEBUG_LUN: Debug the given lun. Use -1 to debug all luns. -# CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE, -# CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB +# CAMDEBUG Compile in all possible debugging. +# CAM_DEBUG_COMPILE Debug levels to compile in. +# CAM_DEBUG_FLAGS Debug levels to enable on boot. +# CAM_DEBUG_BUS Limit debugging to the given bus. +# CAM_DEBUG_TARGET Limit debugging to the given target. +# CAM_DEBUG_LUN Limit debugging to the given lun. +# CAM_DEBUG_DELAY Delay in us after printing each debug line. # # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions @@ -1309,10 +1308,12 @@ device ctl #CAM Target Layer # can be changed at boot and runtime with the # kern.cam.scsi_delay tunable/sysctl. options CAMDEBUG +options CAM_DEBUG_COMPILE=-1 +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH) options CAM_DEBUG_BUS=-1 options CAM_DEBUG_TARGET=-1 options CAM_DEBUG_LUN=-1 -options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB) +options CAM_DEBUG_DELAY=1 options CAM_MAX_HIGHPOWER=4 options SCSI_NO_SENSE_STRINGS options SCSI_NO_OP_STRINGS Modified: stable/9/sys/conf/options ============================================================================== --- stable/9/sys/conf/options Wed Jun 20 14:29:01 2012 (r237316) +++ stable/9/sys/conf/options Wed Jun 20 14:36:09 2012 (r237317) @@ -302,6 +302,7 @@ MAXSSIZ opt_param.h # Generic SCSI options. CAM_MAX_HIGHPOWER opt_cam.h CAMDEBUG opt_cam.h +CAM_DEBUG_COMPILE opt_cam.h CAM_DEBUG_DELAY opt_cam.h CAM_DEBUG_BUS opt_cam.h CAM_DEBUG_TARGET opt_cam.h From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:39:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C4121065672; Wed, 20 Jun 2012 14:39:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63C0A8FC17; Wed, 20 Jun 2012 14:39:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEdaRB048433; Wed, 20 Jun 2012 14:39:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEdaF9048424; Wed, 20 Jun 2012 14:39:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201439.q5KEdaF9048424@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:39:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237318 - in stable/8: share/man/man4 sys/cam sys/cam/scsi sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:39:36 -0000 Author: mav Date: Wed Jun 20 14:39:35 2012 New Revision: 237318 URL: http://svn.freebsd.org/changeset/base/237318 Log: MFC r236712: To make CAM debugging easier, compile in some debug flags (CAM_DEBUG_INFO, CAM_DEBUG_CDB, CAM_DEBUG_PERIPH and CAM_DEBUG_PROBE) by default. List of these flags can be modified with CAM_DEBUG_COMPILE kernel option. CAMDEBUG kernel option still enables all possible debug, if not overriden. Additional 50KB of kernel size is a good price for the ability to debug problems without rebuilding the kernel. In case where size is important, debugging can be compiled out by setting CAM_DEBUG_COMPILE option to 0. Modified: stable/8/share/man/man4/scsi.4 stable/8/sys/cam/cam_debug.h stable/8/sys/cam/cam_xpt.c stable/8/sys/cam/cam_xpt.h stable/8/sys/cam/scsi/scsi_sa.c stable/8/sys/cam/scsi/scsi_target.c stable/8/sys/conf/NOTES stable/8/sys/conf/options Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/share/man/man4/scsi.4 ============================================================================== --- stable/8/share/man/man4/scsi.4 Wed Jun 20 14:36:09 2012 (r237317) +++ stable/8/share/man/man4/scsi.4 Wed Jun 20 14:39:35 2012 (r237318) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd March 4, 2010 +.Dd June 7, 2012 .Dt CAM 4 .Os .Sh NAME @@ -43,6 +43,7 @@ .Cd "options CAM_DEBUG_BUS=-1" .Cd "options CAM_DEBUG_TARGET=-1" .Cd "options CAM_DEBUG_LUN=-1" +.Cd "options CAM_DEBUG_COMPILE=CAM_DEBUG_INFO|CAM_DEBUG_CDB|CAM_DEBUG_PROBE" .Cd "options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB" .Cd "options CAM_MAX_HIGHPOWER=4" .Cd "options SCSI_NO_SENSE_STRINGS" @@ -72,12 +73,11 @@ There are a number of generic kernel con subsystem: .Bl -tag -width SCSI_NO_SENSE_STRINGS .It Dv CAMDEBUG -This option enables the +This option compiles in all the .Nm debugging printf code. This will not actually cause any debugging information to be printed out when included by itself. -Enabling printouts requires additional configuration. See below for details. .It Dv "CAM_MAX_HIGHPOWER=4" This sets the maximum allowable number of concurrent "high power" commands. @@ -248,54 +248,53 @@ see other .Nm device entries. .Sh DIAGNOSTICS -When the kernel is compiled with options CAMDEBUG, an XPT_DEBUG CCB can be -used to enable various amounts of tracing information on any -specific device. -Devices not being traced will not produce trace information. -There are currently four debugging flags that may be turned on: +An XPT_DEBUG CCB can be used to enable various amounts of tracing information +on any specific bus/device from the list of options compiled into the kernel. +There are currently seven debugging flags that may be compiled in and used: .Bl -tag -width CAM_DEBUG_SUBTRACE .It Dv CAM_DEBUG_INFO -This debugging flag enables general informational printfs for the device +This flag enables general informational printfs for the device or devices in question. .It Dv CAM_DEBUG_TRACE -This debugging flag enables function-level command flow tracing. +This flag enables function-level command flow tracing. i.e.\& kernel printfs will happen at the entrance and exit of various functions. .It Dv CAM_DEBUG_SUBTRACE -This debugging flag enables debugging output internal to various functions. +This flag enables debugging output internal to various functions. .It Dv CAM_DEBUG_CDB -This debugging flag will cause the kernel to print out all +This flag will cause the kernel to print out all +.Tn ATA +and .Tn SCSI commands sent to a particular device or devices. +.It Dv CAM_DEBUG_XPT +This flag will enable command scheduler tracing. +.It Dv CAM_DEBUG_PERIPH +This flag will enable peripheral drivers messages. +.It Dv CAM_DEBUG_PROBE +This flag will enable devices probe process tracing. .El .Pp Some of these flags, most notably .Dv CAM_DEBUG_TRACE and -.Dv CAM_DEBUG_SUBTRACE -will produce kernel printfs in EXTREME numbers, -and because of that, they are not especially useful. -There are not many things logged at the -.Dv CAM_DEBUG_INFO -level, so it is not especially useful. -The most useful debugging flag is the -.Dv CAM_DEBUG_CDB -flag. +.Dv CAM_DEBUG_SUBTRACE , +will produce kernel printfs in EXTREME numbers. +.Pp Users can enable debugging from their kernel config file, by using the following kernel config options: -.Bl -tag -width CAM_DEBUG_TARGET +.Bl -tag -width CAM_DEBUG_COMPILE .It Dv CAMDEBUG -This enables +This builds into the kernel all possible .Nm debugging. -Without this option, users will not even be able -to turn on debugging from userland via -.Xr camcontrol 8 . -.It Dv CAM_DEBUG_FLAGS -This allows the user to set the various debugging flags described above -in a kernel config file. +.It Dv CAM_DEBUG_COMPILE +This allows to specify support for which debugging flags described above +should be built into the kernel. Flags may be ORed together if the user wishes to see printfs for multiple debugging levels. +.It Dv CAM_DEBUG_FLAGS +This allows to set the various debugging flags from a kernel config file. .It Dv CAM_DEBUG_BUS Specify a bus to debug. To debug all busses, set this to -1. @@ -307,17 +306,9 @@ Specify a lun to debug. To debug all luns, set this to -1. .El .Pp -When specifying a bus, target or lun to debug, you -.Em MUST -specify all three bus/target/lun options above. -Using wildcards, you -should be able to enable debugging on most anything. -.Pp -Users may also enable debugging printfs on the fly, if the -.Dv CAMDEBUG -option is their config file, by using the +Users may also enable debugging on the fly by using the .Xr camcontrol 8 -utility. +utility, if wanted options built into the kernel. See .Xr camcontrol 8 for details. Modified: stable/8/sys/cam/cam_debug.h ============================================================================== --- stable/8/sys/cam/cam_debug.h Wed Jun 20 14:36:09 2012 (r237317) +++ stable/8/sys/cam/cam_debug.h Wed Jun 20 14:39:35 2012 (r237318) @@ -44,7 +44,35 @@ typedef enum { CAM_DEBUG_PROBE = 0x40 /* print out probe actions */ } cam_debug_flags; -#if defined(CAMDEBUG) && defined(_KERNEL) +#if defined(_KERNEL) + +#ifndef CAM_DEBUG_FLAGS +#define CAM_DEBUG_FLAGS CAM_DEBUG_NONE +#endif + +#ifndef CAM_DEBUG_COMPILE +#ifdef CAMDEBUG +#define CAM_DEBUG_COMPILE (-1) +#else +#define CAM_DEBUG_COMPILE (CAM_DEBUG_INFO | CAM_DEBUG_CDB | \ + CAM_DEBUG_PERIPH | CAM_DEBUG_PROBE | \ + CAM_DEBUG_FLAGS) +#endif +#endif + +#ifndef CAM_DEBUG_BUS +#define CAM_DEBUG_BUS (-1) +#endif +#ifndef CAM_DEBUG_TARGET +#define CAM_DEBUG_TARGET (-1) +#endif +#ifndef CAM_DEBUG_LUN +#define CAM_DEBUG_LUN (-1) +#endif + +#ifndef CAM_DEBUG_DELAY +#define CAM_DEBUG_DELAY 0 +#endif /* Path we want to debug */ extern struct cam_path *cam_dpath; @@ -52,48 +80,48 @@ extern struct cam_path *cam_dpath; extern u_int32_t cam_dflags; /* Printf delay value (to prevent scrolling) */ extern u_int32_t cam_debug_delay; - + /* Debugging macros. */ #define CAM_DEBUGGED(path, flag) \ - ((cam_dflags & (flag)) \ + (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ && (cam_dpath != NULL) \ && (xpt_path_comp(cam_dpath, path) >= 0) \ && (xpt_path_comp(cam_dpath, path) < 2)) #define CAM_DEBUG(path, flag, printfargs) \ - if ((cam_dflags & (flag)) \ + if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ && (cam_dpath != NULL) \ && (xpt_path_comp(cam_dpath, path) >= 0) \ && (xpt_path_comp(cam_dpath, path) < 2)) { \ xpt_print_path(path); \ - printf printfargs; \ + printf printfargs; \ if (cam_debug_delay != 0) \ DELAY(cam_debug_delay); \ } #define CAM_DEBUG_PRINT(flag, printfargs) \ - if (cam_dflags & (flag)) { \ + if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \ printf("cam_debug: "); \ - printf printfargs; \ + printf printfargs; \ if (cam_debug_delay != 0) \ DELAY(cam_debug_delay); \ } #define CAM_DEBUG_PATH_PRINT(flag, path, printfargs) \ - if (cam_dflags & (flag)) { \ + if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \ xpt_print(path, "cam_debug: "); \ - printf printfargs; \ + printf printfargs; \ if (cam_debug_delay != 0) \ DELAY(cam_debug_delay); \ } -#else /* !CAMDEBUG || !_KERNEL */ +#else /* !_KERNEL */ #define CAM_DEBUGGED(A, B) 0 #define CAM_DEBUG(A, B, C) #define CAM_DEBUG_PRINT(A, B) #define CAM_DEBUG_PATH_PRINT(A, B, C) -#endif /* CAMDEBUG && _KERNEL */ +#endif /* _KERNEL */ #endif /* _CAM_CAM_DEBUG_H */ Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Wed Jun 20 14:36:09 2012 (r237317) +++ stable/8/sys/cam/cam_xpt.c Wed Jun 20 14:39:35 2012 (r237318) @@ -189,21 +189,15 @@ static struct cdevsw xpt_cdevsw = { }; /* Storage for debugging datastructures */ -#ifdef CAMDEBUG struct cam_path *cam_dpath; -#ifdef CAM_DEBUG_FLAGS u_int32_t cam_dflags = CAM_DEBUG_FLAGS; -#else -u_int32_t cam_dflags = CAM_DEBUG_NONE; -#endif TUNABLE_INT("kern.cam.dflags", &cam_dflags); SYSCTL_INT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RW, - &cam_dflags, 0, "Cam Debug Flags"); -u_int32_t cam_debug_delay; + &cam_dflags, 0, "Enabled debug flags"); +u_int32_t cam_debug_delay = CAM_DEBUG_DELAY; TUNABLE_INT("kern.cam.debug_delay", &cam_debug_delay); SYSCTL_INT(_kern_cam, OID_AUTO, debug_delay, CTLFLAG_RW, - &cam_debug_delay, 0, "Cam Debug Flags"); -#endif + &cam_debug_delay, 0, "Delay in us after each debug message"); /* Our boot-time initialization hook */ static int cam_module_event_handler(module_t, int /*modeventtype_t*/, void *); @@ -2428,9 +2422,7 @@ xpt_action(union ccb *start_ccb) void xpt_action_default(union ccb *start_ccb) { -#ifdef CAMDEBUG char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; -#endif struct cam_path *path; path = start_ccb->ccb_h.path; @@ -2935,16 +2927,17 @@ xpt_action_default(union ccb *start_ccb) break; } case XPT_DEBUG: { -#ifdef CAMDEBUG -#ifdef CAM_DEBUG_DELAY - cam_debug_delay = CAM_DEBUG_DELAY; -#endif + /* Check that all request bits are supported. */ + if (start_ccb->cdbg.flags & ~CAM_DEBUG_COMPILE) { + start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; + break; + } + cam_dflags = start_ccb->cdbg.flags; if (cam_dpath != NULL) { xpt_free_path(cam_dpath); cam_dpath = NULL; } - if (cam_dflags != CAM_DEBUG_NONE) { if (xpt_create_path(&cam_dpath, xpt_periph, start_ccb->ccb_h.path_id, @@ -2962,9 +2955,6 @@ xpt_action_default(union ccb *start_ccb) cam_dpath = NULL; start_ccb->ccb_h.status = CAM_REQ_CMP; } -#else /* !CAMDEBUG */ - start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; -#endif /* CAMDEBUG */ break; } case XPT_FREEZE_QUEUE: @@ -4707,9 +4697,7 @@ xpt_config(void *arg) * Now that interrupts are enabled, go find our devices */ -#ifdef CAMDEBUG - /* Setup debugging flags and path */ -#ifdef CAM_DEBUG_BUS + /* Setup debugging path */ if (cam_dflags != CAM_DEBUG_NONE) { /* * Locking is specifically omitted here. No SIMs have @@ -4726,10 +4714,6 @@ xpt_config(void *arg) } } else cam_dpath = NULL; -#else /* !CAM_DEBUG_BUS */ - cam_dpath = NULL; -#endif /* CAM_DEBUG_BUS */ -#endif /* CAMDEBUG */ periphdriver_init(1); xpt_hold_boot(); Modified: stable/8/sys/cam/cam_xpt.h ============================================================================== --- stable/8/sys/cam/cam_xpt.h Wed Jun 20 14:36:09 2012 (r237317) +++ stable/8/sys/cam/cam_xpt.h Wed Jun 20 14:39:35 2012 (r237318) @@ -63,28 +63,6 @@ struct async_node { SLIST_HEAD(async_list, async_node); SLIST_HEAD(periph_list, cam_periph); -#if defined(CAM_DEBUG_FLAGS) && !defined(CAMDEBUG) -#error "You must have options CAMDEBUG to use options CAM_DEBUG_FLAGS" -#endif - -/* - * In order to enable the CAM_DEBUG_* options, the user must have CAMDEBUG - * enabled. Also, the user must have either none, or all of CAM_DEBUG_BUS, - * CAM_DEBUG_TARGET, and CAM_DEBUG_LUN specified. - */ -#if defined(CAM_DEBUG_BUS) || defined(CAM_DEBUG_TARGET) \ - || defined(CAM_DEBUG_LUN) -#ifdef CAMDEBUG -#if !defined(CAM_DEBUG_BUS) || !defined(CAM_DEBUG_TARGET) \ - || !defined(CAM_DEBUG_LUN) -#error "You must define all or none of CAM_DEBUG_BUS, CAM_DEBUG_TARGET \ - and CAM_DEBUG_LUN" -#endif /* !CAM_DEBUG_BUS || !CAM_DEBUG_TARGET || !CAM_DEBUG_LUN */ -#else /* !CAMDEBUG */ -#error "You must use options CAMDEBUG if you use the CAM_DEBUG_* options" -#endif /* CAMDEBUG */ -#endif /* CAM_DEBUG_BUS || CAM_DEBUG_TARGET || CAM_DEBUG_LUN */ - void xpt_action(union ccb *new_ccb); void xpt_action_default(union ccb *new_ccb); union ccb *xpt_alloc_ccb(void); Modified: stable/8/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_sa.c Wed Jun 20 14:36:09 2012 (r237317) +++ stable/8/sys/cam/scsi/scsi_sa.c Wed Jun 20 14:39:35 2012 (r237318) @@ -1477,10 +1477,6 @@ saregister(struct cam_periph *periph, vo softc->quirks = ((struct sa_quirk_entry *)match)->quirks; softc->last_media_blksize = ((struct sa_quirk_entry *)match)->prefblk; -#ifdef CAMDEBUG - xpt_print(periph->path, "found quirk entry %d\n", - (int) (((struct sa_quirk_entry *) match) - sa_quirk_table)); -#endif } else softc->quirks = SA_QUIRK_NONE; @@ -1793,13 +1789,11 @@ sadone(struct cam_periph *periph, union */ if (error || (softc->flags & SA_FLAG_ERR_PENDING)) cam_release_devq(done_ccb->ccb_h.path, 0, 0, 0, 0); -#ifdef CAMDEBUG if (error || bp->bio_resid) { CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("error %d resid %ld count %ld\n", error, bp->bio_resid, bp->bio_bcount)); } -#endif biofinish(bp, softc->device_stats, 0); break; } Modified: stable/8/sys/cam/scsi/scsi_target.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_target.c Wed Jun 20 14:36:09 2012 (r237317) +++ stable/8/sys/cam/scsi/scsi_target.c Wed Jun 20 14:39:35 2012 (r237318) @@ -302,7 +302,6 @@ targioctl(struct cdev *dev, u_long cmd, break; case TARGIOCDEBUG: { -#ifdef CAMDEBUG struct ccb_debug cdbg; /* If no periph available, disallow debugging changes */ @@ -323,9 +322,6 @@ targioctl(struct cdev *dev, u_long cmd, xpt_action((union ccb *)&cdbg); cam_periph_unlock(softc->periph); status = cdbg.ccb_h.status & CAM_STATUS_MASK; -#else - status = CAM_FUNC_NOTAVAIL; -#endif break; } default: Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Wed Jun 20 14:36:09 2012 (r237317) +++ stable/8/sys/conf/NOTES Wed Jun 20 14:39:35 2012 (r237318) @@ -1264,14 +1264,13 @@ device sg #Linux SCSI passthrough # CAM OPTIONS: # debugging options: -# -- NOTE -- If you specify one of the bus/target/lun options, you must -# specify them all! -# CAMDEBUG: When defined enables debugging macros -# CAM_DEBUG_BUS: Debug the given bus. Use -1 to debug all busses. -# CAM_DEBUG_TARGET: Debug the given target. Use -1 to debug all targets. -# CAM_DEBUG_LUN: Debug the given lun. Use -1 to debug all luns. -# CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE, -# CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB +# CAMDEBUG Compile in all possible debugging. +# CAM_DEBUG_COMPILE Debug levels to compile in. +# CAM_DEBUG_FLAGS Debug levels to enable on boot. +# CAM_DEBUG_BUS Limit debugging to the given bus. +# CAM_DEBUG_TARGET Limit debugging to the given target. +# CAM_DEBUG_LUN Limit debugging to the given lun. +# CAM_DEBUG_DELAY Delay in us after printing each debug line. # # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions @@ -1282,10 +1281,12 @@ device sg #Linux SCSI passthrough # can be changed at boot and runtime with the # kern.cam.scsi_delay tunable/sysctl. options CAMDEBUG +options CAM_DEBUG_COMPILE=-1 +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH) options CAM_DEBUG_BUS=-1 options CAM_DEBUG_TARGET=-1 options CAM_DEBUG_LUN=-1 -options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB) +options CAM_DEBUG_DELAY=1 options CAM_MAX_HIGHPOWER=4 options SCSI_NO_SENSE_STRINGS options SCSI_NO_OP_STRINGS Modified: stable/8/sys/conf/options ============================================================================== --- stable/8/sys/conf/options Wed Jun 20 14:36:09 2012 (r237317) +++ stable/8/sys/conf/options Wed Jun 20 14:39:35 2012 (r237318) @@ -298,6 +298,7 @@ MAXSSIZ opt_param.h # Generic SCSI options. CAM_MAX_HIGHPOWER opt_cam.h CAMDEBUG opt_cam.h +CAM_DEBUG_COMPILE opt_cam.h CAM_DEBUG_DELAY opt_cam.h CAM_DEBUG_BUS opt_cam.h CAM_DEBUG_TARGET opt_cam.h From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:43:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2262F1065709; Wed, 20 Jun 2012 14:43:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D4148FC14; Wed, 20 Jun 2012 14:43:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEheAA048647; Wed, 20 Jun 2012 14:43:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEheMR048644; Wed, 20 Jun 2012 14:43:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201443.q5KEheMR048644@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237319 - stable/9/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:43:41 -0000 Author: mav Date: Wed Jun 20 14:43:40 2012 New Revision: 237319 URL: http://svn.freebsd.org/changeset/base/237319 Log: MFC r236713: Add CAM_DEBUG_INFO debug messages for periph created/invalidated/destroyed and for asyncs sent. Modified: stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Wed Jun 20 14:39:35 2012 (r237318) +++ stable/9/sys/cam/cam_periph.c Wed Jun 20 14:43:40 2012 (r237319) @@ -240,6 +240,7 @@ cam_periph_alloc(periph_ctor_t *periph_c goto failure; init_level++; + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph created\n")); status = periph_ctor(periph, arg); @@ -252,6 +253,7 @@ failure: /* Initialized successfully */ break; case 3: + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); xpt_remove_periph(periph); /* FALLTHROUGH */ case 2: @@ -572,6 +574,7 @@ void cam_periph_invalidate(struct cam_periph *periph) { + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); /* * We only call this routine the first time a peripheral is * invalidated. @@ -610,6 +613,7 @@ camperiphfree(struct cam_periph *periph) if (periph->periph_dtor != NULL) periph->periph_dtor(periph); xpt_remove_periph(periph); + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { union ccb ccb; Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Jun 20 14:39:35 2012 (r237318) +++ stable/9/sys/cam/cam_xpt.c Wed Jun 20 14:43:40 2012 (r237319) @@ -2973,7 +2973,7 @@ xpt_action_default(union ccb *start_ccb) } case XPT_DEBUG: { /* Check that all request bits are supported. */ - if (start_ccb->cdbg.flags & ~CAM_DEBUG_COMPILE) { + if (start_ccb->cdbg.flags & ~(CAM_DEBUG_COMPILE)) { start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; break; } @@ -4033,6 +4033,28 @@ xptpathid(const char *sim_name, int sim_ return (pathid); } +static const char * +xpt_async_string(u_int32_t async_code) +{ + + switch (async_code) { + case AC_BUS_RESET: return ("AC_BUS_RESET"); + case AC_UNSOL_RESEL: return ("AC_UNSOL_RESEL"); + case AC_SCSI_AEN: return ("AC_SCSI_AEN"); + case AC_SENT_BDR: return ("AC_SENT_BDR"); + case AC_PATH_REGISTERED: return ("AC_PATH_REGISTERED"); + case AC_PATH_DEREGISTERED: return ("AC_PATH_DEREGISTERED"); + case AC_FOUND_DEVICE: return ("AC_FOUND_DEVICE"); + case AC_LOST_DEVICE: return ("AC_LOST_DEVICE"); + case AC_TRANSFER_NEG: return ("AC_TRANSFER_NEG"); + case AC_INQ_CHANGED: return ("AC_INQ_CHANGED"); + case AC_GETDEV_CHANGED: return ("AC_GETDEV_CHANGED"); + case AC_CONTRACT: return ("AC_CONTRACT"); + case AC_ADVINFO_CHANGED: return ("AC_ADVINFO_CHANGED"); + } + return ("AC_UNKNOWN"); +} + void xpt_async(u_int32_t async_code, struct cam_path *path, void *async_arg) { @@ -4041,8 +4063,8 @@ xpt_async(u_int32_t async_code, struct c struct cam_ed *device, *next_device; mtx_assert(path->bus->sim->mtx, MA_OWNED); - - CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_async\n")); + CAM_DEBUG(path, CAM_DEBUG_TRACE | CAM_DEBUG_INFO, + ("xpt_async(%s)\n", xpt_async_string(async_code))); /* * Most async events come from a CAM interrupt context. In From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 14:47:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A52CC1065670; Wed, 20 Jun 2012 14:47:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90B2E8FC17; Wed, 20 Jun 2012 14:47:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KEldow048880; Wed, 20 Jun 2012 14:47:39 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KEldRZ048877; Wed, 20 Jun 2012 14:47:39 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201447.q5KEldRZ048877@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 14:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237320 - stable/8/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 14:47:39 -0000 Author: mav Date: Wed Jun 20 14:47:39 2012 New Revision: 237320 URL: http://svn.freebsd.org/changeset/base/237320 Log: MFC r236713: Add CAM_DEBUG_INFO debug messages for periph created/invalidated/destroyed and for asyncs sent. Modified: stable/8/sys/cam/cam_periph.c stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/cam_periph.c ============================================================================== --- stable/8/sys/cam/cam_periph.c Wed Jun 20 14:43:40 2012 (r237319) +++ stable/8/sys/cam/cam_periph.c Wed Jun 20 14:47:39 2012 (r237320) @@ -239,6 +239,7 @@ cam_periph_alloc(periph_ctor_t *periph_c goto failure; init_level++; + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph created\n")); status = periph_ctor(periph, arg); @@ -251,6 +252,7 @@ failure: /* Initialized successfully */ break; case 3: + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); xpt_remove_periph(periph); /* FALLTHROUGH */ case 2: @@ -526,6 +528,7 @@ void cam_periph_invalidate(struct cam_periph *periph) { + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); /* * We only call this routine the first time a peripheral is * invalidated. @@ -564,6 +567,7 @@ camperiphfree(struct cam_periph *periph) if (periph->periph_dtor != NULL) periph->periph_dtor(periph); xpt_remove_periph(periph); + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { union ccb ccb; Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Wed Jun 20 14:43:40 2012 (r237319) +++ stable/8/sys/cam/cam_xpt.c Wed Jun 20 14:47:39 2012 (r237320) @@ -2928,7 +2928,7 @@ xpt_action_default(union ccb *start_ccb) } case XPT_DEBUG: { /* Check that all request bits are supported. */ - if (start_ccb->cdbg.flags & ~CAM_DEBUG_COMPILE) { + if (start_ccb->cdbg.flags & ~(CAM_DEBUG_COMPILE)) { start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; break; } @@ -3992,6 +3992,27 @@ xptpathid(const char *sim_name, int sim_ return (pathid); } +static const char * +xpt_async_string(u_int32_t async_code) +{ + + switch (async_code) { + case AC_BUS_RESET: return ("AC_BUS_RESET"); + case AC_UNSOL_RESEL: return ("AC_UNSOL_RESEL"); + case AC_SCSI_AEN: return ("AC_SCSI_AEN"); + case AC_SENT_BDR: return ("AC_SENT_BDR"); + case AC_PATH_REGISTERED: return ("AC_PATH_REGISTERED"); + case AC_PATH_DEREGISTERED: return ("AC_PATH_DEREGISTERED"); + case AC_FOUND_DEVICE: return ("AC_FOUND_DEVICE"); + case AC_LOST_DEVICE: return ("AC_LOST_DEVICE"); + case AC_TRANSFER_NEG: return ("AC_TRANSFER_NEG"); + case AC_INQ_CHANGED: return ("AC_INQ_CHANGED"); + case AC_GETDEV_CHANGED: return ("AC_GETDEV_CHANGED"); + case AC_CONTRACT: return ("AC_CONTRACT"); + } + return ("AC_UNKNOWN"); +} + void xpt_async(u_int32_t async_code, struct cam_path *path, void *async_arg) { @@ -4000,8 +4021,8 @@ xpt_async(u_int32_t async_code, struct c struct cam_ed *device, *next_device; mtx_assert(path->bus->sim->mtx, MA_OWNED); - - CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_async\n")); + CAM_DEBUG(path, CAM_DEBUG_TRACE | CAM_DEBUG_INFO, + ("xpt_async(%s)\n", xpt_async_string(async_code))); /* * Most async events come from a CAM interrupt context. In From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 15:45:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3845C106566B; Wed, 20 Jun 2012 15:45:51 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 196DF8FC0A; Wed, 20 Jun 2012 15:45:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KFjoYB051503; Wed, 20 Jun 2012 15:45:50 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KFjoxb051501; Wed, 20 Jun 2012 15:45:50 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201206201545.q5KFjoxb051501@svn.freebsd.org> From: Fabien Thomas Date: Wed, 20 Jun 2012 15:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237322 - head/sys/dev/xen/balloon X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 15:45:51 -0000 Author: fabient Date: Wed Jun 20 15:45:50 2012 New Revision: 237322 URL: http://svn.freebsd.org/changeset/base/237322 Log: Allow booting XENHVM kernel without Xen hypervisor. MFC after: 3 days Modified: head/sys/dev/xen/balloon/balloon.c Modified: head/sys/dev/xen/balloon/balloon.c ============================================================================== --- head/sys/dev/xen/balloon/balloon.c Wed Jun 20 15:12:31 2012 (r237321) +++ head/sys/dev/xen/balloon/balloon.c Wed Jun 20 15:45:50 2012 (r237322) @@ -436,6 +436,9 @@ balloon_init_watcher(void *arg) { int err; + if (!is_running_on_xen()) + return; + err = xs_register_watch(&target_watch); if (err) printf("Failed to set balloon watcher\n"); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 16:27:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A8D61065672; Wed, 20 Jun 2012 16:27:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id E2ECC8FC15; Wed, 20 Jun 2012 16:27:27 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5KGRNTt028595 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Jun 2012 02:27:25 +1000 Date: Thu, 21 Jun 2012 02:27:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eitan Adler In-Reply-To: <201206200638.q5K6cg7u024024@svn.freebsd.org> Message-ID: <20120621015220.J2636@besplex.bde.org> References: <201206200638.q5K6cg7u024024@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237286 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 16:27:28 -0000 On Wed, 20 Jun 2012, Eitan Adler wrote: > Log: > Don't close an uninitialized descriptor. [1] > Add a sanity check for the validity of the passed fd. Library functions shouldn't use assert() or abort(). The fd is not passed, but is a static variable under syslog()'s control. In libc, only the following use assert.h: - stdio/xprintf*.c. Very nonstd. - rpc/*.c (perhaps not everything) - db/*.c (but partly under DEBUG. Not the standard use where assert() is controlled by NDEBUG) - nameser/ns_print.c - ia64/gen/unwind.c (but under SANITY. The standard NDEBUG is too hard to use here too) - gen/getgrent.c. - regex/grot/main.c (test program. Not part of libc) - regex/regex/utils.h (but ifdefed, and I think turned off in production. Spencer knows how to use NDEBUG) - regex/regcomp.c (ifdefed) - include/isc/list.h - net/*.c (just 2 files) - posix1e/acl*.c (perhaps not everything) - inet/inet_net_pton.c - iconv/*.c (perhaps not everything). The list was only short enough to be described by "only" in not very old versions of FreeBSD. posix1e and iconv doubled the number of files. > Modified: head/lib/libc/gen/syslog.c > ============================================================================== > --- head/lib/libc/gen/syslog.c Wed Jun 20 04:11:34 2012 (r237285) > +++ head/lib/libc/gen/syslog.c Wed Jun 20 06:38:41 2012 (r237286) > @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > #include > #include > #include > @@ -413,8 +414,11 @@ void > closelog(void) > { > THREAD_LOCK(); > - (void)_close(LogFile); > - LogFile = -1; > + assert(LogFile >= -1); Since this assert() can't fail (unless the CPU has a parity error or or the memory behind Logfile has a parity error or another memory error or was clobbered by a buffer overrun), this assert() doesn't break the library but just wastes space. > + if (LogFile != -1) { > + (void)_close(LogFile); > + LogFile = -1; > + } > LogTag = NULL; > status = NOCONN; > THREAD_UNLOCK(); Bruce From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 16:37:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3604A106566B for ; Wed, 20 Jun 2012 16:37:36 +0000 (UTC) (envelope-from bounces+73574-8822-svn-src-all=freebsd.org@sendgrid.me) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) by mx1.freebsd.org (Postfix) with SMTP id B6ADB8FC22 for ; Wed, 20 Jun 2012 16:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h= message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; s=smtpapi; bh=TftGBz3F3lVqpXVib75fwLxiFi4=; b=fO0aiA6Vas2DTqjyy5MypgybGrzr Cx15fN/qVffYztON2VZSiq4yaV+rAG8YqvZa7cdNuYcXS+h0xT1W5y8NHBFymIKC Y/3W3s+QLEUO028rYaApiU6Ni+QL2rl4ArjyHUMCMGUrc9prG1ISyIylAzjh6Vl8 kThAubkP75ZdsSg= Received: by 10.8.40.34 with SMTP id mf27.22848.4FE1FC4E5 Wed, 20 Jun 2012 11:37:34 -0500 (CDT) Received: from mail.tarsnap.com (unknown [10.9.180.5]) by mi13 (SG) with ESMTP id 4fe1fc4e.64c9.13f9e2c for ; Wed, 20 Jun 2012 11:37:34 -0500 (CST) Received: (qmail 84858 invoked from network); 20 Jun 2012 16:37:10 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 20 Jun 2012 16:37:10 -0000 Received: (qmail 90108 invoked from network); 20 Jun 2012 16:36:52 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 20 Jun 2012 16:36:52 -0000 Message-ID: <4FE1FC23.9000904@freebsd.org> Date: Wed, 20 Jun 2012 09:36:51 -0700 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120509 Thunderbird/12.0.1 MIME-Version: 1.0 To: Bruce Evans References: <201206200638.q5K6cg7u024024@svn.freebsd.org> <20120621015220.J2636@besplex.bde.org> In-Reply-To: <20120621015220.J2636@besplex.bde.org> X-Enigmail-Version: 1.5pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Sendgrid-EID: A6W2xSVPHetogaU8rnzccWwgBYtN+QvIzXyjfe/10PGJ/U/8j1yE/RbsrcYMg7DYavaqb8pvAziIOu0BhK/yk45KoCEXoVPLrDSumY2btvZzFuDCSyTa5Om0hrb2QYfgBiWnmT+f2N3zBhmBjkhA/kR3jNiYwelf5xcSNs/OMj0= Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler Subject: Re: svn commit: r237286 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 16:37:36 -0000 On 06/20/12 09:27, Bruce Evans wrote: > On Wed, 20 Jun 2012, Eitan Adler wrote: >> Log: >> Don't close an uninitialized descriptor. [1] >> Add a sanity check for the validity of the passed fd. > > Library functions shouldn't use assert() or abort(). Why not? > The fd is not passed, but is a static variable under syslog()'s control. I understood "passed fd" to mean "fd we're passing to _close". >> closelog(void) >> { >> THREAD_LOCK(); >> - (void)_close(LogFile); >> - LogFile = -1; >> + assert(LogFile >= -1); > > Since this assert() can't fail (unless the CPU has a parity error or > or the memory behind Logfile has a parity error or another memory error > or was clobbered by a buffer overrun), this assert() doesn't break the > library but just wastes space. I asked eadler to include that on the basis that it made the code easier to understand. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 16:51:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1973E1065673; Wed, 20 Jun 2012 16:51:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 024168FC1B; Wed, 20 Jun 2012 16:51:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KGpEos055133; Wed, 20 Jun 2012 16:51:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KGpEor055126; Wed, 20 Jun 2012 16:51:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201651.q5KGpEor055126@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 16:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237327 - in stable/9/sys/cam: . ata scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 16:51:15 -0000 Author: mav Date: Wed Jun 20 16:51:14 2012 New Revision: 237327 URL: http://svn.freebsd.org/changeset/base/237327 Log: MFC r236814: One more major cam_periph_error() rewrite to improve error handling and reporting. It includes: - removing of error messages controlled by bootverbose, replacing them with more universal and informative debugging on CAM_DEBUG_INFO level, that is now built into the kernel by default; - more close following to the arguments submitted by caller, such as SF_PRINT_ALWAYS, SF_QUIET_IR and SF_NO_PRINT; consumer knows better which errors are usual/expected at this point and which are really informative; - adding two new flags SF_NO_RECOVERY and SF_NO_RETRY to allow caller specify how much assistance it needs at this point; previously consumers controlled that by not calling cam_periph_error() at all, but that made behavior inconsistent and debugging complicated; - tuning debug messages and taken actions order to make debugging output more readable and cause-effect relationships visible; - making camperiphdone() (common device recovery completion handler) to also use cam_periph_error() in most cases, instead of own dumb code; - removing manual sense fetching code from cam_periph_error(); I was told by number of people that it is SIM obligation to fetch sense data, so this code is useless and only significantly complicates recovery logic; - making ada, da and pass driver to use cam_periph_error() with new limited recovery options to handle error recovery and debugging in common way; as one of results, CAM_REQUEUE_REQ and other retrying statuses are now working fine with pass driver, that caused many problems before. - reverting r186891 by raj@ to avoid burning few seconds in tight DELAY() loops on device probe, while device simply loads media; I think that problem may already be fixed in other way, and even if it is not, solution must be different. Sponsored by: iXsystems, Inc. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/cam/cam.h stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_periph.h stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_pass.c stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Wed Jun 20 16:24:02 2012 (r237326) +++ stable/9/sys/cam/ata/ata_da.c Wed Jun 20 16:51:14 2012 (r237327) @@ -584,6 +584,7 @@ adadump(void *arg, void *virtual, vm_off struct disk *dp; uint64_t lba; uint16_t count; + int error = 0; dp = arg; periph = dp->d_drv1; @@ -622,13 +623,16 @@ adadump(void *arg, void *virtual, vm_off } xpt_polled_action(&ccb); - if ((ccb.ataio.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cam_periph_error(&ccb, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); + if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, + /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + if (error != 0) printf("Aborting dump due to I/O error.\n"); - cam_periph_unlock(periph); - return(EIO); - } + cam_periph_unlock(periph); - return(0); + return (error); } if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) { @@ -636,7 +640,7 @@ adadump(void *arg, void *virtual, vm_off ccb.ccb_h.ccb_state = ADA_CCB_DUMP; cam_fill_ataio(&ccb.ataio, - 1, + 0, adadone, CAM_DIR_NONE, 0, @@ -650,18 +654,16 @@ adadump(void *arg, void *virtual, vm_off ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); xpt_polled_action(&ccb); - if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) - xpt_print(periph->path, "Synchronize cache failed\n"); - + error = cam_periph_error(&ccb, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb.ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); + cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, + /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + if (error != 0) + xpt_print(periph->path, "Synchronize cache failed\n"); } cam_periph_unlock(periph); - return (0); + return (error); } static void @@ -1716,6 +1718,7 @@ adaflush(void) { struct cam_periph *periph; struct ada_softc *softc; + int error; TAILQ_FOREACH(periph, &adadriver.units, unit_links) { union ccb ccb; @@ -1739,7 +1742,7 @@ adaflush(void) ccb.ccb_h.ccb_state = ADA_CCB_DUMP; cam_fill_ataio(&ccb.ataio, - 1, + 0, adadone, CAM_DIR_NONE, 0, @@ -1753,15 +1756,13 @@ adaflush(void) ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); xpt_polled_action(&ccb); - if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) - xpt_print(periph->path, "Synchronize cache failed\n"); - + error = cam_periph_error(&ccb, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb.ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); + cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, + /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + if (error != 0) + xpt_print(periph->path, "Synchronize cache failed\n"); cam_periph_unlock(periph); } } @@ -1771,6 +1772,7 @@ adaspindown(uint8_t cmd, int flags) { struct cam_periph *periph; struct ada_softc *softc; + int error; TAILQ_FOREACH(periph, &adadriver.units, unit_links) { union ccb ccb; @@ -1795,7 +1797,7 @@ adaspindown(uint8_t cmd, int flags) ccb.ccb_h.ccb_state = ADA_CCB_DUMP; cam_fill_ataio(&ccb.ataio, - 1, + 0, adadone, CAM_DIR_NONE | flags, 0, @@ -1806,15 +1808,13 @@ adaspindown(uint8_t cmd, int flags) ata_28bit_cmd(&ccb.ataio, cmd, 0, 0, 0); xpt_polled_action(&ccb); - if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) - xpt_print(periph->path, "Spin-down disk failed\n"); - + error = cam_periph_error(&ccb, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb.ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); + cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, + /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + if (error != 0) + xpt_print(periph->path, "Spin-down disk failed\n"); cam_periph_unlock(periph); } } Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Wed Jun 20 16:24:02 2012 (r237326) +++ stable/9/sys/cam/ata/ata_xpt.c Wed Jun 20 16:51:14 2012 (r237327) @@ -705,12 +705,9 @@ probedone(struct cam_periph *periph, uni inq_buf = &path->device->inq_data; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (softc->restart) { - if (bootverbose) { - cam_error_print(done_ccb, - CAM_ESF_ALL, CAM_EPF_ALL); - } - } else if (cam_periph_error(done_ccb, 0, 0, NULL) == ERESTART) + if (cam_periph_error(done_ccb, + 0, softc->restart ? (SF_NO_RECOVERY | SF_NO_RETRY) : 0, + NULL) == ERESTART) return; if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ Modified: stable/9/sys/cam/cam.h ============================================================================== --- stable/9/sys/cam/cam.h Wed Jun 20 16:24:02 2012 (r237326) +++ stable/9/sys/cam/cam.h Wed Jun 20 16:51:14 2012 (r237327) @@ -108,6 +108,15 @@ typedef enum { CAM_RETRY_SELTO = 0x02 /* Retry Selection Timeouts */ } cam_flags; +enum { + SF_RETRY_UA = 0x01, /* Retry UNIT ATTENTION conditions. */ + SF_NO_PRINT = 0x02, /* Never print error status. */ + SF_QUIET_IR = 0x04, /* Be quiet about Illegal Request reponses */ + SF_PRINT_ALWAYS = 0x08, /* Always print error status. */ + SF_NO_RECOVERY = 0x10, /* Don't do active error recovery. */ + SF_NO_RETRY = 0x20 /* Don't do any retries. */ +}; + /* CAM Status field values */ typedef enum { CAM_REQ_INPROG, /* CCB request is in progress */ Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Wed Jun 20 16:24:02 2012 (r237326) +++ stable/9/sys/cam/cam_periph.c Wed Jun 20 16:51:14 2012 (r237327) @@ -69,18 +69,22 @@ static void camperiphdone(struct cam_pe union ccb *done_ccb); static void camperiphfree(struct cam_periph *periph); static int camperiphscsistatuserror(union ccb *ccb, + union ccb **orig_ccb, cam_flags camflags, u_int32_t sense_flags, int *openings, u_int32_t *relsim_flags, u_int32_t *timeout, + int *print, const char **action_string); static int camperiphscsisenseerror(union ccb *ccb, + union ccb **orig_ccb, cam_flags camflags, u_int32_t sense_flags, int *openings, u_int32_t *relsim_flags, u_int32_t *timeout, + int *print, const char **action_string); static int nperiph_drivers; @@ -1108,255 +1112,84 @@ cam_release_devq(struct cam_path *path, } #define saved_ccb_ptr ppriv_ptr0 -#define recovery_depth ppriv_field1 -static void -camperiphsensedone(struct cam_periph *periph, union ccb *done_ccb) -{ - union ccb *saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; - cam_status status; - int frozen = 0; - int depth = done_ccb->ccb_h.recovery_depth; - - status = done_ccb->ccb_h.status; - if (status & CAM_DEV_QFRZN) { - frozen = 1; - /* - * Clear freeze flag now for case of retry, - * freeze will be dropped later. - */ - done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN; - } - status &= CAM_STATUS_MASK; - switch (status) { - case CAM_REQ_CMP: - { - int error_code, sense_key, asc, ascq; - - scsi_extract_sense_len(&saved_ccb->csio.sense_data, - saved_ccb->csio.sense_len - - saved_ccb->csio.sense_resid, - &error_code, &sense_key, &asc, &ascq, - /*show_errors*/ 1); - /* - * If we manually retrieved sense into a CCB and got - * something other than "NO SENSE" send the updated CCB - * back to the client via xpt_done() to be processed via - * the error recovery code again. - */ - if ((sense_key != -1) - && (sense_key != SSD_KEY_NO_SENSE)) { - saved_ccb->ccb_h.status |= CAM_AUTOSNS_VALID; - } else { - saved_ccb->ccb_h.status &= ~CAM_STATUS_MASK; - saved_ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL; - } - saved_ccb->csio.sense_resid = done_ccb->csio.resid; - bcopy(saved_ccb, done_ccb, sizeof(union ccb)); - xpt_free_ccb(saved_ccb); - break; - } - default: - bcopy(saved_ccb, done_ccb, sizeof(union ccb)); - xpt_free_ccb(saved_ccb); - done_ccb->ccb_h.status &= ~CAM_STATUS_MASK; - done_ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL; - break; - } - periph->flags &= ~CAM_PERIPH_SENSE_INPROG; - /* - * If it is the end of recovery, drop freeze, taken due to - * CAM_DEV_QFREEZE flag, set on recovery request. - */ - if (depth == 0) { - cam_release_devq(done_ccb->ccb_h.path, - /*relsim_flags*/0, - /*openings*/0, - /*timeout*/0, - /*getcount_only*/0); - } - /* - * Copy frozen flag from recovery request if it is set there - * for some reason. - */ - if (frozen != 0) - done_ccb->ccb_h.status |= CAM_DEV_QFRZN; - (*done_ccb->ccb_h.cbfcnp)(periph, done_ccb); -} - static void camperiphdone(struct cam_periph *periph, union ccb *done_ccb) { - union ccb *saved_ccb, *save_ccb; + union ccb *saved_ccb; cam_status status; - int frozen = 0; struct scsi_start_stop_unit *scsi_cmd; - u_int32_t relsim_flags, timeout; + scsi_cmd = (struct scsi_start_stop_unit *) + &done_ccb->csio.cdb_io.cdb_bytes; status = done_ccb->ccb_h.status; - if (status & CAM_DEV_QFRZN) { - frozen = 1; - /* - * Clear freeze flag now for case of retry, - * freeze will be dropped later. - */ - done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN; - } - timeout = 0; - relsim_flags = 0; - saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; - - switch (status & CAM_STATUS_MASK) { - case CAM_REQ_CMP: - { - /* - * If we have successfully taken a device from the not - * ready to ready state, re-scan the device and re-get - * the inquiry information. Many devices (mostly disks) - * don't properly report their inquiry information unless - * they are spun up. - */ - scsi_cmd = (struct scsi_start_stop_unit *) - &done_ccb->csio.cdb_io.cdb_bytes; - - if (scsi_cmd->opcode == START_STOP_UNIT) - xpt_async(AC_INQ_CHANGED, - done_ccb->ccb_h.path, NULL); - goto final; - } - case CAM_SCSI_STATUS_ERROR: - scsi_cmd = (struct scsi_start_stop_unit *) - &done_ccb->csio.cdb_io.cdb_bytes; - if (status & CAM_AUTOSNS_VALID) { - struct ccb_getdev cgd; + if ((status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if ((status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR && + (status & CAM_AUTOSNS_VALID)) { struct scsi_sense_data *sense; int error_code, sense_key, asc, ascq, sense_len; - scsi_sense_action err_action; sense = &done_ccb->csio.sense_data; sense_len = done_ccb->csio.sense_len - done_ccb->csio.sense_resid; - scsi_extract_sense_len(sense, sense_len, &error_code, - &sense_key, &asc, &ascq, - /*show_errors*/ 1); - /* - * Grab the inquiry data for this device. - */ - xpt_setup_ccb(&cgd.ccb_h, done_ccb->ccb_h.path, - CAM_PRIORITY_NORMAL); - cgd.ccb_h.func_code = XPT_GDEV_TYPE; - xpt_action((union ccb *)&cgd); - err_action = scsi_error_action(&done_ccb->csio, - &cgd.inq_data, 0); + scsi_extract_sense_len(sense, sense_len, &error_code, + &sense_key, &asc, &ascq, /*show_errors*/ 1); /* - * If the error is "invalid field in CDB", - * and the load/eject flag is set, turn the - * flag off and try again. This is just in - * case the drive in question barfs on the - * load eject flag. The CAM code should set - * the load/eject flag by default for + * If the error is "invalid field in CDB", + * and the load/eject flag is set, turn the + * flag off and try again. This is just in + * case the drive in question barfs on the + * load eject flag. The CAM code should set + * the load/eject flag by default for * removable media. */ - /* XXX KDM - * Should we check to see what the specific - * scsi status is?? Or does it not matter - * since we already know that there was an - * error, and we know what the specific - * error code was, and we know what the - * opcode is.. - */ if ((scsi_cmd->opcode == START_STOP_UNIT) && ((scsi_cmd->how & SSS_LOEJ) != 0) && - (asc == 0x24) && (ascq == 0x00) && - (done_ccb->ccb_h.retry_count > 0)) { - + (asc == 0x24) && (ascq == 0x00)) { scsi_cmd->how &= ~SSS_LOEJ; + if (status & CAM_DEV_QFRZN) { + cam_release_devq(done_ccb->ccb_h.path, + 0, 0, 0, 0); + done_ccb->ccb_h.status &= + ~CAM_DEV_QFRZN; + } xpt_action(done_ccb); - } else if ((done_ccb->ccb_h.retry_count > 1) - && ((err_action & SS_MASK) != SS_FAIL)) { - - /* - * In this case, the error recovery - * command failed, but we've got - * some retries left on it. Give - * it another try unless this is an - * unretryable error. - */ - /* set the timeout to .5 sec */ - relsim_flags = - RELSIM_RELEASE_AFTER_TIMEOUT; - timeout = 500; - xpt_action(done_ccb); - break; - } else { - /* - * Perform the final retry with the original - * CCB so that final error processing is - * performed by the owner of the CCB. - */ - goto final; + goto out; } - } else { - save_ccb = xpt_alloc_ccb_nowait(); - if (save_ccb == NULL) - goto final; - bcopy(done_ccb, save_ccb, sizeof(*save_ccb)); - periph->flags |= CAM_PERIPH_SENSE_INPROG; - /* - * Send a Request Sense to the device. We - * assume that we are in a contingent allegiance - * condition so we do not tag this request. - */ - scsi_request_sense(&done_ccb->csio, /*retries*/1, - camperiphsensedone, - &save_ccb->csio.sense_data, - save_ccb->csio.sense_len, - CAM_TAG_ACTION_NONE, - /*sense_len*/SSD_FULL_SIZE, - /*timeout*/5000); - done_ccb->ccb_h.pinfo.priority--; - done_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; - done_ccb->ccb_h.saved_ccb_ptr = save_ccb; - done_ccb->ccb_h.recovery_depth++; - xpt_action(done_ccb); } - break; - default: -final: - bcopy(saved_ccb, done_ccb, sizeof(*done_ccb)); - xpt_free_ccb(saved_ccb); - periph->flags &= ~CAM_PERIPH_RECOVERY_INPROG; - xpt_action(done_ccb); - break; + if (cam_periph_error(done_ccb, + 0, SF_RETRY_UA | SF_NO_PRINT, NULL) == ERESTART) + goto out; + if (done_ccb->ccb_h.status & CAM_DEV_QFRZN) { + cam_release_devq(done_ccb->ccb_h.path, 0, 0, 0, 0); + done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN; + } + } else { + /* + * If we have successfully taken a device from the not + * ready to ready state, re-scan the device and re-get + * the inquiry information. Many devices (mostly disks) + * don't properly report their inquiry information unless + * they are spun up. + */ + if (scsi_cmd->opcode == START_STOP_UNIT) + xpt_async(AC_INQ_CHANGED, done_ccb->ccb_h.path, NULL); } - /* decrement the retry count */ - /* - * XXX This isn't appropriate in all cases. Restructure, - * so that the retry count is only decremented on an - * actual retry. Remeber that the orignal ccb had its - * retry count dropped before entering recovery, so - * doing it again is a bug. - */ - if (done_ccb->ccb_h.retry_count > 0) - done_ccb->ccb_h.retry_count--; /* - * Drop freeze taken due to CAM_DEV_QFREEZE flag set on recovery - * request. + * Perform the final retry with the original CCB so that final + * error processing is performed by the owner of the CCB. */ - cam_release_devq(done_ccb->ccb_h.path, - /*relsim_flags*/relsim_flags, - /*openings*/0, - /*timeout*/timeout, - /*getcount_only*/0); - /* Drop freeze taken, if this recovery request got error. */ - if (frozen != 0) { - cam_release_devq(done_ccb->ccb_h.path, - /*relsim_flags*/0, - /*openings*/0, - /*timeout*/0, - /*getcount_only*/0); - } + saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; + bcopy(saved_ccb, done_ccb, sizeof(*done_ccb)); + xpt_free_ccb(saved_ccb); + if (done_ccb->ccb_h.cbfcnp != camperiphdone) + periph->flags &= ~CAM_PERIPH_RECOVERY_INPROG; + xpt_action(done_ccb); + +out: + /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. */ + cam_release_devq(done_ccb->ccb_h.path, 0, 0, 0, 0); } /* @@ -1415,10 +1248,10 @@ cam_periph_freeze_after_event(struct cam } static int -camperiphscsistatuserror(union ccb *ccb, cam_flags camflags, - u_int32_t sense_flags, - int *openings, u_int32_t *relsim_flags, - u_int32_t *timeout, const char **action_string) +camperiphscsistatuserror(union ccb *ccb, union ccb **orig_ccb, + cam_flags camflags, u_int32_t sense_flags, + int *openings, u_int32_t *relsim_flags, + u_int32_t *timeout, int *print, const char **action_string) { int error; @@ -1431,14 +1264,13 @@ camperiphscsistatuserror(union ccb *ccb, break; case SCSI_STATUS_CMD_TERMINATED: case SCSI_STATUS_CHECK_COND: - if (bootverbose) - xpt_print(ccb->ccb_h.path, "SCSI status error\n"); - error = camperiphscsisenseerror(ccb, + error = camperiphscsisenseerror(ccb, orig_ccb, camflags, sense_flags, openings, relsim_flags, timeout, + print, action_string); break; case SCSI_STATUS_QUEUE_FULL: @@ -1493,9 +1325,6 @@ camperiphscsistatuserror(union ccb *ccb, } *timeout = 0; error = ERESTART; - if (bootverbose) { - xpt_print(ccb->ccb_h.path, "Queue full\n"); - } break; } /* FALLTHROUGH */ @@ -1505,9 +1334,6 @@ camperiphscsistatuserror(union ccb *ccb, * Restart the queue after either another * command completes or a 1 second timeout. */ - if (bootverbose) { - xpt_print(ccb->ccb_h.path, "Device busy\n"); - } if (ccb->ccb_h.retry_count > 0) { ccb->ccb_h.retry_count--; error = ERESTART; @@ -1519,12 +1345,7 @@ camperiphscsistatuserror(union ccb *ccb, } break; case SCSI_STATUS_RESERV_CONFLICT: - xpt_print(ccb->ccb_h.path, "Reservation conflict\n"); - error = EIO; - break; default: - xpt_print(ccb->ccb_h.path, "SCSI status 0x%x\n", - ccb->csio.scsi_status); error = EIO; break; } @@ -1532,18 +1353,18 @@ camperiphscsistatuserror(union ccb *ccb, } static int -camperiphscsisenseerror(union ccb *ccb, cam_flags camflags, - u_int32_t sense_flags, - int *openings, u_int32_t *relsim_flags, - u_int32_t *timeout, const char **action_string) +camperiphscsisenseerror(union ccb *ccb, union ccb **orig, + cam_flags camflags, u_int32_t sense_flags, + int *openings, u_int32_t *relsim_flags, + u_int32_t *timeout, int *print, const char **action_string) { struct cam_periph *periph; union ccb *orig_ccb = ccb; - int error; + int error, recoveryccb; periph = xpt_path_periph(ccb->ccb_h.path); - if (periph->flags & - (CAM_PERIPH_RECOVERY_INPROG | CAM_PERIPH_SENSE_INPROG)) { + recoveryccb = (ccb->ccb_h.cbfcnp == camperiphdone); + if ((periph->flags & CAM_PERIPH_RECOVERY_INPROG) && !recoveryccb) { /* * If error recovery is already in progress, don't attempt * to process this error, but requeue it unconditionally @@ -1558,6 +1379,7 @@ camperiphscsisenseerror(union ccb *ccb, * imperitive that we don't violate this assumption. */ error = ERESTART; + *print = 0; } else { scsi_sense_action err_action; struct ccb_getdev cgd; @@ -1573,14 +1395,36 @@ camperiphscsisenseerror(union ccb *ccb, err_action = scsi_error_action(&ccb->csio, &cgd.inq_data, sense_flags); - else if ((ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) - err_action = SS_REQSENSE; else err_action = SS_RETRY|SSQ_DECREMENT_COUNT|EIO; - error = err_action & SS_ERRMASK; /* + * Do not autostart sequential access devices + * to avoid unexpected tape loading. + */ + if ((err_action & SS_MASK) == SS_START && + SID_TYPE(&cgd.inq_data) == T_SEQUENTIAL) { + *action_string = "Will not autostart a " + "sequential access device"; + goto sense_error_done; + } + + /* + * Avoid recovery recursion if recovery action is the same. + */ + if ((err_action & SS_MASK) >= SS_START && recoveryccb) { + if (((err_action & SS_MASK) == SS_START && + ccb->csio.cdb_io.cdb_bytes[0] == START_STOP_UNIT) || + ((err_action & SS_MASK) == SS_TUR && + (ccb->csio.cdb_io.cdb_bytes[0] == TEST_UNIT_READY))) { + err_action = SS_RETRY|SSQ_DECREMENT_COUNT|EIO; + *relsim_flags = RELSIM_RELEASE_AFTER_TIMEOUT; + *timeout = 500; + } + } + + /* * If the recovery action will consume a retry, * make sure we actually have retries available. */ @@ -1627,15 +1471,6 @@ camperiphscsisenseerror(union ccb *ccb, case SS_START: { int le; - if (SID_TYPE(&cgd.inq_data) == T_SEQUENTIAL) { - xpt_free_ccb(orig_ccb); - ccb->ccb_h.status |= CAM_DEV_QFRZN; - *action_string = "Will not autostart a " - "sequential access device"; - err_action = SS_FAIL; - error = EIO; - break; - } /* * Send a start unit command to the device, and @@ -1699,24 +1534,6 @@ camperiphscsisenseerror(union ccb *ccb, *timeout = 500; break; } - case SS_REQSENSE: - { - *action_string = "Requesting SCSI sense data"; - periph->flags |= CAM_PERIPH_SENSE_INPROG; - /* - * Send a Request Sense to the device. We - * assume that we are in a contingent allegiance - * condition so we do not tag this request. - */ - scsi_request_sense(&ccb->csio, /*retries*/1, - camperiphsensedone, - &orig_ccb->csio.sense_data, - orig_ccb->csio.sense_len, - CAM_TAG_ACTION_NONE, - /*sense_len*/SSD_FULL_SIZE, - /*timeout*/5000); - break; - } default: panic("Unhandled error action %x", err_action); } @@ -1733,14 +1550,12 @@ camperiphscsisenseerror(union ccb *ccb, ccb->ccb_h.pinfo.priority--; ccb->ccb_h.flags |= CAM_DEV_QFREEZE; ccb->ccb_h.saved_ccb_ptr = orig_ccb; - ccb->ccb_h.recovery_depth = 0; error = ERESTART; + *orig = orig_ccb; } sense_error_done: - if ((err_action & SSQ_PRINT_SENSE) != 0 - && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0) - cam_error_print(orig_ccb, CAM_ESF_ALL, CAM_EPF_ALL); + *print = ((err_action & SSQ_PRINT_SENSE) != 0); } return (error); } @@ -1754,87 +1569,35 @@ int cam_periph_error(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, union ccb *save_ccb) { + union ccb *orig_ccb; struct cam_periph *periph; const char *action_string; cam_status status; - int frozen; - int error, printed = 0; - int openings; - u_int32_t relsim_flags; - u_int32_t timeout = 0; + int frozen, error, openings, print, lost_device; + u_int32_t relsim_flags, timeout; + print = 1; periph = xpt_path_periph(ccb->ccb_h.path); action_string = NULL; status = ccb->ccb_h.status; frozen = (status & CAM_DEV_QFRZN) != 0; status &= CAM_STATUS_MASK; - openings = relsim_flags = 0; + openings = relsim_flags = timeout = lost_device = 0; + orig_ccb = ccb; switch (status) { case CAM_REQ_CMP: error = 0; + print = 0; break; case CAM_SCSI_STATUS_ERROR: - error = camperiphscsistatuserror(ccb, - camflags, - sense_flags, - &openings, - &relsim_flags, - &timeout, - &action_string); + error = camperiphscsistatuserror(ccb, &orig_ccb, + camflags, sense_flags, &openings, &relsim_flags, + &timeout, &print, &action_string); break; case CAM_AUTOSENSE_FAIL: - xpt_print(ccb->ccb_h.path, "AutoSense failed\n"); error = EIO; /* we have to kill the command */ break; - case CAM_ATA_STATUS_ERROR: - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, "ATA status error\n"); - cam_error_print(ccb, CAM_ESF_ALL, CAM_EPF_ALL); - printed++; - } - /* FALLTHROUGH */ - case CAM_REQ_CMP_ERR: - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, - "Request completed with CAM_REQ_CMP_ERR\n"); - printed++; - } - /* FALLTHROUGH */ - case CAM_CMD_TIMEOUT: - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, "Command timed out\n"); - printed++; - } - /* FALLTHROUGH */ - case CAM_UNEXP_BUSFREE: - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, "Unexpected Bus Free\n"); - printed++; - } - /* FALLTHROUGH */ - case CAM_UNCOR_PARITY: - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, - "Uncorrected parity error\n"); - printed++; - } - /* FALLTHROUGH */ - case CAM_DATA_RUN_ERR: - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, "Data overrun\n"); - printed++; - } - /* decrement the number of retries */ - if (ccb->ccb_h.retry_count > 0 && - (periph->flags & CAM_PERIPH_INVALID) == 0) { - ccb->ccb_h.retry_count--; - error = ERESTART; - } else { - action_string = "Retries exhausted"; - error = EIO; - } - break; case CAM_UA_ABORT: case CAM_UA_TERMIO: case CAM_MSG_REJECT_REC: @@ -1845,14 +1608,8 @@ cam_periph_error(union ccb *ccb, cam_fla if ((camflags & CAM_RETRY_SELTO) != 0) { if (ccb->ccb_h.retry_count > 0 && (periph->flags & CAM_PERIPH_INVALID) == 0) { - ccb->ccb_h.retry_count--; error = ERESTART; - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, - "Selection timeout\n"); - printed++; - } /* * Wait a bit to give the device @@ -1866,38 +1623,10 @@ cam_periph_error(union ccb *ccb, cam_fla } /* FALLTHROUGH */ case CAM_DEV_NOT_THERE: - { - struct cam_path *newpath; - lun_id_t lun_id; - error = ENXIO; - - /* - * For a selection timeout, we consider all of the LUNs on - * the target to be gone. If the status is CAM_DEV_NOT_THERE, - * then we only get rid of the device(s) specified by the - * path in the original CCB. - */ - if (status == CAM_DEV_NOT_THERE) - lun_id = xpt_path_lun_id(ccb->ccb_h.path); - else - lun_id = CAM_LUN_WILDCARD; - - /* Should we do more if we can't create the path?? */ - if (xpt_create_path(&newpath, periph, - xpt_path_path_id(ccb->ccb_h.path), - xpt_path_target_id(ccb->ccb_h.path), - lun_id) != CAM_REQ_CMP) - break; - - /* - * Let peripheral drivers know that this device has gone - * away. - */ - xpt_async(AC_LOST_DEVICE, newpath, NULL); - xpt_free_path(newpath); + print = 0; + lost_device = 1; break; - } case CAM_REQ_INVALID: case CAM_PATH_INVALID: case CAM_NO_HBA: @@ -1917,27 +1646,16 @@ cam_periph_error(union ccb *ccb, cam_fla * these events and should be unconditionally * retried. */ - if (bootverbose && printed == 0) { - xpt_print_path(ccb->ccb_h.path); - if (status == CAM_BDR_SENT) - printf("Bus Device Reset sent\n"); - else - printf("Bus Reset issued\n"); - printed++; - } - /* FALLTHROUGH */ case CAM_REQUEUE_REQ: - /* Unconditional requeue */ - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, "Request requeued\n"); - printed++; - } - if ((periph->flags & CAM_PERIPH_INVALID) == 0) - error = ERESTART; - else { - action_string = "Retries exhausted"; + /* Unconditional requeue if device is still there */ + if (periph->flags & CAM_PERIPH_INVALID) { + action_string = "Periph was invalidated"; error = EIO; - } + } else if (sense_flags & SF_NO_RETRY) { + error = EIO; + action_string = "Retry was blocked"; + } else + error = ERESTART; break; case CAM_RESRC_UNAVAIL: /* Wait a bit for the resource shortage to abate. */ @@ -1950,30 +1668,37 @@ cam_periph_error(union ccb *ccb, cam_fla } relsim_flags = RELSIM_RELEASE_AFTER_TIMEOUT; /* FALLTHROUGH */ + case CAM_ATA_STATUS_ERROR: + case CAM_REQ_CMP_ERR: + case CAM_CMD_TIMEOUT: + case CAM_UNEXP_BUSFREE: + case CAM_UNCOR_PARITY: + case CAM_DATA_RUN_ERR: default: - /* decrement the number of retries */ - if (ccb->ccb_h.retry_count > 0 && - (periph->flags & CAM_PERIPH_INVALID) == 0) { - ccb->ccb_h.retry_count--; - error = ERESTART; - if (bootverbose && printed == 0) { - xpt_print(ccb->ccb_h.path, "CAM status 0x%x\n", - status); - printed++; - } - } else { + if (periph->flags & CAM_PERIPH_INVALID) { + error = EIO; + action_string = "Periph was invalidated"; + } else if (ccb->ccb_h.retry_count == 0) { error = EIO; action_string = "Retries exhausted"; + } else if (sense_flags & SF_NO_RETRY) { + error = EIO; + action_string = "Retry was blocked"; + } else { + ccb->ccb_h.retry_count--; + error = ERESTART; } break; } - /* - * If we have and error and are booting verbosely, whine - * *unless* this was a non-retryable selection timeout. - */ - if (error != 0 && bootverbose && - !(status == CAM_SEL_TIMEOUT && (camflags & CAM_RETRY_SELTO) == 0)) { + if ((sense_flags & SF_PRINT_ALWAYS) || + CAM_DEBUGGED(ccb->ccb_h.path, CAM_DEBUG_INFO)) + print = 1; + else if (sense_flags & SF_NO_PRINT) + print = 0; + if (print) + cam_error_print(orig_ccb, CAM_ESF_ALL, CAM_EPF_ALL); + if (error != 0 && print) { if (error != ERESTART) { if (action_string == NULL) action_string = "Unretryable error"; @@ -1985,6 +1710,36 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_print(ccb->ccb_h.path, "Retrying command\n"); } + if (lost_device) { + struct cam_path *newpath; + lun_id_t lun_id; + + /* + * For a selection timeout, we consider all of the LUNs on + * the target to be gone. If the status is CAM_DEV_NOT_THERE, + * then we only get rid of the device(s) specified by the + * path in the original CCB. + */ + if (status == CAM_DEV_NOT_THERE) + lun_id = xpt_path_lun_id(ccb->ccb_h.path); + else + lun_id = CAM_LUN_WILDCARD; + + /* Should we do more if we can't create the path?? */ + if (xpt_create_path(&newpath, periph, + xpt_path_path_id(ccb->ccb_h.path), + xpt_path_target_id(ccb->ccb_h.path), + lun_id) == CAM_REQ_CMP) { + + /* + * Let peripheral drivers know that this + * device has gone away. + */ + xpt_async(AC_LOST_DEVICE, newpath, NULL); + xpt_free_path(newpath); + } + } + /* Attempt a retry */ if (error == ERESTART || error == 0) { if (frozen != 0) Modified: stable/9/sys/cam/cam_periph.h ============================================================================== --- stable/9/sys/cam/cam_periph.h Wed Jun 20 16:24:02 2012 (r237326) +++ stable/9/sys/cam/cam_periph.h Wed Jun 20 16:51:14 2012 (r237327) @@ -118,7 +118,6 @@ struct cam_periph { #define CAM_PERIPH_INVALID 0x08 #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 -#define CAM_PERIPH_SENSE_INPROG 0x40 #define CAM_PERIPH_FREE 0x80 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 17:08:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCD921065670; Wed, 20 Jun 2012 17:08:01 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71A2E8FC15; Wed, 20 Jun 2012 17:08:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KH81K2056371; Wed, 20 Jun 2012 17:08:01 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KH81EI056365; Wed, 20 Jun 2012 17:08:01 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201206201708.q5KH81EI056365@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 20 Jun 2012 17:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237328 - in head/sys/cam: . scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 17:08:01 -0000 Author: ken Date: Wed Jun 20 17:08:00 2012 New Revision: 237328 URL: http://svn.freebsd.org/changeset/base/237328 Log: Fix several reference counting and object lifetime issues between the pass(4) and enc(4) drivers and devfs. The pass(4) driver uses the destroy_dev_sched() routine to schedule its device node for destruction in a separate thread context. It does this because the passcleanup() routine can get called indirectly from the passclose() routine, and that would cause a deadlock if the close routine tried to destroy its own device node. In any case, once a particular passthrough driver number, e.g. pass3, is destroyed, CAM considers that unit number (3 in this case) available for reuse. The problem is that devfs may not be done cleaning up the previous instance of pass3, and will panic if isn't done cleaning up the previous instance. The solution is to get a callback from devfs when the device node is removed, and make sure we hold a reference to the peripheral until that happens. Testing exposed some other cases where we have reference counting issues, and those were also fixed in the pass(4) driver. cam_periph.c: In camperiphfree(), reorder some of the operations. The peripheral destructor needs to be called before the peripheral is removed from the peripheral is removed from the list. This is because once we remove the peripheral from the list, and drop the topology lock, the peripheral number may be reused. But if the destructor hasn't been called yet, there may still be resources hanging around (like devfs nodes) that haven't been fully cleaned up. cam_xpt.c: Add an argument to xpt_remove_periph() to indicate whether the topology lock is already held. scsi_enc.c: Acquire an extra reference to the peripheral during registration, and release it once we get a callback from devfs indicating that the device node is gone. Call destroy_dev_sched_cb() in enc_oninvalidate() instead of calling destroy_dev() in the cleanup routine. scsi_pass.c: Add reference counting to handle peripheral and devfs object lifetime issues. Add a reference to the peripheral and the devfs node in the peripheral registration. Don't attempt to add a physical path alias if the peripheral has been marked invalid. Release the devfs reference once the initial physical path alias taskqueue run has completed. Schedule devfs node destruction in the passoninvalidate(), and release our peripheral reference in a new routine, passdevgonecb() once the devfs node is gone. This allows the peripheral to fully go away, and the peripheral destructor, passcleanup(), will get called. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt_periph.h head/sys/cam/scsi/scsi_enc.c head/sys/cam/scsi/scsi_pass.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Wed Jun 20 16:51:14 2012 (r237327) +++ head/sys/cam/cam_periph.c Wed Jun 20 17:08:00 2012 (r237328) @@ -258,7 +258,7 @@ failure: break; case 3: CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); - xpt_remove_periph(periph); + xpt_remove_periph(periph, /*topology_lock_held*/ 0); /* FALLTHROUGH */ case 2: xpt_lock_buses(); @@ -610,13 +610,38 @@ camperiphfree(struct cam_periph *periph) return; } - TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); - (*p_drv)->generation++; + /* + * The peripheral destructor semantics dictate calling with only the + * SIM mutex held. Since it might sleep, it should not be called + * with the topology lock held. + */ xpt_unlock_buses(); + /* + * We need to call the peripheral destructor prior to removing the + * peripheral from the list. Otherwise, we risk running into a + * scenario where the peripheral unit number may get reused + * (because it has been removed from the list), but some resources + * used by the peripheral are still hanging around. In particular, + * the devfs nodes used by some peripherals like the pass(4) driver + * aren't fully cleaned up until the destructor is run. If the + * unit number is reused before the devfs instance is fully gone, + * devfs will panic. + */ if (periph->periph_dtor != NULL) periph->periph_dtor(periph); - xpt_remove_periph(periph); + + /* + * The peripheral list is protected by the topology lock. + */ + xpt_lock_buses(); + + TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); + (*p_drv)->generation++; + + xpt_remove_periph(periph, /*topology_lock_held*/ 1); + + xpt_unlock_buses(); CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Jun 20 16:51:14 2012 (r237327) +++ head/sys/cam/cam_xpt.c Wed Jun 20 17:08:00 2012 (r237328) @@ -1026,7 +1026,7 @@ xpt_add_periph(struct cam_periph *periph } void -xpt_remove_periph(struct cam_periph *periph) +xpt_remove_periph(struct cam_periph *periph, int topology_lock_held) { struct cam_ed *device; @@ -1047,9 +1047,13 @@ xpt_remove_periph(struct cam_periph *per SLIST_REMOVE(periph_head, periph, cam_periph, periph_links); } - mtx_lock(&xsoftc.xpt_topo_lock); + if (topology_lock_held == 0) + mtx_lock(&xsoftc.xpt_topo_lock); + xsoftc.xpt_generation++; - mtx_unlock(&xsoftc.xpt_topo_lock); + + if (topology_lock_held == 0) + mtx_unlock(&xsoftc.xpt_topo_lock); } Modified: head/sys/cam/cam_xpt_periph.h ============================================================================== --- head/sys/cam/cam_xpt_periph.h Wed Jun 20 16:51:14 2012 (r237327) +++ head/sys/cam/cam_xpt_periph.h Wed Jun 20 17:08:00 2012 (r237328) @@ -42,7 +42,8 @@ void xpt_polled_action(union ccb *ccb); void xpt_release_ccb(union ccb *released_ccb); void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority); int32_t xpt_add_periph(struct cam_periph *periph); -void xpt_remove_periph(struct cam_periph *periph); +void xpt_remove_periph(struct cam_periph *periph, + int topology_lock_held); void xpt_announce_periph(struct cam_periph *periph, char *announce_string); #endif Modified: head/sys/cam/scsi/scsi_enc.c ============================================================================== --- head/sys/cam/scsi/scsi_enc.c Wed Jun 20 16:51:14 2012 (r237327) +++ head/sys/cam/scsi/scsi_enc.c Wed Jun 20 17:08:00 2012 (r237328) @@ -114,6 +114,16 @@ enc_init(void) } static void +enc_devgonecb(void *arg) +{ + struct cam_periph *periph; + + periph = (struct cam_periph *)arg; + + cam_periph_release(periph); +} + +static void enc_oninvalidate(struct cam_periph *periph) { struct enc_softc *enc; @@ -141,6 +151,8 @@ enc_oninvalidate(struct cam_periph *peri } callout_drain(&enc->status_updater); + destroy_dev_sched_cb(enc->enc_dev, enc_devgonecb, periph); + xpt_print(periph->path, "lost device\n"); } @@ -152,9 +164,7 @@ enc_dtor(struct cam_periph *periph) enc = periph->softc; xpt_print(periph->path, "removing device entry\n"); - cam_periph_unlock(periph); - destroy_dev(enc->enc_dev); - cam_periph_lock(periph); + /* If the sub-driver has a cleanup routine, call it */ if (enc->enc_vec.softc_cleanup != NULL) @@ -951,9 +961,19 @@ enc_ctor(struct cam_periph *periph, void goto out; } } + + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + cam_periph_lock(periph); + + return (CAM_REQ_CMP_ERR); + } + enc->enc_dev = make_dev(&enc_cdevsw, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); + cam_periph_lock(periph); enc->enc_dev->si_drv1 = periph; Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Wed Jun 20 16:51:14 2012 (r237327) +++ head/sys/cam/scsi/scsi_pass.c Wed Jun 20 17:08:00 2012 (r237328) @@ -55,7 +55,8 @@ __FBSDID("$FreeBSD$"); typedef enum { PASS_FLAG_OPEN = 0x01, PASS_FLAG_LOCKED = 0x02, - PASS_FLAG_INVALID = 0x04 + PASS_FLAG_INVALID = 0x04, + PASS_FLAG_INITIAL_PHYSPATH = 0x08 } pass_flags; typedef enum { @@ -133,7 +134,18 @@ passinit(void) printf("pass: Failed to attach master async callback " "due to status 0x%x!\n", status); } - + +} + +static void +passdevgonecb(void *arg) +{ + struct cam_periph *periph; + + periph = (struct cam_periph *)arg; + + xpt_print(periph->path, "%s: devfs entry is gone\n", __func__); + cam_periph_release(periph); } static void @@ -151,6 +163,12 @@ passoninvalidate(struct cam_periph *peri softc->flags |= PASS_FLAG_INVALID; /* + * Tell devfs this device has gone away, and ask for a callback + * when it has cleaned up its state. + */ + destroy_dev_sched_cb(softc->dev, passdevgonecb, periph); + + /* * XXX Return all queued I/O with ENXIO. * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. @@ -176,11 +194,6 @@ passcleanup(struct cam_periph *periph) cam_periph_unlock(periph); taskqueue_drain(taskqueue_thread, &softc->add_physpath_task); - /* - * passcleanup() is indirectly a d_close method via passclose, - * so using destroy_dev(9) directly can result in deadlock. - */ - destroy_dev_sched(softc->dev); cam_periph_lock(periph); free(softc, M_DEVBUF); @@ -199,6 +212,12 @@ pass_add_physpath(void *context, int pen */ periph = context; softc = periph->softc; + cam_periph_lock(periph); + if (periph->flags & CAM_PERIPH_INVALID) { + cam_periph_unlock(periph); + return; + } + cam_periph_unlock(periph); physpath = malloc(MAXPATHLEN, M_DEVBUF, M_WAITOK); if (xpt_getattr(physpath, MAXPATHLEN, "GEOM::physpath", periph->path) == 0 @@ -208,6 +227,19 @@ pass_add_physpath(void *context, int pen softc->dev, softc->alias_dev, physpath); } free(physpath, M_DEVBUF); + + /* + * Now that we've made our alias, we no longer have to have a + * reference to the device. + */ + cam_periph_lock(periph); + if ((softc->flags & PASS_FLAG_INITIAL_PHYSPATH) == 0) { + softc->flags |= PASS_FLAG_INITIAL_PHYSPATH; + cam_periph_unlock(periph); + dev_rel(softc->dev); + } + else + cam_periph_unlock(periph); } static void @@ -281,12 +313,12 @@ passregister(struct cam_periph *periph, cgd = (struct ccb_getdev *)arg; if (periph == NULL) { - printf("passregister: periph was NULL!!\n"); + printf("%s: periph was NULL!!\n", __func__); return(CAM_REQ_CMP_ERR); } if (cgd == NULL) { - printf("passregister: no getdev CCB, can't register device\n"); + printf("%s: no getdev CCB, can't register device\n", __func__); return(CAM_REQ_CMP_ERR); } @@ -294,8 +326,8 @@ passregister(struct cam_periph *periph, M_DEVBUF, M_NOWAIT); if (softc == NULL) { - printf("passregister: Unable to probe new device. " - "Unable to allocate softc\n"); + printf("%s: Unable to probe new device. " + "Unable to allocate softc\n", __func__); return(CAM_REQ_CMP_ERR); } @@ -331,10 +363,31 @@ passregister(struct cam_periph *periph, DEVSTAT_TYPE_PASS, DEVSTAT_PRIORITY_PASS); + /* + * Acquire a reference to the periph before we create the devfs + * instance for it. We'll release this reference once the devfs + * instance has been freed. + */ + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + mtx_lock(periph->sim->mtx); + return (CAM_REQ_CMP_ERR); + } + /* Register the device */ softc->dev = make_dev(&pass_cdevsw, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); + + /* + * Now that we have made the devfs instance, hold a reference to it + * until the task queue has run to setup the physical path alias. + * That way devfs won't get rid of the device before we add our + * alias. + */ + dev_ref(softc->dev); + mtx_lock(periph->sim->mtx); softc->dev->si_drv1 = periph; From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 17:20:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38FA01065674; Wed, 20 Jun 2012 17:20:26 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23DBF8FC19; Wed, 20 Jun 2012 17:20:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KHKPxK056953; Wed, 20 Jun 2012 17:20:25 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KHKPq7056951; Wed, 20 Jun 2012 17:20:25 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201206201720.q5KHKPq7056951@svn.freebsd.org> From: Matt Jacob Date: Wed, 20 Jun 2012 17:20:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237329 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 17:20:26 -0000 Author: mjacob Date: Wed Jun 20 17:20:25 2012 New Revision: 237329 URL: http://svn.freebsd.org/changeset/base/237329 Log: Fix ARM compilation issue. X-MFC: 237260 Modified: head/usr.sbin/mfiutil/mfi_drive.c Modified: head/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_drive.c Wed Jun 20 17:08:00 2012 (r237328) +++ head/usr.sbin/mfiutil/mfi_drive.c Wed Jun 20 17:20:25 2012 (r237329) @@ -330,11 +330,13 @@ cam_strvis(char *dst, const char *src, i const char * mfi_pd_inq_string(struct mfi_pd_info *info) { - struct scsi_inquiry_data *inq_data; + struct scsi_inquiry_data iqd, *inq_data = &iqd; char vendor[16], product[48], revision[16], rstr[12], serial[SID_VENDOR_SPECIFIC_0_SIZE]; static char inq_string[64]; - inq_data = (struct scsi_inquiry_data *)info->inquiry_data; + memcpy(inq_data, info->inquiry_data, + (sizeof (iqd) < sizeof (info->inquiry_data))? + sizeof (iqd) : sizeof (info->inquiry_data)); if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data)) return (NULL); if (SID_TYPE(inq_data) != T_DIRECT) From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 17:26:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D85E106566B; Wed, 20 Jun 2012 17:26:22 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8851F8FC1C; Wed, 20 Jun 2012 17:26:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KHQMWK057241; Wed, 20 Jun 2012 17:26:22 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KHQMV4057239; Wed, 20 Jun 2012 17:26:22 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201206201726.q5KHQMV4057239@svn.freebsd.org> From: Sean Bruno Date: Wed, 20 Jun 2012 17:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237330 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 17:26:22 -0000 Author: sbruno Date: Wed Jun 20 17:26:22 2012 New Revision: 237330 URL: http://svn.freebsd.org/changeset/base/237330 Log: Now that there is an est(4) man page, reference it here in cpufreq(4). Modified: head/share/man/man4/cpufreq.4 Modified: head/share/man/man4/cpufreq.4 ============================================================================== --- head/share/man/man4/cpufreq.4 Wed Jun 20 17:20:25 2012 (r237329) +++ head/share/man/man4/cpufreq.4 Wed Jun 20 17:26:22 2012 (r237330) @@ -286,6 +286,7 @@ then it should set all elements to .Dv CPUFREQ_VAL_UNKNOWN . .Sh SEE ALSO .Xr acpi 4 , +.Xr est 4 , .Xr timecounters 4 , .Xr powerd 8 , .Xr sysctl 8 From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 17:51:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D35C1065670; Wed, 20 Jun 2012 17:51:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8D148FC19; Wed, 20 Jun 2012 17:51:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KHp4wk058615; Wed, 20 Jun 2012 17:51:04 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KHp4Xr058600; Wed, 20 Jun 2012 17:51:04 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206201751.q5KHp4Xr058600@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 20 Jun 2012 17:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237332 - in vendor-sys/acpica/dist: . generate/unix/iasl source/common source/compiler source/components/debugger source/components/disassembler source/components/dispatcher source/com... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 17:51:05 -0000 Author: jkim Date: Wed Jun 20 17:51:04 2012 New Revision: 237332 URL: http://svn.freebsd.org/changeset/base/237332 Log: Import ACPICA 20120620. Added: vendor-sys/acpica/dist/source/common/ahpredef.c (contents, props changed) Deleted: vendor-sys/acpica/dist/source/tools/acpihelp/ahpredef.c Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/iasl/Makefile vendor-sys/acpica/dist/source/common/dmextern.c vendor-sys/acpica/dist/source/common/dmrestag.c vendor-sys/acpica/dist/source/compiler/Makefile vendor-sys/acpica/dist/source/compiler/aslcompile.c vendor-sys/acpica/dist/source/compiler/aslerror.c vendor-sys/acpica/dist/source/compiler/aslfiles.c vendor-sys/acpica/dist/source/compiler/asllookup.c vendor-sys/acpica/dist/source/compiler/aslmain.c vendor-sys/acpica/dist/source/compiler/aslsupport.l vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/dttemplate.c vendor-sys/acpica/dist/source/components/debugger/dbdisply.c vendor-sys/acpica/dist/source/components/debugger/dbexec.c vendor-sys/acpica/dist/source/components/debugger/dbutils.c vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c vendor-sys/acpica/dist/source/components/dispatcher/dsopcode.c vendor-sys/acpica/dist/source/components/events/evgpe.c vendor-sys/acpica/dist/source/components/events/evgpeutil.c vendor-sys/acpica/dist/source/components/events/evxfgpe.c vendor-sys/acpica/dist/source/components/executer/exconfig.c vendor-sys/acpica/dist/source/components/utilities/utmisc.c vendor-sys/acpica/dist/source/include/acdebug.h vendor-sys/acpica/dist/source/include/acdisasm.h vendor-sys/acpica/dist/source/include/acglobal.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/acpredef.h vendor-sys/acpica/dist/source/include/acutils.h vendor-sys/acpica/dist/source/include/platform/acwin64.h vendor-sys/acpica/dist/source/tools/acpiexec/aeexec.c vendor-sys/acpica/dist/source/tools/acpihelp/acpihelp.h vendor-sys/acpica/dist/source/tools/acpisrc/acpisrc.h vendor-sys/acpica/dist/source/tools/acpisrc/ascase.c vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c vendor-sys/acpica/dist/source/tools/acpisrc/asmain.c vendor-sys/acpica/dist/source/tools/acpisrc/astable.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/changes.txt Wed Jun 20 17:51:04 2012 (r237332) @@ -1,4 +1,68 @@ ---------------------------------------- +20 June 2012. Summary of changes for version 20120620: + +This release is available at https://www.acpica.org/downloads +The ACPI 5.0 specification is available at www.acpi.info + +1) ACPICA Kernel-resident Subsystem: + +Implemented support to expand the "implicit notify" feature to allow multiple +devices to be notified by a single GPE. This feature automatically generates a +runtime device notification in the absence of a BIOS-provided GPE control +method (_Lxx/_Exx) or a host-installed handler for the GPE. Implicit notify is +provided by ACPICA for Windows compatibility, and is a workaround for BIOS AML +code errors. See the description of the AcpiSetupGpeForWake interface in the +APCICA reference. Bob Moore, Rafael Wysocki. ACPICA BZ 918. + +Changed some comments and internal function names to simplify and ensure +correctness of the Linux code translation. No functional changes. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug +version of the code includes the debug output trace mechanism and has a much +larger code and data size. + + Previous Release: + Non-Debug Version: 93.0K Code, 25.1K Data, 118.1K Total + Debug Version: 172.7K Code, 73.6K Data, 246.3K Total + Current Release: + Non-Debug Version: 93.1K Code, 25.1K Data, 118.2K Total + Debug Version: 172.9K Code, 73.6K Data, 246.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Added support to emit short, commented descriptions for the ACPI +predefined names in order to improve the readability of the disassembled +output. ACPICA BZ 959. Changes include: + 1) Emit descriptions for all standard predefined names (_INI, _STA, _PRW, +etc.) + 2) Emit generic descriptions for the special names (_Exx, _Qxx, etc.) + 3) Emit descriptions for the resource descriptor names (_MIN, _LEN, etc.) + +AcpiSrc: Fixed several long-standing Linux code translation issues. Argument +descriptions in function headers are now translated properly to lower case and +underscores. ACPICA BZ 961. Also fixes translation problems such as these: +(old -> new) + i_aSL -> iASL + 00-7_f -> 00-7F + 16_k -> 16K + local_fADT -> local_FADT + execute_oSI -> execute_OSI + +iASL: Fixed a problem where null bytes were inadvertently emitted into some +listing files. + +iASL: Added the existing debug options to the standard help screen. There are +no longer two different help screens. ACPICA BZ 957. + +AcpiHelp: Fixed some typos in the various predefined name descriptions. Also +expand some of the descriptions where appropriate. + +iASL: Fixed the -ot option (display compile times/statistics). Was not working +properly for standard output; only worked for the debug file case. + +---------------------------------------- 18 May 2012. Summary of changes for version 20120518: Modified: vendor-sys/acpica/dist/generate/unix/iasl/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/iasl/Makefile Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/generate/unix/iasl/Makefile Wed Jun 20 17:51:04 2012 (r237332) @@ -45,6 +45,7 @@ OBJECTS = \ $(OBJDIR)/adfile.o \ $(OBJDIR)/adisasm.o \ $(OBJDIR)/adwalk.o \ + $(OBJDIR)/ahpredef.o \ $(OBJDIR)/aslanalyze.o \ $(OBJDIR)/aslbtypes.o \ $(OBJDIR)/aslcodegen.o \ Added: vendor-sys/acpica/dist/source/common/ahpredef.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/acpica/dist/source/common/ahpredef.c Wed Jun 20 17:51:04 2012 (r237332) @@ -0,0 +1,323 @@ +/****************************************************************************** + * + * Module Name: ahpredef - Table of all known ACPI predefined names + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" + +/* + * iASL only needs a partial table (short descriptions only). + * AcpiHelp needs the full table. + */ +#ifdef ACPI_ASL_COMPILER +#define AH_PREDEF(Name, ShortDesc, LongDesc) {Name, ShortDesc} +#else +#define AH_PREDEF(Name, ShortDesc, LongDesc) {Name, ShortDesc, LongDesc} +#endif + +/* + * Predefined ACPI names, with short description and return value. + * This table was extracted directly from the ACPI specification. + */ +const AH_PREDEFINED_NAME AslPredefinedInfo[] = +{ + AH_PREDEF ("_ACx", "Active Cooling", "Returns the active cooling policy threshold values"), + AH_PREDEF ("_ADR", "Address", "Returns the address of a device on its parent bus"), + AH_PREDEF ("_AEI", "ACPI Event Interrupts", "Returns a list of GPIO events to be used as ACPI events"), + AH_PREDEF ("_ALC", "Ambient Light Chromaticity", "Returns the ambient light color chromaticity"), + AH_PREDEF ("_ALI", "Ambient Light Illuminance", "Returns the ambient light brightness"), + AH_PREDEF ("_ALN", "Alignment", "Base alignment, Resource Descriptor field"), + AH_PREDEF ("_ALP", "Ambient Light Polling", "Returns the ambient light sensor polling frequency"), + AH_PREDEF ("_ALR", "Ambient Light Response", "Returns the ambient light brightness to display brightness mappings"), + AH_PREDEF ("_ALT", "Ambient Light Temperature", "Returns the ambient light color temperature"), + AH_PREDEF ("_ALx", "Active List", "Returns a list of active cooling device objects"), + AH_PREDEF ("_ART", "Active Cooling Relationship Table", "Returns thermal relationship information between platform devices and fan devices"), + AH_PREDEF ("_ASI", "Address Space Id", "Resource Descriptor field"), + AH_PREDEF ("_ASZ", "Access Size", "Resource Descriptor field"), + AH_PREDEF ("_ATT", "Type-Specific Attribute", "Resource Descriptor field"), + AH_PREDEF ("_BAS", "Base Address", "Range base address, Resource Descriptor field"), + AH_PREDEF ("_BBN", "BIOS Bus Number", "Returns the PCI bus number returned by the BIOS"), + AH_PREDEF ("_BCL", "Brightness Control Levels", "Returns a list of supported brightness control levels"), + AH_PREDEF ("_BCM", "Brightness Control Method", "Sets the brightness level of the display device"), + AH_PREDEF ("_BCT", "Battery Charge Time", "Returns time remaining to complete charging battery"), + AH_PREDEF ("_BDN", "BIOS Dock Name", "Returns the Dock ID returned by the BIOS"), + AH_PREDEF ("_BFS", "Back From Sleep", "Inform AML of a wake event"), + AH_PREDEF ("_BIF", "Battery Information", "Returns a Control Method Battery information block"), + AH_PREDEF ("_BIX", "Battery Information Extended", "Returns a Control Method Battery extended information block"), + AH_PREDEF ("_BLT", "Battery Level Threshold", "Set battery level threshold preferences"), + AH_PREDEF ("_BM_", "Bus Master", "Resource Descriptor field"), + AH_PREDEF ("_BMA", "Battery Measurement Averaging Interval", "Sets battery measurement averaging interval"), + AH_PREDEF ("_BMC", "Battery Maintenance Control", "Sets battery maintenance and control features"), + AH_PREDEF ("_BMD", "Battery Maintenance Data", "Returns battery maintenance, control, and state data"), + AH_PREDEF ("_BMS", "Battery Measurement Sampling Time", "Sets the battery measurement sampling time"), + AH_PREDEF ("_BQC", "Brightness Query Current", "Returns the current display brightness level"), + AH_PREDEF ("_BST", "Battery Status", "Returns a Control Method Battery status block"), + AH_PREDEF ("_BTM", "Battery Time", "Returns the battery runtime"), + AH_PREDEF ("_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"), + AH_PREDEF ("_CBA", "Configuration Base Address", "Sets the base address for a PCI Express host bridge"), + AH_PREDEF ("_CDM", "Clock Domain", "Returns a logical processor's clock domain identifier"), + AH_PREDEF ("_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"), + AH_PREDEF ("_CLS", "Class Code", "Returns PCI class code and subclass"), + AH_PREDEF ("_CPC", "Continuous Performance Control", "Returns a list of performance control interfaces"), + AH_PREDEF ("_CRS", "Current Resource Settings", "Returns the current resource settings for a device"), + AH_PREDEF ("_CRT", "Critical Temperature", "Returns the shutdown critical temperature"), + AH_PREDEF ("_CSD", "C-State Dependencies", "Returns a list of C-state dependencies"), + AH_PREDEF ("_CST", "C-States", "Returns a list of supported C-states"), + AH_PREDEF ("_CWS", "Clear Wake Alarm Status", "Clear the status of wake alarms"), + AH_PREDEF ("_DBT", "Debounce Timeout", "Timeout value, Resource Descriptor field"), + AH_PREDEF ("_DCK", "Dock Present", "Sets docking isolation. Presence indicates device is a docking station"), + AH_PREDEF ("_DCS", "Display Current Status", "Returns status of the display output device"), + AH_PREDEF ("_DDC", "Display Data Current", "Returns the EDID for the display output device"), + AH_PREDEF ("_DDN", "DOS Device Name", "Returns a device logical name"), + AH_PREDEF ("_DEC", "Decode", "Device decoding type, Resource Descriptor field"), + AH_PREDEF ("_DEP", "Dependencies", "Returns a list of operation region dependencies"), + AH_PREDEF ("_DGS", "Display Graphics State", "Return the current state of the output device"), + AH_PREDEF ("_DIS", "Disable Device", "Disables a device"), + AH_PREDEF ("_DLM", "Device Lock Mutex", "Defines mutex for OS/AML sharing"), + AH_PREDEF ("_DMA", "Direct Memory Access", "Returns a device's current resources for DMA transactions"), + AH_PREDEF ("_DOD", "Display Output Devices", "Enumerate all devices attached to the display adapter"), + AH_PREDEF ("_DOS", "Disable Output Switching", "Sets the display output switching mode"), + AH_PREDEF ("_DPL", "Device Selection Polarity", "Polarity of Device Selection signal, Resource Descriptor field"), + AH_PREDEF ("_DRS", "Drive Strength", "Drive Strength setting for GPIO connection, Resource Descriptor field"), + AH_PREDEF ("_DSM", "Device-Specific Method", "Executes device-specific functions"), + AH_PREDEF ("_DSS", "Device Set State", "Sets the display device state"), + AH_PREDEF ("_DSW", "Device Sleep Wake", "Sets the sleep and wake transition states for a device"), + AH_PREDEF ("_DTI", "Device Temperature Indication", "Conveys native device temperature to the platform"), + AH_PREDEF ("_Exx", "Edge-Triggered GPE", "Method executed as a result of a general-purpose event"), + AH_PREDEF ("_EC_", "Embedded Controller", "returns EC offset and query information"), + AH_PREDEF ("_EDL", "Eject Device List", "Returns a list of devices that are dependent on a device (docking)"), + AH_PREDEF ("_EJD", "Ejection Dependent Device", "Returns the name of dependent (parent) device (docking)"), + AH_PREDEF ("_EJx", "Eject Device", "Begin or cancel a device ejection request (docking)"), + AH_PREDEF ("_END", "Endianness", "Endian orientation, Resource Descriptor field"), + AH_PREDEF ("_EVT", "Event", "Event method for GPIO events"), + AH_PREDEF ("_FDE", "Floppy Disk Enumerate", "Returns floppy disk configuration information"), + AH_PREDEF ("_FDI", "Floppy Drive Information", "Returns a floppy drive information block"), + AH_PREDEF ("_FDM", "Floppy Drive Mode", "Sets a floppy drive speed"), + AH_PREDEF ("_FIF", "Fan Information", "Returns fan device information"), + AH_PREDEF ("_FIX", "Fixed Register Resource Provider", "Returns a list of devices that implement FADT register blocks"), + AH_PREDEF ("_FLC", "Flow Control", "Flow control, Resource Descriptor field"), + AH_PREDEF ("_FPS", "Fan Performance States", "Returns a list of supported fan performance states"), + AH_PREDEF ("_FSL", "Fan Set Level", "Control method that sets the fan device's speed level (performance state)"), + AH_PREDEF ("_FST", "Fan Status", "Returns current status information for a fan device"), + AH_PREDEF ("_GAI", "Get Averaging Interval", "Returns the power meter averaging interval"), + AH_PREDEF ("_GCP", "Get Capabilities", "Get device time capabilities"), + AH_PREDEF ("_GHL", "Get Hardware Limit", "Returns the hardware limit enforced by the power meter"), + AH_PREDEF ("_GL_", "Global Lock", "OS-defined Global Lock mutex object"), + AH_PREDEF ("_GLK", "Get Global Lock Requirement", "Returns a device's Global Lock requirement for device access"), + AH_PREDEF ("_GPD", "Get Post Data", "Returns the value of the VGA device that will be posted at boot"), + AH_PREDEF ("_GPE", "General Purpose Events", "Predefined scope (\\_GPE) or SCI number for EC"), + AH_PREDEF ("_GRA", "Granularity", "Address space granularity, Resource Descriptor field"), + AH_PREDEF ("_GRT", "Get Real Time", "Returns current time-of-day from a time/alarm device"), + AH_PREDEF ("_GSB", "Global System Interrupt Base", "Returns the GSB for a I/O APIC device"), + AH_PREDEF ("_GTF", "Get Task File", "Returns a list of ATA commands to restore a drive to default state"), + AH_PREDEF ("_GTM", "Get Timing Mode", "Returns a list of IDE controller timing information"), + AH_PREDEF ("_GTS", "Going To Sleep", "Inform AML of pending sleep"), + AH_PREDEF ("_GWS", "Get Wake Status", "Return status of wake alarms"), + AH_PREDEF ("_HE_", "High-Edge", "Interrupt triggering, Resource Descriptor field"), + AH_PREDEF ("_HID", "Hardware ID", "Returns a device's Plug and Play Hardware ID"), + AH_PREDEF ("_HOT", "Hot Temperature", "Returns the critical temperature for sleep (entry to S4)"), + AH_PREDEF ("_HPP", "Hot Plug Parameters", "Returns a list of hot-plug information for a PCI device"), + AH_PREDEF ("_HPX", "Hot Plug Parameter Extensions", "Returns a list of hot-plug information for a PCI device. Supersedes _HPP"), + AH_PREDEF ("_HRV", "Hardware Revision", "Returns a hardware revision value"), + AH_PREDEF ("_IFT", "IPMI Interface Type", "See the Intelligent Platform Management Interface Specification"), + AH_PREDEF ("_INI", "Initialize", "Performs device specific initialization"), + AH_PREDEF ("_INT", "Interrupts", "Interrupt mask bits, Resource Descriptor field"), + AH_PREDEF ("_IOR", "I/O Restriction", "Restriction type, Resource Descriptor field"), + AH_PREDEF ("_IRC", "Inrush Current", "Presence indicates that a device has a significant inrush current draw"), + AH_PREDEF ("_Lxx", "Level-Triggered GPE", "Control method executed as a result of a general-purpose event"), + AH_PREDEF ("_LCK", "Lock Device", "Locks or unlocks a device (docking)"), + AH_PREDEF ("_LEN", "Length", "Range length, Resource Descriptor field"), + AH_PREDEF ("_LID", "Lid Status", "Returns the open/closed status of the lid on a mobile system"), + AH_PREDEF ("_LIN", "Lines In Use", "Handshake lines, Resource Descriptor field"), + AH_PREDEF ("_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"), + AH_PREDEF ("_MAF", "Maximum Address Fixed", "Resource Descriptor field"), + AH_PREDEF ("_MAT", "Multiple APIC Table Entry", "Returns a list of MADT APIC structure entries"), + AH_PREDEF ("_MAX", "Maximum Base Address", "Resource Descriptor field"), + AH_PREDEF ("_MBM", "Memory Bandwidth Monitoring Data", "Returns bandwidth monitoring data for a memory device"), + AH_PREDEF ("_MEM", "Memory Attributes", "Resource Descriptor field"), + AH_PREDEF ("_MIF", "Minimum Address Fixed", "Resource Descriptor field"), + AH_PREDEF ("_MIN", "Minimum Base Address", "Resource Descriptor field"), + AH_PREDEF ("_MLS", "Multiple Language String", "Returns a device description in multiple languages"), + AH_PREDEF ("_MOD", "Mode", "Interrupt mode, Resource Descriptor field"), + AH_PREDEF ("_MSG", "Message", "Sets the system message waiting status indicator"), + AH_PREDEF ("_MSM", "Memory Set Monitoring", "Sets bandwidth monitoring parameters for a memory device"), + AH_PREDEF ("_MTP", "Memory Type", "Resource Descriptor field"), + AH_PREDEF ("_NTT", "Notification Temperature Threshold", "Returns a threshold for device temperature change that requires platform notification"), + AH_PREDEF ("_OFF", "Power Off", "Sets a power resource to the off state"), + AH_PREDEF ("_ON_", "Power On", "Sets a power resource to the on state"), + AH_PREDEF ("_OS_", "Operating System", "Returns a string that identifies the operating system"), + AH_PREDEF ("_OSC", "Operating System Capabilities", "Inform AML of host features and capabilities"), + AH_PREDEF ("_OSI", "Operating System Interfaces", "Returns supported interfaces, behaviors, and features"), + AH_PREDEF ("_OST", "OSPM Status Indication", "Inform AML of event processing status"), + AH_PREDEF ("_PAI", "Power Averaging Interval", "Sets the averaging interval for a power meter"), + AH_PREDEF ("_PAR", "Parity", "Parity bits, Resource Descriptor field"), + AH_PREDEF ("_PCL", "Power Consumer List", "Returns a list of devices powered by a power source"), + AH_PREDEF ("_PCT", "Performance Control", "Returns processor performance control and status registers"), + AH_PREDEF ("_PDC", "Processor Driver Capabilities", "Inform AML of processor driver capabilities"), + AH_PREDEF ("_PDL", "P-state Depth Limit", "Returns the lowest available performance P-state"), + AH_PREDEF ("_PHA", "Clock Phase", "Clock phase, Resource Descriptor field"), + AH_PREDEF ("_PIC", "Interrupt Model", "Inform AML of the interrupt model in use"), + AH_PREDEF ("_PIF", "Power Source Information", "Returns a Power Source information block"), + AH_PREDEF ("_PIN", "Pin List", "Pin list, Resource Descriptor field"), + AH_PREDEF ("_PLD", "Physical Device Location", "Returns a device's physical location information"), + AH_PREDEF ("_PMC", "Power Meter Capabilities", "Returns a list of Power Meter capabilities info"), + AH_PREDEF ("_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"), + AH_PREDEF ("_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"), + AH_PREDEF ("_POL", "Polarity", "Interrupt polarity, Resource Descriptor field"), + AH_PREDEF ("_PPC", "Performance Present Capabilites", "Returns a list of the performance states currently supported by the platform"), + AH_PREDEF ("_PPE", "Polling for Platform Error", "Returns the polling interval to retrieve Corrected Platform Error information"), + AH_PREDEF ("_PPI", "Pin Configuration", "Resource Descriptor field"), + AH_PREDEF ("_PR", "Processor", "Predefined scope for processor objects"), + AH_PREDEF ("_PR0", "Power Resources for D0", "Returns a list of dependent power resources to enter state D0 (fully on)"), + AH_PREDEF ("_PR1", "Power Resources for D1", "Returns a list of dependent power resources to enter state D1"), + AH_PREDEF ("_PR2", "Power Resources for D2", "Returns a list of dependent power resources to enter state D2"), + AH_PREDEF ("_PR3", "Power Resources for D3hot", "Returns a list of dependent power resources to enter state D3hot"), + AH_PREDEF ("_PRE", "Power Resources for Enumeration", "Returns a list of dependent power resources to enumerate devices on a bus"), + AH_PREDEF ("_PRL", "Power Source Redundancy List", "Returns a list of power source devices in the same redundancy grouping"), + AH_PREDEF ("_PRS", "Possible Resource Settings", "Returns a list of a device's possible resource settings"), + AH_PREDEF ("_PRT", "PCI Routing Table", "Returns a list of PCI interrupt mappings"), + AH_PREDEF ("_PRW", "Power Resources for Wake", "Returns a list of dependent power resources for waking"), + AH_PREDEF ("_PS0", "Power State 0", "Sets a device's power state to D0 (device fully on)"), + AH_PREDEF ("_PS1", "Power State 1", "Sets a device's power state to D1"), + AH_PREDEF ("_PS2", "Power State 2", "Sets a device's power state to D2"), + AH_PREDEF ("_PS3", "Power State 3", "Sets a device's power state to D3 (device off)"), + AH_PREDEF ("_PSC", "Power State Current", "Returns a device's current power state"), + AH_PREDEF ("_PSD", "Power State Dependencies", "Returns processor P-State dependencies"), + AH_PREDEF ("_PSE", "Power State for Enumeration", "Put a bus into enumeration power mode"), + AH_PREDEF ("_PSL", "Passive List", "Returns a list of passive cooling device objects"), + AH_PREDEF ("_PSR", "Power Source", "Returns the power source device currently in use"), + AH_PREDEF ("_PSS", "Performance Supported States", "Returns a list of supported processor performance states"), + AH_PREDEF ("_PSV", "Passive Temperature", "Returns the passive trip point temperature"), + AH_PREDEF ("_PSW", "Power State Wake", "Sets a device's wake function"), + AH_PREDEF ("_PTC", "Processor Throttling Control", "Returns throttling control and status registers"), + AH_PREDEF ("_PTP", "Power Trip Points", "Sets trip points for the Power Meter device"), + AH_PREDEF ("_PTS", "Prepare To Sleep", "Inform the platform of an impending sleep transition"), + AH_PREDEF ("_PUR", "Processor Utilization Request", "Returns the number of processors that the platform would like to idle"), + AH_PREDEF ("_PXM", "Device Proximity", "Returns a device's proximity domain identifier"), + AH_PREDEF ("_Qxx", "EC Query", "Embedded Controller query and SMBus Alarm control method"), + AH_PREDEF ("_RBO", "Register Bit Offset", "Resource Descriptor field"), + AH_PREDEF ("_RBW", "Register Bit Width", "Resource Descriptor field"), + AH_PREDEF ("_REG", "Region Availability", "Inform AML code of an operation region availability change"), + AH_PREDEF ("_REV", "Supported ACPI Revision", "Returns the revision of the ACPI specification that is implemented"), + AH_PREDEF ("_RMV", "Removal Status", "Returns a device's removal ability status (docking)"), + AH_PREDEF ("_RNG", "Range", "Memory range type, Resource Descriptor field"), + AH_PREDEF ("_ROM", "Read-Only Memory", "Returns a copy of the ROM data for a display device"), + AH_PREDEF ("_RT_", "Resource Type", "Resource Descriptor field"), + AH_PREDEF ("_RTV", "Relative Temperature Values", "Returns temperature value information"), + AH_PREDEF ("_RW_", "Read-Write Status", "Resource Descriptor field"), + AH_PREDEF ("_RXL", "Receive Buffer Size", "Serial channel buffer, Resource Descriptor field"), + AH_PREDEF ("_S0_", "S0 System State", "Returns values to enter the system into the S0 state"), + AH_PREDEF ("_S1_", "S1 System State", "Returns values to enter the system into the S1 state"), + AH_PREDEF ("_S2_", "S2 System State", "Returns values to enter the system into the S2 state"), + AH_PREDEF ("_S3_", "S3 System State", "Returns values to enter the system into the S3 state"), + AH_PREDEF ("_S4_", "S4 System State", "Returns values to enter the system into the S4 state"), + AH_PREDEF ("_S5_", "S5 System State", "Returns values to enter the system into the S5 state"), + AH_PREDEF ("_S1D", "S1 Device State", "Returns the highest D-state supported by a device when in the S1 state"), + AH_PREDEF ("_S2D", "S2 Device State", "Returns the highest D-state supported by a device when in the S2 state"), + AH_PREDEF ("_S3D", "S3 Device State", "Returns the highest D-state supported by a device when in the S3 state"), + AH_PREDEF ("_S4D", "S4 Device State", "Returns the highest D-state supported by a device when in the S4 state"), + AH_PREDEF ("_S0W", "S0 Device Wake State", "Returns the lowest D-state that the device can wake itself from S0"), + AH_PREDEF ("_S1W", "S1 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S1"), + AH_PREDEF ("_S2W", "S2 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S2"), + AH_PREDEF ("_S3W", "S3 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S3"), + AH_PREDEF ("_S4W", "S4 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S4"), + AH_PREDEF ("_SB_", "System Bus", "Predefined scope for device and bus objects"), + AH_PREDEF ("_SBS", "Smart Battery Subsystem", "Returns the subsystem configuration"), + AH_PREDEF ("_SCP", "Set Cooling Policy", "Sets the cooling policy (active or passive)"), + AH_PREDEF ("_SDD", "Set Device Data", "Sets data for a SATA device"), + AH_PREDEF ("_SEG", "PCI Segment", "Returns a device's PCI Segment Group number"), + AH_PREDEF ("_SHL", "Set Hardware Limit", "Sets the hardware limit enforced by the Power Meter"), + AH_PREDEF ("_SHR", "Sharable", "Interrupt share status, Resource Descriptor field"), + AH_PREDEF ("_SI_", "System Indicators", "Predefined scope"), + AH_PREDEF ("_SIZ", "Size", "DMA transfer size, Resource Descriptor field"), + AH_PREDEF ("_SLI", "System Locality Information", "Returns a list of NUMA system localities"), + AH_PREDEF ("_SLV", "Slave Mode", "Mode setting, Resource Descriptor field"), + AH_PREDEF ("_SPD", "Set Post Device", "Sets which video device will be posted at boot"), + AH_PREDEF ("_SPE", "Speed", "Connection speed, Resource Descriptor field"), + AH_PREDEF ("_SRS", "Set Resource Settings", "Sets a device's resource allocation"), + AH_PREDEF ("_SRT", "Set Real Time", "Sets the current time for a time/alarm device"), + AH_PREDEF ("_SRV", "IPMI Spec Revision", "See the Intelligent Platform Management Interface Specification"), + AH_PREDEF ("_SST", "System Status", "Sets the system status indicator"), + AH_PREDEF ("_STA", "Status", "Returns the current status of a Device or Power Resource"), + AH_PREDEF ("_STB", "Stop Bits", "Serial channel stop bits, Resource Descriptor field"), + AH_PREDEF ("_STM", "Set Timing Mode", "Sets an IDE controller transfer timings"), + AH_PREDEF ("_STP", "Set Expired Timer Wake Policy", "Sets expired timer policies of the wake alarm device"), + AH_PREDEF ("_STR", "Description String", "Returns a device's description string"), + AH_PREDEF ("_STV", "Set Timer Value", "Set timer values of the wake alarm device"), + AH_PREDEF ("_SUB", "Subsystem ID", "Returns the subsystem ID for a device"), + AH_PREDEF ("_SUN", "Slot User Number", "Returns the slot unique ID number"), + AH_PREDEF ("_SWS", "System Wake Source", "Returns the source event that caused the system to wake"), + AH_PREDEF ("_T_x", "Emitted by ASL Compiler", "Reserved for use by ASL compilers"), + AH_PREDEF ("_TC1", "Thermal Constant 1", "Returns TC1 for the passive cooling formula"), + AH_PREDEF ("_TC2", "Thermal Constant 2", "Returns TC2 for the passive cooling formula"), + AH_PREDEF ("_TDL", "T-State Depth Limit", "Returns the _TSS entry number of the lowest power throttling state"), + AH_PREDEF ("_TIP", "Expired Timer Wake Policy", "Returns timer policies of the wake alarm device"), + AH_PREDEF ("_TIV", "Timer Values", "Returns remaining time of the wake alarm device"), + AH_PREDEF ("_TMP", "Temperature", "Returns a thermal zone's current temperature"), + AH_PREDEF ("_TPC", "Throttling Present Capabilities", "Returns the current number of supported throttling states"), + AH_PREDEF ("_TPT", "Trip Point Temperature", "Inform AML that a device's embedded temperature sensor has crossed a temperature trip point"), + AH_PREDEF ("_TRA", "Translation", "Address translation offset, Resource Descriptor field"), + AH_PREDEF ("_TRS", "Translation Sparse", "Sparse/dense flag, Resource Descriptor field"), + AH_PREDEF ("_TRT", "Thermal Relationship Table", "Returns thermal relationships between platform devices"), + AH_PREDEF ("_TSD", "Throttling State Dependencies", "Returns a list of T-state dependencies"), + AH_PREDEF ("_TSF", "Type-Specific Flags", "Resource Descriptor field"), + AH_PREDEF ("_TSP", "Thermal Sampling Period", "Returns the thermal sampling period for passive cooling"), + AH_PREDEF ("_TSS", "Throttling Supported States", "Returns supported throttling state information"), + AH_PREDEF ("_TST", "Temperature Sensor Threshold", "Returns the minimum separation for a device's temperature trip points"), + AH_PREDEF ("_TTP", "Translation Type", "Translation/static flag, Resource Descriptor field"), + AH_PREDEF ("_TTS", "Transition To State", "Inform AML of an S-state transition"), + AH_PREDEF ("_TXL", "Transmit Buffer Size", "Serial Channel buffer, Resource Descriptor field"), + AH_PREDEF ("_TYP", "Type", "DMA channel type (speed), Resource Descriptor field"), + AH_PREDEF ("_TZ_", "Thermal Zone", "Predefined scope: ACPI 1.0"), + AH_PREDEF ("_TZD", "Thermal Zone Devices", "Returns a list of device names associated with a Thermal Zone"), + AH_PREDEF ("_TZM", "Thermal Zone Member", "Returns a reference to the thermal zone of which a device is a member"), + AH_PREDEF ("_TZP", "Thermal Zone Polling", "Returns a Thermal zone's polling frequency"), + AH_PREDEF ("_UID", "Unique ID", "Return a device's unique persistent ID"), + AH_PREDEF ("_UPC", "USB Port Capabilities", "Returns a list of USB port capabilities"), + AH_PREDEF ("_UPD", "User Presence Detect", "Returns user detection information"), + AH_PREDEF ("_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"), + AH_PREDEF ("_VEN", "Vendor Data", "Resource Descriptor field"), + AH_PREDEF ("_VPO", "Video Post Options", "Returns the implemented video post options"), + AH_PREDEF ("_WAK", "Wake", "Inform AML that the system has just awakened"), + AH_PREDEF ("_Wxx", "Wake Event", "Method executed as a result of a wake event"), + AH_PREDEF (NULL, NULL, NULL) +}; Modified: vendor-sys/acpica/dist/source/common/dmextern.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmextern.c Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/common/dmextern.c Wed Jun 20 17:51:04 2012 (r237332) @@ -221,8 +221,10 @@ AcpiDmNormalizeParentPrefix ( */ ACPI_STRCAT (Fullpath, ParentPath); - /* Add dot separator (don't need dot if parent fullpath is a single "\") */ - + /* + * Add dot separator + * (don't need dot if parent fullpath is a single backslash) + */ if (ParentPath[1]) { ACPI_STRCAT (Fullpath, "."); Modified: vendor-sys/acpica/dist/source/common/dmrestag.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmrestag.c Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/common/dmrestag.c Wed Jun 20 17:51:04 2012 (r237332) @@ -73,6 +73,7 @@ AcpiDmGetResourceTag ( static char * AcpiGetTagPathname ( + ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *BufferNode, ACPI_NAMESPACE_NODE *ResourceNode, UINT32 BitIndex); @@ -443,7 +444,6 @@ AcpiDmCheckResourceReference ( ACPI_NAMESPACE_NODE *BufferNode; ACPI_NAMESPACE_NODE *ResourceNode; const ACPI_OPCODE_INFO *OpInfo; - char *Pathname; UINT32 BitIndex; @@ -519,14 +519,7 @@ AcpiDmCheckResourceReference ( /* Translate the Index to a resource tag pathname */ - Pathname = AcpiGetTagPathname (BufferNode, ResourceNode, BitIndex); - if (Pathname) - { - /* Complete the conversion of the Index to a symbol */ - - IndexOp->Common.AmlOpcode = AML_INT_NAMEPATH_OP; - IndexOp->Common.Value.String = Pathname; - } + AcpiGetTagPathname (IndexOp, BufferNode, ResourceNode, BitIndex); } @@ -597,6 +590,7 @@ AcpiDmGetResourceNode ( static char * AcpiGetTagPathname ( + ACPI_PARSE_OBJECT *IndexOp, ACPI_NAMESPACE_NODE *BufferNode, ACPI_NAMESPACE_NODE *ResourceNode, UINT32 BitIndex) @@ -689,6 +683,15 @@ AcpiGetTagPathname ( AcpiNsInternalizeName (Pathname, &InternalPath); ACPI_FREE (Pathname); + + /* Update the Op with the symbol */ + + AcpiPsInitOp (IndexOp, AML_INT_NAMEPATH_OP); + IndexOp->Common.Value.String = InternalPath; + + /* We will need the tag later. Cheat by putting it in the Node field */ + + IndexOp->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Tag); return (InternalPath); } Modified: vendor-sys/acpica/dist/source/compiler/Makefile ============================================================================== --- vendor-sys/acpica/dist/source/compiler/Makefile Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/compiler/Makefile Wed Jun 20 17:51:04 2012 (r237332) @@ -77,6 +77,7 @@ OBJECTS = \ adfile.o \ adisasm.o \ adwalk.o \ + ahpredef.o \ aslanalyze.o \ aslbtypes.o \ aslcodegen.o \ Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompile.c Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Wed Jun 20 17:51:04 2012 (r237332) @@ -67,6 +67,10 @@ FlConsumeNewComment ( FILE *Handle, ASL_FILE_STATUS *Status); +static void +CmDumpAllEvents ( + void); + /******************************************************************************* * @@ -717,45 +721,65 @@ CmDoOutputFiles ( /******************************************************************************* * - * FUNCTION: CmDumpEvent + * FUNCTION: CmDumpAllEvents * - * PARAMETERS: Event - A compiler event struct + * PARAMETERS: None * * RETURN: None. * - * DESCRIPTION: Dump a compiler event struct + * DESCRIPTION: Dump all compiler events * ******************************************************************************/ static void -CmDumpEvent ( - ASL_EVENT_INFO *Event) +CmDumpAllEvents ( + void) { + ASL_EVENT_INFO *Event; UINT32 Delta; UINT32 USec; UINT32 MSec; + UINT32 i; + - if (!Event->Valid) + Event = AslGbl_Events; + + DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); + if (Gbl_CompileTimesFlag) { - return; + printf ("\nElapsed time for major events\n\n"); } - /* Delta will be in 100-nanosecond units */ + for (i = 0; i < AslGbl_NextEvent; i++) + { + if (Event->Valid) + { + /* Delta will be in 100-nanosecond units */ - Delta = (UINT32) (Event->EndTime - Event->StartTime); + Delta = (UINT32) (Event->EndTime - Event->StartTime); - USec = Delta / 10; - MSec = Delta / 10000; + USec = Delta / 10; + MSec = Delta / 10000; - /* Round milliseconds up */ + /* Round milliseconds up */ - if ((USec - (MSec * 1000)) >= 500) - { - MSec++; - } + if ((USec - (MSec * 1000)) >= 500) + { + MSec++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", + USec, MSec, Event->EventName); + + if (Gbl_CompileTimesFlag) + { + printf ("%8u usec %8u msec - %s\n", + USec, MSec, Event->EventName); + } + } - DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", - USec, MSec, Event->EventName); + Event++; + } } @@ -786,20 +810,12 @@ CmCleanupAndExit ( AePrintErrorLog (ASL_FILE_STDOUT); } - DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } + /* Emit compile times if enabled */ + + CmDumpAllEvents (); if (Gbl_CompileTimesFlag) { - printf ("\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } - printf ("\nMiscellaneous compile statistics\n\n"); printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); Modified: vendor-sys/acpica/dist/source/compiler/aslerror.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslerror.c Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/compiler/aslerror.c Wed Jun 20 17:51:04 2012 (r237332) @@ -341,7 +341,7 @@ AePrintException ( if (Gbl_VerboseErrors) { - fprintf (OutputFile, "%s %4.4d - ", + fprintf (OutputFile, "%s %4.4d -", AslErrorLevel[Enode->Level], Enode->MessageId + ((Enode->Level+1) * 1000)); } Modified: vendor-sys/acpica/dist/source/compiler/aslfiles.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfiles.c Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/compiler/aslfiles.c Wed Jun 20 17:51:04 2012 (r237332) @@ -754,7 +754,7 @@ FlOpenInputFile ( /* Open the input ASL file, text mode */ - FlOpenFile (ASL_FILE_INPUT, InputFilename, "r"); + FlOpenFile (ASL_FILE_INPUT, InputFilename, "rt"); AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; return (AE_OK); @@ -838,7 +838,7 @@ FlOpenMiscOutputFiles ( /* Open the hex file, text mode */ - FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_HEX_OUTPUT); AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT); @@ -889,7 +889,7 @@ FlOpenMiscOutputFiles ( /* Open the listing file, text mode */ - FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_LISTING_OUTPUT); AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); @@ -907,7 +907,7 @@ FlOpenMiscOutputFiles ( return (AE_ERROR); } - FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b"); + FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+t"); } /* All done for data table compiler */ @@ -952,7 +952,7 @@ FlOpenMiscOutputFiles ( /* Open the assembly code source file, text mode */ - FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT); AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT); @@ -972,7 +972,7 @@ FlOpenMiscOutputFiles ( /* Open the C code source file, text mode */ - FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+t"); FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n"); AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT); @@ -993,7 +993,7 @@ FlOpenMiscOutputFiles ( /* Open the assembly include file, text mode */ - FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT); AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT); @@ -1013,7 +1013,7 @@ FlOpenMiscOutputFiles ( /* Open the C include file, text mode */ - FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+t"); FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n"); AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT); @@ -1034,7 +1034,7 @@ FlOpenMiscOutputFiles ( /* Open the namespace file, text mode */ - FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT); AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); Modified: vendor-sys/acpica/dist/source/compiler/asllookup.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asllookup.c Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/compiler/asllookup.c Wed Jun 20 17:51:04 2012 (r237332) @@ -1098,7 +1098,7 @@ LkNamespaceLocateBegin ( if (Message) { - sprintf (MsgBuffer, "Tag: %u bit%s, Field: %u bit%s", + sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s", TagBitLength, (TagBitLength > 1) ? "s" : "", FieldBitLength, (FieldBitLength > 1) ? "s" : ""); Modified: vendor-sys/acpica/dist/source/compiler/aslmain.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmain.c Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/compiler/aslmain.c Wed Jun 20 17:51:04 2012 (r237332) @@ -63,7 +63,7 @@ Options ( void); static void -HelpMessage ( +FilenameHelp ( void); static void @@ -170,27 +170,36 @@ Options ( ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); printf ("\nHelp:\n"); - ACPI_OPTION ("-h", "Additional help and compiler debug options"); + ACPI_OPTION ("-h", "This message"); ACPI_OPTION ("-hc", "Display operators allowed in constant expressions"); + ACPI_OPTION ("-hf", "Display help for output filename generation"); ACPI_OPTION ("-hr", "Display ACPI reserved method names"); ACPI_OPTION ("-ht", "Display currently supported ACPI table names"); + + printf ("\nDebug Options:\n"); + ACPI_OPTION ("-bf -bt", "Create debug file (full or parse tree only) (*.txt)"); + ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); + ACPI_OPTION ("-n", "Parse only, no output generation"); + ACPI_OPTION ("-ot", "Display compile times and statistics"); + ACPI_OPTION ("-x ", "Set debug level for trace output"); + ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } /******************************************************************************* * - * FUNCTION: HelpMessage + * FUNCTION: FilenameHelp * * PARAMETERS: None * * RETURN: None * - * DESCRIPTION: Display help message + * DESCRIPTION: Display help message for output filename generation * ******************************************************************************/ static void -HelpMessage ( +FilenameHelp ( void) { @@ -202,17 +211,6 @@ HelpMessage ( printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); printf (" 3) The prefix of the input filename\n"); printf ("\n"); - - Options (); - - printf ("\nCompiler/Disassembler Debug Options:\n"); - ACPI_OPTION ("-bb -bp -bt", "Create compiler debug/trace file (*.txt)"); - ACPI_OPTION ("", "Types: Parse/Tree/Both"); - ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); - ACPI_OPTION ("-n", "Parse only, no output generation"); - ACPI_OPTION ("-ot", "Display compile times"); - ACPI_OPTION ("-x ", "Set debug level for trace output"); - ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } @@ -430,13 +428,7 @@ AslDoOptions ( case 'b': /* Debug output options */ switch (AcpiGbl_Optarg[0]) { - case 'b': - AslCompilerdebug = 1; /* same as yydebug */ - DtParserdebug = 1; - PrParserdebug = 1; - break; - - case 'p': + case 'f': AslCompilerdebug = 1; /* same as yydebug */ DtParserdebug = 1; PrParserdebug = 1; @@ -530,13 +522,17 @@ AslDoOptions ( switch (AcpiGbl_Optarg[0]) { case '^': - HelpMessage (); + Usage (); exit (0); case 'c': UtDisplayConstantOpcodes (); exit (0); + case 'f': + FilenameHelp (); + exit (0); + case 'r': /* reserved names */ Modified: vendor-sys/acpica/dist/source/compiler/aslsupport.l ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslsupport.l Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/compiler/aslsupport.l Wed Jun 20 17:51:04 2012 (r237332) @@ -92,19 +92,23 @@ static void AslDoLineDirective ( void) { - char c; + UINT8 c; char *Token; UINT32 LineNumber; char *Filename; + UINT32 i; /* Eat the entire line that contains the #line directive */ - while ((c = (char) input()) != '\n' && c != EOF) + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + + while ((c = (UINT8) input()) != '\n' && c != EOF) { - AslInsertLineBuffer (c); + *Gbl_LineBufPtr = c; + Gbl_LineBufPtr++; } - AslInsertLineBuffer (0); + *Gbl_LineBufPtr = 0; /* First argument is the actual line number */ @@ -114,10 +118,23 @@ AslDoLineDirective ( goto ResetAndExit; } - /* Convert line number. Subtract one to handle _this_ line */ + /* First argument is the line number */ LineNumber = (UINT32) UtDoConstant (Token); - FlSetLineNumber (LineNumber - 1); + + /* Emit the appropriate number of newlines */ + + Gbl_CurrentColumn = 0; + if (LineNumber > Gbl_CurrentLineNumber) + { + for (i = 0; i < (LineNumber - Gbl_CurrentLineNumber); i++) + { + FlWriteFile (ASL_FILE_SOURCE_OUTPUT, "\n", 1); + Gbl_CurrentColumn++; + } + } + + FlSetLineNumber (LineNumber); /* Second argument is the optional filename (in double quotes) */ @@ -132,7 +149,12 @@ AslDoLineDirective ( /* Third argument is not supported at this time */ ResetAndExit: - AslResetCurrentLineBuffer (); + + /* Reset globals for a new line */ + + Gbl_CurrentLineOffset += Gbl_CurrentColumn; + Gbl_CurrentColumn = 0; + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; } Modified: vendor-sys/acpica/dist/source/compiler/aslutils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslutils.c Wed Jun 20 17:45:53 2012 (r237331) +++ vendor-sys/acpica/dist/source/compiler/aslutils.c Wed Jun 20 17:51:04 2012 (r237332) @@ -139,7 +139,7 @@ UtDisplaySupportedTables ( /******************************************************************************* * - * FUNCTION: AcpiPsDisplayConstantOpcodes + * FUNCTION: UtDisplayConstantOpcodes * * PARAMETERS: None * @@ -172,11 +172,11 @@ UtDisplayConstantOpcodes ( * * FUNCTION: UtLocalCalloc * - * PARAMETERS: Size - Bytes to be allocated + * PARAMETERS: Size - Bytes to be allocated * - * RETURN: Pointer to the allocated memory. Guaranteed to be valid. + * RETURN: Pointer to the allocated memory. Guaranteed to be valid. * - * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an + * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an * allocation failure, on the assumption that nothing more can be * accomplished. * @@ -211,9 +211,9 @@ UtLocalCalloc ( * * FUNCTION: UtBeginEvent * - * PARAMETERS: Name - Ascii name of this event + * PARAMETERS: Name - Ascii name of this event * - * RETURN: Event - Event number (integer index) + * RETURN: Event number (integer index) * * DESCRIPTION: Saves the current time with this event * @@ -244,7 +244,7 @@ UtBeginEvent ( * * FUNCTION: UtEndEvent * - * PARAMETERS: Event - Event number (integer index) + * PARAMETERS: Event - Event number (integer index) * * RETURN: None * @@ -254,7 +254,7 @@ UtBeginEvent ( void UtEndEvent ( - UINT8 Event) + UINT8 Event) { if (Event >= ASL_NUM_EVENTS) @@ -272,7 +272,7 @@ UtEndEvent ( * * FUNCTION: UtHexCharToValue * - * PARAMETERS: HexChar - Hex character in Ascii + * PARAMETERS: HexChar - Hex character in Ascii * * RETURN: The binary value of the hex character * @@ -303,12 +303,13 @@ UtHexCharToValue ( * * FUNCTION: UtConvertByteToHex * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored + * PARAMETERS: RawByte - Binary data + * Buffer - Pointer to where the hex bytes will be + * stored * * RETURN: Ascii hex byte is stored in Buffer. * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed * with "0x" * ******************************************************************************/ @@ -331,12 +332,13 @@ UtConvertByteToHex ( * * FUNCTION: UtConvertByteToAsmHex * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored + * PARAMETERS: RawByte - Binary data + * Buffer - Pointer to where the hex bytes will be + * stored * * RETURN: Ascii hex byte is stored in Buffer. * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed * with "0x" * ******************************************************************************/ @@ -358,13 +360,13 @@ UtConvertByteToAsmHex ( * * FUNCTION: DbgPrint * - * PARAMETERS: Type - Type of output - * Fmt - Printf format string - * ... - variable printf list + * PARAMETERS: Type - Type of output + * Fmt - Printf format string + * ... - variable printf list * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 17:52:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D077E106566B; Wed, 20 Jun 2012 17:52:21 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A26F18FC19; Wed, 20 Jun 2012 17:52:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KHqLCc058702; Wed, 20 Jun 2012 17:52:21 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KHqLUq058701; Wed, 20 Jun 2012 17:52:21 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206201752.q5KHqLUq058701@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 20 Jun 2012 17:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237333 - vendor-sys/acpica/20120620 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 17:52:21 -0000 Author: jkim Date: Wed Jun 20 17:52:21 2012 New Revision: 237333 URL: http://svn.freebsd.org/changeset/base/237333 Log: Tag ACPICA 20120620. Added: vendor-sys/acpica/20120620/ - copied from r237332, vendor-sys/acpica/dist/ From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 18:00:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F8E7106566C; Wed, 20 Jun 2012 18:00:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B7B28FC08; Wed, 20 Jun 2012 18:00:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KI0QMT059136; Wed, 20 Jun 2012 18:00:26 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KI0QQf059134; Wed, 20 Jun 2012 18:00:26 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206201800.q5KI0QQf059134@svn.freebsd.org> From: John Baldwin Date: Wed, 20 Jun 2012 18:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237334 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 18:00:27 -0000 Author: jhb Date: Wed Jun 20 18:00:26 2012 New Revision: 237334 URL: http://svn.freebsd.org/changeset/base/237334 Log: Move the per-thread deferred user map entries list into a private list in vm_map_process_deferred() which is then iterated to release map entries. This avoids having a nested vm map unlock operation called from the loop body attempt to recuse into vm_map_process_deferred(). This can happen if the vm_map_remove() triggers the OOM killer. Reviewed by: alc, kib MFC after: 1 week Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed Jun 20 17:52:21 2012 (r237333) +++ head/sys/vm/vm_map.c Wed Jun 20 18:00:26 2012 (r237334) @@ -475,12 +475,14 @@ static void vm_map_process_deferred(void) { struct thread *td; - vm_map_entry_t entry; + vm_map_entry_t entry, next; vm_object_t object; td = curthread; - while ((entry = td->td_map_def_user) != NULL) { - td->td_map_def_user = entry->next; + entry = td->td_map_def_user; + td->td_map_def_user = NULL; + while (entry != NULL) { + next = entry->next; if ((entry->eflags & MAP_ENTRY_VN_WRITECNT) != 0) { /* * Decrement the object's writemappings and @@ -494,6 +496,7 @@ vm_map_process_deferred(void) entry->end); } vm_map_entry_deallocate(entry, FALSE); + entry = next; } } From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 18:25:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 431AC106566C; Wed, 20 Jun 2012 18:25:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EC1F8FC23; Wed, 20 Jun 2012 18:25:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KIPqtX060918; Wed, 20 Jun 2012 18:25:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KIPpjQ060916; Wed, 20 Jun 2012 18:25:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201825.q5KIPpjQ060916@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 18:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237335 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 18:25:52 -0000 Author: mav Date: Wed Jun 20 18:25:51 2012 New Revision: 237335 URL: http://svn.freebsd.org/changeset/base/237335 Log: Check status of cam_periph_hold() inside cdclose(). If cd device was invalidated while open, cam_periph_hold() will return error and won't get the reference. Following reference release will crash the system. Sponsored by: iXsystems, Inc. MFC after: 3 days Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:00:26 2012 (r237334) +++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012 (r237335) @@ -1041,6 +1041,7 @@ cdclose(struct disk *dp) { struct cam_periph *periph; struct cd_softc *softc; + int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) @@ -1049,7 +1050,11 @@ cdclose(struct disk *dp) softc = (struct cd_softc *)periph->softc; cam_periph_lock(periph); - cam_periph_hold(periph, PRIBIO); + if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + cam_periph_unlock(periph); + cam_periph_release(periph); + return (0); + } CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("cdclose\n")); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 18:35:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C347E106566C; Wed, 20 Jun 2012 18:35:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF8CC8FC15; Wed, 20 Jun 2012 18:35:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KIZatu061357; Wed, 20 Jun 2012 18:35:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KIZash061354; Wed, 20 Jun 2012 18:35:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206201835.q5KIZash061354@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Jun 2012 18:35:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237336 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 18:35:36 -0000 Author: mav Date: Wed Jun 20 18:35:36 2012 New Revision: 237336 URL: http://svn.freebsd.org/changeset/base/237336 Log: Remove unused error variables in cdclose() and daclose(). Modified: head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012 (r237335) +++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:35:36 2012 (r237336) @@ -1041,7 +1041,6 @@ cdclose(struct disk *dp) { struct cam_periph *periph; struct cd_softc *softc; - int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) @@ -1050,7 +1049,7 @@ cdclose(struct disk *dp) softc = (struct cd_softc *)periph->softc; cam_periph_lock(periph); - if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + if (cam_periph_hold(periph, PRIBIO) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (0); Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Wed Jun 20 18:25:51 2012 (r237335) +++ head/sys/cam/scsi/scsi_da.c Wed Jun 20 18:35:36 2012 (r237336) @@ -982,14 +982,13 @@ daclose(struct disk *dp) { struct cam_periph *periph; struct da_softc *softc; - int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) return (0); cam_periph_lock(periph); - if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + if (cam_periph_hold(periph, PRIBIO) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (0); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 20:01:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 179681065672; Wed, 20 Jun 2012 20:01:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 048D98FC1C; Wed, 20 Jun 2012 20:01:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KK1pJV065041; Wed, 20 Jun 2012 20:01:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KK1pbZ065039; Wed, 20 Jun 2012 20:01:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206202001.q5KK1pbZ065039@svn.freebsd.org> From: John Baldwin Date: Wed, 20 Jun 2012 20:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237337 - head/etc/periodic/daily X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 20:01:52 -0000 Author: jhb Date: Wed Jun 20 20:01:51 2012 New Revision: 237337 URL: http://svn.freebsd.org/changeset/base/237337 Log: Only output a list of file systems that need to be dumped if the system has a non-empty dumpdates file. Reviewed by: brooks MFC after: 1 week Modified: head/etc/periodic/daily/400.status-disks Modified: head/etc/periodic/daily/400.status-disks ============================================================================== --- head/etc/periodic/daily/400.status-disks Wed Jun 20 18:35:36 2012 (r237336) +++ head/etc/periodic/daily/400.status-disks Wed Jun 20 20:01:51 2012 (r237337) @@ -19,12 +19,15 @@ case "$daily_status_disks_enable" in df $daily_status_disks_df_flags && rc=1 || rc=3 # display which filesystems need backing up - if ! [ -f /etc/fstab ]; then - export PATH_FSTAB=/dev/null - fi + if [ -s /etc/dumpdates ]; then + if ! [ -f /etc/fstab ]; then + export PATH_FSTAB=/dev/null + fi - echo "" - dump W || rc=3;; + echo "" + dump W || rc=3 + fi + ;; *) rc=0;; esac From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 20:44:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0A88106566C for ; Wed, 20 Jun 2012 20:44:23 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-gh0-f182.google.com (mail-gh0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3FE348FC0A for ; Wed, 20 Jun 2012 20:44:23 +0000 (UTC) Received: by ghbz22 with SMTP id z22so7051944ghb.13 for ; Wed, 20 Jun 2012 13:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=F8CakRuoZIGcLqsrSs6I4IE4fTc2pk5bGqbb/nY0Dc4=; b=JhzEp/VIfaFFNsxXpOsMuTxATmECvQgMc8IDOqPcqtJxof8Ll7DKgj4oe9x95ZXI52 I370Z7Zv6b1zE4V7hT3o2bQ0E5RlH0VD3+wWmuFHUaZqkT9VAdvuqOGbt+gPJ0gyOJvr MiMsXGGbffdMlSWw9fHUaSvWVci1rnAHpMhk8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=F8CakRuoZIGcLqsrSs6I4IE4fTc2pk5bGqbb/nY0Dc4=; b=L7OZaA6B/D0tLXsA2qKABm3YBy1/CoiQlYdHYvhorjWlyc6gHLb5oVhPFG4wmbKES5 Wg7uhyJ6PLLrSSLDFcSGNeMLrVJi3oAYnxQJAPGZkaoqmBg3jYwMVw24RIOHWEmqCIsA Dya1wd6smeF6W6Hz2ErNA/2XjbT3erTeZzpURNC5TWWKv/+1okbsDtqzpwBYhaKGDTja M5hKm3GSguGxHaWIIIWCI8amXmBl0ASnuxBWvci6UqfmiKFvJ1DIyu+NbGsHdDmjAW3s z+Qef1ONU1LptPO8X1iEMr08ziNb6Q8WDMcHR1BJ0U+FlvvjEOwrPpp+tkf8CpXlOaat Oy5w== Received: by 10.60.14.68 with SMTP id n4mr23092990oec.24.1340225062516; Wed, 20 Jun 2012 13:44:22 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.182.125.70 with HTTP; Wed, 20 Jun 2012 13:43:52 -0700 (PDT) In-Reply-To: <201206201720.q5KHKPq7056951@svn.freebsd.org> References: <201206201720.q5KHKPq7056951@svn.freebsd.org> From: Eitan Adler Date: Wed, 20 Jun 2012 13:43:52 -0700 X-Google-Sender-Auth: J6LFroYC-CPFRNVpEHG7OZNeUWw Message-ID: To: Matt Jacob Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQmJuj/Uw5IpyWWEpkkiKgmiJXrfTvoLorFZDC3OYuhF+iIVZwQmPZuDB/TWYRrdABgKSEiB Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237329 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 20:44:23 -0000 On 20 June 2012 10:20, Matt Jacob wrote: > Author: mjacob > Date: Wed Jun 20 17:20:25 2012 > New Revision: 237329 > URL: http://svn.freebsd.org/changeset/base/237329 > > Log: > =C2=A0Fix ARM compilation issue. > > =C2=A0X-MFC: 237260 Sorry about this. I had a sent a diff for approval, but was at work and unable to deal with it on time. --=20 Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:06:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B8F41065670; Wed, 20 Jun 2012 21:06:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 767B48FC18; Wed, 20 Jun 2012 21:06:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KL6qjc067737; Wed, 20 Jun 2012 21:06:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KL6q2N067734; Wed, 20 Jun 2012 21:06:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206202106.q5KL6q2N067734@svn.freebsd.org> From: John Baldwin Date: Wed, 20 Jun 2012 21:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237338 - head/sys/boot/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:06:52 -0000 Author: jhb Date: Wed Jun 20 21:06:51 2012 New Revision: 237338 URL: http://svn.freebsd.org/changeset/base/237338 Log: Don't return an error if a kld does not contain any modules (e.g. a kld that only contained a sysctl). The kernel linker allows such modules, so the boot loader should not reject them. MFC after: 2 weeks Modified: head/sys/boot/common/load_elf.c head/sys/boot/common/load_elf_obj.c Modified: head/sys/boot/common/load_elf.c ============================================================================== --- head/sys/boot/common/load_elf.c Wed Jun 20 20:01:51 2012 (r237337) +++ head/sys/boot/common/load_elf.c Wed Jun 20 21:06:51 2012 (r237338) @@ -612,7 +612,7 @@ __elfN(parse_modmetadata)(struct preload Elf_Addr v, p, p_stop; if (__elfN(lookup_symbol)(fp, ef, "__start_set_modmetadata_set", &sym) != 0) - return ENOENT; + return 0; p = sym.st_value + ef->off; if (__elfN(lookup_symbol)(fp, ef, "__stop_set_modmetadata_set", &sym) != 0) return ENOENT; Modified: head/sys/boot/common/load_elf_obj.c ============================================================================== --- head/sys/boot/common/load_elf_obj.c Wed Jun 20 20:01:51 2012 (r237337) +++ head/sys/boot/common/load_elf_obj.c Wed Jun 20 21:06:51 2012 (r237338) @@ -369,7 +369,7 @@ __elfN(obj_parse_modmetadata)(struct pre if (__elfN(obj_lookup_set)(fp, ef, "modmetadata_set", &p, &p_stop, &modcnt) != 0) - return ENOENT; + return 0; modcnt = 0; while (p < p_stop) { From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:10:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D1AD31065687; Wed, 20 Jun 2012 21:10:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCBD88FC17; Wed, 20 Jun 2012 21:10:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KLAda5067927; Wed, 20 Jun 2012 21:10:39 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KLAdi6067925; Wed, 20 Jun 2012 21:10:39 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206202110.q5KLAdi6067925@svn.freebsd.org> From: Xin LI Date: Wed, 20 Jun 2012 21:10:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237339 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:10:39 -0000 Author: delphij Date: Wed Jun 20 21:10:38 2012 New Revision: 237339 URL: http://svn.freebsd.org/changeset/base/237339 Log: Polish previous revision: if the fts_* routines have lstat()'ed the directory entry then use the struct stat from that instead of doing it again, and skip the rm_overwrite() call if fts_read() indicated that the entry couldn't be a regular file. Obtained from: OpenBSD MFC after: 1 week Modified: head/bin/rm/rm.c Modified: head/bin/rm/rm.c ============================================================================== --- head/bin/rm/rm.c Wed Jun 20 21:06:51 2012 (r237338) +++ head/bin/rm/rm.c Wed Jun 20 21:10:38 2012 (r237339) @@ -301,10 +301,16 @@ rm_tree(char **argv) if (fflag) continue; /* FALLTHROUGH */ - default: + + case FTS_F: + case FTS_NSOK: if (Pflag) - if (!rm_overwrite(p->fts_accpath, NULL)) + if (!rm_overwrite(p->fts_accpath, p->fts_info == + FTS_NSOK ? NULL : p->fts_statp)) continue; + /* FALLTHROUGH */ + + default: rval = unlink(p->fts_accpath); if (rval == 0 || (fflag && errno == ENOENT)) { if (rval == 0 && vflag) From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:15:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7DA81065678 for ; Wed, 20 Jun 2012 21:15:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 429BD8FC21 for ; Wed, 20 Jun 2012 21:15:26 +0000 (UTC) Received: by dadv36 with SMTP id v36so11266835dad.13 for ; Wed, 20 Jun 2012 14:15:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=n2mAkYYH1H2kamlAz3EniseVJXGHI7N0jq/5RY4zn6o=; b=FDFJx7GSZcTzYjzgnOoD0XskgD0+CV/+hVBCsJ9i1xnxy2LGNK2/5x9QAFpTT0cDID +5jq57OPRKQFAsdT7vSoz7OeCM91YNDpuLzrYC8e8YWiJ9jsILSDooyt0bYOjDCf6Jy8 xzMQMBKPY3OFj1kRorCdvJl+bwuOB9f3wbEAyb0G59dA6hx+LZ/lyb1fSjYtdX1xn536 +HfatBYwGwP56w9R9wvKybH3XGBm8UJVH+ISEJde+iPJzQxLvrRrFfpgn0KHLxOip7eY Z+ckvbcyLyA/tl1Lz4AnJL5+G5NCkpyd5X02PrXbxo5JKLvVwkPP/gut9mEi8HAASN/o Av1A== Received: by 10.68.231.40 with SMTP id td8mr82026057pbc.150.1340226925859; Wed, 20 Jun 2012 14:15:25 -0700 (PDT) Received: from [10.30.101.53] ([209.117.142.2]) by mx.google.com with ESMTPS id he9sm33186270pbc.68.2012.06.20.14.15.24 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 14:15:25 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <4FE1FC23.9000904@freebsd.org> Date: Wed, 20 Jun 2012 15:15:17 -0600 Content-Transfer-Encoding: 7bit Message-Id: <690DF487-F7CB-421E-B6BC-F7CE6BC0F658@bsdimp.com> References: <201206200638.q5K6cg7u024024@svn.freebsd.org> <20120621015220.J2636@besplex.bde.org> <4FE1FC23.9000904@freebsd.org> To: Colin Percival X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQkzmDNk4/O/poyvzqxBZ+X48d6bpAoe4uylneBY3y+vBXc54kqzf53DDMi5f9nIh8YjQze4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler , Bruce Evans Subject: Re: svn commit: r237286 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:15:26 -0000 On Jun 20, 2012, at 10:36 AM, Colin Percival wrote: > On 06/20/12 09:27, Bruce Evans wrote: >> On Wed, 20 Jun 2012, Eitan Adler wrote: >>> Log: >>> Don't close an uninitialized descriptor. [1] >>> Add a sanity check for the validity of the passed fd. >> >> Library functions shouldn't use assert() or abort(). > > Why not? We've tried to avoid things that make the library dump core... Warner From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:24:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 169021065672 for ; Wed, 20 Jun 2012 21:24:17 +0000 (UTC) (envelope-from bounces+73574-8822-svn-src-all=freebsd.org@sendgrid.me) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) by mx1.freebsd.org (Postfix) with SMTP id 8D4F08FC19 for ; Wed, 20 Jun 2012 21:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h= message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; s=smtpapi; bh=cN88ZNaSC7tESRP+6oeN38JKN9Q=; b=TXTtpRnqrABHUbZ8qscGsHnUs/wY teM24AbRFCKkECUK/zqyrkaljbNmC1xghZA/ECgqG4M5xXJ31W+oc1IVPQhoqZgK VGyHdOWxWiG5FIIxz1To/oNGlc1MdjetXEjNSRWetgc3I8zIdWRiGJOxWDLxoOOR ru/+La3KXo/Hd70= Received: by 10.36.109.177 with SMTP id mf45.22826.4FE23F7F3 Wed, 20 Jun 2012 16:24:15 -0500 (CDT) Received: from mail.tarsnap.com (unknown [10.9.180.5]) by mi2 (SG) with ESMTP id 4fe23f7f.970.bb13a for ; Wed, 20 Jun 2012 16:24:15 -0500 (CST) Received: (qmail 87295 invoked from network); 20 Jun 2012 21:23:50 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 20 Jun 2012 21:23:50 -0000 Received: (qmail 91838 invoked from network); 20 Jun 2012 21:23:32 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 20 Jun 2012 21:23:32 -0000 Message-ID: <4FE23F54.5060409@freebsd.org> Date: Wed, 20 Jun 2012 14:23:32 -0700 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120509 Thunderbird/12.0.1 MIME-Version: 1.0 To: Warner Losh References: <201206200638.q5K6cg7u024024@svn.freebsd.org> <20120621015220.J2636@besplex.bde.org> <4FE1FC23.9000904@freebsd.org> <690DF487-F7CB-421E-B6BC-F7CE6BC0F658@bsdimp.com> In-Reply-To: <690DF487-F7CB-421E-B6BC-F7CE6BC0F658@bsdimp.com> X-Enigmail-Version: 1.5pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Sendgrid-EID: A6W2xSVPHetogaU8rnzccWwgBYtN+QvIzXyjfe/10PFSOCai/4cXwjQzgimCQL2khnIsJsfm3XEbQ3aayIPjhJM/x7lWOdRWB6V7XDB062z4bwycTIVF1Zf3MOOpCoINCYG5O2xIM2NirbT+3coq0XX5D5Jhvr8qOGROPaMsbb8= Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler , Bruce Evans Subject: Re: svn commit: r237286 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:24:17 -0000 On 06/20/12 14:15, Warner Losh wrote: > On Jun 20, 2012, at 10:36 AM, Colin Percival wrote: >> On 06/20/12 09:27, Bruce Evans wrote: >>> On Wed, 20 Jun 2012, Eitan Adler wrote: >>>> Log: >>>> Don't close an uninitialized descriptor. [1] >>>> Add a sanity check for the validity of the passed fd. >>> >>> Library functions shouldn't use assert() or abort(). >> >> Why not? > > We've tried to avoid things that make the library dump core... You mean, we avoid it except in the places where we don't? It seems to me that dumping core is exactly the right way to handle a "can't ever happen" situation inside libc -- just like the ~250 instances of assert() in jemalloc. If you mean "passing an invalid parameter to a library function shouldn't result in a core dump", I agree -- but that's not the case here. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:28:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FC9F106566B; Wed, 20 Jun 2012 21:28:17 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89A3F8FC1B; Wed, 20 Jun 2012 21:28:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KLSHdt068753; Wed, 20 Jun 2012 21:28:17 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KLSHUU068751; Wed, 20 Jun 2012 21:28:17 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <201206202128.q5KLSHUU068751@svn.freebsd.org> From: Robert Noland Date: Wed, 20 Jun 2012 21:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237340 - stable/8/sys/dev/wbwd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:28:17 -0000 Author: rnoland Date: Wed Jun 20 21:28:17 2012 New Revision: 237340 URL: http://svn.freebsd.org/changeset/base/237340 Log: MFC r236245 Fix a typo in wbwd so that CRF5 is actually written to the data register rather than the index register. Modified: stable/8/sys/dev/wbwd/wbwd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/wbwd/wbwd.c ============================================================================== --- stable/8/sys/dev/wbwd/wbwd.c Wed Jun 20 21:10:38 2012 (r237339) +++ stable/8/sys/dev/wbwd/wbwd.c Wed Jun 20 21:28:17 2012 (r237340) @@ -638,7 +638,7 @@ wb_attach(device_t dev) */ sc->reg_1 &= ~(WB_LDN8_CRF5_KEYB_P20); write_efir_1(sc, WB_LDN8_CRF5); - write_efir_1(sc, sc->reg_1); + write_efdr_1(sc, sc->reg_1); sc->reg_2 &= ~WB_LDN8_CRF7_CLEAR_MASK; write_efir_1(sc, WB_LDN8_CRF7); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:29:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2056E106566B; Wed, 20 Jun 2012 21:29:20 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A0E58FC1B; Wed, 20 Jun 2012 21:29:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KLTJUn068839; Wed, 20 Jun 2012 21:29:19 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KLTJE7068837; Wed, 20 Jun 2012 21:29:19 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <201206202129.q5KLTJE7068837@svn.freebsd.org> From: Robert Noland Date: Wed, 20 Jun 2012 21:29:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237341 - stable/8/sys/dev/wbwd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:29:20 -0000 Author: rnoland Date: Wed Jun 20 21:29:19 2012 New Revision: 237341 URL: http://svn.freebsd.org/changeset/base/237341 Log: MFC r236246 Add device ids for the Winbond 83627DHG-P chip and set the registers to trigger the keyboard reset line on timeout. Modified: stable/8/sys/dev/wbwd/wbwd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/wbwd/wbwd.c ============================================================================== --- stable/8/sys/dev/wbwd/wbwd.c Wed Jun 20 21:28:17 2012 (r237340) +++ stable/8/sys/dev/wbwd/wbwd.c Wed Jun 20 21:29:19 2012 (r237341) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #define WB_LDN8_CRF5 0xF5 #define WB_LDN8_CRF5_SCALE 0x08 /* 0: 1s, 1: 60s */ #define WB_LDN8_CRF5_KEYB_P20 0x04 /* 1: keyb P20 forces timeout */ +#define WB_LDN8_CRF5_KBRST 0x02 /* 1: timeout causes pin60 kbd reset */ /* CRF6: Watchdog Timeout (0 == off). Mapped to reg_timeout. */ #define WB_LDN8_CRF6 0xF6 @@ -180,6 +181,12 @@ struct winbond_vendor_device_id { .device_rev = 0x25, .descr = "Winbond 83627DHG IC ver. 5", }, + { + .vendor_id = 0x5ca3, + .device_id = 0xb0, + .device_rev = 0x73, + .descr = "Winbond 83627DHG-P", + }, }; /* @@ -637,6 +644,7 @@ wb_attach(device_t dev) * Disable all all interrupt reset sources (defaults). */ sc->reg_1 &= ~(WB_LDN8_CRF5_KEYB_P20); + sc->reg_1 |= WB_LDN8_CRF5_KBRST; write_efir_1(sc, WB_LDN8_CRF5); write_efdr_1(sc, sc->reg_1); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:32:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C8CF6106564A; Wed, 20 Jun 2012 21:32:54 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B28528FC08; Wed, 20 Jun 2012 21:32:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KLWsCH069038; Wed, 20 Jun 2012 21:32:54 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KLWswd069036; Wed, 20 Jun 2012 21:32:54 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <201206202132.q5KLWswd069036@svn.freebsd.org> From: Robert Noland Date: Wed, 20 Jun 2012 21:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237342 - stable/9/sys/dev/wbwd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:32:54 -0000 Author: rnoland Date: Wed Jun 20 21:32:54 2012 New Revision: 237342 URL: http://svn.freebsd.org/changeset/base/237342 Log: MFC r236245 Fix a typo in wbwd so that CRF5 is actually written to the data register rather than the index register. Modified: stable/9/sys/dev/wbwd/wbwd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/wbwd/wbwd.c ============================================================================== --- stable/9/sys/dev/wbwd/wbwd.c Wed Jun 20 21:29:19 2012 (r237341) +++ stable/9/sys/dev/wbwd/wbwd.c Wed Jun 20 21:32:54 2012 (r237342) @@ -638,7 +638,7 @@ wb_attach(device_t dev) */ sc->reg_1 &= ~(WB_LDN8_CRF5_KEYB_P20); write_efir_1(sc, WB_LDN8_CRF5); - write_efir_1(sc, sc->reg_1); + write_efdr_1(sc, sc->reg_1); sc->reg_2 &= ~WB_LDN8_CRF7_CLEAR_MASK; write_efir_1(sc, WB_LDN8_CRF7); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:34:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10948106566B; Wed, 20 Jun 2012 21:34:04 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F9A8FC17; Wed, 20 Jun 2012 21:34:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KLY39f069140; Wed, 20 Jun 2012 21:34:03 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KLY3NE069137; Wed, 20 Jun 2012 21:34:03 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <201206202134.q5KLY3NE069137@svn.freebsd.org> From: Robert Noland Date: Wed, 20 Jun 2012 21:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237343 - stable/9/sys/dev/wbwd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:34:04 -0000 Author: rnoland Date: Wed Jun 20 21:34:03 2012 New Revision: 237343 URL: http://svn.freebsd.org/changeset/base/237343 Log: MFC r236246 Add device ids for the Winbond 83627DHG-P chip and set the registers to trigger the keyboard reset line on timeout. Modified: stable/9/sys/dev/wbwd/wbwd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/wbwd/wbwd.c ============================================================================== --- stable/9/sys/dev/wbwd/wbwd.c Wed Jun 20 21:32:54 2012 (r237342) +++ stable/9/sys/dev/wbwd/wbwd.c Wed Jun 20 21:34:03 2012 (r237343) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #define WB_LDN8_CRF5 0xF5 #define WB_LDN8_CRF5_SCALE 0x08 /* 0: 1s, 1: 60s */ #define WB_LDN8_CRF5_KEYB_P20 0x04 /* 1: keyb P20 forces timeout */ +#define WB_LDN8_CRF5_KBRST 0x02 /* 1: timeout causes pin60 kbd reset */ /* CRF6: Watchdog Timeout (0 == off). Mapped to reg_timeout. */ #define WB_LDN8_CRF6 0xF6 @@ -180,6 +181,12 @@ struct winbond_vendor_device_id { .device_rev = 0x25, .descr = "Winbond 83627DHG IC ver. 5", }, + { + .vendor_id = 0x5ca3, + .device_id = 0xb0, + .device_rev = 0x73, + .descr = "Winbond 83627DHG-P", + }, }; /* @@ -637,6 +644,7 @@ wb_attach(device_t dev) * Disable all all interrupt reset sources (defaults). */ sc->reg_1 &= ~(WB_LDN8_CRF5_KEYB_P20); + sc->reg_1 |= WB_LDN8_CRF5_KBRST; write_efir_1(sc, WB_LDN8_CRF5); write_efdr_1(sc, sc->reg_1); From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:38:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D83F106566C; Wed, 20 Jun 2012 21:38:17 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 388838FC08; Wed, 20 Jun 2012 21:38:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KLcH0R069356; Wed, 20 Jun 2012 21:38:17 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KLcHvU069354; Wed, 20 Jun 2012 21:38:17 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201206202138.q5KLcHvU069354@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 20 Jun 2012 21:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237344 - head/tools/regression/usr.bin/make X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:38:17 -0000 Author: obrien Date: Wed Jun 20 21:38:16 2012 New Revision: 237344 URL: http://svn.freebsd.org/changeset/base/237344 Log: Provide a mechanism to not clear out the work and output dirs when developing tests. Modified: head/tools/regression/usr.bin/make/common.sh Modified: head/tools/regression/usr.bin/make/common.sh ============================================================================== --- head/tools/regression/usr.bin/make/common.sh Wed Jun 20 21:34:03 2012 (r237343) +++ head/tools/regression/usr.bin/make/common.sh Wed Jun 20 21:38:16 2012 (r237344) @@ -239,8 +239,10 @@ eval_clean() if [ -n "${TEST_CLEANUP}" ] ; then . ${SRC_DIR}/cleanup fi - rm -rf ${WORK_DIR} - rm -rf ${OUTPUT_DIR} + if [ -z "${NO_TEST_CLEANUP}" ] ; then + rm -rf ${WORK_DIR} + rm -rf ${OUTPUT_DIR} + fi } # From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 21:41:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CD6A1065673; Wed, 20 Jun 2012 21:41:56 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) by mx1.freebsd.org (Postfix) with ESMTP id 7AC8A8FC0C; Wed, 20 Jun 2012 21:41:56 +0000 (UTC) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 43E185AAF; Wed, 20 Jun 2012 14:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1340228516; bh=XyU5PPr7jtVyqYdKpLbR9vJClbVqVCjpgLtzMB1bq5o=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=zx102Ixt8DxQ4pvamheeOgUlwnlRbG+MVewALq5FAN6acjt85fNJk8jP5BDGLTGy6 BWTb6c5AnKDQw+TnWjQGoc+QV6eyaYoEfQyilMGR5r2hQ/l3lQlsXfPujfgleKolKC UZkZwyWHWBl8ldZ0KpfcET816CZBwiGWQp2CFLVs= Message-ID: <4FE243A3.1070202@delphij.net> Date: Wed, 20 Jun 2012 14:41:55 -0700 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Colin Percival References: <201206200638.q5K6cg7u024024@svn.freebsd.org> <20120621015220.J2636@besplex.bde.org> <4FE1FC23.9000904@freebsd.org> <690DF487-F7CB-421E-B6BC-F7CE6BC0F658@bsdimp.com> <4FE23F54.5060409@freebsd.org> In-Reply-To: <4FE23F54.5060409@freebsd.org> X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Eitan Adler , svn-src-all@freebsd.org, Warner Losh , Bruce Evans , svn-src-head@freebsd.org, d@delphij.net Subject: Re: svn commit: r237286 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:41:56 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 06/20/12 14:23, Colin Percival wrote: > On 06/20/12 14:15, Warner Losh wrote: >> On Jun 20, 2012, at 10:36 AM, Colin Percival wrote: >>> On 06/20/12 09:27, Bruce Evans wrote: >>>> On Wed, 20 Jun 2012, Eitan Adler wrote: >>>>> Log: Don't close an uninitialized descriptor. [1] Add a >>>>> sanity check for the validity of the passed fd. >>>> >>>> Library functions shouldn't use assert() or abort(). >>> >>> Why not? >> >> We've tried to avoid things that make the library dump core... > > You mean, we avoid it except in the places where we don't? It > seems to me that dumping core is exactly the right way to handle a > "can't ever happen" situation inside libc -- just like the ~250 > instances of assert() in jemalloc. > > If you mean "passing an invalid parameter to a library function > shouldn't result in a core dump", I agree -- but that's not the > case here. But malloc() is a rare place that we typically consider as "low level" enough where, no better remedies are provided from API prospective -- there is nothing better than crashing the program immediately, since that would likely to lead us to where the smoking gun is. Library procedures normally detect and report errors, but don't handle them like this. Also, as Bruce pointed out, it's a case that can never happen and thus the explicit assert is just a waste of space. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJP4kOjAAoJEG80Jeu8UPuzs/cH/ixT9Emrdb4MDoVA3WCE9TS6 W3DE0SbvFtRLrtsSI8i8EsET87sRtOiIoEjFUuRa7HYO3JL3hr9wzLLa84k2sCEW pSPa0pKJ3ZhQR7O3UMb3PxAQxwG4uoFhxST6MuAOci2ySojwbK0YAg5G+TyBf1ch V2MNG2ZIg3tGAmT96/YHONYmP3rleHNDSoYQ5N3m9Svu8am1qRrg8Tz+Z+M0c1db SpJvWBsmrk60xpcZUlHMlO6L1TB5eCAE+pxTiN41xDlL8sXwHIzWf+g7YUyzRa+n 82fpnDPnm6VfdnPHug3MBQ/gRdIMw2aApqEtwRmRTQHIz41t5MA1b48qAWrTH3o= =V4AY -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 22:21:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D4623106566B; Wed, 20 Jun 2012 22:21:02 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6E5F8FC12; Wed, 20 Jun 2012 22:21:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KML21r071230; Wed, 20 Jun 2012 22:21:02 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KML2Vv071228; Wed, 20 Jun 2012 22:21:02 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201206202221.q5KML2Vv071228@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 20 Jun 2012 22:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237345 - stable/9/usr.bin/find X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 22:21:02 -0000 Author: jilles Date: Wed Jun 20 22:21:02 2012 New Revision: 237345 URL: http://svn.freebsd.org/changeset/base/237345 Log: MFC r236860,r237035: find(1): Extend and move description of -d option to -depth primary. The nullary -depth primary is standard and the -d option provides little advantage. Commit r236860 originally by issyl0. PR: docs/168885 Modified: stable/9/usr.bin/find/find.1 Directory Properties: stable/9/usr.bin/find/ (props changed) Modified: stable/9/usr.bin/find/find.1 ============================================================================== --- stable/9/usr.bin/find/find.1 Wed Jun 20 21:38:16 2012 (r237344) +++ stable/9/usr.bin/find/find.1 Wed Jun 20 22:21:02 2012 (r237345) @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd March 17, 2010 +.Dd June 13, 2012 .Dt FIND 1 .Os .Sh NAME @@ -126,36 +126,15 @@ as an effective alternative. .It Fl d Cause .Nm -to perform a depth-first traversal, i.e., directories -are visited in post-order and all entries in a directory will be acted -on before the directory itself. -By default, -.Nm -visits directories in pre-order, i.e., before their contents. -Note, the default is -.Em not -a breadth-first traversal. +to perform a depth-first traversal. .Pp -This option is equivalent to the +This option is a BSD-specific equivalent of the .Ic -depth -primary of +primary specified by .St -p1003.1-2001 . -The -.Fl d -option -can be useful when -.Nm -is used with -.Xr cpio 1 -to process files that are contained in directories with unusual permissions. -It ensures that you have write permission while you are placing files in a -directory, then sets the directory's permissions as the last thing. -.It Fl f -Specify a file hierarchy for -.Nm -to traverse. -File hierarchies may also be specified as the operands immediately -following the options. +Refer to its description under +.Sx PRIMARIES +for more information. .It Fl s Cause .Nm @@ -302,7 +281,7 @@ Please refer to the .Ic -atime primary description for information on supported time units. .It Ic -d -Same as +Non-portable, BSD-specific version of .Ic depth . GNU find implements this as a primary in mistaken emulation of .Fx @@ -323,9 +302,31 @@ Depth-first traversal processing is impl Following symlinks is incompatible with this option. .It Ic -depth Always true; -same as the +same as the non-portable .Fl d option. +Cause +.Nm +to perform a depth-first traversal, i.e., directories +are visited in post-order and all entries in a directory will be acted +on before the directory itself. +By default, +.Nm +visits directories in pre-order, i.e., before their contents. +Note, the default is +.Em not +a breadth-first traversal. +.Pp +The +.Ic -depth +primary +can be useful when +.Nm +is used with +.Xr cpio 1 +to process files that are contained in directories with unusual permissions. +It ensures that you have write permission while you are placing files in a +directory, then sets the directory's permissions as the last thing. .It Ic -depth Ar n True if the depth of the file relative to the starting point of the traversal is From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 23:25:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30500106566B; Wed, 20 Jun 2012 23:25:48 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0382E8FC15; Wed, 20 Jun 2012 23:25:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KNPlw7073881; Wed, 20 Jun 2012 23:25:47 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KNPl6p073878; Wed, 20 Jun 2012 23:25:47 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206202325.q5KNPl6p073878@svn.freebsd.org> From: Alan Cox Date: Wed, 20 Jun 2012 23:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237346 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 23:25:48 -0000 Author: alc Date: Wed Jun 20 23:25:47 2012 New Revision: 237346 URL: http://svn.freebsd.org/changeset/base/237346 Log: Selectively inline vm_page_dirty(). Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Jun 20 22:21:02 2012 (r237345) +++ head/sys/vm/vm_page.c Wed Jun 20 23:25:47 2012 (r237346) @@ -783,7 +783,7 @@ vm_page_sleep(vm_page_t m, const char *m } /* - * vm_page_dirty: + * vm_page_dirty_KBI: [ internal use only ] * * Set all bits in the page's dirty field. * @@ -791,11 +791,14 @@ vm_page_sleep(vm_page_t m, const char *m * call is made from the machine-independent layer. * * See vm_page_clear_dirty_mask(). + * + * This function should only be called by vm_page_dirty(). */ void -vm_page_dirty(vm_page_t m) +vm_page_dirty_KBI(vm_page_t m) { + /* These assertions refer to this operation by its public name. */ KASSERT((m->flags & PG_CACHED) == 0, ("vm_page_dirty: page in cache!")); KASSERT(!VM_PAGE_IS_FREE(m), Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Jun 20 22:21:02 2012 (r237345) +++ head/sys/vm/vm_page.h Wed Jun 20 23:25:47 2012 (r237346) @@ -360,7 +360,6 @@ void vm_page_hold(vm_page_t mem); void vm_page_unhold(vm_page_t mem); void vm_page_free(vm_page_t m); void vm_page_free_zero(vm_page_t m); -void vm_page_dirty(vm_page_t m); void vm_page_wakeup(vm_page_t m); void vm_pageq_remove(vm_page_t m); @@ -414,6 +413,7 @@ void vm_page_cowfault (vm_page_t); int vm_page_cowsetup(vm_page_t); void vm_page_cowclear (vm_page_t); +void vm_page_dirty_KBI(vm_page_t m); void vm_page_lock_KBI(vm_page_t m, const char *file, int line); void vm_page_unlock_KBI(vm_page_t m, const char *file, int line); int vm_page_trylock_KBI(vm_page_t m, const char *file, int line); @@ -429,6 +429,28 @@ void vm_page_object_lock_assert(vm_page_ #endif /* + * vm_page_dirty: + * + * Set all bits in the page's dirty field. + * + * The object containing the specified page must be locked if the + * call is made from the machine-independent layer. + * + * See vm_page_clear_dirty_mask(). + */ +static __inline void +vm_page_dirty(vm_page_t m) +{ + + /* Use vm_page_dirty_KBI() under INVARIANTS to save memory. */ +#if defined(KLD_MODULE) || defined(INVARIANTS) + vm_page_dirty_KBI(m); +#else + m->dirty = VM_PAGE_BITS_ALL; +#endif +} + +/* * vm_page_sleep_if_busy: * * Sleep and release the page queues lock if VPO_BUSY is set or, From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 23:47:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 70E79106566B; Wed, 20 Jun 2012 23:47:49 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 579DA8FC12; Wed, 20 Jun 2012 23:47:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KNlnRd074845; Wed, 20 Jun 2012 23:47:49 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KNln28074825; Wed, 20 Jun 2012 23:47:49 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206202347.q5KNln28074825@svn.freebsd.org> From: Warren Block Date: Wed, 20 Jun 2012 23:47:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237347 - in stable/8: lib/libpam/modules/pam_exec sbin/atacontrol sbin/geom/class/part sbin/geom/class/raid sbin/geom/class/virstor sbin/gvinum sbin/hastctl sbin/hastd sbin/mount sbin/... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 23:47:49 -0000 Author: wblock (doc committer) Date: Wed Jun 20 23:47:48 2012 New Revision: 237347 URL: http://svn.freebsd.org/changeset/base/237347 Log: MFC r235873: Fixes to man8 groff mandoc style, usage mistakes, or typos. Includes a partial MFC of r233648 for sbin/gvinum/gvinum.8. PR: 168016 Submitted by: Nobuyuki Koganemaru Approved by: gjb (mentor) Modified: stable/8/lib/libpam/modules/pam_exec/pam_exec.8 stable/8/sbin/atacontrol/atacontrol.8 stable/8/sbin/geom/class/part/gpart.8 stable/8/sbin/geom/class/raid/graid.8 stable/8/sbin/geom/class/virstor/gvirstor.8 stable/8/sbin/gvinum/gvinum.8 stable/8/sbin/hastctl/hastctl.8 stable/8/sbin/hastd/hastd.8 stable/8/sbin/mount/mount.8 stable/8/sbin/natd/natd.8 stable/8/share/man/man8/picobsd.8 stable/8/share/man/man8/rc.8 stable/8/usr.sbin/cpucontrol/cpucontrol.8 stable/8/usr.sbin/freebsd-update/freebsd-update.8 stable/8/usr.sbin/i2c/i2c.8 stable/8/usr.sbin/rtadvctl/rtadvctl.8 stable/8/usr.sbin/rtadvd/rtadvd.8 stable/8/usr.sbin/smbmsg/smbmsg.8 stable/8/usr.sbin/wpa/ndis_events/ndis_events.8 Directory Properties: stable/8/lib/libpam/ (props changed) stable/8/sbin/atacontrol/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/raid/ (props changed) stable/8/sbin/geom/class/virstor/ (props changed) stable/8/sbin/gvinum/ (props changed) stable/8/sbin/hastctl/ (props changed) stable/8/sbin/hastd/ (props changed) stable/8/sbin/mount/ (props changed) stable/8/sbin/natd/ (props changed) stable/8/share/man/man8/ (props changed) stable/8/usr.sbin/cpucontrol/ (props changed) stable/8/usr.sbin/freebsd-update/ (props changed) stable/8/usr.sbin/i2c/ (props changed) stable/8/usr.sbin/rtadvctl/ (props changed) stable/8/usr.sbin/rtadvd/ (props changed) stable/8/usr.sbin/smbmsg/ (props changed) stable/8/usr.sbin/wpa/ (props changed) Modified: stable/8/lib/libpam/modules/pam_exec/pam_exec.8 ============================================================================== --- stable/8/lib/libpam/modules/pam_exec/pam_exec.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/lib/libpam/modules/pam_exec/pam_exec.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -131,10 +131,10 @@ This is useful in shell scripts for inst .Xr pam 8 , .Xr pam_sm_acct_mgmt 8 , .Xr pam_sm_authenticate 8 , -.Xr pam_sm_chauthtok 8, +.Xr pam_sm_chauthtok 8 , .Xr pam_sm_close_session 8 , .Xr pam_sm_open_session 8 , -.Xr pam_sm_setcred 8 . +.Xr pam_sm_setcred 8 .Sh AUTHORS The .Nm Modified: stable/8/sbin/atacontrol/atacontrol.8 ============================================================================== --- stable/8/sbin/atacontrol/atacontrol.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/atacontrol/atacontrol.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -367,8 +367,8 @@ You should not set a spindown timeout on or syslog logging on it as the disk will be worn out spinning down and up all the time. .Sh SEE ALSO -.Xr ata 4 -.Xr cam 4 +.Xr ata 4 , +.Xr cam 4 , .Xr camcontrol 8 .Sh HISTORY The Modified: stable/8/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/8/sbin/geom/class/part/gpart.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/geom/class/part/gpart.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -650,7 +650,7 @@ for MBR, for GPT. .It Cm ms-ldm-metadata A partition that contains Logical Disk Manager (LDM) database. -The scheme-specifig type is +The scheme-specific type is .Qq Li "!5808c8aa-7e8f-42e0-85d2-e1e90434cfb3" for GPT. .El @@ -971,7 +971,7 @@ By default mirrored volumes are shown as .Sx "PARTITION TYPES" section). If this variable set to 1 each component of the mirrored volume will be -present as independet partition. +present as independent partition. .Em NOTE : This may break a mirrored volume and lead to data damage. .El Modified: stable/8/sbin/geom/class/raid/graid.8 ============================================================================== --- stable/8/sbin/geom/class/raid/graid.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/geom/class/raid/graid.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -294,7 +294,7 @@ Debug level of the .Nm RAID GEOM class. .It Va kern.geom.raid.idle_threshold : No 1000000 -Time in microseconds to consider a volume idle for rebuild puroses. +Time in microseconds to consider a volume idle for rebuild purposes. .It Va kern.geom.raid.name_format : No 0 Providers name format: 0 -- raid/r{num}, 1 -- raid/{label}. .It Va kern.geom.raid.read_err_thresh : No 10 Modified: stable/8/sbin/geom/class/virstor/gvirstor.8 ============================================================================== --- stable/8/sbin/geom/class/virstor/gvirstor.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/geom/class/virstor/gvirstor.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -109,7 +109,7 @@ Adds new components to existing virtual The specified virstor device must exist and be active .Pq i.e. module loaded, device present in Pa /dev . This action can be safely performed while the virstor device is in use -.Pq Qo hot Qc operation +.Pq Qo hot Qc operation . .It Cm remove Removes components from existing virtual device with the given .Ar name . @@ -264,7 +264,8 @@ change once it is set, and that the size components will always remain constant during their existence. For alternative ways to implement virtual or resizable file systems see .Xr zfs 1M , -.Xr gconcat 8 and +.Xr gconcat 8 +and .Xr growfs 8 . .Pp Note that Modified: stable/8/sbin/gvinum/gvinum.8 ============================================================================== --- stable/8/sbin/gvinum/gvinum.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/gvinum/gvinum.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -42,7 +42,7 @@ .Bl -tag -width indent .It Ic attach Ar plex volume Op Cm rename .It Ic attach Ar subdisk plex Oo Ar offset Oc Op Cm rename -Attach a plex to a volume, or a subdisk to a plex. +Attach a plex to a volume, or a subdisk to a plex. If offset is specified, the subdisk will be attached to the given offset within the plex. If rename is specified, the subdisk or plex will change name according to the @@ -58,7 +58,8 @@ All subdisks in the plex must be up for a parity check. .It Ic concat Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives Create a concatenated volume from the specified drives. -If no name is specified, a unique name will be set by gvinum. +If no name is specified, a unique name will be set by +.Ic gvinum . .It Ic create Oo Fl f Oc Op Ar description-file Create a volume as described in .Ar description-file . @@ -103,10 +104,10 @@ and .Fl V flags provide progressively more detailed output. .It Ic mirror Oo Fl fsv Oc Oo Fl n Ar name Oc Ar drives -Create a mirrored volume from the specified drives. +Create a mirrored volume from the specified drives. It requires at least a multiple of 2 drives. If no name is specified, a unique name will be set by gvinum. -If the +If the .Fl s flag is specified, a striped mirror will be created, and thus requires a multiple of 4 drives. @@ -148,8 +149,8 @@ Normally this would be done by entering EOF character. .It Ic raid5 Oo Fl fv Oc Oo Fl s Ar stripesize Oc Oo Fl n Ar name Oc Ar drives Create a RAID-5 volume from the specified drives. -If no name is specified,a unique name will be set by -.Ic gvinum. +If no name is specified, a unique name will be set by +.Ic gvinum . This organization requires at least three drives. .It Ic rename Oo Fl r Oc Ar drive | subdisk | plex | volume newname Change the name of the specified object. @@ -202,8 +203,9 @@ Terminate access to the objects, or stop if no parameters are specified. .It Ic stripe Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives Create a striped volume from the specified drives. If no name is specified, -a unique name will be set by Ic gvinum. This organization requires at least two -drives. +a unique name will be set by +.Ic gvinum . +This organization requires at least two drives. .El .Sh DESCRIPTION The @@ -278,11 +280,12 @@ objects .El .Sh EXAMPLES To create a mirror on disks /dev/ad1 and /dev/ad2, create a filesystem, mount, -unmount and then stop Ic gvinum: +unmount and then stop +.Ic gvinum : .Pp .Dl "gvinum mirror /dev/ad1 /dev/ad2" .Dl "newfs /dev/gvinum/gvinumvolume0" -.Dl "mount /dev/gvinum/gvinumvolume0 /mnt" +.Dl "mount /dev/gvinum/gvinumvolume0 /mnt" .Dl "..." .Dl "unmount /mnt" .Dl "gvinum stop" Modified: stable/8/sbin/hastctl/hastctl.8 ============================================================================== --- stable/8/sbin/hastctl/hastctl.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/hastctl/hastctl.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -211,7 +211,7 @@ nodeB# application_start .Xr ggatel 8 , .Xr hastd 8 , .Xr mount 8 , -.Xr newfs 8 . +.Xr newfs 8 .Sh AUTHORS The .Nm Modified: stable/8/sbin/hastd/hastd.8 ============================================================================== --- stable/8/sbin/hastd/hastd.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/hastd/hastd.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -223,7 +223,7 @@ nodeA# mount -o noatime /dev/hast/shared .Xr hastctl 8 , .Xr mount 8 , .Xr newfs 8 , -.Xr g_bio 9 . +.Xr g_bio 9 .Sh AUTHORS The .Nm Modified: stable/8/sbin/mount/mount.8 ============================================================================== --- stable/8/sbin/mount/mount.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/mount/mount.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -448,7 +448,7 @@ However, for the following file system t .Cm smbfs , .Cm udf , and -.Cm unionfs , +.Cm unionfs . .Nm will not call .Xr nmount 2 Modified: stable/8/sbin/natd/natd.8 ============================================================================== --- stable/8/sbin/natd/natd.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/sbin/natd/natd.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -787,7 +787,7 @@ ipfw add allow ip from any to any .Pp Here the packet from internal network to Internet goes out via .Ql sis0 -(rule number 2000) and gets catched by the +(rule number 2000) and gets caught by the .Ic globalport socket (3000). After that, either a match is found in a translation table Modified: stable/8/share/man/man8/picobsd.8 ============================================================================== --- stable/8/share/man/man8/picobsd.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/share/man/man8/picobsd.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -54,7 +54,7 @@ The most important options for common op .Fl src , .Fl init , .Fl n and -.Fl v. +.Fl v . .Pp .Bl -tag -width indent .\" @@ -95,7 +95,10 @@ subtree as necessary to subsequently bui images. .\" .It Fl -iso -Generate an ISO image, picobsd.iso, in addition to the disk image picobsd.bin +Generate an ISO image, +.Pa picobsd.iso , +in addition to the disk image +.Pa picobsd.bin . .\" .It Fl -modules Also build kernel modules. Modified: stable/8/share/man/man8/rc.8 ============================================================================== --- stable/8/share/man/man8/rc.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/share/man/man8/rc.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -253,7 +253,7 @@ The boot does not stop if such a script but a script can stop the boot if necessary by invoking the .Fn stop_boot function (from -.Xr rc.subr 8 ). +.Xr rc.subr 8 ) . .El .Pp Each script should contain Modified: stable/8/usr.sbin/cpucontrol/cpucontrol.8 ============================================================================== --- stable/8/usr.sbin/cpucontrol/cpucontrol.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/usr.sbin/cpucontrol/cpucontrol.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -31,7 +31,7 @@ .Nm cpucontrol .Nd control utility for the .Xr cpuctl 4 -device. +device .Sh SYNOPSIS .Nm .Op Fl vh Modified: stable/8/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- stable/8/usr.sbin/freebsd-update/freebsd-update.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/usr.sbin/freebsd-update/freebsd-update.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -62,7 +62,7 @@ Release Engineering Team, e.g., .Fx 9.0-CURRENT. .Sh OPTIONS -The following options are supported +The following options are supported: .Bl -tag -width "-f conffile" .It Fl b Ar basedir Operate on a system mounted at Modified: stable/8/usr.sbin/i2c/i2c.8 ============================================================================== --- stable/8/usr.sbin/i2c/i2c.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/usr.sbin/i2c/i2c.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -88,7 +88,7 @@ reset the controller. .It Fl s scan the bus for devices. .It Fl v -be verbose +be verbose. .It Fl w Ar 0|8|16 device addressing width (in bits). .El Modified: stable/8/usr.sbin/rtadvctl/rtadvctl.8 ============================================================================== --- stable/8/usr.sbin/rtadvctl/rtadvctl.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/usr.sbin/rtadvctl/rtadvctl.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -31,7 +31,8 @@ .Sh NAME .Nm rtadvctl .Nd control program for -.Xr rtadvd 8 daemon +.Xr rtadvd 8 +daemon .Sh SYNOPSIS .Nm .Op Fl v Modified: stable/8/usr.sbin/rtadvd/rtadvd.8 ============================================================================== --- stable/8/usr.sbin/rtadvd/rtadvd.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/usr.sbin/rtadvd/rtadvd.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -140,7 +140,7 @@ option, which enables routing renumberin .It Fl p Specify an alternative file in which to store the process ID. The default is -.Pa /var/run/rtadvd.pid. +.Pa /var/run/rtadvd.pid . .It Fl R Accept router renumbering requests. If you enable it, certain IPsec setup is suggested for security reasons. Modified: stable/8/usr.sbin/smbmsg/smbmsg.8 ============================================================================== --- stable/8/usr.sbin/smbmsg/smbmsg.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/usr.sbin/smbmsg/smbmsg.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -70,7 +70,7 @@ and writeable, respectively. The only valid additional option for this modus of operation (besides the .Fl p -option that choses the modus) is +option that chooses the modus) is .Fl f Ar dev . See below for a description. .Pp Modified: stable/8/usr.sbin/wpa/ndis_events/ndis_events.8 ============================================================================== --- stable/8/usr.sbin/wpa/ndis_events/ndis_events.8 Wed Jun 20 23:25:47 2012 (r237346) +++ stable/8/usr.sbin/wpa/ndis_events/ndis_events.8 Wed Jun 20 23:47:48 2012 (r237347) @@ -71,7 +71,7 @@ When it detects an event that was genera interface, it transmits it via UDP packet on the loopback interface, where .Xr wpa_supplicant 8 -is presumeably listening. +is presumably listening. The standard .Xr wpa_supplicant 8 distribution includes its own version of this utility for use with From owner-svn-src-all@FreeBSD.ORG Wed Jun 20 23:53:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DE11C1065672; Wed, 20 Jun 2012 23:53:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA0D88FC14; Wed, 20 Jun 2012 23:53:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KNraC3075109; Wed, 20 Jun 2012 23:53:36 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KNraeG075107; Wed, 20 Jun 2012 23:53:36 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206202353.q5KNraeG075107@svn.freebsd.org> From: Xin LI Date: Wed, 20 Jun 2012 23:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237348 - head/usr.bin/makewhatis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 23:53:37 -0000 Author: delphij Date: Wed Jun 20 23:53:36 2012 New Revision: 237348 URL: http://svn.freebsd.org/changeset/base/237348 Log: Currently the code uses gzFile * for a zlib file descriptor, which is not correct. The code works by accident because gzFile is currently defined as void *, and internally it would be casted from or to its real type. A newer version of zlib will instead define it as a pointer to a specific type pointer (namely, struct gzFile_s *). This therefore would cause stricter checks and compiler would catch this type mismatch. This change does not cause any changes to the resulting binary, as validated with md5(1). MFC after: 3 days Modified: head/usr.bin/makewhatis/makewhatis.c Modified: head/usr.bin/makewhatis/makewhatis.c ============================================================================== --- head/usr.bin/makewhatis/makewhatis.c Wed Jun 20 23:47:48 2012 (r237347) +++ head/usr.bin/makewhatis/makewhatis.c Wed Jun 20 23:53:36 2012 (r237348) @@ -693,7 +693,7 @@ enum { STATE_UNKNOWN, STATE_MANSTYLE, ST static void process_page(struct page_info *page, char *section_dir) { - gzFile *in; + gzFile in; char buffer[4096]; char *line; StringList *names; From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 02:38:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A761106566B; Thu, 21 Jun 2012 02:38:56 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail15.syd.optusnet.com.au (mail15.syd.optusnet.com.au [211.29.132.196]) by mx1.freebsd.org (Postfix) with ESMTP id 1EE498FC0C; Thu, 21 Jun 2012 02:38:55 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail15.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5L2cVBq028971 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Jun 2012 12:38:34 +1000 Date: Thu, 21 Jun 2012 12:38:31 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: d@delphij.net In-Reply-To: <4FE243A3.1070202@delphij.net> Message-ID: <20120621112708.W901@besplex.bde.org> References: <201206200638.q5K6cg7u024024@svn.freebsd.org> <20120621015220.J2636@besplex.bde.org> <4FE1FC23.9000904@freebsd.org> <690DF487-F7CB-421E-B6BC-F7CE6BC0F658@bsdimp.com> <4FE23F54.5060409@freebsd.org> <4FE243A3.1070202@delphij.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, Eitan Adler , Colin Percival , svn-src-all@freebsd.org, Warner Losh , Bruce Evans , svn-src-head@freebsd.org Subject: Re: svn commit: r237286 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 02:38:56 -0000 On Wed, 20 Jun 2012, Xin Li wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 06/20/12 14:23, Colin Percival wrote: >> On 06/20/12 14:15, Warner Losh wrote: >>> On Jun 20, 2012, at 10:36 AM, Colin Percival wrote: >>>> On 06/20/12 09:27, Bruce Evans wrote: >>>>> On Wed, 20 Jun 2012, Eitan Adler wrote: >>>>>> Log: Don't close an uninitialized descriptor. [1] Add a >>>>>> sanity check for the validity of the passed fd. >>>>> >>>>> Library functions shouldn't use assert() or abort(). >>>> >>>> Why not? Because correctly designed APIs handle errors by returning an error status. Less correctly designed APIs might handle errors by dumping core, but then they have to document this. >>> We've tried to avoid things that make the library dump core... >> >> You mean, we avoid it except in the places where we don't? It >> seems to me that dumping core is exactly the right way to handle a >> "can't ever happen" situation inside libc -- just like the ~250 >> instances of assert() in jemalloc. Doesn't inspire confidence. I missed this because jemalloc doesn't include assert.h. It rolls its own assert() "to reduce the chance of deadlock during assertion failure". The library assert is indeed unusable in malloc() since it calls stdio, which may call malloc(). (It is a standard bug that assert() must write on stderr, since write() and STDERR_FILENO are not available in plain STDC. stderr is under more direct control of the application than is STDERR_FILENO. Although it is normally unbuffered, the application may set it into some mode that is buffered with the buffer not yet allocated, or otherwise uses malloc(). jemalloc's assert() avoids this problem by writing to STDERR_FILENO). But even in jemalloc, the assert()s are in debugging code and are turned off in production. It is apparently not ready for production, since MALLOC_PRODUCTION is apparently never configured. MALLOC_PRODUCTION also turns off the default malloc options of AJ. The default A option gives much larger standards breakage and core dumps, by aborting for all warnings. Not configuring MALLOC_PRODUCTION also results in configuring MALLOC_DEBUG and MALLOC_STATS. These result in malloc() using stdio in other ways, although it has mounds of code to avoid this in the production version. >> If you mean "passing an invalid parameter to a library function >> shouldn't result in a core dump", I agree -- but that's not the >> case here. Any undefined behaviour can cause a core dump, even when it is an invalid parameter passed to a library function (examples are null pointers passed to string and memory functions). However, the library should be more carefully written than applications, so it shouldn't have any undefined behaviours, and if it actually checks for undefined behaviours then it should try not to abort when it finds one. > But malloc() is a rare place that we typically consider as "low level" > enough where, no better remedies are provided from API prospective -- > there is nothing better than crashing the program immediately, since > that would likely to lead us to where the smoking gun is. Library > procedures normally detect and report errors, but don't handle them > like this. > > Also, as Bruce pointed out, it's a case that can never happen and thus > the explicit assert is just a waste of space. The only good think about the assert() in closelog() is that it detects a problem (that can't happen) in some cases and aborts before destroying the evidence. Here are all uses of LogFile in syslog.c. This shows that the assert() is even more bogus than I thought (since there are several closes of LogFile, but only an assert() for the recently changed one). Of course there are no assert()s for critical uses of LogFile. % static int LogFile = -1; /* fd for log */ % ... % if (send(LogFile, tbuf, cnt, 0) < 0) { % ... % if (send(LogFile, tbuf, cnt, 0) >= 0) { % ... These use LogFile without checking that it is not -1. This error can happen -- see below. % static void % disconnectlog(void) % { % /* % * If the user closed the FD and opened another in the same slot, % * that's their problem. They should close it before calling on % * system services. % */ % if (LogFile != -1) { % _close(LogFile); % LogFile = -1; % } % status = NOCONN; /* retry connect */ % } disconnect() is very similar to closelog(). It already had the check to avoid the unnecessary close when LogFile has not been allocated, but doesn't have an assert(). % ... % static void % connectlog(void) % { % struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */ % % if (LogFile == -1) { % if ((LogFile = _socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) % return; % (void)_fcntl(LogFile, F_SETFD, FD_CLOEXEC); % } % if (LogFile != -1 && status == NOCONN) { Bogus check that LogFile != -1. If LogFile was -1, then we just called _socket() succeessfully to make it different from -1, or returned if _socket() failed. % ... % if (_connect(LogFile, (struct sockaddr *)&SyslogAddr, % ... % if (_connect(LogFile, (struct sockaddr *)&SyslogAddr, % ... % if (_connect(LogFile, (struct sockaddr *)&SyslogAddr, % ... % if (status == NOCONN) { % (void)_close(LogFile); % LogFile = -1; connectlog() also returns without allocating LogFile here. % } % ... % } % } Note that we don't bogusly assert() that LogFile >= 0 before we use it. We don't even check that it is not -1 before using it. And this seems to be an error that can actually happen. The 2 _send()s in the above are done soon after calling connectlog(). But connectlog() returns void, and doesn't abort() when it fails to allocate LogFile. It just leaves or resets LogFile to -1 and lets the _send()s fail. % ... % void % closelog(void) % { % THREAD_LOCK(); % assert(LogFile >= -1); The bogus assert(). We check for an error that can't happen (_socket() returning a negative value that is not -1, or something clobbering LogFile to a negative value that is not -1). We don't and can't check for another error that can't happen (something clobbering LogFile to a _non-negative_ but still invalid or conflicting value). % if (LogFile != -1) { % (void)_close(LogFile); % LogFile = -1; % } % LogTag = NULL; % status = NOCONN; % THREAD_UNLOCK(); % } Since closelog() doesn't really use LogFile, handling the case that can't happen (LogFile < -1) by trying the close and resetting state was as harmless as possible. It mainly destroys the evidence that LogFIle (and perhaps other state) got clobbered. But it doesn't detect the problem as early as possible. If you want that, then you need to check LogFile every time before it is used. Don't forget to check for parity errors in the CPU before every instruction too. Bruce From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 02:48:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7808F1065670; Thu, 21 Jun 2012 02:48:50 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57E478FC12; Thu, 21 Jun 2012 02:48:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L2mon5083693; Thu, 21 Jun 2012 02:48:50 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L2moL8083684; Thu, 21 Jun 2012 02:48:50 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206210248.q5L2moL8083684@svn.freebsd.org> From: Warren Block Date: Thu, 21 Jun 2012 02:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237349 - in stable/7: sbin/mount sbin/natd share/man/man8 usr.sbin/cpucontrol usr.sbin/freebsd-update usr.sbin/rtadvd usr.sbin/smbmsg usr.sbin/wpa/ndis_events X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 02:48:50 -0000 Author: wblock (doc committer) Date: Thu Jun 21 02:48:49 2012 New Revision: 237349 URL: http://svn.freebsd.org/changeset/base/237349 Log: MFC r235873: Fixes to man8 groff mandoc style, usage mistakes, or typos. PR: 168016 Submitted by: Nobuyuki Koganemaru Approved by: gjb (mentor) Modified: stable/7/sbin/mount/mount.8 stable/7/sbin/natd/natd.8 stable/7/share/man/man8/rc.8 stable/7/usr.sbin/cpucontrol/cpucontrol.8 stable/7/usr.sbin/freebsd-update/freebsd-update.8 stable/7/usr.sbin/rtadvd/rtadvd.8 stable/7/usr.sbin/smbmsg/smbmsg.8 stable/7/usr.sbin/wpa/ndis_events/ndis_events.8 Directory Properties: stable/7/sbin/mount/ (props changed) stable/7/sbin/natd/ (props changed) stable/7/share/man/man8/ (props changed) stable/7/usr.sbin/cpucontrol/ (props changed) stable/7/usr.sbin/freebsd-update/ (props changed) stable/7/usr.sbin/rtadvd/ (props changed) stable/7/usr.sbin/smbmsg/ (props changed) stable/7/usr.sbin/wpa/ (props changed) Modified: stable/7/sbin/mount/mount.8 ============================================================================== --- stable/7/sbin/mount/mount.8 Wed Jun 20 23:53:36 2012 (r237348) +++ stable/7/sbin/mount/mount.8 Thu Jun 21 02:48:49 2012 (r237349) @@ -436,7 +436,7 @@ However, for the following file system t .Cm smbfs , .Cm udf , and -.Cm unionfs , +.Cm unionfs . .Nm will not call .Xr nmount 2 Modified: stable/7/sbin/natd/natd.8 ============================================================================== --- stable/7/sbin/natd/natd.8 Wed Jun 20 23:53:36 2012 (r237348) +++ stable/7/sbin/natd/natd.8 Thu Jun 21 02:48:49 2012 (r237349) @@ -782,7 +782,7 @@ ipfw add allow ip from any to any .Pp Here the packet from internal network to Internet goes out via .Ql sis0 -(rule number 2000) and gets catched by the +(rule number 2000) and gets caught by the .Ic globalport socket (3000). After that, either a match is found in a translation table Modified: stable/7/share/man/man8/rc.8 ============================================================================== --- stable/7/share/man/man8/rc.8 Wed Jun 20 23:53:36 2012 (r237348) +++ stable/7/share/man/man8/rc.8 Thu Jun 21 02:48:49 2012 (r237349) @@ -253,7 +253,7 @@ The boot does not stop if such a script but a script can stop the boot if necessary by invoking the .Fn stop_boot function (from -.Xr rc.subr 8 ). +.Xr rc.subr 8 ) . .El .Pp Each script should contain Modified: stable/7/usr.sbin/cpucontrol/cpucontrol.8 ============================================================================== --- stable/7/usr.sbin/cpucontrol/cpucontrol.8 Wed Jun 20 23:53:36 2012 (r237348) +++ stable/7/usr.sbin/cpucontrol/cpucontrol.8 Thu Jun 21 02:48:49 2012 (r237349) @@ -31,7 +31,7 @@ .Nm cpucontrol .Nd control utility for the .Xr cpuctl 4 -device. +device .Sh SYNOPSIS .Nm .Op Fl vh Modified: stable/7/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- stable/7/usr.sbin/freebsd-update/freebsd-update.8 Wed Jun 20 23:53:36 2012 (r237348) +++ stable/7/usr.sbin/freebsd-update/freebsd-update.8 Thu Jun 21 02:48:49 2012 (r237349) @@ -62,7 +62,7 @@ Release Engineering Team, e.g., .Fx 7.0-CURRENT. .Sh OPTIONS -The following options are supported +The following options are supported: .Bl -tag -width "-f conffile" .It Fl b Ar basedir Operate on a system mounted at Modified: stable/7/usr.sbin/rtadvd/rtadvd.8 ============================================================================== --- stable/7/usr.sbin/rtadvd/rtadvd.8 Wed Jun 20 23:53:36 2012 (r237348) +++ stable/7/usr.sbin/rtadvd/rtadvd.8 Thu Jun 21 02:48:49 2012 (r237349) @@ -147,7 +147,7 @@ option, which enables routing renumberin .It Fl p Specify an alternative file in which to store the process ID. The default is -.Pa /var/run/rtadvd.pid. +.Pa /var/run/rtadvd.pid . .It Fl R Accept router renumbering requests. If you enable it, certain IPsec setup is suggested for security reasons. Modified: stable/7/usr.sbin/smbmsg/smbmsg.8 ============================================================================== --- stable/7/usr.sbin/smbmsg/smbmsg.8 Wed Jun 20 23:53:36 2012 (r237348) +++ stable/7/usr.sbin/smbmsg/smbmsg.8 Thu Jun 21 02:48:49 2012 (r237349) @@ -71,7 +71,7 @@ and writeable, respectively. The only valid additional option for this modus of operation (besides the .Fl p -option that choses the modus) is +option that chooses the modus) is .Fl f Ar dev . See below for a description. .Pp Modified: stable/7/usr.sbin/wpa/ndis_events/ndis_events.8 ============================================================================== --- stable/7/usr.sbin/wpa/ndis_events/ndis_events.8 Wed Jun 20 23:53:36 2012 (r237348) +++ stable/7/usr.sbin/wpa/ndis_events/ndis_events.8 Thu Jun 21 02:48:49 2012 (r237349) @@ -71,7 +71,7 @@ When it detects an event that was genera interface, it transmits it via UDP packet on the loopback interface, where .Xr wpa_supplicant 8 -is presumeably listening. +is presumably listening. The standard .Xr wpa_supplicant 8 distribution includes its own version of this utility for use with From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 03:10:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ECD761065674; Thu, 21 Jun 2012 03:10:48 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE4A68FC0A; Thu, 21 Jun 2012 03:10:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L3AmFg084979; Thu, 21 Jun 2012 03:10:48 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L3AmLd084976; Thu, 21 Jun 2012 03:10:48 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201206210310.q5L3AmLd084976@svn.freebsd.org> From: Max Khon Date: Thu, 21 Jun 2012 03:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237350 - head/sys/dev/puc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 03:10:49 -0000 Author: fjoe Date: Thu Jun 21 03:10:48 2012 New Revision: 237350 URL: http://svn.freebsd.org/changeset/base/237350 Log: Add support for the following Moxa PCIe multiport serial boards: - CP102E - CP102EL - CP132EL - CP114EL - CP118EL-A - CP168EL-A MFC after: 1 week Modified: head/sys/dev/puc/puc_cfg.h head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/puc_cfg.h ============================================================================== --- head/sys/dev/puc/puc_cfg.h Thu Jun 21 02:48:49 2012 (r237349) +++ head/sys/dev/puc/puc_cfg.h Thu Jun 21 03:10:48 2012 (r237350) @@ -79,7 +79,7 @@ struct puc_cfg { int8_t ports; int8_t rid; /* Rid of first port */ int8_t d_rid; /* Delta rid of next ports */ - int8_t d_ofs; /* Delta offset of next ports */ + int16_t d_ofs; /* Delta offset of next ports */ puc_config_f *config_function; }; Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Thu Jun 21 02:48:49 2012 (r237349) +++ head/sys/dev/puc/pucdata.c Thu Jun 21 03:10:48 2012 (r237350) @@ -507,6 +507,18 @@ const struct puc_cfg puc_pci_devices[] = .config_function = puc_config_quatech }, + { 0x1393, 0x1024, 0xffff, 0, + "Moxa Technologies, Smartio CP-102E/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x14, 0, 0x200 + }, + + { 0x1393, 0x1025, 0xffff, 0, + "Moxa Technologies, Smartio CP-102EL/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x14, 0, 0x200, + }, + { 0x1393, 0x1040, 0xffff, 0, "Moxa Technologies, Smartio C104H/PCI", DEFAULT_RCLK * 8, @@ -550,6 +562,25 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S, 0x18, 0, 8, }, + { 0x1393, 0x1144, 0xffff, 0, + "Moxa Technologies, Smartio CP-114EL/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x14, 0, -1, + .config_function = puc_config_moxa + }, + + { 0x1393, 0x1182, 0xffff, 0, + "Moxa Technologies, Smartio CP-118EL-A/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x14, 0, 0x200, + }, + + { 0x1393, 0x1322, 0xffff, 0, + "Moxa Technologies, Smartio CP-132EL/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x14, 0, 0x200, + }, + { 0x1393, 0x1680, 0xffff, 0, "Moxa Technologies, C168H/PCI", DEFAULT_RCLK * 8, @@ -568,6 +599,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_8S, 0x18, 0, 8, }, + { 0x1393, 0x1683, 0xffff, 0, + "Moxa Technologies, Smartio CP-168EL-A/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x14, 0, 0x200, + }, + { 0x13a8, 0x0152, 0xffff, 0, "Exar XR17C/D152", DEFAULT_RCLK * 8, @@ -1127,9 +1164,7 @@ static int puc_config_moxa(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { - const struct puc_cfg *cfg = sc->sc_cfg; - - if (cmd == PUC_CFG_GET_OFS && cfg->device == 0x1045) { + if (cmd == PUC_CFG_GET_OFS) { *res = ((port == 3) ? 7 : port) * 0x200; return 0; } From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 03:58:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 381C61065670; Thu, 21 Jun 2012 03:58:11 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08A708FC08; Thu, 21 Jun 2012 03:58:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L3wAaY087036; Thu, 21 Jun 2012 03:58:10 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L3wAmn087034; Thu, 21 Jun 2012 03:58:10 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201206210358.q5L3wAmn087034@svn.freebsd.org> From: Kirk McKusick Date: Thu, 21 Jun 2012 03:58:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237351 - stable/9/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 03:58:11 -0000 Author: mckusick Date: Thu Jun 21 03:58:10 2012 New Revision: 237351 URL: http://svn.freebsd.org/changeset/base/237351 Log: MFC of 236825 When synchronously syncing a device (MNT_WAIT), wait for buffers to become available. Otherwise we may excessively spin and fail with ``fsync: giving up on dirty''. Reviewed by: kib Tested by: Peter Holm Modified: stable/9/sys/kern/vfs_default.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/kern/vfs_default.c ============================================================================== --- stable/9/sys/kern/vfs_default.c Thu Jun 21 03:10:48 2012 (r237350) +++ stable/9/sys/kern/vfs_default.c Thu Jun 21 03:58:10 2012 (r237351) @@ -646,8 +646,17 @@ loop2: if ((bp->b_vflags & BV_SCANNED) != 0) continue; bp->b_vflags |= BV_SCANNED; - if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) - continue; + if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) { + if (ap->a_waitfor != MNT_WAIT) + continue; + if (BUF_LOCK(bp, + LK_EXCLUSIVE | LK_INTERLOCK | LK_SLEEPFAIL, + BO_MTX(bo)) != 0) { + BO_LOCK(bo); + goto loop1; + } + BO_LOCK(bo); + } BO_UNLOCK(bo); KASSERT(bp->b_bufobj == bo, ("bp %p wrong b_bufobj %p should be %p", From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 04:02:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A838A106564A; Thu, 21 Jun 2012 04:02:07 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91D958FC14; Thu, 21 Jun 2012 04:02:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L427rB087285; Thu, 21 Jun 2012 04:02:07 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L427FS087283; Thu, 21 Jun 2012 04:02:07 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201206210402.q5L427FS087283@svn.freebsd.org> From: Kirk McKusick Date: Thu, 21 Jun 2012 04:02:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237352 - stable/9/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 04:02:07 -0000 Author: mckusick Date: Thu Jun 21 04:02:07 2012 New Revision: 237352 URL: http://svn.freebsd.org/changeset/base/237352 Log: MFC of 236937 In softdep_setup_inomapdep() we may have to allocate both inodedep and bmsafemap dependency structures in inodedep_lookup() and bmsafemap_lookup() respectively. The setup of these structures must be done while holding the soft-dependency mutex. If the inodedep is allocated first, it may be freed in the I/O completion callback when the mutex is released to allocate the bmsafemap. If the bmsafemap is allocated first, it may be freed in the I/O completion callback when the mutex is released to allocate the inodedep. To resolve this problem, bmsafemap_lookup has had a parameter added that allows a pre-malloc'ed bmsafemap to be passed in so that it does not need to release the mutex to create a new bmsafemap. The softdep_setup_inomapdep() routine pre-malloc's a bmsafemap dependency before acquiring the mutex and starting to build the inodedep with a call to inodedep_lookup(). The subsequent call to bmsafemap_lookup() is passed this pre-allocated bmsafemap entry so that it need not release the mutex if it needs to create a new one. Reported by: Peter Holm Tested by: Peter Holm Modified: stable/9/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_softdep.c Thu Jun 21 03:58:10 2012 (r237351) +++ stable/9/sys/ufs/ffs/ffs_softdep.c Thu Jun 21 04:02:07 2012 (r237352) @@ -919,7 +919,7 @@ static struct freefrag *allocindir_merge static int bmsafemap_find(struct bmsafemap_hashhead *, struct mount *, int, struct bmsafemap **); static struct bmsafemap *bmsafemap_lookup(struct mount *, struct buf *, - int cg); + int cg, struct bmsafemap *); static int newblk_find(struct newblk_hashhead *, struct mount *, ufs2_daddr_t, int, struct newblk **); static int newblk_lookup(struct mount *, ufs2_daddr_t, int, struct newblk **); @@ -4707,12 +4707,26 @@ softdep_setup_inomapdep(bp, ip, newinum, * Panic if it already exists as something is seriously wrong. * Otherwise add it to the dependency list for the buffer holding * the cylinder group map from which it was allocated. + * + * We have to preallocate a bmsafemap entry in case it is needed + * in bmsafemap_lookup since once we allocate the inodedep, we + * have to finish initializing it before we can FREE_LOCK(). + * By preallocating, we avoid FREE_LOCK() while doing a malloc + * in bmsafemap_lookup. We cannot call bmsafemap_lookup before + * creating the inodedep as it can be freed during the time + * that we FREE_LOCK() while allocating the inodedep. We must + * call workitem_alloc() before entering the locked section as + * it also acquires the lock and we must avoid trying doing so + * recursively. */ + bmsafemap = malloc(sizeof(struct bmsafemap), + M_BMSAFEMAP, M_SOFTDEP_FLAGS); + workitem_alloc(&bmsafemap->sm_list, D_BMSAFEMAP, mp); ACQUIRE_LOCK(&lk); if ((inodedep_lookup(mp, newinum, DEPALLOC | NODELAY, &inodedep))) panic("softdep_setup_inomapdep: dependency %p for new" "inode already exists", inodedep); - bmsafemap = bmsafemap_lookup(mp, bp, ino_to_cg(fs, newinum)); + bmsafemap = bmsafemap_lookup(mp, bp, ino_to_cg(fs, newinum), bmsafemap); if (jaddref) { LIST_INSERT_HEAD(&bmsafemap->sm_jaddrefhd, jaddref, ja_bmdeps); TAILQ_INSERT_TAIL(&inodedep->id_inoreflst, &jaddref->ja_ref, @@ -4786,7 +4800,7 @@ softdep_setup_blkmapdep(bp, mp, newblkno if (newblk_lookup(mp, newblkno, DEPALLOC, &newblk) != 0) panic("softdep_setup_blkmapdep: found block"); newblk->nb_bmsafemap = bmsafemap = bmsafemap_lookup(mp, bp, - dtog(fs, newblkno)); + dtog(fs, newblkno), NULL); if (jnewblk) { jnewblk->jn_dep = (struct worklist *)newblk; LIST_INSERT_HEAD(&bmsafemap->sm_jnewblkhd, jnewblk, jn_deps); @@ -4827,13 +4841,16 @@ bmsafemap_find(bmsafemaphd, mp, cg, bmsa * Find the bmsafemap associated with a cylinder group buffer. * If none exists, create one. The buffer must be locked when * this routine is called and this routine must be called with - * splbio interrupts blocked. + * the softdep lock held. To avoid giving up the lock while + * allocating a new bmsafemap, a preallocated bmsafemap may be + * provided. If it is provided but not needed, it is freed. */ static struct bmsafemap * -bmsafemap_lookup(mp, bp, cg) +bmsafemap_lookup(mp, bp, cg, newbmsafemap) struct mount *mp; struct buf *bp; int cg; + struct bmsafemap *newbmsafemap; { struct bmsafemap_hashhead *bmsafemaphd; struct bmsafemap *bmsafemap, *collision; @@ -4843,16 +4860,27 @@ bmsafemap_lookup(mp, bp, cg) mtx_assert(&lk, MA_OWNED); if (bp) LIST_FOREACH(wk, &bp->b_dep, wk_list) - if (wk->wk_type == D_BMSAFEMAP) + if (wk->wk_type == D_BMSAFEMAP) { + if (newbmsafemap) + WORKITEM_FREE(newbmsafemap,D_BMSAFEMAP); return (WK_BMSAFEMAP(wk)); + } fs = VFSTOUFS(mp)->um_fs; bmsafemaphd = BMSAFEMAP_HASH(fs, cg); - if (bmsafemap_find(bmsafemaphd, mp, cg, &bmsafemap) == 1) + if (bmsafemap_find(bmsafemaphd, mp, cg, &bmsafemap) == 1) { + if (newbmsafemap) + WORKITEM_FREE(newbmsafemap, D_BMSAFEMAP); return (bmsafemap); - FREE_LOCK(&lk); - bmsafemap = malloc(sizeof(struct bmsafemap), - M_BMSAFEMAP, M_SOFTDEP_FLAGS); - workitem_alloc(&bmsafemap->sm_list, D_BMSAFEMAP, mp); + } + if (newbmsafemap) { + bmsafemap = newbmsafemap; + } else { + FREE_LOCK(&lk); + bmsafemap = malloc(sizeof(struct bmsafemap), + M_BMSAFEMAP, M_SOFTDEP_FLAGS); + workitem_alloc(&bmsafemap->sm_list, D_BMSAFEMAP, mp); + ACQUIRE_LOCK(&lk); + } bmsafemap->sm_buf = bp; LIST_INIT(&bmsafemap->sm_inodedephd); LIST_INIT(&bmsafemap->sm_inodedepwr); @@ -4862,7 +4890,6 @@ bmsafemap_lookup(mp, bp, cg) LIST_INIT(&bmsafemap->sm_jnewblkhd); LIST_INIT(&bmsafemap->sm_freehd); LIST_INIT(&bmsafemap->sm_freewr); - ACQUIRE_LOCK(&lk); if (bmsafemap_find(bmsafemaphd, mp, cg, &collision) == 1) { WORKITEM_FREE(bmsafemap, D_BMSAFEMAP); return (collision); @@ -10221,7 +10248,7 @@ softdep_setup_blkfree(mp, bp, blkno, fra ACQUIRE_LOCK(&lk); /* Lookup the bmsafemap so we track when it is dirty. */ fs = VFSTOUFS(mp)->um_fs; - bmsafemap = bmsafemap_lookup(mp, bp, dtog(fs, blkno)); + bmsafemap = bmsafemap_lookup(mp, bp, dtog(fs, blkno), NULL); /* * Detach any jnewblks which have been canceled. They must linger * until the bitmap is cleared again by ffs_blkfree() to prevent @@ -10267,7 +10294,7 @@ softdep_setup_blkfree(mp, bp, blkno, fra * allocation dependency. */ fs = VFSTOUFS(mp)->um_fs; - bmsafemap = bmsafemap_lookup(mp, bp, dtog(fs, blkno)); + bmsafemap = bmsafemap_lookup(mp, bp, dtog(fs, blkno), NULL); end = blkno + frags; LIST_FOREACH(jnewblk, &bmsafemap->sm_jnewblkhd, jn_deps) { /* From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 04:57:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3FD41065674; Thu, 21 Jun 2012 04:57:59 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FE918FC0C; Thu, 21 Jun 2012 04:57:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L4vx2H089870; Thu, 21 Jun 2012 04:57:59 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L4vx1f089868; Thu, 21 Jun 2012 04:57:59 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201206210457.q5L4vx1f089868@svn.freebsd.org> From: Max Khon Date: Thu, 21 Jun 2012 04:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237357 - head/sys/dev/puc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 04:57:59 -0000 Author: fjoe Date: Thu Jun 21 04:57:59 2012 New Revision: 237357 URL: http://svn.freebsd.org/changeset/base/237357 Log: Remove Moxa CP-132EL definition (RS422/485-only board). Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Thu Jun 21 04:52:26 2012 (r237356) +++ head/sys/dev/puc/pucdata.c Thu Jun 21 04:57:59 2012 (r237357) @@ -575,12 +575,6 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_8S, 0x14, 0, 0x200, }, - { 0x1393, 0x1322, 0xffff, 0, - "Moxa Technologies, Smartio CP-132EL/PCIe", - DEFAULT_RCLK * 8, - PUC_PORT_2S, 0x14, 0, 0x200, - }, - { 0x1393, 0x1680, 0xffff, 0, "Moxa Technologies, C168H/PCI", DEFAULT_RCLK * 8, From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 08:35:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A72E41065672; Thu, 21 Jun 2012 08:35:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90E708FC1F; Thu, 21 Jun 2012 08:35:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L8ZlR8099226; Thu, 21 Jun 2012 08:35:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L8ZlBS099224; Thu, 21 Jun 2012 08:35:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206210835.q5L8ZlBS099224@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Jun 2012 08:35:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237361 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 08:35:47 -0000 Author: kib Date: Thu Jun 21 08:35:47 2012 New Revision: 237361 URL: http://svn.freebsd.org/changeset/base/237361 Log: MFC r237061: Make sure that fstab fd is not leaked on exec. PR: kern/169023 Modified: stable/9/lib/libc/gen/fstab.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/fstab.c ============================================================================== --- stable/9/lib/libc/gen/fstab.c Thu Jun 21 07:48:14 2012 (r237360) +++ stable/9/lib/libc/gen/fstab.c Thu Jun 21 08:35:47 2012 (r237361) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -246,6 +247,8 @@ getfsfile(name) int setfsent() { + int fd; + if (_fs_fp) { rewind(_fs_fp); LineNo = 0; @@ -257,11 +260,18 @@ setfsent() else setfstab(getenv("PATH_FSTAB")); } - if ((_fs_fp = fopen(path_fstab, "r")) != NULL) { + fd = _open(path_fstab, O_RDONLY | O_CLOEXEC); + if (fd == -1) { + error(errno); + return (0); + } + _fs_fp = fdopen(fd, "r"); + if (_fs_fp != NULL) { LineNo = 0; return(1); } error(errno); + _close(fd); return(0); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 08:45:58 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 72B961065670; Thu, 21 Jun 2012 08:45:58 +0000 (UTC) (envelope-from SRS0=n8fm=EY=FreeBSD.org=brueffer@srs.kundenserver.de) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mx1.freebsd.org (Postfix) with ESMTP id F29428FC08; Thu, 21 Jun 2012 08:45:57 +0000 (UTC) Received: from ip235-179.wireless.lu.se (ip235-179.wireless.lu.se [130.235.235.179]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0Mam0Q-1SRbH30vpC-00JyNK; Thu, 21 Jun 2012 10:45:43 +0200 Message-ID: <4FE2DF35.5040804@FreeBSD.org> Date: Thu, 21 Jun 2012 10:45:41 +0200 From: Christian Brueffer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Steve Kargl References: <201204221818.q3MIIn4Y051313@svn.freebsd.org> <20120422184553.GA85374@troutmask.apl.washington.edu> In-Reply-To: <20120422184553.GA85374@troutmask.apl.washington.edu> Content-Type: multipart/mixed; boundary="------------010509040203020300000609" X-Provags-ID: V02:K0:ZXcv39qAy0XvvvssAm3RM666LfcvRFh1dkZixogyoJl D4Mlli+rbdfMwheUT9GPFUcQGS4fDH6gQ4KWYuFtTPJ4V2ojYk cLmHOCam5O2HlD7p3lGlVcnnXYfoI5WuS6R6uJs/TwGZZQ+qZO Kv5Gtn3YFoyzRJvSEZl9seuUuxPepbRmnTBF6iB3NDYXUIUTte OZmsNwfjcWqnPW7TDRN0tOOvRx3RwTNEwSGihVW1Ql6dyM+Bml YhqKWWnGDuxNpezNgFg74EdUmjOyeBkd8ZpHdFulYRn749bIdQ zpRDWF/K331PSCNNowb3HrOikToB4s0azWihzJf9Ss/sAGTzfx uwQZIxv9FfMwsC0e6gYq8B9xAmefp2rPZ65y3zolL Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r234577 - head/usr.bin/stat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 08:45:58 -0000 This is a multi-part message in MIME format. --------------010509040203020300000609 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 4/22/12 20:45 , Steve Kargl wrote: > On Sun, Apr 22, 2012 at 06:18:49PM +0000, Christian Brueffer wrote: >> Author: brueffer >> Date: Sun Apr 22 18:18:49 2012 >> New Revision: 234577 >> URL: http://svn.freebsd.org/changeset/base/234577 >> >> Log: >> Remove duplicate -l description. >> >> Submitted by: Rainer Hurling >> MFC after: 1 week > > The patch should have also fixed the misordering > of the -n, -qi, and -x options. > Hi Steve, sorry for the late reply. Could you say more specifically how you would arrange the order? From a small sampling of our manpages, it seems we don't have "one true" style of ordering options (except from alphabetically, see attached patch). Some manpages order A-Z, then a-z, while others (Apple and OpenBSD seem to do this) order AaBb...Zz. Cheers, Chris --------------010509040203020300000609 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="stat.1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stat.1.diff" Index: stat.1 =================================================================== --- stat.1 (revision 237294) +++ stat.1 (working copy) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 22, 2012 +.Dd June 21, 2012 .Dt STAT 1 .Os .Sh NAME @@ -140,6 +140,15 @@ fall back on .Xr lstat 2 and report information about the link. +.It Fl f Ar format +Display information using the specified format. +See the +.Sx Formats +section for a description of valid formats. +.It Fl l +Display output in +.Nm ls Fl lT +format. .It Fl n Do not force a newline to appear at the end of each piece of output. .It Fl q @@ -151,15 +160,6 @@ When run as .Nm readlink , error messages are automatically suppressed. -.It Fl f Ar format -Display information using the specified format. -See the -.Sx Formats -section for a description of valid formats. -.It Fl l -Display output in -.Nm ls Fl lT -format. .It Fl r Display raw information. That is, for all the fields in the @@ -172,15 +172,15 @@ .Dq shell output format, suitable for initializing variables. -.It Fl x -Display information in a more verbose way as known from some -.Tn Linux -distributions. .It Fl t Ar timefmt Display timestamps using the specified format. This format is passed directly to .Xr strftime 3 . +.It Fl x +Display information in a more verbose way as known from some +.Tn Linux +distributions. .El .Ss Formats Format strings are similar to --------------010509040203020300000609-- From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 08:55:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A71D106564A; Thu, 21 Jun 2012 08:55:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC48C8FC17; Thu, 21 Jun 2012 08:55:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L8t7Aq000157; Thu, 21 Jun 2012 08:55:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L8t7LV000155; Thu, 21 Jun 2012 08:55:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206210855.q5L8t7LV000155@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Jun 2012 08:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237362 - stable/8/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 08:55:08 -0000 Author: kib Date: Thu Jun 21 08:55:07 2012 New Revision: 237362 URL: http://svn.freebsd.org/changeset/base/237362 Log: MFC r237061: Make sure that fstab fd is not leaked on exec. PR: kern/169023 Modified: stable/8/lib/libc/gen/fstab.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/gen/fstab.c ============================================================================== --- stable/8/lib/libc/gen/fstab.c Thu Jun 21 08:35:47 2012 (r237361) +++ stable/8/lib/libc/gen/fstab.c Thu Jun 21 08:55:07 2012 (r237362) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -246,6 +247,8 @@ getfsfile(name) int setfsent() { + int fd; + if (_fs_fp) { rewind(_fs_fp); LineNo = 0; @@ -257,11 +260,18 @@ setfsent() else setfstab(getenv("PATH_FSTAB")); } - if ((_fs_fp = fopen(path_fstab, "r")) != NULL) { + fd = _open(path_fstab, O_RDONLY | O_CLOEXEC); + if (fd == -1) { + error(errno); + return (0); + } + _fs_fp = fdopen(fd, "r"); + if (_fs_fp != NULL) { LineNo = 0; return(1); } error(errno); + _close(fd); return(0); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:19:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9F3011065672; Thu, 21 Jun 2012 09:19:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 898518FC0A; Thu, 21 Jun 2012 09:19:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L9JgWn001683; Thu, 21 Jun 2012 09:19:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L9JfoW001681; Thu, 21 Jun 2012 09:19:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206210919.q5L9JfoW001681@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Jun 2012 09:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237365 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:19:42 -0000 Author: kib Date: Thu Jun 21 09:19:41 2012 New Revision: 237365 URL: http://svn.freebsd.org/changeset/base/237365 Log: Fix locking for f_offset, vn_read() and vn_write() cases only, for now. It seems that intended locking protocol for struct file f_offset field was as follows: f_offset should always be changed under the vnode lock (except fcntl(2) and lseek(2) did not followed the rules). Since read(2) uses shared vnode lock, FOFFSET_LOCKED block is additionally taken to serialize shared vnode lock owners. This was broken first by enabling shared lock on writes, then by fadvise changes, which moved f_offset assigned from under vnode lock, and last by vn_io_fault() doing chunked i/o. More, due to uio_offset not yet valid in vn_io_fault(), the range lock for reads was taken on the wrong region. Change the locking for f_offset to always use FOFFSET_LOCKED block, which is placed before rangelocks in the lock order. Extract foffset_lock() and foffset_unlock() functions which implements FOFFSET_LOCKED lock, and consistently lock f_offset with it in the vn_io_fault() both for reads and writes, even if MNTK_NO_IOPF flag is not set for the vnode mount. Indicate that f_offset is already valid for vn_read() and vn_write() calls from vn_io_fault() with FOF_OFFSET flag, and assert that all callers of vn_read() and vn_write() follow this protocol. Extract get_advice() function to calculate the POSIX_FADV_XXX value for the i/o region, and use it were appropriate. Reviewed by: jhb Tested by: pho MFC after: 2 weeks Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu Jun 21 09:12:33 2012 (r237364) +++ head/sys/kern/vfs_vnops.c Thu Jun 21 09:19:41 2012 (r237365) @@ -527,6 +527,66 @@ vn_rdwr_inchunks(rw, vp, base, len, offs return (error); } +static void +foffset_lock(struct file *fp, struct uio *uio, int flags) +{ + struct mtx *mtxp; + + if ((flags & FOF_OFFSET) != 0) + return; + + /* + * According to McKusick the vn lock was protecting f_offset here. + * It is now protected by the FOFFSET_LOCKED flag. + */ + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + while (fp->f_vnread_flags & FOFFSET_LOCKED) { + fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; + msleep(&fp->f_vnread_flags, mtxp, PUSER -1, + "vnread offlock", 0); + } + fp->f_vnread_flags |= FOFFSET_LOCKED; + uio->uio_offset = fp->f_offset; + mtx_unlock(mtxp); +} + +static int +get_advice(struct file *fp, struct uio *uio) +{ + struct mtx *mtxp; + int ret; + + ret = POSIX_FADV_NORMAL; + if (fp->f_advice == NULL) + return (ret); + + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + if (uio->uio_offset >= fp->f_advice->fa_start && + uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) + ret = fp->f_advice->fa_advice; + mtx_unlock(mtxp); + return (ret); +} + +static void +foffset_unlock(struct file *fp, struct uio *uio, int flags) +{ + struct mtx *mtxp; + + if ((flags & FOF_OFFSET) != 0) + return; + + fp->f_offset = uio->uio_offset; + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + if (fp->f_vnread_flags & FOFFSET_LOCK_WAITING) + wakeup(&fp->f_vnread_flags); + fp->f_vnread_flags = 0; + mtx_unlock(mtxp); +} + /* * File table vnode read routine. */ @@ -539,44 +599,22 @@ vn_read(fp, uio, active_cred, flags, td) struct thread *td; { struct vnode *vp; - int error, ioflag; struct mtx *mtxp; + int error, ioflag; int advice, vfslocked; off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); - mtxp = NULL; + KASSERT(flags & FOF_OFFSET, ("No FOF_OFFSET")); vp = fp->f_vnode; ioflag = 0; if (fp->f_flag & FNONBLOCK) ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; - advice = POSIX_FADV_NORMAL; + advice = get_advice(fp, uio); vfslocked = VFS_LOCK_GIANT(vp->v_mount); - /* - * According to McKusick the vn lock was protecting f_offset here. - * It is now protected by the FOFFSET_LOCKED flag. - */ - if ((flags & FOF_OFFSET) == 0 || fp->f_advice != NULL) { - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if ((flags & FOF_OFFSET) == 0) { - while (fp->f_vnread_flags & FOFFSET_LOCKED) { - fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; - msleep(&fp->f_vnread_flags, mtxp, PUSER -1, - "vnread offlock", 0); - } - fp->f_vnread_flags |= FOFFSET_LOCKED; - uio->uio_offset = fp->f_offset; - } - if (fp->f_advice != NULL && - uio->uio_offset >= fp->f_advice->fa_start && - uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) - advice = fp->f_advice->fa_advice; - mtx_unlock(mtxp); - } vn_lock(vp, LK_SHARED | LK_RETRY); switch (advice) { @@ -596,14 +634,6 @@ vn_read(fp, uio, active_cred, flags, td) if (error == 0) #endif error = VOP_READ(vp, uio, ioflag, fp->f_cred); - if ((flags & FOF_OFFSET) == 0) { - fp->f_offset = uio->uio_offset; - mtx_lock(mtxp); - if (fp->f_vnread_flags & FOFFSET_LOCK_WAITING) - wakeup(&fp->f_vnread_flags); - fp->f_vnread_flags = 0; - mtx_unlock(mtxp); - } fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0); if (error == 0 && advice == POSIX_FADV_NOREUSE && @@ -625,6 +655,7 @@ vn_read(fp, uio, active_cred, flags, td) */ start = offset; end = uio->uio_offset - 1; + mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); if (fp->f_advice != NULL && fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { @@ -656,13 +687,14 @@ vn_write(fp, uio, active_cred, flags, td { struct vnode *vp; struct mount *mp; - int error, ioflag, lock_flags; struct mtx *mtxp; + int error, ioflag, lock_flags; int advice, vfslocked; off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); + KASSERT(flags & FOF_OFFSET, ("No FOF_OFFSET")); vp = fp->f_vnode; vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type == VREG) @@ -681,6 +713,8 @@ vn_write(fp, uio, active_cred, flags, td if (vp->v_type != VCHR && (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) goto unlock; + + advice = get_advice(fp, uio); if ((MNT_SHARED_WRITES(mp) || ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) && @@ -691,19 +725,6 @@ vn_write(fp, uio, active_cred, flags, td } vn_lock(vp, lock_flags | LK_RETRY); - if ((flags & FOF_OFFSET) == 0) - uio->uio_offset = fp->f_offset; - advice = POSIX_FADV_NORMAL; - mtxp = NULL; - if (fp->f_advice != NULL) { - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if (fp->f_advice != NULL && - uio->uio_offset >= fp->f_advice->fa_start && - uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) - advice = fp->f_advice->fa_advice; - mtx_unlock(mtxp); - } switch (advice) { case POSIX_FADV_NORMAL: case POSIX_FADV_SEQUENTIAL: @@ -721,8 +742,6 @@ vn_write(fp, uio, active_cred, flags, td if (error == 0) #endif error = VOP_WRITE(vp, uio, ioflag, fp->f_cred); - if ((flags & FOF_OFFSET) == 0) - fp->f_offset = uio->uio_offset; fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0); if (vp->v_type != VCHR) @@ -761,6 +780,7 @@ vn_write(fp, uio, active_cred, flags, td */ start = offset; end = uio->uio_offset - 1; + mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); if (fp->f_advice != NULL && fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { @@ -845,11 +865,15 @@ vn_io_fault(struct file *fp, struct uio else doio = vn_write; vp = fp->f_vnode; + foffset_lock(fp, uio, flags); + if (uio->uio_segflg != UIO_USERSPACE || vp->v_type != VREG || ((mp = vp->v_mount) != NULL && (mp->mnt_kern_flag & MNTK_NO_IOPF) == 0) || - !vn_io_fault_enable) - return (doio(fp, uio, active_cred, flags, td)); + !vn_io_fault_enable) { + error = doio(fp, uio, active_cred, flags | FOF_OFFSET, td); + goto out_last; + } /* * The UFS follows IO_UNIT directive and replays back both @@ -882,7 +906,7 @@ vn_io_fault(struct file *fp, struct uio } save = vm_fault_disable_pagefaults(); - error = doio(fp, uio, active_cred, flags, td); + error = doio(fp, uio, active_cred, flags | FOF_OFFSET, td); if (error != EFAULT) goto out; @@ -933,7 +957,8 @@ vn_io_fault(struct file *fp, struct uio td->td_ma = ma; td->td_ma_cnt = cnt; - error = doio(fp, &short_uio, active_cred, flags, td); + error = doio(fp, &short_uio, active_cred, flags | FOF_OFFSET, + td); vm_page_unhold_pages(ma, cnt); adv = len - short_uio.uio_resid; @@ -956,6 +981,8 @@ out: vm_fault_enable_pagefaults(save); vn_rangelock_unlock(vp, rl_cookie); free(uio_clone, M_IOV); +out_last: + foffset_unlock(fp, uio, flags); return (error); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:20:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B924106566C; Thu, 21 Jun 2012 09:20:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 673B28FC1A; Thu, 21 Jun 2012 09:20:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L9K8IJ001747; Thu, 21 Jun 2012 09:20:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L9K8t5001745; Thu, 21 Jun 2012 09:20:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206210920.q5L9K8t5001745@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Jun 2012 09:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237366 - head/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:20:08 -0000 Author: kib Date: Thu Jun 21 09:20:07 2012 New Revision: 237366 URL: http://svn.freebsd.org/changeset/base/237366 Log: Fix unbounded-length malloc, controlled from usermode. The added check is performed before exact size of the buffer is calculated, but the buffer cannot have size greater then the total space allocated for extended attributes. The existing check is executing with precise size, but it is too late, since buffer needs to be allocated in advance. Also, adapt to uio_resid being of ssize_t type. Use lblktosize instead of multiplying by fs block size by hand as well. Reported and tested by: pho MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Thu Jun 21 09:19:41 2012 (r237365) +++ head/sys/ufs/ffs/ffs_vnops.c Thu Jun 21 09:20:07 2012 (r237366) @@ -1648,7 +1648,8 @@ vop_setextattr { struct inode *ip; struct fs *fs; uint32_t ealength, ul; - int ealen, olen, eapad1, eapad2, error, i, easize; + ssize_t ealen; + int olen, eapad1, eapad2, error, i, easize; u_char *eae, *p; ip = VTOI(ap->a_vp); @@ -1667,6 +1668,10 @@ vop_setextattr { if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); + ealen = ap->a_uio->uio_resid; + if (ealen < 0 || ealen > lblktosize(fs, NXADDR)) + return (EINVAL); + error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, VWRITE); if (error) { @@ -1684,7 +1689,6 @@ vop_setextattr { if (error) return (error); - ealen = ap->a_uio->uio_resid; ealength = sizeof(uint32_t) + 3 + strlen(ap->a_name); eapad1 = 8 - (ealength % 8); if (eapad1 == 8) @@ -1712,7 +1716,7 @@ vop_setextattr { easize += (ealength - ul); } } - if (easize > NXADDR * fs->fs_bsize) { + if (easize > lblktosize(fs, NXADDR)) { free(eae, M_TEMP); ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); if (ip->i_ea_area != NULL && ip->i_ea_error == 0) From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:26:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 439B01065676; Thu, 21 Jun 2012 09:26:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2ED398FC12; Thu, 21 Jun 2012 09:26:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L9Q7TR002033; Thu, 21 Jun 2012 09:26:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L9Q6nR002030; Thu, 21 Jun 2012 09:26:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206210926.q5L9Q6nR002030@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Jun 2012 09:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237367 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:26:07 -0000 Author: kib Date: Thu Jun 21 09:26:06 2012 New Revision: 237367 URL: http://svn.freebsd.org/changeset/base/237367 Log: Enable deadlock avoidance code for NFS client. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Thu Jun 21 09:20:07 2012 (r237366) +++ head/sys/fs/nfsclient/nfs_clbio.c Thu Jun 21 09:26:06 2012 (r237367) @@ -722,7 +722,7 @@ ncl_bioread(struct vnode *vp, struct uio }; if (n > 0) { - error = uiomove(bp->b_data + on, (int)n, uio); + error = vn_io_fault_uiomove(bp->b_data + on, (int)n, uio); } if (vp->v_type == VLNK) n = 0; @@ -1203,7 +1203,7 @@ again: } local_resid = uio->uio_resid; - error = uiomove((char *)bp->b_data + on, n, uio); + error = vn_io_fault_uiomove((char *)bp->b_data + on, n, uio); if (error != 0 && !bp_cached) { /* Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Thu Jun 21 09:20:07 2012 (r237366) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Thu Jun 21 09:26:06 2012 (r237367) @@ -1136,7 +1136,8 @@ nfs_mount(struct mount *mp) out: if (!error) { MNT_ILOCK(mp); - mp->mnt_kern_flag |= (MNTK_MPSAFE|MNTK_LOOKUP_SHARED); + mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED | + MNTK_NO_IOPF; MNT_IUNLOCK(mp); } return (error); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:30:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 183FB106566B; Thu, 21 Jun 2012 09:30:19 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-gg0-f182.google.com (mail-gg0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8BBA78FC1A; Thu, 21 Jun 2012 09:30:18 +0000 (UTC) Received: by ggnm2 with SMTP id m2so308698ggn.13 for ; Thu, 21 Jun 2012 02:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=12ePM4cyRtxN5auL9eBXav9cj5LJhvL60wjlg9RG2rs=; b=HF0rRGFmwfA8kTZei1ozvEbhaZ37mvwVu/5o1P4tfWdtSMzdtZIioon5X8ie1fbVmm 0DfHIfG6vayoFDr7e7xwJpp0+s1dzMc0TyGcOzaDBD69BHKYkb7wqpWf3DomySyGB4gV oVeuoloiZr6Ol8XrHNDJ05jsQvbCJpT+5o8edHwYrsCA94XM6gkUUwccv4DU0wNum1VK fEt1DWobYfG6ssQIW8X0sK1jQmnskUdf96kNRY6HsdkxqBHos8El3NgIIcLTBl7NDr3Z xwuqXDt27nvQaZKj+OZ2hqRGyO2ysPD8IwuM/6MPbr9Yof6sdmLdmIvgBYnSru5Zs3A+ 3geQ== MIME-Version: 1.0 Received: by 10.50.149.134 with SMTP id ua6mr6780069igb.11.1340271017717; Thu, 21 Jun 2012 02:30:17 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.64.8.170 with HTTP; Thu, 21 Jun 2012 02:30:17 -0700 (PDT) In-Reply-To: <201206201825.q5KIPpjQ060916@svn.freebsd.org> References: <201206201825.q5KIPpjQ060916@svn.freebsd.org> Date: Thu, 21 Jun 2012 13:30:17 +0400 X-Google-Sender-Auth: fMHJ8rxJwhYRJj07F0LJqvArTxc Message-ID: From: Sergey Kandaurov To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Oliver Fromme Subject: Re: svn commit: r237335 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:30:19 -0000 On 20 June 2012 22:25, Alexander Motin wrote: > Author: mav > Date: Wed Jun 20 18:25:51 2012 > New Revision: 237335 > URL: http://svn.freebsd.org/changeset/base/237335 > > Log: > =A0Check status of cam_periph_hold() inside cdclose(). =A0If cd device wa= s > =A0invalidated while open, cam_periph_hold() will return error and won't > =A0get the reference. =A0Following reference release will crash the syste= m. > > =A0Sponsored by: iXsystems, Inc. > =A0MFC after: =A0 =A03 days > > Modified: > =A0head/sys/cam/scsi/scsi_cd.c > > Modified: head/sys/cam/scsi/scsi_cd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:00:26 2012 =A0 =A0 =A0 =A0(= r237334) > +++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012 =A0 =A0 =A0 =A0(= r237335) > @@ -1041,6 +1041,7 @@ cdclose(struct disk *dp) > =A0{ > =A0 =A0 =A0 =A0struct =A0cam_periph *periph; > =A0 =A0 =A0 =A0struct =A0cd_softc *softc; > + =A0 =A0 =A0 int error; > > =A0 =A0 =A0 =A0periph =3D (struct cam_periph *)dp->d_drv1; > =A0 =A0 =A0 =A0if (periph =3D=3D NULL) > @@ -1049,7 +1050,11 @@ cdclose(struct disk *dp) > =A0 =A0 =A0 =A0softc =3D (struct cd_softc *)periph->softc; > > =A0 =A0 =A0 =A0cam_periph_lock(periph); > - =A0 =A0 =A0 cam_periph_hold(periph, PRIBIO); > + =A0 =A0 =A0 if ((error =3D cam_periph_hold(periph, PRIBIO)) !=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cam_periph_unlock(periph); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cam_periph_release(periph); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (0); > + =A0 =A0 =A0 } > > =A0 =A0 =A0 =A0CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH= , > =A0 =A0 =A0 =A0 =A0 =A0("cdclose\n")); Hi. Does it fix the reported crash with cd refcount underflow? It seems so. http://lists.freebsd.org/pipermail/freebsd-stable/2012-June/068175.html --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:48:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3DD7110656A6; Thu, 21 Jun 2012 09:48:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26BC28FC0C; Thu, 21 Jun 2012 09:48:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L9mEFl003112; Thu, 21 Jun 2012 09:48:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L9mDeY003110; Thu, 21 Jun 2012 09:48:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206210948.q5L9mDeY003110@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 09:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237370 - stable/9/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:48:14 -0000 Author: marius Date: Thu Jun 21 09:48:13 2012 New Revision: 237370 URL: http://svn.freebsd.org/changeset/base/237370 Log: MFC: r237234 Avoid hard sentence break. Modified: stable/9/share/man/man4/ahci.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/ahci.4 ============================================================================== --- stable/9/share/man/man4/ahci.4 Thu Jun 21 09:47:05 2012 (r237369) +++ stable/9/share/man/man4/ahci.4 Thu Jun 21 09:48:13 2012 (r237370) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 6, 2011 +.Dd June 18, 2012 .Dt AHCI 4 .Os .Sh NAME @@ -98,7 +98,8 @@ setting to nonzero value limits maximum Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. .It Va hw.ahci.force setting to nonzero value forces driver attach to some known AHCI-capable -chips even if they are configured for legacy IDE emulation. Default is 1. +chips even if they are configured for legacy IDE emulation. +Default is 1. .El .Sh DESCRIPTION This driver provides the From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:48:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E39AA1065790; Thu, 21 Jun 2012 09:48:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2AF78FC16; Thu, 21 Jun 2012 09:48:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L9mLWq003153; Thu, 21 Jun 2012 09:48:21 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L9mLe3003151; Thu, 21 Jun 2012 09:48:21 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206210948.q5L9mLe3003151@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 09:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237371 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:48:23 -0000 Author: marius Date: Thu Jun 21 09:48:21 2012 New Revision: 237371 URL: http://svn.freebsd.org/changeset/base/237371 Log: MFC: r237234 Avoid hard sentence break. Modified: stable/8/share/man/man4/ahci.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ahci.4 ============================================================================== --- stable/8/share/man/man4/ahci.4 Thu Jun 21 09:48:13 2012 (r237370) +++ stable/8/share/man/man4/ahci.4 Thu Jun 21 09:48:21 2012 (r237371) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 6, 2011 +.Dd June 18, 2012 .Dt AHCI 4 .Os .Sh NAME @@ -99,7 +99,8 @@ setting to nonzero value limits maximum Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. .It Va hw.ahci.force setting to nonzero value forces driver attach to some known AHCI-capable -chips even if they are configured for legacy IDE emulation. Default is 1. +chips even if they are configured for legacy IDE emulation. +Default is 1. .El .Sh DESCRIPTION This driver provides the From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:51:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41393106566B; Thu, 21 Jun 2012 09:51:51 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 11E818FC29; Thu, 21 Jun 2012 09:51:49 +0000 (UTC) Received: by lbon10 with SMTP id n10so2339427lbo.13 for ; Thu, 21 Jun 2012 02:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=G5lQGJRTWb3baTo6RU58Pp/+W5dJ5vHccjZoucXeABI=; b=cl5phq0m5kt6rM97YGSv0ur3YNv6FsE59mvUh6a9duIH8PPiUgdyH967t924KwT+qG DcbiaGaaM5d/+Bvq4DABKUrTYpp0FaRmGM1BgQyURDYKgkoK1lsir0+rIV0P1zmL/J8P GrQOy4sa2cK+7GtSajYAtEPkLOjcebJkVOBw3Fxre48kjP+77VWxYffBlBbCiB2lGbKG 5KLBGvcxPtdiu+k0vqPuDU3j8S1fvRCKcNSk1GDnNNJ/og5ae13e+TsD1UlfISEoxcXa /9NjemziRSAVWAFwlnp8eqrYUYvMI3tYpV750zHQsFJI0OZ7q8z1CQp84m7j0P0UL+tQ TSxA== Received: by 10.112.24.194 with SMTP id w2mr11348720lbf.75.1340272308897; Thu, 21 Jun 2012 02:51:48 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id p2sm18202725lbj.4.2012.06.21.02.51.43 (version=SSLv3 cipher=OTHER); Thu, 21 Jun 2012 02:51:44 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FE2EEAD.3070706@FreeBSD.org> Date: Thu, 21 Jun 2012 12:51:41 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120506 Thunderbird/12.0.1 MIME-Version: 1.0 To: Sergey Kandaurov References: <201206201825.q5KIPpjQ060916@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Oliver Fromme Subject: Re: svn commit: r237335 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:51:51 -0000 On 06/21/12 12:30, Sergey Kandaurov wrote: > On 20 June 2012 22:25, Alexander Motin wrote: >> Author: mav >> Date: Wed Jun 20 18:25:51 2012 >> New Revision: 237335 >> URL: http://svn.freebsd.org/changeset/base/237335 >> >> Log: >> Check status of cam_periph_hold() inside cdclose(). If cd device was >> invalidated while open, cam_periph_hold() will return error and won't >> get the reference. Following reference release will crash the system. >> >> Sponsored by: iXsystems, Inc. >> MFC after: 3 days >> >> Modified: >> head/sys/cam/scsi/scsi_cd.c >> >> Modified: head/sys/cam/scsi/scsi_cd.c >> ============================================================================== >> --- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:00:26 2012 (r237334) >> +++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012 (r237335) >> @@ -1041,6 +1041,7 @@ cdclose(struct disk *dp) >> { >> struct cam_periph *periph; >> struct cd_softc *softc; >> + int error; >> >> periph = (struct cam_periph *)dp->d_drv1; >> if (periph == NULL) >> @@ -1049,7 +1050,11 @@ cdclose(struct disk *dp) >> softc = (struct cd_softc *)periph->softc; >> >> cam_periph_lock(periph); >> - cam_periph_hold(periph, PRIBIO); >> + if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { >> + cam_periph_unlock(periph); >> + cam_periph_release(periph); >> + return (0); >> + } >> >> CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, >> ("cdclose\n")); > > Does it fix the reported crash with cd refcount underflow? It seems so. > http://lists.freebsd.org/pipermail/freebsd-stable/2012-June/068175.html Yes, I think it should. At least diagnostics looks very alike. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:57:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 415F0106564A; Thu, 21 Jun 2012 09:57:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C0728FC18; Thu, 21 Jun 2012 09:57:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L9vUBx003591; Thu, 21 Jun 2012 09:57:30 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L9vTe5003589; Thu, 21 Jun 2012 09:57:29 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206210957.q5L9vTe5003589@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 09:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237372 - stable/9/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:57:30 -0000 Author: marius Date: Thu Jun 21 09:57:29 2012 New Revision: 237372 URL: http://svn.freebsd.org/changeset/base/237372 Log: MFC: r237235 Document the hw.ahci.force tunable here, too, as it's also used by ataahci(4) and atanvidia(4). Modified: stable/9/share/man/man4/ata.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/ata.4 ============================================================================== --- stable/9/share/man/man4/ata.4 Thu Jun 21 09:48:21 2012 (r237371) +++ stable/9/share/man/man4/ata.4 Thu Jun 21 09:57:29 2012 (r237372) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 17, 2011 +.Dd June 18, 2012 .Dt ATA 4 .Os .Sh NAME @@ -89,8 +89,12 @@ subsystem module. The following tunables are settable from the .Xr loader 8 : .Bl -ohang +.It Va hw.ahci.force +set to nonzero value for forcing drivers to attach to some known AHCI-capable +chips even if they are configured for legacy IDE emulation (the default is 1, +force the attach). .It Va hw.ata.ata_dma_check_80pin -set to 0 to disable the 80pin cable check (the default is 1, check the cable) +set to 0 to disable the 80pin cable check (the default is 1, check the cable). .It Va hint.atapci.X.msi set to 1 to allow Message Signalled Interrupts (MSI) to be used by the specified PCI ATA controller, if supported. From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 09:57:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D77CF106566B; Thu, 21 Jun 2012 09:57:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1EFB8FC08; Thu, 21 Jun 2012 09:57:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L9vYTI003638; Thu, 21 Jun 2012 09:57:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L9vYcd003635; Thu, 21 Jun 2012 09:57:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206210957.q5L9vYcd003635@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 09:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237373 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 09:57:35 -0000 Author: marius Date: Thu Jun 21 09:57:34 2012 New Revision: 237373 URL: http://svn.freebsd.org/changeset/base/237373 Log: MFC: r237235 Document the hw.ahci.force tunable here, too, as it's also used by ataahci(4) and atanvidia(4). Modified: stable/8/share/man/man4/ata.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ata.4 ============================================================================== --- stable/8/share/man/man4/ata.4 Thu Jun 21 09:57:29 2012 (r237372) +++ stable/8/share/man/man4/ata.4 Thu Jun 21 09:57:34 2012 (r237373) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2010 +.Dd June 18, 2012 .Dt ATA 4 .Os .Sh NAME @@ -90,10 +90,14 @@ APIs and periperal drivers): .Pp The following tunables are settable from the loader: .Bl -ohang +.It Va hw.ahci.force +set to nonzero value for forcing drivers to attach to some known AHCI-capable +chips even if they are configured for legacy IDE emulation (the default is 1, +force the attach). .It Va hw.ata.ata_dma set to 1 for DMA access, 0 for PIO (default is DMA). .It Va hw.ata.ata_dma_check_80pin -set to 0 to disable the 80pin cable check (default is 1, check the cable) +set to 0 to disable the 80pin cable check (default is 1, check the cable). .It Va hw.ata.atapi_dma set to 1 for DMA access, 0 for PIO (default is DMA). .It Va hw.ata.wc From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 10:29:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 217371065670; Thu, 21 Jun 2012 10:29:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B9B98FC0C; Thu, 21 Jun 2012 10:29:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LASxPL006857; Thu, 21 Jun 2012 10:28:59 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LASxnI006853; Thu, 21 Jun 2012 10:28:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206211028.q5LASxnI006853@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Jun 2012 10:28:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237378 - stable/9/sys/dev/mvs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 10:29:00 -0000 Author: mav Date: Thu Jun 21 10:28:59 2012 New Revision: 237378 URL: http://svn.freebsd.org/changeset/base/237378 Log: MFC r236952: - Limit r214102 workaround to only x86. On arm it causes more problems then solves because of cache coherency issues. This fixes periodic error messages on console and command timeouts. - Patch SATA PHY configuration for 65nm SoCs to improve SNR same as Linux does. Modified: stable/9/sys/dev/mvs/mvs.c stable/9/sys/dev/mvs/mvs.h stable/9/sys/dev/mvs/mvs_soc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mvs/mvs.c ============================================================================== --- stable/9/sys/dev/mvs/mvs.c Thu Jun 21 10:21:33 2012 (r237377) +++ stable/9/sys/dev/mvs/mvs.c Thu Jun 21 10:28:59 2012 (r237378) @@ -1048,14 +1048,19 @@ mvs_crbq_intr(device_t dev) * Handle only successfull completions here. * Errors will be handled by main intr handler. */ +#if defined(__i386__) || defined(__amd64__) if (crpb->id == 0xffff && crpb->rspflg == 0xffff) { device_printf(dev, "Unfilled CRPB " "%d (%d->%d) tag %d flags %04x rs %08x\n", cin_idx, fin_idx, in_idx, slot, flags, ch->rslots); - } else if (ch->numtslots != 0 || + } else +#endif + if (ch->numtslots != 0 || (flags & EDMA_IE_EDEVERR) == 0) { +#if defined(__i386__) || defined(__amd64__) crpb->id = 0xffff; crpb->rspflg = 0xffff; +#endif if (ch->slot[slot].state >= MVS_SLOT_RUNNING) { ccb = ch->slot[slot].ccb; ccb->ataio.res.status = @@ -1999,6 +2004,39 @@ mvs_reset_to(void *arg) } static void +mvs_errata(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + uint32_t val; + + if (ch->quirks & MVS_Q_SOC65) { + val = ATA_INL(ch->r_mem, SATA_PHYM3); + val &= ~(0x3 << 27); /* SELMUPF = 1 */ + val |= (0x1 << 27); + val &= ~(0x3 << 29); /* SELMUPI = 1 */ + val |= (0x1 << 29); + ATA_OUTL(ch->r_mem, SATA_PHYM3, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM4); + val &= ~0x1; /* SATU_OD8 = 0 */ + val |= (0x1 << 16); /* reserved bit 16 = 1 */ + ATA_OUTL(ch->r_mem, SATA_PHYM4, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM9_GEN2); + val &= ~0xf; /* TXAMP[3:0] = 8 */ + val |= 0x8; + val &= ~(0x1 << 14); /* TXAMP[4] = 0 */ + ATA_OUTL(ch->r_mem, SATA_PHYM9_GEN2, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM9_GEN1); + val &= ~0xf; /* TXAMP[3:0] = 8 */ + val |= 0x8; + val &= ~(0x1 << 14); /* TXAMP[4] = 0 */ + ATA_OUTL(ch->r_mem, SATA_PHYM9_GEN1, val); + } +} + +static void mvs_reset(device_t dev) { struct mvs_channel *ch = device_get_softc(dev); @@ -2044,6 +2082,7 @@ mvs_reset(device_t dev) ATA_OUTL(ch->r_mem, EDMA_CMD, EDMA_CMD_EATARST); DELAY(25); ATA_OUTL(ch->r_mem, EDMA_CMD, 0); + mvs_errata(dev); /* Reset and reconnect PHY, */ if (!mvs_sata_phy_reset(dev)) { if (bootverbose) Modified: stable/9/sys/dev/mvs/mvs.h ============================================================================== --- stable/9/sys/dev/mvs/mvs.h Thu Jun 21 10:21:33 2012 (r237377) +++ stable/9/sys/dev/mvs/mvs.h Thu Jun 21 10:28:59 2012 (r237378) @@ -382,6 +382,10 @@ #define SATA_FISDW5 0x384 /* FIS DW5 */ #define SATA_FISDW6 0x388 /* FIS DW6 */ +#define SATA_PHYM9_GEN2 0x398 +#define SATA_PHYM9_GEN1 0x39c +#define SATA_PHYCFG_OFS 0x3a0 /* 65nm SoCs only */ + #define MVS_MAX_PORTS 8 #define MVS_MAX_SLOTS 32 @@ -537,6 +541,7 @@ struct mvs_channel { #define MVS_Q_GENIIE 4 #define MVS_Q_SOC 8 #define MVS_Q_CT 16 +#define MVS_Q_SOC65 32 int pm_level; /* power management level */ struct mvs_slot slot[MVS_MAX_SLOTS]; Modified: stable/9/sys/dev/mvs/mvs_soc.c ============================================================================== --- stable/9/sys/dev/mvs/mvs_soc.c Thu Jun 21 10:21:33 2012 (r237377) +++ stable/9/sys/dev/mvs/mvs_soc.c Thu Jun 21 10:28:59 2012 (r237378) @@ -135,6 +135,8 @@ mvs_attach(device_t dev) if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &ctlr->r_rid, RF_ACTIVE))) return ENXIO; + if (ATA_INL(ctlr->r_mem, PORT_BASE(0) + SATA_PHYCFG_OFS) != 0) + ctlr->quirks |= MVS_Q_SOC65; /* Setup our own memory management for channels. */ ctlr->sc_iomem.rm_start = rman_get_start(ctlr->r_mem); ctlr->sc_iomem.rm_end = rman_get_end(ctlr->r_mem); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 10:41:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 064AA106566B; Thu, 21 Jun 2012 10:41:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E42438FC08; Thu, 21 Jun 2012 10:41:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LAfRdr007480; Thu, 21 Jun 2012 10:41:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LAfRwH007476; Thu, 21 Jun 2012 10:41:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206211041.q5LAfRwH007476@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Jun 2012 10:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237379 - stable/8/sys/dev/mvs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 10:41:28 -0000 Author: mav Date: Thu Jun 21 10:41:27 2012 New Revision: 237379 URL: http://svn.freebsd.org/changeset/base/237379 Log: MFC r236952: - Limit r214102 workaround to only x86. On arm it causes more problems then solves because of cache coherency issues. This fixes periodic error messages on console and command timeouts. - Patch SATA PHY configuration for 65nm SoCs to improve SNR same as Linux does. Modified: stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/mvs/mvs.h stable/8/sys/dev/mvs/mvs_soc.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Thu Jun 21 10:28:59 2012 (r237378) +++ stable/8/sys/dev/mvs/mvs.c Thu Jun 21 10:41:27 2012 (r237379) @@ -1047,14 +1047,19 @@ mvs_crbq_intr(device_t dev) * Handle only successfull completions here. * Errors will be handled by main intr handler. */ +#if defined(__i386__) || defined(__amd64__) if (crpb->id == 0xffff && crpb->rspflg == 0xffff) { device_printf(dev, "Unfilled CRPB " "%d (%d->%d) tag %d flags %04x rs %08x\n", cin_idx, fin_idx, in_idx, slot, flags, ch->rslots); - } else if (ch->numtslots != 0 || + } else +#endif + if (ch->numtslots != 0 || (flags & EDMA_IE_EDEVERR) == 0) { +#if defined(__i386__) || defined(__amd64__) crpb->id = 0xffff; crpb->rspflg = 0xffff; +#endif if (ch->slot[slot].state >= MVS_SLOT_RUNNING) { ccb = ch->slot[slot].ccb; ccb->ataio.res.status = @@ -1998,6 +2003,39 @@ mvs_reset_to(void *arg) } static void +mvs_errata(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + uint32_t val; + + if (ch->quirks & MVS_Q_SOC65) { + val = ATA_INL(ch->r_mem, SATA_PHYM3); + val &= ~(0x3 << 27); /* SELMUPF = 1 */ + val |= (0x1 << 27); + val &= ~(0x3 << 29); /* SELMUPI = 1 */ + val |= (0x1 << 29); + ATA_OUTL(ch->r_mem, SATA_PHYM3, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM4); + val &= ~0x1; /* SATU_OD8 = 0 */ + val |= (0x1 << 16); /* reserved bit 16 = 1 */ + ATA_OUTL(ch->r_mem, SATA_PHYM4, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM9_GEN2); + val &= ~0xf; /* TXAMP[3:0] = 8 */ + val |= 0x8; + val &= ~(0x1 << 14); /* TXAMP[4] = 0 */ + ATA_OUTL(ch->r_mem, SATA_PHYM9_GEN2, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM9_GEN1); + val &= ~0xf; /* TXAMP[3:0] = 8 */ + val |= 0x8; + val &= ~(0x1 << 14); /* TXAMP[4] = 0 */ + ATA_OUTL(ch->r_mem, SATA_PHYM9_GEN1, val); + } +} + +static void mvs_reset(device_t dev) { struct mvs_channel *ch = device_get_softc(dev); @@ -2043,6 +2081,7 @@ mvs_reset(device_t dev) ATA_OUTL(ch->r_mem, EDMA_CMD, EDMA_CMD_EATARST); DELAY(25); ATA_OUTL(ch->r_mem, EDMA_CMD, 0); + mvs_errata(dev); /* Reset and reconnect PHY, */ if (!mvs_sata_phy_reset(dev)) { if (bootverbose) Modified: stable/8/sys/dev/mvs/mvs.h ============================================================================== --- stable/8/sys/dev/mvs/mvs.h Thu Jun 21 10:28:59 2012 (r237378) +++ stable/8/sys/dev/mvs/mvs.h Thu Jun 21 10:41:27 2012 (r237379) @@ -379,6 +379,10 @@ #define SATA_FISDW5 0x384 /* FIS DW5 */ #define SATA_FISDW6 0x388 /* FIS DW6 */ +#define SATA_PHYM9_GEN2 0x398 +#define SATA_PHYM9_GEN1 0x39c +#define SATA_PHYCFG_OFS 0x3a0 /* 65nm SoCs only */ + #define MVS_MAX_PORTS 8 #define MVS_MAX_SLOTS 32 @@ -534,6 +538,7 @@ struct mvs_channel { #define MVS_Q_GENIIE 4 #define MVS_Q_SOC 8 #define MVS_Q_CT 16 +#define MVS_Q_SOC65 32 int pm_level; /* power management level */ struct mvs_slot slot[MVS_MAX_SLOTS]; Modified: stable/8/sys/dev/mvs/mvs_soc.c ============================================================================== --- stable/8/sys/dev/mvs/mvs_soc.c Thu Jun 21 10:28:59 2012 (r237378) +++ stable/8/sys/dev/mvs/mvs_soc.c Thu Jun 21 10:41:27 2012 (r237379) @@ -130,6 +130,8 @@ mvs_attach(device_t dev) if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &ctlr->r_rid, RF_ACTIVE))) return ENXIO; + if (ATA_INL(ctlr->r_mem, PORT_BASE(0) + SATA_PHYCFG_OFS) != 0) + ctlr->quirks |= MVS_Q_SOC65; /* Setup our own memory management for channels. */ ctlr->sc_iomem.rm_start = rman_get_start(ctlr->r_mem); ctlr->sc_iomem.rm_end = rman_get_end(ctlr->r_mem); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 11:06:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 41DE510656B1; Thu, 21 Jun 2012 11:06:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D53F8FC16; Thu, 21 Jun 2012 11:06:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LB6TCv008636; Thu, 21 Jun 2012 11:06:29 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LB6TFd008632; Thu, 21 Jun 2012 11:06:29 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211106.q5LB6TFd008632@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 11:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237380 - in stable/9/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 11:06:30 -0000 Author: marius Date: Thu Jun 21 11:06:29 2012 New Revision: 237380 URL: http://svn.freebsd.org/changeset/base/237380 Log: MFC: r230242, r237102, r237236 - Add support for the FT2232 based egnite Turtelizer 2 JTAG/RS232 Adapter. This includes adding support for skipping FTDI interfaces used for JTAG leaving them for userland and just attaching to the RS232 half, similarly to how the corresponding Linux drivers handles these kind of adapters. While at it, sort uftdi_devs and return BUS_PROBE_SPECIFIC (because uftdi_probe() alters the instance variables for better or worse as do other probe routines of USB drivers) instead of 0. - Remove duplicated entries for BeagleBone. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. - Remove some stray lines. Modified: stable/9/sys/dev/usb/serial/uftdi.c stable/9/sys/dev/usb/serial/uftdi_reg.h stable/9/sys/dev/usb/usbdevs Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/9/sys/dev/usb/serial/uftdi.c Thu Jun 21 10:41:27 2012 (r237379) +++ stable/9/sys/dev/usb/serial/uftdi.c Thu Jun 21 11:06:29 2012 (r237380) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); */ /* - * FTDI FT8U100AX serial adapter driver + * FTDI FT2232x, FT8U100AX and FT8U232AM serial adapter driver */ #include @@ -81,7 +81,7 @@ SYSCTL_INT(_hw_usb_uftdi, OID_AUTO, debu #endif #define UFTDI_CONFIG_INDEX 0 -#define UFTDI_IFACE_INDEX 0 +#define UFTDI_IFACE_INDEX_JTAG 0 #define UFTDI_OBUFSIZE 64 /* bytes, cannot be increased due to * do size encoding */ @@ -102,10 +102,10 @@ struct uftdi_softc { struct mtx sc_mtx; uint32_t sc_unit; - enum uftdi_type sc_type; uint16_t sc_last_lcr; + uint8_t sc_type; uint8_t sc_iface_index; uint8_t sc_hdrlen; uint8_t sc_msr; @@ -190,7 +190,7 @@ static device_method_t uftdi_methods[] = DEVMETHOD(device_attach, uftdi_attach), DEVMETHOD(device_detach, uftdi_detach), - {0, 0} + DEVMETHOD_END }; static devclass_t uftdi_devclass; @@ -201,58 +201,61 @@ static driver_t uftdi_driver = { .size = sizeof(struct uftdi_softc), }; -DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); +DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, NULL); MODULE_DEPEND(uftdi, ucom, 1, 1, 1); MODULE_DEPEND(uftdi, usb, 1, 1, 1); MODULE_VERSION(uftdi, 1); -static STRUCT_USB_HOST_ID uftdi_devs[] = { -#define UFTDI_DEV(v,p,t) \ - { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, UFTDI_TYPE_##t) } - UFTDI_DEV(ATMEL, STK541, 8U232AM), - UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 8U232AM), - UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 8U232AM), - UFTDI_DEV(FALCOM, TWIST, 8U232AM), - UFTDI_DEV(FTDI, GAMMASCOUT, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U100AX, SIO), - UFTDI_DEV(FTDI, SERIAL_2232C, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_2232D, 8U232AM), - UFTDI_DEV(FTDI, BEAGLEBONE, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_4232H, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U232AM, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U232AM4, 8U232AM), - UFTDI_DEV(FTDI, SEMC_DSS20, 8U232AM), - UFTDI_DEV(FTDI, CFA_631, 8U232AM), - UFTDI_DEV(FTDI, CFA_632, 8U232AM), - UFTDI_DEV(FTDI, CFA_633, 8U232AM), - UFTDI_DEV(FTDI, CFA_634, 8U232AM), - UFTDI_DEV(FTDI, CFA_635, 8U232AM), - UFTDI_DEV(FTDI, USB_UIRT, 8U232AM), - UFTDI_DEV(FTDI, USBSERIAL, 8U232AM), - UFTDI_DEV(FTDI, KBS, 8U232AM), - UFTDI_DEV(FTDI, MX2_3, 8U232AM), - UFTDI_DEV(FTDI, MX4_5, 8U232AM), - UFTDI_DEV(FTDI, LK202, 8U232AM), - UFTDI_DEV(FTDI, LK204, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13M, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13S, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13U, 8U232AM), - UFTDI_DEV(FTDI, EISCOU, 8U232AM), - UFTDI_DEV(FTDI, UOPTBR, 8U232AM), - UFTDI_DEV(FTDI, EMCU2D, 8U232AM), - UFTDI_DEV(FTDI, PCMSFU, 8U232AM), - UFTDI_DEV(FTDI, EMCU2H, 8U232AM), - UFTDI_DEV(FTDI, MAXSTREAM, 8U232AM), - UFTDI_DEV(FTDI, CTI_USB_NANO_485, 8U232AM), - UFTDI_DEV(FTDI, CTI_USB_MINI_485, 8U232AM), - UFTDI_DEV(SIIG2, US2308, 8U232AM), - UFTDI_DEV(INTREPIDCS, VALUECAN, 8U232AM), - UFTDI_DEV(INTREPIDCS, NEOVI, 8U232AM), - UFTDI_DEV(BBELECTRONICS, USOTL4, 8U232AM), - UFTDI_DEV(MATRIXORBITAL, MOUA, 8U232AM), - UFTDI_DEV(MARVELL, SHEEVAPLUG, 8U232AM), - UFTDI_DEV(MELCO, PCOPRS1, 8U232AM), - UFTDI_DEV(RATOC, REXUSB60F, 8U232AM), +static const STRUCT_USB_HOST_ID uftdi_devs[] = { +#define UFTDI_DEV(v, p, i) \ + { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + UFTDI_DEV(ATMEL, STK541, UFTDI_TYPE_8U232AM), + UFTDI_DEV(BBELECTRONICS, USOTL4, UFTDI_TYPE_8U232AM), + UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, + UFTDI_TYPE_8U232AM), + UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, + UFTDI_TYPE_8U232AM), + UFTDI_DEV(FALCOM, TWIST, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, BEAGLEBONE, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_631, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_632, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_633, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_634, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_635, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CTI_USB_MINI_485, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CTI_USB_NANO_485, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EISCOU, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EMCU2D, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EMCU2H, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, GAMMASCOUT, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, KBS, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, LK202, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, LK204, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MAXSTREAM, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MX2_3, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MX4_5, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, PCMSFU, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SEMC_DSS20, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_2232C, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_2232D, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_4232H, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_8U100AX, UFTDI_TYPE_SIO), + UFTDI_DEV(FTDI, SERIAL_8U232AM, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_8U232AM4, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13M, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13S, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13U, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TURTELIZER2, UFTDI_TYPE_8U232AM | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, UOPTBR, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, USBSERIAL, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, USB_UIRT, UFTDI_TYPE_8U232AM), + UFTDI_DEV(INTREPIDCS, NEOVI, UFTDI_TYPE_8U232AM), + UFTDI_DEV(INTREPIDCS, VALUECAN, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MARVELL, SHEEVAPLUG, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MATRIXORBITAL, MOUA, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MELCO, PCOPRS1, UFTDI_TYPE_8U232AM), + UFTDI_DEV(RATOC, REXUSB60F, UFTDI_TYPE_8U232AM), + UFTDI_DEV(SIIG2, US2308, UFTDI_TYPE_8U232AM) #undef UFTDI_DEV }; @@ -260,6 +263,7 @@ static int uftdi_probe(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); + const struct usb_device_id *id; if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -267,9 +271,24 @@ uftdi_probe(device_t dev) if (uaa->info.bConfigIndex != UFTDI_CONFIG_INDEX) { return (ENXIO); } - /* attach to all present interfaces */ - return (usbd_lookup_id_by_uaa(uftdi_devs, sizeof(uftdi_devs), uaa)); + /* + * Attach to all present interfaces unless this is a JTAG one, which + * we leave for userland. + */ + id = usbd_lookup_id_by_info(uftdi_devs, sizeof(uftdi_devs), + &uaa->info); + if (id == NULL) + return (ENXIO); + if ((id->driver_info & UFTDI_FLAG_JTAG) != 0 && + uaa->info.bIfaceIndex == UFTDI_IFACE_INDEX_JTAG) { + printf("%s: skipping JTAG interface at %u.%u\n", + device_get_name(dev), usbd_get_bus_index(uaa->device), + usbd_get_device_index(uaa->device)); + return (ENXIO); + } + uaa->driver_info = id->driver_info; + return (BUS_PROBE_SPECIFIC); } static int @@ -292,7 +311,7 @@ uftdi_attach(device_t dev) DPRINTF("\n"); sc->sc_iface_index = uaa->info.bIfaceIndex; - sc->sc_type = USB_GET_DRIVER_INFO(uaa); + sc->sc_type = USB_GET_DRIVER_INFO(uaa) & UFTDI_TYPE_MASK; switch (sc->sc_type) { case UFTDI_TYPE_SIO: @@ -561,6 +580,7 @@ static int uftdi_set_parm_soft(struct termios *t, struct uftdi_param_config *cfg, uint8_t type) { + memset(cfg, 0, sizeof(*cfg)); switch (type) { @@ -823,5 +843,6 @@ static void uftdi_poll(struct ucom_softc *ucom) { struct uftdi_softc *sc = ucom->sc_parent; + usbd_transfer_poll(sc->sc_xfer, UFTDI_N_TRANSFER); } Modified: stable/9/sys/dev/usb/serial/uftdi_reg.h ============================================================================== --- stable/9/sys/dev/usb/serial/uftdi_reg.h Thu Jun 21 10:41:27 2012 (r237379) +++ stable/9/sys/dev/usb/serial/uftdi_reg.h Thu Jun 21 11:06:29 2012 (r237380) @@ -35,10 +35,12 @@ #define FTDI_PIT_SIOB 2 /* SIOB */ #define FTDI_PIT_PARALLEL 3 /* Parallel */ -enum uftdi_type { - UFTDI_TYPE_SIO, - UFTDI_TYPE_8U232AM -}; +/* Values for driver_info */ +#define UFTDI_TYPE_MASK 0x000000ff +#define UFTDI_TYPE_SIO 0x00000001 +#define UFTDI_TYPE_8U232AM 0x00000002 +#define UFTDI_FLAG_MASK 0x0000ff00 +#define UFTDI_FLAG_JTAG 0x00000100 /* * BmRequestType: 0100 0000B @@ -63,14 +65,12 @@ enum uftdi_type { * baud and data format not reset * * The Purge RX and TX buffer commands affect nothing except the buffers - * */ /* FTDI_SIO_RESET */ #define FTDI_SIO_RESET_SIO 0 #define FTDI_SIO_RESET_PURGE_RX 1 #define FTDI_SIO_RESET_PURGE_TX 2 - /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_SET_BAUDRATE @@ -135,7 +135,6 @@ enum { #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) #define FTDI_SIO_SET_BREAK (0x1 << 14) - /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_MODEM_CTRL @@ -172,7 +171,6 @@ enum { #define FTDI_SIO_SET_RTS_HIGH (2 | ( FTDI_SIO_SET_RTS_MASK << 8)) #define FTDI_SIO_SET_RTS_LOW (0 | ( FTDI_SIO_SET_RTS_MASK << 8)) - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_FLOW_CTRL @@ -203,7 +201,6 @@ enum { #define FTDI_SIO_DTR_DSR_HS 0x2 #define FTDI_SIO_XON_XOFF_HS 0x4 - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_EVENT_CHAR @@ -227,8 +224,6 @@ enum { * which is what normally happens. */ - - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_ERROR_CHAR @@ -243,14 +238,11 @@ enum { * 0 = disabled * 1 = enabled * B9..15 Reserved - * - * * FTDI_SIO_SET_ERROR_CHAR * Set the parity error replacement character for the specified communications * port. */ - /* * BmRequestType: 1100 0000b * bRequest: FTDI_SIO_GET_MODEM_STATUS @@ -282,10 +274,7 @@ enum { #define FTDI_SIO_RI_MASK 0x40 #define FTDI_SIO_RLSD_MASK 0x80 - - /* - * * DATA FORMAT * * IN Endpoint @@ -317,8 +306,6 @@ enum { * B5 Transmitter Holding Register (THRE) * B6 Transmitter Empty (TEMT) * B7 Error in RCVR FIFO - * - * * OUT Endpoint * * This device reserves the first bytes of data on this endpoint contain the @@ -330,7 +317,6 @@ enum { * Offset Description * B0..1 Port * B2..7 Length of message - (not including Byte 0) - * */ #define FTDI_PORT_MASK 0x0f #define FTDI_MSR_MASK 0xf0 Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Thu Jun 21 10:41:27 2012 (r237379) +++ stable/9/sys/dev/usb/usbdevs Thu Jun 21 11:06:29 2012 (r237380) @@ -1604,8 +1604,9 @@ product FTDI SERIAL_8U232AM 0x6001 8U232 product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial product FTDI SERIAL_2232D 0x9e90 FT2232D Dual port Serial -product FTDI BEAGLEBONE 0xA6D0 BeagleBone product FTDI SERIAL_4232H 0x6011 FT4232H Quad port Serial +product FTDI BEAGLEBONE 0xa6d0 BeagleBone +product FTDI TURTELIZER2 0xbdc8 egnite Turtelizer 2 JTAG/RS232 Adapter /* Gude Analog- und Digitalsysteme products also uses FTDI's id: */ product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi product FTDI TACTRIX_OPENPORT_13S 0xcc49 OpenPort 1.3 Subaru From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 11:06:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD31E10656E1; Thu, 21 Jun 2012 11:06:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A60158FC12; Thu, 21 Jun 2012 11:06:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LB6VPl008670; Thu, 21 Jun 2012 11:06:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LB6VYB008666; Thu, 21 Jun 2012 11:06:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211106.q5LB6VYB008666@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 11:06:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237381 - in stable/8/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 11:06:31 -0000 Author: marius Date: Thu Jun 21 11:06:31 2012 New Revision: 237381 URL: http://svn.freebsd.org/changeset/base/237381 Log: MFC: r230242, r237102, r237236 - Add support for the FT2232 based egnite Turtelizer 2 JTAG/RS232 Adapter. This includes adding support for skipping FTDI interfaces used for JTAG leaving them for userland and just attaching to the RS232 half, similarly to how the corresponding Linux drivers handles these kind of adapters. While at it, sort uftdi_devs and return BUS_PROBE_SPECIFIC (because uftdi_probe() alters the instance variables for better or worse as do other probe routines of USB drivers) instead of 0. - Remove duplicated entries for BeagleBone. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. - Remove some stray lines. Modified: stable/8/sys/dev/usb/serial/uftdi.c stable/8/sys/dev/usb/serial/uftdi_reg.h stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/8/sys/dev/usb/serial/uftdi.c Thu Jun 21 11:06:29 2012 (r237380) +++ stable/8/sys/dev/usb/serial/uftdi.c Thu Jun 21 11:06:31 2012 (r237381) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); */ /* - * FTDI FT8U100AX serial adapter driver + * FTDI FT2232x, FT8U100AX and FT8U232AM serial adapter driver */ #include @@ -81,7 +81,7 @@ SYSCTL_INT(_hw_usb_uftdi, OID_AUTO, debu #endif #define UFTDI_CONFIG_INDEX 0 -#define UFTDI_IFACE_INDEX 0 +#define UFTDI_IFACE_INDEX_JTAG 0 #define UFTDI_OBUFSIZE 64 /* bytes, cannot be increased due to * do size encoding */ @@ -102,10 +102,10 @@ struct uftdi_softc { struct mtx sc_mtx; uint32_t sc_unit; - enum uftdi_type sc_type; uint16_t sc_last_lcr; + uint8_t sc_type; uint8_t sc_iface_index; uint8_t sc_hdrlen; uint8_t sc_msr; @@ -190,7 +190,7 @@ static device_method_t uftdi_methods[] = DEVMETHOD(device_attach, uftdi_attach), DEVMETHOD(device_detach, uftdi_detach), - {0, 0} + DEVMETHOD_END }; static devclass_t uftdi_devclass; @@ -201,58 +201,61 @@ static driver_t uftdi_driver = { .size = sizeof(struct uftdi_softc), }; -DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); +DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, NULL); MODULE_DEPEND(uftdi, ucom, 1, 1, 1); MODULE_DEPEND(uftdi, usb, 1, 1, 1); MODULE_VERSION(uftdi, 1); -static STRUCT_USB_HOST_ID uftdi_devs[] = { -#define UFTDI_DEV(v,p,t) \ - { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, UFTDI_TYPE_##t) } - UFTDI_DEV(ATMEL, STK541, 8U232AM), - UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 8U232AM), - UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 8U232AM), - UFTDI_DEV(FALCOM, TWIST, 8U232AM), - UFTDI_DEV(FTDI, GAMMASCOUT, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U100AX, SIO), - UFTDI_DEV(FTDI, SERIAL_2232C, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_2232D, 8U232AM), - UFTDI_DEV(FTDI, BEAGLEBONE, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_4232H, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U232AM, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U232AM4, 8U232AM), - UFTDI_DEV(FTDI, SEMC_DSS20, 8U232AM), - UFTDI_DEV(FTDI, CFA_631, 8U232AM), - UFTDI_DEV(FTDI, CFA_632, 8U232AM), - UFTDI_DEV(FTDI, CFA_633, 8U232AM), - UFTDI_DEV(FTDI, CFA_634, 8U232AM), - UFTDI_DEV(FTDI, CFA_635, 8U232AM), - UFTDI_DEV(FTDI, USB_UIRT, 8U232AM), - UFTDI_DEV(FTDI, USBSERIAL, 8U232AM), - UFTDI_DEV(FTDI, KBS, 8U232AM), - UFTDI_DEV(FTDI, MX2_3, 8U232AM), - UFTDI_DEV(FTDI, MX4_5, 8U232AM), - UFTDI_DEV(FTDI, LK202, 8U232AM), - UFTDI_DEV(FTDI, LK204, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13M, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13S, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13U, 8U232AM), - UFTDI_DEV(FTDI, EISCOU, 8U232AM), - UFTDI_DEV(FTDI, UOPTBR, 8U232AM), - UFTDI_DEV(FTDI, EMCU2D, 8U232AM), - UFTDI_DEV(FTDI, PCMSFU, 8U232AM), - UFTDI_DEV(FTDI, EMCU2H, 8U232AM), - UFTDI_DEV(FTDI, MAXSTREAM, 8U232AM), - UFTDI_DEV(FTDI, CTI_USB_NANO_485, 8U232AM), - UFTDI_DEV(FTDI, CTI_USB_MINI_485, 8U232AM), - UFTDI_DEV(SIIG2, US2308, 8U232AM), - UFTDI_DEV(INTREPIDCS, VALUECAN, 8U232AM), - UFTDI_DEV(INTREPIDCS, NEOVI, 8U232AM), - UFTDI_DEV(BBELECTRONICS, USOTL4, 8U232AM), - UFTDI_DEV(MATRIXORBITAL, MOUA, 8U232AM), - UFTDI_DEV(MARVELL, SHEEVAPLUG, 8U232AM), - UFTDI_DEV(MELCO, PCOPRS1, 8U232AM), - UFTDI_DEV(RATOC, REXUSB60F, 8U232AM), +static const STRUCT_USB_HOST_ID uftdi_devs[] = { +#define UFTDI_DEV(v, p, i) \ + { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + UFTDI_DEV(ATMEL, STK541, UFTDI_TYPE_8U232AM), + UFTDI_DEV(BBELECTRONICS, USOTL4, UFTDI_TYPE_8U232AM), + UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, + UFTDI_TYPE_8U232AM), + UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, + UFTDI_TYPE_8U232AM), + UFTDI_DEV(FALCOM, TWIST, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, BEAGLEBONE, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_631, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_632, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_633, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_634, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_635, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CTI_USB_MINI_485, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CTI_USB_NANO_485, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EISCOU, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EMCU2D, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EMCU2H, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, GAMMASCOUT, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, KBS, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, LK202, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, LK204, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MAXSTREAM, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MX2_3, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MX4_5, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, PCMSFU, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SEMC_DSS20, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_2232C, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_2232D, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_4232H, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_8U100AX, UFTDI_TYPE_SIO), + UFTDI_DEV(FTDI, SERIAL_8U232AM, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_8U232AM4, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13M, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13S, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13U, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TURTELIZER2, UFTDI_TYPE_8U232AM | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, UOPTBR, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, USBSERIAL, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, USB_UIRT, UFTDI_TYPE_8U232AM), + UFTDI_DEV(INTREPIDCS, NEOVI, UFTDI_TYPE_8U232AM), + UFTDI_DEV(INTREPIDCS, VALUECAN, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MARVELL, SHEEVAPLUG, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MATRIXORBITAL, MOUA, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MELCO, PCOPRS1, UFTDI_TYPE_8U232AM), + UFTDI_DEV(RATOC, REXUSB60F, UFTDI_TYPE_8U232AM), + UFTDI_DEV(SIIG2, US2308, UFTDI_TYPE_8U232AM) #undef UFTDI_DEV }; @@ -260,6 +263,7 @@ static int uftdi_probe(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); + const struct usb_device_id *id; if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -267,9 +271,24 @@ uftdi_probe(device_t dev) if (uaa->info.bConfigIndex != UFTDI_CONFIG_INDEX) { return (ENXIO); } - /* attach to all present interfaces */ - return (usbd_lookup_id_by_uaa(uftdi_devs, sizeof(uftdi_devs), uaa)); + /* + * Attach to all present interfaces unless this is a JTAG one, which + * we leave for userland. + */ + id = usbd_lookup_id_by_info(uftdi_devs, sizeof(uftdi_devs), + &uaa->info); + if (id == NULL) + return (ENXIO); + if ((id->driver_info & UFTDI_FLAG_JTAG) != 0 && + uaa->info.bIfaceIndex == UFTDI_IFACE_INDEX_JTAG) { + printf("%s: skipping JTAG interface at %u.%u\n", + device_get_name(dev), usbd_get_bus_index(uaa->device), + usbd_get_device_index(uaa->device)); + return (ENXIO); + } + uaa->driver_info = id->driver_info; + return (BUS_PROBE_SPECIFIC); } static int @@ -292,7 +311,7 @@ uftdi_attach(device_t dev) DPRINTF("\n"); sc->sc_iface_index = uaa->info.bIfaceIndex; - sc->sc_type = USB_GET_DRIVER_INFO(uaa); + sc->sc_type = USB_GET_DRIVER_INFO(uaa) & UFTDI_TYPE_MASK; switch (sc->sc_type) { case UFTDI_TYPE_SIO: @@ -561,6 +580,7 @@ static int uftdi_set_parm_soft(struct termios *t, struct uftdi_param_config *cfg, uint8_t type) { + memset(cfg, 0, sizeof(*cfg)); switch (type) { @@ -823,5 +843,6 @@ static void uftdi_poll(struct ucom_softc *ucom) { struct uftdi_softc *sc = ucom->sc_parent; + usbd_transfer_poll(sc->sc_xfer, UFTDI_N_TRANSFER); } Modified: stable/8/sys/dev/usb/serial/uftdi_reg.h ============================================================================== --- stable/8/sys/dev/usb/serial/uftdi_reg.h Thu Jun 21 11:06:29 2012 (r237380) +++ stable/8/sys/dev/usb/serial/uftdi_reg.h Thu Jun 21 11:06:31 2012 (r237381) @@ -35,10 +35,12 @@ #define FTDI_PIT_SIOB 2 /* SIOB */ #define FTDI_PIT_PARALLEL 3 /* Parallel */ -enum uftdi_type { - UFTDI_TYPE_SIO, - UFTDI_TYPE_8U232AM -}; +/* Values for driver_info */ +#define UFTDI_TYPE_MASK 0x000000ff +#define UFTDI_TYPE_SIO 0x00000001 +#define UFTDI_TYPE_8U232AM 0x00000002 +#define UFTDI_FLAG_MASK 0x0000ff00 +#define UFTDI_FLAG_JTAG 0x00000100 /* * BmRequestType: 0100 0000B @@ -63,14 +65,12 @@ enum uftdi_type { * baud and data format not reset * * The Purge RX and TX buffer commands affect nothing except the buffers - * */ /* FTDI_SIO_RESET */ #define FTDI_SIO_RESET_SIO 0 #define FTDI_SIO_RESET_PURGE_RX 1 #define FTDI_SIO_RESET_PURGE_TX 2 - /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_SET_BAUDRATE @@ -135,7 +135,6 @@ enum { #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) #define FTDI_SIO_SET_BREAK (0x1 << 14) - /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_MODEM_CTRL @@ -172,7 +171,6 @@ enum { #define FTDI_SIO_SET_RTS_HIGH (2 | ( FTDI_SIO_SET_RTS_MASK << 8)) #define FTDI_SIO_SET_RTS_LOW (0 | ( FTDI_SIO_SET_RTS_MASK << 8)) - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_FLOW_CTRL @@ -203,7 +201,6 @@ enum { #define FTDI_SIO_DTR_DSR_HS 0x2 #define FTDI_SIO_XON_XOFF_HS 0x4 - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_EVENT_CHAR @@ -227,8 +224,6 @@ enum { * which is what normally happens. */ - - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_ERROR_CHAR @@ -243,14 +238,11 @@ enum { * 0 = disabled * 1 = enabled * B9..15 Reserved - * - * * FTDI_SIO_SET_ERROR_CHAR * Set the parity error replacement character for the specified communications * port. */ - /* * BmRequestType: 1100 0000b * bRequest: FTDI_SIO_GET_MODEM_STATUS @@ -282,10 +274,7 @@ enum { #define FTDI_SIO_RI_MASK 0x40 #define FTDI_SIO_RLSD_MASK 0x80 - - /* - * * DATA FORMAT * * IN Endpoint @@ -317,8 +306,6 @@ enum { * B5 Transmitter Holding Register (THRE) * B6 Transmitter Empty (TEMT) * B7 Error in RCVR FIFO - * - * * OUT Endpoint * * This device reserves the first bytes of data on this endpoint contain the @@ -330,7 +317,6 @@ enum { * Offset Description * B0..1 Port * B2..7 Length of message - (not including Byte 0) - * */ #define FTDI_PORT_MASK 0x0f #define FTDI_MSR_MASK 0xf0 Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Thu Jun 21 11:06:29 2012 (r237380) +++ stable/8/sys/dev/usb/usbdevs Thu Jun 21 11:06:31 2012 (r237381) @@ -1600,8 +1600,9 @@ product FTDI SERIAL_8U232AM 0x6001 8U232 product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial product FTDI SERIAL_2232D 0x9e90 FT2232D Dual port Serial -product FTDI BEAGLEBONE 0xA6D0 BeagleBone product FTDI SERIAL_4232H 0x6011 FT4232H Quad port Serial +product FTDI BEAGLEBONE 0xa6d0 BeagleBone +product FTDI TURTELIZER2 0xbdc8 egnite Turtelizer 2 JTAG/RS232 Adapter /* Gude Analog- und Digitalsysteme products also uses FTDI's id: */ product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi product FTDI TACTRIX_OPENPORT_13S 0xcc49 OpenPort 1.3 Subaru From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 11:10:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A94E51065670; Thu, 21 Jun 2012 11:10:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92F728FC16; Thu, 21 Jun 2012 11:10:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LBAoXJ008920; Thu, 21 Jun 2012 11:10:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LBAoM4008918; Thu, 21 Jun 2012 11:10:50 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211110.q5LBAoM4008918@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 11:10:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237382 - stable/9/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 11:10:50 -0000 Author: marius Date: Thu Jun 21 11:10:49 2012 New Revision: 237382 URL: http://svn.freebsd.org/changeset/base/237382 Log: MFC: r237239 Revert the part of r236495 (MFC'ed to stable/9 in r237095) that introduced checking of SPI_SR_TXEMPTY for TX transfer completion as for reasons unknown this occasionally causes SPI_SR_RXBUFF and SPI_SR_ENDRX to not rise. In any case, once the RX part of the transfer is done it's obvious that the preceding TX part had finished and checking of SPI_SR_TXEMPTY was introduced to rule out a possible cause for the data corruption mentioned in r236495 but which didn't turn out to be the problem anyway. Modified: stable/9/sys/arm/at91/at91_spi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/arm/at91/at91_spi.c ============================================================================== --- stable/9/sys/arm/at91/at91_spi.c Thu Jun 21 11:06:31 2012 (r237381) +++ stable/9/sys/arm/at91/at91_spi.c Thu Jun 21 11:10:49 2012 (r237382) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -59,7 +58,6 @@ struct at91_spi_softc bus_dma_tag_t dmatag; /* bus dma tag for transfers */ bus_dmamap_t map[4]; /* Maps for the transaction */ struct sx xfer_mtx; /* Enforce one transfer at a time */ - uint32_t xfer_mask; /* Bits to wait on for completion */ uint32_t xfer_done; /* interrupt<->mainthread signaling */ }; @@ -124,7 +122,6 @@ at91_spi_attach(device_t dev) * Set up the hardware. */ - sc->xfer_mask = SPI_SR_RXBUFF | (at91_is_rm92() ? 0 : SPI_SR_TXEMPTY); WR4(sc, SPI_CR, SPI_CR_SWRST); /* "Software Reset must be Written Twice" erratum */ WR4(sc, SPI_CR, SPI_CR_SWRST); @@ -272,7 +269,6 @@ at91_spi_transfer(device_t dev, device_t struct at91_spi_softc *sc; bus_addr_t addr; int err, i, j, mode[4]; - uint32_t mask; KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, ("%s: TX/RX command sizes should be equal", __func__)); @@ -356,12 +352,11 @@ at91_spi_transfer(device_t dev, device_t * Start the transfer, wait for it to complete. */ sc->xfer_done = 0; - mask = sc->xfer_mask; - WR4(sc, SPI_IER, mask); + WR4(sc, SPI_IER, SPI_SR_RXBUFF); WR4(sc, PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); do err = tsleep(&sc->xfer_done, PCATCH | PZERO, "at91_spi", hz); - while (sc->xfer_done != mask && err != EINTR); + while (sc->xfer_done == 0 && err != EINTR); /* * Stop the transfer and clean things up. @@ -383,20 +378,19 @@ static void at91_spi_intr(void *arg) { struct at91_spi_softc *sc; - uint32_t mask, sr; + uint32_t sr; sc = (struct at91_spi_softc*)arg; - mask = sc->xfer_mask; sr = RD4(sc, SPI_SR) & RD4(sc, SPI_IMR); - if ((sr & mask) != 0) { - sc->xfer_done |= sr & mask; - WR4(sc, SPI_IDR, mask); + if ((sr & SPI_SR_RXBUFF) != 0) { + sc->xfer_done = 1; + WR4(sc, SPI_IDR, SPI_SR_RXBUFF); wakeup(&sc->xfer_done); } - if ((sr & ~mask) != 0) { + if ((sr & ~SPI_SR_RXBUFF) != 0) { device_printf(sc->dev, "Unexpected ISR %#x\n", sr); - WR4(sc, SPI_IDR, sr & ~mask); + WR4(sc, SPI_IDR, sr & ~SPI_SR_RXBUFF); } } From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 11:10:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7D1C1065675; Thu, 21 Jun 2012 11:10:55 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1C6A8FC17; Thu, 21 Jun 2012 11:10:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LBAtjj008957; Thu, 21 Jun 2012 11:10:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LBAtVd008955; Thu, 21 Jun 2012 11:10:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211110.q5LBAtVd008955@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 11:10:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237383 - stable/8/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 11:10:56 -0000 Author: marius Date: Thu Jun 21 11:10:55 2012 New Revision: 237383 URL: http://svn.freebsd.org/changeset/base/237383 Log: MFC: r237239 Revert the part of r236495 (MFC'ed to stable/8 in r237096) that introduced checking of SPI_SR_TXEMPTY for TX transfer completion as for reasons unknown this occasionally causes SPI_SR_RXBUFF and SPI_SR_ENDRX to not rise. In any case, once the RX part of the transfer is done it's obvious that the preceding TX part had finished and checking of SPI_SR_TXEMPTY was introduced to rule out a possible cause for the data corruption mentioned in r236495 but which didn't turn out to be the problem anyway. Modified: stable/8/sys/arm/at91/at91_spi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/arm/at91/at91_spi.c ============================================================================== --- stable/8/sys/arm/at91/at91_spi.c Thu Jun 21 11:10:49 2012 (r237382) +++ stable/8/sys/arm/at91/at91_spi.c Thu Jun 21 11:10:55 2012 (r237383) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -59,7 +58,6 @@ struct at91_spi_softc bus_dma_tag_t dmatag; /* bus dma tag for transfers */ bus_dmamap_t map[4]; /* Maps for the transaction */ struct sx xfer_mtx; /* Enforce one transfer at a time */ - uint32_t xfer_mask; /* Bits to wait on for completion */ uint32_t xfer_done; /* interrupt<->mainthread signaling */ }; @@ -124,7 +122,6 @@ at91_spi_attach(device_t dev) * Set up the hardware. */ - sc->xfer_mask = SPI_SR_RXBUFF | (at91_is_rm92() ? 0 : SPI_SR_TXEMPTY); WR4(sc, SPI_CR, SPI_CR_SWRST); /* "Software Reset must be Written Twice" erratum */ WR4(sc, SPI_CR, SPI_CR_SWRST); @@ -272,7 +269,6 @@ at91_spi_transfer(device_t dev, device_t struct at91_spi_softc *sc; bus_addr_t addr; int err, i, j, mode[4]; - uint32_t mask; KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, ("%s: TX/RX command sizes should be equal", __func__)); @@ -356,12 +352,11 @@ at91_spi_transfer(device_t dev, device_t * Start the transfer, wait for it to complete. */ sc->xfer_done = 0; - mask = sc->xfer_mask; - WR4(sc, SPI_IER, mask); + WR4(sc, SPI_IER, SPI_SR_RXBUFF); WR4(sc, PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); do err = tsleep(&sc->xfer_done, PCATCH | PZERO, "at91_spi", hz); - while (sc->xfer_done != mask && err != EINTR); + while (sc->xfer_done == 0 && err != EINTR); /* * Stop the transfer and clean things up. @@ -383,20 +378,19 @@ static void at91_spi_intr(void *arg) { struct at91_spi_softc *sc; - uint32_t mask, sr; + uint32_t sr; sc = (struct at91_spi_softc*)arg; - mask = sc->xfer_mask; sr = RD4(sc, SPI_SR) & RD4(sc, SPI_IMR); - if ((sr & mask) != 0) { - sc->xfer_done |= sr & mask; - WR4(sc, SPI_IDR, mask); + if ((sr & SPI_SR_RXBUFF) != 0) { + sc->xfer_done = 1; + WR4(sc, SPI_IDR, SPI_SR_RXBUFF); wakeup(&sc->xfer_done); } - if ((sr & ~mask) != 0) { + if ((sr & ~SPI_SR_RXBUFF) != 0) { device_printf(sc->dev, "Unexpected ISR %#x\n", sr); - WR4(sc, SPI_IDR, sr & ~mask); + WR4(sc, SPI_IDR, sr & ~SPI_SR_RXBUFF); } } From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 11:16:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB2B71065672; Thu, 21 Jun 2012 11:16:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3C378FC22; Thu, 21 Jun 2012 11:16:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LBG5S5009256; Thu, 21 Jun 2012 11:16:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LBG51C009254; Thu, 21 Jun 2012 11:16:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211116.q5LBG51C009254@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 11:16:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237384 - stable/9/sys/dev/flash X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 11:16:06 -0000 Author: marius Date: Thu Jun 21 11:16:05 2012 New Revision: 237384 URL: http://svn.freebsd.org/changeset/base/237384 Log: MFC: r236496 - Loop up to 3 seconds when waiting for a device to get ready. [1] - Make the device description match the driver name. - Identify the chip variant based on the JEDEC and use that information to use the proper values for page count, offset and size instead of hardcoding a AT45DB642x with 2^N byte page support disabled. - Take advantage of bioq_takefirst(). - Given that CONTINUOUS_ARRAY_READ_HF (0x0b) command isn't even mentioned in Atmel's DataFlash Application Note, as suggested by the previous comment may not work on all all devices and actually doesn't properly on at least AT45DB321D (JEDEC 0x1f2701), rewrite at45d_task() to use CONTINUOUS_ARRAY_READ (0xe8) for reading instead. This rewrite is laid out in a way allowing to easily add support for BIO_DELETE later on. - Add support for reads and writes not starting on a page boundary. - Verify the flash content after writing. - Let at45d_task() gracefully handle errors on SPI transfers and the device not becoming ready afterwards again. [1] - Use DEVMETHOD_END. [1] - Use NULL instead of 0 for pointers. [1] Additional testing by: Ian Lepore Submitted by: Ian Lepore [1] Modified: stable/9/sys/dev/flash/at45d.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/flash/at45d.c ============================================================================== --- stable/9/sys/dev/flash/at45d.c Thu Jun 21 11:10:55 2012 (r237383) +++ stable/9/sys/dev/flash/at45d.c Thu Jun 21 11:16:05 2012 (r237384) @@ -1,5 +1,8 @@ /*- - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2006 M. Warner Losh + * Copyright (c) 2011-2012 Ian Lepore + * Copyright (c) 2012 Marius Strobl + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -42,44 +45,82 @@ __FBSDID("$FreeBSD$"); #include #include "spibus_if.h" -struct at45d_softc +struct at45d_flash_ident { - struct intr_config_hook config_intrhook; - device_t dev; - struct mtx sc_mtx; - struct disk *disk; - struct proc *p; - struct bio_queue_head bio_queue; + const char *name; + uint32_t jedec; + uint16_t pagecount; + uint16_t pageoffset; + uint16_t pagesize; + uint16_t pagesize2n; }; -#define AT45D_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +struct at45d_softc +{ + struct bio_queue_head bio_queue; + struct mtx sc_mtx; + struct disk *disk; + struct proc *p; + struct intr_config_hook config_intrhook; + device_t dev; + uint16_t pagecount; + uint16_t pageoffset; + uint16_t pagesize; +}; + +#define AT45D_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define AT45D_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) -#define AT45D_LOCK_INIT(_sc) \ +#define AT45D_LOCK_INIT(_sc) \ mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ "at45d", MTX_DEF) -#define AT45D_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); -#define AT45D_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); -#define AT45D_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); - -static void at45d_delayed_attach(void *xsc); +#define AT45D_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define AT45D_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); +#define AT45D_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); + +/* bus entry points */ +static device_attach_t at45d_attach; +static device_detach_t at45d_detach; +static device_probe_t at45d_probe; /* disk routines */ -static int at45d_open(struct disk *dp); static int at45d_close(struct disk *dp); +static int at45d_open(struct disk *dp); static void at45d_strategy(struct bio *bp); static void at45d_task(void *arg); -#define CONTINUOUS_ARRAY_READ 0xE8 -#define CONTINUOUS_ARRAY_READ_HF 0x0B -#define CONTINUOUS_ARRAY_READ_LF 0x03 -#define STATUS_REGISTER_READ 0xD7 -#define PROGRAM_THROUGH_BUFFER 0x82 -#define MANUFACTURER_ID 0x9F +/* helper routines */ +static void at45d_delayed_attach(void *xsc); +static int at45d_get_mfg_info(device_t dev, uint8_t *resp); +static int at45d_get_status(device_t dev, uint8_t *status); +static int at45d_wait_ready(device_t dev, uint8_t *status); + +#define BUFFER_TRANSFER 0x53 +#define BUFFER_COMPARE 0x60 +#define PROGRAM_THROUGH_BUFFER 0x82 +#define MANUFACTURER_ID 0x9f +#define STATUS_REGISTER_READ 0xd7 +#define CONTINUOUS_ARRAY_READ 0xe8 + +/* + * A sectorsize2n != 0 is used to indicate that a device optionally supports + * 2^N byte pages. If support for the latter is enabled, the sector offset + * has to be reduced by one. + */ +static const struct at45d_flash_ident const at45d_flash_devices[] = { + { "AT45DB011B", 0x1f2200, 512, 9, 264, 256 }, + { "AT45DB021B", 0x1f2300, 1024, 9, 264, 256 }, + { "AT45DB041x", 0x1f2400, 2028, 9, 264, 256 }, + { "AT45DB081B", 0x1f2500, 4096, 9, 264, 256 }, + { "AT45DB161x", 0x1f2600, 4096, 10, 528, 512 }, + { "AT45DB321x", 0x1f2700, 8192, 10, 528, 0 }, + { "AT45DB321x", 0x1f2701, 8192, 10, 528, 512 }, + { "AT45DB642x", 0x1f2800, 8192, 11, 1056, 1024 } +}; -static uint8_t -at45d_get_status(device_t dev) +static int +at45d_get_status(device_t dev, uint8_t *status) { - uint8_t txBuf[8], rxBuf[8]; + uint8_t rxBuf[8], txBuf[8]; struct spi_command cmd; int err; @@ -90,23 +131,16 @@ at45d_get_status(device_t dev) txBuf[0] = STATUS_REGISTER_READ; cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; - cmd.rx_cmd_sz = 2; - cmd.tx_cmd_sz = 2; + cmd.rx_cmd_sz = cmd.tx_cmd_sz = 2; err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); - return (rxBuf[1]); -} - -static void -at45d_wait_for_device_ready(device_t dev) -{ - while (!(at45d_get_status(dev) & 0x80)) - continue; + *status = rxBuf[1]; + return (err); } static int at45d_get_mfg_info(device_t dev, uint8_t *resp) { - uint8_t txBuf[8], rxBuf[8]; + uint8_t rxBuf[8], txBuf[8]; struct spi_command cmd; int err; @@ -117,22 +151,37 @@ at45d_get_mfg_info(device_t dev, uint8_t txBuf[0] = MANUFACTURER_ID; cmd.tx_cmd = &txBuf; cmd.rx_cmd = &rxBuf; - cmd.tx_cmd_sz = 5; - cmd.rx_cmd_sz = 5; + cmd.tx_cmd_sz = cmd.rx_cmd_sz = 5; err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); if (err) return (err); memcpy(resp, rxBuf + 1, 4); - // XXX We really should 'decode' the reply into some kind of - // XXX structure. To be generic (and not just for atmel parts) - // XXX we'd have to loop until we got a full reply. return (0); } static int +at45d_wait_ready(device_t dev, uint8_t *status) +{ + struct timeval now, tout; + int err; + + getmicrouptime(&tout); + tout.tv_sec += 3; + do { + getmicrouptime(&now); + if (now.tv_sec > tout.tv_sec) + err = ETIMEDOUT; + else + err = at45d_get_status(dev, status); + } while (err == 0 && (*status & 0x80) == 0); + return (err); +} + +static int at45d_probe(device_t dev) { - device_set_desc(dev, "AT45 Flash Family"); + + device_set_desc(dev, "AT45D Flash Family"); return (0); } @@ -156,31 +205,66 @@ at45d_attach(device_t dev) static int at45d_detach(device_t dev) { - return EIO; + + return (EBUSY) /* XXX */; } static void at45d_delayed_attach(void *xsc) { - struct at45d_softc *sc = xsc; - uint8_t buf[4]; - - at45d_get_mfg_info(sc->dev, buf); - at45d_wait_for_device_ready(sc->dev); - - sc->disk = disk_alloc(); - sc->disk->d_open = at45d_open; - sc->disk->d_close = at45d_close; - sc->disk->d_strategy = at45d_strategy; - sc->disk->d_name = "flash/spi"; - sc->disk->d_drv1 = sc; - sc->disk->d_maxsize = DFLTPHYS; - sc->disk->d_sectorsize = 1056; /* XXX */ - sc->disk->d_mediasize = 8192 * 1056; /* XXX */ - sc->disk->d_unit = device_get_unit(sc->dev); - disk_create(sc->disk, DISK_VERSION); - bioq_init(&sc->bio_queue); - kproc_create(&at45d_task, sc, &sc->p, 0, 0, "task: at45d flash"); + struct at45d_softc *sc; + const struct at45d_flash_ident *ident; + u_int i; + uint32_t jedec; + uint16_t pagesize; + uint8_t buf[4], status; + + sc = xsc; + ident = NULL; + jedec = 0; + + if (at45d_wait_ready(sc->dev, &status) != 0) + device_printf(sc->dev, "Error waiting for device-ready.\n"); + else if (at45d_get_mfg_info(sc->dev, buf) != 0) + device_printf(sc->dev, "Failed to get ID.\n"); + else { + jedec = buf[0] << 16 | buf[1] << 8 | buf[2]; + for (i = 0; i < nitems(at45d_flash_devices); i++) { + if (at45d_flash_devices[i].jedec == jedec) { + ident = &at45d_flash_devices[i]; + break; + } + } + } + if (ident == NULL) + device_printf(sc->dev, "JEDEC 0x%x not in list.\n", jedec); + else { + sc->pagecount = ident->pagecount; + sc->pageoffset = ident->pageoffset; + if (ident->pagesize2n != 0 && (status & 0x01) != 0) { + sc->pageoffset -= 1; + pagesize = ident->pagesize2n; + } else + pagesize = ident->pagesize; + sc->pagesize = pagesize; + + sc->disk = disk_alloc(); + sc->disk->d_open = at45d_open; + sc->disk->d_close = at45d_close; + sc->disk->d_strategy = at45d_strategy; + sc->disk->d_name = "flash/spi"; + sc->disk->d_drv1 = sc; + sc->disk->d_maxsize = DFLTPHYS; + sc->disk->d_sectorsize = pagesize; + sc->disk->d_mediasize = pagesize * ident->pagecount; + sc->disk->d_unit = device_get_unit(sc->dev); + disk_create(sc->disk, DISK_VERSION); + bioq_init(&sc->bio_queue); + kproc_create(&at45d_task, sc, &sc->p, 0, 0, + "task: at45d flash"); + device_printf(sc->dev, "%s, %d bytes per page, %d pages\n", + ident->name, pagesize, ident->pagecount); + } config_intrhook_disestablish(&sc->config_intrhook); } @@ -188,13 +272,15 @@ at45d_delayed_attach(void *xsc) static int at45d_open(struct disk *dp) { - return 0; + + return (0); } static int at45d_close(struct disk *dp) { - return 0; + + return (0); } static void @@ -212,53 +298,132 @@ at45d_strategy(struct bio *bp) static void at45d_task(void *arg) { - struct at45d_softc *sc = (struct at45d_softc*)arg; + uint8_t rxBuf[8], txBuf[8]; + struct at45d_softc *sc; struct bio *bp; - uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; - int sz; - daddr_t block, end; device_t dev, pdev; - int err; + caddr_t buf; + u_long len, resid; + u_int addr, berr, err, offset, page; + uint8_t status; + + sc = (struct at45d_softc*)arg; + dev = sc->dev; + pdev = device_get_parent(dev); + memset(&cmd, 0, sizeof(cmd)); + memset(txBuf, 0, sizeof(txBuf)); + memset(rxBuf, 0, sizeof(rxBuf)); + cmd.tx_cmd = txBuf; + cmd.rx_cmd = rxBuf; for (;;) { - dev = sc->dev; - pdev = device_get_parent(dev); AT45D_LOCK(sc); do { - bp = bioq_first(&sc->bio_queue); + bp = bioq_takefirst(&sc->bio_queue); if (bp == NULL) msleep(sc, &sc->sc_mtx, PRIBIO, "jobqueue", 0); } while (bp == NULL); - bioq_remove(&sc->bio_queue, bp); AT45D_UNLOCK(sc); - sz = sc->disk->d_sectorsize; - end = bp->bio_pblkno + (bp->bio_bcount / sz); - for (block = bp->bio_pblkno; block < end; block++) { - char *vaddr = bp->bio_data + (block - bp->bio_pblkno) * sz; - if (bp->bio_cmd == BIO_READ) { - txBuf[0] = CONTINUOUS_ARRAY_READ_HF; - cmd.tx_cmd_sz = 5; - cmd.rx_cmd_sz = 5; - } else { + + berr = 0; + buf = bp->bio_data; + len = resid = bp->bio_bcount; + page = bp->bio_offset / sc->pagesize; + offset = bp->bio_offset % sc->pagesize; + + switch (bp->bio_cmd) { + case BIO_READ: + txBuf[0] = CONTINUOUS_ARRAY_READ; + cmd.tx_cmd_sz = cmd.rx_cmd_sz = 8; + cmd.tx_data = cmd.rx_data = buf; + break; + case BIO_WRITE: + cmd.tx_cmd_sz = cmd.rx_cmd_sz = 4; + cmd.tx_data = cmd.rx_data = buf; + if (resid + offset > sc->pagesize) + len = sc->pagesize - offset; + break; + default: + berr = EINVAL; + goto out; + } + + /* + * NB: for BIO_READ, this loop is only traversed once. + */ + while (resid > 0) { + if (page > sc->pagecount) { + berr = EINVAL; + goto out; + } + addr = page << sc->pageoffset; + if (bp->bio_cmd == BIO_WRITE) { + if (len != sc->pagesize) { + txBuf[0] = BUFFER_TRANSFER; + txBuf[1] = ((addr >> 16) & 0xff); + txBuf[2] = ((addr >> 8) & 0xff); + txBuf[3] = 0; + cmd.tx_data_sz = cmd.rx_data_sz = 0; + err = SPIBUS_TRANSFER(pdev, dev, + &cmd); + if (err == 0) + err = at45d_wait_ready(dev, + &status); + if (err != 0) { + berr = EIO; + goto out; + } + } txBuf[0] = PROGRAM_THROUGH_BUFFER; - cmd.tx_cmd_sz = 4; - cmd.rx_cmd_sz = 4; } - // XXX only works on certain devices... Fixme - txBuf[1] = ((block >> 5) & 0xFF); - txBuf[2] = ((block << 3) & 0xF8); - txBuf[3] = 0; - txBuf[4] = 0; - cmd.tx_cmd = txBuf; - cmd.rx_cmd = rxBuf; - cmd.tx_data = vaddr; - cmd.tx_data_sz = sz; - cmd.rx_data = vaddr; - cmd.rx_data_sz = sz; + + addr += offset; + txBuf[1] = ((addr >> 16) & 0xff); + txBuf[2] = ((addr >> 8) & 0xff); + txBuf[3] = (addr & 0xff); + cmd.tx_data_sz = cmd.rx_data_sz = len; err = SPIBUS_TRANSFER(pdev, dev, &cmd); - // XXX err check? + if (err == 0 && bp->bio_cmd != BIO_READ) + err = at45d_wait_ready(dev, &status); + if (err != 0) { + berr = EIO; + goto out; + } + if (bp->bio_cmd == BIO_WRITE) { + addr = page << sc->pageoffset; + txBuf[0] = BUFFER_COMPARE; + txBuf[1] = ((addr >> 16) & 0xff); + txBuf[2] = ((addr >> 8) & 0xff); + txBuf[3] = 0; + cmd.tx_data_sz = cmd.rx_data_sz = 0; + err = SPIBUS_TRANSFER(pdev, dev, &cmd); + if (err == 0) + err = at45d_wait_ready(dev, &status); + if (err != 0 || (status & 0x40) != 0) { + device_printf(dev, "comparing page " + "%d failed (status=0x%x)\n", addr, + status); + berr = EIO; + goto out; + } + } + page++; + buf += len; + offset = 0; + resid -= len; + if (resid > sc->pagesize) + len = sc->pagesize; + else + len = resid; + cmd.tx_data = cmd.rx_data = buf; + } + out: + if (berr != 0) { + bp->bio_flags |= BIO_ERROR; + bp->bio_error = berr; } + bp->bio_resid = resid; biodone(bp); } } @@ -271,7 +436,7 @@ static device_method_t at45d_methods[] = DEVMETHOD(device_attach, at45d_attach), DEVMETHOD(device_detach, at45d_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t at45d_driver = { @@ -280,4 +445,4 @@ static driver_t at45d_driver = { sizeof(struct at45d_softc), }; -DRIVER_MODULE(at45d, spibus, at45d_driver, at45d_devclass, 0, 0); +DRIVER_MODULE(at45d, spibus, at45d_driver, at45d_devclass, NULL, NULL); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 11:16:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6F401065788; Thu, 21 Jun 2012 11:16:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D4F78FC14; Thu, 21 Jun 2012 11:16:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LBGDvw009299; Thu, 21 Jun 2012 11:16:13 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LBGDCB009297; Thu, 21 Jun 2012 11:16:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211116.q5LBGDCB009297@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 11:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237385 - stable/8/sys/dev/flash X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 11:16:16 -0000 Author: marius Date: Thu Jun 21 11:16:13 2012 New Revision: 237385 URL: http://svn.freebsd.org/changeset/base/237385 Log: MFC: r236496 - Loop up to 3 seconds when waiting for a device to get ready. [1] - Make the device description match the driver name. - Identify the chip variant based on the JEDEC and use that information to use the proper values for page count, offset and size instead of hardcoding a AT45DB642x with 2^N byte page support disabled. - Take advantage of bioq_takefirst(). - Given that CONTINUOUS_ARRAY_READ_HF (0x0b) command isn't even mentioned in Atmel's DataFlash Application Note, as suggested by the previous comment may not work on all all devices and actually doesn't properly on at least AT45DB321D (JEDEC 0x1f2701), rewrite at45d_task() to use CONTINUOUS_ARRAY_READ (0xe8) for reading instead. This rewrite is laid out in a way allowing to easily add support for BIO_DELETE later on. - Add support for reads and writes not starting on a page boundary. - Verify the flash content after writing. - Let at45d_task() gracefully handle errors on SPI transfers and the device not becoming ready afterwards again. [1] - Use DEVMETHOD_END. [1] - Use NULL instead of 0 for pointers. [1] Additional testing by: Ian Lepore Submitted by: Ian Lepore [1] Modified: stable/8/sys/dev/flash/at45d.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/flash/at45d.c ============================================================================== --- stable/8/sys/dev/flash/at45d.c Thu Jun 21 11:16:05 2012 (r237384) +++ stable/8/sys/dev/flash/at45d.c Thu Jun 21 11:16:13 2012 (r237385) @@ -1,5 +1,8 @@ /*- - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2006 M. Warner Losh + * Copyright (c) 2011-2012 Ian Lepore + * Copyright (c) 2012 Marius Strobl + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -42,44 +45,82 @@ __FBSDID("$FreeBSD$"); #include #include "spibus_if.h" -struct at45d_softc +struct at45d_flash_ident { - struct intr_config_hook config_intrhook; - device_t dev; - struct mtx sc_mtx; - struct disk *disk; - struct proc *p; - struct bio_queue_head bio_queue; + const char *name; + uint32_t jedec; + uint16_t pagecount; + uint16_t pageoffset; + uint16_t pagesize; + uint16_t pagesize2n; }; -#define AT45D_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +struct at45d_softc +{ + struct bio_queue_head bio_queue; + struct mtx sc_mtx; + struct disk *disk; + struct proc *p; + struct intr_config_hook config_intrhook; + device_t dev; + uint16_t pagecount; + uint16_t pageoffset; + uint16_t pagesize; +}; + +#define AT45D_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define AT45D_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) -#define AT45D_LOCK_INIT(_sc) \ +#define AT45D_LOCK_INIT(_sc) \ mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ "at45d", MTX_DEF) -#define AT45D_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); -#define AT45D_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); -#define AT45D_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); - -static void at45d_delayed_attach(void *xsc); +#define AT45D_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define AT45D_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); +#define AT45D_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); + +/* bus entry points */ +static device_attach_t at45d_attach; +static device_detach_t at45d_detach; +static device_probe_t at45d_probe; /* disk routines */ -static int at45d_open(struct disk *dp); static int at45d_close(struct disk *dp); +static int at45d_open(struct disk *dp); static void at45d_strategy(struct bio *bp); static void at45d_task(void *arg); -#define CONTINUOUS_ARRAY_READ 0xE8 -#define CONTINUOUS_ARRAY_READ_HF 0x0B -#define CONTINUOUS_ARRAY_READ_LF 0x03 -#define STATUS_REGISTER_READ 0xD7 -#define PROGRAM_THROUGH_BUFFER 0x82 -#define MANUFACTURER_ID 0x9F +/* helper routines */ +static void at45d_delayed_attach(void *xsc); +static int at45d_get_mfg_info(device_t dev, uint8_t *resp); +static int at45d_get_status(device_t dev, uint8_t *status); +static int at45d_wait_ready(device_t dev, uint8_t *status); + +#define BUFFER_TRANSFER 0x53 +#define BUFFER_COMPARE 0x60 +#define PROGRAM_THROUGH_BUFFER 0x82 +#define MANUFACTURER_ID 0x9f +#define STATUS_REGISTER_READ 0xd7 +#define CONTINUOUS_ARRAY_READ 0xe8 + +/* + * A sectorsize2n != 0 is used to indicate that a device optionally supports + * 2^N byte pages. If support for the latter is enabled, the sector offset + * has to be reduced by one. + */ +static const struct at45d_flash_ident const at45d_flash_devices[] = { + { "AT45DB011B", 0x1f2200, 512, 9, 264, 256 }, + { "AT45DB021B", 0x1f2300, 1024, 9, 264, 256 }, + { "AT45DB041x", 0x1f2400, 2028, 9, 264, 256 }, + { "AT45DB081B", 0x1f2500, 4096, 9, 264, 256 }, + { "AT45DB161x", 0x1f2600, 4096, 10, 528, 512 }, + { "AT45DB321x", 0x1f2700, 8192, 10, 528, 0 }, + { "AT45DB321x", 0x1f2701, 8192, 10, 528, 512 }, + { "AT45DB642x", 0x1f2800, 8192, 11, 1056, 1024 } +}; -static uint8_t -at45d_get_status(device_t dev) +static int +at45d_get_status(device_t dev, uint8_t *status) { - uint8_t txBuf[8], rxBuf[8]; + uint8_t rxBuf[8], txBuf[8]; struct spi_command cmd; int err; @@ -90,23 +131,16 @@ at45d_get_status(device_t dev) txBuf[0] = STATUS_REGISTER_READ; cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; - cmd.rx_cmd_sz = 2; - cmd.tx_cmd_sz = 2; + cmd.rx_cmd_sz = cmd.tx_cmd_sz = 2; err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); - return (rxBuf[1]); -} - -static void -at45d_wait_for_device_ready(device_t dev) -{ - while (!(at45d_get_status(dev) & 0x80)) - continue; + *status = rxBuf[1]; + return (err); } static int at45d_get_mfg_info(device_t dev, uint8_t *resp) { - uint8_t txBuf[8], rxBuf[8]; + uint8_t rxBuf[8], txBuf[8]; struct spi_command cmd; int err; @@ -117,22 +151,37 @@ at45d_get_mfg_info(device_t dev, uint8_t txBuf[0] = MANUFACTURER_ID; cmd.tx_cmd = &txBuf; cmd.rx_cmd = &rxBuf; - cmd.tx_cmd_sz = 5; - cmd.rx_cmd_sz = 5; + cmd.tx_cmd_sz = cmd.rx_cmd_sz = 5; err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); if (err) return (err); memcpy(resp, rxBuf + 1, 4); - // XXX We really should 'decode' the reply into some kind of - // XXX structure. To be generic (and not just for atmel parts) - // XXX we'd have to loop until we got a full reply. return (0); } static int +at45d_wait_ready(device_t dev, uint8_t *status) +{ + struct timeval now, tout; + int err; + + getmicrouptime(&tout); + tout.tv_sec += 3; + do { + getmicrouptime(&now); + if (now.tv_sec > tout.tv_sec) + err = ETIMEDOUT; + else + err = at45d_get_status(dev, status); + } while (err == 0 && (*status & 0x80) == 0); + return (err); +} + +static int at45d_probe(device_t dev) { - device_set_desc(dev, "AT45 Flash Family"); + + device_set_desc(dev, "AT45D Flash Family"); return (0); } @@ -156,31 +205,66 @@ at45d_attach(device_t dev) static int at45d_detach(device_t dev) { - return EIO; + + return (EBUSY) /* XXX */; } static void at45d_delayed_attach(void *xsc) { - struct at45d_softc *sc = xsc; - uint8_t buf[4]; - - at45d_get_mfg_info(sc->dev, buf); - at45d_wait_for_device_ready(sc->dev); - - sc->disk = disk_alloc(); - sc->disk->d_open = at45d_open; - sc->disk->d_close = at45d_close; - sc->disk->d_strategy = at45d_strategy; - sc->disk->d_name = "flash/spi"; - sc->disk->d_drv1 = sc; - sc->disk->d_maxsize = DFLTPHYS; - sc->disk->d_sectorsize = 1056; /* XXX */ - sc->disk->d_mediasize = 8192 * 1056; /* XXX */ - sc->disk->d_unit = device_get_unit(sc->dev); - disk_create(sc->disk, DISK_VERSION); - bioq_init(&sc->bio_queue); - kproc_create(&at45d_task, sc, &sc->p, 0, 0, "task: at45d flash"); + struct at45d_softc *sc; + const struct at45d_flash_ident *ident; + u_int i; + uint32_t jedec; + uint16_t pagesize; + uint8_t buf[4], status; + + sc = xsc; + ident = NULL; + jedec = 0; + + if (at45d_wait_ready(sc->dev, &status) != 0) + device_printf(sc->dev, "Error waiting for device-ready.\n"); + else if (at45d_get_mfg_info(sc->dev, buf) != 0) + device_printf(sc->dev, "Failed to get ID.\n"); + else { + jedec = buf[0] << 16 | buf[1] << 8 | buf[2]; + for (i = 0; i < nitems(at45d_flash_devices); i++) { + if (at45d_flash_devices[i].jedec == jedec) { + ident = &at45d_flash_devices[i]; + break; + } + } + } + if (ident == NULL) + device_printf(sc->dev, "JEDEC 0x%x not in list.\n", jedec); + else { + sc->pagecount = ident->pagecount; + sc->pageoffset = ident->pageoffset; + if (ident->pagesize2n != 0 && (status & 0x01) != 0) { + sc->pageoffset -= 1; + pagesize = ident->pagesize2n; + } else + pagesize = ident->pagesize; + sc->pagesize = pagesize; + + sc->disk = disk_alloc(); + sc->disk->d_open = at45d_open; + sc->disk->d_close = at45d_close; + sc->disk->d_strategy = at45d_strategy; + sc->disk->d_name = "flash/spi"; + sc->disk->d_drv1 = sc; + sc->disk->d_maxsize = DFLTPHYS; + sc->disk->d_sectorsize = pagesize; + sc->disk->d_mediasize = pagesize * ident->pagecount; + sc->disk->d_unit = device_get_unit(sc->dev); + disk_create(sc->disk, DISK_VERSION); + bioq_init(&sc->bio_queue); + kproc_create(&at45d_task, sc, &sc->p, 0, 0, + "task: at45d flash"); + device_printf(sc->dev, "%s, %d bytes per page, %d pages\n", + ident->name, pagesize, ident->pagecount); + } config_intrhook_disestablish(&sc->config_intrhook); } @@ -188,13 +272,15 @@ at45d_delayed_attach(void *xsc) static int at45d_open(struct disk *dp) { - return 0; + + return (0); } static int at45d_close(struct disk *dp) { - return 0; + + return (0); } static void @@ -212,53 +298,132 @@ at45d_strategy(struct bio *bp) static void at45d_task(void *arg) { - struct at45d_softc *sc = (struct at45d_softc*)arg; + uint8_t rxBuf[8], txBuf[8]; + struct at45d_softc *sc; struct bio *bp; - uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; - int sz; - daddr_t block, end; device_t dev, pdev; - int err; + caddr_t buf; + u_long len, resid; + u_int addr, berr, err, offset, page; + uint8_t status; + + sc = (struct at45d_softc*)arg; + dev = sc->dev; + pdev = device_get_parent(dev); + memset(&cmd, 0, sizeof(cmd)); + memset(txBuf, 0, sizeof(txBuf)); + memset(rxBuf, 0, sizeof(rxBuf)); + cmd.tx_cmd = txBuf; + cmd.rx_cmd = rxBuf; for (;;) { - dev = sc->dev; - pdev = device_get_parent(dev); AT45D_LOCK(sc); do { - bp = bioq_first(&sc->bio_queue); + bp = bioq_takefirst(&sc->bio_queue); if (bp == NULL) msleep(sc, &sc->sc_mtx, PRIBIO, "jobqueue", 0); } while (bp == NULL); - bioq_remove(&sc->bio_queue, bp); AT45D_UNLOCK(sc); - sz = sc->disk->d_sectorsize; - end = bp->bio_pblkno + (bp->bio_bcount / sz); - for (block = bp->bio_pblkno; block < end; block++) { - char *vaddr = bp->bio_data + (block - bp->bio_pblkno) * sz; - if (bp->bio_cmd == BIO_READ) { - txBuf[0] = CONTINUOUS_ARRAY_READ_HF; - cmd.tx_cmd_sz = 5; - cmd.rx_cmd_sz = 5; - } else { + + berr = 0; + buf = bp->bio_data; + len = resid = bp->bio_bcount; + page = bp->bio_offset / sc->pagesize; + offset = bp->bio_offset % sc->pagesize; + + switch (bp->bio_cmd) { + case BIO_READ: + txBuf[0] = CONTINUOUS_ARRAY_READ; + cmd.tx_cmd_sz = cmd.rx_cmd_sz = 8; + cmd.tx_data = cmd.rx_data = buf; + break; + case BIO_WRITE: + cmd.tx_cmd_sz = cmd.rx_cmd_sz = 4; + cmd.tx_data = cmd.rx_data = buf; + if (resid + offset > sc->pagesize) + len = sc->pagesize - offset; + break; + default: + berr = EINVAL; + goto out; + } + + /* + * NB: for BIO_READ, this loop is only traversed once. + */ + while (resid > 0) { + if (page > sc->pagecount) { + berr = EINVAL; + goto out; + } + addr = page << sc->pageoffset; + if (bp->bio_cmd == BIO_WRITE) { + if (len != sc->pagesize) { + txBuf[0] = BUFFER_TRANSFER; + txBuf[1] = ((addr >> 16) & 0xff); + txBuf[2] = ((addr >> 8) & 0xff); + txBuf[3] = 0; + cmd.tx_data_sz = cmd.rx_data_sz = 0; + err = SPIBUS_TRANSFER(pdev, dev, + &cmd); + if (err == 0) + err = at45d_wait_ready(dev, + &status); + if (err != 0) { + berr = EIO; + goto out; + } + } txBuf[0] = PROGRAM_THROUGH_BUFFER; - cmd.tx_cmd_sz = 4; - cmd.rx_cmd_sz = 4; } - // XXX only works on certain devices... Fixme - txBuf[1] = ((block >> 5) & 0xFF); - txBuf[2] = ((block << 3) & 0xF8); - txBuf[3] = 0; - txBuf[4] = 0; - cmd.tx_cmd = txBuf; - cmd.rx_cmd = rxBuf; - cmd.tx_data = vaddr; - cmd.tx_data_sz = sz; - cmd.rx_data = vaddr; - cmd.rx_data_sz = sz; + + addr += offset; + txBuf[1] = ((addr >> 16) & 0xff); + txBuf[2] = ((addr >> 8) & 0xff); + txBuf[3] = (addr & 0xff); + cmd.tx_data_sz = cmd.rx_data_sz = len; err = SPIBUS_TRANSFER(pdev, dev, &cmd); - // XXX err check? + if (err == 0 && bp->bio_cmd != BIO_READ) + err = at45d_wait_ready(dev, &status); + if (err != 0) { + berr = EIO; + goto out; + } + if (bp->bio_cmd == BIO_WRITE) { + addr = page << sc->pageoffset; + txBuf[0] = BUFFER_COMPARE; + txBuf[1] = ((addr >> 16) & 0xff); + txBuf[2] = ((addr >> 8) & 0xff); + txBuf[3] = 0; + cmd.tx_data_sz = cmd.rx_data_sz = 0; + err = SPIBUS_TRANSFER(pdev, dev, &cmd); + if (err == 0) + err = at45d_wait_ready(dev, &status); + if (err != 0 || (status & 0x40) != 0) { + device_printf(dev, "comparing page " + "%d failed (status=0x%x)\n", addr, + status); + berr = EIO; + goto out; + } + } + page++; + buf += len; + offset = 0; + resid -= len; + if (resid > sc->pagesize) + len = sc->pagesize; + else + len = resid; + cmd.tx_data = cmd.rx_data = buf; + } + out: + if (berr != 0) { + bp->bio_flags |= BIO_ERROR; + bp->bio_error = berr; } + bp->bio_resid = resid; biodone(bp); } } @@ -271,7 +436,7 @@ static device_method_t at45d_methods[] = DEVMETHOD(device_attach, at45d_attach), DEVMETHOD(device_detach, at45d_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t at45d_driver = { @@ -280,4 +445,4 @@ static driver_t at45d_driver = { sizeof(struct at45d_softc), }; -DRIVER_MODULE(at45d, spibus, at45d_driver, at45d_devclass, 0, 0); +DRIVER_MODULE(at45d, spibus, at45d_driver, at45d_devclass, NULL, NULL); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 11:23:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18BDD1065673; Thu, 21 Jun 2012 11:23:39 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 018138FC0C; Thu, 21 Jun 2012 11:23:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LBNcHK009681; Thu, 21 Jun 2012 11:23:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LBNcne009676; Thu, 21 Jun 2012 11:23:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211123.q5LBNcne009676@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 11:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237386 - in stable/9/sys/arm: at91 conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 11:23:39 -0000 Author: marius Date: Thu Jun 21 11:23:38 2012 New Revision: 237386 URL: http://svn.freebsd.org/changeset/base/237386 Log: MFC: r235348, r236191, r236497 Add glue/support for the SAM9XE512-based Ethernut 5 boards. Currently, all integrated and on-board peripherals except NAND Flash (missing NAND framework/integration) are working. Added: stable/9/sys/arm/at91/board_ethernut5.c - copied unchanged from r235348, head/sys/arm/at91/board_ethernut5.c stable/9/sys/arm/at91/std.ethernut5 - copied unchanged from r235348, head/sys/arm/at91/std.ethernut5 stable/9/sys/arm/conf/ETHERNUT5 - copied, changed from r235348, head/sys/arm/conf/ETHERNUT5 stable/9/sys/arm/conf/ETHERNUT5.hints - copied, changed from r235348, head/sys/arm/conf/ETHERNUT5.hints Modified: stable/9/sys/arm/at91/files.at91sam9 Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Copied: stable/9/sys/arm/at91/board_ethernut5.c (from r235348, head/sys/arm/at91/board_ethernut5.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/arm/at91/board_ethernut5.c Thu Jun 21 11:23:38 2012 (r237386, copy of r235348, head/sys/arm/at91/board_ethernut5.c) @@ -0,0 +1,146 @@ +/*- + * Copyright (c) 2012 Marius Strobl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Ethernut 5 board support + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +long +board_init(void) +{ + + /* + * DBGU + */ + /* DRXD */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB14, 0); + /* DTXD */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB15, 1); + + /* + * EMAC + */ + /* ETX0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA12, 0); + /* ETX1 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA13, 0); + /* ERX0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA14, 0); + /* ERX1 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA15, 0); + /* ETXEN */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA16, 0); + /* ERXDV */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA17, 0); + /* ERXER */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA18, 0); + /* ETXCK */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA19, 0); + /* EMDC */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA20, 0); + /* EMDIO */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA21, 0); + + /* + * MMC + */ + /* MCDA0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA6, 1); + /* MCCDA */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA7, 1); + /* MCCK */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA8, 1); + /* MCDA1 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA9, 1); + /* MCDA2 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA10, 1); + /* MCDA3 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA11, 1); + + /* + * SPI0 + */ + /* MISO */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA0, 0); + /* MOSI */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA1, 0); + /* SPCK */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA2, 0); + /* NPCS0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA3, 0); + + /* + * TWI + */ + /* TWD */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA23, 1); + /* TWCK */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA24, 1); + + /* + * USART0 + */ + /* TXD0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB4, 1); + /* RXD0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB5, 0); + /* DSR0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB22, 0); + /* DCD0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB23, 0); + /* DTR0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB24, 1); + /* RI0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB25, 0); + /* RTS0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB26, 1); + /* CTS0 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB27, 0); + + /* + * USART2 + */ + /* RTS2 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA4, 1); + /* CTS2 */ + at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA5, 0); + /* TXD2 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB8, 1); + /* RXD2 */ + at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB9, 0); + + return (at91_ramsize()); +} Modified: stable/9/sys/arm/at91/files.at91sam9 ============================================================================== --- stable/9/sys/arm/at91/files.at91sam9 Thu Jun 21 11:16:13 2012 (r237385) +++ stable/9/sys/arm/at91/files.at91sam9 Thu Jun 21 11:23:38 2012 (r237386) @@ -31,6 +31,7 @@ arm/at91/at91sam9260.c optional at91sam # # All the boards we support # +arm/at91/board_ethernut5.c optional at91_board_ethernut5 arm/at91/board_hl201.c optional at91_board_hl201 arm/at91/board_sam9g20ek.c optional at91_board_sam9g20ek arm/at91/board_qila9g20.c optional at91_board_qila9g20 Copied: stable/9/sys/arm/at91/std.ethernut5 (from r235348, head/sys/arm/at91/std.ethernut5) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/arm/at91/std.ethernut5 Thu Jun 21 11:23:38 2012 (r237386, copy of r235348, head/sys/arm/at91/std.ethernut5) @@ -0,0 +1,14 @@ +# $FreeBSD$ +include "../at91/std.at91sam9" + +options STARTUP_PAGETABLE_ADDR=0x20800000 +makeoptions KERNPHYSADDR=0x20000000 +makeoptions KERNVIRTADDR=0xc0000000 +options KERNPHYSADDR=0x20000000 +options KERNVIRTADDR=0xc0000000 + +# SAM9XE512 w/ 90.3168 MHz master clock +options AT91C_MASTER_CLOCK=90316800 + +device at91_board_ethernut5 +nodevice at91sam9g20 Copied and modified: stable/9/sys/arm/conf/ETHERNUT5 (from r235348, head/sys/arm/conf/ETHERNUT5) ============================================================================== --- head/sys/arm/conf/ETHERNUT5 Sat May 12 18:11:26 2012 (r235348, copy source) +++ stable/9/sys/arm/conf/ETHERNUT5 Thu Jun 21 11:23:38 2012 (r237386) @@ -66,11 +66,11 @@ options PRINTF_BUFR_SIZE=128 # Prevent #options INCLUDE_CONFIG_FILE # Include this file in kernel # required for netbooting -options BOOTP_NFSROOT options BOOTP +options BOOTP_COMPAT +options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=ate0 -options BOOTP_COMPAT # alternatively, boot from a MMC/SD memory card #options ROOTDEVNAME=\"ufs:/dev/mmcsd0a\" @@ -117,11 +117,11 @@ options AT91_MCI_HAS_4WIRE device mmc # MMC/SD bus device mmcsd # MMC/SD memory card -# DataFlash - totally b0rken drivers -#device at91_spi # Atmel AT91 Serial Peripheral Interface -#device spibus # SPI bus -#device at45d # Atmel AT45D -#device geom_map # GEOM partition mapping +# DataFlash +device at91_spi # Atmel AT91 Serial Peripheral Interface +device spibus # SPI bus +device at45d # Atmel AT45D +device geom_map # GEOM partition mapping # Pseudo devices. device loop # Network loopback Copied and modified: stable/9/sys/arm/conf/ETHERNUT5.hints (from r235348, head/sys/arm/conf/ETHERNUT5.hints) ============================================================================== --- head/sys/arm/conf/ETHERNUT5.hints Sat May 12 18:11:26 2012 (r235348, copy source) +++ stable/9/sys/arm/conf/ETHERNUT5.hints Thu Jun 21 11:23:38 2012 (r237386) @@ -27,18 +27,24 @@ hint.map.3.start=0x000c6000 hint.map.3.end=0x00359fff hint.map.3.name="kernel" #hint.map.3.readonly=1 -# nutos 3432 kbytes +# nutos 528 kbytes hint.map.4.at="flash/spi0" hint.map.4.start=0x0035a000 hint.map.4.end=0x003ddfff hint.map.4.name="nutos" hint.map.4.readonly=1 -# env 3960 kbytes +# env 132 kbytes hint.map.5.at="flash/spi0" hint.map.5.start=0x003de000 hint.map.5.end=0x003fefff hint.map.5.name="env" hint.map.5.readonly=1 +# env 132 kbytes +hint.map.6.at="flash/spi0" +hint.map.6.start=0x003ff000 +hint.map.6.end=0x0041ffff +hint.map.6.name="nutoscfg" +hint.map.6.readonly=1 # NXP PCF8563 clock/calendar hint.pcf8563_rtc.0.at="iicbus0" From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 12:10:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E20F106567D; Thu, 21 Jun 2012 12:10:09 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69B458FC0C; Thu, 21 Jun 2012 12:10:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LCA9UK011774; Thu, 21 Jun 2012 12:10:09 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LCA9h7011772; Thu, 21 Jun 2012 12:10:09 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211210.q5LCA9h7011772@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 12:10:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237388 - stable/9/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 12:10:09 -0000 Author: marius Date: Thu Jun 21 12:10:08 2012 New Revision: 237388 URL: http://svn.freebsd.org/changeset/base/237388 Log: MFC: r231617 Add ARM relocations types used for thread-local storage Reviewed by: cognet Modified: stable/9/sys/sys/elf_common.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/sys/elf_common.h ============================================================================== --- stable/9/sys/sys/elf_common.h Thu Jun 21 11:39:56 2012 (r237387) +++ stable/9/sys/sys/elf_common.h Thu Jun 21 12:10:08 2012 (r237388) @@ -634,6 +634,10 @@ typedef struct { #define R_ARM_THM_SWI8 14 #define R_ARM_XPC25 15 #define R_ARM_THM_XPC22 16 +/* TLS relocations */ +#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ +#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ +#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ #define R_ARM_COPY 20 /* Copy data from shared object. */ #define R_ARM_GLOB_DAT 21 /* Set GOT entry to data address. */ #define R_ARM_JUMP_SLOT 22 /* Set GOT entry to code address. */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 12:10:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2B89106567E; Thu, 21 Jun 2012 12:10:09 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6DB18FC12; Thu, 21 Jun 2012 12:10:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LCA9di011788; Thu, 21 Jun 2012 12:10:09 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LCA9P3011786; Thu, 21 Jun 2012 12:10:09 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211210.q5LCA9P3011786@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 12:10:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237389 - stable/8/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 12:10:10 -0000 Author: marius Date: Thu Jun 21 12:10:09 2012 New Revision: 237389 URL: http://svn.freebsd.org/changeset/base/237389 Log: MFC: r231617 Add ARM relocations types used for thread-local storage Reviewed by: cognet Modified: stable/8/sys/sys/elf_common.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/sys/elf_common.h ============================================================================== --- stable/8/sys/sys/elf_common.h Thu Jun 21 12:10:08 2012 (r237388) +++ stable/8/sys/sys/elf_common.h Thu Jun 21 12:10:09 2012 (r237389) @@ -630,6 +630,10 @@ typedef struct { #define R_ARM_THM_SWI8 14 #define R_ARM_XPC25 15 #define R_ARM_THM_XPC22 16 +/* TLS relocations */ +#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ +#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ +#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ #define R_ARM_COPY 20 /* Copy data from shared object. */ #define R_ARM_GLOB_DAT 21 /* Set GOT entry to data address. */ #define R_ARM_JUMP_SLOT 22 /* Set GOT entry to code address. */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 12:30:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39491106566B; Thu, 21 Jun 2012 12:30:36 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id B5C468FC18; Thu, 21 Jun 2012 12:30:35 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 931BB25D3A99; Thu, 21 Jun 2012 12:30:34 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id B3584BE84A9; Thu, 21 Jun 2012 12:30:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id rjsBnn-Do65y; Thu, 21 Jun 2012 12:30:32 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 55117BE84A7; Thu, 21 Jun 2012 12:30:32 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201206201708.q5KH81EI056365@svn.freebsd.org> Date: Thu, 21 Jun 2012 12:30:31 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <201206201708.q5KH81EI056365@svn.freebsd.org> To: Kenneth D. Merry X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237328 - in head/sys/cam: . scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 12:30:36 -0000 On 20. Jun 2012, at 17:08 , Kenneth D. Merry wrote: > Author: ken > Date: Wed Jun 20 17:08:00 2012 > New Revision: 237328 > URL: http://svn.freebsd.org/changeset/base/237328 > > Log: > Fix several reference counting and object lifetime issues between > the pass(4) and enc(4) drivers and devfs. Just as a hint for the archives: enc(4) is completely unrelated to this commit as it's the "encapsulation device" used along with IPsec and has nothing to do with scsi_enc. -- Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 12:47:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DE588106566C; Thu, 21 Jun 2012 12:47:21 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEE8B8FC1A; Thu, 21 Jun 2012 12:47:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LClLSw013499; Thu, 21 Jun 2012 12:47:21 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LClLia013497; Thu, 21 Jun 2012 12:47:21 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206211247.q5LClLia013497@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 12:47:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237391 - stable/9/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 12:47:22 -0000 Author: ae Date: Thu Jun 21 12:47:21 2012 New Revision: 237391 URL: http://svn.freebsd.org/changeset/base/237391 Log: MFC r237057: Always reconstruct partition entries in the PMBR when Boot Camp is disabled. This helps to easily recover from situations when PMBR is damaged and contains no entries. Modified: stable/9/sys/geom/part/g_part_gpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/part/g_part_gpt.c ============================================================================== --- stable/9/sys/geom/part/g_part_gpt.c Thu Jun 21 12:26:12 2012 (r237390) +++ stable/9/sys/geom/part/g_part_gpt.c Thu Jun 21 12:47:21 2012 (r237391) @@ -339,9 +339,6 @@ gpt_update_bootcamp(struct g_part_table disable: table->bootcamp = 0; - bzero(table->mbr + DOSPARTOFF, DOSPARTSIZE * NDOSPART); - gpt_write_mbr_entry(table->mbr, 0, 0xee, 1ull, - MIN(table->lba[GPT_ELT_SECHDR], UINT32_MAX)); } static struct gpt_hdr * @@ -587,10 +584,6 @@ g_part_gpt_bootcode(struct g_part_table codesz = MIN(codesz, gpp->gpp_codesize); if (codesz > 0) bcopy(gpp->gpp_codeptr, table->mbr, codesz); - - /* Mark the PMBR active since some BIOS require it. */ - if (!table->bootcamp) - table->mbr[DOSPARTOFF] = 0x80; /* status */ return (0); } @@ -599,7 +592,6 @@ g_part_gpt_create(struct g_part_table *b { struct g_provider *pp; struct g_part_gpt_table *table; - quad_t last; size_t tblsz; /* We don't nest, which means that our depth should be 0. */ @@ -615,11 +607,6 @@ g_part_gpt_create(struct g_part_table *b pp->sectorsize) return (ENOSPC); - last = (pp->mediasize / pp->sectorsize) - 1; - - le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC); - gpt_write_mbr_entry(table->mbr, 0, 0xee, 1, MIN(last, UINT32_MAX)); - /* Allocate space for the header */ table->hdr = g_malloc(sizeof(struct gpt_hdr), M_WAITOK | M_ZERO); @@ -1045,6 +1032,16 @@ g_part_gpt_write(struct g_part_table *ba if (table->bootcamp) gpt_update_bootcamp(basetable); + /* Update partition entries in the PMBR if Boot Camp disabled. */ + if (!table->bootcamp) { + bzero(table->mbr + DOSPARTOFF, DOSPARTSIZE * NDOSPART); + gpt_write_mbr_entry(table->mbr, 0, 0xee, 1, + MIN(pp->mediasize / pp->sectorsize - 1, UINT32_MAX)); + /* Mark the PMBR active since some BIOS require it. */ + table->mbr[DOSPARTOFF] = 0x80; + } + le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC); + /* Write the PMBR */ buf = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); bcopy(table->mbr, buf, MBRSIZE); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 12:51:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E6A34106566B; Thu, 21 Jun 2012 12:51:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D19DC8FC1D; Thu, 21 Jun 2012 12:51:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LCpOwQ013712; Thu, 21 Jun 2012 12:51:24 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LCpOsc013710; Thu, 21 Jun 2012 12:51:24 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206211251.q5LCpOsc013710@svn.freebsd.org> From: Michael Tuexen Date: Thu, 21 Jun 2012 12:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237392 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 12:51:25 -0000 Author: tuexen Date: Thu Jun 21 12:51:24 2012 New Revision: 237392 URL: http://svn.freebsd.org/changeset/base/237392 Log: Remove redundant #ifdef. Reported by gnn@. MFC after: 3 days Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Thu Jun 21 12:47:21 2012 (r237391) +++ head/sys/netinet/sctp_usrreq.c Thu Jun 21 12:51:24 2012 (r237392) @@ -6476,7 +6476,6 @@ sctp_peeraddr(struct socket *so, struct return (0); } -#ifdef INET struct pr_usrreqs sctp_usrreqs = { .pru_abort = sctp_abort, .pru_accept = sctp_accept, @@ -6499,4 +6498,3 @@ struct pr_usrreqs sctp_usrreqs = { }; #endif -#endif From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 12:52:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4ECEA1065674; Thu, 21 Jun 2012 12:52:16 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F7B88FC15; Thu, 21 Jun 2012 12:52:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LCqGfn013787; Thu, 21 Jun 2012 12:52:16 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LCqF8U013782; Thu, 21 Jun 2012 12:52:15 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201206211252.q5LCqF8U013782@svn.freebsd.org> From: Isabell Long Date: Thu, 21 Jun 2012 12:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237393 - head/lib/libc/string X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 12:52:16 -0000 Author: issyl0 (doc committer) Date: Thu Jun 21 12:52:15 2012 New Revision: 237393 URL: http://svn.freebsd.org/changeset/base/237393 Log: Add more locale-specific functions to the relevant man pages: - libc/string/strcoll.3 - libc/string/strstr.3 - libc/string/strxfrm.3 - libc/string/strcasecmp.3 Reviewed by: theraven, gabor Approved by: gabor (mentor) MFC after: 5 days Modified: head/lib/libc/string/strcasecmp.3 head/lib/libc/string/strcoll.3 head/lib/libc/string/strstr.3 head/lib/libc/string/strxfrm.3 Modified: head/lib/libc/string/strcasecmp.3 ============================================================================== --- head/lib/libc/string/strcasecmp.3 Thu Jun 21 12:51:24 2012 (r237392) +++ head/lib/libc/string/strcasecmp.3 Thu Jun 21 12:52:15 2012 (r237393) @@ -45,6 +45,12 @@ .Fn strcasecmp "const char *s1" "const char *s2" .Ft int .Fn strncasecmp "const char *s1" "const char *s2" "size_t len" +.In string.h +.In xlocale.h +.Ft int +.Fn strcasecmp_l "const char *s1" "const char *s2" "locale_t loc" +.Ft int +.Fn strncasecmp_l "const char *s1" "const char *s2" "site_t len" "locale_t loc" .Sh DESCRIPTION The .Fn strcasecmp @@ -58,16 +64,22 @@ and .Pp The .Fn strncasecmp -compares at most +function compares at most .Fa len characters. -.Sh RETURN VALUES The +.Fn strcasecmp_l +and +.Fn strncasecmp_l +functions do the same as their non-locale versions above, but take an +explicit locale rather than using the current locale. +.Sh RETURN VALUES +The functions .Fn strcasecmp and .Fn strncasecmp return an integer greater than, equal to, or less than 0, -according as +depending on whether .Fa s1 is lexicographically greater than, equal to, or less than .Fa s2 @@ -77,6 +89,11 @@ The comparison is done using unsigned ch .Sq Li \e200 is greater than .Ql \e0 . +The functions +.Fn strcasecmp_l +and +.Fn strncasecmp_l +do the same but take explicit locales. .Sh SEE ALSO .Xr bcmp 3 , .Xr memcmp 3 , Modified: head/lib/libc/string/strcoll.3 ============================================================================== --- head/lib/libc/string/strcoll.3 Thu Jun 21 12:51:24 2012 (r237392) +++ head/lib/libc/string/strcoll.3 Thu Jun 21 12:52:15 2012 (r237393) @@ -44,6 +44,8 @@ .In string.h .Ft int .Fn strcoll "const char *s1" "const char *s2" +.Ft int +.Fn strcoll_l "const char *s1" "const char *s2" "locale_t loc" .Sh DESCRIPTION The .Fn strcoll @@ -54,7 +56,7 @@ and .Fa s2 according to the current locale collation and returns an integer greater than, equal to, or less than 0, -according as +depending on whether .Fa s1 is greater than, equal to, or less than .Fa s2 . @@ -62,6 +64,9 @@ If information about the current locale the value of .Fn strcmp s1 s2 is returned. +The +.Fn strcoll_l +function uses an explicit locale argument rather than the system locale. .Sh SEE ALSO .Xr setlocale 3 , .Xr strcmp 3 , @@ -70,6 +75,9 @@ is returned. .Sh STANDARDS The .Fn strcoll -function -conforms to +function conforms to .St -isoC . +The +.Fn strcoll_l +function conforms to +.St -p1003.1-2008 . Modified: head/lib/libc/string/strstr.3 ============================================================================== --- head/lib/libc/string/strstr.3 Thu Jun 21 12:51:24 2012 (r237392) +++ head/lib/libc/string/strstr.3 Thu Jun 21 12:52:15 2012 (r237393) @@ -49,6 +49,10 @@ .Fn strcasestr "const char *big" "const char *little" .Ft char * .Fn strnstr "const char *big" "const char *little" "size_t len" +.In string.h +.In xlocale.h +.Ft char * +.Fn strcasestr_l "const char *big" "const char *little" "locale_t loc" .Sh DESCRIPTION The .Fn strstr @@ -65,6 +69,12 @@ function is similar to but ignores the case of both strings. .Pp The +.Fn strcasestr_l +function does the same as +.Fn strcasestr +but takes an explicit locale rather than using the current locale. +.Pp +The .Fn strnstr function locates the first occurrence of the null-terminated string Modified: head/lib/libc/string/strxfrm.3 ============================================================================== --- head/lib/libc/string/strxfrm.3 Thu Jun 21 12:51:24 2012 (r237392) +++ head/lib/libc/string/strxfrm.3 Thu Jun 21 12:52:15 2012 (r237393) @@ -44,6 +44,8 @@ .In string.h .Ft size_t .Fn strxfrm "char * restrict dst" "const char * restrict src" "size_t n" +.Ft size_t +.Fn strxfrm_l "char * restrict dst" "const char *restrict src" "size_t n" "locale_t loc" .Sh DESCRIPTION The .Fn strxfrm @@ -73,10 +75,16 @@ after is equal to comparing two original strings with .Fn strcoll . +.Pp +.Fn strxfrm_l +does the same, however takes an explicit locale rather than the global +locale. .Sh RETURN VALUES Upon successful completion, .Fn strxfrm -returns the length of the transformed string not including +and +.Fn strxfrm_l +return the length of the transformed string not including the terminating null character. If this value is .Fa n @@ -94,3 +102,7 @@ The function conforms to .St -isoC . +The +.Fn strxfrm_l +function conforms to +.St -p1003.1-2008 . From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 13:01:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BAF51065676; Thu, 21 Jun 2012 13:01:01 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B58D8FC08; Thu, 21 Jun 2012 13:01:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LD11iI014197; Thu, 21 Jun 2012 13:01:01 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LD11fw014192; Thu, 21 Jun 2012 13:01:01 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211301.q5LD11fw014192@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 13:01:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237394 - in stable/9/libexec/rtld-elf: . arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 13:01:01 -0000 Author: marius Date: Thu Jun 21 13:01:00 2012 New Revision: 237394 URL: http://svn.freebsd.org/changeset/base/237394 Log: MFC: r231618, r233231 (partial) Add thread-local storage support for ARM to rtld-elf Reviewed by: cognet Obtained from: NetBSD Modified: stable/9/libexec/rtld-elf/arm/reloc.c stable/9/libexec/rtld-elf/arm/rtld_machdep.h stable/9/libexec/rtld-elf/rtld.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/arm/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/arm/reloc.c Thu Jun 21 12:52:15 2012 (r237393) +++ stable/9/libexec/rtld-elf/arm/reloc.c Thu Jun 21 13:01:00 2012 (r237394) @@ -10,6 +10,9 @@ __FBSDID("$FreeBSD$"); #include #include #include + +#include "machine/sysarch.h" + #include "debug.h" #include "rtld.h" @@ -235,6 +238,63 @@ reloc_nonplt_object(Obj_Entry *obj, cons dbg("COPY (avoid in main)"); break; + case R_ARM_TLS_DTPOFF32: + def = find_symdef(symnum, obj, &defobj, flags, cache, + lockstate); + if (def == NULL) + return -1; + + tmp = (Elf_Addr)(def->st_value); + if (__predict_true(RELOC_ALIGNED_P(where))) + *where = tmp; + else + store_ptr(where, tmp); + + dbg("TLS_DTPOFF32 %s in %s --> %p", + obj->strtab + obj->symtab[symnum].st_name, + obj->path, (void *)tmp); + + break; + case R_ARM_TLS_DTPMOD32: + def = find_symdef(symnum, obj, &defobj, flags, cache, + lockstate); + if (def == NULL) + return -1; + + tmp = (Elf_Addr)(defobj->tlsindex); + if (__predict_true(RELOC_ALIGNED_P(where))) + *where = tmp; + else + store_ptr(where, tmp); + + dbg("TLS_DTPMOD32 %s in %s --> %p", + obj->strtab + obj->symtab[symnum].st_name, + obj->path, (void *)tmp); + + break; + + case R_ARM_TLS_TPOFF32: + def = find_symdef(symnum, obj, &defobj, flags, cache, + lockstate); + if (def == NULL) + return -1; + + if (!defobj->tls_done && allocate_tls_offset(obj)) + return -1; + + /* XXX: FIXME */ + tmp = (Elf_Addr)def->st_value + defobj->tlsoffset + + TLS_TCB_SIZE; + if (__predict_true(RELOC_ALIGNED_P(where))) + *where = tmp; + else + store_ptr(where, tmp); + dbg("TLS_TPOFF32 %s in %s --> %p", + obj->strtab + obj->symtab[symnum].st_name, + obj->path, (void *)tmp); + break; + + default: dbg("sym = %lu, type = %lu, offset = %p, " "contents = %p, symbol = %s", @@ -373,11 +433,26 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr void allocate_initial_tls(Obj_Entry *objs) { - + void **_tp = (void **)ARM_TP_ADDRESS; + + /* + * Fix the size of the static TLS block by using the maximum + * offset allocated so far and adding a bit for dynamic modules to + * use. + */ + + tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; + + (*_tp) = (void *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8); } void * __tls_get_addr(tls_index* ti) { - return (NULL); + void **_tp = (void **)ARM_TP_ADDRESS; + char *p; + + p = tls_get_addr_common((Elf_Addr **)(*_tp), ti->ti_module, ti->ti_offset); + + return (p); } Modified: stable/9/libexec/rtld-elf/arm/rtld_machdep.h ============================================================================== --- stable/9/libexec/rtld-elf/arm/rtld_machdep.h Thu Jun 21 12:52:15 2012 (r237393) +++ stable/9/libexec/rtld-elf/arm/rtld_machdep.h Thu Jun 21 13:01:00 2012 (r237394) @@ -51,20 +51,20 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +#define TLS_TCB_SIZE 8 typedef struct { unsigned long ti_module; unsigned long ti_offset; } tls_index; #define round(size, align) \ - (((size) + (align) - 1) & ~((align) - 1)) + (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ - round(size, align) + round(8, align) #define calculate_tls_offset(prev_offset, prev_size, size, align) \ - round(prev_offset + prev_size, align) + round(prev_offset + prev_size, align) #define calculate_tls_end(off, size) ((off) + (size)) - /* * Lazy binding entry point, called via PLT. */ Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Thu Jun 21 12:52:15 2012 (r237393) +++ stable/9/libexec/rtld-elf/rtld.c Thu Jun 21 13:01:00 2012 (r237394) @@ -3937,9 +3937,7 @@ tls_get_addr_common(Elf_Addr **dtvp, int return (tls_get_addr_slow(dtvp, index, offset)); } -/* XXX not sure what variants to use for arm. */ - -#if defined(__ia64__) || defined(__powerpc__) +#if defined(__arm__) || defined(__ia64__) || defined(__powerpc__) /* * Allocate Static TLS using the Variant I method. @@ -4021,7 +4019,7 @@ free_tls(void *tcb, size_t tcbsize, size #endif #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \ - defined(__arm__) || defined(__mips__) + defined(__mips__) /* * Allocate Static TLS using the Variant II method. From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 13:39:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EB6BF1065675; Thu, 21 Jun 2012 13:39:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D562A8FC22; Thu, 21 Jun 2012 13:39:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LDduTO015843; Thu, 21 Jun 2012 13:39:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LDdumX015841; Thu, 21 Jun 2012 13:39:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211339.q5LDdumX015841@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 13:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237395 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 13:39:57 -0000 Author: marius Date: Thu Jun 21 13:39:56 2012 New Revision: 237395 URL: http://svn.freebsd.org/changeset/base/237395 Log: MFC: r232582 (partial) - Switch ARM to TLS Variant I. - Fix TLS allocation for Variant I: both rtld and libc allocators assume that tls_static_space includes space for TLS structure. So increment calculated static size by the size of it. Modified: stable/9/lib/libc/gen/tls.c Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/lib/libc/uuid/ (props changed) Modified: stable/9/lib/libc/gen/tls.c ============================================================================== --- stable/9/lib/libc/gen/tls.c Thu Jun 21 13:01:00 2012 (r237394) +++ stable/9/lib/libc/gen/tls.c Thu Jun 21 13:39:56 2012 (r237395) @@ -66,11 +66,12 @@ void __libc_free_tls(void *tls, size_t t #error TLS_TCB_ALIGN undefined for target architecture #endif -#if defined(__ia64__) || defined(__powerpc__) +#if defined(__arm__) || defined(__ia64__) || \ + defined(__powerpc__) #define TLS_VARIANT_I #endif #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \ - defined(__arm__) || defined(__mips__) + defined(__mips__) #define TLS_VARIANT_II #endif @@ -308,6 +309,13 @@ _init_tls() } } +#ifdef TLS_VARIANT_I + /* + * tls_static_space should include space for TLS structure + */ + tls_static_space += TLS_TCB_SIZE; +#endif + tls = _rtld_allocate_tls(NULL, TLS_TCB_SIZE, TLS_TCB_ALIGN); _set_tp(tls); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 13:51:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BC5F106566B; Thu, 21 Jun 2012 13:51:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4622C8FC14; Thu, 21 Jun 2012 13:51:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LDpptf016408; Thu, 21 Jun 2012 13:51:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LDppvr016406; Thu, 21 Jun 2012 13:51:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211351.q5LDppvr016406@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 13:51:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237396 - stable/9/lib/libc/arm/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 13:51:51 -0000 Author: marius Date: Thu Jun 21 13:51:50 2012 New Revision: 237396 URL: http://svn.freebsd.org/changeset/base/237396 Log: MFC: r233106, r233107 Fix TLS for statically linked binaries. Modified: stable/9/lib/libc/arm/gen/_set_tp.c Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/lib/libc/uuid/ (props changed) Modified: stable/9/lib/libc/arm/gen/_set_tp.c ============================================================================== --- stable/9/lib/libc/arm/gen/_set_tp.c Thu Jun 21 13:39:56 2012 (r237395) +++ stable/9/lib/libc/arm/gen/_set_tp.c Thu Jun 21 13:51:50 2012 (r237396) @@ -27,9 +27,13 @@ */ #include -#include +#include + +#include void _set_tp(void *tp) { + + *((struct tcb **)ARM_TP_ADDRESS) = tp; } From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 13:53:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40FEC106566B; Thu, 21 Jun 2012 13:53:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2AFE48FC15; Thu, 21 Jun 2012 13:53:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LDrT05016507; Thu, 21 Jun 2012 13:53:29 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LDrSxI016504; Thu, 21 Jun 2012 13:53:28 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206211353.q5LDrSxI016504@svn.freebsd.org> From: Marius Strobl Date: Thu, 21 Jun 2012 13:53:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237397 - in stable/9/lib/libthr/arch/arm: arm include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 13:53:29 -0000 Author: marius Date: Thu Jun 21 13:53:28 2012 New Revision: 237397 URL: http://svn.freebsd.org/changeset/base/237397 Log: MFC: r231619 Add thread-local storage support for arm: - Switch to Variant I TCB layout - Use function from rtld for TCB allocation/deallocation Modified: stable/9/lib/libthr/arch/arm/arm/pthread_md.c stable/9/lib/libthr/arch/arm/include/pthread_md.h Directory Properties: stable/9/lib/libthr/ (props changed) Modified: stable/9/lib/libthr/arch/arm/arm/pthread_md.c ============================================================================== --- stable/9/lib/libthr/arch/arm/arm/pthread_md.c Thu Jun 21 13:51:50 2012 (r237396) +++ stable/9/lib/libthr/arch/arm/arm/pthread_md.c Thu Jun 21 13:53:28 2012 (r237397) @@ -37,14 +37,17 @@ _tcb_ctor(struct pthread *thread, int in { struct tcb *tcb; - tcb = malloc(sizeof(struct tcb)); + tcb = _rtld_allocate_tls((initial) ? _tcb_get() : NULL, + sizeof(struct tcb), 16); if (tcb) tcb->tcb_thread = thread; + return (tcb); } void _tcb_dtor(struct tcb *tcb) { - free(tcb); + + _rtld_free_tls(tcb, sizeof(struct tcb), 16); } Modified: stable/9/lib/libthr/arch/arm/include/pthread_md.h ============================================================================== --- stable/9/lib/libthr/arch/arm/include/pthread_md.h Thu Jun 21 13:51:50 2012 (r237396) +++ stable/9/lib/libthr/arch/arm/include/pthread_md.h Thu Jun 21 13:53:28 2012 (r237397) @@ -43,10 +43,8 @@ * Variant II tcb, first two members are required by rtld. */ struct tcb { - struct tcb *tcb_self; /* required by rtld */ void *tcb_dtv; /* required by rtld */ struct pthread *tcb_thread; /* our hook */ - void *tcb_spare[1]; }; /* From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 14:06:15 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 80C59106566C; Thu, 21 Jun 2012 14:06:15 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 4296B8FC0A; Thu, 21 Jun 2012 14:06:15 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q5LE6973007066; Thu, 21 Jun 2012 07:06:09 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q5LE69qe007065; Thu, 21 Jun 2012 07:06:09 -0700 (PDT) (envelope-from sgk) Date: Thu, 21 Jun 2012 07:06:09 -0700 From: Steve Kargl To: Christian Brueffer Message-ID: <20120621140609.GA7051@troutmask.apl.washington.edu> References: <201204221818.q3MIIn4Y051313@svn.freebsd.org> <20120422184553.GA85374@troutmask.apl.washington.edu> <4FE2DF35.5040804@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FE2DF35.5040804@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r234577 - head/usr.bin/stat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 14:06:15 -0000 On Thu, Jun 21, 2012 at 10:45:41AM +0200, Christian Brueffer wrote: > On 4/22/12 20:45 , Steve Kargl wrote: > >On Sun, Apr 22, 2012 at 06:18:49PM +0000, Christian Brueffer wrote: > >>Author: brueffer > >>Date: Sun Apr 22 18:18:49 2012 > >>New Revision: 234577 > >>URL: http://svn.freebsd.org/changeset/base/234577 > >> > >>Log: > >> Remove duplicate -l description. > >> > >> Submitted by: Rainer Hurling > >> MFC after: 1 week > > > >The patch should have also fixed the misordering > >of the -n, -qi, and -x options. > > > > Hi Steve, > > sorry for the late reply. Could you say more specifically how you > would arrange the order? From a small sampling of our manpages, it > seems we don't have "one true" style of ordering options (except from > alphabetically, see attached patch). > > Some manpages order A-Z, then a-z, while others (Apple and OpenBSD seem > to do this) order AaBb...Zz. > Upon further inspection, the order of the description of the options follows the order of the option in the SYNOPSIS. I suppose the manpage is fine. -- Steve From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 14:35:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82AB310656B8; Thu, 21 Jun 2012 14:35:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DEA48FC17; Thu, 21 Jun 2012 14:35:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LEZl2G018407; Thu, 21 Jun 2012 14:35:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LEZlKS018405; Thu, 21 Jun 2012 14:35:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206211435.q5LEZlKS018405@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Jun 2012 14:35:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237398 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 14:35:47 -0000 Author: mav Date: Thu Jun 21 14:35:46 2012 New Revision: 237398 URL: http://svn.freebsd.org/changeset/base/237398 Log: In camisr() clear CAM_SIM_ON_DONEQ flag after camisr_runqueue() purged SIM done queue. Clearing it before caused extra SIM queueing in some cases. It was invisible during normal operation, but during USB device unplug and respective SIM destruction it could keep pointer on SIM without having counted reference and as result crash the system by use afer free. Reported by: hselasky MFC after: 1 week Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Jun 21 13:53:28 2012 (r237397) +++ head/sys/cam/cam_xpt.c Thu Jun 21 14:35:46 2012 (r237398) @@ -5005,8 +5005,8 @@ camisr(void *dummy) while ((sim = TAILQ_FIRST(&queue)) != NULL) { TAILQ_REMOVE(&queue, sim, links); CAM_SIM_LOCK(sim); - sim->flags &= ~CAM_SIM_ON_DONEQ; camisr_runqueue(&sim->sim_doneq); + sim->flags &= ~CAM_SIM_ON_DONEQ; CAM_SIM_UNLOCK(sim); } mtx_lock(&cam_simq_lock); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 14:55:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B719210657A2; Thu, 21 Jun 2012 14:55:35 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 973D78FC1A; Thu, 21 Jun 2012 14:55:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LEtZTN019444; Thu, 21 Jun 2012 14:55:35 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LEtZOD019442; Thu, 21 Jun 2012 14:55:35 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201206211455.q5LEtZOD019442@svn.freebsd.org> From: Fabien Thomas Date: Thu, 21 Jun 2012 14:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237400 - stable/8/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 14:55:35 -0000 Author: fabient Date: Thu Jun 21 14:55:35 2012 New Revision: 237400 URL: http://svn.freebsd.org/changeset/base/237400 Log: MFC r221839: Allow direct children of PCI-ISA bridges to allocate resources from the parent PCI bus. Heavily inspired by jhb@ and a similar implementation present in sys/dev/pci/vga_pci.c. Modified: stable/8/sys/dev/pci/isa_pci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/pci/isa_pci.c ============================================================================== --- stable/8/sys/dev/pci/isa_pci.c Thu Jun 21 14:37:05 2012 (r237399) +++ stable/8/sys/dev/pci/isa_pci.c Thu Jun 21 14:55:35 2012 (r237400) @@ -45,12 +45,22 @@ __FBSDID("$FreeBSD$"); #include #include -static int isab_probe(device_t dev); +#include +#include +#include + +static int isab_pci_probe(device_t dev); +static int isab_pci_attach(device_t dev); +static struct resource * isab_pci_alloc_resource(device_t dev, + device_t child, int type, int *rid, u_long start, u_long end, u_long count, + u_int flags); +static int isab_pci_release_resource(device_t dev, device_t child, + int type, int rid, struct resource *r); static device_method_t isab_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, isab_probe), - DEVMETHOD(device_attach, isab_attach), + DEVMETHOD(device_probe, isab_pci_probe), + DEVMETHOD(device_attach, isab_pci_attach), DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), @@ -58,8 +68,8 @@ static device_method_t isab_methods[] = /* Bus interface */ DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_alloc_resource, isab_pci_alloc_resource), + DEVMETHOD(bus_release_resource, isab_pci_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), @@ -68,10 +78,19 @@ static device_method_t isab_methods[] = DEVMETHOD_END }; +struct isab_pci_resource { + struct resource *ip_res; + int ip_refs; +}; + +struct isab_pci_softc { + struct isab_pci_resource isab_pci_res[PCIR_MAX_BAR_0 + 1]; +}; + static driver_t isab_driver = { "isab", isab_methods, - 0, + sizeof(struct isab_pci_softc), }; DRIVER_MODULE(isab, pci, isab_driver, isab_devclass, 0, 0); @@ -81,7 +100,7 @@ DRIVER_MODULE(isab, pci, isab_driver, is * report themselves. */ static int -isab_probe(device_t dev) +isab_pci_probe(device_t dev) { int matched = 0; @@ -139,3 +158,88 @@ isab_probe(device_t dev) } return(ENXIO); } + +static int +isab_pci_attach(device_t dev) +{ + + bus_generic_probe(dev); + return (isab_attach(dev)); +} + +static struct resource * +isab_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + struct isab_pci_softc *sc; + int bar; + + if (device_get_parent(child) != dev) + return bus_generic_alloc_resource(dev, child, type, rid, start, + end, count, flags); + + switch (type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + /* + * For BARs, we cache the resource so that we only allocate it + * from the PCI bus once. + */ + bar = PCI_RID2BAR(*rid); + if (bar < 0 || bar > PCIR_MAX_BAR_0) + return (NULL); + sc = device_get_softc(dev); + if (sc->isab_pci_res[bar].ip_res == NULL) + sc->isab_pci_res[bar].ip_res = bus_alloc_resource(dev, type, + rid, start, end, count, flags); + if (sc->isab_pci_res[bar].ip_res != NULL) + sc->isab_pci_res[bar].ip_refs++; + return (sc->isab_pci_res[bar].ip_res); + } + + return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, + start, end, count, flags)); +} + +static int +isab_pci_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + struct isab_pci_softc *sc; + int bar, error; + + if (device_get_parent(child) != dev) + return bus_generic_release_resource(dev, child, type, rid, r); + + switch (type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + /* + * For BARs, we release the resource from the PCI bus + * when the last child reference goes away. + */ + bar = PCI_RID2BAR(rid); + if (bar < 0 || bar > PCIR_MAX_BAR_0) + return (EINVAL); + sc = device_get_softc(dev); + if (sc->isab_pci_res[bar].ip_res == NULL) + return (EINVAL); + KASSERT(sc->isab_pci_res[bar].ip_res == r, + ("isa_pci resource mismatch")); + if (sc->isab_pci_res[bar].ip_refs > 1) { + sc->isab_pci_res[bar].ip_refs--; + return (0); + } + KASSERT(sc->isab_pci_res[bar].ip_refs > 0, + ("isa_pci resource reference count underflow")); + error = bus_release_resource(dev, type, rid, r); + if (error == 0) { + sc->isab_pci_res[bar].ip_res = NULL; + sc->isab_pci_res[bar].ip_refs = 0; + } + return (error); + } + + return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, type, + rid, r)); +} From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 15:14:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE26D106564A; Thu, 21 Jun 2012 15:14:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B90238FC15; Thu, 21 Jun 2012 15:14:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LFEpX4020274; Thu, 21 Jun 2012 15:14:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LFEpIv020272; Thu, 21 Jun 2012 15:14:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206211514.q5LFEpIv020272@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Jun 2012 15:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237401 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 15:14:51 -0000 Author: mav Date: Thu Jun 21 15:14:51 2012 New Revision: 237401 URL: http://svn.freebsd.org/changeset/base/237401 Log: Make cam_periph_hold() behavior consistent: drop taken reference and return ENXIO if periph was invalidated while we were waiting for it. MFC after: 1 week Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Thu Jun 21 14:55:35 2012 (r237400) +++ head/sys/cam/cam_periph.c Thu Jun 21 15:14:51 2012 (r237401) @@ -440,6 +440,10 @@ cam_periph_hold(struct cam_periph *perip cam_periph_release_locked(periph); return (error); } + if (periph->flags & CAM_PERIPH_INVALID) { + cam_periph_release_locked(periph); + return (ENXIO); + } } periph->flags |= CAM_PERIPH_LOCKED; From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 15:47:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F0BC1065676; Thu, 21 Jun 2012 15:47:06 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8991F8FC14; Thu, 21 Jun 2012 15:47:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LFl61J021832; Thu, 21 Jun 2012 15:47:06 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LFl6xS021830; Thu, 21 Jun 2012 15:47:06 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201206211547.q5LFl6xS021830@svn.freebsd.org> From: "David E. O'Brien" Date: Thu, 21 Jun 2012 15:47:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237402 - head/lib/libc/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 15:47:06 -0000 Author: obrien Date: Thu Jun 21 15:47:06 2012 New Revision: 237402 URL: http://svn.freebsd.org/changeset/base/237402 Log: Be explicit about the dependency on nsparser.h. Modified: head/lib/libc/net/Makefile.inc Modified: head/lib/libc/net/Makefile.inc ============================================================================== --- head/lib/libc/net/Makefile.inc Thu Jun 21 15:14:51 2012 (r237401) +++ head/lib/libc/net/Makefile.inc Thu Jun 21 15:47:06 2012 (r237402) @@ -36,7 +36,7 @@ LFLAGS+=-P_nsyy CLEANFILES+=nslexer.c -nslexer.c: nslexer.l +nslexer.c: nslexer.l nsparser.h ${LEX} ${LFLAGS} -o/dev/stdout ${.IMPSRC} | \ sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET} From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 16:37:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F120F106566B; Thu, 21 Jun 2012 16:37:36 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC1698FC14; Thu, 21 Jun 2012 16:37:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LGba4a024343; Thu, 21 Jun 2012 16:37:36 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LGbaAN024340; Thu, 21 Jun 2012 16:37:36 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206211637.q5LGbaAN024340@svn.freebsd.org> From: Alan Cox Date: Thu, 21 Jun 2012 16:37:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237404 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 16:37:37 -0000 Author: alc Date: Thu Jun 21 16:37:36 2012 New Revision: 237404 URL: http://svn.freebsd.org/changeset/base/237404 Log: Update the PV stats in free_pv_entry() using atomics. After which, it is no longer necessary for free_pv_entry() to be serialized by the pvh global lock. Retire pmap_insert_entry() and pmap_remove_entry(). Once upon a time, these functions were called from multiple places within the pmap. Now, each has only one caller. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Jun 21 16:21:31 2012 (r237403) +++ head/sys/amd64/amd64/pmap.c Thu Jun 21 16:37:36 2012 (r237404) @@ -275,9 +275,6 @@ static int pmap_remove_pte(pmap_t pmap, static void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte); static void pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, vm_page_t *free); -static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, - vm_offset_t va); -static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m, struct rwlock **lockp); static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, @@ -2207,10 +2204,10 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv struct pv_chunk *pc; int idx, field, bit; - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - PV_STAT(pv_entry_frees++); - PV_STAT(pv_entry_spare++); + PV_STAT(atomic_add_long(&pv_entry_frees, 1)); + PV_STAT(atomic_add_int(&pv_entry_spare, 1)); PV_STAT(atomic_subtract_long(&pv_entry_count, 1)); pc = pv_to_chunk(pv); idx = pv - &pc->pc_pventry[0]; @@ -2372,7 +2369,9 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_pv_demote_pde: page %p is not managed", m)); va += PAGE_SIZE; - pmap_insert_entry(pmap, va, m); + pv = get_pv_entry(pmap, FALSE); + pv->pv_va = va; + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); } while (va < va_last); } @@ -2430,36 +2429,6 @@ pmap_pvh_free(struct md_page *pvh, pmap_ free_pv_entry(pmap, pv); } -static void -pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) -{ - struct md_page *pvh; - - rw_assert(&pvh_global_lock, RA_WLOCKED); - pmap_pvh_free(&m->md, pmap, va); - if (TAILQ_EMPTY(&m->md.pv_list) && (m->flags & PG_FICTITIOUS) == 0) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_aflag_clear(m, PGA_WRITEABLE); - } -} - -/* - * Create a pv entry for page at pa for - * (pmap, va). - */ -static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) -{ - pv_entry_t pv; - - rw_assert(&pvh_global_lock, RA_WLOCKED); - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - pv = get_pv_entry(pmap, FALSE); - pv->pv_va = va; - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); -} - /* * Conditionally create a pv entry. */ @@ -2711,6 +2680,7 @@ static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va, pd_entry_t ptepde, vm_page_t *free) { + struct md_page *pvh; pt_entry_t oldpte; vm_page_t m; @@ -2725,7 +2695,13 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t vm_page_dirty(m); if (oldpte & PG_A) vm_page_aflag_set(m, PGA_REFERENCED); - pmap_remove_entry(pmap, m, va); + pmap_pvh_free(&m->md, pmap, va); + if (TAILQ_EMPTY(&m->md.pv_list) && + (m->flags & PG_FICTITIOUS) == 0) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + if (TAILQ_EMPTY(&pvh->pv_list)) + vm_page_aflag_clear(m, PGA_WRITEABLE); + } } return (pmap_unuse_pt(pmap, va, ptepde, free)); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 16:37:37 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61B78106566C; Thu, 21 Jun 2012 16:37:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id DBA608FC12; Thu, 21 Jun 2012 16:37:36 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5LGbWnU006182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 22 Jun 2012 02:37:35 +1000 Date: Fri, 22 Jun 2012 02:37:32 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Steve Kargl In-Reply-To: <20120621140609.GA7051@troutmask.apl.washington.edu> Message-ID: <20120622021805.H3133@besplex.bde.org> References: <201204221818.q3MIIn4Y051313@svn.freebsd.org> <20120422184553.GA85374@troutmask.apl.washington.edu> <4FE2DF35.5040804@FreeBSD.org> <20120621140609.GA7051@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Christian Brueffer Subject: Re: svn commit: r234577 - head/usr.bin/stat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 16:37:37 -0000 On Thu, 21 Jun 2012, Steve Kargl wrote: > On Thu, Jun 21, 2012 at 10:45:41AM +0200, Christian Brueffer wrote: >> On 4/22/12 20:45 , Steve Kargl wrote: >>> On Sun, Apr 22, 2012 at 06:18:49PM +0000, Christian Brueffer wrote: >>>> Author: brueffer >>>> Date: Sun Apr 22 18:18:49 2012 >>>> New Revision: 234577 >>>> URL: http://svn.freebsd.org/changeset/base/234577 >>>> >>>> Log: >>>> Remove duplicate -l description. >>>> >>>> Submitted by: Rainer Hurling >>>> MFC after: 1 week >>> >>> The patch should have also fixed the misordering >>> of the -n, -qi, and -x options. >> >> sorry for the late reply. Could you say more specifically how you >> would arrange the order? From a small sampling of our manpages, it >> seems we don't have "one true" style of ordering options (except from >> alphabetically, see attached patch). >> >> Some manpages order A-Z, then a-z, while others (Apple and OpenBSD seem >> to do this) order AaBb...Zz. I think the latter is more common and correct for FreeBSD too. ps uses it. But ls uses A-Za-z0-9. > Upon further inspection, the order of the description of the > options follows the order of the option in the SYNOPSIS. I > suppose the manpage is fine. No, SYNOPSEs (and usage) normally put options with parameters last. DESCRIPTIONs of options shouldn't do that. For ls, there is only 1 option with a parameter (-D). This is sorted into A-Z in the DESCRIPTION section. For ps, there are many options with parameters. These used to be sorted after the ones without args in the SYNOPSEs, but -O and -o are now unsorted before all other options with parameters. The DESCRIPTION section in ps used to be sorted, but -c was added out of order. stat(1) has a sorted SYNOPSIS, with complications for -f that require grouping it with options that don't take pararmeters. These complications affect the DESCRIPTION section too much. Man pages like chmod(1) don't unsort the DESCRIPTION section for similar things (the SYNOPSIS says [-R [-H | -L | -P][, but the DESCRIPTION uses alphabetical ordering for -HLPR. Bruce From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 16:48:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F593106564A; Thu, 21 Jun 2012 16:48:57 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2002E8FC08; Thu, 21 Jun 2012 16:48:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LGmukC024850; Thu, 21 Jun 2012 16:48:56 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LGmuhg024848; Thu, 21 Jun 2012 16:48:56 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206211648.q5LGmuhg024848@svn.freebsd.org> From: Mitsuru IWASAKI Date: Thu, 21 Jun 2012 16:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237405 - stable/9/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 16:48:57 -0000 Author: iwasaki Date: Thu Jun 21 16:48:56 2012 New Revision: 237405 URL: http://svn.freebsd.org/changeset/base/237405 Log: MFC r237197: - Resotre LCD brightness level on resuming. Modified: stable/9/sys/dev/acpica/acpi_video.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_video.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_video.c Thu Jun 21 16:37:36 2012 (r237404) +++ stable/9/sys/dev/acpica/acpi_video.c Thu Jun 21 16:48:56 2012 (r237405) @@ -75,6 +75,7 @@ static void acpi_video_identify(driver_t static int acpi_video_probe(device_t); static int acpi_video_attach(device_t); static int acpi_video_detach(device_t); +static int acpi_video_resume(device_t); static int acpi_video_shutdown(device_t); static void acpi_video_notify_handler(ACPI_HANDLE, UINT32, void *); static void acpi_video_power_profile(void *); @@ -155,6 +156,7 @@ static device_method_t acpi_video_method DEVMETHOD(device_probe, acpi_video_probe), DEVMETHOD(device_attach, acpi_video_attach), DEVMETHOD(device_detach, acpi_video_detach), + DEVMETHOD(device_resume, acpi_video_resume), DEVMETHOD(device_shutdown, acpi_video_shutdown), { 0, 0 } }; @@ -305,6 +307,36 @@ acpi_video_detach(device_t dev) } static int +acpi_video_resume(device_t dev) +{ + struct acpi_video_softc *sc; + struct acpi_video_output *vo, *vn; + int level; + + sc = device_get_softc(dev); + + /* Restore brightness level */ + ACPI_SERIAL_BEGIN(video); + ACPI_SERIAL_BEGIN(video_output); + STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vn) { + if ((vo->adr & DOD_DEVID_MASK_FULL) != DOD_DEVID_LCD && + (vo->adr & DOD_DEVID_MASK) != DOD_DEVID_INTDFP) + continue; + + if ((vo_get_device_status(vo->handle) & DCS_ACTIVE) == 0) + continue; + + level = vo_get_brightness(vo->handle); + if (level != -1) + vo_set_brightness(vo->handle, level); + } + ACPI_SERIAL_END(video_output); + ACPI_SERIAL_END(video); + + return (0); +} + +static int acpi_video_shutdown(device_t dev) { struct acpi_video_softc *sc; From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 16:49:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC5FC106591E; Thu, 21 Jun 2012 16:49:20 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC5508FC16; Thu, 21 Jun 2012 16:49:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LGnKYw024911; Thu, 21 Jun 2012 16:49:20 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LGnKrn024904; Thu, 21 Jun 2012 16:49:20 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206211649.q5LGnKrn024904@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 21 Jun 2012 16:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237406 - head/contrib/gcc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 16:49:21 -0000 Author: pfg Date: Thu Jun 21 16:49:20 2012 New Revision: 237406 URL: http://svn.freebsd.org/changeset/base/237406 Log: Bring a couple of fixes for gcc optimizations. The GCC4.3 branch contains some optimization fixes that were not considered regressions and therefore were never backported. We are bringing a couple of them that are under GPLv2 since they were made before the license switch upstream. While here, add the GCC revision numbers in the log. Discussed with: jkim MFC after: 1 week Modified: head/contrib/gcc/ChangeLog.gcc43 head/contrib/gcc/fold-const.c head/contrib/gcc/gimplify.c head/contrib/gcc/tree-ssa-ccp.c head/contrib/gcc/tree-ssa-pre.c Modified: head/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- head/contrib/gcc/ChangeLog.gcc43 Thu Jun 21 16:48:56 2012 (r237405) +++ head/contrib/gcc/ChangeLog.gcc43 Thu Jun 21 16:49:20 2012 (r237406) @@ -5,6 +5,18 @@ with SSE3 instruction set support. * doc/invoke.texi: Likewise. +2007-04-12 Richard Guenther (r123736) + + PR tree-optimization/24689 + PR tree-optimization/31307 + * fold-const.c (operand_equal_p): Compare INTEGER_CST array + indices by value. + * gimplify.c (canonicalize_addr_expr): To be consistent with + gimplify_compound_lval only set operands two and three of + ARRAY_REFs if they are not gimple_min_invariant. This makes + it never at this place. + * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise. + 2007-04-07 H.J. Lu (r123639) * config/i386/i386.c (ix86_handle_option): Handle SSSE3. @@ -96,7 +108,7 @@ * doc/invoke.texi: Add entry about geode processor. -2006-10-24 Richard Guenther +2006-10-24 Richard Guenther (r118001) PR middle-end/28796 * builtins.c (fold_builtin_classify): Use HONOR_INFINITIES @@ -170,7 +182,13 @@ * doc/invoke.texi: Document -mssse3/-mno-ssse3 switches. -2006-10-21 Richard Guenther +2006-10-21 Richard Guenther (r117932) + + PR tree-optimization/3511 + * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that + got new invariant arguments during PHI translation. + +2006-10-21 Richard Guenther (r117929) * builtins.c (fold_builtin_classify): Fix typo. Modified: head/contrib/gcc/fold-const.c ============================================================================== --- head/contrib/gcc/fold-const.c Thu Jun 21 16:48:56 2012 (r237405) +++ head/contrib/gcc/fold-const.c Thu Jun 21 16:49:20 2012 (r237406) @@ -2802,9 +2802,13 @@ operand_equal_p (tree arg0, tree arg1, u case ARRAY_REF: case ARRAY_RANGE_REF: - /* Operands 2 and 3 may be null. */ + /* Operands 2 and 3 may be null. + Compare the array index by value if it is constant first as we + may have different types but same value here. */ return (OP_SAME (0) - && OP_SAME (1) + && (tree_int_cst_equal (TREE_OPERAND (arg0, 1), + TREE_OPERAND (arg1, 1)) + || OP_SAME (1)) && OP_SAME_WITH_NULL (2) && OP_SAME_WITH_NULL (3)); Modified: head/contrib/gcc/gimplify.c ============================================================================== --- head/contrib/gcc/gimplify.c Thu Jun 21 16:48:56 2012 (r237405) +++ head/contrib/gcc/gimplify.c Thu Jun 21 16:49:20 2012 (r237406) @@ -1600,9 +1600,7 @@ canonicalize_addr_expr (tree *expr_p) /* All checks succeeded. Build a new node to merge the cast. */ *expr_p = build4 (ARRAY_REF, dctype, obj_expr, TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (dctype), - size_int (TYPE_ALIGN_UNIT (dctype)))); + NULL_TREE, NULL_TREE); *expr_p = build1 (ADDR_EXPR, ctype, *expr_p); } Modified: head/contrib/gcc/tree-ssa-ccp.c ============================================================================== --- head/contrib/gcc/tree-ssa-ccp.c Thu Jun 21 16:48:56 2012 (r237405) +++ head/contrib/gcc/tree-ssa-ccp.c Thu Jun 21 16:49:20 2012 (r237406) @@ -1621,9 +1621,7 @@ maybe_fold_offset_to_array_ref (tree bas if (!integer_zerop (elt_offset)) idx = int_const_binop (PLUS_EXPR, idx, elt_offset, 0); - return build4 (ARRAY_REF, orig_type, base, idx, min_idx, - size_int (tree_low_cst (elt_size, 1) - / (TYPE_ALIGN_UNIT (elt_type)))); + return build4 (ARRAY_REF, orig_type, base, idx, NULL_TREE, NULL_TREE); } Modified: head/contrib/gcc/tree-ssa-pre.c ============================================================================== --- head/contrib/gcc/tree-ssa-pre.c Thu Jun 21 16:48:56 2012 (r237405) +++ head/contrib/gcc/tree-ssa-pre.c Thu Jun 21 16:49:20 2012 (r237406) @@ -1076,6 +1076,7 @@ phi_translate (tree expr, value_set_t se tree newexpr; tree vh = get_value_handle (expr); bool listchanged = false; + bool invariantarg = false; VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh); VEC (tree, gc) *tvuses; @@ -1134,10 +1135,26 @@ phi_translate (tree expr, value_set_t se if (newval != oldval) { listchanged = true; + invariantarg |= is_gimple_min_invariant (newval); TREE_VALUE (newwalker) = get_value_handle (newval); } } } + + /* In case of new invariant args we might try to fold the call + again. */ + if (invariantarg) + { + tree tmp = fold_ternary (CALL_EXPR, TREE_TYPE (expr), + newop0, newarglist, newop2); + if (tmp) + { + STRIP_TYPE_NOPS (tmp); + if (is_gimple_min_invariant (tmp)) + return tmp; + } + } + if (listchanged) vn_lookup_or_add (newarglist, NULL); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 17:30:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BC791106567D; Thu, 21 Jun 2012 17:30:38 +0000 (UTC) (envelope-from zeising@daemonic.se) Received: from mail.lysator.liu.se (mail.lysator.liu.se [IPv6:2001:6b0:17:f0a0::3]) by mx1.freebsd.org (Postfix) with ESMTP id 2A7468FC17; Thu, 21 Jun 2012 17:30:38 +0000 (UTC) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 6051040005; Thu, 21 Jun 2012 19:30:37 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 4FBE240007; Thu, 21 Jun 2012 19:30:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.3.1 X-Spam-Score: 0.0 Received: from mx.daemonic.se (mx.daemonic.se [IPv6:2001:470:dca9:0:1::3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 90E5F40005; Thu, 21 Jun 2012 19:30:36 +0200 (CEST) Received: from mailscanner.daemonic.se (mailscanner.daemonic.se [IPv6:2001:470:dca9:0:1::6]) by mx.daemonic.se (Postfix) with ESMTPS id 3WJ90j48smz8ggx; Thu, 21 Jun 2012 19:30:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at daemonic.se Received: from mx.daemonic.se ([10.1.0.3]) (using TLS with cipher CAMELLIA256-SHA) by mailscanner.daemonic.se (mailscanner.daemonic.se [10.1.0.6]) (amavisd-new, port 10025) with ESMTPS id 4xGcQtFjUFBn; Thu, 21 Jun 2012 19:30:26 +0200 (CEST) Received: from mail.daemonic.se (mail.daemonic.se [IPv6:2001:470:dca9:0:1::4]) by mx.daemonic.se (Postfix) with ESMTPS id 3WJ90f4GCmz8ggv; Thu, 21 Jun 2012 19:30:26 +0200 (CEST) Received: from tifa.daemonic.se (tifa.daemonic.se [10.32.0.6]) by mail.daemonic.se (Postfix) with ESMTPSA id 3WJ90f3gZdz9Ctq; Thu, 21 Jun 2012 19:30:26 +0200 (CEST) Received: from tifa.daemonic.se (localhost [IPv6:::1]) by tifa.daemonic.se (Postfix) with ESMTP id 5D23E22AC3; Thu, 21 Jun 2012 19:30:18 +0200 (CEST) Message-ID: <4FE35A2A.3030408@daemonic.se> Date: Thu, 21 Jun 2012 19:30:18 +0200 From: Niclas Zeising User-Agent: Mutt/1.5.21 MIME-Version: 1.0 To: "Pedro F. Giffuni" References: <201206211649.q5LGnKrn024904@svn.freebsd.org> In-Reply-To: <201206211649.q5LGnKrn024904@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237406 - head/contrib/gcc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 17:30:38 -0000 On 06/21/12 18:49, Pedro F. Giffuni wrote: > Author: pfg > Date: Thu Jun 21 16:49:20 2012 > New Revision: 237406 > URL: http://svn.freebsd.org/changeset/base/237406 > > Log: > Bring a couple of fixes for gcc optimizations. > > The GCC4.3 branch contains some optimization fixes > that were not considered regressions and therefore > were never backported. We are bringing a couple of > them that are under GPLv2 since they were made > before the license switch upstream. > > While here, add the GCC revision numbers in the > log. > > Discussed with: jkim > MFC after: 1 week > > Modified: > head/contrib/gcc/ChangeLog.gcc43 > head/contrib/gcc/fold-const.c > head/contrib/gcc/gimplify.c > head/contrib/gcc/tree-ssa-ccp.c > head/contrib/gcc/tree-ssa-pre.c > > Modified: head/contrib/gcc/ChangeLog.gcc43 > ============================================================================== > --- head/contrib/gcc/ChangeLog.gcc43 Thu Jun 21 16:48:56 2012 (r237405) > +++ head/contrib/gcc/ChangeLog.gcc43 Thu Jun 21 16:49:20 2012 (r237406) > @@ -5,6 +5,18 @@ > with SSE3 instruction set support. > * doc/invoke.texi: Likewise. > > +2007-04-12 Richard Guenther (r123736) > + > + PR tree-optimization/24689 > + PR tree-optimization/31307 > + * fold-const.c (operand_equal_p): Compare INTEGER_CST array > + indices by value. > + * gimplify.c (canonicalize_addr_expr): To be consistent with > + gimplify_compound_lval only set operands two and three of > + ARRAY_REFs if they are not gimple_min_invariant. This makes > + it never at this place. > + * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise. > + > 2007-04-07 H.J. Lu (r123639) > > * config/i386/i386.c (ix86_handle_option): Handle SSSE3. > @@ -96,7 +108,7 @@ > > * doc/invoke.texi: Add entry about geode processor. > > -2006-10-24 Richard Guenther > +2006-10-24 Richard Guenther (r118001) > > PR middle-end/28796 > * builtins.c (fold_builtin_classify): Use HONOR_INFINITIES > @@ -170,7 +182,13 @@ > > * doc/invoke.texi: Document -mssse3/-mno-ssse3 switches. > > -2006-10-21 Richard Guenther > +2006-10-21 Richard Guenther (r117932) > + > + PR tree-optimization/3511 > + * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that > + got new invariant arguments during PHI translation. > + > +2006-10-21 Richard Guenther (r117929) > > * builtins.c (fold_builtin_classify): Fix typo. > > > Modified: head/contrib/gcc/fold-const.c > ============================================================================== > --- head/contrib/gcc/fold-const.c Thu Jun 21 16:48:56 2012 (r237405) > +++ head/contrib/gcc/fold-const.c Thu Jun 21 16:49:20 2012 (r237406) > @@ -2802,9 +2802,13 @@ operand_equal_p (tree arg0, tree arg1, u > > case ARRAY_REF: > case ARRAY_RANGE_REF: > - /* Operands 2 and 3 may be null. */ > + /* Operands 2 and 3 may be null. > + Compare the array index by value if it is constant first as we > + may have different types but same value here. */ > return (OP_SAME (0) > - && OP_SAME (1) > + && (tree_int_cst_equal (TREE_OPERAND (arg0, 1), > + TREE_OPERAND (arg1, 1)) > + || OP_SAME (1)) > && OP_SAME_WITH_NULL (2) > && OP_SAME_WITH_NULL (3)); > > > Modified: head/contrib/gcc/gimplify.c > ============================================================================== > --- head/contrib/gcc/gimplify.c Thu Jun 21 16:48:56 2012 (r237405) > +++ head/contrib/gcc/gimplify.c Thu Jun 21 16:49:20 2012 (r237406) > @@ -1600,9 +1600,7 @@ canonicalize_addr_expr (tree *expr_p) > /* All checks succeeded. Build a new node to merge the cast. */ > *expr_p = build4 (ARRAY_REF, dctype, obj_expr, > TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), > - TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), > - size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (dctype), > - size_int (TYPE_ALIGN_UNIT (dctype)))); > + NULL_TREE, NULL_TREE); > *expr_p = build1 (ADDR_EXPR, ctype, *expr_p); > } > > > Modified: head/contrib/gcc/tree-ssa-ccp.c > ============================================================================== > --- head/contrib/gcc/tree-ssa-ccp.c Thu Jun 21 16:48:56 2012 (r237405) > +++ head/contrib/gcc/tree-ssa-ccp.c Thu Jun 21 16:49:20 2012 (r237406) > @@ -1621,9 +1621,7 @@ maybe_fold_offset_to_array_ref (tree bas > if (!integer_zerop (elt_offset)) > idx = int_const_binop (PLUS_EXPR, idx, elt_offset, 0); > > - return build4 (ARRAY_REF, orig_type, base, idx, min_idx, > - size_int (tree_low_cst (elt_size, 1) > - / (TYPE_ALIGN_UNIT (elt_type)))); > + return build4 (ARRAY_REF, orig_type, base, idx, NULL_TREE, NULL_TREE); > } > > > > Modified: head/contrib/gcc/tree-ssa-pre.c > ============================================================================== > --- head/contrib/gcc/tree-ssa-pre.c Thu Jun 21 16:48:56 2012 (r237405) > +++ head/contrib/gcc/tree-ssa-pre.c Thu Jun 21 16:49:20 2012 (r237406) > @@ -1076,6 +1076,7 @@ phi_translate (tree expr, value_set_t se > tree newexpr; > tree vh = get_value_handle (expr); > bool listchanged = false; > + bool invariantarg = false; > VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh); > VEC (tree, gc) *tvuses; > > @@ -1134,10 +1135,26 @@ phi_translate (tree expr, value_set_t se > if (newval != oldval) > { > listchanged = true; > + invariantarg |= is_gimple_min_invariant (newval); > TREE_VALUE (newwalker) = get_value_handle (newval); > } > } > } > + > + /* In case of new invariant args we might try to fold the call > + again. */ > + if (invariantarg) > + { > + tree tmp = fold_ternary (CALL_EXPR, TREE_TYPE (expr), > + newop0, newarglist, newop2); > + if (tmp) > + { > + STRIP_TYPE_NOPS (tmp); > + if (is_gimple_min_invariant (tmp)) > + return tmp; > + } > + } > + > if (listchanged) > vn_lookup_or_add (newarglist, NULL); > Could this fix the issues with mozilla ports not compiling on -O2? I will test later, but I'm just checking if you have any insight... Regards! -- Niclas Zeising From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 18:22:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50961106564A; Thu, 21 Jun 2012 18:22:51 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22C268FC14; Thu, 21 Jun 2012 18:22:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LIMoHB028957; Thu, 21 Jun 2012 18:22:50 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LIMoKs028955; Thu, 21 Jun 2012 18:22:50 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206211822.q5LIMoKs028955@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 21 Jun 2012 18:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237408 - vendor-sys/acpica/dist/source/compiler X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 18:22:51 -0000 Author: jkim Date: Thu Jun 21 18:22:50 2012 New Revision: 237408 URL: http://svn.freebsd.org/changeset/base/237408 Log: Fix "comparison is always true due to limited range of data type" warning from GCC in the base system. Note this patch was submitted upstream and it will appear in the next ACPICA release. Discussed with: Moore, Robert (robert dot moore at intel dot com) Modified: vendor-sys/acpica/dist/source/compiler/aslsupport.l Modified: vendor-sys/acpica/dist/source/compiler/aslsupport.l ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslsupport.l Thu Jun 21 16:53:52 2012 (r237407) +++ vendor-sys/acpica/dist/source/compiler/aslsupport.l Thu Jun 21 18:22:50 2012 (r237408) @@ -92,7 +92,7 @@ static void AslDoLineDirective ( void) { - UINT8 c; + int c; char *Token; UINT32 LineNumber; char *Filename; @@ -103,7 +103,7 @@ AslDoLineDirective ( Gbl_LineBufPtr = Gbl_CurrentLineBuffer; - while ((c = (UINT8) input()) != '\n' && c != EOF) + while ((c = input()) != '\n' && c != EOF) { *Gbl_LineBufPtr = c; Gbl_LineBufPtr++; @@ -430,8 +430,8 @@ static char AslDoComment ( void) { - char c; - char c1 = 0; + int c; + int c1 = 0; AslInsertLineBuffer ('/'); @@ -441,7 +441,7 @@ loop: /* Eat chars until end-of-comment */ - while ((c = (char) input()) != '*' && c != EOF) + while ((c = input()) != '*' && c != EOF) { AslInsertLineBuffer (c); c1 = c; @@ -468,7 +468,7 @@ loop: AslInsertLineBuffer (c); - if ((c1 = (char) input()) != '/' && c1 != EOF) + if ((c1 = input()) != '/' && c1 != EOF) { unput(c1); goto loop; @@ -511,13 +511,13 @@ static char AslDoCommentType2 ( void) { - char c; + int c; AslInsertLineBuffer ('/'); AslInsertLineBuffer ('/'); - while ((c = (char) input()) != '\n' && c != EOF) + while ((c = input()) != '\n' && c != EOF) { AslInsertLineBuffer (c); } @@ -553,7 +553,7 @@ AslDoStringLiteral ( char *StringBuffer = MsgBuffer; char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; char *CleanString; - char StringChar; + int StringChar; UINT32 State = ASL_NORMAL_CHAR; UINT32 i = 0; UINT8 Digit; @@ -566,7 +566,7 @@ AslDoStringLiteral ( * source line buffer. */ AslInsertLineBuffer ('\"'); - while ((StringChar = (char) input()) != EOF) + while ((StringChar = input()) != EOF) { AslInsertLineBuffer (StringChar); From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 18:28:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA7B21065792; Thu, 21 Jun 2012 18:28:48 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5B778FC18; Thu, 21 Jun 2012 18:28:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LISm5J029244; Thu, 21 Jun 2012 18:28:48 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LISmkZ029242; Thu, 21 Jun 2012 18:28:48 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201206211828.q5LISmkZ029242@svn.freebsd.org> From: Isabell Long Date: Thu, 21 Jun 2012 18:28:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237409 - head/lib/libc/string X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 18:28:49 -0000 Author: issyl0 (doc committer) Date: Thu Jun 21 18:28:48 2012 New Revision: 237409 URL: http://svn.freebsd.org/changeset/base/237409 Log: Add the functions documented in the man pages in commit 237393 to the relevant Makefile. Reminded by: gavin Approved by: gabor (mentor) MFC after: 5 days Modified: head/lib/libc/string/Makefile.inc Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Thu Jun 21 18:22:50 2012 (r237408) +++ head/lib/libc/string/Makefile.inc Thu Jun 21 18:28:48 2012 (r237409) @@ -42,10 +42,13 @@ MLINKS+=ffs.3 ffsl.3 \ ffs.3 flsll.3 MLINKS+=index.3 rindex.3 MLINKS+=memchr.3 memrchr.3 -MLINKS+=strcasecmp.3 strncasecmp.3 +MLINKS+=strcasecmp.3 strncasecmp.3 \ + strcasecmp.3 strcasecmp_l.3 \ + strcasecmp.3 strncasecmp_l.3 MLINKS+=strcat.3 strncat.3 MLINKS+=strchr.3 strrchr.3 MLINKS+=strcmp.3 strncmp.3 +MLINKS+=strcoll.3 strcoll_l.3 MLINKS+=strcpy.3 stpcpy.3 \ strcpy.3 stpncpy.3 \ strcpy.3 strncpy.3 @@ -57,8 +60,10 @@ MLINKS+=strerror.3 perror.3 \ MLINKS+=strlcpy.3 strlcat.3 MLINKS+=strlen.3 strnlen.3 MLINKS+=strstr.3 strcasestr.3 \ - strstr.3 strnstr.3 + strstr.3 strnstr.3 \ + strstr.3 strcasestr_l.3 MLINKS+=strtok.3 strtok_r.3 +MLINKS+=strxfrm.3 strxfrm_l.3 MLINKS+=wmemchr.3 wcpcpy.3 \ wmemchr.3 wcpncpy.3 \ wmemchr.3 wcscasecmp.3 \ From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 18:29:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A5D31065675 for ; Thu, 21 Jun 2012 18:29:26 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm30-vm0.bullet.mail.sp2.yahoo.com (nm30-vm0.bullet.mail.sp2.yahoo.com [98.139.91.238]) by mx1.freebsd.org (Postfix) with SMTP id 545FE8FC16 for ; Thu, 21 Jun 2012 18:29:26 +0000 (UTC) Received: from [98.139.91.68] by nm30.bullet.mail.sp2.yahoo.com with NNFMP; 21 Jun 2012 18:29:26 -0000 Received: from [98.139.91.34] by tm8.bullet.mail.sp2.yahoo.com with NNFMP; 21 Jun 2012 18:28:26 -0000 Received: from [127.0.0.1] by omp1034.mail.sp2.yahoo.com with NNFMP; 21 Jun 2012 18:28:26 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 142087.86117.bm@omp1034.mail.sp2.yahoo.com Received: (qmail 16694 invoked by uid 60001); 21 Jun 2012 18:28:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1340303305; bh=dObkysRk/SmHjn82ZGuXKgJHS1Nl7JtC/s8tO9CFbIQ=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=eja3ITSrU/syQqB9xEz7xw/W5w4DgXUUTq4s+mCCTUzzbRgLlitiRfaJre1vpKtIvKkNkl1PNyTInbcPjsUvAySW35vXwt8bZEvqwaW64VDZXCWY2AWAx5qsr1I+VCxdSjU4Q8y8ttWiUJ8/EI/FGqc9GrrHe29CF7cU/bUs0WQ= X-YMail-OSG: NirYMaQVM1n0N3qzRhcmubxgXi4li_8lfczU_AUjH0P1H.e WV0rwu1vrRbUO1LmjFmqPY.3.rTmvhEieQXilLMQmSPkesAJHcojsfeEq9wm vwNkTjapR7ar8KcPiYS_PZr2nE3qY_AOHR_iITeqmv9Dh0kARBA32HP7q0Z5 Oe67KW8Ft0kAA7ftWplx0zoVuK3tz7xWTlcfiDDSuE4aLnftc6sdqrap096L e2snArIPu.9RWRqDukIImpoAbxnkgiy3LXtA0hR80m5jShAH2dLwXMPxLVrm oVMqc1JL1.l65wEFOtEtYuXRVnTn6zlAge1VqWgGN.PZV1EQ4uTxxfZmfPZl n6C8y5U78kakFGP9Gg7Fi0G6PSY5JWrKZK13.41dwmdU2L91vB6.L4I8ZqVv fQyHiPY8bGA_t_tE8lwgkxD8.RdGxhqgpoMeb5p3kH_pXQv8qDmHpgGS24rB FLq6bSUAWp_aMBLu.r9dxTDlqOfXpZQFtpFUfa6jiM0aMmzLq0XEPbLwYQ2f ZQw3q0RBK5I9lWy_rzXWltbXPyJ.amsf1Ug-- Received: from [200.118.157.7] by web113501.mail.gq1.yahoo.com via HTTP; Thu, 21 Jun 2012 11:28:25 PDT X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.8 YahooMailWebService/0.8.118.349524 Message-ID: <1340303305.15705.YahooMailClassic@web113501.mail.gq1.yahoo.com> Date: Thu, 21 Jun 2012 11:28:25 -0700 (PDT) From: Pedro Giffuni To: Niclas Zeising In-Reply-To: <4FE35A2A.3030408@daemonic.se> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237406 - head/contrib/gcc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 18:29:26 -0000 Hi Niclas;=0A=0A--- Gio 21/6/12, Niclas Zeising ha sc= ritto:=0A=0A> On 06/21/12 18:49, Pedro F. Giffuni wrote:=0A> > Author: pfg= =0A> > Date: Thu Jun 21 16:49:20 2012=0A> > New Revision: 237406=0A> > URL:= http://svn.freebsd.org/changeset/base/237406=0A> >=0A> > Log:=0A> >=A0 =A0= Bring a couple of fixes for gcc=0A> optimizations.=0A> >=0A> >=A0 =A0 The = GCC4.3 branch contains some optimization fixes=0A> >=A0 =A0 that were not c= onsidered regressions and therefore=0A> >=A0 =A0 were never backported. We = are bringing a couple of=0A> >=A0 =A0 them that are under GPLv2 since they = were made=0A> >=A0 =A0 before the license switch upstream.=0A> >=0A...=0A> = =0A> Could this fix the issues with mozilla ports not compiling=0A> on -O2?= =0A=0A=0AI don't think so :(.=0A=0AThese are issues that would generate non= -optimal code=0Abut will not fix anything that doesn't compile.=0A=0ASorry,= =0A=0APedro.=0A From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 18:50:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 165191065672; Thu, 21 Jun 2012 18:50:26 +0000 (UTC) (envelope-from zeising@daemonic.se) Received: from mail.lysator.liu.se (mail.lysator.liu.se [IPv6:2001:6b0:17:f0a0::3]) by mx1.freebsd.org (Postfix) with ESMTP id 8290E8FC15; Thu, 21 Jun 2012 18:50:25 +0000 (UTC) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id BA7CA40005; Thu, 21 Jun 2012 20:50:24 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id AF8D440007; Thu, 21 Jun 2012 20:50:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.3.1 X-Spam-Score: 0.0 Received: from mx.daemonic.se (mx.daemonic.se [IPv6:2001:470:dca9:0:1::3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 9810D40005; Thu, 21 Jun 2012 20:50:22 +0200 (CEST) Received: from mailscanner.daemonic.se (mailscanner.daemonic.se [IPv6:2001:470:dca9:0:1::6]) by mx.daemonic.se (Postfix) with ESMTPS id 3WJBms6ZW2z8ggv; Thu, 21 Jun 2012 20:50:21 +0200 (CEST) X-Virus-Scanned: amavisd-new at daemonic.se Received: from mx.daemonic.se ([IPv6:2001:470:dca9:0:1::3]) (using TLS with cipher CAMELLIA256-SHA) by mailscanner.daemonic.se (mailscanner.daemonic.se [2001:470:dca9:0:1::6]) (amavisd-new, port 10025) with ESMTPS id BRDqmyaz0tFD; Thu, 21 Jun 2012 20:50:19 +0200 (CEST) Received: from mail.daemonic.se (mail.daemonic.se [IPv6:2001:470:dca9:0:1::4]) by mx.daemonic.se (Postfix) with ESMTPS id 3WJBmq2ZjWz8gh0; Thu, 21 Jun 2012 20:50:19 +0200 (CEST) Received: from tifa.daemonic.se (tifa.daemonic.se [10.32.0.6]) by mail.daemonic.se (Postfix) with ESMTPSA id 3WJBmq2Gh5z9CvV; Thu, 21 Jun 2012 20:50:19 +0200 (CEST) Received: from tifa.daemonic.se (localhost [IPv6:::1]) by tifa.daemonic.se (Postfix) with ESMTP id 1DA2922AC3; Thu, 21 Jun 2012 20:50:19 +0200 (CEST) Message-ID: <4FE36CEA.4050104@daemonic.se> Date: Thu, 21 Jun 2012 20:50:18 +0200 From: Niclas Zeising User-Agent: Mutt/1.5.21 MIME-Version: 1.0 To: pfg@freebsd.org References: <1340303305.15705.YahooMailClassic@web113501.mail.gq1.yahoo.com> In-Reply-To: <1340303305.15705.YahooMailClassic@web113501.mail.gq1.yahoo.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237406 - head/contrib/gcc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 18:50:26 -0000 On 06/21/12 20:28, Pedro Giffuni wrote: > Hi Niclas; > > --- Gio 21/6/12, Niclas Zeising ha scritto: > >> On 06/21/12 18:49, Pedro F. Giffuni wrote: >>> Author: pfg >>> Date: Thu Jun 21 16:49:20 2012 >>> New Revision: 237406 >>> URL: http://svn.freebsd.org/changeset/base/237406 >>> >>> Log: >>> Bring a couple of fixes for gcc >> optimizations. >>> >>> The GCC4.3 branch contains some optimization fixes >>> that were not considered regressions and therefore >>> were never backported. We are bringing a couple of >>> them that are under GPLv2 since they were made >>> before the license switch upstream. >>> > ... >> >> Could this fix the issues with mozilla ports not compiling >> on -O2? > > > I don't think so :(. > > These are issues that would generate non-optimal code > but will not fix anything that doesn't compile. > > Sorry, > > Pedro. > Ok. Something in g++ between FreeBSD 8 and current has broken something in the compile of mozilla related stuff on -O2. I haven't been able to figure out exactly which commit though. Regards! -- Niclas Zeising From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 21:47:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 014631065670; Thu, 21 Jun 2012 21:47:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCEDC8FC14; Thu, 21 Jun 2012 21:47:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LLl88M037970; Thu, 21 Jun 2012 21:47:08 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LLl8Qk037955; Thu, 21 Jun 2012 21:47:08 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206212147.q5LLl8Qk037955@svn.freebsd.org> From: Xin LI Date: Thu, 21 Jun 2012 21:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237410 - in head: lib/libstand lib/libz lib/libz/contrib lib/libz/contrib/asm686 lib/libz/contrib/gcc_gvmat64 lib/libz/doc lib/libz/test sys/boot/userboot/libstand usr.bin/minigzip X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 21:47:09 -0000 Author: delphij Date: Thu Jun 21 21:47:08 2012 New Revision: 237410 URL: http://svn.freebsd.org/changeset/base/237410 Log: MFV: Update zlib to 1.2.7. (x86 assembler optimization disabled for now because it requires the new .cfi_* directives that is not supported by base system binutils). MFC after: 1 week Added: head/lib/libz/test/ - copied from r237252, vendor/libz/dist/test/ Deleted: head/lib/libz/example.c head/lib/libz/minigzip.c Modified: head/lib/libstand/Makefile head/lib/libz/ChangeLog head/lib/libz/FAQ head/lib/libz/FREEBSD-upgrade (contents, props changed) head/lib/libz/Makefile (contents, props changed) head/lib/libz/README head/lib/libz/Symbol.map (contents, props changed) head/lib/libz/Versions.def (contents, props changed) head/lib/libz/adler32.c head/lib/libz/contrib/asm686/match.S (contents, props changed) head/lib/libz/crc32.c head/lib/libz/crc32.h head/lib/libz/deflate.c head/lib/libz/deflate.h head/lib/libz/doc/algorithm.txt (contents, props changed) head/lib/libz/gzguts.h (contents, props changed) head/lib/libz/gzlib.c head/lib/libz/gzread.c head/lib/libz/gzwrite.c head/lib/libz/infback.c head/lib/libz/inffixed.h head/lib/libz/inflate.c head/lib/libz/inftrees.c head/lib/libz/trees.c head/lib/libz/zconf.h head/lib/libz/zlib.3 head/lib/libz/zlib.h head/lib/libz/zopen.c (contents, props changed) head/lib/libz/zutil.c head/lib/libz/zutil.h head/sys/boot/userboot/libstand/Makefile head/usr.bin/minigzip/Makefile Directory Properties: head/lib/libz/ (props changed) head/lib/libz/contrib/ (props changed) head/lib/libz/contrib/README.contrib (props changed) head/lib/libz/contrib/asm686/ (props changed) head/lib/libz/contrib/asm686/README.686 (props changed) head/lib/libz/contrib/gcc_gvmat64/ (props changed) head/lib/libz/contrib/gcc_gvmat64/gvmat64.S (props changed) head/lib/libz/doc/ (props changed) head/lib/libz/doc/rfc1950.txt (props changed) head/lib/libz/doc/rfc1951.txt (props changed) head/lib/libz/doc/rfc1952.txt (props changed) head/lib/libz/doc/txtvsbin.txt (props changed) head/lib/libz/gzclose.c (props changed) head/lib/libz/test/example.c (props changed) head/lib/libz/test/infcover.c (props changed) head/lib/libz/test/minigzip.c (props changed) Modified: head/lib/libstand/Makefile ============================================================================== --- head/lib/libstand/Makefile Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libstand/Makefile Thu Jun 21 21:47:08 2012 (r237410) @@ -38,7 +38,7 @@ CFLAGS+= -msoft-float -D_STANDALONE .endif # standalone components and stuff we have modified locally -SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ +SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \ sbrk.c twiddle.c zalloc.c zalloc_malloc.c @@ -118,23 +118,29 @@ libstand_bzlib_private.h: bzlib_private. # decompression functionality from libz .PATH: ${.CURDIR}/../libz CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz -SRCS+= adler32.c crc32.c libstand_zutil.h +SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h .for file in infback.c inffast.c inflate.c inftrees.c zutil.c SRCS+= _${file} CLEANFILES+= _${file} _${file}: ${file} - sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET} + sed -e "s|zutil\.h|libstand_zutil.h|" \ + -e "s|gzguts\.h|libstand_gzguts.h|" \ + ${.ALLSRC} > ${.TARGET} .endfor # depend on stand.h being able to be included multiple times -CLEANFILES+= libstand_zutil.h -libstand_zutil.h: zutil.h - sed -e 's||"stand.h"|' \ +.for file in zutil.h gzguts.h +CLEANFILES+= libstand_${file} +libstand_${file}: ${file} + sed -e 's||"stand.h"|' \ + -e 's||"stand.h"|' \ -e 's||"stand.h"|' \ + -e 's||"stand.h"|' \ -e 's||"stand.h"|' \ ${.ALLSRC} > ${.TARGET} +.endfor # io routines SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ Modified: head/lib/libz/ChangeLog ============================================================================== --- head/lib/libz/ChangeLog Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/ChangeLog Thu Jun 21 21:47:08 2012 (r237410) @@ -1,12 +1,213 @@ ChangeLog file for zlib +Changes in 1.2.7 (2 May 2012) +- Replace use of memmove() with a simple copy for portability +- Test for existence of strerror +- Restore gzgetc_ for backward compatibility with 1.2.6 +- Fix build with non-GNU make on Solaris +- Require gcc 4.0 or later on Mac OS X to use the hidden attribute +- Include unistd.h for Watcom C +- Use __WATCOMC__ instead of __WATCOM__ +- Do not use the visibility attribute if NO_VIZ defined +- Improve the detection of no hidden visibility attribute +- Avoid using __int64 for gcc or solo compilation +- Cast to char * in gzprintf to avoid warnings [Zinser] +- Fix make_vms.com for VAX [Zinser] +- Don't use library or built-in byte swaps +- Simplify test and use of gcc hidden attribute +- Fix bug in gzclose_w() when gzwrite() fails to allocate memory +- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen() +- Fix bug in test/minigzip.c for configure --solo +- Fix contrib/vstudio project link errors [Mohanathas] +- Add ability to choose the builder in make_vms.com [Schweda] +- Add DESTDIR support to mingw32 win32/Makefile.gcc +- Fix comments in win32/Makefile.gcc for proper usage +- Allow overriding the default install locations for cmake +- Generate and install the pkg-config file with cmake +- Build both a static and a shared version of zlib with cmake +- Include version symbols for cmake builds +- If using cmake with MSVC, add the source directory to the includes +- Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta] +- Move obsolete emx makefile to old [Truta] +- Allow the use of -Wundef when compiling or using zlib +- Avoid the use of the -u option with mktemp +- Improve inflate() documentation on the use of Z_FINISH +- Recognize clang as gcc +- Add gzopen_w() in Windows for wide character path names +- Rename zconf.h in CMakeLists.txt to move it out of the way +- Add source directory in CMakeLists.txt for building examples +- Look in build directory for zlib.pc in CMakeLists.txt +- Remove gzflags from zlibvc.def in vc9 and vc10 +- Fix contrib/minizip compilation in the MinGW environment +- Update ./configure for Solaris, support --64 [Mooney] +- Remove -R. from Solaris shared build (possible security issue) +- Avoid race condition for parallel make (-j) running example +- Fix type mismatch between get_crc_table() and crc_table +- Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler] +- Fix the path to zlib.map in CMakeLists.txt +- Force the native libtool in Mac OS X to avoid GNU libtool [Beebe] +- Add instructions to win32/Makefile.gcc for shared install [Torri] + +Changes in 1.2.6.1 (12 Feb 2012) +- Avoid the use of the Objective-C reserved name "id" +- Include io.h in gzguts.h for Microsoft compilers +- Fix problem with ./configure --prefix and gzgetc macro +- Include gz_header definition when compiling zlib solo +- Put gzflags() functionality back in zutil.c +- Avoid library header include in crc32.c for Z_SOLO +- Use name in GCC_CLASSIC as C compiler for coverage testing, if set +- Minor cleanup in contrib/minizip/zip.c [Vollant] +- Update make_vms.com [Zinser] +- Remove unnecessary gzgetc_ function +- Use optimized byte swap operations for Microsoft and GNU [Snyder] +- Fix minor typo in zlib.h comments [Rzesniowiecki] + +Changes in 1.2.6 (29 Jan 2012) +- Update the Pascal interface in contrib/pascal +- Fix function numbers for gzgetc_ in zlibvc.def files +- Fix configure.ac for contrib/minizip [Schiffer] +- Fix large-entry detection in minizip on 64-bit systems [Schiffer] +- Have ./configure use the compiler return code for error indication +- Fix CMakeLists.txt for cross compilation [McClure] +- Fix contrib/minizip/zip.c for 64-bit architectures [Dalsnes] +- Fix compilation of contrib/minizip on FreeBSD [Marquez] +- Correct suggested usages in win32/Makefile.msc [Shachar, Horvath] +- Include io.h for Turbo C / Borland C on all platforms [Truta] +- Make version explicit in contrib/minizip/configure.ac [Bosmans] +- Avoid warning for no encryption in contrib/minizip/zip.c [Vollant] +- Minor cleanup up contrib/minizip/unzip.c [Vollant] +- Fix bug when compiling minizip with C++ [Vollant] +- Protect for long name and extra fields in contrib/minizip [Vollant] +- Avoid some warnings in contrib/minizip [Vollant] +- Add -I../.. -L../.. to CFLAGS for minizip and miniunzip +- Add missing libs to minizip linker command +- Add support for VPATH builds in contrib/minizip +- Add an --enable-demos option to contrib/minizip/configure +- Add the generation of configure.log by ./configure +- Exit when required parameters not provided to win32/Makefile.gcc +- Have gzputc return the character written instead of the argument +- Use the -m option on ldconfig for BSD systems [Tobias] +- Correct in zlib.map when deflateResetKeep was added + +Changes in 1.2.5.3 (15 Jan 2012) +- Restore gzgetc function for binary compatibility +- Do not use _lseeki64 under Borland C++ [Truta] +- Update win32/Makefile.msc to build test/*.c [Truta] +- Remove old/visualc6 given CMakefile and other alternatives +- Update AS400 build files and documentation [Monnerat] +- Update win32/Makefile.gcc to build test/*.c [Truta] +- Permit stronger flushes after Z_BLOCK flushes +- Avoid extraneous empty blocks when doing empty flushes +- Permit Z_NULL arguments to deflatePending +- Allow deflatePrime() to insert bits in the middle of a stream +- Remove second empty static block for Z_PARTIAL_FLUSH +- Write out all of the available bits when using Z_BLOCK +- Insert the first two strings in the hash table after a flush + +Changes in 1.2.5.2 (17 Dec 2011) +- fix ld error: unable to find version dependency 'ZLIB_1.2.5' +- use relative symlinks for shared libs +- Avoid searching past window for Z_RLE strategy +- Assure that high-water mark initialization is always applied in deflate +- Add assertions to fill_window() in deflate.c to match comments +- Update python link in README +- Correct spelling error in gzread.c +- Fix bug in gzgets() for a concatenated empty gzip stream +- Correct error in comment for gz_make() +- Change gzread() and related to ignore junk after gzip streams +- Allow gzread() and related to continue after gzclearerr() +- Allow gzrewind() and gzseek() after a premature end-of-file +- Simplify gzseek() now that raw after gzip is ignored +- Change gzgetc() to a macro for speed (~40% speedup in testing) +- Fix gzclose() to return the actual error last encountered +- Always add large file support for windows +- Include zconf.h for windows large file support +- Include zconf.h.cmakein for windows large file support +- Update zconf.h.cmakein on make distclean +- Merge vestigial vsnprintf determination from zutil.h to gzguts.h +- Clarify how gzopen() appends in zlib.h comments +- Correct documentation of gzdirect() since junk at end now ignored +- Add a transparent write mode to gzopen() when 'T' is in the mode +- Update python link in zlib man page +- Get inffixed.h and MAKEFIXED result to match +- Add a ./config --solo option to make zlib subset with no libary use +- Add undocumented inflateResetKeep() function for CAB file decoding +- Add --cover option to ./configure for gcc coverage testing +- Add #define ZLIB_CONST option to use const in the z_stream interface +- Add comment to gzdopen() in zlib.h to use dup() when using fileno() +- Note behavior of uncompress() to provide as much data as it can +- Add files in contrib/minizip to aid in building libminizip +- Split off AR options in Makefile.in and configure +- Change ON macro to Z_ARG to avoid application conflicts +- Facilitate compilation with Borland C++ for pragmas and vsnprintf +- Include io.h for Turbo C / Borland C++ +- Move example.c and minigzip.c to test/ +- Simplify incomplete code table filling in inflate_table() +- Remove code from inflate.c and infback.c that is impossible to execute +- Test the inflate code with full coverage +- Allow deflateSetDictionary, inflateSetDictionary at any time (in raw) +- Add deflateResetKeep and fix inflateResetKeep to retain dictionary +- Fix gzwrite.c to accommodate reduced memory zlib compilation +- Have inflate() with Z_FINISH avoid the allocation of a window +- Do not set strm->adler when doing raw inflate +- Fix gzeof() to behave just like feof() when read is not past end of file +- Fix bug in gzread.c when end-of-file is reached +- Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF +- Document gzread() capability to read concurrently written files +- Remove hard-coding of resource compiler in CMakeLists.txt [Blammo] + +Changes in 1.2.5.1 (10 Sep 2011) +- Update FAQ entry on shared builds (#13) +- Avoid symbolic argument to chmod in Makefile.in +- Fix bug and add consts in contrib/puff [Oberhumer] +- Update contrib/puff/zeros.raw test file to have all block types +- Add full coverage test for puff in contrib/puff/Makefile +- Fix static-only-build install in Makefile.in +- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno] +- Add libz.a dependency to shared in Makefile.in for parallel builds +- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out +- Replace $(...) with `...` in configure for non-bash sh [Bowler] +- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen] +- Add solaris* to Linux* in configure to allow gcc use [Groffen] +- Add *bsd* to Linux* case in configure [Bar-Lev] +- Add inffast.obj to dependencies in win32/Makefile.msc +- Correct spelling error in deflate.h [Kohler] +- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc +- Add test to configure for GNU C looking for gcc in output of $cc -v +- Add zlib.pc generation to win32/Makefile.gcc [Weigelt] +- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not +- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense +- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser) +- Make stronger test in zconf.h to include unistd.h for LFS +- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack] +- Fix zlib.h LFS support when Z_PREFIX used +- Add updated as400 support (removed from old) [Monnerat] +- Avoid deflate sensitivity to volatile input data +- Avoid division in adler32_combine for NO_DIVIDE +- Clarify the use of Z_FINISH with deflateBound() amount of space +- Set binary for output file in puff.c +- Use u4 type for crc_table to avoid conversion warnings +- Apply casts in zlib.h to avoid conversion warnings +- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] +- Improve inflateSync() documentation to note indeterminancy +- Add deflatePending() function to return the amount of pending output +- Correct the spelling of "specification" in FAQ [Randers-Pehrson] +- Add a check in configure for stdarg.h, use for gzprintf() +- Check that pointers fit in ints when gzprint() compiled old style +- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] +- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] +- Add debug records in assmebler code [Londer] +- Update RFC references to use http://tools.ietf.org/html/... [Li] +- Add --archs option, use of libtool to configure for Mac OS X [Borstel] + Changes in 1.2.5 (19 Apr 2010) - Disable visibility attribute in win32/Makefile.gcc [Bar-Lev] - Default to libdir as sharedlibdir in configure [Nieder] - Update copyright dates on modified source files - Update trees.c to be able to generate modified trees.h - Exit configure for MinGW, suggesting win32/Makefile.gcc +- Check for NULL path in gz_open [Homurlu] Changes in 1.2.4.5 (18 Apr 2010) - Set sharedlibdir in configure [Torok] @@ -261,7 +462,7 @@ Changes in 1.2.3.4 (21 Dec 2009) - Clear bytes after deflate lookahead to avoid use of uninitialized data - Change a limit in inftrees.c to be more transparent to Coverity Prevent - Update win32/zlib.def with exported symbols from zlib.h -- Correct spelling error in zlib.h [Willem] +- Correct spelling errors in zlib.h [Willem, Sobrado] - Allow Z_BLOCK for deflate() to force a new block - Allow negative bits in inflatePrime() to delete existing bit buffer - Add Z_TREES flush option to inflate() to return at end of trees Modified: head/lib/libz/FAQ ============================================================================== --- head/lib/libz/FAQ Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/FAQ Thu Jun 21 21:47:08 2012 (r237410) @@ -44,8 +44,8 @@ The lastest zlib FAQ is at http://zlib.n 6. Where's the zlib documentation (man pages, etc.)? - It's in zlib.h . Examples of zlib usage are in the files example.c and - minigzip.c, with more in examples/ . + It's in zlib.h . Examples of zlib usage are in the files test/example.c + and test/minigzip.c, with more in examples/ . 7. Why don't you use GNU autoconf or libtool or ...? @@ -84,8 +84,10 @@ The lastest zlib FAQ is at http://zlib.n 13. How can I make a Unix shared library? - make clean - ./configure -s + By default a shared (and a static) library is built for Unix. So: + + make distclean + ./configure make 14. How do I install a shared zlib library on Unix? @@ -325,7 +327,7 @@ The lastest zlib FAQ is at http://zlib.n correctly points to the zlib specification in RFC 1950 for the "deflate" transfer encoding, there have been reports of servers and browsers that incorrectly produce or expect raw deflate data per the deflate - specficiation in RFC 1951, most notably Microsoft. So even though the + specification in RFC 1951, most notably Microsoft. So even though the "deflate" transfer encoding using the zlib format would be the more efficient approach (and in fact exactly what the zlib format was designed for), using the "gzip" transfer encoding is probably more reliable due to Modified: head/lib/libz/FREEBSD-upgrade ============================================================================== --- head/lib/libz/FREEBSD-upgrade Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/FREEBSD-upgrade Thu Jun 21 21:47:08 2012 (r237410) @@ -1,4 +1,4 @@ -$FreeBSD$ +$FreeBSD: head/lib/libz/FREEBSD-upgrade 146082 2005-05-11 03:50:50Z kientzle $ ZLib 1.2.2 Modified: head/lib/libz/Makefile ============================================================================== --- head/lib/libz/Makefile Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/Makefile Thu Jun 21 21:47:08 2012 (r237410) @@ -1,5 +1,5 @@ # -# $FreeBSD$ +# $FreeBSD: head/lib/libz/Makefile 232263 2012-02-28 18:30:18Z dim $ # LIB= z @@ -35,12 +35,12 @@ SRCS+= uncompr.c SRCS+= zopen.c SRCS+= zutil.c -.if ${MACHINE_ARCH} == "i386" && ${MACHINE_CPU:M*i686*} -.PATH: ${.CURDIR}/contrib/asm686 -SRCS+= match.S -CFLAGS+= -DASMV -DNO_UNDERLINE -ACFLAGS+= -Wa,--noexecstack -.endif +#.if ${MACHINE_ARCH} == "i386" && ${MACHINE_CPU:M*i686*} +#.PATH: ${.CURDIR}/contrib/asm686 +#SRCS+= match.S +#CFLAGS+= -DASMV -DNO_UNDERLINE +#ACFLAGS+= -Wa,--noexecstack +#.endif #.if ${MACHINE_ARCH} == "amd64" #.PATH: ${.CURDIR}/contrib/gcc_gvmat64 Modified: head/lib/libz/README ============================================================================== --- head/lib/libz/README Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/README Thu Jun 21 21:47:08 2012 (r237410) @@ -1,22 +1,22 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.5 is a general purpose data compression library. All the code is +zlib 1.2.7 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files -http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) -and rfc1952.txt (gzip format). +http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and +rfc1952 (gzip format). All functions of the compression library are documented in the file zlib.h (volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file example.c which also tests that the library -is working correctly. Another example is given in the file minigzip.c. The -compression library itself is composed of all source files except example.c and -minigzip.c. +of the library is given in the file test/example.c which also tests that +the library is working correctly. Another example is given in the file +test/minigzip.c. The compression library itself is composed of all source +files in the root directory. To compile all files and run the test program, follow the instructions given at the top of Makefile.in. In short "./configure; make test", and if that goes -well, "make install" should work for most flavors of Unix. For Windows, use one -of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use +well, "make install" should work for most flavors of Unix. For Windows, use +one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use make_vms.com. Questions about zlib should be sent to , or to Gilles Vollant @@ -31,7 +31,7 @@ Mark Nelson wrote an ar issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.5 are documented in the file ChangeLog. +The changes made in version 1.2.7 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -44,7 +44,7 @@ http://search.cpan.org/~pmqs/IO-Compress A Python interface to zlib written by A.M. Kuchling is available in Python 1.5 and later versions, see -http://www.python.org/doc/lib/module-zlib.html . +http://docs.python.org/library/zlib.html . zlib is built into tcl: http://wiki.tcl.tk/4610 . @@ -84,7 +84,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2010 Jean-loup Gailly and Mark Adler + (C) 1995-2012 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages Modified: head/lib/libz/Symbol.map ============================================================================== --- head/lib/libz/Symbol.map Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/Symbol.map Thu Jun 21 21:47:08 2012 (r237410) @@ -1,7 +1,14 @@ /* - * $FreeBSD$ + * $FreeBSD: head/lib/libz/Symbol.map 206709 2010-04-16 20:07:24Z delphij $ */ +ZLIB_1.2.7.0 { + deflatePending; + deflateResetKeep; + gzgetc_; + inflateResetKeep; +}; + ZLIB_1.2.4.0 { adler32; adler32_combine; Modified: head/lib/libz/Versions.def ============================================================================== --- head/lib/libz/Versions.def Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/Versions.def Thu Jun 21 21:47:08 2012 (r237410) @@ -1,8 +1,11 @@ -# $FreeBSD$ +# $FreeBSD: head/lib/libz/Versions.def 205486 2010-03-22 22:12:27Z delphij $ ZLIB_1.2.4.0 { }; +ZLIB_1.2.7.0 { +} ZLIB_1.2.4.0; + FBSD_1.2 { } ZLIB_1.2.4.0; Modified: head/lib/libz/adler32.c ============================================================================== --- head/lib/libz/adler32.c Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/adler32.c Thu Jun 21 21:47:08 2012 (r237410) @@ -1,5 +1,5 @@ /* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2007 Mark Adler + * Copyright (C) 1995-2011 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,9 +9,9 @@ #define local static -local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); +local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); -#define BASE 65521UL /* largest prime smaller than 65536 */ +#define BASE 65521 /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ @@ -21,39 +21,44 @@ local uLong adler32_combine_(uLong adler #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); #define DO16(buf) DO8(buf,0); DO8(buf,8); -/* use NO_DIVIDE if your processor does not do division in hardware */ +/* use NO_DIVIDE if your processor does not do division in hardware -- + try it both ways to see which is faster */ #ifdef NO_DIVIDE -# define MOD(a) \ +/* note that this assumes BASE is 65521, where 65536 % 65521 == 15 + (thank you to John Reiser for pointing this out) */ +# define CHOP(a) \ + do { \ + unsigned long tmp = a >> 16; \ + a &= 0xffffUL; \ + a += (tmp << 4) - tmp; \ + } while (0) +# define MOD28(a) \ do { \ - if (a >= (BASE << 16)) a -= (BASE << 16); \ - if (a >= (BASE << 15)) a -= (BASE << 15); \ - if (a >= (BASE << 14)) a -= (BASE << 14); \ - if (a >= (BASE << 13)) a -= (BASE << 13); \ - if (a >= (BASE << 12)) a -= (BASE << 12); \ - if (a >= (BASE << 11)) a -= (BASE << 11); \ - if (a >= (BASE << 10)) a -= (BASE << 10); \ - if (a >= (BASE << 9)) a -= (BASE << 9); \ - if (a >= (BASE << 8)) a -= (BASE << 8); \ - if (a >= (BASE << 7)) a -= (BASE << 7); \ - if (a >= (BASE << 6)) a -= (BASE << 6); \ - if (a >= (BASE << 5)) a -= (BASE << 5); \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ + CHOP(a); \ if (a >= BASE) a -= BASE; \ } while (0) -# define MOD4(a) \ +# define MOD(a) \ do { \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ + CHOP(a); \ + MOD28(a); \ + } while (0) +# define MOD63(a) \ + do { /* this assumes a is not negative */ \ + z_off64_t tmp = a >> 32; \ + a &= 0xffffffffL; \ + a += (tmp << 8) - (tmp << 5) + tmp; \ + tmp = a >> 16; \ + a &= 0xffffL; \ + a += (tmp << 4) - tmp; \ + tmp = a >> 16; \ + a &= 0xffffL; \ + a += (tmp << 4) - tmp; \ if (a >= BASE) a -= BASE; \ } while (0) #else # define MOD(a) a %= BASE -# define MOD4(a) a %= BASE +# define MOD28(a) a %= BASE +# define MOD63(a) a %= BASE #endif /* ========================================================================= */ @@ -92,7 +97,7 @@ uLong ZEXPORT adler32(adler, buf, len) } if (adler >= BASE) adler -= BASE; - MOD4(sum2); /* only added so many BASE's */ + MOD28(sum2); /* only added so many BASE's */ return adler | (sum2 << 16); } @@ -137,8 +142,13 @@ local uLong adler32_combine_(adler1, adl unsigned long sum2; unsigned rem; + /* for negative len, return invalid adler32 as a clue for debugging */ + if (len2 < 0) + return 0xffffffffUL; + /* the derivation of this formula is left as an exercise for the reader */ - rem = (unsigned)(len2 % BASE); + MOD63(len2); /* assumes len2 >= 0 */ + rem = (unsigned)len2; sum1 = adler1 & 0xffff; sum2 = rem * sum1; MOD(sum2); Modified: head/lib/libz/contrib/asm686/match.S ============================================================================== --- head/lib/libz/contrib/asm686/match.S Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/contrib/asm686/match.S Thu Jun 21 21:47:08 2012 (r237410) @@ -83,17 +83,25 @@ .text /* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ +.cfi_sections .debug_frame longest_match: +.cfi_startproc /* Save registers that the compiler may be using, and adjust %esp to */ /* make room for our stack frame. */ pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset ebp, -8 pushl %edi + .cfi_def_cfa_offset 12 pushl %esi + .cfi_def_cfa_offset 16 pushl %ebx + .cfi_def_cfa_offset 20 subl $LocalVarsSize, %esp + .cfi_def_cfa_offset LocalVarsSize+20 /* Retrieve the function arguments. %ecx will hold cur_match */ /* throughout the entire function. %edx will hold the pointer to the */ @@ -108,7 +116,7 @@ longest_match: /* if (s->prev_length >= s->good_match) { */ /* chain_length >>= 2; */ /* } */ - + movl dsPrevLen(%edx), %eax movl dsGoodMatch(%edx), %ebx cmpl %ebx, %eax @@ -336,8 +344,14 @@ LookaheadRet: /* Restore the stack and return from whence we came. */ addl $LocalVarsSize, %esp + .cfi_def_cfa_offset 20 popl %ebx + .cfi_def_cfa_offset 16 popl %esi + .cfi_def_cfa_offset 12 popl %edi + .cfi_def_cfa_offset 8 popl %ebp + .cfi_def_cfa_offset 4 +.cfi_endproc match_init: ret Modified: head/lib/libz/crc32.c ============================================================================== --- head/lib/libz/crc32.c Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/crc32.c Thu Jun 21 21:47:08 2012 (r237410) @@ -1,5 +1,5 @@ /* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010 Mark Adler + * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Thanks to Rodney Brown for his contribution of faster @@ -17,6 +17,8 @@ of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should first call get_crc_table() to initialize the tables before allowing more than one thread to use crc32(). + + DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. */ #ifdef MAKECRCH @@ -30,31 +32,11 @@ #define local static -/* Find a four-byte integer type for crc32_little() and crc32_big(). */ -#ifndef NOBYFOUR -# ifdef STDC /* need ANSI C limits.h to determine sizes */ -# include -# define BYFOUR -# if (UINT_MAX == 0xffffffffUL) - typedef unsigned int u4; -# else -# if (ULONG_MAX == 0xffffffffUL) - typedef unsigned long u4; -# else -# if (USHRT_MAX == 0xffffffffUL) - typedef unsigned short u4; -# else -# undef BYFOUR /* can't find a four-byte integer type! */ -# endif -# endif -# endif -# endif /* STDC */ -#endif /* !NOBYFOUR */ - /* Definitions for doing the crc four data bytes at a time. */ +#if !defined(NOBYFOUR) && defined(Z_U4) +# define BYFOUR +#endif #ifdef BYFOUR -# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ - (((w)&0xff00)<<8)+(((w)&0xff)<<24)) local unsigned long crc32_little OF((unsigned long, const unsigned char FAR *, unsigned)); local unsigned long crc32_big OF((unsigned long, @@ -68,16 +50,16 @@ local unsigned long gf2_matrix_times OF((unsigned long *mat, unsigned long vec)); local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2); +local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); #ifdef DYNAMIC_CRC_TABLE local volatile int crc_table_empty = 1; -local unsigned long FAR crc_table[TBLS][256]; +local z_crc_t FAR crc_table[TBLS][256]; local void make_crc_table OF((void)); #ifdef MAKECRCH - local void write_table OF((FILE *, const unsigned long FAR *)); + local void write_table OF((FILE *, const z_crc_t FAR *)); #endif /* MAKECRCH */ /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: @@ -107,9 +89,9 @@ local void make_crc_table OF((void)); */ local void make_crc_table() { - unsigned long c; + z_crc_t c; int n, k; - unsigned long poly; /* polynomial exclusive-or pattern */ + z_crc_t poly; /* polynomial exclusive-or pattern */ /* terms of polynomial defining this crc (except x^32): */ static volatile int first = 1; /* flag to limit concurrent making */ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; @@ -121,13 +103,13 @@ local void make_crc_table() first = 0; /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0UL; - for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) - poly |= 1UL << (31 - p[n]); + poly = 0; + for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) + poly |= (z_crc_t)1 << (31 - p[n]); /* generate a crc for every 8-bit value */ for (n = 0; n < 256; n++) { - c = (unsigned long)n; + c = (z_crc_t)n; for (k = 0; k < 8; k++) c = c & 1 ? poly ^ (c >> 1) : c >> 1; crc_table[0][n] = c; @@ -138,11 +120,11 @@ local void make_crc_table() and then the byte reversal of those as well as the first table */ for (n = 0; n < 256; n++) { c = crc_table[0][n]; - crc_table[4][n] = REV(c); + crc_table[4][n] = ZSWAP32(c); for (k = 1; k < 4; k++) { c = crc_table[0][c & 0xff] ^ (c >> 8); crc_table[k][n] = c; - crc_table[k + 4][n] = REV(c); + crc_table[k + 4][n] = ZSWAP32(c); } } #endif /* BYFOUR */ @@ -164,7 +146,7 @@ local void make_crc_table() if (out == NULL) return; fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const unsigned long FAR "); + fprintf(out, "local const z_crc_t FAR "); fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); write_table(out, crc_table[0]); # ifdef BYFOUR @@ -184,12 +166,13 @@ local void make_crc_table() #ifdef MAKECRCH local void write_table(out, table) FILE *out; - const unsigned long FAR *table; + const z_crc_t FAR *table; { int n; for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", + (unsigned long)(table[n]), n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); } #endif /* MAKECRCH */ @@ -204,13 +187,13 @@ local void write_table(out, table) /* ========================================================================= * This function can be used by asm versions of crc32() */ -const unsigned long FAR * ZEXPORT get_crc_table() +const z_crc_t FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ - return (const unsigned long FAR *)crc_table; + return (const z_crc_t FAR *)crc_table; } /* ========================================================================= */ @@ -232,7 +215,7 @@ unsigned long ZEXPORT crc32(crc, buf, le #ifdef BYFOUR if (sizeof(void *) == sizeof(ptrdiff_t)) { - u4 endian; + z_crc_t endian; endian = 1; if (*((unsigned char *)(&endian))) @@ -266,17 +249,17 @@ local unsigned long crc32_little(crc, bu const unsigned char FAR *buf; unsigned len; { - register u4 c; - register const u4 FAR *buf4; + register z_crc_t c; + register const z_crc_t FAR *buf4; - c = (u4)crc; + c = (z_crc_t)crc; c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } - buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4 = (const z_crc_t FAR *)(const void FAR *)buf; while (len >= 32) { DOLIT32; len -= 32; @@ -306,17 +289,17 @@ local unsigned long crc32_big(crc, buf, const unsigned char FAR *buf; unsigned len; { - register u4 c; - register const u4 FAR *buf4; + register z_crc_t c; + register const z_crc_t FAR *buf4; - c = REV((u4)crc); + c = ZSWAP32((z_crc_t)crc); c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; } - buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4 = (const z_crc_t FAR *)(const void FAR *)buf; buf4--; while (len >= 32) { DOBIG32; @@ -333,7 +316,7 @@ local unsigned long crc32_big(crc, buf, c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); } while (--len); c = ~c; - return (unsigned long)(REV(c)); + return (unsigned long)(ZSWAP32(c)); } #endif /* BYFOUR */ Modified: head/lib/libz/crc32.h ============================================================================== --- head/lib/libz/crc32.h Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/crc32.h Thu Jun 21 21:47:08 2012 (r237410) @@ -2,7 +2,7 @@ * Generated automatically by crc32.c */ -local const unsigned long FAR crc_table[TBLS][256] = +local const z_crc_t FAR crc_table[TBLS][256] = { { 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, Modified: head/lib/libz/deflate.c ============================================================================== --- head/lib/libz/deflate.c Thu Jun 21 18:28:48 2012 (r237409) +++ head/lib/libz/deflate.c Thu Jun 21 21:47:08 2012 (r237410) @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -37,7 +37,7 @@ * REFERENCES * * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://www.ietf.org/rfc/rfc1951.txt + * Available in http://tools.ietf.org/html/rfc1951 * * A description of the Rabin and Karp algorithm is given in the book * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -155,6 +155,9 @@ local const config configuration_table[1 struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ #endif +/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ +#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) + /* =========================================================================== * Update a hash value with the given input byte * IN assertion: all calls to to UPDATE_HASH are made with consecutive @@ -235,10 +238,19 @@ int ZEXPORT deflateInit2_(strm, level, m strm->msg = Z_NULL; if (strm->zalloc == (alloc_func)0) { +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else strm->zalloc = zcalloc; strm->opaque = (voidpf)0; +#endif } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; + if (strm->zfree == (free_func)0) +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zfree = zcfree; +#endif #ifdef FASTEST if (level != 0) level = 1; @@ -314,43 +326,70 @@ int ZEXPORT deflateSetDictionary (strm, uInt dictLength; { deflate_state *s; - uInt length = dictLength; - uInt n; - IPos hash_head = 0; - - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || - strm->state->wrap == 2 || - (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) - return Z_STREAM_ERROR; + uInt str, n; + int wrap; + unsigned avail; + unsigned char *next; + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) + return Z_STREAM_ERROR; s = strm->state; - if (s->wrap) + wrap = s->wrap; + if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) + return Z_STREAM_ERROR; + + /* when using zlib wrappers, compute Adler-32 for provided dictionary */ + if (wrap == 1) strm->adler = adler32(strm->adler, dictionary, dictLength); + s->wrap = 0; /* avoid computing Adler-32 in read_buf */ - if (length < MIN_MATCH) return Z_OK; - if (length > s->w_size) { - length = s->w_size; - dictionary += dictLength - length; /* use the tail of the dictionary */ - } - zmemcpy(s->window, dictionary, length); - s->strstart = length; - s->block_start = (long)length; - - /* Insert all strings in the hash table (except for the last two bytes). - * s->lookahead stays null, so s->ins_h will be recomputed at the next - * call of fill_window. - */ - s->ins_h = s->window[0]; - UPDATE_HASH(s, s->ins_h, s->window[1]); - for (n = 0; n <= length - MIN_MATCH; n++) { - INSERT_STRING(s, n, hash_head); - } - if (hash_head) hash_head = 0; /* to make compiler happy */ + /* if dictionary would fill window, just replace the history */ + if (dictLength >= s->w_size) { + if (wrap == 0) { /* already empty otherwise */ + CLEAR_HASH(s); + s->strstart = 0; + s->block_start = 0L; + s->insert = 0; + } + dictionary += dictLength - s->w_size; /* use the tail */ + dictLength = s->w_size; + } + + /* insert dictionary into window and hash */ + avail = strm->avail_in; + next = strm->next_in; + strm->avail_in = dictLength; + strm->next_in = (Bytef *)dictionary; + fill_window(s); + while (s->lookahead >= MIN_MATCH) { + str = s->strstart; + n = s->lookahead - (MIN_MATCH-1); + do { + UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); +#ifndef FASTEST + s->prev[str & s->w_mask] = s->head[s->ins_h]; +#endif + s->head[s->ins_h] = (Pos)str; + str++; + } while (--n); + s->strstart = str; + s->lookahead = MIN_MATCH-1; + fill_window(s); + } + s->strstart += s->lookahead; + s->block_start = (long)s->strstart; + s->insert = s->lookahead; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + strm->next_in = next; + strm->avail_in = avail; + s->wrap = wrap; return Z_OK; } /* ========================================================================= */ -int ZEXPORT deflateReset (strm) +int ZEXPORT deflateResetKeep (strm) z_streamp strm; { deflate_state *s; @@ -380,12 +419,23 @@ int ZEXPORT deflateReset (strm) s->last_flush = Z_NO_FLUSH; _tr_init(s); - lm_init(s); return Z_OK; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 22:06:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19FA91065670; Thu, 21 Jun 2012 22:06:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 058DB8FC14; Thu, 21 Jun 2012 22:06:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LM6v4R038818; Thu, 21 Jun 2012 22:06:57 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LM6vvK038816; Thu, 21 Jun 2012 22:06:57 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201206212206.q5LM6vvK038816@svn.freebsd.org> From: Ed Maste Date: Thu, 21 Jun 2012 22:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237411 - head/sys/dev/drm2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 22:06:58 -0000 Author: emaste Date: Thu Jun 21 22:06:57 2012 New Revision: 237411 URL: http://svn.freebsd.org/changeset/base/237411 Log: Add PCI IDs for Ivy Bridge Modified: head/sys/dev/drm2/drm_pciids.h Modified: head/sys/dev/drm2/drm_pciids.h ============================================================================== --- head/sys/dev/drm2/drm_pciids.h Thu Jun 21 21:47:08 2012 (r237410) +++ head/sys/dev/drm2/drm_pciids.h Thu Jun 21 22:06:57 2012 (r237411) @@ -566,6 +566,12 @@ {0x8086, 0x0116, CHIP_I9XX|CHIP_I915, "Intel SandyBridge (M)"}, \ {0x8086, 0x0126, CHIP_I9XX|CHIP_I915, "Intel SandyBridge (M)"}, \ {0x8086, 0x010A, CHIP_I9XX|CHIP_I915, "Intel SandyBridge (M)"}, \ + {0x8086, 0x0152, CHIP_I9XX|CHIP_I915, "Intel IvyBridge"}, \ + {0x8086, 0x0162, CHIP_I9XX|CHIP_I915, "Intel IvyBridge"}, \ + {0x8086, 0x0156, CHIP_I9XX|CHIP_I915, "Intel IvyBridge (M)"}, \ + {0x8086, 0x0166, CHIP_I9XX|CHIP_I915, "Intel IvyBridge (M)"}, \ + {0x8086, 0x015A, CHIP_I9XX|CHIP_I915, "Intel IvyBridge (S)"}, \ + {0x8086, 0x016A, CHIP_I9XX|CHIP_I915, "Intel IvyBridge (S)"}, \ {0x8086, 0xA001, CHIP_I9XX|CHIP_I965, "Intel Pineview"}, \ {0x8086, 0xA011, CHIP_I9XX|CHIP_I965, "Intel Pineview (M)"}, \ {0, 0, 0, NULL} From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 00:40:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBCC21065673; Fri, 22 Jun 2012 00:40:45 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2BE38FC0A; Fri, 22 Jun 2012 00:40:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M0ejnt045415; Fri, 22 Jun 2012 00:40:45 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M0ejNk045397; Fri, 22 Jun 2012 00:40:45 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206220040.q5M0ejNk045397@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 22 Jun 2012 00:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237412 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disa... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 00:40:45 -0000 Author: jkim Date: Fri Jun 22 00:40:44 2012 New Revision: 237412 URL: http://svn.freebsd.org/changeset/base/237412 Log: Merge ACPICA 20120620. Added: head/sys/contrib/dev/acpica/common/ahpredef.c - copied, changed from r237408, vendor-sys/acpica/dist/source/common/ahpredef.c Modified: head/sys/contrib/dev/acpica/changes.txt (contents, props changed) head/sys/contrib/dev/acpica/common/dmextern.c head/sys/contrib/dev/acpica/common/dmrestag.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslerror.c head/sys/contrib/dev/acpica/compiler/aslfiles.c head/sys/contrib/dev/acpica/compiler/asllookup.c head/sys/contrib/dev/acpica/compiler/aslmain.c head/sys/contrib/dev/acpica/compiler/aslsupport.l head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/dttemplate.c head/sys/contrib/dev/acpica/components/debugger/dbdisply.c head/sys/contrib/dev/acpica/components/debugger/dbexec.c head/sys/contrib/dev/acpica/components/debugger/dbutils.c head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c head/sys/contrib/dev/acpica/components/events/evgpe.c head/sys/contrib/dev/acpica/components/events/evgpeutil.c head/sys/contrib/dev/acpica/components/events/evxfgpe.c head/sys/contrib/dev/acpica/components/executer/exconfig.c head/sys/contrib/dev/acpica/components/utilities/utmisc.c head/sys/contrib/dev/acpica/include/acdebug.h head/sys/contrib/dev/acpica/include/acdisasm.h head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acpredef.h head/sys/contrib/dev/acpica/include/acutils.h head/usr.sbin/acpi/iasl/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/dev/acpica/common/ (props changed) head/sys/contrib/dev/acpica/compiler/ (props changed) head/sys/contrib/dev/acpica/components/debugger/ (props changed) head/sys/contrib/dev/acpica/components/disassembler/ (props changed) head/sys/contrib/dev/acpica/components/dispatcher/ (props changed) head/sys/contrib/dev/acpica/components/events/ (props changed) head/sys/contrib/dev/acpica/components/executer/ (props changed) head/sys/contrib/dev/acpica/components/utilities/ (props changed) head/sys/contrib/dev/acpica/include/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/changes.txt Fri Jun 22 00:40:44 2012 (r237412) @@ -1,4 +1,68 @@ ---------------------------------------- +20 June 2012. Summary of changes for version 20120620: + +This release is available at https://www.acpica.org/downloads +The ACPI 5.0 specification is available at www.acpi.info + +1) ACPICA Kernel-resident Subsystem: + +Implemented support to expand the "implicit notify" feature to allow multiple +devices to be notified by a single GPE. This feature automatically generates a +runtime device notification in the absence of a BIOS-provided GPE control +method (_Lxx/_Exx) or a host-installed handler for the GPE. Implicit notify is +provided by ACPICA for Windows compatibility, and is a workaround for BIOS AML +code errors. See the description of the AcpiSetupGpeForWake interface in the +APCICA reference. Bob Moore, Rafael Wysocki. ACPICA BZ 918. + +Changed some comments and internal function names to simplify and ensure +correctness of the Linux code translation. No functional changes. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug +version of the code includes the debug output trace mechanism and has a much +larger code and data size. + + Previous Release: + Non-Debug Version: 93.0K Code, 25.1K Data, 118.1K Total + Debug Version: 172.7K Code, 73.6K Data, 246.3K Total + Current Release: + Non-Debug Version: 93.1K Code, 25.1K Data, 118.2K Total + Debug Version: 172.9K Code, 73.6K Data, 246.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Added support to emit short, commented descriptions for the ACPI +predefined names in order to improve the readability of the disassembled +output. ACPICA BZ 959. Changes include: + 1) Emit descriptions for all standard predefined names (_INI, _STA, _PRW, +etc.) + 2) Emit generic descriptions for the special names (_Exx, _Qxx, etc.) + 3) Emit descriptions for the resource descriptor names (_MIN, _LEN, etc.) + +AcpiSrc: Fixed several long-standing Linux code translation issues. Argument +descriptions in function headers are now translated properly to lower case and +underscores. ACPICA BZ 961. Also fixes translation problems such as these: +(old -> new) + i_aSL -> iASL + 00-7_f -> 00-7F + 16_k -> 16K + local_fADT -> local_FADT + execute_oSI -> execute_OSI + +iASL: Fixed a problem where null bytes were inadvertently emitted into some +listing files. + +iASL: Added the existing debug options to the standard help screen. There are +no longer two different help screens. ACPICA BZ 957. + +AcpiHelp: Fixed some typos in the various predefined name descriptions. Also +expand some of the descriptions where appropriate. + +iASL: Fixed the -ot option (display compile times/statistics). Was not working +properly for standard output; only worked for the debug file case. + +---------------------------------------- 18 May 2012. Summary of changes for version 20120518: Copied and modified: head/sys/contrib/dev/acpica/common/ahpredef.c (from r237408, vendor-sys/acpica/dist/source/common/ahpredef.c) ============================================================================== --- vendor-sys/acpica/dist/source/common/ahpredef.c Thu Jun 21 18:22:50 2012 (r237408, copy source) +++ head/sys/contrib/dev/acpica/common/ahpredef.c Fri Jun 22 00:40:44 2012 (r237412) @@ -41,8 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include "acpi.h" -#include "accommon.h" +#include +#include /* * iASL only needs a partial table (short descriptions only). Modified: head/sys/contrib/dev/acpica/common/dmextern.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmextern.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/common/dmextern.c Fri Jun 22 00:40:44 2012 (r237412) @@ -221,8 +221,10 @@ AcpiDmNormalizeParentPrefix ( */ ACPI_STRCAT (Fullpath, ParentPath); - /* Add dot separator (don't need dot if parent fullpath is a single "\") */ - + /* + * Add dot separator + * (don't need dot if parent fullpath is a single backslash) + */ if (ParentPath[1]) { ACPI_STRCAT (Fullpath, "."); Modified: head/sys/contrib/dev/acpica/common/dmrestag.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmrestag.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/common/dmrestag.c Fri Jun 22 00:40:44 2012 (r237412) @@ -73,6 +73,7 @@ AcpiDmGetResourceTag ( static char * AcpiGetTagPathname ( + ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *BufferNode, ACPI_NAMESPACE_NODE *ResourceNode, UINT32 BitIndex); @@ -443,7 +444,6 @@ AcpiDmCheckResourceReference ( ACPI_NAMESPACE_NODE *BufferNode; ACPI_NAMESPACE_NODE *ResourceNode; const ACPI_OPCODE_INFO *OpInfo; - char *Pathname; UINT32 BitIndex; @@ -519,14 +519,7 @@ AcpiDmCheckResourceReference ( /* Translate the Index to a resource tag pathname */ - Pathname = AcpiGetTagPathname (BufferNode, ResourceNode, BitIndex); - if (Pathname) - { - /* Complete the conversion of the Index to a symbol */ - - IndexOp->Common.AmlOpcode = AML_INT_NAMEPATH_OP; - IndexOp->Common.Value.String = Pathname; - } + AcpiGetTagPathname (IndexOp, BufferNode, ResourceNode, BitIndex); } @@ -597,6 +590,7 @@ AcpiDmGetResourceNode ( static char * AcpiGetTagPathname ( + ACPI_PARSE_OBJECT *IndexOp, ACPI_NAMESPACE_NODE *BufferNode, ACPI_NAMESPACE_NODE *ResourceNode, UINT32 BitIndex) @@ -689,6 +683,15 @@ AcpiGetTagPathname ( AcpiNsInternalizeName (Pathname, &InternalPath); ACPI_FREE (Pathname); + + /* Update the Op with the symbol */ + + AcpiPsInitOp (IndexOp, AML_INT_NAMEPATH_OP); + IndexOp->Common.Value.String = InternalPath; + + /* We will need the tag later. Cheat by putting it in the Node field */ + + IndexOp->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Tag); return (InternalPath); } Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Fri Jun 22 00:40:44 2012 (r237412) @@ -67,6 +67,10 @@ FlConsumeNewComment ( FILE *Handle, ASL_FILE_STATUS *Status); +static void +CmDumpAllEvents ( + void); + /******************************************************************************* * @@ -717,45 +721,65 @@ CmDoOutputFiles ( /******************************************************************************* * - * FUNCTION: CmDumpEvent + * FUNCTION: CmDumpAllEvents * - * PARAMETERS: Event - A compiler event struct + * PARAMETERS: None * * RETURN: None. * - * DESCRIPTION: Dump a compiler event struct + * DESCRIPTION: Dump all compiler events * ******************************************************************************/ static void -CmDumpEvent ( - ASL_EVENT_INFO *Event) +CmDumpAllEvents ( + void) { + ASL_EVENT_INFO *Event; UINT32 Delta; UINT32 USec; UINT32 MSec; + UINT32 i; + - if (!Event->Valid) + Event = AslGbl_Events; + + DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); + if (Gbl_CompileTimesFlag) { - return; + printf ("\nElapsed time for major events\n\n"); } - /* Delta will be in 100-nanosecond units */ + for (i = 0; i < AslGbl_NextEvent; i++) + { + if (Event->Valid) + { + /* Delta will be in 100-nanosecond units */ - Delta = (UINT32) (Event->EndTime - Event->StartTime); + Delta = (UINT32) (Event->EndTime - Event->StartTime); - USec = Delta / 10; - MSec = Delta / 10000; + USec = Delta / 10; + MSec = Delta / 10000; - /* Round milliseconds up */ + /* Round milliseconds up */ - if ((USec - (MSec * 1000)) >= 500) - { - MSec++; - } + if ((USec - (MSec * 1000)) >= 500) + { + MSec++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", + USec, MSec, Event->EventName); + + if (Gbl_CompileTimesFlag) + { + printf ("%8u usec %8u msec - %s\n", + USec, MSec, Event->EventName); + } + } - DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", - USec, MSec, Event->EventName); + Event++; + } } @@ -786,20 +810,12 @@ CmCleanupAndExit ( AePrintErrorLog (ASL_FILE_STDOUT); } - DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } + /* Emit compile times if enabled */ + + CmDumpAllEvents (); if (Gbl_CompileTimesFlag) { - printf ("\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } - printf ("\nMiscellaneous compile statistics\n\n"); printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslerror.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/compiler/aslerror.c Fri Jun 22 00:40:44 2012 (r237412) @@ -341,7 +341,7 @@ AePrintException ( if (Gbl_VerboseErrors) { - fprintf (OutputFile, "%s %4.4d - ", + fprintf (OutputFile, "%s %4.4d -", AslErrorLevel[Enode->Level], Enode->MessageId + ((Enode->Level+1) * 1000)); } Modified: head/sys/contrib/dev/acpica/compiler/aslfiles.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslfiles.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/compiler/aslfiles.c Fri Jun 22 00:40:44 2012 (r237412) @@ -754,7 +754,7 @@ FlOpenInputFile ( /* Open the input ASL file, text mode */ - FlOpenFile (ASL_FILE_INPUT, InputFilename, "r"); + FlOpenFile (ASL_FILE_INPUT, InputFilename, "rt"); AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; return (AE_OK); @@ -838,7 +838,7 @@ FlOpenMiscOutputFiles ( /* Open the hex file, text mode */ - FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_HEX_OUTPUT); AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT); @@ -889,7 +889,7 @@ FlOpenMiscOutputFiles ( /* Open the listing file, text mode */ - FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_LISTING_OUTPUT); AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); @@ -907,7 +907,7 @@ FlOpenMiscOutputFiles ( return (AE_ERROR); } - FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b"); + FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+t"); } /* All done for data table compiler */ @@ -952,7 +952,7 @@ FlOpenMiscOutputFiles ( /* Open the assembly code source file, text mode */ - FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT); AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT); @@ -972,7 +972,7 @@ FlOpenMiscOutputFiles ( /* Open the C code source file, text mode */ - FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+t"); FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n"); AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT); @@ -993,7 +993,7 @@ FlOpenMiscOutputFiles ( /* Open the assembly include file, text mode */ - FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT); AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT); @@ -1013,7 +1013,7 @@ FlOpenMiscOutputFiles ( /* Open the C include file, text mode */ - FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+t"); FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n"); AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT); @@ -1034,7 +1034,7 @@ FlOpenMiscOutputFiles ( /* Open the namespace file, text mode */ - FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT); AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); Modified: head/sys/contrib/dev/acpica/compiler/asllookup.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asllookup.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/compiler/asllookup.c Fri Jun 22 00:40:44 2012 (r237412) @@ -1098,7 +1098,7 @@ LkNamespaceLocateBegin ( if (Message) { - sprintf (MsgBuffer, "Tag: %u bit%s, Field: %u bit%s", + sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s", TagBitLength, (TagBitLength > 1) ? "s" : "", FieldBitLength, (FieldBitLength > 1) ? "s" : ""); Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmain.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/compiler/aslmain.c Fri Jun 22 00:40:44 2012 (r237412) @@ -63,7 +63,7 @@ Options ( void); static void -HelpMessage ( +FilenameHelp ( void); static void @@ -170,27 +170,36 @@ Options ( ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); printf ("\nHelp:\n"); - ACPI_OPTION ("-h", "Additional help and compiler debug options"); + ACPI_OPTION ("-h", "This message"); ACPI_OPTION ("-hc", "Display operators allowed in constant expressions"); + ACPI_OPTION ("-hf", "Display help for output filename generation"); ACPI_OPTION ("-hr", "Display ACPI reserved method names"); ACPI_OPTION ("-ht", "Display currently supported ACPI table names"); + + printf ("\nDebug Options:\n"); + ACPI_OPTION ("-bf -bt", "Create debug file (full or parse tree only) (*.txt)"); + ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); + ACPI_OPTION ("-n", "Parse only, no output generation"); + ACPI_OPTION ("-ot", "Display compile times and statistics"); + ACPI_OPTION ("-x ", "Set debug level for trace output"); + ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } /******************************************************************************* * - * FUNCTION: HelpMessage + * FUNCTION: FilenameHelp * * PARAMETERS: None * * RETURN: None * - * DESCRIPTION: Display help message + * DESCRIPTION: Display help message for output filename generation * ******************************************************************************/ static void -HelpMessage ( +FilenameHelp ( void) { @@ -202,17 +211,6 @@ HelpMessage ( printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); printf (" 3) The prefix of the input filename\n"); printf ("\n"); - - Options (); - - printf ("\nCompiler/Disassembler Debug Options:\n"); - ACPI_OPTION ("-bb -bp -bt", "Create compiler debug/trace file (*.txt)"); - ACPI_OPTION ("", "Types: Parse/Tree/Both"); - ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); - ACPI_OPTION ("-n", "Parse only, no output generation"); - ACPI_OPTION ("-ot", "Display compile times"); - ACPI_OPTION ("-x ", "Set debug level for trace output"); - ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } @@ -430,13 +428,7 @@ AslDoOptions ( case 'b': /* Debug output options */ switch (AcpiGbl_Optarg[0]) { - case 'b': - AslCompilerdebug = 1; /* same as yydebug */ - DtParserdebug = 1; - PrParserdebug = 1; - break; - - case 'p': + case 'f': AslCompilerdebug = 1; /* same as yydebug */ DtParserdebug = 1; PrParserdebug = 1; @@ -530,13 +522,17 @@ AslDoOptions ( switch (AcpiGbl_Optarg[0]) { case '^': - HelpMessage (); + Usage (); exit (0); case 'c': UtDisplayConstantOpcodes (); exit (0); + case 'f': + FilenameHelp (); + exit (0); + case 'r': /* reserved names */ Modified: head/sys/contrib/dev/acpica/compiler/aslsupport.l ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslsupport.l Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/compiler/aslsupport.l Fri Jun 22 00:40:44 2012 (r237412) @@ -92,19 +92,23 @@ static void AslDoLineDirective ( void) { - char c; + int c; char *Token; UINT32 LineNumber; char *Filename; + UINT32 i; /* Eat the entire line that contains the #line directive */ - while ((c = (char) input()) != '\n' && c != EOF) + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + + while ((c = input()) != '\n' && c != EOF) { - AslInsertLineBuffer (c); + *Gbl_LineBufPtr = c; + Gbl_LineBufPtr++; } - AslInsertLineBuffer (0); + *Gbl_LineBufPtr = 0; /* First argument is the actual line number */ @@ -114,10 +118,23 @@ AslDoLineDirective ( goto ResetAndExit; } - /* Convert line number. Subtract one to handle _this_ line */ + /* First argument is the line number */ LineNumber = (UINT32) UtDoConstant (Token); - FlSetLineNumber (LineNumber - 1); + + /* Emit the appropriate number of newlines */ + + Gbl_CurrentColumn = 0; + if (LineNumber > Gbl_CurrentLineNumber) + { + for (i = 0; i < (LineNumber - Gbl_CurrentLineNumber); i++) + { + FlWriteFile (ASL_FILE_SOURCE_OUTPUT, "\n", 1); + Gbl_CurrentColumn++; + } + } + + FlSetLineNumber (LineNumber); /* Second argument is the optional filename (in double quotes) */ @@ -132,7 +149,12 @@ AslDoLineDirective ( /* Third argument is not supported at this time */ ResetAndExit: - AslResetCurrentLineBuffer (); + + /* Reset globals for a new line */ + + Gbl_CurrentLineOffset += Gbl_CurrentColumn; + Gbl_CurrentColumn = 0; + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; } @@ -408,8 +430,8 @@ static char AslDoComment ( void) { - char c; - char c1 = 0; + int c; + int c1 = 0; AslInsertLineBuffer ('/'); @@ -419,7 +441,7 @@ loop: /* Eat chars until end-of-comment */ - while ((c = (char) input()) != '*' && c != EOF) + while ((c = input()) != '*' && c != EOF) { AslInsertLineBuffer (c); c1 = c; @@ -446,7 +468,7 @@ loop: AslInsertLineBuffer (c); - if ((c1 = (char) input()) != '/' && c1 != EOF) + if ((c1 = input()) != '/' && c1 != EOF) { unput(c1); goto loop; @@ -489,13 +511,13 @@ static char AslDoCommentType2 ( void) { - char c; + int c; AslInsertLineBuffer ('/'); AslInsertLineBuffer ('/'); - while ((c = (char) input()) != '\n' && c != EOF) + while ((c = input()) != '\n' && c != EOF) { AslInsertLineBuffer (c); } @@ -531,7 +553,7 @@ AslDoStringLiteral ( char *StringBuffer = MsgBuffer; char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; char *CleanString; - char StringChar; + int StringChar; UINT32 State = ASL_NORMAL_CHAR; UINT32 i = 0; UINT8 Digit; @@ -544,7 +566,7 @@ AslDoStringLiteral ( * source line buffer. */ AslInsertLineBuffer ('\"'); - while ((StringChar = (char) input()) != EOF) + while ((StringChar = input()) != EOF) { AslInsertLineBuffer (StringChar); Modified: head/sys/contrib/dev/acpica/compiler/aslutils.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslutils.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/compiler/aslutils.c Fri Jun 22 00:40:44 2012 (r237412) @@ -139,7 +139,7 @@ UtDisplaySupportedTables ( /******************************************************************************* * - * FUNCTION: AcpiPsDisplayConstantOpcodes + * FUNCTION: UtDisplayConstantOpcodes * * PARAMETERS: None * @@ -172,11 +172,11 @@ UtDisplayConstantOpcodes ( * * FUNCTION: UtLocalCalloc * - * PARAMETERS: Size - Bytes to be allocated + * PARAMETERS: Size - Bytes to be allocated * - * RETURN: Pointer to the allocated memory. Guaranteed to be valid. + * RETURN: Pointer to the allocated memory. Guaranteed to be valid. * - * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an + * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an * allocation failure, on the assumption that nothing more can be * accomplished. * @@ -211,9 +211,9 @@ UtLocalCalloc ( * * FUNCTION: UtBeginEvent * - * PARAMETERS: Name - Ascii name of this event + * PARAMETERS: Name - Ascii name of this event * - * RETURN: Event - Event number (integer index) + * RETURN: Event number (integer index) * * DESCRIPTION: Saves the current time with this event * @@ -244,7 +244,7 @@ UtBeginEvent ( * * FUNCTION: UtEndEvent * - * PARAMETERS: Event - Event number (integer index) + * PARAMETERS: Event - Event number (integer index) * * RETURN: None * @@ -254,7 +254,7 @@ UtBeginEvent ( void UtEndEvent ( - UINT8 Event) + UINT8 Event) { if (Event >= ASL_NUM_EVENTS) @@ -272,7 +272,7 @@ UtEndEvent ( * * FUNCTION: UtHexCharToValue * - * PARAMETERS: HexChar - Hex character in Ascii + * PARAMETERS: HexChar - Hex character in Ascii * * RETURN: The binary value of the hex character * @@ -303,12 +303,13 @@ UtHexCharToValue ( * * FUNCTION: UtConvertByteToHex * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored + * PARAMETERS: RawByte - Binary data + * Buffer - Pointer to where the hex bytes will be + * stored * * RETURN: Ascii hex byte is stored in Buffer. * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed * with "0x" * ******************************************************************************/ @@ -331,12 +332,13 @@ UtConvertByteToHex ( * * FUNCTION: UtConvertByteToAsmHex * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored + * PARAMETERS: RawByte - Binary data + * Buffer - Pointer to where the hex bytes will be + * stored * * RETURN: Ascii hex byte is stored in Buffer. * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed * with "0x" * ******************************************************************************/ @@ -358,13 +360,13 @@ UtConvertByteToAsmHex ( * * FUNCTION: DbgPrint * - * PARAMETERS: Type - Type of output - * Fmt - Printf format string - * ... - variable printf list + * PARAMETERS: Type - Type of output + * Fmt - Printf format string + * ... - variable printf list * * RETURN: None * - * DESCRIPTION: Conditional print statement. Prints to stderr only if the + * DESCRIPTION: Conditional print statement. Prints to stderr only if the * debug flag is set. * ******************************************************************************/ @@ -438,7 +440,7 @@ UtPrintFormattedName ( * * FUNCTION: UtSetParseOpName * - * PARAMETERS: Op + * PARAMETERS: Op - Parse op to be named. * * RETURN: None * @@ -460,7 +462,7 @@ UtSetParseOpName ( * * FUNCTION: UtDisplaySummary * - * PARAMETERS: FileID - ID of outpout file + * PARAMETERS: FileID - ID of outpout file * * RETURN: None * @@ -571,11 +573,11 @@ UtDisplaySummary ( /******************************************************************************* * - * FUNCTION: UtDisplaySummary + * FUNCTION: UtCheckIntegerRange * - * PARAMETERS: Op - Integer parse node - * LowValue - Smallest allowed value - * HighValue - Largest allowed value + * PARAMETERS: Op - Integer parse node + * LowValue - Smallest allowed value + * HighValue - Largest allowed value * * RETURN: Op if OK, otherwise NULL * @@ -626,11 +628,11 @@ UtCheckIntegerRange ( * * FUNCTION: UtGetStringBuffer * - * PARAMETERS: Length - Size of buffer requested + * PARAMETERS: Length - Size of buffer requested * - * RETURN: Pointer to the buffer. Aborts on allocation failure + * RETURN: Pointer to the buffer. Aborts on allocation failure * - * DESCRIPTION: Allocate a string buffer. Bypass the local + * DESCRIPTION: Allocate a string buffer. Bypass the local * dynamic memory manager for performance reasons (This has a * major impact on the speed of the compiler.) * @@ -661,8 +663,8 @@ UtGetStringBuffer ( * * FUNCTION: UtInternalizeName * - * PARAMETERS: ExternalName - Name to convert - * ConvertedName - Where the converted name is returned + * PARAMETERS: ExternalName - Name to convert + * ConvertedName - Where the converted name is returned * * RETURN: Status * @@ -714,8 +716,8 @@ UtInternalizeName ( * * FUNCTION: UtPadNameWithUnderscores * - * PARAMETERS: NameSeg - Input nameseg - * PaddedNameSeg - Output padded nameseg + * PARAMETERS: NameSeg - Input nameseg + * PaddedNameSeg - Output padded nameseg * * RETURN: Padded nameseg. * @@ -752,8 +754,8 @@ UtPadNameWithUnderscores ( * * FUNCTION: UtAttachNameseg * - * PARAMETERS: Op - Parent parse node - * Name - Full ExternalName + * PARAMETERS: Op - Parent parse node + * Name - Full ExternalName * * RETURN: None; Sets the NameSeg field in parent node * @@ -809,12 +811,12 @@ UtAttachNameseg ( * * FUNCTION: UtAttachNamepathToOwner * - * PARAMETERS: Op - Parent parse node - * NameOp - Node that contains the name + * PARAMETERS: Op - Parent parse node + * NameOp - Node that contains the name * * RETURN: Sets the ExternalName and Namepath in the parent node * - * DESCRIPTION: Store the name in two forms in the parent node: The original + * DESCRIPTION: Store the name in two forms in the parent node: The original * (external) name, and the internalized name that is used within * the ACPI namespace manager. * @@ -854,11 +856,11 @@ UtAttachNamepathToOwner ( * * FUNCTION: UtDoConstant * - * PARAMETERS: String - Hex, Octal, or Decimal string + * PARAMETERS: String - Hex, Octal, or Decimal string * * RETURN: Converted Integer * - * DESCRIPTION: Convert a string to an integer. With error checking. + * DESCRIPTION: Convert a string to an integer, with error checking. * ******************************************************************************/ @@ -889,10 +891,10 @@ UtDoConstant ( * * FUNCTION: UtStrtoul64 * - * PARAMETERS: String - Null terminated string - * Terminater - Where a pointer to the terminating byte is - * returned - * Base - Radix of the string + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte + * is returned + * Base - Radix of the string * * RETURN: Converted value * @@ -1072,5 +1074,3 @@ ErrorExit: return (Status); } - - Modified: head/sys/contrib/dev/acpica/compiler/dttemplate.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dttemplate.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/compiler/dttemplate.c Fri Jun 22 00:40:44 2012 (r237412) @@ -226,7 +226,7 @@ DtCreateAllTemplates ( } /* - * Create the "special ACPI tables: + * Create the special ACPI tables: * 1) DSDT/SSDT are AML tables, not data tables * 2) FACS and RSDP have non-standard headers */ Modified: head/sys/contrib/dev/acpica/components/debugger/dbdisply.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbdisply.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/components/debugger/dbdisply.c Fri Jun 22 00:40:44 2012 (r237412) @@ -792,10 +792,12 @@ AcpiDbDisplayGpes ( ACPI_GPE_EVENT_INFO *GpeEventInfo; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; char *GpeType; + ACPI_GPE_NOTIFY_INFO *Notify; UINT32 GpeIndex; UINT32 Block = 0; UINT32 i; UINT32 j; + UINT32 Count; char Buffer[80]; ACPI_BUFFER RetBuf; ACPI_STATUS Status; @@ -916,7 +918,14 @@ AcpiDbDisplayGpes ( AcpiOsPrintf ("Handler"); break; case ACPI_GPE_DISPATCH_NOTIFY: - AcpiOsPrintf ("Notify"); + Count = 0; + Notify = GpeEventInfo->Dispatch.NotifyList; + while (Notify) + { + Count++; + Notify = Notify->Next; + } + AcpiOsPrintf ("Implicit Notify on %u devices", Count); break; default: AcpiOsPrintf ("UNKNOWN: %X", Modified: head/sys/contrib/dev/acpica/components/debugger/dbexec.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbexec.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/components/debugger/dbexec.c Fri Jun 22 00:40:44 2012 (r237412) @@ -872,8 +872,8 @@ AcpiDbMethodThread ( if (Info->InitArgs) { - AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr); - AcpiDbUInt32ToHexString ((UINT32) AcpiOsGetThreadId (), Info->IdOfThreadStr); + AcpiDbUint32ToHexString (Info->NumCreated, Info->IndexOfThreadStr); + AcpiDbUint32ToHexString ((UINT32) AcpiOsGetThreadId (), Info->IdOfThreadStr); } if (Info->Threads && (Info->NumCreated < Info->NumThreads)) @@ -1063,7 +1063,7 @@ AcpiDbCreateExecutionThreads ( AcpiGbl_DbMethodInfo.ArgTypes[1] = ACPI_TYPE_INTEGER; AcpiGbl_DbMethodInfo.ArgTypes[2] = ACPI_TYPE_INTEGER; - AcpiDbUInt32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr); + AcpiDbUint32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr); AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); Modified: head/sys/contrib/dev/acpica/components/debugger/dbutils.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbutils.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/components/debugger/dbutils.c Fri Jun 22 00:40:44 2012 (r237412) @@ -360,7 +360,7 @@ AcpiDbLocalNsLookup ( /******************************************************************************* * - * FUNCTION: AcpiDbUInt32ToHexString + * FUNCTION: AcpiDbUint32ToHexString * * PARAMETERS: Value - The value to be converted to string * Buffer - Buffer for result (not less than 11 bytes) @@ -375,7 +375,7 @@ AcpiDbLocalNsLookup ( ******************************************************************************/ void -AcpiDbUInt32ToHexString ( +AcpiDbUint32ToHexString ( UINT32 Value, char *Buffer) { Modified: head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c ============================================================================== --- head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c Thu Jun 21 22:06:57 2012 (r237411) +++ head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c Fri Jun 22 00:40:44 2012 (r237412) @@ -46,6 +46,7 @@ #include #include #include +#include #ifdef ACPI_DISASSEMBLER @@ -61,6 +62,218 @@ AcpiDmMatchKeyword ( /******************************************************************************* * + * FUNCTION: AcpiDmPredefinedDescription + * + * PARAMETERS: Op - Name() parse object + * + * RETURN: None + * + * DESCRIPTION: Emit a description comment for a predefined ACPI name. + * Used for iASL compiler only. + * + ******************************************************************************/ + +void +AcpiDmPredefinedDescription ( + ACPI_PARSE_OBJECT *Op) +{ +#ifdef ACPI_ASL_COMPILER + const AH_PREDEFINED_NAME *Info; + char *NameString; + int LastCharIsDigit; + int LastCharsAreHex; + + + if (!Op) + { + return; + } + + /* Ensure that the comment field is emitted only once */ + + if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED) + { + return; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:01:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B9B41065672; Fri, 22 Jun 2012 05:01:37 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E187A8FC0C; Fri, 22 Jun 2012 05:01:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M51aJl056506; Fri, 22 Jun 2012 05:01:36 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M51aPw056504; Fri, 22 Jun 2012 05:01:36 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206220501.q5M51aPw056504@svn.freebsd.org> From: Alan Cox Date: Fri, 22 Jun 2012 05:01:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237414 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:01:37 -0000 Author: alc Date: Fri Jun 22 05:01:36 2012 New Revision: 237414 URL: http://svn.freebsd.org/changeset/base/237414 Log: Introduce CHANGE_PV_LIST_LOCK_TO_{PHYS,VM_PAGE}() to avoid duplication of code. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Jun 22 00:41:37 2012 (r237413) +++ head/sys/amd64/amd64/pmap.c Fri Jun 22 05:01:36 2012 (r237414) @@ -173,6 +173,22 @@ __FBSDID("$FreeBSD$"); #define PHYS_TO_PV_LIST_LOCK(pa) \ (&pv_list_locks[pa_index(pa) % NPV_LIST_LOCKS]) +#define CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa) do { \ + struct rwlock **_lockp = (lockp); \ + struct rwlock *_new_lock; \ + \ + _new_lock = PHYS_TO_PV_LIST_LOCK(pa); \ + if (_new_lock != *_lockp) { \ + if (*_lockp != NULL) \ + rw_wunlock(*_lockp); \ + *_lockp = _new_lock; \ + rw_wlock(*_lockp); \ + } \ +} while (0) + +#define CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m) \ + CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, VM_PAGE_TO_PHYS(m)) + #define VM_PAGE_TO_PV_LIST_LOCK(m) \ PHYS_TO_PV_LIST_LOCK(VM_PAGE_TO_PHYS(m)) @@ -2436,20 +2452,13 @@ static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m, struct rwlock **lockp) { - struct rwlock *new_lock; pv_entry_t pv; rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; - new_lock = VM_PAGE_TO_PV_LIST_LOCK(m); - if (new_lock != *lockp) { - if (*lockp != NULL) - rw_wunlock(*lockp); - *lockp = new_lock; - rw_wlock(*lockp); - } + CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); return (TRUE); } else @@ -2464,19 +2473,12 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse struct rwlock **lockp) { struct md_page *pvh; - struct rwlock *new_lock; pv_entry_t pv; rw_assert(&pvh_global_lock, RA_LOCKED); if ((pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; - new_lock = PHYS_TO_PV_LIST_LOCK(pa); - if (new_lock != *lockp) { - if (*lockp != NULL) - rw_wunlock(*lockp); - *lockp = new_lock; - rw_wlock(*lockp); - } + CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa); pvh = pa_to_pvh(pa); TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list); return (TRUE); @@ -4159,7 +4161,7 @@ pmap_remove_pages(pmap_t pmap) pv_entry_t pv; struct md_page *pvh; struct pv_chunk *pc, *npc; - struct rwlock *lock, *new_lock; + struct rwlock *lock; int64_t bit; uint64_t inuse, bitmask; int allfree, field, freed, idx; @@ -4229,13 +4231,7 @@ pmap_remove_pages(pmap_t pmap) vm_page_dirty(m); } - new_lock = VM_PAGE_TO_PV_LIST_LOCK(m); - if (new_lock != lock) { - if (lock != NULL) - rw_wunlock(lock); - lock = new_lock; - rw_wlock(lock); - } + CHANGE_PV_LIST_LOCK_TO_VM_PAGE(&lock, m); /* Mark free */ pc->pc_map[field] |= bitmask; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:23:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89DAE106564A; Fri, 22 Jun 2012 05:23:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 398B48FC0A; Fri, 22 Jun 2012 05:23:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5NeJq057463; Fri, 22 Jun 2012 05:23:40 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5Neeg057461; Fri, 22 Jun 2012 05:23:40 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220523.q5M5Neeg057461@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:23:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237415 - stable/9/usr.sbin/kldxref X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:23:40 -0000 Author: eadler Date: Fri Jun 22 05:23:39 2012 New Revision: 237415 URL: http://svn.freebsd.org/changeset/base/237415 Log: MFC r237258: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/kldxref/ef.c Directory Properties: stable/9/usr.sbin/kldxref/ (props changed) Modified: stable/9/usr.sbin/kldxref/ef.c ============================================================================== --- stable/9/usr.sbin/kldxref/ef.c Fri Jun 22 05:01:36 2012 (r237414) +++ stable/9/usr.sbin/kldxref/ef.c Fri Jun 22 05:23:39 2012 (r237415) @@ -532,7 +532,7 @@ ef_open(const char *filename, struct elf int error; int phlen, res; int nsegs; - Elf_Phdr *phdr, *phdyn, *phphdr, *phlimit; + Elf_Phdr *phdr, *phdyn, *phlimit; if (filename == NULL) return EFTYPE; @@ -576,7 +576,6 @@ ef_open(const char *filename, struct elf phlimit = phdr + hdr->e_phnum; nsegs = 0; phdyn = NULL; - phphdr = NULL; while (phdr < phlimit) { if (verbose > 1) ef_print_phdr(phdr); @@ -590,7 +589,6 @@ ef_open(const char *filename, struct elf ef->ef_segs[nsegs++] = phdr; break; case PT_PHDR: - phphdr = phdr; break; case PT_DYNAMIC: phdyn = phdr; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:23:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EBCD110657A3; Fri, 22 Jun 2012 05:23:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D60EA8FC0A; Fri, 22 Jun 2012 05:23:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5Nnc6057534; Fri, 22 Jun 2012 05:23:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5Nnd0057532; Fri, 22 Jun 2012 05:23:49 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220523.q5M5Nnd0057532@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237416 - stable/8/usr.sbin/kldxref X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:23:50 -0000 Author: eadler Date: Fri Jun 22 05:23:49 2012 New Revision: 237416 URL: http://svn.freebsd.org/changeset/base/237416 Log: MFC r237258: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/kldxref/ef.c Directory Properties: stable/8/usr.sbin/kldxref/ (props changed) Modified: stable/8/usr.sbin/kldxref/ef.c ============================================================================== --- stable/8/usr.sbin/kldxref/ef.c Fri Jun 22 05:23:39 2012 (r237415) +++ stable/8/usr.sbin/kldxref/ef.c Fri Jun 22 05:23:49 2012 (r237416) @@ -532,7 +532,7 @@ ef_open(const char *filename, struct elf int error; int phlen, res; int nsegs; - Elf_Phdr *phdr, *phdyn, *phphdr, *phlimit; + Elf_Phdr *phdr, *phdyn, *phlimit; if (filename == NULL) return EFTYPE; @@ -576,7 +576,6 @@ ef_open(const char *filename, struct elf phlimit = phdr + hdr->e_phnum; nsegs = 0; phdyn = NULL; - phphdr = NULL; while (phdr < phlimit) { if (verbose > 1) ef_print_phdr(phdr); @@ -590,7 +589,6 @@ ef_open(const char *filename, struct elf ef->ef_segs[nsegs++] = phdr; break; case PT_PHDR: - phphdr = phdr; break; case PT_DYNAMIC: phdyn = phdr; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:23:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FB2D10657A4; Fri, 22 Jun 2012 05:23:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE5278FC0C; Fri, 22 Jun 2012 05:23:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5NnGZ057538; Fri, 22 Jun 2012 05:23:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5NnqV057536; Fri, 22 Jun 2012 05:23:49 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220523.q5M5NnqV057536@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237417 - stable/7/usr.sbin/kldxref X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:23:50 -0000 Author: eadler Date: Fri Jun 22 05:23:49 2012 New Revision: 237417 URL: http://svn.freebsd.org/changeset/base/237417 Log: MFC r237258: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva (implicit) Modified: stable/7/usr.sbin/kldxref/ef.c Directory Properties: stable/7/usr.sbin/kldxref/ (props changed) Modified: stable/7/usr.sbin/kldxref/ef.c ============================================================================== --- stable/7/usr.sbin/kldxref/ef.c Fri Jun 22 05:23:49 2012 (r237416) +++ stable/7/usr.sbin/kldxref/ef.c Fri Jun 22 05:23:49 2012 (r237417) @@ -532,7 +532,7 @@ ef_open(const char *filename, struct elf int error; int phlen, res; int nsegs; - Elf_Phdr *phdr, *phdyn, *phphdr, *phlimit; + Elf_Phdr *phdr, *phdyn, *phlimit; if (filename == NULL) return EFTYPE; @@ -576,7 +576,6 @@ ef_open(const char *filename, struct elf phlimit = phdr + hdr->e_phnum; nsegs = 0; phdyn = NULL; - phphdr = NULL; while (phdr < phlimit) { if (verbose > 1) ef_print_phdr(phdr); @@ -590,7 +589,6 @@ ef_open(const char *filename, struct elf ef->ef_segs[nsegs++] = phdr; break; case PT_PHDR: - phphdr = phdr; break; case PT_DYNAMIC: phdyn = phdr; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:36:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 461C11065672; Fri, 22 Jun 2012 05:36:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2654B8FC08; Fri, 22 Jun 2012 05:36:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5acfh058228; Fri, 22 Jun 2012 05:36:38 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5abqv058225; Fri, 22 Jun 2012 05:36:37 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220536.q5M5abqv058225@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237418 - in stable/7: lib/libncp sys/netncp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:36:38 -0000 Author: eadler Date: Fri Jun 22 05:36:37 2012 New Revision: 237418 URL: http://svn.freebsd.org/changeset/base/237418 Log: MFC r236376: Add characters mapping for codepages used in Germany. PR: bin/163847 Approved by: cperciva (implicit) Modified: stable/7/lib/libncp/ncpl_nls.c stable/7/sys/netncp/ncp_nls.h Directory Properties: stable/7/lib/libncp/ (props changed) stable/7/sys/ (props changed) Modified: stable/7/lib/libncp/ncpl_nls.c ============================================================================== --- stable/7/lib/libncp/ncpl_nls.c Fri Jun 22 05:23:49 2012 (r237417) +++ stable/7/lib/libncp/ncpl_nls.c Fri Jun 22 05:36:37 2012 (r237418) @@ -200,6 +200,79 @@ static u_int8_t se_unix2nw[] = { 0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a }; +/* + * Characters mapping for codepages used in Germany. + */ +static u_int8_t de_nw2unix[] = { + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x00 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0xb6, 0xa7, 0x5f, 0x5f, /* 0x10 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7, /* 0x80 */ + 0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5, + 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9, /* 0x90 */ + 0xff, 0xd6, 0xdc, 0xa2, 0xa3, 0xa5, 0x5f, 0x5f, + 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba, /* 0xA0 */ + 0xbf, 0x5f, 0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xB0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xC0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xD0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0xdf, 0x5f, 0x5f, 0x5f, 0x5f, 0xb5, 0x5f, /* 0xE0 */ + 0x5f, 0x5f, 0x5f, 0xf0, 0x5f, 0xf8, 0x5f, 0x5f, + 0x5f, 0xb1, 0x5f, 0x5f, 0x5f, 0x5f, 0xf7, 0x5f, /* 0xF0 */ + 0xb0, 0x5f, 0xb7, 0x5f, 0x5f, 0xb2, 0x5f, 0xa0 +}; + +static u_int8_t de_unix2nw[] = { + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x00 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x10 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x80 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x90 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0xff, 0xad, 0x9b, 0x9c, 0x5f, 0x9d, 0x5f, 0x15, /* 0xA0 */ + 0x5f, 0x5f, 0xa6, 0xae, 0xaa, 0x5f, 0x5f, 0x5f, + 0xf8, 0xf1, 0xfd, 0x5f, 0x5f, 0xe6, 0x14, 0xfa, /* 0xB0 */ + 0x5f, 0x5f, 0xa7, 0xaf, 0xac, 0xab, 0x5f, 0xa8, + 0x5f, 0x5f, 0x5f, 0x5f, 0x8e, 0x8f, 0x92, 0x80, /* 0xC0 */ + 0x5f, 0x90, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0xa5, 0x5f, 0x5f, 0x5f, 0x5f, 0x99, 0x5f, /* 0xD0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x9a, 0x5f, 0x5f, 0xe1, + 0x85, 0xa0, 0x83, 0x5f, 0x84, 0x86, 0x91, 0x87, /* 0xE0 */ + 0x8a, 0x82, 0x88, 0x89, 0x8d, 0xa1, 0x8c, 0x8b, + 0xeb, 0xa4, 0x95, 0xa2, 0x93, 0x5f, 0x94, 0xf6, /* 0xF0 */ + 0xed, 0x97, 0xa3, 0x96, 0x81, 0x5f, 0x5f, 0x98 +}; + static u_int8_t def2lower[256]; static u_int8_t def2upper[256]; @@ -225,6 +298,9 @@ static struct ncp_nlsdesc ncp_nlslist[] {NCP_NLS_SE, NCP_NLS_SE_NAME, {def2lower, def2upper, se_nw2unix, se_unix2nw, 0} }, + {NCP_NLS_DE, NCP_NLS_DE_NAME, + {def2lower, def2upper, de_nw2unix, de_unix2nw, 0} + }, {0} }; Modified: stable/7/sys/netncp/ncp_nls.h ============================================================================== --- stable/7/sys/netncp/ncp_nls.h Fri Jun 22 05:23:49 2012 (r237417) +++ stable/7/sys/netncp/ncp_nls.h Fri Jun 22 05:36:37 2012 (r237418) @@ -58,9 +58,11 @@ struct ncp_nlstables { #define NCP_NLS_AS_IS 1 #define NCP_NLS_AS_IS_NAME "asis" #define NCP_NLS_KOI_866 2 -#define NCP_NLS_SE 3 #define NCP_NLS_KOI_866_NAME "koi2cp866" +#define NCP_NLS_SE 3 #define NCP_NLS_SE_NAME "se" +#define NCP_NLS_DE 4 +#define NCP_NLS_DE_NAME "de" extern struct ncp_nlstables ncp_nls; /* active nls */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:36:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 71BDD1065673; Fri, 22 Jun 2012 05:36:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51ECA8FC16; Fri, 22 Jun 2012 05:36:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5ahLG058269; Fri, 22 Jun 2012 05:36:43 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5ahAb058266; Fri, 22 Jun 2012 05:36:43 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220536.q5M5ahAb058266@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:36:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237419 - in stable/8: lib/libncp sys/netncp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:36:43 -0000 Author: eadler Date: Fri Jun 22 05:36:42 2012 New Revision: 237419 URL: http://svn.freebsd.org/changeset/base/237419 Log: MFC r236376: Add characters mapping for codepages used in Germany. PR: bin/163847 Approved by: cperciva (implicit) Modified: stable/8/lib/libncp/ncpl_nls.c stable/8/sys/netncp/ncp_nls.h Directory Properties: stable/8/lib/libncp/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/lib/libncp/ncpl_nls.c ============================================================================== --- stable/8/lib/libncp/ncpl_nls.c Fri Jun 22 05:36:37 2012 (r237418) +++ stable/8/lib/libncp/ncpl_nls.c Fri Jun 22 05:36:42 2012 (r237419) @@ -200,6 +200,79 @@ static u_int8_t se_unix2nw[] = { 0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a }; +/* + * Characters mapping for codepages used in Germany. + */ +static u_int8_t de_nw2unix[] = { + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x00 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0xb6, 0xa7, 0x5f, 0x5f, /* 0x10 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7, /* 0x80 */ + 0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5, + 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9, /* 0x90 */ + 0xff, 0xd6, 0xdc, 0xa2, 0xa3, 0xa5, 0x5f, 0x5f, + 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba, /* 0xA0 */ + 0xbf, 0x5f, 0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xB0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xC0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xD0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0xdf, 0x5f, 0x5f, 0x5f, 0x5f, 0xb5, 0x5f, /* 0xE0 */ + 0x5f, 0x5f, 0x5f, 0xf0, 0x5f, 0xf8, 0x5f, 0x5f, + 0x5f, 0xb1, 0x5f, 0x5f, 0x5f, 0x5f, 0xf7, 0x5f, /* 0xF0 */ + 0xb0, 0x5f, 0xb7, 0x5f, 0x5f, 0xb2, 0x5f, 0xa0 +}; + +static u_int8_t de_unix2nw[] = { + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x00 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x10 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x80 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x90 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0xff, 0xad, 0x9b, 0x9c, 0x5f, 0x9d, 0x5f, 0x15, /* 0xA0 */ + 0x5f, 0x5f, 0xa6, 0xae, 0xaa, 0x5f, 0x5f, 0x5f, + 0xf8, 0xf1, 0xfd, 0x5f, 0x5f, 0xe6, 0x14, 0xfa, /* 0xB0 */ + 0x5f, 0x5f, 0xa7, 0xaf, 0xac, 0xab, 0x5f, 0xa8, + 0x5f, 0x5f, 0x5f, 0x5f, 0x8e, 0x8f, 0x92, 0x80, /* 0xC0 */ + 0x5f, 0x90, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0xa5, 0x5f, 0x5f, 0x5f, 0x5f, 0x99, 0x5f, /* 0xD0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x9a, 0x5f, 0x5f, 0xe1, + 0x85, 0xa0, 0x83, 0x5f, 0x84, 0x86, 0x91, 0x87, /* 0xE0 */ + 0x8a, 0x82, 0x88, 0x89, 0x8d, 0xa1, 0x8c, 0x8b, + 0xeb, 0xa4, 0x95, 0xa2, 0x93, 0x5f, 0x94, 0xf6, /* 0xF0 */ + 0xed, 0x97, 0xa3, 0x96, 0x81, 0x5f, 0x5f, 0x98 +}; + static u_int8_t def2lower[256]; static u_int8_t def2upper[256]; @@ -225,6 +298,9 @@ static struct ncp_nlsdesc ncp_nlslist[] {NCP_NLS_SE, NCP_NLS_SE_NAME, {def2lower, def2upper, se_nw2unix, se_unix2nw, 0} }, + {NCP_NLS_DE, NCP_NLS_DE_NAME, + {def2lower, def2upper, de_nw2unix, de_unix2nw, 0} + }, {0} }; Modified: stable/8/sys/netncp/ncp_nls.h ============================================================================== --- stable/8/sys/netncp/ncp_nls.h Fri Jun 22 05:36:37 2012 (r237418) +++ stable/8/sys/netncp/ncp_nls.h Fri Jun 22 05:36:42 2012 (r237419) @@ -58,9 +58,11 @@ struct ncp_nlstables { #define NCP_NLS_AS_IS 1 #define NCP_NLS_AS_IS_NAME "asis" #define NCP_NLS_KOI_866 2 -#define NCP_NLS_SE 3 #define NCP_NLS_KOI_866_NAME "koi2cp866" +#define NCP_NLS_SE 3 #define NCP_NLS_SE_NAME "se" +#define NCP_NLS_DE 4 +#define NCP_NLS_DE_NAME "de" extern struct ncp_nlstables ncp_nls; /* active nls */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:36:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5CE31065674; Fri, 22 Jun 2012 05:36:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5FAD8FC14; Fri, 22 Jun 2012 05:36:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5ao5j058311; Fri, 22 Jun 2012 05:36:50 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5aoru058308; Fri, 22 Jun 2012 05:36:50 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220536.q5M5aoru058308@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237420 - in stable/9: lib/libncp sys/netncp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:36:50 -0000 Author: eadler Date: Fri Jun 22 05:36:50 2012 New Revision: 237420 URL: http://svn.freebsd.org/changeset/base/237420 Log: MFC r236376: Add characters mapping for codepages used in Germany. PR: bin/163847 Approved by: cperciva (implicit) Modified: stable/9/lib/libncp/ncpl_nls.c stable/9/sys/netncp/ncp_nls.h Directory Properties: stable/9/lib/libncp/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/lib/libncp/ncpl_nls.c ============================================================================== --- stable/9/lib/libncp/ncpl_nls.c Fri Jun 22 05:36:42 2012 (r237419) +++ stable/9/lib/libncp/ncpl_nls.c Fri Jun 22 05:36:50 2012 (r237420) @@ -200,6 +200,79 @@ static u_int8_t se_unix2nw[] = { 0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a }; +/* + * Characters mapping for codepages used in Germany. + */ +static u_int8_t de_nw2unix[] = { + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x00 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0xb6, 0xa7, 0x5f, 0x5f, /* 0x10 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7, /* 0x80 */ + 0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5, + 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9, /* 0x90 */ + 0xff, 0xd6, 0xdc, 0xa2, 0xa3, 0xa5, 0x5f, 0x5f, + 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba, /* 0xA0 */ + 0xbf, 0x5f, 0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xB0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xC0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0xD0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0xdf, 0x5f, 0x5f, 0x5f, 0x5f, 0xb5, 0x5f, /* 0xE0 */ + 0x5f, 0x5f, 0x5f, 0xf0, 0x5f, 0xf8, 0x5f, 0x5f, + 0x5f, 0xb1, 0x5f, 0x5f, 0x5f, 0x5f, 0xf7, 0x5f, /* 0xF0 */ + 0xb0, 0x5f, 0xb7, 0x5f, 0x5f, 0xb2, 0x5f, 0xa0 +}; + +static u_int8_t de_unix2nw[] = { + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x00 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x10 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x80 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x90 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0xff, 0xad, 0x9b, 0x9c, 0x5f, 0x9d, 0x5f, 0x15, /* 0xA0 */ + 0x5f, 0x5f, 0xa6, 0xae, 0xaa, 0x5f, 0x5f, 0x5f, + 0xf8, 0xf1, 0xfd, 0x5f, 0x5f, 0xe6, 0x14, 0xfa, /* 0xB0 */ + 0x5f, 0x5f, 0xa7, 0xaf, 0xac, 0xab, 0x5f, 0xa8, + 0x5f, 0x5f, 0x5f, 0x5f, 0x8e, 0x8f, 0x92, 0x80, /* 0xC0 */ + 0x5f, 0x90, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, + 0x5f, 0xa5, 0x5f, 0x5f, 0x5f, 0x5f, 0x99, 0x5f, /* 0xD0 */ + 0x5f, 0x5f, 0x5f, 0x5f, 0x9a, 0x5f, 0x5f, 0xe1, + 0x85, 0xa0, 0x83, 0x5f, 0x84, 0x86, 0x91, 0x87, /* 0xE0 */ + 0x8a, 0x82, 0x88, 0x89, 0x8d, 0xa1, 0x8c, 0x8b, + 0xeb, 0xa4, 0x95, 0xa2, 0x93, 0x5f, 0x94, 0xf6, /* 0xF0 */ + 0xed, 0x97, 0xa3, 0x96, 0x81, 0x5f, 0x5f, 0x98 +}; + static u_int8_t def2lower[256]; static u_int8_t def2upper[256]; @@ -225,6 +298,9 @@ static struct ncp_nlsdesc ncp_nlslist[] {NCP_NLS_SE, NCP_NLS_SE_NAME, {def2lower, def2upper, se_nw2unix, se_unix2nw, 0} }, + {NCP_NLS_DE, NCP_NLS_DE_NAME, + {def2lower, def2upper, de_nw2unix, de_unix2nw, 0} + }, {0} }; Modified: stable/9/sys/netncp/ncp_nls.h ============================================================================== --- stable/9/sys/netncp/ncp_nls.h Fri Jun 22 05:36:42 2012 (r237419) +++ stable/9/sys/netncp/ncp_nls.h Fri Jun 22 05:36:50 2012 (r237420) @@ -52,9 +52,11 @@ struct ncp_nlstables { #define NCP_NLS_AS_IS 1 #define NCP_NLS_AS_IS_NAME "asis" #define NCP_NLS_KOI_866 2 -#define NCP_NLS_SE 3 #define NCP_NLS_KOI_866_NAME "koi2cp866" +#define NCP_NLS_SE 3 #define NCP_NLS_SE_NAME "se" +#define NCP_NLS_DE 4 +#define NCP_NLS_DE_NAME "de" extern struct ncp_nlstables ncp_nls; /* active nls */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:40:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9171E1065670; Fri, 22 Jun 2012 05:40:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7BE868FC16; Fri, 22 Jun 2012 05:40:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5eFSs058567; Fri, 22 Jun 2012 05:40:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5eFMK058564; Fri, 22 Jun 2012 05:40:15 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220540.q5M5eFMK058564@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237421 - stable/9/usr.sbin/kbdmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:40:15 -0000 Author: eadler Date: Fri Jun 22 05:40:14 2012 New Revision: 237421 URL: http://svn.freebsd.org/changeset/base/237421 Log: MFC r237257: Remove variables which are initialized but never used thereafter reported by gcc46 warning PR: bin/163847 Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/kbdmap/kbdmap.c Directory Properties: stable/9/usr.sbin/kbdmap/ (props changed) Modified: stable/9/usr.sbin/kbdmap/kbdmap.c ============================================================================== --- stable/9/usr.sbin/kbdmap/kbdmap.c Fri Jun 22 05:36:50 2012 (r237420) +++ stable/9/usr.sbin/kbdmap/kbdmap.c Fri Jun 22 05:40:14 2012 (r237421) @@ -327,7 +327,6 @@ show_dialog(struct keymap **km_sorted, i FILE *fp; char *cmd, *dialog; char tmp_name[] = "/tmp/_kbd_lang.XXXX"; - const char *ext; int fd, i, size; fd = mkstemp(tmp_name); @@ -339,8 +338,6 @@ show_dialog(struct keymap **km_sorted, i asprintf(&dialog, "/usr/bin/dialog --clear --title \"Keyboard Menu\" " "--menu \"%s\" 0 0 0", menu); - ext = extract_name(dir); - /* start right font, assume that current font is equal * to default font in /etc/rc.conf * From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:40:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BA31106564A; Fri, 22 Jun 2012 05:40:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16DED8FC18; Fri, 22 Jun 2012 05:40:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5eFk8058588; Fri, 22 Jun 2012 05:40:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5eFAG058586; Fri, 22 Jun 2012 05:40:15 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220540.q5M5eFAG058586@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237422 - stable/7/usr.sbin/kbdmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:40:16 -0000 Author: eadler Date: Fri Jun 22 05:40:15 2012 New Revision: 237422 URL: http://svn.freebsd.org/changeset/base/237422 Log: MFC r237257: Remove variables which are initialized but never used thereafter reported by gcc46 warning PR: bin/163847 Approved by: cperciva (implicit) Modified: stable/7/usr.sbin/kbdmap/kbdmap.c Directory Properties: stable/7/usr.sbin/kbdmap/ (props changed) Modified: stable/7/usr.sbin/kbdmap/kbdmap.c ============================================================================== --- stable/7/usr.sbin/kbdmap/kbdmap.c Fri Jun 22 05:40:14 2012 (r237421) +++ stable/7/usr.sbin/kbdmap/kbdmap.c Fri Jun 22 05:40:15 2012 (r237422) @@ -327,7 +327,6 @@ show_dialog(struct keymap **km_sorted, i FILE *fp; char *cmd, *dialog; char tmp_name[] = "/tmp/_kbd_lang.XXXX"; - const char *ext; int fd, i, size; fd = mkstemp(tmp_name); @@ -339,8 +338,6 @@ show_dialog(struct keymap **km_sorted, i asprintf(&dialog, "/usr/bin/dialog --clear --title \"Keyboard Menu\" " "--menu \"%s\" -1 -1 10", menu); - ext = extract_name(dir); - /* start right font, assume that current font is equal * to default font in /etc/rc.conf * From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:40:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66C3F106566B; Fri, 22 Jun 2012 05:40:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5181C8FC19; Fri, 22 Jun 2012 05:40:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5eGKe058602; Fri, 22 Jun 2012 05:40:16 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5eGq9058600; Fri, 22 Jun 2012 05:40:16 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220540.q5M5eGq9058600@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237423 - stable/8/usr.sbin/kbdmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:40:16 -0000 Author: eadler Date: Fri Jun 22 05:40:15 2012 New Revision: 237423 URL: http://svn.freebsd.org/changeset/base/237423 Log: MFC r237257: Remove variables which are initialized but never used thereafter reported by gcc46 warning PR: bin/163847 Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/kbdmap/kbdmap.c Directory Properties: stable/8/usr.sbin/kbdmap/ (props changed) Modified: stable/8/usr.sbin/kbdmap/kbdmap.c ============================================================================== --- stable/8/usr.sbin/kbdmap/kbdmap.c Fri Jun 22 05:40:15 2012 (r237422) +++ stable/8/usr.sbin/kbdmap/kbdmap.c Fri Jun 22 05:40:15 2012 (r237423) @@ -327,7 +327,6 @@ show_dialog(struct keymap **km_sorted, i FILE *fp; char *cmd, *dialog; char tmp_name[] = "/tmp/_kbd_lang.XXXX"; - const char *ext; int fd, i, size; fd = mkstemp(tmp_name); @@ -339,8 +338,6 @@ show_dialog(struct keymap **km_sorted, i asprintf(&dialog, "/usr/bin/dialog --clear --title \"Keyboard Menu\" " "--menu \"%s\" -1 -1 10", menu); - ext = extract_name(dir); - /* start right font, assume that current font is equal * to default font in /etc/rc.conf * From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:42:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DCAB1065676; Fri, 22 Jun 2012 05:42:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18A0E8FC18; Fri, 22 Jun 2012 05:42:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5g5T3058740; Fri, 22 Jun 2012 05:42:05 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5g5e4058738; Fri, 22 Jun 2012 05:42:05 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220542.q5M5g5e4058738@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237424 - stable/9/usr.sbin/crunch/crunchide X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:42:06 -0000 Author: eadler Date: Fri Jun 22 05:42:05 2012 New Revision: 237424 URL: http://svn.freebsd.org/changeset/base/237424 Log: MFC r237254: Remove variables which are initialized but never used thereafter reported by gcc46 warning PR: bin/163847 Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/crunch/crunchide/exec_elf32.c Directory Properties: stable/9/usr.sbin/crunch/ (props changed) Modified: stable/9/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- stable/9/usr.sbin/crunch/crunchide/exec_elf32.c Fri Jun 22 05:40:15 2012 (r237423) +++ stable/9/usr.sbin/crunch/crunchide/exec_elf32.c Fri Jun 22 05:42:05 2012 (r237424) @@ -238,7 +238,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr; Elf_Sym *symtabp = NULL; char *strtabp = NULL; - Elf_Size nsyms, nlocalsyms, ewi; + Elf_Size nsyms, ewi; ssize_t shdrsize; int rv, i, weird; size_t nstrtab_size, nstrtab_nextoff, fn_size; @@ -327,7 +327,6 @@ ELFNAMEEND(hide)(int fd, const char *fn) /* Prepare data structures for symbol movement. */ nsyms = xewtoh(symtabshdr->sh_size) / xewtoh(symtabshdr->sh_entsize); - nlocalsyms = xe32toh(symtabshdr->sh_info); /* move symbols, making them local */ for (ewi = 0; ewi < nsyms; ewi++) { From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:44:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5E371065675; Fri, 22 Jun 2012 05:44:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C14298FC21; Fri, 22 Jun 2012 05:44:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5icMd058907; Fri, 22 Jun 2012 05:44:38 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5icGh058905; Fri, 22 Jun 2012 05:44:38 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220544.q5M5icGh058905@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237425 - stable/9/usr.sbin/ctladm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:44:39 -0000 Author: eadler Date: Fri Jun 22 05:44:38 2012 New Revision: 237425 URL: http://svn.freebsd.org/changeset/base/237425 Log: MFC r237255: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/ctladm/ctladm.c Directory Properties: stable/9/usr.sbin/ctladm/ (props changed) Modified: stable/9/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/9/usr.sbin/ctladm/ctladm.c Fri Jun 22 05:42:05 2012 (r237424) +++ stable/9/usr.sbin/ctladm/ctladm.c Fri Jun 22 05:44:38 2012 (r237425) @@ -764,7 +764,6 @@ static int cctl_delay(int fd, int target, int lun, int argc, char **argv, char *combinedopt) { - int datamove_delay; struct ctl_io_delay_info delay_info; char *delayloc = NULL; char *delaytype = NULL; @@ -773,7 +772,6 @@ cctl_delay(int fd, int target, int lun, int c; retval = 0; - datamove_delay = 0; memset(&delay_info, 0, sizeof(delay_info)); @@ -3708,7 +3706,7 @@ CTL_DEFAULT_DEV); int main(int argc, char **argv) { - int option_index, c; + int c; ctladm_cmdfunction command; ctladm_cmdargs cmdargs; ctladm_optret optreturn; @@ -3719,10 +3717,9 @@ main(int argc, char **argv) int target, lun; int optstart = 2; int retval, fd; - int retries, timeout; + int retries; int initid; - option_index = 0; retval = 0; cmdargs = CTLADM_ARG_NONE; command = CTLADM_CMD_HELP; @@ -3731,7 +3728,6 @@ main(int argc, char **argv) retries = 0; target = 0; lun = 0; - timeout = 0; initid = 7; if (argc < 2) { From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:46:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99BD41065680; Fri, 22 Jun 2012 05:46:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 845408FC1D; Fri, 22 Jun 2012 05:46:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5ki8t059061; Fri, 22 Jun 2012 05:46:44 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5kiWn059059; Fri, 22 Jun 2012 05:46:44 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220546.q5M5kiWn059059@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:46:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237426 - stable/8/usr.sbin/ifmcstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:46:44 -0000 Author: eadler Date: Fri Jun 22 05:46:43 2012 New Revision: 237426 URL: http://svn.freebsd.org/changeset/base/237426 Log: MFC r237256: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/ifmcstat/ifmcstat.c Directory Properties: stable/8/usr.sbin/ifmcstat/ (props changed) Modified: stable/8/usr.sbin/ifmcstat/ifmcstat.c ============================================================================== --- stable/8/usr.sbin/ifmcstat/ifmcstat.c Fri Jun 22 05:44:38 2012 (r237425) +++ stable/8/usr.sbin/ifmcstat/ifmcstat.c Fri Jun 22 05:46:43 2012 (r237426) @@ -388,7 +388,6 @@ ll_addrlist(struct ifaddr *ifap) struct sockaddr sa; struct sockaddr_dl sdl; struct ifaddr *ifap0; - int error; if (af && af != AF_LINK) return; @@ -405,7 +404,7 @@ ll_addrlist(struct ifaddr *ifap) if (sdl.sdl_alen == 0) goto nextifap; addrbuf[0] = '\0'; - error = getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, + getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, addrbuf, sizeof(addrbuf), NULL, 0, NI_NUMERICHOST); printf("\tlink %s\n", addrbuf); nextifap: @@ -428,7 +427,7 @@ ll_addrlist(struct ifaddr *ifap) goto nextmulti; KREAD(ifm.ifma_addr, &sdl, struct sockaddr_dl); addrbuf[0] = '\0'; - error = getnameinfo((struct sockaddr *)&sdl, + getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, addrbuf, sizeof(addrbuf), NULL, 0, NI_NUMERICHOST); printf("\t\tgroup %s refcnt %d\n", From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:46:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3726E1065731; Fri, 22 Jun 2012 05:46:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0048B8FC19; Fri, 22 Jun 2012 05:46:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5knkf059102; Fri, 22 Jun 2012 05:46:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5knho059100; Fri, 22 Jun 2012 05:46:49 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220546.q5M5knho059100@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237427 - stable/9/usr.sbin/ifmcstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:46:50 -0000 Author: eadler Date: Fri Jun 22 05:46:49 2012 New Revision: 237427 URL: http://svn.freebsd.org/changeset/base/237427 Log: MFC r237256: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/ifmcstat/ifmcstat.c Directory Properties: stable/9/usr.sbin/ifmcstat/ (props changed) Modified: stable/9/usr.sbin/ifmcstat/ifmcstat.c ============================================================================== --- stable/9/usr.sbin/ifmcstat/ifmcstat.c Fri Jun 22 05:46:43 2012 (r237426) +++ stable/9/usr.sbin/ifmcstat/ifmcstat.c Fri Jun 22 05:46:49 2012 (r237427) @@ -387,7 +387,6 @@ ll_addrlist(struct ifaddr *ifap) struct sockaddr sa; struct sockaddr_dl sdl; struct ifaddr *ifap0; - int error; if (af && af != AF_LINK) return; @@ -404,7 +403,7 @@ ll_addrlist(struct ifaddr *ifap) if (sdl.sdl_alen == 0) goto nextifap; addrbuf[0] = '\0'; - error = getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, + getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, addrbuf, sizeof(addrbuf), NULL, 0, NI_NUMERICHOST); printf("\tlink %s\n", addrbuf); nextifap: @@ -427,7 +426,7 @@ ll_addrlist(struct ifaddr *ifap) goto nextmulti; KREAD(ifm.ifma_addr, &sdl, struct sockaddr_dl); addrbuf[0] = '\0'; - error = getnameinfo((struct sockaddr *)&sdl, + getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, addrbuf, sizeof(addrbuf), NULL, 0, NI_NUMERICHOST); printf("\t\tgroup %s refcnt %d\n", From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:48:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 91126106564A; Fri, 22 Jun 2012 05:48:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 616F48FC12; Fri, 22 Jun 2012 05:48:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5msRG059242; Fri, 22 Jun 2012 05:48:54 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5msOh059239; Fri, 22 Jun 2012 05:48:54 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206220548.q5M5msOh059239@svn.freebsd.org> From: Eitan Adler Date: Fri, 22 Jun 2012 05:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237428 - stable/9/usr.sbin/bsdinstall/partedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:48:54 -0000 Author: eadler Date: Fri Jun 22 05:48:53 2012 New Revision: 237428 URL: http://svn.freebsd.org/changeset/base/237428 Log: MFC r237253: Remove variables which are initialized but never used thereafter reported by gcc46 warning Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/bsdinstall/partedit/diskeditor.c stable/9/usr.sbin/bsdinstall/partedit/part_wizard.c Directory Properties: stable/9/usr.sbin/bsdinstall/ (props changed) Modified: stable/9/usr.sbin/bsdinstall/partedit/diskeditor.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/partedit/diskeditor.c Fri Jun 22 05:46:49 2012 (r237427) +++ stable/9/usr.sbin/bsdinstall/partedit/diskeditor.c Fri Jun 22 05:48:53 2012 (r237428) @@ -74,7 +74,7 @@ diskeditor_show(const char *title, const int x, y; int i; int height, width, min_width; - int partlist_height, partlist_width, min_partlist_width; + int partlist_height, partlist_width; int cur_scroll = 0; int key, fkey; int cur_button = 0, cur_part = 0; @@ -102,7 +102,6 @@ diskeditor_show(const char *title, const min_width = 50; height = width = 0; partlist_height = 10; - min_partlist_width = 0; dlg_tab_correct_str(prompt); dlg_button_layout(buttons, &min_width); dlg_auto_size(title, prompt, &height, &width, 2, min_width); Modified: stable/9/usr.sbin/bsdinstall/partedit/part_wizard.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/partedit/part_wizard.c Fri Jun 22 05:46:49 2012 (r237427) +++ stable/9/usr.sbin/bsdinstall/partedit/part_wizard.c Fri Jun 22 05:48:53 2012 (r237428) @@ -294,8 +294,6 @@ wizard_makeparts(struct gmesh *mesh, con struct gmesh submesh; struct gclass *classp; struct ggeom *gp; - struct gconfig *gc; - const char *scheme; struct gprovider *pp; intmax_t swapsize, available; char swapsizestr[10], rootsizestr[10]; @@ -309,10 +307,6 @@ wizard_makeparts(struct gmesh *mesh, con if (strcmp(gp->lg_name, disk) == 0) break; - LIST_FOREACH(gc, &gp->lg_config, lg_config) - if (strcmp(gc->lg_name, "scheme") == 0) - scheme = gc->lg_val; - pp = provider_for_name(mesh, disk); available = gpart_max_free(gp, NULL)*pp->lg_sectorsize; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 05:54:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0A3A1065670; Fri, 22 Jun 2012 05:54:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C7698FC08; Fri, 22 Jun 2012 05:54:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M5sYex059526; Fri, 22 Jun 2012 05:54:34 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M5sYwY059523; Fri, 22 Jun 2012 05:54:34 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206220554.q5M5sYwY059523@svn.freebsd.org> From: Warner Losh Date: Fri, 22 Jun 2012 05:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237429 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 05:54:34 -0000 Author: imp Date: Fri Jun 22 05:54:34 2012 New Revision: 237429 URL: http://svn.freebsd.org/changeset/base/237429 Log: Move these #defines to at91reg.h (where I should have put them in the first place). Modified: head/sys/arm/at91/at91_machdep.c head/sys/arm/at91/at91reg.h Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Fri Jun 22 05:48:53 2012 (r237428) +++ head/sys/arm/at91/at91_machdep.c Fri Jun 22 05:54:34 2012 (r237429) @@ -281,9 +281,6 @@ static const char *soc_subtype_name[] = [AT91_ST_SAM9X35] = "at91sam9x35", }; -#define AT91_DBGU0 0x0ffff200 /* Most */ -#define AT91_DBGU1 0x0fffee00 /* SAM9263, CAP9, and SAM9G45 */ - struct at91_soc_info soc_data; /* Modified: head/sys/arm/at91/at91reg.h ============================================================================== --- head/sys/arm/at91/at91reg.h Fri Jun 22 05:48:53 2012 (r237428) +++ head/sys/arm/at91/at91reg.h Fri Jun 22 05:54:34 2012 (r237429) @@ -46,6 +46,9 @@ #define AT91_SYS_BASE 0xffff000 #define AT91_SYS_SIZE 0x1000 +#define AT91_DBGU0 0x0ffff200 /* Most */ +#define AT91_DBGU1 0x0fffee00 /* SAM9263, CAP9, and SAM9G45 */ + #define AT91_DBGU_SIZE 0x200 #define DBGU_C1R (64) /* Chip ID1 Register */ #define DBGU_C2R (68) /* Chip ID2 Register */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 06:38:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55E09106566B; Fri, 22 Jun 2012 06:38:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 364428FC14; Fri, 22 Jun 2012 06:38:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M6cW7V061429; Fri, 22 Jun 2012 06:38:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M6cV4L061421; Fri, 22 Jun 2012 06:38:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206220638.q5M6cV4L061421@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 22 Jun 2012 06:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237430 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 06:38:32 -0000 Author: kib Date: Fri Jun 22 06:38:31 2012 New Revision: 237430 URL: http://svn.freebsd.org/changeset/base/237430 Log: Reserve AT_TIMEKEEP auxv entry for providing usermode the pointer to timekeeping information. MFC after: 1 week Modified: head/sys/amd64/include/elf.h head/sys/arm/include/elf.h head/sys/i386/include/elf.h head/sys/ia64/include/elf.h head/sys/mips/include/elf.h head/sys/powerpc/include/elf.h head/sys/sparc64/include/elf.h Modified: head/sys/amd64/include/elf.h ============================================================================== --- head/sys/amd64/include/elf.h Fri Jun 22 05:54:34 2012 (r237429) +++ head/sys/amd64/include/elf.h Fri Jun 22 06:38:31 2012 (r237430) @@ -94,6 +94,7 @@ __ElfType(Auxinfo); #define AT_NCPUS 19 /* Number of CPUs. */ #define AT_PAGESIZES 20 /* Pagesizes. */ #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ +#define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ #define AT_COUNT 24 /* Count of defined aux entry types. */ Modified: head/sys/arm/include/elf.h ============================================================================== --- head/sys/arm/include/elf.h Fri Jun 22 05:54:34 2012 (r237429) +++ head/sys/arm/include/elf.h Fri Jun 22 06:38:31 2012 (r237430) @@ -82,6 +82,7 @@ __ElfType(Auxinfo); #define AT_NCPUS 19 /* Number of CPUs. */ #define AT_PAGESIZES 20 /* Pagesizes. */ #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ +#define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ #define AT_COUNT 24 /* Count of defined aux entry types. */ Modified: head/sys/i386/include/elf.h ============================================================================== --- head/sys/i386/include/elf.h Fri Jun 22 05:54:34 2012 (r237429) +++ head/sys/i386/include/elf.h Fri Jun 22 06:38:31 2012 (r237430) @@ -96,6 +96,7 @@ __ElfType(Auxinfo); #define AT_NCPUS 19 /* Number of CPUs. */ #define AT_PAGESIZES 20 /* Pagesizes. */ #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ +#define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ #define AT_COUNT 24 /* Count of defined aux entry types. */ Modified: head/sys/ia64/include/elf.h ============================================================================== --- head/sys/ia64/include/elf.h Fri Jun 22 05:54:34 2012 (r237429) +++ head/sys/ia64/include/elf.h Fri Jun 22 06:38:31 2012 (r237430) @@ -95,6 +95,7 @@ __ElfType(Auxinfo); #define AT_NCPUS 19 /* Number of CPUs. */ #define AT_PAGESIZES 20 /* Pagesizes. */ #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ +#define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ #define AT_COUNT 24 /* Count of defined aux entry types. */ Modified: head/sys/mips/include/elf.h ============================================================================== --- head/sys/mips/include/elf.h Fri Jun 22 05:54:34 2012 (r237429) +++ head/sys/mips/include/elf.h Fri Jun 22 06:38:31 2012 (r237430) @@ -278,6 +278,7 @@ __ElfType(Auxinfo); #define AT_NCPUS 19 /* Number of CPUs. */ #define AT_PAGESIZES 20 /* Pagesizes. */ #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ +#define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ #define AT_COUNT 24 /* Count of defined aux entry types. */ Modified: head/sys/powerpc/include/elf.h ============================================================================== --- head/sys/powerpc/include/elf.h Fri Jun 22 05:54:34 2012 (r237429) +++ head/sys/powerpc/include/elf.h Fri Jun 22 06:38:31 2012 (r237430) @@ -106,8 +106,9 @@ __ElfType(Auxinfo); #define AT_PAGESIZES 18 /* Pagesizes. */ #define AT_PAGESIZESLEN 19 /* Number of pagesizes. */ #define AT_STACKPROT 21 /* Initial stack protection. */ +#define AT_TIMEKEEP 22 /* Pointer to timehands. */ -#define AT_COUNT 22 /* Count of defined aux entry types. */ +#define AT_COUNT 23 /* Count of defined aux entry types. */ /* * Relocation types. Modified: head/sys/sparc64/include/elf.h ============================================================================== --- head/sys/sparc64/include/elf.h Fri Jun 22 05:54:34 2012 (r237429) +++ head/sys/sparc64/include/elf.h Fri Jun 22 06:38:31 2012 (r237430) @@ -90,6 +90,7 @@ __ElfType(Auxinfo); #define AT_NCPUS 19 /* Number of CPUs. */ #define AT_PAGESIZES 20 /* Pagesizes. */ #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ +#define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ #define AT_COUNT 24 /* Count of defined aux entry types. */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 06:39:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5356C10656E6; Fri, 22 Jun 2012 06:39:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E8868FC15; Fri, 22 Jun 2012 06:39:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M6dTkb061505; Fri, 22 Jun 2012 06:39:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M6dTrD061502; Fri, 22 Jun 2012 06:39:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206220639.q5M6dTrD061502@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 22 Jun 2012 06:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237431 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 06:39:29 -0000 Author: kib Date: Fri Jun 22 06:39:28 2012 New Revision: 237431 URL: http://svn.freebsd.org/changeset/base/237431 Log: Enchance the shared page chunk allocator. Do not rely on the busy state of the page from which we allocate the chunk, to protect allocator state. Use statically allocated sx lock instead. Provide more flexible KPI. In particular, allow to allocate chunk without providing initial data, and allow writes into existing allocation. Allow to get an sf buf which temporary maps the chunk, to allow sequential updates to shared page content without unmapping in between. Reviewed by: jhb Tested by: flo MFC after: 1 month Modified: head/sys/kern/kern_exec.c head/sys/sys/sysent.h Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Jun 22 06:38:31 2012 (r237430) +++ head/sys/kern/kern_exec.c Fri Jun 22 06:39:28 2012 (r237431) @@ -1512,33 +1512,81 @@ exec_unregister(execsw_arg) return (0); } +static struct sx shared_page_alloc_sx; static vm_object_t shared_page_obj; static int shared_page_free; -int -shared_page_fill(int size, int align, const char *data) +struct sf_buf * +shared_page_write_start(int base) { vm_page_t m; struct sf_buf *s; + + VM_OBJECT_LOCK(shared_page_obj); + m = vm_page_grab(shared_page_obj, OFF_TO_IDX(base), VM_ALLOC_RETRY); + VM_OBJECT_UNLOCK(shared_page_obj); + s = sf_buf_alloc(m, SFB_DEFAULT); + return (s); +} + +void +shared_page_write_end(struct sf_buf *sf) +{ + vm_page_t m; + + m = sf_buf_page(sf); + sf_buf_free(sf); + VM_OBJECT_LOCK(shared_page_obj); + vm_page_wakeup(m); + VM_OBJECT_UNLOCK(shared_page_obj); +} + +void +shared_page_write(int base, int size, const void *data) +{ + struct sf_buf *sf; vm_offset_t sk; + + sf = shared_page_write_start(base); + sk = sf_buf_kva(sf); + bcopy(data, (void *)(sk + (base & PAGE_MASK)), size); + shared_page_write_end(sf); +} + +static int +shared_page_alloc_locked(int size, int align) +{ int res; - VM_OBJECT_LOCK(shared_page_obj); - m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_RETRY); res = roundup(shared_page_free, align); if (res + size >= IDX_TO_OFF(shared_page_obj->size)) res = -1; - else { - VM_OBJECT_UNLOCK(shared_page_obj); - s = sf_buf_alloc(m, SFB_DEFAULT); - sk = sf_buf_kva(s); - bcopy(data, (void *)(sk + res), size); + else shared_page_free = res + size; - sf_buf_free(s); - VM_OBJECT_LOCK(shared_page_obj); - } - vm_page_wakeup(m); - VM_OBJECT_UNLOCK(shared_page_obj); + return (res); +} + +int +shared_page_alloc(int size, int align) +{ + int res; + + sx_xlock(&shared_page_alloc_sx); + res = shared_page_alloc_locked(size, align); + sx_xunlock(&shared_page_alloc_sx); + return (res); +} + +int +shared_page_fill(int size, int align, const void *data) +{ + int res; + + sx_xlock(&shared_page_alloc_sx); + res = shared_page_alloc_locked(size, align); + if (res != -1) + shared_page_write(res, size, data); + sx_xunlock(&shared_page_alloc_sx); return (res); } @@ -1547,6 +1595,7 @@ shared_page_init(void *dummy __unused) { vm_page_t m; + sx_init(&shared_page_alloc_sx, "shpsx"); shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, VM_PROT_DEFAULT, 0, NULL); VM_OBJECT_LOCK(shared_page_obj); Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Fri Jun 22 06:38:31 2012 (r237430) +++ head/sys/sys/sysent.h Fri Jun 22 06:39:28 2012 (r237431) @@ -256,8 +256,13 @@ int lkmressys(struct thread *, struct no int syscall_thread_enter(struct thread *td, struct sysent *se); void syscall_thread_exit(struct thread *td, struct sysent *se); -int shared_page_fill(int size, int align, const char *data); +struct sf_buf; +int shared_page_alloc(int size, int align); +int shared_page_fill(int size, int align, const void *data); +void shared_page_write(int base, int size, const void *data); void exec_sysvec_init(void *param); +struct sf_buf *shared_page_write_start(int base); +void shared_page_write_end(struct sf_buf *sf); #define INIT_SYSENTVEC(name, sv) \ SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \ From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 06:44:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C768A1065673; Fri, 22 Jun 2012 06:44:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B30638FC16; Fri, 22 Jun 2012 06:44:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M6iMwA061751; Fri, 22 Jun 2012 06:44:22 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M6iMCC061749; Fri, 22 Jun 2012 06:44:22 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206220644.q5M6iMCC061749@svn.freebsd.org> From: Warner Losh Date: Fri, 22 Jun 2012 06:44:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237432 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 06:44:22 -0000 Author: imp Date: Fri Jun 22 06:44:22 2012 New Revision: 237432 URL: http://svn.freebsd.org/changeset/base/237432 Log: Fix a stray debug that I committed accidentally years ago... Modified: head/sys/arm/at91/at91_twi.c Modified: head/sys/arm/at91/at91_twi.c ============================================================================== --- head/sys/arm/at91/at91_twi.c Fri Jun 22 06:39:28 2012 (r237431) +++ head/sys/arm/at91/at91_twi.c Fri Jun 22 06:44:22 2012 (r237432) @@ -284,7 +284,6 @@ at91_twi_rst_card(device_t dev, u_char s WR4(sc, TWI_CR, TWI_CR_SWRST); WR4(sc, TWI_CR, TWI_CR_MSEN | TWI_CR_SVDIS); WR4(sc, TWI_CWGR, sc->cwgr); - printf("setting cwgr to %#x\n", sc->cwgr); AT91_TWI_UNLOCK(sc); return 0; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 07:06:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83C14106566B; Fri, 22 Jun 2012 07:06:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A1B48FC0C; Fri, 22 Jun 2012 07:06:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M76fjg062772; Fri, 22 Jun 2012 07:06:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M76fbO062751; Fri, 22 Jun 2012 07:06:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206220706.q5M76fbO062751@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 22 Jun 2012 07:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237433 - in head/sys: amd64/include arm/include conf i386/include ia64/include kern mips/include pc98/include powerpc/include sparc64/include sys x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 07:06:41 -0000 Author: kib Date: Fri Jun 22 07:06:40 2012 New Revision: 237433 URL: http://svn.freebsd.org/changeset/base/237433 Log: Implement mechanism to export some kernel timekeeping data to usermode, using shared page. The structures and functions have vdso prefix, to indicate the intended location of the code in some future. The versioned per-algorithm data is exported in the format of struct vdso_timehands, which mostly repeats the content of in-kernel struct timehands. Usermode reading of the structure can be lockless. Compatibility export for 32bit processes on 64bit host is also provided. Kernel also provides usermode with indication about currently used timecounter, so that libc can fall back to syscall if configured timecounter is unknown to usermode code. The shared data updates are initiated both from the tc_windup(), where a fast task is queued to do the update, and from sysctl handlers which change timecounter. A manual override switch kern.timecounter.fast_gettime allows to turn off the mechanism. Only x86 architectures export the real algorithm data, and there, only for tsc timecounter. HPET counters page could be exported as well, but I prefer to not further glue the kernel and libc ABI there until proper vdso-based solution is developed. Minimal stubs neccessary for non-x86 architectures to still compile are provided. Discussed with: bde Reviewed by: jhb Tested by: flo MFC after: 1 month Added: head/sys/amd64/include/vdso.h (contents, props changed) head/sys/arm/include/vdso.h (contents, props changed) head/sys/i386/include/vdso.h (contents, props changed) head/sys/ia64/include/vdso.h (contents, props changed) head/sys/kern/subr_dummy_vdso_tc.c (contents, props changed) head/sys/mips/include/vdso.h (contents, props changed) head/sys/pc98/include/vdso.h (contents, props changed) head/sys/powerpc/include/vdso.h (contents, props changed) head/sys/sparc64/include/vdso.h (contents, props changed) head/sys/sys/vdso.h (contents, props changed) head/sys/x86/include/vdso.h (contents, props changed) Modified: head/sys/conf/files.arm head/sys/conf/files.ia64 head/sys/conf/files.mips head/sys/conf/files.powerpc head/sys/conf/files.sparc64 head/sys/kern/imgact_elf.c head/sys/kern/kern_exec.c head/sys/kern/kern_tc.c head/sys/sys/sysent.h head/sys/x86/x86/tsc.c Added: head/sys/amd64/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,6 @@ +/*- + * This file is in the public domain. + */ +/* $FreeBSD$ */ + +#include Added: head/sys/arm/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,34 @@ +/*- + * Copyright 2012 Konstantin Belousov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ARM_VDSO_H +#define _ARM_VDSO_H + +#define VDSO_TIMEHANDS_MD \ + uint32_t th_res[8]; + +#endif Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/conf/files.arm Fri Jun 22 07:06:40 2012 (r237433) @@ -79,6 +79,7 @@ libkern/umoddi3.c standard #libkern/arm/strcmp.S standard #libkern/arm/strncmp.S standard # +kern/subr_dummy_vdso_tc.c standard board_id.h standard \ dependency "$S/arm/conf/genboardid.awk $S/arm/conf/mach-types" \ compile-with "${AWK} -f $S/arm/conf/genboardid.awk $S/arm/conf/mach-types > board_id.h" \ Modified: head/sys/conf/files.ia64 ============================================================================== --- head/sys/conf/files.ia64 Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/conf/files.ia64 Fri Jun 22 07:06:40 2012 (r237433) @@ -138,3 +138,4 @@ libkern/ia64/bswap16.S standard libkern/ia64/bswap32.S standard libkern/memmove.c standard libkern/memset.c standard +kern/subr_dummy_vdso_tc.c standard Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/conf/files.mips Fri Jun 22 07:06:40 2012 (r237433) @@ -91,6 +91,7 @@ compat/freebsd32/freebsd32_misc.c option compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32 compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32 kern/imgact_elf32.c optional compat_freebsd32 +kern/subr_dummy_vdso_tc.c standard mips/mips/freebsd32_machdep.c optional compat_freebsd32 kern/kern_clocksource.c standard Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/conf/files.powerpc Fri Jun 22 07:06:40 2012 (r237433) @@ -61,6 +61,7 @@ dev/tsec/if_tsec.c optional tsec dev/tsec/if_tsec_fdt.c optional tsec fdt dev/uart/uart_cpu_powerpc.c optional uart aim kern/kern_clocksource.c standard +kern/subr_dummy_vdso_tc.c standard kern/syscalls.c optional ktr libkern/ashldi3.c optional powerpc libkern/ashrdi3.c optional powerpc Modified: head/sys/conf/files.sparc64 ============================================================================== --- head/sys/conf/files.sparc64 Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/conf/files.sparc64 Fri Jun 22 07:06:40 2012 (r237433) @@ -61,6 +61,7 @@ dev/syscons/scvtb.c optional sc dev/uart/uart_cpu_sparc64.c optional uart dev/uart/uart_kbd_sun.c optional uart sc kern/kern_clocksource.c standard +kern/subr_dummy_vdso_tc.c standard kern/syscalls.c optional ktr libkern/ffs.c standard libkern/ffsl.c standard Added: head/sys/i386/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/i386/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,6 @@ +/*- + * This file is in the public domain. + */ +/* $FreeBSD$ */ + +#include Added: head/sys/ia64/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/ia64/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,41 @@ +/*- + * Copyright 2012 Konstantin Belousov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _IA64_VDSO_H +#define _IA64_VDSO_H + +#define VDSO_TIMEHANDS_MD \ + uint32_t th_res[8]; + +#ifdef _KERNEL +#ifdef COMPAT_FREEBSD32 + +#define VDSO_TIMEHANDS_MD32 VDSO_TIMEHANDS_MD + +#endif +#endif +#endif Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/kern/imgact_elf.c Fri Jun 22 07:06:40 2012 (r237433) @@ -1011,6 +1011,10 @@ __elfN(freebsd_fixup)(register_t **stack AUXARGS_ENTRY(pos, AT_PAGESIZES, imgp->pagesizes); AUXARGS_ENTRY(pos, AT_PAGESIZESLEN, imgp->pagesizeslen); } + if (imgp->sysent->sv_timekeep_base != 0) { + AUXARGS_ENTRY(pos, AT_TIMEKEEP, + imgp->sysent->sv_timekeep_base); + } AUXARGS_ENTRY(pos, AT_STACKPROT, imgp->sysent->sv_shared_page_obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : imgp->sysent->sv_stackprot); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/kern/kern_exec.c Fri Jun 22 07:06:40 2012 (r237433) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" +#include "opt_compat.h" #include "opt_hwpmc_hooks.h" #include "opt_kdtrace.h" #include "opt_ktrace.h" @@ -64,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #ifdef KTRACE @@ -1608,10 +1610,76 @@ shared_page_init(void *dummy __unused) SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)shared_page_init, NULL); +static void +timehands_update(void *arg) +{ + struct sysentvec *sv; + struct sf_buf *sf; + struct vdso_timehands th; + struct vdso_timekeep *tk; + uint32_t enabled, idx; + + sv = arg; + sx_xlock(&shared_page_alloc_sx); + enabled = tc_fill_vdso_timehands(&th); + sf = shared_page_write_start(sv->sv_timekeep_off); + tk = (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); + idx = sv->sv_timekeep_curr; + atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); + if (++idx >= VDSO_TH_NUM) + idx = 0; + sv->sv_timekeep_curr = idx; + if (++sv->sv_timekeep_gen == 0) + sv->sv_timekeep_gen = 1; + th.th_gen = 0; + if (enabled) + tk->tk_th[idx] = th; + tk->tk_enabled = enabled; + atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); + tk->tk_current = idx; + shared_page_write_end(sf); + sx_xunlock(&shared_page_alloc_sx); +} + +#ifdef COMPAT_FREEBSD32 +static void +timehands_update32(void *arg) +{ + struct sysentvec *sv; + struct sf_buf *sf; + struct vdso_timekeep32 *tk; + struct vdso_timehands32 th; + uint32_t enabled, idx; + + sv = arg; + sx_xlock(&shared_page_alloc_sx); + enabled = tc_fill_vdso_timehands32(&th); + sf = shared_page_write_start(sv->sv_timekeep_off); + tk = (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); + idx = sv->sv_timekeep_curr; + atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); + if (++idx >= VDSO_TH_NUM) + idx = 0; + sv->sv_timekeep_curr = idx; + if (++sv->sv_timekeep_gen == 0) + sv->sv_timekeep_gen = 1; + th.th_gen = 0; + if (enabled) + tk->tk_th[idx] = th; + tk->tk_enabled = enabled; + atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); + tk->tk_current = idx; + shared_page_write_end(sf); + sx_xunlock(&shared_page_alloc_sx); +} +#endif + void exec_sysvec_init(void *param) { struct sysentvec *sv; + int tk_base; + uint32_t tk_ver; sv = (struct sysentvec *)param; @@ -1620,4 +1688,29 @@ exec_sysvec_init(void *param) sv->sv_shared_page_obj = shared_page_obj; sv->sv_sigcode_base = sv->sv_shared_page_base + shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); + tk_ver = VDSO_TK_VER_CURR; +#ifdef COMPAT_FREEBSD32 + if ((sv->sv_flags & SV_ILP32) != 0) { + tk_base = shared_page_alloc(sizeof(struct vdso_timekeep32) + + sizeof(struct vdso_timehands32) * VDSO_TH_NUM, 16); + KASSERT(tk_base != -1, ("tk_base -1 for 32bit")); + EVENTHANDLER_REGISTER(tc_windup, timehands_update32, sv, + EVENTHANDLER_PRI_ANY); + shared_page_write(tk_base + offsetof(struct vdso_timekeep32, + tk_ver), sizeof(uint32_t), &tk_ver); + } else { +#endif + tk_base = shared_page_alloc(sizeof(struct vdso_timekeep) + + sizeof(struct vdso_timehands) * VDSO_TH_NUM, 16); + KASSERT(tk_base != -1, ("tk_base -1 for native")); + EVENTHANDLER_REGISTER(tc_windup, timehands_update, sv, + EVENTHANDLER_PRI_ANY); + shared_page_write(tk_base + offsetof(struct vdso_timekeep, + tk_ver), sizeof(uint32_t), &tk_ver); +#ifdef COMPAT_FREEBSD32 + } +#endif + sv->sv_timekeep_base = sv->sv_shared_page_base + tk_base; + sv->sv_timekeep_off = tk_base; + EVENTHANDLER_INVOKE(tc_windup); } Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/kern/kern_tc.c Fri Jun 22 07:06:40 2012 (r237433) @@ -16,6 +16,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_ntp.h" #include "opt_ffclock.h" @@ -30,8 +31,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include /* * A large step happens on boot. This constant detects such steps. @@ -118,8 +121,12 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, ×tepwarnings, 0, "Log time steps"); static void tc_windup(void); +static void tc_windup_push_vdso(void *ctx, int pending); static void cpu_tick_calibrate(int); +static struct task tc_windup_push_vdso_task = TASK_INITIALIZER(0, + tc_windup_push_vdso, 0); + static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { @@ -1360,6 +1367,7 @@ tc_windup(void) #endif timehands = th; + taskqueue_enqueue_fast(taskqueue_fast, &tc_windup_push_vdso_task); } /* Report or change the active timecounter hardware. */ @@ -1386,6 +1394,7 @@ sysctl_kern_timecounter_hardware(SYSCTL_ (void)newtc->tc_get_timecount(newtc); timecounter = newtc; + EVENTHANDLER_INVOKE(tc_windup); return (0); } return (EINVAL); @@ -1844,3 +1853,78 @@ cputick2usec(uint64_t tick) } cpu_tick_f *cpu_ticks = tc_cpu_ticks; + +static int vdso_th_enable = 1; +static int +sysctl_fast_gettime(SYSCTL_HANDLER_ARGS) +{ + int old_vdso_th_enable, error; + + old_vdso_th_enable = vdso_th_enable; + error = sysctl_handle_int(oidp, &old_vdso_th_enable, 0, req); + if (error != 0) + return (error); + vdso_th_enable = old_vdso_th_enable; + EVENTHANDLER_INVOKE(tc_windup); + return (0); +} +SYSCTL_PROC(_kern_timecounter, OID_AUTO, fast_gettime, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + NULL, 0, sysctl_fast_gettime, "I", "Enable fast time of day"); + +uint32_t +tc_fill_vdso_timehands(struct vdso_timehands *vdso_th) +{ + struct timehands *th; + uint32_t enabled; + int gen; + + do { + th = timehands; + gen = th->th_generation; + vdso_th->th_algo = VDSO_TH_ALGO_1; + vdso_th->th_scale = th->th_scale; + vdso_th->th_offset_count = th->th_offset_count; + vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; + vdso_th->th_offset = th->th_offset; + vdso_th->th_boottime = boottimebin; + enabled = cpu_fill_vdso_timehands(vdso_th); + } while (gen == 0 || timehands->th_generation != gen); + if (!vdso_th_enable) + enabled = 0; + return (enabled); +} + +#ifdef COMPAT_FREEBSD32 +uint32_t +tc_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32) +{ + struct timehands *th; + uint32_t enabled; + int gen; + + do { + th = timehands; + gen = th->th_generation; + vdso_th32->th_algo = VDSO_TH_ALGO_1; + *(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale; + vdso_th32->th_offset_count = th->th_offset_count; + vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; + vdso_th32->th_offset.sec = th->th_offset.sec; + *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; + vdso_th32->th_boottime.sec = boottimebin.sec; + *(uint64_t *)&vdso_th32->th_boottime.frac[0] = boottimebin.frac; + enabled = cpu_fill_vdso_timehands32(vdso_th32); + } while (gen == 0 || timehands->th_generation != gen); + if (!vdso_th_enable) + enabled = 0; + return (enabled); +} +#endif + +static void +tc_windup_push_vdso(void *ctx, int pending) +{ + + EVENTHANDLER_INVOKE(tc_windup); +} Added: head/sys/kern/subr_dummy_vdso_tc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/subr_dummy_vdso_tc.c Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,49 @@ +/*- + * Copyright 2012 Konstantin Belousov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" + +#include +#include + +uint32_t +cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th) +{ + + return (0); +} + +#ifdef COMPAT_FREEBSD32 +uint32_t +cpu_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32) +{ + + return (0); +} +#endif Added: head/sys/mips/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,41 @@ +/*- + * Copyright 2012 Konstantin Belousov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MIPS_VDSO_H +#define _MIPS_VDSO_H + +#define VDSO_TIMEHANDS_MD \ + uint32_t th_res[8]; + +#ifdef _KERNEL +#ifdef COMPAT_FREEBSD32 + +#define VDSO_TIMEHANDS_MD32 VDSO_TIMEHANDS_MD + +#endif +#endif +#endif Added: head/sys/pc98/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/pc98/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,6 @@ +/*- + * This file is in the public domain. + */ +/* $FreeBSD$ */ + +#include Added: head/sys/powerpc/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,41 @@ +/*- + * Copyright 2012 Konstantin Belousov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _POWERPC_VDSO_H +#define _POWERPC_VDSO_H + +#define VDSO_TIMEHANDS_MD \ + uint32_t th_res[8]; + +#ifdef _KERNEL +#ifdef COMPAT_FREEBSD32 + +#define VDSO_TIMEHANDS_MD32 VDSO_TIMEHANDS_MD + +#endif +#endif +#endif Added: head/sys/sparc64/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sparc64/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,34 @@ +/*- + * Copyright 2012 Konstantin Belousov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SPARC64_VDSO_H +#define _SPARC64_VDSO_H + +#define VDSO_TIMEHANDS_MD \ + uint32_t th_res[8]; + +#endif Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/sys/sysent.h Fri Jun 22 07:06:40 2012 (r237433) @@ -124,6 +124,10 @@ struct sysentvec { vm_offset_t sv_shared_page_base; vm_offset_t sv_shared_page_len; vm_offset_t sv_sigcode_base; + vm_offset_t sv_timekeep_base; + int sv_timekeep_off; + int sv_timekeep_curr; + uint32_t sv_timekeep_gen; void *sv_shared_page_obj; void (*sv_schedtail)(struct thread *); }; Added: head/sys/sys/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,124 @@ +/*- + * Copyright 2012 Konstantin Belousov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_VDSO_H +#define _SYS_VDSO_H + +#include +#include +#include + +struct vdso_timehands { + uint32_t th_algo; + uint32_t th_gen; + uint64_t th_scale; + uint32_t th_offset_count; + uint32_t th_counter_mask; + struct bintime th_offset; + struct bintime th_boottime; + VDSO_TIMEHANDS_MD +}; + +struct vdso_timekeep { + uint32_t tk_ver; + uint32_t tk_enabled; + uint32_t tk_current; + struct vdso_timehands tk_th[]; +}; + +#define VDSO_TK_CURRENT_BUSY 0xffffffff +#define VDSO_TK_VER_1 0x1 +#define VDSO_TK_VER_CURR VDSO_TK_VER_1 +#define VDSO_TH_ALGO_1 0x1 + +#ifndef _KERNEL + +struct timespec; +struct timeval; +struct timezone; + +int __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts); +#pragma weak __vdso_clock_gettime + +int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz); +#pragma weak __vdso_gettimeofday + +u_int __vdso_gettc(const struct vdso_timehands *vdso_th); +#pragma weak __vdso_gettc + +#endif + +#ifdef _KERNEL + +uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vdso_th); + +/* + * The cpu_fill_vdso_timehands() function should fill MD-part of the + * struct vdso_timehands, which is both machine- and + * timecounter-depended. The return value should be 1 if fast + * userspace timecounter is enabled by hardware, and 0 otherwise. The + * global sysctl enable override is handled by machine-independed code + * after cpu_fill_vdso_timehands() call is made. + */ +uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th); + +typedef void (*tc_windup_fn)(void *); +EVENTHANDLER_DECLARE(tc_windup, tc_windup_fn); + +#define VDSO_TH_NUM 4 + +#ifdef COMPAT_FREEBSD32 +struct bintime32 { + uint32_t sec; + uint32_t frac[2]; +}; + +struct vdso_timehands32 { + uint32_t th_algo; + uint32_t th_gen; + uint32_t th_scale[2]; + uint32_t th_offset_count; + uint32_t th_counter_mask; + struct bintime32 th_offset; + struct bintime32 th_boottime; + VDSO_TIMEHANDS_MD32 +}; + +struct vdso_timekeep32 { + uint32_t tk_ver; + uint32_t tk_enabled; + uint32_t tk_current; + struct vdso_timehands32 tk_th[]; +}; + +uint32_t tc_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32); +uint32_t cpu_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32); + +#endif +#endif + +#endif Added: head/sys/x86/include/vdso.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/include/vdso.h Fri Jun 22 07:06:40 2012 (r237433) @@ -0,0 +1,42 @@ +/*- + * Copyright 2012 Konstantin Belousov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _X86_VDSO_H +#define _X86_VDSO_H + +#define VDSO_TIMEHANDS_MD \ + uint32_t th_x86_shift; \ + uint32_t th_res[7]; + +#ifdef _KERNEL +#ifdef COMPAT_FREEBSD32 + +#define VDSO_TIMEHANDS_MD32 VDSO_TIMEHANDS_MD + +#endif +#endif +#endif Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Fri Jun 22 06:44:22 2012 (r237432) +++ head/sys/x86/x86/tsc.c Fri Jun 22 07:06:40 2012 (r237433) @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_clock.h" #include @@ -41,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -604,3 +606,23 @@ tsc_get_timecount_low(struct timecounter : "=a" (rv) : "c" ((int)(intptr_t)tc->tc_priv) : "edx"); return (rv); } + +uint32_t +cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th) +{ + + vdso_th->th_x86_shift = (int)(intptr_t)timecounter->tc_priv; + bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); + return (timecounter == &tsc_timecounter); +} + +#ifdef COMPAT_FREEBSD32 +uint32_t +cpu_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32) +{ + + vdso_th32->th_x86_shift = (int)(intptr_t)timecounter->tc_priv; + bzero(vdso_th32->th_res, sizeof(vdso_th32->th_res)); + return (timecounter == &tsc_timecounter); +} +#endif From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 07:13:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 73F38106566B; Fri, 22 Jun 2012 07:13:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C4268FC15; Fri, 22 Jun 2012 07:13:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M7DVOh063109; Fri, 22 Jun 2012 07:13:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M7DVH0063098; Fri, 22 Jun 2012 07:13:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206220713.q5M7DVH0063098@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 22 Jun 2012 07:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 07:13:31 -0000 Author: kib Date: Fri Jun 22 07:13:30 2012 New Revision: 237434 URL: http://svn.freebsd.org/changeset/base/237434 Log: Use struct vdso_timehands data to implement fast gettimeofday(2) and clock_gettime(2) functions if supported. The speedup seen in microbenchmarks is in range 4x-7x depending on the hardware. Only amd64 and i386 architectures are supported. Libc uses rdtsc and kernel data to calculate current time, if enabled by kernel. Hopefully, this code is going to migrate into vdso in some future. Discussed with: bde Reviewed by: jhb Tested by: flo MFC after: 1 month Added: head/lib/libc/amd64/sys/__vdso_gettc.c (contents, props changed) head/lib/libc/i386/sys/__vdso_gettc.c (contents, props changed) head/lib/libc/sys/__vdso_gettimeofday.c (contents, props changed) head/lib/libc/sys/clock_gettime.c (contents, props changed) head/lib/libc/sys/gettimeofday.c (contents, props changed) Modified: head/lib/libc/amd64/sys/Makefile.inc head/lib/libc/gen/aux.c head/lib/libc/i386/sys/Makefile.inc head/lib/libc/include/libc_private.h head/lib/libc/sys/Makefile.inc Modified: head/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- head/lib/libc/amd64/sys/Makefile.inc Fri Jun 22 07:06:40 2012 (r237433) +++ head/lib/libc/amd64/sys/Makefile.inc Fri Jun 22 07:13:30 2012 (r237434) @@ -1,7 +1,8 @@ # from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp # $FreeBSD$ -SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c amd64_set_gsbase.c +SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \ + amd64_set_gsbase.c __vdso_gettc.c MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S Added: head/lib/libc/amd64/sys/__vdso_gettc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/amd64/sys/__vdso_gettc.c Fri Jun 22 07:13:30 2012 (r237434) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static u_int +__vdso_gettc_low(const struct vdso_timehands *th) +{ + uint32_t rv; + + __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" + : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); + return (rv); +} + +u_int +__vdso_gettc(const struct vdso_timehands *th) +{ + + return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); +} Modified: head/lib/libc/gen/aux.c ============================================================================== --- head/lib/libc/gen/aux.c Fri Jun 22 07:06:40 2012 (r237433) +++ head/lib/libc/gen/aux.c Fri Jun 22 07:13:30 2012 (r237434) @@ -66,6 +66,7 @@ __init_elf_aux_vector(void) static pthread_once_t aux_once = PTHREAD_ONCE_INIT; static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; static char *canary, *pagesizes; +static void *timekeep; static void init_aux(void) @@ -101,6 +102,10 @@ init_aux(void) case AT_NCPUS: ncpus = aux->a_un.a_val; break; + + case AT_TIMEKEEP: + timekeep = aux->a_un.a_ptr; + break; } } } @@ -163,6 +168,16 @@ _elf_aux_info(int aux, void *buf, int bu } else res = EINVAL; break; + case AT_TIMEKEEP: + if (buflen == sizeof(void *)) { + if (timekeep != NULL) { + *(void **)buf = timekeep; + res = 0; + } else + res = ENOENT; + } else + res = EINVAL; + break; default: res = ENOENT; break; Modified: head/lib/libc/i386/sys/Makefile.inc ============================================================================== --- head/lib/libc/i386/sys/Makefile.inc Fri Jun 22 07:06:40 2012 (r237433) +++ head/lib/libc/i386/sys/Makefile.inc Fri Jun 22 07:13:30 2012 (r237434) @@ -5,7 +5,8 @@ SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c .endif SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \ - i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c + i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c \ + __vdso_gettc.c MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S syscall.S Added: head/lib/libc/i386/sys/__vdso_gettc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/i386/sys/__vdso_gettc.c Fri Jun 22 07:13:30 2012 (r237434) @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static u_int +__vdso_gettc_low(const struct vdso_timehands *th) +{ + uint32_t rv; + + __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" + : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); + return (rv); +} + +#pragma weak __vdso_gettc +u_int +__vdso_gettc(const struct vdso_timehands *th) +{ + + return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); +} Modified: head/lib/libc/include/libc_private.h ============================================================================== --- head/lib/libc/include/libc_private.h Fri Jun 22 07:06:40 2012 (r237433) +++ head/lib/libc/include/libc_private.h Fri Jun 22 07:13:30 2012 (r237434) @@ -34,6 +34,7 @@ #ifndef _LIBC_PRIVATE_H_ #define _LIBC_PRIVATE_H_ +#include #include /* @@ -245,6 +246,12 @@ extern void * __sys_freebsd6_mmap(void * /* Without back-compat translation */ extern int __sys_fcntl(int, int, ...); +struct timespec; +struct timeval; +struct timezone; +int __sys_gettimeofday(struct timeval *, struct timezone *); +int __sys_clock_gettime(__clockid_t, struct timespec *ts); + /* execve() with PATH processing to implement posix_spawnp() */ int _execvpe(const char *, char * const *, char * const *); Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Fri Jun 22 07:06:40 2012 (r237433) +++ head/lib/libc/sys/Makefile.inc Fri Jun 22 07:13:30 2012 (r237434) @@ -15,6 +15,10 @@ # .sinclude "${.CURDIR}/${LIBC_ARCH}/sys/Makefile.inc" +SRCS+= clock_gettime.c gettimeofday.c __vdso_gettimeofday.c +NOASM+= clock_gettime.o gettimeofday.o +PSEUDO+= _clock_gettime.o _gettimeofday.o + # Sources common to both syscall interfaces: SRCS+= stack_protector.c stack_protector_compat.c __error.c .if !defined(WITHOUT_SYSCALL_COMPAT) Added: head/lib/libc/sys/__vdso_gettimeofday.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/__vdso_gettimeofday.c Fri Jun 22 07:13:30 2012 (r237434) @@ -0,0 +1,142 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include "libc_private.h" + +static u_int +tc_delta(const struct vdso_timehands *th) +{ + + return ((__vdso_gettc(th) - th->th_offset_count) & + th->th_counter_mask); +} + +static int +binuptime(struct bintime *bt, struct vdso_timekeep *tk, int abs) +{ + struct vdso_timehands *th; + uint32_t curr, gen; + + do { + if (!tk->tk_enabled) + return (ENOSYS); + + /* + * XXXKIB. The load of tk->tk_current should use + * atomic_load_acq_32 to provide load barrier. But + * since tk points to r/o mapped page, x86 + * implementation of atomic_load_acq faults. + */ + curr = tk->tk_current; + rmb(); + th = &tk->tk_th[curr]; + if (th->th_algo != VDSO_TH_ALGO_1) + return (ENOSYS); + gen = th->th_gen; + *bt = th->th_offset; + bintime_addx(bt, th->th_scale * tc_delta(th)); + if (abs) + bintime_add(bt, &th->th_boottime); + + /* + * Barrier for load of both tk->tk_current and th->th_gen. + */ + rmb(); + } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen); + return (0); +} + +static struct vdso_timekeep *tk; + +int +__vdso_gettimeofday(struct timeval *tv, struct timezone *tz) +{ + struct bintime bt; + int error; + + if (tz != NULL) + return (ENOSYS); + if (tk == NULL) { + error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); + if (error != 0 || tk == NULL) + return (ENOSYS); + } + if (tk->tk_ver != VDSO_TK_VER_CURR) + return (ENOSYS); + error = binuptime(&bt, tk, 1); + if (error != 0) + return (error); + bintime2timeval(&bt, tv); + return (0); +} + +int +__vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) +{ + struct bintime bt; + int abs, error; + + if (tk == NULL) { + error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); + if (error != 0 || tk == NULL) + return (ENOSYS); + } + if (tk->tk_ver != VDSO_TK_VER_CURR) + return (ENOSYS); + switch (clock_id) { + case CLOCK_REALTIME: + case CLOCK_REALTIME_PRECISE: + case CLOCK_REALTIME_FAST: + case CLOCK_SECOND: + abs = 1; + break; + case CLOCK_MONOTONIC: + case CLOCK_MONOTONIC_PRECISE: + case CLOCK_MONOTONIC_FAST: + case CLOCK_UPTIME: + case CLOCK_UPTIME_PRECISE: + case CLOCK_UPTIME_FAST: + abs = 0; + break; + default: + return (ENOSYS); + } + error = binuptime(&bt, tk, abs); + if (error != 0) + return (error); + bintime2timespec(&bt, ts); + if (clock_id == CLOCK_SECOND) + ts->tv_nsec = 0; + return (0); +} Added: head/lib/libc/sys/clock_gettime.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/clock_gettime.c Fri Jun 22 07:13:30 2012 (r237434) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include "libc_private.h" + +int __clock_gettime(clockid_t, struct timespec *ts); + +__weak_reference(__clock_gettime, clock_gettime); + +int +__clock_gettime(clockid_t clock_id, struct timespec *ts) +{ + int error; + + if (__vdso_clock_gettime != NULL && __vdso_gettc != NULL) + error = __vdso_clock_gettime(clock_id, ts); + else + error = ENOSYS; + if (error == ENOSYS) + error = __sys_clock_gettime(clock_id, ts); + return (error); +} Added: head/lib/libc/sys/gettimeofday.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/gettimeofday.c Fri Jun 22 07:13:30 2012 (r237434) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include "libc_private.h" + +int __gettimeofday(struct timeval *tv, struct timezone *tz); + +__weak_reference(__gettimeofday, gettimeofday); + +int +__gettimeofday(struct timeval *tv, struct timezone *tz) +{ + int error; + + if (__vdso_gettimeofday != NULL && __vdso_gettc != NULL) + error = __vdso_gettimeofday(tv, tz); + else + error = ENOSYS; + if (error == ENOSYS) + error = __sys_gettimeofday(tv, tz); + return (error); +} From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 07:16:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 91443106566C; Fri, 22 Jun 2012 07:16:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C53E8FC14; Fri, 22 Jun 2012 07:16:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M7GUIq063281; Fri, 22 Jun 2012 07:16:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M7GUCQ063278; Fri, 22 Jun 2012 07:16:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206220716.q5M7GUCQ063278@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 22 Jun 2012 07:16:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237435 - in head/sys/i386: i386 include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 07:16:30 -0000 Author: kib Date: Fri Jun 22 07:16:29 2012 New Revision: 237435 URL: http://svn.freebsd.org/changeset/base/237435 Log: Enable shared page on i386, now it has a use for vdso_timehands. MFC after: 1 month Modified: head/sys/i386/i386/elf_machdep.c head/sys/i386/include/vmparam.h Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Fri Jun 22 07:13:30 2012 (r237434) +++ head/sys/i386/i386/elf_machdep.c Fri Jun 22 07:16:29 2012 (r237435) @@ -74,12 +74,15 @@ struct sysentvec elf32_freebsd_sysvec = .sv_setregs = exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32, + .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 | SV_SHP, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, + .sv_shared_page_base = SHAREDPAGE, + .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, }; +INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); static Elf32_Brandinfo freebsd_brand_info = { .brand = ELFOSABI_FREEBSD, Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Fri Jun 22 07:13:30 2012 (r237434) +++ head/sys/i386/include/vmparam.h Fri Jun 22 07:16:29 2012 (r237435) @@ -165,7 +165,8 @@ #define VM_MAXUSER_ADDRESS VADDR(PTDPTDI, 0) -#define USRSTACK VM_MAXUSER_ADDRESS +#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) +#define USRSTACK SHAREDPAGE #define VM_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) #define VM_MIN_ADDRESS ((vm_offset_t)0) From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 07:34:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4397C106566C; Fri, 22 Jun 2012 07:34:58 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id CD8058FC0A; Fri, 22 Jun 2012 07:34:57 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5M7YuVn032715; Fri, 22 Jun 2012 09:34:56 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5M7YuwM032714; Fri, 22 Jun 2012 09:34:56 +0200 (CEST) (envelope-from marius) Date: Fri, 22 Jun 2012 09:34:56 +0200 From: Marius Strobl To: Konstantin Belousov Message-ID: <20120622073455.GE69382@alchemy.franken.de> References: <201206220713.q5M7DVH0063098@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206220713.q5M7DVH0063098@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 07:34:58 -0000 On Fri, Jun 22, 2012 at 07:13:31AM +0000, Konstantin Belousov wrote: > Author: kib > Date: Fri Jun 22 07:13:30 2012 > New Revision: 237434 > URL: http://svn.freebsd.org/changeset/base/237434 > > Log: > Use struct vdso_timehands data to implement fast gettimeofday(2) and > clock_gettime(2) functions if supported. The speedup seen in > microbenchmarks is in range 4x-7x depending on the hardware. > > Only amd64 and i386 architectures are supported. Libc uses rdtsc and > kernel data to calculate current time, if enabled by kernel. I don't know much about x86 CPUs but is my understanding correct that TSCs are not synchronized in any way across CPUs, i.e. reading it on different CPUs may result in time going backwards etc., which is okay for this application though? Marius From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 07:48:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB4651065670; Fri, 22 Jun 2012 07:48:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 7663D8FC15; Fri, 22 Jun 2012 07:48:36 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5M7mHXN093337; Fri, 22 Jun 2012 10:48:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5M7mHEb040779; Fri, 22 Jun 2012 10:48:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5M7mHvo040778; Fri, 22 Jun 2012 10:48:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 22 Jun 2012 10:48:17 +0300 From: Konstantin Belousov To: Marius Strobl Message-ID: <20120622074817.GA2337@deviant.kiev.zoral.com.ua> References: <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BhCmZxNx01sRldsR" Content-Disposition: inline In-Reply-To: <20120622073455.GE69382@alchemy.franken.de> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 07:48:37 -0000 --BhCmZxNx01sRldsR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 22, 2012 at 09:34:56AM +0200, Marius Strobl wrote: > On Fri, Jun 22, 2012 at 07:13:31AM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Fri Jun 22 07:13:30 2012 > > New Revision: 237434 > > URL: http://svn.freebsd.org/changeset/base/237434 > >=20 > > Log: > > Use struct vdso_timehands data to implement fast gettimeofday(2) and > > clock_gettime(2) functions if supported. The speedup seen in > > microbenchmarks is in range 4x-7x depending on the hardware. > > =20 > > Only amd64 and i386 architectures are supported. Libc uses rdtsc and > > kernel data to calculate current time, if enabled by kernel. >=20 > I don't know much about x86 CPUs but is my understanding correct > that TSCs are not synchronized in any way across CPUs, i.e. > reading it on different CPUs may result in time going backwards > etc., which is okay for this application though? Generally speaking, tsc state among different CPU after boot is not synchronized, you are right. Kernel has somewhat doubtful test which verifies whether the after-boot state of tsc looks good. If the test fails, TSC is not enabled by default as timecounter, and then usermode follows kernel policy and falls back to slow syscall. So we err on the safe side. I tested this on Core i7 2xxx, where the test (usually) passes. The test we currently have fails for me at least on single-package Nehalems, where the counter should be located on uncore part. This indicates some brokeness in the code, but I did not investigated the cause. The code can be developed which adjusts tsc msrs to be in sync. Or, rtdscp instruction can be used, which allow to handle counter skew in usermode in race-free manner. While you are there. do you have comments about sparc64 TICK counter ? On SMP, the counter of BSP is used by IPI. Is it unavoidable ? --BhCmZxNx01sRldsR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/kI0EACgkQC3+MBN1Mb4jh9QCgnhWmDbvxGgbSNaOSUQ98p/wZ 5GIAnApRbgba9UHQIdftXy8A4CmfAAYH =kE+o -----END PGP SIGNATURE----- --BhCmZxNx01sRldsR-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 07:51:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A39181065676; Fri, 22 Jun 2012 07:51:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BD818FC21; Fri, 22 Jun 2012 07:51:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M7pFEw064767; Fri, 22 Jun 2012 07:51:15 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M7pF0k064763; Fri, 22 Jun 2012 07:51:15 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201206220751.q5M7pF0k064763@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 22 Jun 2012 07:51:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237436 - in head/sys/dev/cxgbe: . common firmware tom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 07:51:15 -0000 Author: np Date: Fri Jun 22 07:51:15 2012 New Revision: 237436 URL: http://svn.freebsd.org/changeset/base/237436 Log: cxgbe(4): update to firmware interface 1.5.2.0; updates to shared code. Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/firmware/t4fw_cfg.txt head/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/dev/cxgbe/osdep.h head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Fri Jun 22 07:16:29 2012 (r237435) +++ head/sys/dev/cxgbe/common/common.h Fri Jun 22 07:51:15 2012 (r237436) @@ -38,6 +38,8 @@ enum { SERNUM_LEN = 24, /* Serial # length */ EC_LEN = 16, /* E/C length */ ID_LEN = 16, /* ID length */ + PN_LEN = 16, /* Part Number length */ + MACADDR_LEN = 12, /* MAC Address length */ }; enum { MEM_EDC0, MEM_EDC1, MEM_MC }; @@ -62,8 +64,8 @@ enum { }; #define FW_VERSION_MAJOR 1 -#define FW_VERSION_MINOR 4 -#define FW_VERSION_MICRO 16 +#define FW_VERSION_MINOR 5 +#define FW_VERSION_MICRO 2 struct port_stats { u64 tx_octets; /* total # of octets in good frames */ @@ -219,6 +221,8 @@ struct vpd_params { u8 ec[EC_LEN + 1]; u8 sn[SERNUM_LEN + 1]; u8 id[ID_LEN + 1]; + u8 pn[PN_LEN + 1]; + u8 na[MACADDR_LEN + 1]; }; struct pci_params { @@ -356,6 +360,8 @@ void t4_write_indirect(struct adapter *a unsigned int data_reg, const u32 *vals, unsigned int nregs, unsigned int start_idx); +u32 t4_hw_pci_read_cfg4(adapter_t *adapter, int reg); + struct fw_filter_wr; void t4_intr_enable(struct adapter *adapter); @@ -374,7 +380,7 @@ int t4_seeprom_wp(struct adapter *adapte int t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented); int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); -int t4_load_boot(struct adapter *adap, const u8 *boot_data, +int t4_load_boot(struct adapter *adap, u8 *boot_data, unsigned int boot_addr, unsigned int size); unsigned int t4_flash_cfg_addr(struct adapter *adapter); int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); @@ -431,6 +437,9 @@ int t4_mem_read(struct adapter *adap, in __be32 *data); void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); +void t4_get_port_stats_offset(struct adapter *adap, int idx, + struct port_stats *stats, + struct port_stats *offset); void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); void t4_clr_port_stats(struct adapter *adap, int idx); @@ -472,6 +481,10 @@ int t4_fw_hello(struct adapter *adap, un enum dev_master master, enum dev_state *state); int t4_fw_bye(struct adapter *adap, unsigned int mbox); int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); +int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force); +int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset); +int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, + const u8 *fw_data, unsigned int size, int force); int t4_fw_initialize(struct adapter *adap, unsigned int mbox); int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, @@ -484,6 +497,10 @@ int t4_cfg_pfvf(struct adapter *adap, un unsigned int rxqi, unsigned int rxq, unsigned int tc, unsigned int vi, unsigned int cmask, unsigned int pmask, unsigned int exactf, unsigned int rcaps, unsigned int wxcaps); +int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox, + unsigned int port, unsigned int pf, unsigned int vf, + unsigned int nmac, u8 *mac, unsigned int *rss_size, + unsigned int portfunc, unsigned int idstype); int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, unsigned int *rss_size); @@ -524,5 +541,10 @@ int t4_sge_ctxt_rd(struct adapter *adap, enum ctxt_type ctype, u32 *data); int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, u32 *data); +int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); +int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val); +int t4_config_scheduler(struct adapter *adapter, int mode, int level, int pktsize, + int sched_class, int port, int rate, int unit, + int weight, int minrate, int maxrate); #endif /* __CHELSIO_COMMON_H */ Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Fri Jun 22 07:16:29 2012 (r237435) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Jun 22 07:51:15 2012 (r237436) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011 Chelsio Communications, Inc. + * Copyright (c) 2012 Chelsio Communications, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,6 +135,20 @@ void t4_write_indirect(struct adapter *a } /* + * Read a 32-bit PCI Configuration Space register via the PCI-E backdoor + * mechanism. This guarantees that we get the real value even if we're + * operating within a Virtual Machine and the Hypervisor is trapping our + * Configuration Space accesses. + */ +u32 t4_hw_pci_read_cfg4(adapter_t *adap, int reg) +{ + t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, + F_ENABLE | F_LOCALCFG | V_FUNCTION(adap->pf) | + V_REGISTER(reg)); + return t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA); +} + +/* * Get the reply to a mailbox command and store it in @rpl in big-endian order. */ static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, @@ -196,7 +210,6 @@ int t4_wr_mbox_meat(struct adapter *adap u64 res; int i, ms, delay_idx; const __be64 *p = cmd; - u32 data_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_DATA); u32 ctl_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_CTRL); @@ -283,7 +296,7 @@ int t4_mc_read(struct adapter *adap, u32 #define MC_DATA(i) MC_BIST_STATUS_REG(A_MC_BIST_STATUS_RDATA, i) for (i = 15; i >= 0; i--) - *data++ = htonl(t4_read_reg(adap, MC_DATA(i))); + *data++ = ntohl(t4_read_reg(adap, MC_DATA(i))); if (ecc) *ecc = t4_read_reg64(adap, MC_DATA(16)); #undef MC_DATA @@ -321,7 +334,7 @@ int t4_edc_read(struct adapter *adap, in #define EDC_DATA(i) (EDC_BIST_STATUS_REG(A_EDC_BIST_STATUS_RDATA, i) + idx) for (i = 15; i >= 0; i--) - *data++ = htonl(t4_read_reg(adap, EDC_DATA(i))); + *data++ = ntohl(t4_read_reg(adap, EDC_DATA(i))); if (ecc) *ecc = t4_read_reg64(adap, EDC_DATA(16)); #undef EDC_DATA @@ -566,7 +579,7 @@ static int get_vpd_keyword_val(const str static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) { int i, ret, addr; - int ec, sn; + int ec, sn, pn, na; u8 vpd[VPD_LEN], csum; const struct t4_vpd_hdr *v; @@ -602,6 +615,8 @@ static int get_vpd_params(struct adapter } FIND_VPD_KW(ec, "EC"); FIND_VPD_KW(sn, "SN"); + FIND_VPD_KW(pn, "PN"); + FIND_VPD_KW(na, "NA"); #undef FIND_VPD_KW memcpy(p->id, v->id_data, ID_LEN); @@ -611,6 +626,10 @@ static int get_vpd_params(struct adapter i = vpd[sn - VPD_INFO_FLD_HDR_SIZE + 2]; memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); strstrip(p->sn); + memcpy(p->pn, vpd + pn, min(i, PN_LEN)); + strstrip((char *)p->pn); + memcpy(p->na, vpd + na, min(i, MACADDR_LEN)); + strstrip((char *)p->na); return 0; } @@ -954,7 +973,7 @@ int t4_load_cfg(struct adapter *adap, co if (ret || size == 0) goto out; - /* this will write to the flash up to SF_PAGE_SIZE at a time */ + /* this will write to the flash up to SF_PAGE_SIZE at a time */ for (i = 0; i< size; i+= SF_PAGE_SIZE) { if ( (size - i) < SF_PAGE_SIZE) n = size - i; @@ -1056,42 +1075,209 @@ out: return ret; } -/* BIOS boot header */ -typedef struct boot_header_s { - u8 signature[2]; /* signature */ - u8 length; /* image length (include header) */ - u8 offset[4]; /* initialization vector */ - u8 reserved[19]; /* reserved */ - u8 exheader[2]; /* offset to expansion header */ -} boot_header_t; +/* BIOS boot headers */ +typedef struct pci_expansion_rom_header { + u8 signature[2]; /* ROM Signature. Should be 0xaa55 */ + u8 reserved[22]; /* Reserved per processor Architecture data */ + u8 pcir_offset[2]; /* Offset to PCI Data Structure */ +} pci_exp_rom_header_t; /* PCI_EXPANSION_ROM_HEADER */ + +/* Legacy PCI Expansion ROM Header */ +typedef struct legacy_pci_expansion_rom_header { + u8 signature[2]; /* ROM Signature. Should be 0xaa55 */ + u8 size512; /* Current Image Size in units of 512 bytes */ + u8 initentry_point[4]; + u8 cksum; /* Checksum computed on the entire Image */ + u8 reserved[16]; /* Reserved */ + u8 pcir_offset[2]; /* Offset to PCI Data Struture */ +} legacy_pci_exp_rom_header_t; /* LEGACY_PCI_EXPANSION_ROM_HEADER */ + +/* EFI PCI Expansion ROM Header */ +typedef struct efi_pci_expansion_rom_header { + u8 signature[2]; // ROM signature. The value 0xaa55 + u8 initialization_size[2]; /* Units 512. Includes this header */ + u8 efi_signature[4]; /* Signature from EFI image header. 0x0EF1 */ + u8 efi_subsystem[2]; /* Subsystem value for EFI image header */ + u8 efi_machine_type[2]; /* Machine type from EFI image header */ + u8 compression_type[2]; /* Compression type. */ + /* + * Compression type definition + * 0x0: uncompressed + * 0x1: Compressed + * 0x2-0xFFFF: Reserved + */ + u8 reserved[8]; /* Reserved */ + u8 efi_image_header_offset[2]; /* Offset to EFI Image */ + u8 pcir_offset[2]; /* Offset to PCI Data Structure */ +} efi_pci_exp_rom_header_t; /* EFI PCI Expansion ROM Header */ + +/* PCI Data Structure Format */ +typedef struct pcir_data_structure { /* PCI Data Structure */ + u8 signature[4]; /* Signature. The string "PCIR" */ + u8 vendor_id[2]; /* Vendor Identification */ + u8 device_id[2]; /* Device Identification */ + u8 vital_product[2]; /* Pointer to Vital Product Data */ + u8 length[2]; /* PCIR Data Structure Length */ + u8 revision; /* PCIR Data Structure Revision */ + u8 class_code[3]; /* Class Code */ + u8 image_length[2]; /* Image Length. Multiple of 512B */ + u8 code_revision[2]; /* Revision Level of Code/Data */ + u8 code_type; /* Code Type. */ + /* + * PCI Expansion ROM Code Types + * 0x00: Intel IA-32, PC-AT compatible. Legacy + * 0x01: Open Firmware standard for PCI. FCODE + * 0x02: Hewlett-Packard PA RISC. HP reserved + * 0x03: EFI Image. EFI + * 0x04-0xFF: Reserved. + */ + u8 indicator; /* Indicator. Identifies the last image in the ROM */ + u8 reserved[2]; /* Reserved */ +} pcir_data_t; /* PCI__DATA_STRUCTURE */ +/* BOOT constants */ enum { BOOT_FLASH_BOOT_ADDR = 0x0,/* start address of boot image in flash */ BOOT_SIGNATURE = 0xaa55, /* signature of BIOS boot ROM */ BOOT_SIZE_INC = 512, /* image size measured in 512B chunks */ - BOOT_MIN_SIZE = sizeof(boot_header_t), /* at least basic header */ - BOOT_MAX_SIZE = 1024*BOOT_SIZE_INC /* 1 byte * length increment */ + BOOT_MIN_SIZE = sizeof(pci_exp_rom_header_t), /* basic header */ + BOOT_MAX_SIZE = 1024*BOOT_SIZE_INC, /* 1 byte * length increment */ + VENDOR_ID = 0x1425, /* Vendor ID */ + PCIR_SIGNATURE = 0x52494350 /* PCIR signature */ }; /* + * modify_device_id - Modifies the device ID of the Boot BIOS image + * @adatper: the device ID to write. + * @boot_data: the boot image to modify. + * + * Write the supplied device ID to the boot BIOS image. + */ +static void modify_device_id(int device_id, u8 *boot_data) +{ + legacy_pci_exp_rom_header_t *header; + pcir_data_t *pcir_header; + u32 cur_header = 0; + + /* + * Loop through all chained images and change the device ID's + */ + while (1) { + header = (legacy_pci_exp_rom_header_t *) &boot_data[cur_header]; + pcir_header = (pcir_data_t *) &boot_data[cur_header + + le16_to_cpu(*(u16*)header->pcir_offset)]; + + /* + * Only modify the Device ID if code type is Legacy or HP. + * 0x00: Okay to modify + * 0x01: FCODE. Do not be modify + * 0x03: Okay to modify + * 0x04-0xFF: Do not modify + */ + if (pcir_header->code_type == 0x00) { + u8 csum = 0; + int i; + + /* + * Modify Device ID to match current adatper + */ + *(u16*) pcir_header->device_id = device_id; + + /* + * Set checksum temporarily to 0. + * We will recalculate it later. + */ + header->cksum = 0x0; + + /* + * Calculate and update checksum + */ + for (i = 0; i < (header->size512 * 512); i++) + csum += (u8)boot_data[cur_header + i]; + + /* + * Invert summed value to create the checksum + * Writing new checksum value directly to the boot data + */ + boot_data[cur_header + 7] = -csum; + + } else if (pcir_header->code_type == 0x03) { + + /* + * Modify Device ID to match current adatper + */ + *(u16*) pcir_header->device_id = device_id; + + } + + + /* + * Check indicator element to identify if this is the last + * image in the ROM. + */ + if (pcir_header->indicator & 0x80) + break; + + /* + * Move header pointer up to the next image in the ROM. + */ + cur_header += header->size512 * 512; + } +} + +/* * t4_load_boot - download boot flash * @adapter: the adapter * @boot_data: the boot image to write + * @boot_addr: offset in flash to write boot_data * @size: image size * * Write the supplied boot image to the card's serial flash. * The boot image has the following sections: a 28-byte header and the * boot image. */ -int t4_load_boot(struct adapter *adap, const u8 *boot_data, +int t4_load_boot(struct adapter *adap, u8 *boot_data, unsigned int boot_addr, unsigned int size) { + pci_exp_rom_header_t *header; + int pcir_offset ; + pcir_data_t *pcir_header; int ret, addr; + uint16_t device_id; unsigned int i; unsigned int boot_sector = boot_addr * 1024; unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec; /* + * Make sure the boot image does not encroach on the firmware region + */ + if ((boot_sector + size) >> 16 > FLASH_FW_START_SEC) { + CH_ERR(adap, "boot image encroaching on firmware region\n"); + return -EFBIG; + } + + /* + * Number of sectors spanned + */ + i = DIV_ROUND_UP(size ? size : FLASH_BOOTCFG_MAX_SIZE, + sf_sec_size); + ret = t4_flash_erase_sectors(adap, boot_sector >> 16, + (boot_sector >> 16) + i - 1); + + /* + * If size == 0 then we're simply erasing the FLASH sectors associated + * with the on-adapter option ROM file + */ + if (ret || (size == 0)) + goto out; + + /* Get boot header */ + header = (pci_exp_rom_header_t *)boot_data; + pcir_offset = le16_to_cpu(*(u16 *)header->pcir_offset); + /* PCIR Data Structure */ + pcir_header = (pcir_data_t *) &boot_data[pcir_offset]; + + /* * Perform some primitive sanity testing to avoid accidentally * writing garbage over the boot sectors. We ought to check for * more but it's not worth it for now ... @@ -1102,18 +1288,46 @@ int t4_load_boot(struct adapter *adap, c } /* - * Make sure the boot image does not encroach on the firmware region + * Check BOOT ROM header signature */ - if ((boot_sector + size) >> 16 > FLASH_FW_START_SEC) { - CH_ERR(adap, "boot image encroaching on firmware region\n"); - return -EFBIG; + if (le16_to_cpu(*(u16*)header->signature) != BOOT_SIGNATURE ) { + CH_ERR(adap, "Boot image missing signature\n"); + return -EINVAL; } - i = DIV_ROUND_UP(size, sf_sec_size); /* # of sectors spanned */ - ret = t4_flash_erase_sectors(adap, boot_sector >> 16, - (boot_sector >> 16) + i - 1); - if (ret) - goto out; + /* + * Check PCI header signature + */ + if (le32_to_cpu(*(u32*)pcir_header->signature) != PCIR_SIGNATURE) { + CH_ERR(adap, "PCI header missing signature\n"); + return -EINVAL; + } + + /* + * Check Vendor ID matches Chelsio ID + */ + if (le16_to_cpu(*(u16*)pcir_header->vendor_id) != VENDOR_ID) { + CH_ERR(adap, "Vendor ID missing signature\n"); + return -EINVAL; + } + + /* + * Retrieve adapter's device ID + */ + t4_os_pci_read_cfg2(adap, PCI_DEVICE_ID, &device_id); + /* Want to deal with PF 0 so I strip off PF 4 indicator */ + device_id = (device_id & 0xff) | 0x4000; + + /* + * Check PCIE Device ID + */ + if (le16_to_cpu(*(u16*)pcir_header->device_id) != device_id) { + /* + * Change the device ID in the Boot BIOS image to match + * the Device ID of the current adapter. + */ + modify_device_id(device_id, boot_data); + } /* * Skip over the first SF_PAGE_SIZE worth of data and write it after @@ -3206,7 +3420,11 @@ void t4_get_chan_txrate(struct adapter * * @enable: whether to enable or disable the filter * * Configures one of the tracing filters available in HW. If @enable is - * %0 @tp is not examined and may be %NULL. + * %0 @tp is not examined and may be %NULL. The user is responsible to + * set the single/multiple trace mode by writing to A_MPS_TRC_CFG register + * by using "cxgbtool iface reg reg_addr=val" command. See t4_sniffer/ + * docs/readme.txt for a complete description of how to setup traceing on + * T4. */ int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, int idx, int enable) @@ -3217,45 +3435,45 @@ int t4_set_trace_filter(struct adapter * if (!enable) { t4_write_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - goto out; + return 0; } - if (tp->port > 11 || tp->invert > 1 || tp->skip_len > M_TFLENGTH || - tp->skip_ofst > M_TFOFFSET || tp->min_len > M_TFMINPKTSIZE || - tp->snap_len > 9600 || (idx && tp->snap_len > 256)) - return -EINVAL; - - if (tp->snap_len > 256) { /* must be tracer 0 */ - if ((t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + 4) | - t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + 8) | - t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + 12)) & - F_TFEN) - return -EINVAL; /* other tracers are enabled */ + /* + * TODO - After T4 data book is updated, specify the exact + * section below. + * + * See T4 data book - MPS section for a complete description + * of the below if..else handling of A_MPS_TRC_CFG register + * value. + */ + cfg = t4_read_reg(adap, A_MPS_TRC_CFG); + if (cfg & F_TRCMULTIFILTER) { + /* + * If multiple tracers are enabled, then maximum + * capture size is 2.5KB (FIFO size of a single channel) + * minus 2 flits for CPL_TRACE_PKT header. + */ + if (tp->snap_len > ((10 * 1024 / 4) - (2 * 8))) + return -EINVAL; + } + else { + /* + * If multiple tracers are disabled, to avoid deadlocks + * maximum packet capture size of 9600 bytes is recommended. + * Also in this mode, only trace0 can be enabled and running. + */ multitrc = 0; - } else if (idx) { - i = t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_B); - if (G_TFCAPTUREMAX(i) > 256 && - (t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A) & F_TFEN)) + if (tp->snap_len > 9600 || idx) return -EINVAL; } + if (tp->port > 11 || tp->invert > 1 || tp->skip_len > M_TFLENGTH || + tp->skip_ofst > M_TFOFFSET || tp->min_len > M_TFMINPKTSIZE) + return -EINVAL; + /* stop the tracer we'll be changing */ t4_write_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - /* disable tracing globally if running in the wrong single/multi mode */ - cfg = t4_read_reg(adap, A_MPS_TRC_CFG); - if ((cfg & F_TRCEN) && multitrc != (cfg & F_TRCMULTIFILTER)) { - t4_write_reg(adap, A_MPS_TRC_CFG, cfg ^ F_TRCEN); - t4_read_reg(adap, A_MPS_TRC_CFG); /* flush */ - msleep(1); - if (!(t4_read_reg(adap, A_MPS_TRC_CFG) & F_TRCFIFOEMPTY)) - return -ETIMEDOUT; - } - /* - * At this point either the tracing is enabled and in the right mode or - * disabled. - */ - idx *= (A_MPS_TRC_FILTER1_MATCH - A_MPS_TRC_FILTER0_MATCH); data_reg = A_MPS_TRC_FILTER0_MATCH + idx; mask_reg = A_MPS_TRC_FILTER0_DONT_CARE + idx; @@ -3271,9 +3489,6 @@ int t4_set_trace_filter(struct adapter * V_TFOFFSET(tp->skip_ofst) | V_TFLENGTH(tp->skip_len) | V_TFPORT(tp->port) | F_TFEN | V_TFINVERTMATCH(tp->invert)); - cfg &= ~F_TRCMULTIFILTER; - t4_write_reg(adap, A_MPS_TRC_CFG, cfg | F_TRCEN | multitrc); -out: t4_read_reg(adap, A_MPS_TRC_CFG); /* flush */ return 0; } @@ -3373,6 +3588,28 @@ static unsigned int get_mps_bg_map(struc } /** + * t4_get_port_stats_offset - collect port stats relative to a previous + * snapshot + * @adap: The adapter + * @idx: The port + * @stats: Current stats to fill + * @offset: Previous stats snapshot + */ +void t4_get_port_stats_offset(struct adapter *adap, int idx, + struct port_stats *stats, + struct port_stats *offset) +{ + u64 *s, *o; + int i; + + t4_get_port_stats(adap, idx, stats); + for (i = 0, s = (u64 *)stats, o = (u64 *)offset ; + i < (sizeof(struct port_stats)/sizeof(u64)) ; + i++, s++, o++) + *s -= *o; +} + +/** * t4_get_port_stats - collect port statistics * @adap: the adapter * @idx: the port index @@ -3633,6 +3870,20 @@ void t4_mk_filtdelwr(unsigned int ftid, (var).retval_len16 = htonl(FW_LEN16(var)); \ } while (0) +int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val) +{ + struct fw_ldst_cmd c; + + memset(&c, 0, sizeof(c)); + c.op_to_addrspace = htonl(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | + F_FW_CMD_WRITE | V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FIRMWARE)); + c.cycles_to_len16 = htonl(FW_LEN16(c)); + c.u.addrval.addr = htonl(addr); + c.u.addrval.val = htonl(val); + + return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); +} + /** * t4_mdio_rd - read a PHY register through MDIO * @adap: the adapter @@ -3693,6 +3944,30 @@ int t4_mdio_wr(struct adapter *adap, uns } /** + * t4_sge_ctxt_flush - flush the SGE context cache + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * + * Issues a FW command through the given mailbox to flush the + * SGE context cache. + */ +int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox) +{ + int ret; + struct fw_ldst_cmd c; + + memset(&c, 0, sizeof(c)); + c.op_to_addrspace = htonl(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | + F_FW_CMD_READ | + V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_SGE_EGRC)); + c.cycles_to_len16 = htonl(FW_LEN16(c)); + c.u.idctxt.msg_ctxtflush = htonl(F_FW_LDST_CMD_CTXTFLUSH); + + ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); + return ret; +} + +/** * t4_sge_ctxt_rd - read an SGE context through FW * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -3764,9 +4039,10 @@ int t4_sge_ctxt_rd_bd(struct adapter *ad * @mbox: mailbox to use for the FW command * @evt_mbox: mailbox to receive async FW events * @master: specifies the caller's willingness to be the device master - * @state: returns the current device state + * @state: returns the current device state (if non-NULL) * - * Issues a command to establish communication with FW. + * Issues a command to establish communication with FW. Returns either + * an error (negative integer) or the mailbox of the Master PF. */ int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, enum dev_master master, enum dev_state *state) @@ -3918,6 +4194,175 @@ int t4_fw_reset(struct adapter *adap, un } /** + * t4_fw_halt - issue a reset/halt to FW and put uP into RESET + * @adap: the adapter + * @mbox: mailbox to use for the FW RESET command (if desired) + * @force: force uP into RESET even if FW RESET command fails + * + * Issues a RESET command to firmware (if desired) with a HALT indication + * and then puts the microprocessor into RESET state. The RESET command + * will only be issued if a legitimate mailbox is provided (mbox <= + * M_PCIE_FW_MASTER). + * + * This is generally used in order for the host to safely manipulate the + * adapter without fear of conflicting with whatever the firmware might + * be doing. The only way out of this state is to RESTART the firmware + * ... + */ +int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force) +{ + int ret = 0; + + /* + * If a legitimate mailbox is provided, issue a RESET command + * with a HALT indication. + */ + if (mbox <= M_PCIE_FW_MASTER) { + struct fw_reset_cmd c; + + memset(&c, 0, sizeof(c)); + INIT_CMD(c, RESET, WRITE); + c.val = htonl(F_PIORST | F_PIORSTMODE); + c.halt_pkd = htonl(F_FW_RESET_CMD_HALT); + ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); + } + + /* + * Normally we won't complete the operation if the firmware RESET + * command fails but if our caller insists we'll go ahead and put the + * uP into RESET. This can be useful if the firmware is hung or even + * missing ... We'll have to take the risk of putting the uP into + * RESET without the cooperation of firmware in that case. + * + * We also force the firmware's HALT flag to be on in case we bypassed + * the firmware RESET command above or we're dealing with old firmware + * which doesn't have the HALT capability. This will serve as a flag + * for the incoming firmware to know that it's coming out of a HALT + * rather than a RESET ... if it's new enough to understand that ... + */ + if (ret == 0 || force) { + t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, F_UPCRST); + t4_set_reg_field(adap, A_PCIE_FW, F_PCIE_FW_HALT, F_PCIE_FW_HALT); + } + + /* + * And we always return the result of the firmware RESET command + * even when we force the uP into RESET ... + */ + return ret; +} + +/** + * t4_fw_restart - restart the firmware by taking the uP out of RESET + * @adap: the adapter + * @reset: if we want to do a RESET to restart things + * + * Restart firmware previously halted by t4_fw_halt(). On successful + * return the previous PF Master remains as the new PF Master and there + * is no need to issue a new HELLO command, etc. + * + * We do this in two ways: + * + * 1. If we're dealing with newer firmware we'll simply want to take + * the chip's microprocessor out of RESET. This will cause the + * firmware to start up from its start vector. And then we'll loop + * until the firmware indicates it's started again (PCIE_FW.HALT + * reset to 0) or we timeout. + * + * 2. If we're dealing with older firmware then we'll need to RESET + * the chip since older firmware won't recognize the PCIE_FW.HALT + * flag and automatically RESET itself on startup. + */ +int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset) +{ + if (reset) { + /* + * Since we're directing the RESET instead of the firmware + * doing it automatically, we need to clear the PCIE_FW.HALT + * bit. + */ + t4_set_reg_field(adap, A_PCIE_FW, F_PCIE_FW_HALT, 0); + + /* + * If we've been given a valid mailbox, first try to get the + * firmware to do the RESET. If that works, great and we can + * return success. Otherwise, if we haven't been given a + * valid mailbox or the RESET command failed, fall back to + * hitting the chip with a hammer. + */ + if (mbox <= M_PCIE_FW_MASTER) { + t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, 0); + msleep(100); + if (t4_fw_reset(adap, mbox, + F_PIORST | F_PIORSTMODE) == 0) + return 0; + } + + t4_write_reg(adap, A_PL_RST, F_PIORST | F_PIORSTMODE); + msleep(2000); + } else { + int ms; + + t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, 0); + for (ms = 0; ms < FW_CMD_MAX_TIMEOUT; ) { + if (!(t4_read_reg(adap, A_PCIE_FW) & F_PCIE_FW_HALT)) + return FW_SUCCESS; + msleep(100); + ms += 100; + } + return -ETIMEDOUT; + } + return 0; +} + +/** + * t4_fw_upgrade - perform all of the steps necessary to upgrade FW + * @adap: the adapter + * @mbox: mailbox to use for the FW RESET command (if desired) + * @fw_data: the firmware image to write + * @size: image size + * @force: force upgrade even if firmware doesn't cooperate + * + * Perform all of the steps necessary for upgrading an adapter's + * firmware image. Normally this requires the cooperation of the + * existing firmware in order to halt all existing activities + * but if an invalid mailbox token is passed in we skip that step + * (though we'll still put the adapter microprocessor into RESET in + * that case). + * + * On successful return the new firmware will have been loaded and + * the adapter will have been fully RESET losing all previous setup + * state. On unsuccessful return the adapter may be completely hosed ... + * positive errno indicates that the adapter is ~probably~ intact, a + * negative errno indicates that things are looking bad ... + */ +int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, + const u8 *fw_data, unsigned int size, int force) +{ + const struct fw_hdr *fw_hdr = (const struct fw_hdr *)fw_data; + int reset, ret; + + ret = t4_fw_halt(adap, mbox, force); + if (ret < 0 && !force) + return ret; + + ret = t4_load_fw(adap, fw_data, size); + if (ret < 0) + return ret; + + /* + * Older versions of the firmware don't understand the new + * PCIE_FW.HALT flag and so won't know to perform a RESET when they + * restart. So for newly loaded older firmware we'll have to do the + * RESET for it so it starts up on a clean slate. We can tell if + * the newly loaded firmware will handle this right by checking + * its header flags to see if it advertises the capability. + */ + reset = ((ntohl(fw_hdr->flags) & FW_HDR_FLAGS_RESET_HALT) == 0); + return t4_fw_restart(adap, mbox, reset); +} + +/** * t4_fw_initialize - ask FW to initialize the device * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -4059,7 +4504,7 @@ int t4_cfg_pfvf(struct adapter *adap, un } /** - * t4_alloc_vi - allocate a virtual interface + * t4_alloc_vi_func - allocate a virtual interface * @adap: the adapter * @mbox: mailbox to use for the FW command * @port: physical port associated with the VI @@ -4068,6 +4513,8 @@ int t4_cfg_pfvf(struct adapter *adap, un * @nmac: number of MAC addresses needed (1 to 5) * @mac: the MAC addresses of the VI * @rss_size: size of RSS table slice associated with this VI + * @portfunc: which Port Application Function MAC Address is desired + * @idstype: Intrusion Detection Type * * Allocates a virtual interface for the given physical port. If @mac is * not %NULL it contains the MAC addresses of the VI as assigned by FW. @@ -4075,9 +4522,10 @@ int t4_cfg_pfvf(struct adapter *adap, un * stored consecutively so the space needed is @nmac * 6 bytes. * Returns a negative error number or the non-negative VI id. */ -int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, - unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, - unsigned int *rss_size) +int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox, + unsigned int port, unsigned int pf, unsigned int vf, + unsigned int nmac, u8 *mac, unsigned int *rss_size, + unsigned int portfunc, unsigned int idstype) { int ret; struct fw_vi_cmd c; @@ -4087,6 +4535,8 @@ int t4_alloc_vi(struct adapter *adap, un F_FW_CMD_WRITE | F_FW_CMD_EXEC | V_FW_VI_CMD_PFN(pf) | V_FW_VI_CMD_VFN(vf)); c.alloc_to_len16 = htonl(F_FW_VI_CMD_ALLOC | FW_LEN16(c)); + c.type_to_viid = htons(V_FW_VI_CMD_TYPE(idstype) | + V_FW_VI_CMD_FUNC(portfunc)); c.portid_pkd = V_FW_VI_CMD_PORTID(port); c.nmac = nmac - 1; @@ -4109,7 +4559,30 @@ int t4_alloc_vi(struct adapter *adap, un } if (rss_size) *rss_size = G_FW_VI_CMD_RSSSIZE(ntohs(c.rsssize_pkd)); - return G_FW_VI_CMD_VIID(ntohs(c.type_to_viid)); + return G_FW_VI_CMD_VIID(htons(c.type_to_viid)); +} + +/** + * t4_alloc_vi - allocate an [Ethernet Function] virtual interface + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @port: physical port associated with the VI + * @pf: the PF owning the VI + * @vf: the VF owning the VI + * @nmac: number of MAC addresses needed (1 to 5) + * @mac: the MAC addresses of the VI + * @rss_size: size of RSS table slice associated with this VI + * + * backwards compatible and convieniance routine to allocate a Virtual + * Interface with a Ethernet Port Application Function and Intrustion + * Detection System disabled. + */ +int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, + unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, + unsigned int *rss_size) +{ + return t4_alloc_vi_func(adap, mbox, port, pf, vf, nmac, mac, rss_size, + FW_VI_FUNC_ETH, 0); } /** @@ -4214,7 +4687,7 @@ int t4_alloc_mac_filt(struct adapter *ad unsigned int nfilters = 0; unsigned int rem = naddr; - if (naddr > FW_CLS_TCAM_NUM_ENTRIES) + if (naddr > NUM_MPS_CLS_SRAM_L_INSTANCES) return -EINVAL; for (offset = 0; offset < naddr ; /**/) { @@ -4255,10 +4728,10 @@ int t4_alloc_mac_filt(struct adapter *ad u16 index = G_FW_VI_MAC_CMD_IDX(ntohs(p->valid_to_idx)); if (idx) - idx[offset+i] = (index >= FW_CLS_TCAM_NUM_ENTRIES + idx[offset+i] = (index >= NUM_MPS_CLS_SRAM_L_INSTANCES ? 0xffff : index); - if (index < FW_CLS_TCAM_NUM_ENTRIES) + if (index < NUM_MPS_CLS_SRAM_L_INSTANCES) nfilters++; else if (hash) *hash |= (1ULL << hash_mac_addr(addr[offset+i])); @@ -4319,7 +4792,7 @@ int t4_change_mac(struct adapter *adap, ret = t4_wr_mbox_ns(adap, mbox, &c, sizeof(c), &c); if (ret == 0) { ret = G_FW_VI_MAC_CMD_IDX(ntohs(p->valid_to_idx)); - if (ret >= FW_CLS_TCAM_NUM_ENTRIES) + if (ret >= NUM_MPS_CLS_SRAM_L_INSTANCES) ret = -ENOMEM; } return ret; @@ -4540,10 +5013,12 @@ int t4_ofld_eq_free(struct adapter *adap int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) { u8 opcode = *(const u8 *)rpl; + const struct fw_port_cmd *p = (const void *)rpl; + unsigned int action = G_FW_PORT_CMD_ACTION(ntohl(p->action_to_len16)); - if (opcode == FW_PORT_CMD) { /* link/module state change message */ + if (opcode == FW_PORT_CMD && action == FW_PORT_ACTION_GET_PORT_INFO) { + /* link/module state change message */ int speed = 0, fc = 0, i; - const struct fw_port_cmd *p = (const void *)rpl; int chan = G_FW_PORT_CMD_PORTID(ntohl(p->op_to_portid)); struct port_info *pi = NULL; struct link_config *lc; @@ -4580,6 +5055,10 @@ int t4_handle_fw_rpl(struct adapter *ada pi->mod_type = mod; t4_os_portmod_changed(adap, i); } + } else { + CH_WARN_RATELIMIT(adap, + "Unknown firmware reply 0x%x (0x%x)\n", opcode, action); + return -EINVAL; } return 0; } @@ -4706,6 +5185,11 @@ int __devinit t4_prep_adapter(struct ada get_pci_mode(adapter, &adapter->params.pci); adapter->params.rev = t4_read_reg(adapter, A_PL_REV); + /* T4A1 chip is no longer supported */ + if (adapter->params.rev == 1) { + CH_ALERT(adapter, "T4 rev 1 chip is no longer supported\n"); + return -EINVAL; + } adapter->params.pci.vpd_cap_addr = t4_os_find_pci_capability(adapter, PCI_CAP_ID_VPD); @@ -4717,9 +5201,11 @@ int __devinit t4_prep_adapter(struct ada if (ret < 0) return ret; - if (t4_read_reg(adapter, A_SGE_PC0_REQ_BIST_CMD) != 0xffffffff) { + if (t4_read_reg(adapter, A_PCIE_REVISION) != 0) { + /* FPGA */ adapter->params.cim_la_size = 2 * CIMLA_SIZE; } else { + /* ASIC */ adapter->params.cim_la_size = CIMLA_SIZE; } @@ -4783,3 +5269,43 @@ int __devinit t4_port_init(struct port_i return 0; } + +int t4_config_scheduler(struct adapter *adapter, int mode, int level, + int pktsize, int sched_class, int port, int unit, + int rate, int weight, int minrate, int maxrate) +{ + struct fw_sched_cmd cmd, rpl; + + if (rate < 0 || unit < 0) + return -EINVAL; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 08:09:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A091106564A; Fri, 22 Jun 2012 08:09:03 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id D715A8FC12; Fri, 22 Jun 2012 08:09:01 +0000 (UTC) Received: by lbon10 with SMTP id n10so3979240lbo.13 for ; Fri, 22 Jun 2012 01:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=8HIyPyCPmtu17dYLtBtk4zhogIHbPbrHS+kVhInLupI=; b=xjREB0lyB5q2BN/vsIPKtvHxrp4yIa5tLk4Zz2ohOWJZc54Vsp1BmGPsChC0z6HRHt w65eWIDDwMWZh3pmVBSaiRfga4mwQWjPMnNIE8r0813zR6O06OpU+RNZ0Gmlgp5GY51I YfEnxdm9n9iVKZA4LTLebq8fX7Tc6/+wNbgB1O6+USX0nedr5U4L7qN7EJFHG6uwv4Jw UJW7mwTFgVtV6CheLIZIoD1yFFS41a8CQso4mC41HVhu6mlqrY1SIKgs30n6lLzUhoQN twhOU8QflMF2o61dXmMir03nQi1lPkigf7JyHXeR/U2vOlX/PHDPXVjCaTTQw7V6qV10 Jk5A== Received: by 10.152.132.40 with SMTP id or8mr1199663lab.24.1340352534664; Fri, 22 Jun 2012 01:08:54 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id fd1sm20373044lbb.7.2012.06.22.01.08.52 (version=SSLv3 cipher=OTHER); Fri, 22 Jun 2012 01:08:53 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FE42812.3050807@FreeBSD.org> Date: Fri, 22 Jun 2012 11:08:50 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120506 Thunderbird/12.0.1 MIME-Version: 1.0 To: Konstantin Belousov References: <201206220706.q5M76fbO062751@svn.freebsd.org> In-Reply-To: <201206220706.q5M76fbO062751@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237433 - in head/sys: amd64/include arm/include conf i386/include ia64/include kern mips/include pc98/include powerpc/include sparc64/include sys x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 08:09:03 -0000 On 06/22/12 10:06, Konstantin Belousov wrote: > Author: kib > Date: Fri Jun 22 07:06:40 2012 > New Revision: 237433 > URL: http://svn.freebsd.org/changeset/base/237433 > > Log: > Implement mechanism to export some kernel timekeeping data to > usermode, using shared page. The structures and functions have vdso > prefix, to indicate the intended location of the code in some future. > > The versioned per-algorithm data is exported in the format of struct > vdso_timehands, which mostly repeats the content of in-kernel struct > timehands. Usermode reading of the structure can be lockless. > Compatibility export for 32bit processes on 64bit host is also > provided. Kernel also provides usermode with indication about > currently used timecounter, so that libc can fall back to syscall if > configured timecounter is unknown to usermode code. > > The shared data updates are initiated both from the tc_windup(), where > a fast task is queued to do the update, and from sysctl handlers which > change timecounter. A manual override switch > kern.timecounter.fast_gettime allows to turn off the mechanism. > > Only x86 architectures export the real algorithm data, and there, only > for tsc timecounter. HPET counters page could be exported as well, but > I prefer to not further glue the kernel and libc ABI there until > proper vdso-based solution is developed. > > Minimal stubs neccessary for non-x86 architectures to still compile > are provided. > > Discussed with: bde > Reviewed by: jhb > Tested by: flo > MFC after: 1 month > @@ -1360,6 +1367,7 @@ tc_windup(void) > #endif > > timehands = th; > + taskqueue_enqueue_fast(taskqueue_fast,&tc_windup_push_vdso_task); > } > > /* Report or change the active timecounter hardware. */ This taskqueue_enqueue_fast() will schedule extra thread to run each time hardclock() fires. One thread may be not a big problem, but together with callout swi and possible other threads woken up there it will wake up several other CPU cores from sleep just to put them back in few microseconds. Now davide@ and me are trying to fix that by avoiding callout SWI use for simple tasks. Please, let's not create another problem same time. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 08:11:38 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2DC40106564A; Fri, 22 Jun 2012 08:11:38 +0000 (UTC) (envelope-from theraven@theravensnest.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) by mx1.freebsd.org (Postfix) with ESMTP id EB8488FC16; Fri, 22 Jun 2012 08:11:37 +0000 (UTC) Received: from [192.168.0.2] (cpc2-cmbg15-2-0-cust445.5-4.cable.virginmedia.com [86.26.13.190]) (authenticated bits=0) by theravensnest.org (8.14.5/8.14.5) with ESMTP id q5M7fh02050990 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Fri, 22 Jun 2012 07:41:45 GMT (envelope-from theraven@theravensnest.org) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <20120622073455.GE69382@alchemy.franken.de> Date: Fri, 22 Jun 2012 08:41:38 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de> To: Marius Strobl X-Mailer: Apple Mail (2.1257) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Konstantin Belousov Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 08:11:38 -0000 On 22 Jun 2012, at 08:34, Marius Strobl wrote: > I don't know much about x86 CPUs but is my understanding correct > that TSCs are not synchronized in any way across CPUs, i.e. > reading it on different CPUs may result in time going backwards > etc., which is okay for this application though? As long as the initial value is set on every context switch, it only = matters that the TSC is monotonic and increments at an approximately = constant rate. It is also possible to set the TSC value, but that's = less useful in this context. The one thing to be careful about is the fact that certain power saving = states will affect the speed at which the TSC increments, and so it is = important to update the ticks-per-second value whenever a core goes into = a low power state. This is more or less the same approach used by Xen, so most of the = issues have been ironed out: Oracle complained to CPU vendors about a = few corner cases and, because Oracle customers tend to buy a lot of = expensive Xeon and Opteron chips, they were fixed quite promptly. =20 David From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 08:25:10 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECC2D1065672; Fri, 22 Jun 2012 08:25:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 6A03F8FC0C; Fri, 22 Jun 2012 08:25:10 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5M8P2ST002909; Fri, 22 Jun 2012 11:25:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5M8P2T6041027; Fri, 22 Jun 2012 11:25:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5M8P2Y0041026; Fri, 22 Jun 2012 11:25:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 22 Jun 2012 11:25:02 +0300 From: Konstantin Belousov To: Alexander Motin Message-ID: <20120622082502.GB2337@deviant.kiev.zoral.com.ua> References: <201206220706.q5M76fbO062751@svn.freebsd.org> <4FE42812.3050807@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sEXf5qLefa2bWrwX" Content-Disposition: inline In-Reply-To: <4FE42812.3050807@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237433 - in head/sys: amd64/include arm/include conf i386/include ia64/include kern mips/include pc98/include powerpc/include sparc64/include sys x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 08:25:11 -0000 --sEXf5qLefa2bWrwX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 22, 2012 at 11:08:50AM +0300, Alexander Motin wrote: > On 06/22/12 10:06, Konstantin Belousov wrote: > >Author: kib > >Date: Fri Jun 22 07:06:40 2012 > >New Revision: 237433 > >URL: http://svn.freebsd.org/changeset/base/237433 > > > >Log: > > Implement mechanism to export some kernel timekeeping data to > > usermode, using shared page. The structures and functions have vdso > > prefix, to indicate the intended location of the code in some future. > > > > The versioned per-algorithm data is exported in the format of struct > > vdso_timehands, which mostly repeats the content of in-kernel struct > > timehands. Usermode reading of the structure can be lockless. > > Compatibility export for 32bit processes on 64bit host is also > > provided. Kernel also provides usermode with indication about > > currently used timecounter, so that libc can fall back to syscall if > > configured timecounter is unknown to usermode code. > > > > The shared data updates are initiated both from the tc_windup(), where > > a fast task is queued to do the update, and from sysctl handlers which > > change timecounter. A manual override switch > > kern.timecounter.fast_gettime allows to turn off the mechanism. > > > > Only x86 architectures export the real algorithm data, and there, only > > for tsc timecounter. HPET counters page could be exported as well, but > > I prefer to not further glue the kernel and libc ABI there until > > proper vdso-based solution is developed. > > > > Minimal stubs neccessary for non-x86 architectures to still compile > > are provided. > > > > Discussed with: bde > > Reviewed by: jhb > > Tested by: flo > > MFC after: 1 month >=20 >=20 > >@@ -1360,6 +1367,7 @@ tc_windup(void) > > #endif > > > > timehands =3D th; > >+ taskqueue_enqueue_fast(taskqueue_fast,&tc_windup_push_vdso_task); > > } > > > > /* Report or change the active timecounter hardware. */ >=20 > This taskqueue_enqueue_fast() will schedule extra thread to run each=20 > time hardclock() fires. One thread may be not a big problem, but=20 > together with callout swi and possible other threads woken up there it=20 > will wake up several other CPU cores from sleep just to put them back in= =20 > few microseconds. Now davide@ and me are trying to fix that by avoiding= =20 > callout SWI use for simple tasks. Please, let's not create another=20 > problem same time. The patch was public for quite a time. If you have some comments about it, it would be much more productive to let me know about them before the commit, not after. Anyway, what is your proposal for 'let's not create another problem same time' part of the message ? It was discussed, as a possibility, to have permanent mapping for the shared page in the KVA and to perform lock-less update of the struct vdso_timehands directly from hardclock handler. My opinion was that amount of work added by tc_windup eventhandler is not trivial, so it is better to be postponed to less critical context. It also slightly more safe to not perform lockless update for vdso_timehands, since otherwise module load which register exec handler could cause transient gettimeofday() failure in usermode. This might boil down to the fact that tc_windup function is called too often, in fact. Also, packing execution of tc_windup eventhandler together with the clock swi is fine from my POV. --sEXf5qLefa2bWrwX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/kK94ACgkQC3+MBN1Mb4i4lwCffVntk+LpPG5jXWFpo5em9EGt tRMAoKna5jQBrk/bloJfcNV0uK9iNM4z =IBkC -----END PGP SIGNATURE----- --sEXf5qLefa2bWrwX-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 08:37:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4FBA4106564A; Fri, 22 Jun 2012 08:37:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21DB38FC15; Fri, 22 Jun 2012 08:37:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M8bXRk066829; Fri, 22 Jun 2012 08:37:33 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M8bXEg066827; Fri, 22 Jun 2012 08:37:33 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201206220837.q5M8bXEg066827@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 22 Jun 2012 08:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237439 - head/sys/dev/cxgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 08:37:34 -0000 Author: np Date: Fri Jun 22 08:37:33 2012 New Revision: 237439 URL: http://svn.freebsd.org/changeset/base/237439 Log: Do not read registers with read side effects while performing a register dump for cxgbetool. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jun 22 07:53:51 2012 (r237438) +++ head/sys/dev/cxgbe/t4_main.c Fri Jun 22 08:37:33 2012 (r237439) @@ -2705,7 +2705,9 @@ t4_get_regs(struct adapter *sc, struct t 0xdfc0, 0xdfe0, 0xe000, 0xea7c, 0xf000, 0x11190, - 0x19040, 0x19124, + 0x19040, 0x1906c, + 0x19078, 0x19080, + 0x1908c, 0x19124, 0x19150, 0x191b0, 0x191d0, 0x191e8, 0x19238, 0x1924c, @@ -2718,49 +2720,49 @@ t4_get_regs(struct adapter *sc, struct t 0x1a190, 0x1a1c4, 0x1a1fc, 0x1a1fc, 0x1e040, 0x1e04c, - 0x1e240, 0x1e28c, + 0x1e284, 0x1e28c, 0x1e2c0, 0x1e2c0, 0x1e2e0, 0x1e2e0, 0x1e300, 0x1e384, 0x1e3c0, 0x1e3c8, 0x1e440, 0x1e44c, - 0x1e640, 0x1e68c, + 0x1e684, 0x1e68c, 0x1e6c0, 0x1e6c0, 0x1e6e0, 0x1e6e0, 0x1e700, 0x1e784, 0x1e7c0, 0x1e7c8, 0x1e840, 0x1e84c, - 0x1ea40, 0x1ea8c, + 0x1ea84, 0x1ea8c, 0x1eac0, 0x1eac0, 0x1eae0, 0x1eae0, 0x1eb00, 0x1eb84, 0x1ebc0, 0x1ebc8, 0x1ec40, 0x1ec4c, - 0x1ee40, 0x1ee8c, + 0x1ee84, 0x1ee8c, 0x1eec0, 0x1eec0, 0x1eee0, 0x1eee0, 0x1ef00, 0x1ef84, 0x1efc0, 0x1efc8, 0x1f040, 0x1f04c, - 0x1f240, 0x1f28c, + 0x1f284, 0x1f28c, 0x1f2c0, 0x1f2c0, 0x1f2e0, 0x1f2e0, 0x1f300, 0x1f384, 0x1f3c0, 0x1f3c8, 0x1f440, 0x1f44c, - 0x1f640, 0x1f68c, + 0x1f684, 0x1f68c, 0x1f6c0, 0x1f6c0, 0x1f6e0, 0x1f6e0, 0x1f700, 0x1f784, 0x1f7c0, 0x1f7c8, 0x1f840, 0x1f84c, - 0x1fa40, 0x1fa8c, + 0x1fa84, 0x1fa8c, 0x1fac0, 0x1fac0, 0x1fae0, 0x1fae0, 0x1fb00, 0x1fb84, 0x1fbc0, 0x1fbc8, 0x1fc40, 0x1fc4c, - 0x1fe40, 0x1fe8c, + 0x1fe84, 0x1fe8c, 0x1fec0, 0x1fec0, 0x1fee0, 0x1fee0, 0x1ff00, 0x1ff84, From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 08:54:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E1B1A106566B; Fri, 22 Jun 2012 08:54:55 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id ED55C8FC0C; Fri, 22 Jun 2012 08:54:54 +0000 (UTC) Received: by lbon10 with SMTP id n10so4038519lbo.13 for ; Fri, 22 Jun 2012 01:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=BgGfywcsOZo6hMDfAJpkA/wkyhaIRvcoaHkAHCvLKj0=; b=XY9LCc1lsh8v8Jg33cTpeJcWZKZ5iAEwAywo0rqTkI25p3lTO2WEV68fPRhoUgILtP 7FUyfSKdRxFTSAhKZ07g7t6hfi0Gktv1FJGWG8rC4kNnYVor8ejJFMFURH3MJGjnjPLN 9gbOs08M41q7jibSocJxFOXWejLzZ2/OodPo2D14U2cYYGCzTkQ20JSle+xRPRzIVICk UqMbkMzdYTLV+0zB5qRmMidecQ++EivZppBlocbjXABf7+wAGdiggmZ4JhNQyqM13rLh gnx2A1FXQMAYIGdOTgIhMutDVYZBFYU5Wn7XldVV3hlpQoiWQJZrAJCOWk2rhKbUiEOT 6DmA== Received: by 10.152.148.169 with SMTP id tt9mr1270249lab.49.1340355293866; Fri, 22 Jun 2012 01:54:53 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id hi14sm51186795lab.4.2012.06.22.01.54.51 (version=SSLv3 cipher=OTHER); Fri, 22 Jun 2012 01:54:52 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FE432C4.7000608@FreeBSD.org> Date: Fri, 22 Jun 2012 11:54:28 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120116 Thunderbird/9.0 MIME-Version: 1.0 To: Konstantin Belousov References: <201206220706.q5M76fbO062751@svn.freebsd.org> <4FE42812.3050807@FreeBSD.org> <20120622082502.GB2337@deviant.kiev.zoral.com.ua> In-Reply-To: <20120622082502.GB2337@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237433 - in head/sys: amd64/include arm/include conf i386/include ia64/include kern mips/include pc98/include powerpc/include sparc64/include sys x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 08:54:56 -0000 On 22.06.2012 11:25, Konstantin Belousov wrote: > On Fri, Jun 22, 2012 at 11:08:50AM +0300, Alexander Motin wrote: >> On 06/22/12 10:06, Konstantin Belousov wrote: >>> Author: kib >>> Date: Fri Jun 22 07:06:40 2012 >>> New Revision: 237433 >>> URL: http://svn.freebsd.org/changeset/base/237433 >>> >>> Log: >>> Implement mechanism to export some kernel timekeeping data to >>> usermode, using shared page. The structures and functions have vdso >>> prefix, to indicate the intended location of the code in some future. >>> >>> The versioned per-algorithm data is exported in the format of struct >>> vdso_timehands, which mostly repeats the content of in-kernel struct >>> timehands. Usermode reading of the structure can be lockless. >>> Compatibility export for 32bit processes on 64bit host is also >>> provided. Kernel also provides usermode with indication about >>> currently used timecounter, so that libc can fall back to syscall if >>> configured timecounter is unknown to usermode code. >>> >>> The shared data updates are initiated both from the tc_windup(), where >>> a fast task is queued to do the update, and from sysctl handlers which >>> change timecounter. A manual override switch >>> kern.timecounter.fast_gettime allows to turn off the mechanism. >>> >>> Only x86 architectures export the real algorithm data, and there, only >>> for tsc timecounter. HPET counters page could be exported as well, but >>> I prefer to not further glue the kernel and libc ABI there until >>> proper vdso-based solution is developed. >>> >>> Minimal stubs neccessary for non-x86 architectures to still compile >>> are provided. >>> >>> Discussed with: bde >>> Reviewed by: jhb >>> Tested by: flo >>> MFC after: 1 month >> >> >>> @@ -1360,6 +1367,7 @@ tc_windup(void) >>> #endif >>> >>> timehands = th; >>> + taskqueue_enqueue_fast(taskqueue_fast,&tc_windup_push_vdso_task); >>> } >>> >>> /* Report or change the active timecounter hardware. */ >> >> This taskqueue_enqueue_fast() will schedule extra thread to run each >> time hardclock() fires. One thread may be not a big problem, but >> together with callout swi and possible other threads woken up there it >> will wake up several other CPU cores from sleep just to put them back in >> few microseconds. Now davide@ and me are trying to fix that by avoiding >> callout SWI use for simple tasks. Please, let's not create another >> problem same time. > > The patch was public for quite a time. If you have some comments about > it, it would be much more productive to let me know about them before > the commit, not after. I'm sorry, I haven't seen it. My mad. > Anyway, what is your proposal for 'let's not create another problem > same time' part of the message ? It was discussed, as a possibility, > to have permanent mapping for the shared page in the KVA and to perform > lock-less update of the struct vdso_timehands directly from hardclock > handler. My opinion was that amount of work added by tc_windup > eventhandler is not trivial, so it is better to be postponed to > less critical context. It also slightly more safe to not perform > lockless update for vdso_timehands, since otherwise module load which > register exec handler could cause transient gettimeofday() failure > in usermode. > > This might boil down to the fact that tc_windup function is called > too often, in fact. Also, packing execution of tc_windup eventhandler > together with the clock swi is fine from my POV. I have nothing against using shared pages. On UP system I would probably have not so much against several threads. But on SMP system it will cause at least one, but in many cases two extra CPUs to be woken up. There are two or more threads to run on hardclock(): this taskqueue, callout swi and some thread(s) woken from callouts. Scheduler has no idea how heavy they are. So it will try to move each of them to separate idle CPU. Does the amount of work done in event handlers worth extra Watts consumed by rapidly waking CPUs? As quite rare person running FreeBSD on laptop, I am not sure. I am not sure even that on desktop/server this won't kill all benefit of fast clocks by limiting TurboBoost. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 09:58:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C31D106566C; Fri, 22 Jun 2012 09:58:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 8B3DE8FC15; Fri, 22 Jun 2012 09:58:56 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5M9wlAA026219; Fri, 22 Jun 2012 12:58:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5M9wlhu041642; Fri, 22 Jun 2012 12:58:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5M9wldc041641; Fri, 22 Jun 2012 12:58:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 22 Jun 2012 12:58:47 +0300 From: Konstantin Belousov To: Jung-uk Kim Message-ID: <20120622095847.GC2337@deviant.kiev.zoral.com.ua> References: <201206220040.q5M0ejNk045397@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sh1CKz+Jfn6GrauW" Content-Disposition: inline In-Reply-To: <201206220040.q5M0ejNk045397@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237412 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disa... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 09:58:57 -0000 --sh1CKz+Jfn6GrauW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 22, 2012 at 12:40:45AM +0000, Jung-uk Kim wrote: > Author: jkim > Date: Fri Jun 22 00:40:44 2012 > New Revision: 237412 > URL: http://svn.freebsd.org/changeset/base/237412 >=20 > Log: > Merge ACPICA 20120620. I think it is caused by import, malloc is called while spinlock is held: ACPI: Executed 1 blocks of module-level executable AML code acpi0: Power Button (fixed) panic: blockable sleep lock (sleep mutex) 16 @ /usr/home/kostik/work/build/= bsd/DEV/src/sys/vm/uma_core.c:2040 cpuid =3D 0 KDB: stack backtrace: db_trace_self_wrapper() at 0xffffffff80279d0a =3D db_trace_self_wrapper+0x2a panic() at 0xffffffff80325a28 =3D panic+0x1d8 witness_checkorder() at 0xffffffff80377938 =3D witness_checkorder+0x1d8 _mtx_lock_flags() at 0xffffffff80313777 =3D _mtx_lock_flags+0x87 uma_zalloc_arg() at 0xffffffff804db97a =3D uma_zalloc_arg+0x2ea malloc() at 0xffffffff8030f7cd =3D malloc+0xbd AcpiUtAllocate() at 0xffffffff802704f1 =3D AcpiUtAllocate+0x31 AcpiUtAllocateZeroed() at 0xffffffff80270559 =3D AcpiUtAllocateZeroed+0x19 AcpiSetupGpeForWake() at 0xffffffff8025becc =3D AcpiSetupGpeForWake+0xfc acpi_probe_child() at 0xffffffff802848e9 =3D acpi_probe_child+0x2b9 AcpiNsWalkNamespace() at 0xffffffff802686ef =3D AcpiNsWalkNamespace+0x15f AcpiWalkNamespace() at 0xffffffff80268c0f =3D AcpiWalkNamespace+0xbf acpi_attach() at 0xffffffff80283e43 =3D acpi_attach+0x993 device_attach() at 0xffffffff8035ab62 =3D device_attach+0x72 bus_generic_attach() at 0xffffffff8035bd3a =3D bus_generic_attach+0x1a nexus_acpi_attach() at 0xffffffff804fbd89 =3D nexus_acpi_attach+0x69 device_attach() at 0xffffffff8035ab62 =3D device_attach+0x72 bus_generic_new_pass() at 0xffffffff8035bf46 =3D bus_generic_new_pass+0xd6 bus_set_pass() at 0xffffffff803597ba =3D bus_set_pass+0x7a configure() at 0xffffffff804fd51a =3D configure+0xa mi_startup() at 0xffffffff802d5c17 =3D mi_startup+0x77 btext() at 0xffffffff802531cc =3D btext+0x2c KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at 0xffffffff8035fffb =3D kdb_enter+0x3b: movq $0,0x1027= d62(%rip) db> show alllocks Process 0 (kernel) thread 0xffffffff80837cc0 (100000) exclusive sleep mutex Giant (Giant) r =3D 0 (0xffffffff8133a900) locked @ /= usr/home/kostik/work/build/bsd/DEV/src/sys/kern/kern_module.c:116 exclusive spin mutex ACPI lock (0xfffffe000321da80) (ACPI lock (0xfffffe000= 321da80)) r =3D 0 (0xfffffe000321da80) locked @ /usr/home/kostik/work/build= /bsd/DEV/src/sys/dev/acpica/Osd/OsdSynch.c:535 --sh1CKz+Jfn6GrauW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/kQdcACgkQC3+MBN1Mb4gXzwCeN/jRIUQboKt1g/W+0Uc5oAws gjIAmwTHt3NNImKA4iuPfQ9W11p8l8jR =Cd8O -----END PGP SIGNATURE----- --sh1CKz+Jfn6GrauW-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 10:23:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4102B106566C; Fri, 22 Jun 2012 10:23:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 658EB8FC15; Fri, 22 Jun 2012 10:23:47 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5MANgB8033216; Fri, 22 Jun 2012 13:23:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5MANgoa041797; Fri, 22 Jun 2012 13:23:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5MANgwC041796; Fri, 22 Jun 2012 13:23:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 22 Jun 2012 13:23:42 +0300 From: Konstantin Belousov To: Alexander Motin Message-ID: <20120622102342.GD2337@deviant.kiev.zoral.com.ua> References: <201206220706.q5M76fbO062751@svn.freebsd.org> <4FE42812.3050807@FreeBSD.org> <20120622082502.GB2337@deviant.kiev.zoral.com.ua> <4FE432C4.7000608@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qcmJb3WyrQSdDnng" Content-Disposition: inline In-Reply-To: <4FE432C4.7000608@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237433 - in head/sys: amd64/include arm/include conf i386/include ia64/include kern mips/include pc98/include powerpc/include sparc64/include sys x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 10:23:48 -0000 --qcmJb3WyrQSdDnng Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 22, 2012 at 11:54:28AM +0300, Alexander Motin wrote: > On 22.06.2012 11:25, Konstantin Belousov wrote: > >On Fri, Jun 22, 2012 at 11:08:50AM +0300, Alexander Motin wrote: > >>On 06/22/12 10:06, Konstantin Belousov wrote: > >>>Author: kib > >>>Date: Fri Jun 22 07:06:40 2012 > >>>New Revision: 237433 > >>>URL: http://svn.freebsd.org/changeset/base/237433 > >>> > >>>Log: > >>> Implement mechanism to export some kernel timekeeping data to > >>> usermode, using shared page. The structures and functions have vdso > >>> prefix, to indicate the intended location of the code in some futur= e. > >>> > >>> The versioned per-algorithm data is exported in the format of struct > >>> vdso_timehands, which mostly repeats the content of in-kernel struct > >>> timehands. Usermode reading of the structure can be lockless. > >>> Compatibility export for 32bit processes on 64bit host is also > >>> provided. Kernel also provides usermode with indication about > >>> currently used timecounter, so that libc can fall back to syscall if > >>> configured timecounter is unknown to usermode code. > >>> > >>> The shared data updates are initiated both from the tc_windup(), wh= ere > >>> a fast task is queued to do the update, and from sysctl handlers wh= ich > >>> change timecounter. A manual override switch > >>> kern.timecounter.fast_gettime allows to turn off the mechanism. > >>> > >>> Only x86 architectures export the real algorithm data, and there, o= nly > >>> for tsc timecounter. HPET counters page could be exported as well, = but > >>> I prefer to not further glue the kernel and libc ABI there until > >>> proper vdso-based solution is developed. > >>> > >>> Minimal stubs neccessary for non-x86 architectures to still compile > >>> are provided. > >>> > >>> Discussed with: bde > >>> Reviewed by: jhb > >>> Tested by: flo > >>> MFC after: 1 month > >> > >> > >>>@@ -1360,6 +1367,7 @@ tc_windup(void) > >>> #endif > >>> > >>> timehands =3D th; > >>>+ taskqueue_enqueue_fast(taskqueue_fast,&tc_windup_push_vdso_task); > >>> } > >>> > >>> /* Report or change the active timecounter hardware. */ > >> > >>This taskqueue_enqueue_fast() will schedule extra thread to run each > >>time hardclock() fires. One thread may be not a big problem, but > >>together with callout swi and possible other threads woken up there it > >>will wake up several other CPU cores from sleep just to put them back in > >>few microseconds. Now davide@ and me are trying to fix that by avoiding > >>callout SWI use for simple tasks. Please, let's not create another > >>problem same time. > > > >The patch was public for quite a time. If you have some comments about > >it, it would be much more productive to let me know about them before > >the commit, not after. >=20 > I'm sorry, I haven't seen it. My mad. >=20 > >Anyway, what is your proposal for 'let's not create another problem > >same time' part of the message ? It was discussed, as a possibility, > >to have permanent mapping for the shared page in the KVA and to perform > >lock-less update of the struct vdso_timehands directly from hardclock > >handler. My opinion was that amount of work added by tc_windup > >eventhandler is not trivial, so it is better to be postponed to > >less critical context. It also slightly more safe to not perform > >lockless update for vdso_timehands, since otherwise module load which > >register exec handler could cause transient gettimeofday() failure > >in usermode. > > > >This might boil down to the fact that tc_windup function is called > >too often, in fact. Also, packing execution of tc_windup eventhandler > >together with the clock swi is fine from my POV. >=20 > I have nothing against using shared pages. On UP system I would probably= =20 > have not so much against several threads. But on SMP system it will=20 > cause at least one, but in many cases two extra CPUs to be woken up.=20 > There are two or more threads to run on hardclock(): this taskqueue,=20 > callout swi and some thread(s) woken from callouts. Scheduler has no=20 > idea how heavy they are. So it will try to move each of them to separate= =20 > idle CPU. Does the amount of work done in event handlers worth extra=20 > Watts consumed by rapidly waking CPUs? As quite rare person running=20 > FreeBSD on laptop, I am not sure. I am not sure even that on=20 > desktop/server this won't kill all benefit of fast clocks by limiting=20 > TurboBoost. Patch below would probably work, but I cannot test it right now on real hardware due to ACPI issue. It worked for me in qemu. commit 4f2ffd93b36d20eae61495776fc6b0855745fd7f Author: Konstantin Belousov Date: Fri Jun 22 13:19:22 2012 +0300 Use persistent kernel mapping of the shared page, and update the vdso_timehands from hardclock, instead of scheduling task. diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 80502e3..9365223 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1517,42 +1517,13 @@ exec_unregister(execsw_arg) static struct sx shared_page_alloc_sx; static vm_object_t shared_page_obj; static int shared_page_free; - -struct sf_buf * -shared_page_write_start(int base) -{ - vm_page_t m; - struct sf_buf *s; - - VM_OBJECT_LOCK(shared_page_obj); - m =3D vm_page_grab(shared_page_obj, OFF_TO_IDX(base), VM_ALLOC_RETRY); - VM_OBJECT_UNLOCK(shared_page_obj); - s =3D sf_buf_alloc(m, SFB_DEFAULT); - return (s); -} - -void -shared_page_write_end(struct sf_buf *sf) -{ - vm_page_t m; - - m =3D sf_buf_page(sf); - sf_buf_free(sf); - VM_OBJECT_LOCK(shared_page_obj); - vm_page_wakeup(m); - VM_OBJECT_UNLOCK(shared_page_obj); -} +char *shared_page_mapping; =20 void shared_page_write(int base, int size, const void *data) { - struct sf_buf *sf; - vm_offset_t sk; =20 - sf =3D shared_page_write_start(base); - sk =3D sf_buf_kva(sf); - bcopy(data, (void *)(sk + (base & PAGE_MASK)), size); - shared_page_write_end(sf); + bcopy(data, shared_page_mapping + base, size); } =20 static int @@ -1596,6 +1567,7 @@ static void shared_page_init(void *dummy __unused) { vm_page_t m; + vm_offset_t addr; =20 sx_init(&shared_page_alloc_sx, "shpsx"); shared_page_obj =3D vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, @@ -1605,25 +1577,24 @@ shared_page_init(void *dummy __unused) VM_ALLOC_ZERO); m->valid =3D VM_PAGE_BITS_ALL; VM_OBJECT_UNLOCK(shared_page_obj); + addr =3D kmem_alloc_nofault(kernel_map, PAGE_SIZE); + pmap_qenter(addr, &m, 1); + shared_page_mapping =3D (char *)addr; } =20 SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)shared_page_ini= t, NULL); =20 static void -timehands_update(void *arg) +timehands_update(struct sysentvec *sv) { - struct sysentvec *sv; - struct sf_buf *sf; struct vdso_timehands th; struct vdso_timekeep *tk; uint32_t enabled, idx; =20 - sv =3D arg; - sx_xlock(&shared_page_alloc_sx); enabled =3D tc_fill_vdso_timehands(&th); - sf =3D shared_page_write_start(sv->sv_timekeep_off); - tk =3D (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); + tk =3D (struct vdso_timekeep *)(shared_page_mapping + + sv->sv_timekeep_off); idx =3D sv->sv_timekeep_curr; atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); if (++idx >=3D VDSO_TH_NUM) @@ -1637,25 +1608,19 @@ timehands_update(void *arg) tk->tk_enabled =3D enabled; atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); tk->tk_current =3D idx; - shared_page_write_end(sf); - sx_xunlock(&shared_page_alloc_sx); } =20 #ifdef COMPAT_FREEBSD32 static void -timehands_update32(void *arg) +timehands_update32(struct sysentvec *sv) { - struct sysentvec *sv; - struct sf_buf *sf; struct vdso_timekeep32 *tk; struct vdso_timehands32 th; uint32_t enabled, idx; =20 - sv =3D arg; - sx_xlock(&shared_page_alloc_sx); enabled =3D tc_fill_vdso_timehands32(&th); - sf =3D shared_page_write_start(sv->sv_timekeep_off); - tk =3D (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); + tk =3D (struct vdso_timekeep32 *)(shared_page_mapping + + sv->sv_timekeep_off); idx =3D sv->sv_timekeep_curr; atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); if (++idx >=3D VDSO_TH_NUM) @@ -1669,11 +1634,32 @@ timehands_update32(void *arg) tk->tk_enabled =3D enabled; atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); tk->tk_current =3D idx; - shared_page_write_end(sf); - sx_xunlock(&shared_page_alloc_sx); } #endif =20 +/* + * This is hackish, but easiest way to avoid creating list structures + * that needs to be iterated over from the hardclock interrupt + * context. + */ +static struct sysentvec *host_sysentvec; +#ifdef COMPAT_FREEBSD32 +static struct sysentvec *compat32_sysentvec; +#endif + +void +timekeep_push_vdso(void) +{ + + if (host_sysentvec !=3D NULL && host_sysentvec->sv_timekeep_base !=3D 0) + timehands_update(host_sysentvec); +#ifdef COMPAT_FREEBSD32 + if (compat32_sysentvec !=3D NULL && + compat32_sysentvec->sv_timekeep_base !=3D 0) + timehands_update32(compat32_sysentvec); +#endif +} + void exec_sysvec_init(void *param) { @@ -1688,29 +1674,32 @@ exec_sysvec_init(void *param) sv->sv_shared_page_obj =3D shared_page_obj; sv->sv_sigcode_base =3D sv->sv_shared_page_base + shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); + if ((sv->sv_flags & SV_ABI_MASK) !=3D SV_ABI_FREEBSD) + return; tk_ver =3D VDSO_TK_VER_CURR; #ifdef COMPAT_FREEBSD32 if ((sv->sv_flags & SV_ILP32) !=3D 0) { tk_base =3D shared_page_alloc(sizeof(struct vdso_timekeep32) + sizeof(struct vdso_timehands32) * VDSO_TH_NUM, 16); KASSERT(tk_base !=3D -1, ("tk_base -1 for 32bit")); - EVENTHANDLER_REGISTER(tc_windup, timehands_update32, sv, - EVENTHANDLER_PRI_ANY); shared_page_write(tk_base + offsetof(struct vdso_timekeep32, tk_ver), sizeof(uint32_t), &tk_ver); + KASSERT(compat32_sysentvec =3D=3D 0, + ("Native compat32 already registered")); + compat32_sysentvec =3D sv; } else { #endif tk_base =3D shared_page_alloc(sizeof(struct vdso_timekeep) + sizeof(struct vdso_timehands) * VDSO_TH_NUM, 16); KASSERT(tk_base !=3D -1, ("tk_base -1 for native")); - EVENTHANDLER_REGISTER(tc_windup, timehands_update, sv, - EVENTHANDLER_PRI_ANY); shared_page_write(tk_base + offsetof(struct vdso_timekeep, tk_ver), sizeof(uint32_t), &tk_ver); + KASSERT(host_sysentvec =3D=3D 0, ("Native already registered")); + host_sysentvec =3D sv; #ifdef COMPAT_FREEBSD32 } #endif sv->sv_timekeep_base =3D sv->sv_shared_page_base + tk_base; sv->sv_timekeep_off =3D tk_base; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); } diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 0b8fefe..2950380 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -121,12 +120,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, = CTLFLAG_RW, ×tepwarnings, 0, "Log time steps"); =20 static void tc_windup(void); -static void tc_windup_push_vdso(void *ctx, int pending); static void cpu_tick_calibrate(int); =20 -static struct task tc_windup_push_vdso_task =3D TASK_INITIALIZER(0, - tc_windup_push_vdso, 0); - static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { @@ -1367,7 +1362,7 @@ tc_windup(void) #endif =20 timehands =3D th; - taskqueue_enqueue_fast(taskqueue_fast, &tc_windup_push_vdso_task); + timekeep_push_vdso(); } =20 /* Report or change the active timecounter hardware. */ @@ -1394,7 +1389,7 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) (void)newtc->tc_get_timecount(newtc); =20 timecounter =3D newtc; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); return (0); } return (EINVAL); @@ -1865,7 +1860,7 @@ sysctl_fast_gettime(SYSCTL_HANDLER_ARGS) if (error !=3D 0) return (error); vdso_th_enable =3D old_vdso_th_enable; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); return (0); } SYSCTL_PROC(_kern_timecounter, OID_AUTO, fast_gettime, @@ -1921,10 +1916,3 @@ tc_fill_vdso_timehands32(struct vdso_timehands32 *vd= so_th32) return (enabled); } #endif - -static void -tc_windup_push_vdso(void *ctx, int pending) -{ - - EVENTHANDLER_INVOKE(tc_windup); -} diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 22769c2..6de72d9 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -265,8 +265,6 @@ int shared_page_alloc(int size, int align); int shared_page_fill(int size, int align, const void *data); void shared_page_write(int base, int size, const void *data); void exec_sysvec_init(void *param); -struct sf_buf *shared_page_write_start(int base); -void shared_page_write_end(struct sf_buf *sf); =20 #define INIT_SYSENTVEC(name, sv) \ SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \ diff --git a/sys/sys/vdso.h b/sys/sys/vdso.h index 9f3f3af..653a606 100644 --- a/sys/sys/vdso.h +++ b/sys/sys/vdso.h @@ -29,7 +29,6 @@ #define _SYS_VDSO_H =20 #include -#include #include =20 struct vdso_timehands { @@ -74,6 +73,8 @@ u_int __vdso_gettc(const struct vdso_timehands *vdso_th); =20 #ifdef _KERNEL =20 +void timekeep_push_vdso(void); + uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vdso_th); =20 /* @@ -86,9 +87,6 @@ uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vd= so_th); */ uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th); =20 -typedef void (*tc_windup_fn)(void *); -EVENTHANDLER_DECLARE(tc_windup, tc_windup_fn); - #define VDSO_TH_NUM 4 =20 #ifdef COMPAT_FREEBSD32 --qcmJb3WyrQSdDnng Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/kR64ACgkQC3+MBN1Mb4iD0wCfV2ntAMF9n2NrsT6mDQi0oAyV 7JoAn3M8eagjY12jGxrhQpIxC5+mU6oR =c0ch -----END PGP SIGNATURE----- --qcmJb3WyrQSdDnng-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 10:46:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7794106566C; Fri, 22 Jun 2012 10:46:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id CF24F8FC0C; Fri, 22 Jun 2012 10:46:34 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5MAkQS9039120; Fri, 22 Jun 2012 13:46:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5MAkQbu041972; Fri, 22 Jun 2012 13:46:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5MAkQAA041971; Fri, 22 Jun 2012 13:46:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 22 Jun 2012 13:46:26 +0300 From: Konstantin Belousov To: Alexander Motin Message-ID: <20120622104626.GE2337@deviant.kiev.zoral.com.ua> References: <201206220706.q5M76fbO062751@svn.freebsd.org> <4FE42812.3050807@FreeBSD.org> <20120622082502.GB2337@deviant.kiev.zoral.com.ua> <4FE432C4.7000608@FreeBSD.org> <20120622102342.GD2337@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="r5UKZFo5ar5Icv+k" Content-Disposition: inline In-Reply-To: <20120622102342.GD2337@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237433 - in head/sys: amd64/include arm/include conf i386/include ia64/include kern mips/include pc98/include powerpc/include sparc64/include sys x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 10:46:36 -0000 --r5UKZFo5ar5Icv+k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 22, 2012 at 01:23:42PM +0300, Konstantin Belousov wrote: > On Fri, Jun 22, 2012 at 11:54:28AM +0300, Alexander Motin wrote: > > On 22.06.2012 11:25, Konstantin Belousov wrote: > > >On Fri, Jun 22, 2012 at 11:08:50AM +0300, Alexander Motin wrote: > > >>On 06/22/12 10:06, Konstantin Belousov wrote: > > >>>Author: kib > > >>>Date: Fri Jun 22 07:06:40 2012 > > >>>New Revision: 237433 > > >>>URL: http://svn.freebsd.org/changeset/base/237433 > > >>> > > >>>Log: > > >>> Implement mechanism to export some kernel timekeeping data to > > >>> usermode, using shared page. The structures and functions have v= dso > > >>> prefix, to indicate the intended location of the code in some fut= ure. > > >>> > > >>> The versioned per-algorithm data is exported in the format of str= uct > > >>> vdso_timehands, which mostly repeats the content of in-kernel str= uct > > >>> timehands. Usermode reading of the structure can be lockless. > > >>> Compatibility export for 32bit processes on 64bit host is also > > >>> provided. Kernel also provides usermode with indication about > > >>> currently used timecounter, so that libc can fall back to syscall= if > > >>> configured timecounter is unknown to usermode code. > > >>> > > >>> The shared data updates are initiated both from the tc_windup(), = where > > >>> a fast task is queued to do the update, and from sysctl handlers = which > > >>> change timecounter. A manual override switch > > >>> kern.timecounter.fast_gettime allows to turn off the mechanism. > > >>> > > >>> Only x86 architectures export the real algorithm data, and there,= only > > >>> for tsc timecounter. HPET counters page could be exported as well= , but > > >>> I prefer to not further glue the kernel and libc ABI there until > > >>> proper vdso-based solution is developed. > > >>> > > >>> Minimal stubs neccessary for non-x86 architectures to still compi= le > > >>> are provided. > > >>> > > >>> Discussed with: bde > > >>> Reviewed by: jhb > > >>> Tested by: flo > > >>> MFC after: 1 month > > >> > > >> > > >>>@@ -1360,6 +1367,7 @@ tc_windup(void) > > >>> #endif > > >>> > > >>> timehands =3D th; > > >>>+ taskqueue_enqueue_fast(taskqueue_fast,&tc_windup_push_vdso_task); > > >>> } > > >>> > > >>> /* Report or change the active timecounter hardware. */ > > >> > > >>This taskqueue_enqueue_fast() will schedule extra thread to run each > > >>time hardclock() fires. One thread may be not a big problem, but > > >>together with callout swi and possible other threads woken up there it > > >>will wake up several other CPU cores from sleep just to put them back= in > > >>few microseconds. Now davide@ and me are trying to fix that by avoidi= ng > > >>callout SWI use for simple tasks. Please, let's not create another > > >>problem same time. > > > > > >The patch was public for quite a time. If you have some comments about > > >it, it would be much more productive to let me know about them before > > >the commit, not after. > >=20 > > I'm sorry, I haven't seen it. My mad. > >=20 > > >Anyway, what is your proposal for 'let's not create another problem > > >same time' part of the message ? It was discussed, as a possibility, > > >to have permanent mapping for the shared page in the KVA and to perform > > >lock-less update of the struct vdso_timehands directly from hardclock > > >handler. My opinion was that amount of work added by tc_windup > > >eventhandler is not trivial, so it is better to be postponed to > > >less critical context. It also slightly more safe to not perform > > >lockless update for vdso_timehands, since otherwise module load which > > >register exec handler could cause transient gettimeofday() failure > > >in usermode. > > > > > >This might boil down to the fact that tc_windup function is called > > >too often, in fact. Also, packing execution of tc_windup eventhandler > > >together with the clock swi is fine from my POV. > >=20 > > I have nothing against using shared pages. On UP system I would probabl= y=20 > > have not so much against several threads. But on SMP system it will=20 > > cause at least one, but in many cases two extra CPUs to be woken up.=20 > > There are two or more threads to run on hardclock(): this taskqueue,=20 > > callout swi and some thread(s) woken from callouts. Scheduler has no=20 > > idea how heavy they are. So it will try to move each of them to separat= e=20 > > idle CPU. Does the amount of work done in event handlers worth extra=20 > > Watts consumed by rapidly waking CPUs? As quite rare person running=20 > > FreeBSD on laptop, I am not sure. I am not sure even that on=20 > > desktop/server this won't kill all benefit of fast clocks by limiting= =20 > > TurboBoost. >=20 > Patch below would probably work, but I cannot test it right now on real > hardware due to ACPI issue. It worked for me in qemu. >=20 > commit 4f2ffd93b36d20eae61495776fc6b0855745fd7f > Author: Konstantin Belousov > Date: Fri Jun 22 13:19:22 2012 +0300 >=20 > Use persistent kernel mapping of the shared page, and update the > vdso_timehands from hardclock, instead of scheduling task. Slightly improved version. Since tc_fill_vdso_timehands is now called from hardclock context, thee is no need to spin waiting for valid current generation of timehands. diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 80502e3..9365223 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1517,42 +1517,13 @@ exec_unregister(execsw_arg) static struct sx shared_page_alloc_sx; static vm_object_t shared_page_obj; static int shared_page_free; - -struct sf_buf * -shared_page_write_start(int base) -{ - vm_page_t m; - struct sf_buf *s; - - VM_OBJECT_LOCK(shared_page_obj); - m =3D vm_page_grab(shared_page_obj, OFF_TO_IDX(base), VM_ALLOC_RETRY); - VM_OBJECT_UNLOCK(shared_page_obj); - s =3D sf_buf_alloc(m, SFB_DEFAULT); - return (s); -} - -void -shared_page_write_end(struct sf_buf *sf) -{ - vm_page_t m; - - m =3D sf_buf_page(sf); - sf_buf_free(sf); - VM_OBJECT_LOCK(shared_page_obj); - vm_page_wakeup(m); - VM_OBJECT_UNLOCK(shared_page_obj); -} +char *shared_page_mapping; =20 void shared_page_write(int base, int size, const void *data) { - struct sf_buf *sf; - vm_offset_t sk; =20 - sf =3D shared_page_write_start(base); - sk =3D sf_buf_kva(sf); - bcopy(data, (void *)(sk + (base & PAGE_MASK)), size); - shared_page_write_end(sf); + bcopy(data, shared_page_mapping + base, size); } =20 static int @@ -1596,6 +1567,7 @@ static void shared_page_init(void *dummy __unused) { vm_page_t m; + vm_offset_t addr; =20 sx_init(&shared_page_alloc_sx, "shpsx"); shared_page_obj =3D vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, @@ -1605,25 +1577,24 @@ shared_page_init(void *dummy __unused) VM_ALLOC_ZERO); m->valid =3D VM_PAGE_BITS_ALL; VM_OBJECT_UNLOCK(shared_page_obj); + addr =3D kmem_alloc_nofault(kernel_map, PAGE_SIZE); + pmap_qenter(addr, &m, 1); + shared_page_mapping =3D (char *)addr; } =20 SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)shared_page_ini= t, NULL); =20 static void -timehands_update(void *arg) +timehands_update(struct sysentvec *sv) { - struct sysentvec *sv; - struct sf_buf *sf; struct vdso_timehands th; struct vdso_timekeep *tk; uint32_t enabled, idx; =20 - sv =3D arg; - sx_xlock(&shared_page_alloc_sx); enabled =3D tc_fill_vdso_timehands(&th); - sf =3D shared_page_write_start(sv->sv_timekeep_off); - tk =3D (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); + tk =3D (struct vdso_timekeep *)(shared_page_mapping + + sv->sv_timekeep_off); idx =3D sv->sv_timekeep_curr; atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); if (++idx >=3D VDSO_TH_NUM) @@ -1637,25 +1608,19 @@ timehands_update(void *arg) tk->tk_enabled =3D enabled; atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); tk->tk_current =3D idx; - shared_page_write_end(sf); - sx_xunlock(&shared_page_alloc_sx); } =20 #ifdef COMPAT_FREEBSD32 static void -timehands_update32(void *arg) +timehands_update32(struct sysentvec *sv) { - struct sysentvec *sv; - struct sf_buf *sf; struct vdso_timekeep32 *tk; struct vdso_timehands32 th; uint32_t enabled, idx; =20 - sv =3D arg; - sx_xlock(&shared_page_alloc_sx); enabled =3D tc_fill_vdso_timehands32(&th); - sf =3D shared_page_write_start(sv->sv_timekeep_off); - tk =3D (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); + tk =3D (struct vdso_timekeep32 *)(shared_page_mapping + + sv->sv_timekeep_off); idx =3D sv->sv_timekeep_curr; atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); if (++idx >=3D VDSO_TH_NUM) @@ -1669,11 +1634,32 @@ timehands_update32(void *arg) tk->tk_enabled =3D enabled; atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); tk->tk_current =3D idx; - shared_page_write_end(sf); - sx_xunlock(&shared_page_alloc_sx); } #endif =20 +/* + * This is hackish, but easiest way to avoid creating list structures + * that needs to be iterated over from the hardclock interrupt + * context. + */ +static struct sysentvec *host_sysentvec; +#ifdef COMPAT_FREEBSD32 +static struct sysentvec *compat32_sysentvec; +#endif + +void +timekeep_push_vdso(void) +{ + + if (host_sysentvec !=3D NULL && host_sysentvec->sv_timekeep_base !=3D 0) + timehands_update(host_sysentvec); +#ifdef COMPAT_FREEBSD32 + if (compat32_sysentvec !=3D NULL && + compat32_sysentvec->sv_timekeep_base !=3D 0) + timehands_update32(compat32_sysentvec); +#endif +} + void exec_sysvec_init(void *param) { @@ -1688,29 +1674,32 @@ exec_sysvec_init(void *param) sv->sv_shared_page_obj =3D shared_page_obj; sv->sv_sigcode_base =3D sv->sv_shared_page_base + shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); + if ((sv->sv_flags & SV_ABI_MASK) !=3D SV_ABI_FREEBSD) + return; tk_ver =3D VDSO_TK_VER_CURR; #ifdef COMPAT_FREEBSD32 if ((sv->sv_flags & SV_ILP32) !=3D 0) { tk_base =3D shared_page_alloc(sizeof(struct vdso_timekeep32) + sizeof(struct vdso_timehands32) * VDSO_TH_NUM, 16); KASSERT(tk_base !=3D -1, ("tk_base -1 for 32bit")); - EVENTHANDLER_REGISTER(tc_windup, timehands_update32, sv, - EVENTHANDLER_PRI_ANY); shared_page_write(tk_base + offsetof(struct vdso_timekeep32, tk_ver), sizeof(uint32_t), &tk_ver); + KASSERT(compat32_sysentvec =3D=3D 0, + ("Native compat32 already registered")); + compat32_sysentvec =3D sv; } else { #endif tk_base =3D shared_page_alloc(sizeof(struct vdso_timekeep) + sizeof(struct vdso_timehands) * VDSO_TH_NUM, 16); KASSERT(tk_base !=3D -1, ("tk_base -1 for native")); - EVENTHANDLER_REGISTER(tc_windup, timehands_update, sv, - EVENTHANDLER_PRI_ANY); shared_page_write(tk_base + offsetof(struct vdso_timekeep, tk_ver), sizeof(uint32_t), &tk_ver); + KASSERT(host_sysentvec =3D=3D 0, ("Native already registered")); + host_sysentvec =3D sv; #ifdef COMPAT_FREEBSD32 } #endif sv->sv_timekeep_base =3D sv->sv_shared_page_base + tk_base; sv->sv_timekeep_off =3D tk_base; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); } diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 0b8fefe..4a75af5 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -121,12 +120,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, = CTLFLAG_RW, ×tepwarnings, 0, "Log time steps"); =20 static void tc_windup(void); -static void tc_windup_push_vdso(void *ctx, int pending); static void cpu_tick_calibrate(int); =20 -static struct task tc_windup_push_vdso_task =3D TASK_INITIALIZER(0, - tc_windup_push_vdso, 0); - static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { @@ -1367,7 +1362,7 @@ tc_windup(void) #endif =20 timehands =3D th; - taskqueue_enqueue_fast(taskqueue_fast, &tc_windup_push_vdso_task); + timekeep_push_vdso(); } =20 /* Report or change the active timecounter hardware. */ @@ -1394,7 +1389,7 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) (void)newtc->tc_get_timecount(newtc); =20 timecounter =3D newtc; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); return (0); } return (EINVAL); @@ -1865,7 +1860,7 @@ sysctl_fast_gettime(SYSCTL_HANDLER_ARGS) if (error !=3D 0) return (error); vdso_th_enable =3D old_vdso_th_enable; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); return (0); } SYSCTL_PROC(_kern_timecounter, OID_AUTO, fast_gettime, @@ -1877,19 +1872,15 @@ tc_fill_vdso_timehands(struct vdso_timehands *vdso_= th) { struct timehands *th; uint32_t enabled; - int gen; =20 - do { - th =3D timehands; - gen =3D th->th_generation; - vdso_th->th_algo =3D VDSO_TH_ALGO_1; - vdso_th->th_scale =3D th->th_scale; - vdso_th->th_offset_count =3D th->th_offset_count; - vdso_th->th_counter_mask =3D th->th_counter->tc_counter_mask; - vdso_th->th_offset =3D th->th_offset; - vdso_th->th_boottime =3D boottimebin; - enabled =3D cpu_fill_vdso_timehands(vdso_th); - } while (gen =3D=3D 0 || timehands->th_generation !=3D gen); + th =3D timehands; + vdso_th->th_algo =3D VDSO_TH_ALGO_1; + vdso_th->th_scale =3D th->th_scale; + vdso_th->th_offset_count =3D th->th_offset_count; + vdso_th->th_counter_mask =3D th->th_counter->tc_counter_mask; + vdso_th->th_offset =3D th->th_offset; + vdso_th->th_boottime =3D boottimebin; + enabled =3D cpu_fill_vdso_timehands(vdso_th); if (!vdso_th_enable) enabled =3D 0; return (enabled); @@ -1901,30 +1892,19 @@ tc_fill_vdso_timehands32(struct vdso_timehands32 *v= dso_th32) { struct timehands *th; uint32_t enabled; - int gen; =20 - do { - th =3D timehands; - gen =3D th->th_generation; - vdso_th32->th_algo =3D VDSO_TH_ALGO_1; - *(uint64_t *)&vdso_th32->th_scale[0] =3D th->th_scale; - vdso_th32->th_offset_count =3D th->th_offset_count; - vdso_th32->th_counter_mask =3D th->th_counter->tc_counter_mask; - vdso_th32->th_offset.sec =3D th->th_offset.sec; - *(uint64_t *)&vdso_th32->th_offset.frac[0] =3D th->th_offset.frac; - vdso_th32->th_boottime.sec =3D boottimebin.sec; - *(uint64_t *)&vdso_th32->th_boottime.frac[0] =3D boottimebin.frac; - enabled =3D cpu_fill_vdso_timehands32(vdso_th32); - } while (gen =3D=3D 0 || timehands->th_generation !=3D gen); + th =3D timehands; + vdso_th32->th_algo =3D VDSO_TH_ALGO_1; + *(uint64_t *)&vdso_th32->th_scale[0] =3D th->th_scale; + vdso_th32->th_offset_count =3D th->th_offset_count; + vdso_th32->th_counter_mask =3D th->th_counter->tc_counter_mask; + vdso_th32->th_offset.sec =3D th->th_offset.sec; + *(uint64_t *)&vdso_th32->th_offset.frac[0] =3D th->th_offset.frac; + vdso_th32->th_boottime.sec =3D boottimebin.sec; + *(uint64_t *)&vdso_th32->th_boottime.frac[0] =3D boottimebin.frac; + enabled =3D cpu_fill_vdso_timehands32(vdso_th32); if (!vdso_th_enable) enabled =3D 0; return (enabled); } #endif - -static void -tc_windup_push_vdso(void *ctx, int pending) -{ - - EVENTHANDLER_INVOKE(tc_windup); -} diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 22769c2..6de72d9 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -265,8 +265,6 @@ int shared_page_alloc(int size, int align); int shared_page_fill(int size, int align, const void *data); void shared_page_write(int base, int size, const void *data); void exec_sysvec_init(void *param); -struct sf_buf *shared_page_write_start(int base); -void shared_page_write_end(struct sf_buf *sf); =20 #define INIT_SYSENTVEC(name, sv) \ SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \ diff --git a/sys/sys/vdso.h b/sys/sys/vdso.h index 9f3f3af..653a606 100644 --- a/sys/sys/vdso.h +++ b/sys/sys/vdso.h @@ -29,7 +29,6 @@ #define _SYS_VDSO_H =20 #include -#include #include =20 struct vdso_timehands { @@ -74,6 +73,8 @@ u_int __vdso_gettc(const struct vdso_timehands *vdso_th); =20 #ifdef _KERNEL =20 +void timekeep_push_vdso(void); + uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vdso_th); =20 /* @@ -86,9 +87,6 @@ uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vd= so_th); */ uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th); =20 -typedef void (*tc_windup_fn)(void *); -EVENTHANDLER_DECLARE(tc_windup, tc_windup_fn); - #define VDSO_TH_NUM 4 =20 #ifdef COMPAT_FREEBSD32 --r5UKZFo5ar5Icv+k Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/kTQEACgkQC3+MBN1Mb4j1JwCbBlIe+aX2TtvQoMbqZCMiLbeq bZIAnRAqwAxtQl8uMWjTfO/+Xi+ysCfM =nV8y -----END PGP SIGNATURE----- --r5UKZFo5ar5Icv+k-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 10:56:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 75CDD106566B; Fri, 22 Jun 2012 10:56:03 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 687EF8FC1C; Fri, 22 Jun 2012 10:56:02 +0000 (UTC) Received: by lbon10 with SMTP id n10so4199785lbo.13 for ; Fri, 22 Jun 2012 03:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=n56Zzf2SkirEAWcoEB4xiY4eaFX+eMcCwkymXk2Ics8=; b=M7XL42czxv2CWSSs2sFBfR7oRaxTBsVXpI2mh0vXh92bebnb+eo4JzwAV/zqTx+fXF S31ecsBynR03KZ9r4Je3A8fsfb5WCw38kjU+4G7CvDOxwvQ4wl3WIYP3/HnKkrTL2Jl9 iYHPFcMcgeDAnFAVdCcJ+XB2ki5o02xsEg6/dHvu17FgR3Epf5PhA70wgNL37EoTqCvL jVHExiTmhPWHHUrv+QyQq6O9S589Zx3/ioRzUfPteTN38NyHIBKnWD49yU4DaW7LtHQF LHeTEkMmqyMXe/iCx1qVLe0LfdbkPFcN97NB1Zba/NQ9/PFIZxJNwRxAVJFaByb+s5ct FV+Q== Received: by 10.112.103.130 with SMTP id fw2mr1270950lbb.107.1340362561056; Fri, 22 Jun 2012 03:56:01 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id q8sm20660474lbj.2.2012.06.22.03.55.58 (version=SSLv3 cipher=OTHER); Fri, 22 Jun 2012 03:56:00 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FE44F3C.5040108@FreeBSD.org> Date: Fri, 22 Jun 2012 13:55:56 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120618 Thunderbird/13.0 MIME-Version: 1.0 To: Konstantin Belousov References: <201206220706.q5M76fbO062751@svn.freebsd.org> <4FE42812.3050807@FreeBSD.org> <20120622082502.GB2337@deviant.kiev.zoral.com.ua> <4FE432C4.7000608@FreeBSD.org> <20120622102342.GD2337@deviant.kiev.zoral.com.ua> <20120622104626.GE2337@deviant.kiev.zoral.com.ua> In-Reply-To: <20120622104626.GE2337@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237433 - in head/sys: amd64/include arm/include conf i386/include ia64/include kern mips/include pc98/include powerpc/include sparc64/include sys x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 10:56:03 -0000 On 06/22/12 13:46, Konstantin Belousov wrote: > On Fri, Jun 22, 2012 at 01:23:42PM +0300, Konstantin Belousov wrote: >> On Fri, Jun 22, 2012 at 11:54:28AM +0300, Alexander Motin wrote: >>> On 22.06.2012 11:25, Konstantin Belousov wrote: >>>> On Fri, Jun 22, 2012 at 11:08:50AM +0300, Alexander Motin wrote: >>>>> On 06/22/12 10:06, Konstantin Belousov wrote: >>>>>> Author: kib >>>>>> Date: Fri Jun 22 07:06:40 2012 >>>>>> New Revision: 237433 >>>>>> URL: http://svn.freebsd.org/changeset/base/237433 >>>>>> >>>>>> Log: >>>>>> Implement mechanism to export some kernel timekeeping data to >>>>>> usermode, using shared page. The structures and functions have vdso >>>>>> prefix, to indicate the intended location of the code in some future. >>>>>> >>>>>> The versioned per-algorithm data is exported in the format of struct >>>>>> vdso_timehands, which mostly repeats the content of in-kernel struct >>>>>> timehands. Usermode reading of the structure can be lockless. >>>>>> Compatibility export for 32bit processes on 64bit host is also >>>>>> provided. Kernel also provides usermode with indication about >>>>>> currently used timecounter, so that libc can fall back to syscall if >>>>>> configured timecounter is unknown to usermode code. >>>>>> >>>>>> The shared data updates are initiated both from the tc_windup(), where >>>>>> a fast task is queued to do the update, and from sysctl handlers which >>>>>> change timecounter. A manual override switch >>>>>> kern.timecounter.fast_gettime allows to turn off the mechanism. >>>>>> >>>>>> Only x86 architectures export the real algorithm data, and there, only >>>>>> for tsc timecounter. HPET counters page could be exported as well, but >>>>>> I prefer to not further glue the kernel and libc ABI there until >>>>>> proper vdso-based solution is developed. >>>>>> >>>>>> Minimal stubs neccessary for non-x86 architectures to still compile >>>>>> are provided. >>>>>> >>>>>> Discussed with: bde >>>>>> Reviewed by: jhb >>>>>> Tested by: flo >>>>>> MFC after: 1 month >>>>> >>>>> >>>>>> @@ -1360,6 +1367,7 @@ tc_windup(void) >>>>>> #endif >>>>>> >>>>>> timehands = th; >>>>>> + taskqueue_enqueue_fast(taskqueue_fast,&tc_windup_push_vdso_task); >>>>>> } >>>>>> >>>>>> /* Report or change the active timecounter hardware. */ >>>>> >>>>> This taskqueue_enqueue_fast() will schedule extra thread to run each >>>>> time hardclock() fires. One thread may be not a big problem, but >>>>> together with callout swi and possible other threads woken up there it >>>>> will wake up several other CPU cores from sleep just to put them back in >>>>> few microseconds. Now davide@ and me are trying to fix that by avoiding >>>>> callout SWI use for simple tasks. Please, let's not create another >>>>> problem same time. >>>> >>>> The patch was public for quite a time. If you have some comments about >>>> it, it would be much more productive to let me know about them before >>>> the commit, not after. >>> >>> I'm sorry, I haven't seen it. My mad. >>> >>>> Anyway, what is your proposal for 'let's not create another problem >>>> same time' part of the message ? It was discussed, as a possibility, >>>> to have permanent mapping for the shared page in the KVA and to perform >>>> lock-less update of the struct vdso_timehands directly from hardclock >>>> handler. My opinion was that amount of work added by tc_windup >>>> eventhandler is not trivial, so it is better to be postponed to >>>> less critical context. It also slightly more safe to not perform >>>> lockless update for vdso_timehands, since otherwise module load which >>>> register exec handler could cause transient gettimeofday() failure >>>> in usermode. >>>> >>>> This might boil down to the fact that tc_windup function is called >>>> too often, in fact. Also, packing execution of tc_windup eventhandler >>>> together with the clock swi is fine from my POV. >>> >>> I have nothing against using shared pages. On UP system I would probably >>> have not so much against several threads. But on SMP system it will >>> cause at least one, but in many cases two extra CPUs to be woken up. >>> There are two or more threads to run on hardclock(): this taskqueue, >>> callout swi and some thread(s) woken from callouts. Scheduler has no >>> idea how heavy they are. So it will try to move each of them to separate >>> idle CPU. Does the amount of work done in event handlers worth extra >>> Watts consumed by rapidly waking CPUs? As quite rare person running >>> FreeBSD on laptop, I am not sure. I am not sure even that on >>> desktop/server this won't kill all benefit of fast clocks by limiting >>> TurboBoost. >> >> Patch below would probably work, but I cannot test it right now on real >> hardware due to ACPI issue. It worked for me in qemu. >> >> commit 4f2ffd93b36d20eae61495776fc6b0855745fd7f >> Author: Konstantin Belousov >> Date: Fri Jun 22 13:19:22 2012 +0300 >> >> Use persistent kernel mapping of the shared page, and update the >> vdso_timehands from hardclock, instead of scheduling task. > > Slightly improved version. Since tc_fill_vdso_timehands is now > called from hardclock context, thee is no need to spin waiting for > valid current generation of timehands. I can't evaluate how much "hackish" this is from memory management side, but I'm glad there is some viable solution. Thank you! -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 14:24:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 348421065670; Fri, 22 Jun 2012 14:24:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 073888FC0A; Fri, 22 Jun 2012 14:24:21 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4A5F1B96C; Fri, 22 Jun 2012 10:24:20 -0400 (EDT) From: John Baldwin To: Marius Strobl Date: Fri, 22 Jun 2012 09:57:01 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de> In-Reply-To: <20120622073455.GE69382@alchemy.franken.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201206220957.01341.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 22 Jun 2012 10:24:20 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 14:24:21 -0000 On Friday, June 22, 2012 3:34:56 am Marius Strobl wrote: > On Fri, Jun 22, 2012 at 07:13:31AM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Fri Jun 22 07:13:30 2012 > > New Revision: 237434 > > URL: http://svn.freebsd.org/changeset/base/237434 > > > > Log: > > Use struct vdso_timehands data to implement fast gettimeofday(2) and > > clock_gettime(2) functions if supported. The speedup seen in > > microbenchmarks is in range 4x-7x depending on the hardware. > > > > Only amd64 and i386 architectures are supported. Libc uses rdtsc and > > kernel data to calculate current time, if enabled by kernel. > > I don't know much about x86 CPUs but is my understanding correct > that TSCs are not synchronized in any way across CPUs, i.e. > reading it on different CPUs may result in time going backwards > etc., which is okay for this application though? Hmm, in practice I have found that on modern x86 CPUs (Penryn and later) the TSC is in fact sychronized across packages at work. At least, when I measure skew across packages it appears to be consistent with the time it would take a write to propagate from one to the other. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 14:58:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B4B5106566C; Fri, 22 Jun 2012 14:58:41 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F01428FC18; Fri, 22 Jun 2012 14:58:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MEweKJ084498; Fri, 22 Jun 2012 14:58:40 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MEwe0c084495; Fri, 22 Jun 2012 14:58:40 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201206221458.q5MEwe0c084495@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 22 Jun 2012 14:58:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237444 - stable/9/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 14:58:41 -0000 Author: gnn Date: Fri Jun 22 14:58:40 2012 New Revision: 237444 URL: http://svn.freebsd.org/changeset/base/237444 Log: MFC 230063 Clean up a switch statement for uncore events on Westmere processors. Submitted by: Davide Italiano Reviewed by: gnn Modified: stable/9/sys/dev/hwpmc/hwpmc_uncore.c stable/9/sys/dev/hwpmc/hwpmc_uncore.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/hwpmc/hwpmc_uncore.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_uncore.c Fri Jun 22 13:56:58 2012 (r237443) +++ stable/9/sys/dev/hwpmc/hwpmc_uncore.c Fri Jun 22 14:58:40 2012 (r237444) @@ -1032,26 +1032,18 @@ ucp_start_pmc(int cpu, int ri) /* Event specific configuration. */ switch (pm->pm_event) { case PMC_EV_UCP_EVENT_0CH_04H_E: + case PMC_EV_UCP_EVENT_0CH_08H_E: wrmsr(MSR_GQ_SNOOP_MESF,0x2); break; case PMC_EV_UCP_EVENT_0CH_04H_F: + case PMC_EV_UCP_EVENT_0CH_08H_F: wrmsr(MSR_GQ_SNOOP_MESF,0x8); break; case PMC_EV_UCP_EVENT_0CH_04H_M: - wrmsr(MSR_GQ_SNOOP_MESF,0x1); - break; - case PMC_EV_UCP_EVENT_0CH_04H_S: - wrmsr(MSR_GQ_SNOOP_MESF,0x4); - break; - case PMC_EV_UCP_EVENT_0CH_08H_E: - wrmsr(MSR_GQ_SNOOP_MESF,0x2); - break; - case PMC_EV_UCP_EVENT_0CH_08H_F: - wrmsr(MSR_GQ_SNOOP_MESF,0x8); - break; case PMC_EV_UCP_EVENT_0CH_08H_M: wrmsr(MSR_GQ_SNOOP_MESF,0x1); break; + case PMC_EV_UCP_EVENT_0CH_04H_S: case PMC_EV_UCP_EVENT_0CH_08H_S: wrmsr(MSR_GQ_SNOOP_MESF,0x4); break; Modified: stable/9/sys/dev/hwpmc/hwpmc_uncore.h ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_uncore.h Fri Jun 22 13:56:58 2012 (r237443) +++ stable/9/sys/dev/hwpmc/hwpmc_uncore.h Fri Jun 22 14:58:40 2012 (r237444) @@ -89,7 +89,6 @@ struct pmc_md_ucp_op_pmcallocate { #define UC_GLOBAL_CTRL 0x391 #define UC_GLOBAL_OVF_CTRL 0x393 - #define UC_GLOBAL_STATUS_FLAG_CLRCHG (1ULL << 63) #define UC_GLOBAL_STATUS_FLAG_OVFPMI (1ULL << 61) #define UC_GLOBAL_CTRL_FLAG_FRZ (1ULL << 63) From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 15:53:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D78A106564A; Fri, 22 Jun 2012 15:53:32 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5E33E8FC08; Fri, 22 Jun 2012 15:53:31 +0000 (UTC) Message-ID: <4FE494FA.1030907@FreeBSD.org> Date: Fri, 22 Jun 2012 11:53:30 -0400 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120612 Thunderbird/13.0 MIME-Version: 1.0 To: Konstantin Belousov References: <201206220040.q5M0ejNk045397@svn.freebsd.org> <20120622095847.GC2337@deviant.kiev.zoral.com.ua> In-Reply-To: <20120622095847.GC2337@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237412 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disa... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 15:53:32 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2012-06-22 05:58:47 -0400, Konstantin Belousov wrote: > On Fri, Jun 22, 2012 at 12:40:45AM +0000, Jung-uk Kim wrote: >> Author: jkim Date: Fri Jun 22 00:40:44 2012 New Revision: 237412 >> URL: http://svn.freebsd.org/changeset/base/237412 >> >> Log: Merge ACPICA 20120620. > > I think it is caused by import, malloc is called while spinlock is > held: > > ACPI: Executed 1 blocks of module-level executable AML code acpi0: > Power Button (fixed) panic: blockable sleep lock (sleep mutex) 16 @ > /usr/home/kostik/work/build/bsd/DEV/src/sys/vm/uma_core.c:2040 > cpuid = 0 KDB: stack backtrace: db_trace_self_wrapper() at > 0xffffffff80279d0a = db_trace_self_wrapper+0x2a panic() at > 0xffffffff80325a28 = panic+0x1d8 witness_checkorder() at > 0xffffffff80377938 = witness_checkorder+0x1d8 _mtx_lock_flags() at > 0xffffffff80313777 = _mtx_lock_flags+0x87 uma_zalloc_arg() at > 0xffffffff804db97a = uma_zalloc_arg+0x2ea malloc() at > 0xffffffff8030f7cd = malloc+0xbd AcpiUtAllocate() at > 0xffffffff802704f1 = AcpiUtAllocate+0x31 AcpiUtAllocateZeroed() at > 0xffffffff80270559 = AcpiUtAllocateZeroed+0x19 > AcpiSetupGpeForWake() at 0xffffffff8025becc = > AcpiSetupGpeForWake+0xfc acpi_probe_child() at 0xffffffff802848e9 = > acpi_probe_child+0x2b9 AcpiNsWalkNamespace() at 0xffffffff802686ef > = AcpiNsWalkNamespace+0x15f AcpiWalkNamespace() at > 0xffffffff80268c0f = AcpiWalkNamespace+0xbf acpi_attach() at > 0xffffffff80283e43 = acpi_attach+0x993 device_attach() at > 0xffffffff8035ab62 = device_attach+0x72 bus_generic_attach() at > 0xffffffff8035bd3a = bus_generic_attach+0x1a nexus_acpi_attach() at > 0xffffffff804fbd89 = nexus_acpi_attach+0x69 device_attach() at > 0xffffffff8035ab62 = device_attach+0x72 bus_generic_new_pass() at > 0xffffffff8035bf46 = bus_generic_new_pass+0xd6 bus_set_pass() at > 0xffffffff803597ba = bus_set_pass+0x7a configure() at > 0xffffffff804fd51a = configure+0xa mi_startup() at > 0xffffffff802d5c17 = mi_startup+0x77 btext() at 0xffffffff802531cc > = btext+0x2c KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped > at 0xffffffff8035fffb = kdb_enter+0x3b: movq > $0,0x1027d62(%rip) db> show alllocks Process 0 (kernel) thread > 0xffffffff80837cc0 (100000) exclusive sleep mutex Giant (Giant) r = > 0 (0xffffffff8133a900) locked @ > /usr/home/kostik/work/build/bsd/DEV/src/sys/kern/kern_module.c:116 > exclusive spin mutex ACPI lock (0xfffffe000321da80) (ACPI lock > (0xfffffe000321da80)) r = 0 (0xfffffe000321da80) locked @ > /usr/home/kostik/work/build/bsd/DEV/src/sys/dev/acpica/Osd/OsdSynch.c:535 Hmm... > I was afraid it might happen. I'll look into it ASAP. Sorry for the trouble, Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/klPoACgkQmlay1b9qnVMg+QCggRXxXE2Wpc6kXWSpwbykhrWq RvQAniVjs7p/084ZnlDPA+GQqyxTIF/w =+7Iw -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 16:05:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B2321065677; Fri, 22 Jun 2012 16:05:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 162DA8FC19; Fri, 22 Jun 2012 16:05:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MG5uGK087329; Fri, 22 Jun 2012 16:05:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MG5uJJ087327; Fri, 22 Jun 2012 16:05:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206221605.q5MG5uJJ087327@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 22 Jun 2012 16:05:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237445 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 16:05:57 -0000 Author: kib Date: Fri Jun 22 16:05:56 2012 New Revision: 237445 URL: http://svn.freebsd.org/changeset/base/237445 Log: Commit changes missed from r237435. Properly calculate the signal trampoline addresses after the shared page is enabled. Handle FreeBSD ABIs without shared page support too. Reported and tested by: David Wolfskill (previous version) Pointy hat to: kib MFC after: 1 month Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Fri Jun 22 14:58:40 2012 (r237444) +++ head/sys/i386/i386/machdep.c Fri Jun 22 16:05:56 2012 (r237445) @@ -469,7 +469,13 @@ osendsig(sig_t catcher, ksiginfo_t *ksi, } regs->tf_esp = (int)fp; - regs->tf_eip = PS_STRINGS - szosigcode; + if (p->p_sysent->sv_sigcode_base != 0) { + regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode - + szosigcode; + } else { + /* a.out sysentvec does not use shared page */ + regs->tf_eip = p->p_sysent->sv_psstrings - szosigcode; + } regs->tf_eflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; @@ -596,7 +602,8 @@ freebsd4_sendsig(sig_t catcher, ksiginfo } regs->tf_esp = (int)sfp; - regs->tf_eip = PS_STRINGS - szfreebsd4_sigcode; + regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode - + szfreebsd4_sigcode; regs->tf_eflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; @@ -747,7 +754,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, } regs->tf_esp = (int)sfp; - regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode); + regs->tf_eip = p->p_sysent->sv_sigcode_base; regs->tf_eflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 16:20:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E6CC8106566C; Fri, 22 Jun 2012 16:20:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D17318FC18; Fri, 22 Jun 2012 16:20:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MGKD7g087943; Fri, 22 Jun 2012 16:20:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MGKDIW087941; Fri, 22 Jun 2012 16:20:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206221620.q5MGKDIW087941@svn.freebsd.org> From: Alexander Motin Date: Fri, 22 Jun 2012 16:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237446 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 16:20:14 -0000 Author: mav Date: Fri Jun 22 16:20:13 2012 New Revision: 237446 URL: http://svn.freebsd.org/changeset/base/237446 Log: Don't print SCSI Queue Full and CAM_REQUEUE_REQ statuses as errors if they were handled and retried. They are part of normal operation for SCSI TCQ. MFC after: 3 days Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Fri Jun 22 16:05:56 2012 (r237445) +++ head/sys/cam/cam_periph.c Fri Jun 22 16:20:13 2012 (r237446) @@ -1354,6 +1354,7 @@ camperiphscsistatuserror(union ccb *ccb, } *timeout = 0; error = ERESTART; + *print = 0; break; } /* FALLTHROUGH */ @@ -1683,8 +1684,10 @@ cam_periph_error(union ccb *ccb, cam_fla } else if (sense_flags & SF_NO_RETRY) { error = EIO; action_string = "Retry was blocked"; - } else + } else { error = ERESTART; + print = 0; + } break; case CAM_RESRC_UNAVAIL: /* Wait a bit for the resource shortage to abate. */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 16:31:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C2A01065691; Fri, 22 Jun 2012 16:31:01 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D7BD8FC17; Fri, 22 Jun 2012 16:31:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MGV122088414; Fri, 22 Jun 2012 16:31:01 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MGV1b4088411; Fri, 22 Jun 2012 16:31:01 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201206221631.q5MGV1b4088411@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 22 Jun 2012 16:31:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237447 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 16:31:01 -0000 Author: gnn Date: Fri Jun 22 16:31:00 2012 New Revision: 237447 URL: http://svn.freebsd.org/changeset/base/237447 Log: MFC 230063 Clean up a switch statement for uncore events on Westmere processors. Submitted by: Davide Italiano Reviewed by: gnn Modified: stable/8/sys/dev/hwpmc/hwpmc_uncore.c stable/8/sys/dev/hwpmc/hwpmc_uncore.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_uncore.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_uncore.c Fri Jun 22 16:20:13 2012 (r237446) +++ stable/8/sys/dev/hwpmc/hwpmc_uncore.c Fri Jun 22 16:31:00 2012 (r237447) @@ -974,26 +974,18 @@ ucp_start_pmc(int cpu, int ri) /* Event specific configuration. */ switch (pm->pm_event) { case PMC_EV_UCP_EVENT_0CH_04H_E: + case PMC_EV_UCP_EVENT_0CH_08H_E: wrmsr(MSR_GQ_SNOOP_MESF,0x2); break; case PMC_EV_UCP_EVENT_0CH_04H_F: + case PMC_EV_UCP_EVENT_0CH_08H_F: wrmsr(MSR_GQ_SNOOP_MESF,0x8); break; case PMC_EV_UCP_EVENT_0CH_04H_M: - wrmsr(MSR_GQ_SNOOP_MESF,0x1); - break; - case PMC_EV_UCP_EVENT_0CH_04H_S: - wrmsr(MSR_GQ_SNOOP_MESF,0x4); - break; - case PMC_EV_UCP_EVENT_0CH_08H_E: - wrmsr(MSR_GQ_SNOOP_MESF,0x2); - break; - case PMC_EV_UCP_EVENT_0CH_08H_F: - wrmsr(MSR_GQ_SNOOP_MESF,0x8); - break; case PMC_EV_UCP_EVENT_0CH_08H_M: wrmsr(MSR_GQ_SNOOP_MESF,0x1); break; + case PMC_EV_UCP_EVENT_0CH_04H_S: case PMC_EV_UCP_EVENT_0CH_08H_S: wrmsr(MSR_GQ_SNOOP_MESF,0x4); break; Modified: stable/8/sys/dev/hwpmc/hwpmc_uncore.h ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_uncore.h Fri Jun 22 16:20:13 2012 (r237446) +++ stable/8/sys/dev/hwpmc/hwpmc_uncore.h Fri Jun 22 16:31:00 2012 (r237447) @@ -87,7 +87,6 @@ struct pmc_md_ucp_op_pmcallocate { #define UC_GLOBAL_CTRL 0x391 #define UC_GLOBAL_OVF_CTRL 0x393 - #define UC_GLOBAL_STATUS_FLAG_CLRCHG (1ULL << 63) #define UC_GLOBAL_STATUS_FLAG_OVFPMI (1ULL << 61) #define UC_GLOBAL_CTRL_FLAG_FRZ (1ULL << 63) From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 18:01:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 63132106566B; Fri, 22 Jun 2012 18:01:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BA768FC12; Fri, 22 Jun 2012 18:01:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MI1NNS092252; Fri, 22 Jun 2012 18:01:23 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MI1NxN092238; Fri, 22 Jun 2012 18:01:23 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206221801.q5MI1NxN092238@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 22 Jun 2012 18:01:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237448 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 18:01:23 -0000 Author: pfg Date: Fri Jun 22 18:01:22 2012 New Revision: 237448 URL: http://svn.freebsd.org/changeset/base/237448 Log: Merge changes from upstream libedit. Our libedit has been diverging from the mainstream version maintained in NetBSD. As a consequence it has been difficult to do an appropriate MFV and we have been bringing only partial updates. Here we update most of the files to at least match the version available in NetBSD's snapshot of 20091228. This version was chosen because it still doesn't include wide character support (UTF-8), which involves many changes and new files. From NetBSD's logs: Dec 15 22:13:33 2006 - editline.3 el.c el.h histedit.h add EL_GETFP, and EL_SETFP. Apr 5 15:53:28 2008 - editline.3 el.c histedit.h readline.c add EL_REFRESH for the benefit of readline Sep 10 15:45:37 2008 - common.c el.c read.c refresh.c sig.c term.c term.h tty.c Allow a single process to control multiple ttys (for pthreads using _REENTRANT) using multiple EditLine objects. Jan 18 12:17:24 2009 - el.c read.c readline.c fix -Wsign-compare issues Feb 6 14:40:32 2009 - history.c Plug memory leak, from MySQL. Feb 5 19:15:44 2009 - histedit.h read.c match documentation in el_push Feb 6 13:14:37 2009 - vi.c Portability fix. Feb 12 13:39:49 2009 - readline.c term.c More fixes for existing portability stuff. Feb 15 21:24:13 2009 - el.h read.c don't restart on EINTR, instead return NULL immediately. From Anon Ymous Feb 15 21:25:01 2009 - sig.c sig.h in order for read() to return EINTR we need to use sigaction, not signal, otherwise SA_RESTART is set. Feb 15 21:55:23 2009 - chared.c chared.h common.c emacs.c filecomplete.c filecomplete.h key.c key.h read.c readline.c refresh.c search.c term.c tokenizer.c tty.c vi.c pass lint on _LP64. Feb 17 21:34:26 2009 - el.c histedit.h prompt.c prompt.h allow for a prompt argument. Feb 18 15:04:40 2009 - sig.c SA_RESTART for all signals but SIGINT. From Anon Ymous. Feb 19 15:20:22 2009 - read.c sig.c sig.h reset and redraw on sigcont. From Anon Ymous. Feb 21 23:31:56 2009 - key.c key.h readline.c vi.c more size_t stuff. Mar 10 20:46:15 2009 - editline.3 read.c make el_gets set the count to -1 on error to distinguish between EOF and error. Mar 31 17:38:27 2009 - editline.3 el.c histedit.h prompt.c prompt.h refresh.c term.c term.h Implement literal prompt sequences. Now someone can implement RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-) Mar 31 21:33:17 2009 - term.c cast to size_t to avoid sign / unsigned comparison warning. Apr 23 02:03 2009 - term.c Apply patch (requested by msaitoh in ticket #2007): Coverity CID 1668: Plug memory leak when malloc() failed.:55 2009 May 11 18:33:30 2009 - editline.3 el.c histedit.h restore binary compatibility by providing new prompt functions that take an extra literal character. May 19 21:45:14 2009 - refresh.c always scroll when we advance past bottom. From Caleb Welton cwelton at greenplum dot com. Jul 17 12:27:57 2009 - term.c - off by one in the term.h case. - make code more similar to tcsh (if we want to handle wide chars, this is needed; for now it is a no-op) Jul 22 15:56:29 2009 - el.c Move filename to the scope it is being used. From Michael Cook mcook at bbn dot com Jul 22 15:57:00 2009 - read.c Always initialize nread since it is an out param. From Michael Cook mcook at bbn dot com Jul 22 18:25:26 2009 - el.c Only need path if we have issetugid... From Anon Ymous Jul 25 21:19:23 2009 - el.c Ignore comment lines in .editrc from Jess Thrysoee Sep 7 21:24:33 2009 histedit.h history.c readline.c apply apple patches from: http://opensource.apple.com/source/libedit/libedit-11/patches/ Dec 28 21:52:43 2009 - refresh.c Fix bug where tab completion on the second or > line that caused listing ended up corrupting the display by an extra space in the beginning. Reported by Mac Chan. Dec 28 22:15:36 2009 - refresh.c term.c reduce diff with tcsh Obtained from: NetBSD Tested by: bapt, jilles and current@ MFC after: 1 week Modified: head/lib/libedit/common.c head/lib/libedit/editline.3 head/lib/libedit/editrc.5 head/lib/libedit/el.c head/lib/libedit/el.h head/lib/libedit/histedit.h head/lib/libedit/history.c head/lib/libedit/key.c head/lib/libedit/key.h head/lib/libedit/prompt.c head/lib/libedit/prompt.h head/lib/libedit/read.c head/lib/libedit/refresh.c head/lib/libedit/search.c head/lib/libedit/sig.c head/lib/libedit/sig.h head/lib/libedit/term.c head/lib/libedit/term.h head/lib/libedit/tty.c head/lib/libedit/vi.c Modified: head/lib/libedit/common.c ============================================================================== --- head/lib/libedit/common.c Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/common.c Fri Jun 22 18:01:22 2012 (r237448) @@ -905,7 +905,7 @@ ed_command(EditLine *el, int c __unused) int tmplen; tmplen = c_gets(el, tmpbuf, "\n: "); - term__putc('\n'); + term__putc(el, '\n'); if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1) term_beep(el); Modified: head/lib/libedit/editline.3 ============================================================================== --- head/lib/libedit/editline.3 Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/editline.3 Fri Jun 22 18:01:22 2012 (r237448) @@ -1,4 +1,4 @@ -.\" $NetBSD: editline.3,v 1.55 2007/01/12 16:31:13 christos Exp $ +.\" $NetBSD: editline.3,v 1.70 2009/07/05 21:55:24 perry Exp $ .\" .\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2007 +.Dd July 5, 2009 .Dt EDITLINE 3 .Os .Sh NAME @@ -162,6 +162,14 @@ is modified to contain the number of cha Returns the line read if successful, or .Dv NULL if no characters were read or if an error occurred. +If an error occurred, +.Fa count +is set to \-1 and +.Dv errno +contains the error code that caused it. +The return value may not remain valid across calls to +.Fn el_gets +and must be copied if the data is to be retained. .It Fn el_getc Read a character from the tty. .Fa ch @@ -222,10 +230,30 @@ are supported, along with the required a Define prompt printing function as .Fa f , which is to return a string that contains the prompt. +.It Dv EL_PROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" +Same as +.Dv EL_PROMPT , +but the +.Fa c +argument indicates the start/stop literal prompt character. +.Pp +If a start/stop literal character is found in the prompt, the +character itself +is not printed, but characters after it are printed directly to the +terminal without affecting the state of the current line. +A subsequent second start/stop literal character ends this behavior. +This is typically used to embed literal escape sequences that change the +color/style of the terminal in the prompt. +.Dv 0 +unsets it. +.It Dv EL_REFRESH +Re-display the current line on the next terminal line. .It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" Define right side prompt printing function as .Fa f , which is to return a string that contains the prompt. +.It Dv EL_RPROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" +Define the right prompt printing function but with a literal escape character. .It Dv EL_TERMINAL , Fa "const char *type" Define terminal type of the tty to be .Fa type , @@ -259,66 +287,43 @@ reading command input: and .Dv SIGWINCH . Otherwise, the current signal handlers will be used. -.It Dv EL_BIND , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_BIND , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic bind builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_ECHOTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_ECHOTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic echotc builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_SETTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_SETTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic settc builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_SETTY , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_SETTY , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic setty builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_TELLTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_TELLTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic telltc builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_ADDFN , Xo -.Fa "const char *name" , -.Fa "const char *help" , -.Fa "unsigned char (*func)(EditLine *e, int ch)" -.Xc +.It Dv EL_ADDFN , Fa "const char *name" , Fa "const char *help" , \ +Fa "unsigned char (*func)(EditLine *e, int ch)" Add a user defined function, .Fn func , referred to as @@ -360,10 +365,8 @@ Beep, and flush tty. .It Dv CC_FATAL Fatal error, reset tty to known state. .El -.It Dv EL_HIST , Xo -.Fa "History *(*func)(History *, int op, ...)" , -.Fa "const char *ptr" -.Xc +.It Dv EL_HIST , Fa "History *(*func)(History *, int op, ...)" , \ +Fa "const char *ptr" Defines which history function to use, which is usually .Fn history . .Fa ptr @@ -435,10 +438,22 @@ The following values for are supported, along with actual type of .Fa result : .Bl -tag -width 4n -.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" -Return a pointer to the function that displays the prompt. -.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" -Return a pointer to the function that displays the rightside prompt. +.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c" +Return a pointer to the function that displays the prompt in +.Fa f . +If +.Fa c +is not +.Dv NULL , +return the start/stop literal prompt character in it. +.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c" +Return a pointer to the function that displays the prompt in +.Fa f . +If +.Fa c +is not +.Dv NULL , +return the start/stop literal prompt character in it. .It Dv EL_EDITOR , Fa "const char *" Return the name of the editor, which will be one of .Dq emacs @@ -603,18 +618,11 @@ assumed to be created with .Fn history_init . .It Dv H_CLEAR Clear the history. -.It Dv H_FUNC , Xo -.Fa "void *ptr" , -.Fa "history_gfun_t first" , -.Fa "history_gfun_t next" , -.Fa "history_gfun_t last" , -.Fa "history_gfun_t prev" , -.Fa "history_gfun_t curr" , -.Fa "history_sfun_t set" , -.Fa "history_vfun_t clear" , -.Fa "history_efun_t enter" , -.Fa "history_efun_t add" -.Xc +.It Dv H_FUNC , Fa "void *ptr" , Fa "history_gfun_t first" , \ +Fa "history_gfun_t next" , Fa "history_gfun_t last" , \ +Fa "history_gfun_t prev" , Fa "history_gfun_t curr" , \ +Fa "history_sfun_t set" , Fa "history_vfun_t clear" , \ +Fa "history_efun_t enter" , Fa "history_efun_t add" Define functions to perform various history operations. .Fa ptr is the argument given to a function when it is invoked. Modified: head/lib/libedit/editrc.5 ============================================================================== --- head/lib/libedit/editrc.5 Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/editrc.5 Fri Jun 22 18:01:22 2012 (r237448) @@ -1,4 +1,4 @@ -.\" $NetBSD: editrc.5,v 1.20 2006/08/21 12:45:30 christos Exp $ +.\" $NetBSD: editrc.5,v 1.24 2009/04/11 22:17:52 wiz Exp $ .\" .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -89,16 +89,8 @@ shell. .Pp The following builtin commands are available: .Bl -tag -width 4n -.It Ic bind Xo -.Op Fl a -.Op Fl e -.Op Fl k -.Op Fl l -.Op Fl r -.Op Fl s -.Op Fl v -.Op Ar key Op Ar command -.Xc +.It Ic bind Oo Fl a Oc Oo Fl e Oc Oo Fl k Oc Oo Fl l Oc Oo Fl r Oc \ +Oo Fl s Oc Oo Fl v Oc Oo Ar key Op Ar command Oc Without options, list all bound keys, and the editor command to which each is bound. If @@ -192,11 +184,7 @@ if it has any, notably .Sq \e and .Sq ^ . -.It Ic echotc Xo -.Op Fl sv -.Ar arg -.Ar ... -.Xc +.It Ic echotc Oo Fl sv Oc Ar arg Ar ... Exercise terminal capabilities given in .Ar arg Ar ... . If @@ -252,16 +240,8 @@ to as defined in .Xr termcap 5 . No sanity checking is done. -.It Ic setty Xo -.Op Fl a -.Op Fl d -.Op Fl q -.Op Fl x -.Op Ar +mode -.Op Ar -mode -.Op Ar mode -.Op Ar char=c -.Xc +.It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ar +mode Oc \ +Oo Ar -mode Oc Oo Ar mode Oc Oo Ar char=c Oc Control which tty modes that .Nm will not allow the user to change. Modified: head/lib/libedit/el.c ============================================================================== --- head/lib/libedit/el.c Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/el.c Fri Jun 22 18:01:22 2012 (r237448) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: el.c,v 1.44 2006/12/15 22:13:33 christos Exp $ + * $NetBSD: el.c,v 1.55 2009/07/25 21:19:23 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "el.h" #define HAVE_ISSETUGID @@ -156,9 +157,21 @@ el_set(EditLine *el, int op, ...) switch (op) { case EL_PROMPT: - case EL_RPROMPT: - rv = prompt_set(el, va_arg(ap, el_pfunc_t), op); + case EL_RPROMPT: { + el_pfunc_t p = va_arg(ap, el_pfunc_t); + + rv = prompt_set(el, p, 0, op); break; + } + + case EL_PROMPT_ESC: + case EL_RPROMPT_ESC: { + el_pfunc_t p = va_arg(ap, el_pfunc_t); + char c = va_arg(ap, int); + + rv = prompt_set(el, p, c, op); + break; + } case EL_TERMINAL: rv = term_set(el, va_arg(ap, char *)); @@ -309,6 +322,12 @@ el_set(EditLine *el, int op, ...) break; } + case EL_REFRESH: + re_clear_display(el); + re_refresh(el); + term__flush(el); + break; + default: rv = -1; break; @@ -335,9 +354,13 @@ el_get(EditLine *el, int op, ...) switch (op) { case EL_PROMPT: - case EL_RPROMPT: - rv = prompt_get(el, va_arg(ap, el_pfunc_t *), op); + case EL_RPROMPT: { + el_pfunc_t *p = va_arg(ap, el_pfunc_t *); + char *c = va_arg(ap, char *); + + rv = prompt_get(el, p, c, op); break; + } case EL_EDITOR: rv = map_get_editor(el, va_arg(ap, const char **)); @@ -364,7 +387,7 @@ el_get(EditLine *el, int op, ...) char *argv[20]; int i; - for (i = 1; i < sizeof(argv) / sizeof(argv[0]); i++) + for (i = 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++) if ((argv[i] = va_arg(ap, char *)) == NULL) break; @@ -495,12 +518,14 @@ el_source(EditLine *el, const char *fnam FILE *fp; size_t len; char *ptr; +#ifdef HAVE_ISSETUGID + char path[MAXPATHLEN]; +#endif fp = NULL; if (fname == NULL) { #ifdef HAVE_ISSETUGID static const char elpath[] = "/.editrc"; - char path[MAXPATHLEN]; if (issetugid()) return (-1); @@ -529,6 +554,13 @@ el_source(EditLine *el, const char *fnam if (len > 0 && ptr[len - 1] == '\n') --len; ptr[len] = '\0'; + + /* loop until first non-space char or EOL */ + while (*ptr != '\0' && isspace((unsigned char)*ptr)) + ptr++; + if (*ptr == '#') + continue; /* ignore, this is a comment line */ + if (parse_line(el, ptr) == -1) { (void) fclose(fp); return (-1); Modified: head/lib/libedit/el.h ============================================================================== --- head/lib/libedit/el.h Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/el.h Fri Jun 22 18:01:22 2012 (r237448) @@ -115,6 +115,7 @@ struct editline { FILE *el_errfile; /* Stdio stuff */ int el_infd; /* Input file descriptor */ int el_flags; /* Various flags. */ + int el_errno; /* Local copy of errno */ coord_t el_cursor; /* Cursor location */ char **el_display; /* Real screen image = what is there */ char **el_vdisplay; /* Virtual screen image = what we see */ Modified: head/lib/libedit/histedit.h ============================================================================== --- head/lib/libedit/histedit.h Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/histedit.h Fri Jun 22 18:01:22 2012 (r237448) @@ -131,10 +131,10 @@ unsigned char _el_fn_sh_complete(EditLin #define EL_GETCFN 13 /* , el_rfunc_t); */ #define EL_CLIENTDATA 14 /* , void *); */ #define EL_UNBUFFERED 15 /* , int); */ -#define EL_PREP_TERM 16 /* , int); */ +#define EL_PREP_TERM 16 /* , int); */ #define EL_GETTC 17 /* , const char *, ..., NULL); */ -#define EL_GETFP 18 /* , int, FILE **) */ -#define EL_SETFP 19 /* , int, FILE *) */ +#define EL_GETFP 18 /* , int, FILE **); */ +#define EL_SETFP 19 /* , int, FILE *); */ #define EL_REFRESH 20 /* , void); set */ #define EL_PROMPT_ESC 21 /* , prompt_func, Char); set/get */ #define EL_RPROMPT_ESC 22 /* , prompt_func, Char); set/get */ Modified: head/lib/libedit/history.c ============================================================================== --- head/lib/libedit/history.c Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/history.c Fri Jun 22 18:01:22 2012 (r237448) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: history.c,v 1.32 2006/09/28 13:52:51 christos Exp $ + * $NetBSD: history.c,v 1.34 2009/09/07 21:24:33 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -116,6 +116,7 @@ private int history_prev_string(History */ typedef struct hentry_t { HistEvent ev; /* What we return */ + void *data; /* data */ struct hentry_t *next; /* Next entry */ struct hentry_t *prev; /* Previous entry */ } hentry_t; @@ -145,6 +146,9 @@ private int history_def_init(ptr_t *, Hi private int history_def_insert(history_t *, HistEvent *, const char *); private void history_def_delete(history_t *, HistEvent *, hentry_t *); +private int history_deldata_nth(history_t *, HistEvent *, int, void **); +private int history_set_nth(ptr_t, HistEvent *, int); + #define history_def_setsize(p, num)(void) (((history_t *)p)->max = (num)) #define history_def_getsize(p) (((history_t *)p)->cur) #define history_def_getunique(p) (((((history_t *)p)->flags) & H_UNIQUE) != 0) @@ -335,6 +339,31 @@ history_def_set(ptr_t p, HistEvent *ev, } +/* history_set_nth(): + * Default function to set the current event in the history to the + * n-th one. + */ +private int +history_set_nth(ptr_t p, HistEvent *ev, int n) +{ + history_t *h = (history_t *) p; + + if (h->cur == 0) { + he_seterrev(ev, _HE_EMPTY_LIST); + return (-1); + } + for (h->cursor = h->list.prev; h->cursor != &h->list; + h->cursor = h->cursor->prev) + if (n-- <= 0) + break; + if (h->cursor == &h->list) { + he_seterrev(ev, _HE_NOT_FOUND); + return (-1); + } + return (0); +} + + /* history_def_add(): * Append string to element */ @@ -363,6 +392,24 @@ history_def_add(ptr_t p, HistEvent *ev, } +private int +history_deldata_nth(history_t *h, HistEvent *ev, + int num, void **data) +{ + if (history_set_nth(h, ev, num) != 0) + return (-1); + /* magic value to skip delete (just set to n-th history) */ + if (data == (void **)-1) + return (0); + ev->str = strdup(h->cursor->ev.str); + ev->num = h->cursor->ev.num; + if (data) + *data = h->cursor->data; + history_def_delete(h, ev, h->cursor); + return (0); +} + + /* history_def_del(): * Delete element hp of the h list */ @@ -392,8 +439,11 @@ history_def_delete(history_t *h, HistEventPrivate *evp = (void *)&hp->ev; if (hp == &h->list) abort(); - if (h->cursor == hp) + if (h->cursor == hp) { h->cursor = hp->prev; + if (h->cursor == &h->list) + h->cursor = hp->next; + } hp->prev->next = hp->next; hp->next->prev = hp->prev; h_free((ptr_t) evp->str); @@ -416,6 +466,7 @@ history_def_insert(history_t *h, HistEve h_free((ptr_t)h->cursor); goto oomem; } + h->cursor->data = NULL; h->cursor->ev.num = ++h->eventid; h->cursor->next = h->list.next; h->cursor->prev = &h->list; @@ -711,8 +762,8 @@ history_load(History *h, const char *fna (void) strunvis(ptr, line); line[sz] = c; if (HENTER(h, &ev, ptr) == -1) { - h_free((ptr_t)ptr); - return -1; + i = -1; + goto oomem; } } oomem: @@ -787,6 +838,23 @@ history_prev_event(History *h, HistEvent } +private int +history_next_evdata(History *h, HistEvent *ev, int num, void **d) +{ + int retval; + + for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) + if (num-- <= 0) { + if (d) + *d = ((history_t *)h->h_ref)->cursor->data; + return (0); + } + + he_seterrev(ev, _HE_NOT_FOUND); + return (-1); +} + + /* history_next_event(): * Find the next event, with number given */ @@ -976,11 +1044,42 @@ history(History *h, HistEvent *ev, int f retval = 0; break; + case H_NEXT_EVDATA: + { + int num = va_arg(va, int); + void **d = va_arg(va, void **); + retval = history_next_evdata(h, ev, num, d); + break; + } + + case H_DELDATA: + { + int num = va_arg(va, int); + void **d = va_arg(va, void **); + retval = history_deldata_nth((history_t *)h->h_ref, ev, num, d); + break; + } + + case H_REPLACE: /* only use after H_NEXT_EVDATA */ + { + const char *line = va_arg(va, const char *); + void *d = va_arg(va, void *); + const char *s; + if(!line || !(s = strdup(line))) { + retval = -1; + break; + } + ((history_t *)h->h_ref)->cursor->ev.str = s; + ((history_t *)h->h_ref)->cursor->data = d; + retval = 0; + break; + } + default: retval = -1; he_seterrev(ev, _HE_UNKNOWN); break; } va_end(va); - return (retval); + return retval; } Modified: head/lib/libedit/key.c ============================================================================== --- head/lib/libedit/key.c Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/key.c Fri Jun 22 18:01:22 2012 (r237448) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: key.c,v 1.19 2006/03/23 20:22:51 christos Exp $ + * $NetBSD: key.c,v 1.20 2009/02/15 21:55:23 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -86,8 +86,8 @@ private void node__free(key_node_t *); private void node__put(EditLine *, key_node_t *); private int node__delete(EditLine *, key_node_t **, const char *); private int node_lookup(EditLine *, const char *, key_node_t *, - int); -private int node_enum(EditLine *, key_node_t *, int); + size_t); +private int node_enum(EditLine *, key_node_t *, size_t); #define KEY_BUFSIZ EL_BUFSIZ @@ -478,9 +478,9 @@ node__free(key_node_t *k) * Print if last node */ private int -node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt) +node_lookup(EditLine *el, const char *str, key_node_t *ptr, size_t cnt) { - int ncnt; + size_t ncnt; if (ptr == NULL) return (-1); /* cannot have null ptr */ @@ -493,7 +493,8 @@ node_lookup(EditLine *el, const char *st /* If match put this char into el->el_key.buf. Recurse */ if (ptr->ch == *str) { /* match found */ - ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt, + ncnt = key__decode_char(el->el_key.buf, + (size_t)KEY_BUFSIZ, cnt, (unsigned char) ptr->ch); if (ptr->next != NULL) /* not yet at leaf */ @@ -527,9 +528,9 @@ node_lookup(EditLine *el, const char *st * Traverse the node printing the characters it is bound in buffer */ private int -node_enum(EditLine *el, key_node_t *ptr, int cnt) +node_enum(EditLine *el, key_node_t *ptr, size_t cnt) { - int ncnt; + size_t ncnt; if (cnt >= KEY_BUFSIZ - 5) { /* buffer too small */ el->el_key.buf[++cnt] = '"'; @@ -547,7 +548,7 @@ node_enum(EditLine *el, key_node_t *ptr, return (-1); } /* put this char at end of str */ - ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt, + ncnt = key__decode_char(el->el_key.buf, (size_t)KEY_BUFSIZ, cnt, (unsigned char)ptr->ch); if (ptr->next == NULL) { /* print this key and function */ @@ -615,8 +616,8 @@ key_kprint(EditLine *el, const char *key /* key__decode_char(): * Put a printable form of char in buf. */ -protected int -key__decode_char(char *buf, int cnt, int off, int ch) +protected size_t +key__decode_char(char *buf, size_t cnt, size_t off, int ch) { char *sb = buf + off; char *eb = buf + cnt; @@ -626,7 +627,7 @@ key__decode_char(char *buf, int cnt, int if (ch == 0) { ADDC('^'); ADDC('@'); - return b - sb; + return (int)(b - sb); } if (iscntrl(ch)) { ADDC('^'); @@ -648,15 +649,15 @@ key__decode_char(char *buf, int cnt, int ADDC((((unsigned int) ch >> 3) & 7) + '0'); ADDC((ch & 7) + '0'); } - return b - sb; + return (size_t)(b - sb); } /* key__decode_str(): * Make a printable version of the ey */ -protected int -key__decode_str(const char *str, char *buf, int len, const char *sep) +protected size_t +key__decode_str(const char *str, char *buf, size_t len, const char *sep) { char *b = buf, *eb = b + len; const char *p; @@ -699,7 +700,7 @@ key__decode_str(const char *str, char *b } done: ADDC('\0'); - if (b - buf >= len) + if ((size_t)(b - buf) >= len) buf[len - 1] = '\0'; - return b - buf; + return (size_t)(b - buf); } Modified: head/lib/libedit/key.h ============================================================================== --- head/lib/libedit/key.h Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/key.h Fri Jun 22 18:01:22 2012 (r237448) @@ -76,8 +76,8 @@ protected int key_delete(EditLine *, c protected void key_print(EditLine *, const char *); protected void key_kprint(EditLine *, const char *, key_value_t *, int); -protected int key__decode_str(const char *, char *, int, +protected size_t key__decode_str(const char *, char *, size_t, const char *); -protected int key__decode_char(char *, int, int, int); +protected size_t key__decode_char(char *, size_t, size_t, int); #endif /* _h_el_key */ Modified: head/lib/libedit/prompt.c ============================================================================== --- head/lib/libedit/prompt.c Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/prompt.c Fri Jun 22 18:01:22 2012 (r237448) @@ -85,14 +85,23 @@ prompt_print(EditLine *el, int op) { el_prompt_t *elp; char *p; + int ignore = 0; if (op == EL_PROMPT) elp = &el->el_prompt; else elp = &el->el_rprompt; - p = (elp->p_func) (el); - while (*p) - re_putc(el, *p++, 1); + + for (p = (*elp->p_func)(el); *p; p++) { + if (elp->p_ignore == *p) { + ignore = !ignore; + continue; + } + if (ignore) + term__putc(el, *p); + else + re_putc(el, *p, 1); + } elp->p_pos.v = el->el_refresh.r_cursor.v; elp->p_pos.h = el->el_refresh.r_cursor.h; @@ -109,10 +118,12 @@ prompt_init(EditLine *el) el->el_prompt.p_func = prompt_default; el->el_prompt.p_pos.v = 0; el->el_prompt.p_pos.h = 0; + el->el_prompt.p_ignore = '\0'; el->el_rprompt.p_func = prompt_default_r; el->el_rprompt.p_pos.v = 0; el->el_rprompt.p_pos.h = 0; - return (0); + el->el_rprompt.p_ignore = '\0'; + return 0; } @@ -130,24 +141,29 @@ prompt_end(EditLine *el __unused) * Install a prompt printing function */ protected int -prompt_set(EditLine *el, el_pfunc_t prf, int op) +prompt_set(EditLine *el, el_pfunc_t prf, char c, int op) { el_prompt_t *p; - if (op == EL_PROMPT) + if (op == EL_PROMPT || op == EL_PROMPT_ESC) p = &el->el_prompt; else p = &el->el_rprompt; + if (prf == NULL) { - if (op == EL_PROMPT) + if (op == EL_PROMPT || op == EL_PROMPT_ESC) p->p_func = prompt_default; else p->p_func = prompt_default_r; } else p->p_func = prf; + + p->p_ignore = c; + p->p_pos.v = 0; p->p_pos.h = 0; - return (0); + + return 0; } @@ -155,14 +171,22 @@ prompt_set(EditLine *el, el_pfunc_t prf, * Retrieve the prompt printing function */ protected int -prompt_get(EditLine *el, el_pfunc_t *prf, int op) +prompt_get(EditLine *el, el_pfunc_t *prf, char *c, int op) { + el_prompt_t *p; if (prf == NULL) - return (-1); + return -1; + if (op == EL_PROMPT) - *prf = el->el_prompt.p_func; + p = &el->el_prompt; else - *prf = el->el_rprompt.p_func; - return (0); + p = &el->el_rprompt; + + *prf = el->el_rprompt.p_func; + + if (c) + *c = p->p_ignore; + + return 0; } Modified: head/lib/libedit/prompt.h ============================================================================== --- head/lib/libedit/prompt.h Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/prompt.h Fri Jun 22 18:01:22 2012 (r237448) @@ -47,11 +47,13 @@ typedef char * (*el_pfunc_t)(EditLine*); typedef struct el_prompt_t { el_pfunc_t p_func; /* Function to return the prompt */ coord_t p_pos; /* position in the line after prompt */ + char p_ignore; /* character to start/end literal +*/ } el_prompt_t; protected void prompt_print(EditLine *, int); -protected int prompt_set(EditLine *, el_pfunc_t, int); -protected int prompt_get(EditLine *, el_pfunc_t *, int); +protected int prompt_set(EditLine *, el_pfunc_t, char, int); +protected int prompt_get(EditLine *, el_pfunc_t *, char *, int); protected int prompt_init(EditLine *); protected void prompt_end(EditLine *); Modified: head/lib/libedit/read.c ============================================================================== --- head/lib/libedit/read.c Fri Jun 22 16:31:00 2012 (r237447) +++ head/lib/libedit/read.c Fri Jun 22 18:01:22 2012 (r237448) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: read.c,v 1.40 2007/03/01 21:41:45 christos Exp $ + * $NetBSD: read.c,v 1.52 2009/07/22 15:57:00 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include "el.h" -#define OKCMD -1 +#define OKCMD -1 /* must be -1! */ private int read__fixio(int, int); private int read_preread(EditLine *); @@ -170,7 +170,7 @@ read__fixio(int fd __unused, int e) return (e ? 0 : -1); case EINTR: - return (0); + return (-1); default: return (-1); @@ -222,7 +222,7 @@ el_push(EditLine *el, const char *str) ma->level--; } term_beep(el); - term__flush(); + term__flush(el); } @@ -235,9 +235,12 @@ read_getcmd(EditLine *el, el_action_t *c el_action_t cmd; int num; + el->el_errno = 0; do { - if ((num = el_getc(el, ch)) != 1) /* if EOF or error */ + if ((num = el_getc(el, ch)) != 1) { /* if EOF or error */ + el->el_errno = num == 0 ? 0 : errno; return (num); + } #ifdef KANJI if ((*ch & 0200)) { @@ -286,18 +289,25 @@ read_getcmd(EditLine *el, el_action_t *c private int read_char(EditLine *el, char *cp) { - int num_read; + ssize_t num_read; int tried = 0; - while ((num_read = read(el->el_infd, cp, 1)) == -1) + again: + el->el_signal->sig_no = 0; + while ((num_read = read(el->el_infd, cp, 1)) == -1) { + if (el->el_signal->sig_no == SIGCONT) { + sig_set(el); + el_set(el, EL_REFRESH); + goto again; + } if (!tried && read__fixio(el->el_infd, errno) == 0) tried = 1; else { *cp = '\0'; return (-1); } - - return (num_read); + } + return (int)num_read; } /* read_pop(): @@ -309,8 +319,9 @@ read_pop(c_macro_t *ma) int i; el_free(ma->macro[0]); - for (i = ma->level--; i > 0; i--) - ma->macro[i - 1] = ma->macro[i]; + for (i = 0; i < ma->level; i++) + ma->macro[i] = ma->macro[i + 1]; + ma->level--; ma->offset = 0; } @@ -323,7 +334,7 @@ el_getc(EditLine *el, char *cp) int num_read; c_macro_t *ma = &el->el_chared.c_macro; - term__flush(); + term__flush(el); for (;;) { if (ma->level < 0) { if (!read_preread(el)) @@ -382,7 +393,7 @@ read_prepare(EditLine *el) re_refresh(el); /* print the prompt */ if (el->el_flags & UNBUFFERED) - term__flush(); + term__flush(el); } protected void @@ -402,15 +413,20 @@ el_gets(EditLine *el, int *nread) int num; /* how many chars we have read at NL */ char ch; int crlf = 0; + int nrb; #ifdef FIONREAD c_macro_t *ma = &el->el_chared.c_macro; #endif /* FIONREAD */ + if (nread == NULL) + nread = &nrb; + *nread = 0; + if (el->el_flags & NO_TTY) { char *cp = el->el_line.buffer; size_t idx; - while ((*el->el_read.read_char)(el, cp) == 1) { + while ((num = (*el->el_read.read_char)(el, cp)) == 1) { /* make sure there is space for next character */ if (cp + 1 >= el->el_line.limit) { idx = (cp - el->el_line.buffer); @@ -424,12 +440,16 @@ el_gets(EditLine *el, int *nread) if (cp[-1] == '\r' || cp[-1] == '\n') break; } + if (num == -1) { + if (errno == EINTR) + cp = el->el_line.buffer; + el->el_errno = errno; + } el->el_line.cursor = el->el_line.lastchar = cp; *cp = '\0'; - if (nread) - *nread = el->el_line.cursor - el->el_line.buffer; - return (el->el_line.buffer); + *nread = (int)(el->el_line.cursor - el->el_line.buffer); + goto done; } @@ -440,8 +460,8 @@ el_gets(EditLine *el, int *nread) (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 18:34:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 096E71065675; Fri, 22 Jun 2012 18:34:12 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E85E38FC0C; Fri, 22 Jun 2012 18:34:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MIYBtS093751; Fri, 22 Jun 2012 18:34:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MIYBMn093749; Fri, 22 Jun 2012 18:34:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206221834.q5MIYBMn093749@svn.freebsd.org> From: Attilio Rao Date: Fri, 22 Jun 2012 18:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237451 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 18:34:12 -0000 Author: attilio Date: Fri Jun 22 18:34:11 2012 New Revision: 237451 URL: http://svn.freebsd.org/changeset/base/237451 Log: - Add a comment explaining the locking of the cached pages pool held by vm_objects. - Add flags for the per-object lock and free pages queue mutex lock. Use the newly added flags to mark the cache root within the vm_object structure. Please note that other vm_object members should be marked with correct locking but they are left for other commits. In collabouration with: alc MFC after: 3 days3 days3 days Modified: head/sys/vm/vm_object.h Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Fri Jun 22 18:20:26 2012 (r237450) +++ head/sys/vm/vm_object.h Fri Jun 22 18:34:11 2012 (r237451) @@ -76,8 +76,21 @@ * * vm_object_t Virtual memory object. * + * The root of cached pages pool is protected by both the per-object mutex + * and the free pages queue mutex. + * On insert in the cache splay tree, the per-object mutex is expected + * to be already held and the free pages queue mutex will be + * acquired during the operation too. + * On remove and lookup from the cache splay tree, only the free + * pages queue mutex is expected to be locked. + * These rules allow for reliably checking for the presence of cached + * pages with only the per-object lock held, thereby reducing contention + * for the free pages queue mutex. + * * List of locks * (c) const until freed + * (o) per-object mutex + * (f) free pages queue mutex * */ @@ -102,7 +115,7 @@ struct vm_object { vm_ooffset_t backing_object_offset;/* Offset in backing object */ TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ - vm_page_t cache; /* root of the cache page splay tree */ + vm_page_t cache; /* (o + f) root of the cache page splay tree */ void *handle; union { /* From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 18:57:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A6F3106564A; Fri, 22 Jun 2012 18:57:07 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C3798FC15; Fri, 22 Jun 2012 18:57:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MIv6K0094688; Fri, 22 Jun 2012 18:57:06 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MIv6iX094684; Fri, 22 Jun 2012 18:57:06 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201206221857.q5MIv6iX094684@svn.freebsd.org> From: "Kenneth D. Merry" Date: Fri, 22 Jun 2012 18:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237452 - in head: sbin/camcontrol sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 18:57:07 -0000 Author: ken Date: Fri Jun 22 18:57:06 2012 New Revision: 237452 URL: http://svn.freebsd.org/changeset/base/237452 Log: Change 'camcontrol defects' to first probe a drive to find out how much defect information it has before grabbing the full defect list. This works around a bug with some Hitachi drives that generate data overrun errors when they are asked for more defect data than they have. The change is done in a spec-compliant way, so it should have no negative impact on drives that don't have this issue. This is based on work originally done at Sandvine. scsi_da.h: Add a define for the maximum amount of data that can be contained in a defect list. camcontrol.c: Update the readdefects() function to issue an initial command to determine the length of the defect list, and then use that length in the request for the full defect list. camcontrol.8: Add a note that some drives will report 0 defects available if you don't request either the PLIST or GLIST. Submitted by: Mark Johnston (original version) MFC after: 3 days Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c head/sys/cam/scsi/scsi_da.h Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Fri Jun 22 18:34:11 2012 (r237451) +++ head/sbin/camcontrol/camcontrol.8 Fri Jun 22 18:57:06 2012 (r237452) @@ -497,6 +497,8 @@ is specified, .Nm will print out the number of defects given in the READ DEFECT DATA header returned from the drive. +Some drives will report 0 defects if neither the primary or grown defect +lists are requested. .It Ic modepage Allows the user to display and optionally edit a SCSI mode page. The mode Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Jun 22 18:34:11 2012 (r237451) +++ head/sbin/camcontrol/camcontrol.c Fri Jun 22 18:57:06 2012 (r237452) @@ -1799,13 +1799,14 @@ readdefects(struct cam_device *device, i union ccb *ccb = NULL; struct scsi_read_defect_data_10 *rdd_cdb; u_int8_t *defect_list = NULL; - u_int32_t dlist_length = 65000; + u_int32_t max_dlist_length = SRDD10_MAX_LENGTH, dlist_length = 0; u_int32_t returned_length = 0; u_int32_t num_returned = 0; u_int8_t returned_format; unsigned int i; int c, error = 0; - int lists_specified = 0; + int lists_specified; + int get_length = 1; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c){ @@ -1842,20 +1843,33 @@ readdefects(struct cam_device *device, i ccb = cam_getccb(device); /* - * Hopefully 65000 bytes is enough to hold the defect list. If it - * isn't, the disk is probably dead already. We'd have to go with - * 12 byte command (i.e. alloc_length is 32 bits instead of 16) - * to hold them all. + * Eventually we should probably support the 12 byte READ DEFECT + * DATA command. It supports a longer parameter list, which may be + * necessary on newer drives with lots of defects. According to + * the SBC-3 spec, drives are supposed to return an illegal request + * if they have more defect data than will fit in 64K. */ - defect_list = malloc(dlist_length); + defect_list = malloc(max_dlist_length); if (defect_list == NULL) { warnx("can't malloc memory for defect list"); error = 1; goto defect_bailout; } + /* + * We start off asking for just the header to determine how much + * defect data is available. Some Hitachi drives return an error + * if you ask for more data than the drive has. Once we know the + * length, we retry the command with the returned length. + */ + dlist_length = sizeof(struct scsi_read_defect_data_hdr_10); + rdd_cdb =(struct scsi_read_defect_data_10 *)&ccb->csio.cdb_io.cdb_bytes; +retry: + + lists_specified = 0; + /* * cam_getccb() zeros the CCB header only. So we need to zero the * payload portion of the ccb. @@ -1917,6 +1931,51 @@ readdefects(struct cam_device *device, i returned_length = scsi_2btoul(((struct scsi_read_defect_data_hdr_10 *)defect_list)->length); + if (get_length != 0) { + get_length = 0; + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == + CAM_SCSI_STATUS_ERROR) { + struct scsi_sense_data *sense; + int error_code, sense_key, asc, ascq; + + sense = &ccb->csio.sense_data; + scsi_extract_sense_len(sense, ccb->csio.sense_len - + ccb->csio.sense_resid, &error_code, &sense_key, + &asc, &ascq, /*show_errors*/ 1); + + /* + * If the drive is reporting that it just doesn't + * support the defect list format, go ahead and use + * the length it reported. Otherwise, the length + * may not be valid, so use the maximum. + */ + if ((sense_key == SSD_KEY_RECOVERED_ERROR) + && (asc == 0x1c) && (ascq == 0x00) + && (returned_length > 0)) { + dlist_length = returned_length + + sizeof(struct scsi_read_defect_data_hdr_10); + dlist_length = min(dlist_length, + SRDD10_MAX_LENGTH); + } else + dlist_length = max_dlist_length; + } else if ((ccb->ccb_h.status & CAM_STATUS_MASK) != + CAM_REQ_CMP){ + error = 1; + warnx("Error reading defect header"); + if (arglist & CAM_ARG_VERBOSE) + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + goto defect_bailout; + } else { + dlist_length = returned_length + + sizeof(struct scsi_read_defect_data_hdr_10); + dlist_length = min(dlist_length, SRDD10_MAX_LENGTH); + } + + goto retry; + } + returned_format = ((struct scsi_read_defect_data_hdr_10 *) defect_list)->format; Modified: head/sys/cam/scsi/scsi_da.h ============================================================================== --- head/sys/cam/scsi/scsi_da.h Fri Jun 22 18:34:11 2012 (r237451) +++ head/sys/cam/scsi/scsi_da.h Fri Jun 22 18:57:06 2012 (r237452) @@ -111,6 +111,7 @@ struct scsi_read_defect_data_10 u_int8_t reserved[4]; u_int8_t alloc_length[2]; +#define SRDD10_MAX_LENGTH 0xffff u_int8_t control; }; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 19:19:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 03B6A106564A; Fri, 22 Jun 2012 19:19:54 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E19738FC0C; Fri, 22 Jun 2012 19:19:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MJJrI7095689; Fri, 22 Jun 2012 19:19:53 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MJJr9M095687; Fri, 22 Jun 2012 19:19:53 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201206221919.q5MJJr9M095687@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 22 Jun 2012 19:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237454 - stable/8/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 19:19:54 -0000 Author: gnn Date: Fri Jun 22 19:19:53 2012 New Revision: 237454 URL: http://svn.freebsd.org/changeset/base/237454 Log: MFC: 234424 Set SIGCANCEL to SIGTHR as part of some cleanup of DTrace code. Reviewed by: davidxu@ Modified: stable/8/lib/libthr/thread/thr_private.h Directory Properties: stable/8/lib/libthr/ (props changed) Modified: stable/8/lib/libthr/thread/thr_private.h ============================================================================== --- stable/8/lib/libthr/thread/thr_private.h Fri Jun 22 19:09:15 2012 (r237453) +++ stable/8/lib/libthr/thread/thr_private.h Fri Jun 22 19:19:53 2012 (r237454) @@ -61,7 +61,7 @@ typedef TAILQ_HEAD(atfork_head, pthread_ TAILQ_HEAD(mutex_queue, pthread_mutex); /* Signal to do cancellation */ -#define SIGCANCEL 32 +#define SIGCANCEL SIGTHR /* * Kernel fatal error handler macro. From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 19:19:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06BD71065672; Fri, 22 Jun 2012 19:19:59 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5CB98FC12; Fri, 22 Jun 2012 19:19:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MJJwEl095727; Fri, 22 Jun 2012 19:19:58 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MJJwGg095725; Fri, 22 Jun 2012 19:19:58 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201206221919.q5MJJwGg095725@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 22 Jun 2012 19:19:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237455 - stable/9/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 19:19:59 -0000 Author: gnn Date: Fri Jun 22 19:19:58 2012 New Revision: 237455 URL: http://svn.freebsd.org/changeset/base/237455 Log: MFC: 234424 Set SIGCANCEL to SIGTHR as part of some cleanup of DTrace code. Reviewed by: davidxu@ Modified: stable/9/lib/libthr/thread/thr_private.h Directory Properties: stable/9/lib/libthr/ (props changed) Modified: stable/9/lib/libthr/thread/thr_private.h ============================================================================== --- stable/9/lib/libthr/thread/thr_private.h Fri Jun 22 19:19:53 2012 (r237454) +++ stable/9/lib/libthr/thread/thr_private.h Fri Jun 22 19:19:58 2012 (r237455) @@ -80,7 +80,7 @@ typedef TAILQ_HEAD(atfork_head, pthread_ TAILQ_HEAD(mutex_queue, pthread_mutex); /* Signal to do cancellation */ -#define SIGCANCEL 32 +#define SIGCANCEL SIGTHR /* * Kernel fatal error handler macro. From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 19:48:39 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55B77106567E; Fri, 22 Jun 2012 19:48:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 359F58FC0A; Fri, 22 Jun 2012 19:48:39 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5MJmdT4019092; Fri, 22 Jun 2012 19:48:39 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q5MJmcjL019090; Fri, 22 Jun 2012 19:48:38 GMT (envelope-from bapt@FreeBSD.org) X-Authentication-Warning: freefall.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f Date: Fri, 22 Jun 2012 21:48:35 +0200 From: Baptiste Daroussin To: "Pedro F. Giffuni" Message-ID: <20120622194835.GE83730@ithaqua.etoilebsd.net> References: <201206221801.q5MI1NxN092238@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="G6nVm6DDWH/FONJq" Content-Disposition: inline In-Reply-To: <201206221801.q5MI1NxN092238@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237448 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 19:48:39 -0000 --G6nVm6DDWH/FONJq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 22, 2012 at 06:01:23PM +0000, Pedro F. Giffuni wrote: > Author: pfg > Date: Fri Jun 22 18:01:22 2012 > New Revision: 237448 > URL: http://svn.freebsd.org/changeset/base/237448 >=20 > Log: > Merge changes from upstream libedit. > =20 > Our libedit has been diverging from the mainstream version > maintained in NetBSD. As a consequence it has been difficult > to do an appropriate MFV and we have been bringing only > partial updates. > =20 > Here we update most of the files to at least match the > version available in NetBSD's snapshot of 20091228. This > version was chosen because it still doesn't include wide > character support (UTF-8), which involves many changes and > new files. > =20 > From NetBSD's logs: > =20 > Dec 15 22:13:33 2006 - editline.3 el.c el.h histedit.h > add EL_GETFP, and EL_SETFP. > =20 > Apr 5 15:53:28 2008 - editline.3 el.c histedit.h readline.c > add EL_REFRESH for the benefit of readline > =20 > Sep 10 15:45:37 2008 - common.c el.c read.c refresh.c sig.c term.c term= =2Eh tty.c > Allow a single process to control multiple ttys (for pthreads using _RE= ENTRANT) > using multiple EditLine objects. > =20 > Jan 18 12:17:24 2009 - el.c read.c readline.c > fix -Wsign-compare issues > =20 > Feb 6 14:40:32 2009 - history.c > Plug memory leak, from MySQL. > =20 > Feb 5 19:15:44 2009 - histedit.h read.c > match documentation in el_push > =20 > Feb 6 13:14:37 2009 - vi.c > Portability fix. > =20 > Feb 12 13:39:49 2009 - readline.c term.c > More fixes for existing portability stuff. > =20 > Feb 15 21:24:13 2009 - el.h read.c > don't restart on EINTR, instead return NULL immediately. From Anon Ymous > =20 > Feb 15 21:25:01 2009 - sig.c sig.h > in order for read() to return EINTR we need to use sigaction, not signa= l, > otherwise SA_RESTART is set. > =20 > Feb 15 21:55:23 2009 - chared.c chared.h common.c emacs.c filecomplete.c > filecomplete.h key.c key.h read.c readline.c refresh.c search.c > term.c tokenizer.c tty.c vi.c > pass lint on _LP64. > =20 > Feb 17 21:34:26 2009 - el.c histedit.h prompt.c prompt.h > allow for a prompt argument. > =20 > Feb 18 15:04:40 2009 - sig.c > SA_RESTART for all signals but SIGINT. From Anon Ymous. > =20 > Feb 19 15:20:22 2009 - read.c sig.c sig.h > reset and redraw on sigcont. From Anon Ymous. > =20 > Feb 21 23:31:56 2009 - key.c key.h readline.c vi.c > more size_t stuff. > =20 > Mar 10 20:46:15 2009 - editline.3 read.c > make el_gets set the count to -1 on error to distinguish between EOF and > error. > =20 > Mar 31 17:38:27 2009 - editline.3 el.c histedit.h prompt.c prompt.h > refresh.c term.c term.h > Implement literal prompt sequences. Now someone can implement > RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-) > =20 > Mar 31 21:33:17 2009 - term.c > cast to size_t to avoid sign / unsigned comparison warning. > =20 > Apr 23 02:03 2009 - term.c > Apply patch (requested by msaitoh in ticket #2007): > Coverity CID 1668: Plug memory leak when malloc() failed.:55 2009 > =20 > May 11 18:33:30 2009 - editline.3 el.c histedit.h > restore binary compatibility by providing new prompt functions that take > an extra literal character. > =20 > May 19 21:45:14 2009 - refresh.c > always scroll when we advance past bottom. From Caleb Welton > cwelton at greenplum dot com. > =20 > Jul 17 12:27:57 2009 - term.c > - off by one in the term.h case. > - make code more similar to tcsh (if we want to handle wide chars, this= is > needed; for now it is a no-op) > =20 > Jul 22 15:56:29 2009 - el.c > Move filename to the scope it is being used. > From Michael Cook mcook at bbn dot com > =20 > Jul 22 15:57:00 2009 - read.c > Always initialize nread since it is an out param. > From Michael Cook mcook at bbn dot com > =20 > Jul 22 18:25:26 2009 - el.c > Only need path if we have issetugid... From Anon Ymous > =20 > Jul 25 21:19:23 2009 - el.c > Ignore comment lines in .editrc from Jess Thrysoee > =20 > Sep 7 21:24:33 2009 > histedit.h history.c readline.c > apply apple patches from: > http://opensource.apple.com/source/libedit/libedit-11/patches/ > =20 > Dec 28 21:52:43 2009 - refresh.c > Fix bug where tab completion on the second or > line that caused listing > ended up corrupting the display by an extra space in the beginning. Rep= orted > by Mac Chan. > =20 > Dec 28 22:15:36 2009 - refresh.c term.c > reduce diff with tcsh > =20 > Obtained from: NetBSD > Tested by: bapt, jilles and current@ > MFC after: 1 week >=20 > Modified: > head/lib/libedit/common.c > head/lib/libedit/editline.3 > head/lib/libedit/editrc.5 > head/lib/libedit/el.c > head/lib/libedit/el.h > head/lib/libedit/histedit.h > head/lib/libedit/history.c > head/lib/libedit/key.c > head/lib/libedit/key.h > head/lib/libedit/prompt.c > head/lib/libedit/prompt.h > head/lib/libedit/read.c > head/lib/libedit/refresh.c > head/lib/libedit/search.c > head/lib/libedit/sig.c > head/lib/libedit/sig.h > head/lib/libedit/term.c > head/lib/libedit/term.h > head/lib/libedit/tty.c > head/lib/libedit/vi.c >=20 > Modified: head/lib/libedit/common.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/common.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/common.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -905,7 +905,7 @@ ed_command(EditLine *el, int c __unused) > int tmplen; > =20 > tmplen =3D c_gets(el, tmpbuf, "\n: "); > - term__putc('\n'); > + term__putc(el, '\n'); > =20 > if (tmplen < 0 || (tmpbuf[tmplen] =3D 0, parse_line(el, tmpbuf)) =3D=3D= -1) > term_beep(el); >=20 > Modified: head/lib/libedit/editline.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/editline.3 Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/editline.3 Fri Jun 22 18:01:22 2012 (r237448) > @@ -1,4 +1,4 @@ > -.\" $NetBSD: editline.3,v 1.55 2007/01/12 16:31:13 christos Exp $ > +.\" $NetBSD: editline.3,v 1.70 2009/07/05 21:55:24 perry Exp $ > .\" > .\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc. > .\" All rights reserved. > @@ -28,7 +28,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 12, 2007 > +.Dd July 5, 2009 > .Dt EDITLINE 3 > .Os > .Sh NAME > @@ -162,6 +162,14 @@ is modified to contain the number of cha > Returns the line read if successful, or > .Dv NULL > if no characters were read or if an error occurred. > +If an error occurred, > +.Fa count > +is set to \-1 and > +.Dv errno > +contains the error code that caused it. > +The return value may not remain valid across calls to > +.Fn el_gets > +and must be copied if the data is to be retained. > .It Fn el_getc > Read a character from the tty. > .Fa ch > @@ -222,10 +230,30 @@ are supported, along with the required a > Define prompt printing function as > .Fa f , > which is to return a string that contains the prompt. > +.It Dv EL_PROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" > +Same as > +.Dv EL_PROMPT , > +but the > +.Fa c > +argument indicates the start/stop literal prompt character. > +.Pp > +If a start/stop literal character is found in the prompt, the > +character itself > +is not printed, but characters after it are printed directly to the > +terminal without affecting the state of the current line. > +A subsequent second start/stop literal character ends this behavior. > +This is typically used to embed literal escape sequences that change the > +color/style of the terminal in the prompt. > +.Dv 0 > +unsets it. > +.It Dv EL_REFRESH > +Re-display the current line on the next terminal line. > .It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" > Define right side prompt printing function as > .Fa f , > which is to return a string that contains the prompt. > +.It Dv EL_RPROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" > +Define the right prompt printing function but with a literal escape char= acter. > .It Dv EL_TERMINAL , Fa "const char *type" > Define terminal type of the tty to be > .Fa type , > @@ -259,66 +287,43 @@ reading command input: > and > .Dv SIGWINCH . > Otherwise, the current signal handlers will be used. > -.It Dv EL_BIND , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_BIND , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic bind > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_ECHOTC , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_ECHOTC , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic echotc > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_SETTC , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_SETTC , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic settc > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_SETTY , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_SETTY , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic setty > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_TELLTC , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_TELLTC , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic telltc > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_ADDFN , Xo > -.Fa "const char *name" , > -.Fa "const char *help" , > -.Fa "unsigned char (*func)(EditLine *e, int ch)" > -.Xc > +.It Dv EL_ADDFN , Fa "const char *name" , Fa "const char *help" , \ > +Fa "unsigned char (*func)(EditLine *e, int ch)" > Add a user defined function, > .Fn func , > referred to as > @@ -360,10 +365,8 @@ Beep, and flush tty. > .It Dv CC_FATAL > Fatal error, reset tty to known state. > .El > -.It Dv EL_HIST , Xo > -.Fa "History *(*func)(History *, int op, ...)" , > -.Fa "const char *ptr" > -.Xc > +.It Dv EL_HIST , Fa "History *(*func)(History *, int op, ...)" , \ > +Fa "const char *ptr" > Defines which history function to use, which is usually > .Fn history . > .Fa ptr > @@ -435,10 +438,22 @@ The following values for > are supported, along with actual type of > .Fa result : > .Bl -tag -width 4n > -.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" > -Return a pointer to the function that displays the prompt. > -.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" > -Return a pointer to the function that displays the rightside prompt. > +.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c" > +Return a pointer to the function that displays the prompt in > +.Fa f . > +If > +.Fa c > +is not > +.Dv NULL , > +return the start/stop literal prompt character in it. > +.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c" > +Return a pointer to the function that displays the prompt in > +.Fa f . > +If > +.Fa c > +is not > +.Dv NULL , > +return the start/stop literal prompt character in it. > .It Dv EL_EDITOR , Fa "const char *" > Return the name of the editor, which will be one of > .Dq emacs > @@ -603,18 +618,11 @@ assumed to be created with > .Fn history_init . > .It Dv H_CLEAR > Clear the history. > -.It Dv H_FUNC , Xo > -.Fa "void *ptr" , > -.Fa "history_gfun_t first" , > -.Fa "history_gfun_t next" , > -.Fa "history_gfun_t last" , > -.Fa "history_gfun_t prev" , > -.Fa "history_gfun_t curr" , > -.Fa "history_sfun_t set" , > -.Fa "history_vfun_t clear" , > -.Fa "history_efun_t enter" , > -.Fa "history_efun_t add" > -.Xc > +.It Dv H_FUNC , Fa "void *ptr" , Fa "history_gfun_t first" , \ > +Fa "history_gfun_t next" , Fa "history_gfun_t last" , \ > +Fa "history_gfun_t prev" , Fa "history_gfun_t curr" , \ > +Fa "history_sfun_t set" , Fa "history_vfun_t clear" , \ > +Fa "history_efun_t enter" , Fa "history_efun_t add" > Define functions to perform various history operations. > .Fa ptr > is the argument given to a function when it is invoked. >=20 > Modified: head/lib/libedit/editrc.5 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/editrc.5 Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/editrc.5 Fri Jun 22 18:01:22 2012 (r237448) > @@ -1,4 +1,4 @@ > -.\" $NetBSD: editrc.5,v 1.20 2006/08/21 12:45:30 christos Exp $ > +.\" $NetBSD: editrc.5,v 1.24 2009/04/11 22:17:52 wiz Exp $ > .\" > .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc. > .\" All rights reserved. > @@ -89,16 +89,8 @@ shell. > .Pp > The following builtin commands are available: > .Bl -tag -width 4n > -.It Ic bind Xo > -.Op Fl a > -.Op Fl e > -.Op Fl k > -.Op Fl l > -.Op Fl r > -.Op Fl s > -.Op Fl v > -.Op Ar key Op Ar command > -.Xc > +.It Ic bind Oo Fl a Oc Oo Fl e Oc Oo Fl k Oc Oo Fl l Oc Oo Fl r Oc \ > +Oo Fl s Oc Oo Fl v Oc Oo Ar key Op Ar command Oc > Without options, list all bound keys, and the editor command to which > each is bound. > If > @@ -192,11 +184,7 @@ if it has any, notably > .Sq \e > and > .Sq ^ . > -.It Ic echotc Xo > -.Op Fl sv > -.Ar arg > -.Ar ... > -.Xc > +.It Ic echotc Oo Fl sv Oc Ar arg Ar ... > Exercise terminal capabilities given in > .Ar arg Ar ... . > If > @@ -252,16 +240,8 @@ to > as defined in > .Xr termcap 5 . > No sanity checking is done. > -.It Ic setty Xo > -.Op Fl a > -.Op Fl d > -.Op Fl q > -.Op Fl x > -.Op Ar +mode > -.Op Ar -mode > -.Op Ar mode > -.Op Ar char=3Dc > -.Xc > +.It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ar +mode Oc \ > +Oo Ar -mode Oc Oo Ar mode Oc Oo Ar char=3Dc Oc > Control which tty modes that > .Nm > will not allow the user to change. >=20 > Modified: head/lib/libedit/el.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/el.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/el.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -29,7 +29,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * > - * $NetBSD: el.c,v 1.44 2006/12/15 22:13:33 christos Exp $ > + * $NetBSD: el.c,v 1.55 2009/07/25 21:19:23 christos Exp $ > */ > =20 > #if !defined(lint) && !defined(SCCSID) > @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include "el.h" > =20 > #define HAVE_ISSETUGID > @@ -156,9 +157,21 @@ el_set(EditLine *el, int op, ...) > =20 > switch (op) { > case EL_PROMPT: > - case EL_RPROMPT: > - rv =3D prompt_set(el, va_arg(ap, el_pfunc_t), op); > + case EL_RPROMPT: { > + el_pfunc_t p =3D va_arg(ap, el_pfunc_t); > + > + rv =3D prompt_set(el, p, 0, op); > break; > + } > + > + case EL_PROMPT_ESC: > + case EL_RPROMPT_ESC: { > + el_pfunc_t p =3D va_arg(ap, el_pfunc_t); > + char c =3D va_arg(ap, int); > + > + rv =3D prompt_set(el, p, c, op); > + break; > + } > =20 > case EL_TERMINAL: > rv =3D term_set(el, va_arg(ap, char *)); > @@ -309,6 +322,12 @@ el_set(EditLine *el, int op, ...) > break; > } > =20 > + case EL_REFRESH: > + re_clear_display(el); > + re_refresh(el); > + term__flush(el); > + break; > + > default: > rv =3D -1; > break; > @@ -335,9 +354,13 @@ el_get(EditLine *el, int op, ...) > =20 > switch (op) { > case EL_PROMPT: > - case EL_RPROMPT: > - rv =3D prompt_get(el, va_arg(ap, el_pfunc_t *), op); > + case EL_RPROMPT: { > + el_pfunc_t *p =3D va_arg(ap, el_pfunc_t *); > + char *c =3D va_arg(ap, char *); > + > + rv =3D prompt_get(el, p, c, op); > break; > + } > =20 > case EL_EDITOR: > rv =3D map_get_editor(el, va_arg(ap, const char **)); > @@ -364,7 +387,7 @@ el_get(EditLine *el, int op, ...) > char *argv[20]; > int i; > =20 > - for (i =3D 1; i < sizeof(argv) / sizeof(argv[0]); i++) > + for (i =3D 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++) > if ((argv[i] =3D va_arg(ap, char *)) =3D=3D NULL) > break; > =20 > @@ -495,12 +518,14 @@ el_source(EditLine *el, const char *fnam > FILE *fp; > size_t len; > char *ptr; > +#ifdef HAVE_ISSETUGID > + char path[MAXPATHLEN]; > +#endif > =20 > fp =3D NULL; > if (fname =3D=3D NULL) { > #ifdef HAVE_ISSETUGID > static const char elpath[] =3D "/.editrc"; > - char path[MAXPATHLEN]; > =20 > if (issetugid()) > return (-1); > @@ -529,6 +554,13 @@ el_source(EditLine *el, const char *fnam > if (len > 0 && ptr[len - 1] =3D=3D '\n') > --len; > ptr[len] =3D '\0'; > + > + /* loop until first non-space char or EOL */ > + while (*ptr !=3D '\0' && isspace((unsigned char)*ptr)) > + ptr++; > + if (*ptr =3D=3D '#') > + continue; /* ignore, this is a comment line */ > + > if (parse_line(el, ptr) =3D=3D -1) { > (void) fclose(fp); > return (-1); >=20 > Modified: head/lib/libedit/el.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/el.h Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/el.h Fri Jun 22 18:01:22 2012 (r237448) > @@ -115,6 +115,7 @@ struct editline { > FILE *el_errfile; /* Stdio stuff */ > int el_infd; /* Input file descriptor */ > int el_flags; /* Various flags. */ > + int el_errno; /* Local copy of errno */ > coord_t el_cursor; /* Cursor location */ > char **el_display; /* Real screen image =3D what is there */ > char **el_vdisplay; /* Virtual screen image =3D what we see */ >=20 > Modified: head/lib/libedit/histedit.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/histedit.h Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/histedit.h Fri Jun 22 18:01:22 2012 (r237448) > @@ -131,10 +131,10 @@ unsigned char _el_fn_sh_complete(EditLin > #define EL_GETCFN 13 /* , el_rfunc_t); */ > #define EL_CLIENTDATA 14 /* , void *); */ > #define EL_UNBUFFERED 15 /* , int); */ > -#define EL_PREP_TERM 16 /* , int); */ > +#define EL_PREP_TERM 16 /* , int); */ > #define EL_GETTC 17 /* , const char *, ..., NULL); */ > -#define EL_GETFP 18 /* , int, FILE **) */ > -#define EL_SETFP 19 /* , int, FILE *) */ > +#define EL_GETFP 18 /* , int, FILE **); */ > +#define EL_SETFP 19 /* , int, FILE *); */ > #define EL_REFRESH 20 /* , void); set */ > #define EL_PROMPT_ESC 21 /* , prompt_func, Char); set/get */ > #define EL_RPROMPT_ESC 22 /* , prompt_func, Char); set/get */ >=20 > Modified: head/lib/libedit/history.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/history.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/history.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -29,7 +29,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * > - * $NetBSD: history.c,v 1.32 2006/09/28 13:52:51 christos Exp $ > + * $NetBSD: history.c,v 1.34 2009/09/07 21:24:33 christos Exp $ > */ > =20 > #if !defined(lint) && !defined(SCCSID) > @@ -116,6 +116,7 @@ private int history_prev_string(History=20 > */ > typedef struct hentry_t { > HistEvent ev; /* What we return */ > + void *data; /* data */ > struct hentry_t *next; /* Next entry */ > struct hentry_t *prev; /* Previous entry */ > } hentry_t; > @@ -145,6 +146,9 @@ private int history_def_init(ptr_t *, Hi > private int history_def_insert(history_t *, HistEvent *, const char *); > private void history_def_delete(history_t *, HistEvent *, hentry_t *); > =20 > +private int history_deldata_nth(history_t *, HistEvent *, int, void **); > +private int history_set_nth(ptr_t, HistEvent *, int); > + > #define history_def_setsize(p, num)(void) (((history_t *)p)->max =3D (nu= m)) > #define history_def_getsize(p) (((history_t *)p)->cur) > #define history_def_getunique(p) (((((history_t *)p)->flags) & H_UNIQUE)= !=3D 0) > @@ -335,6 +339,31 @@ history_def_set(ptr_t p, HistEvent *ev,=20 > } > =20 > =20 > +/* history_set_nth(): > + * Default function to set the current event in the history to the > + * n-th one. > + */ > +private int > +history_set_nth(ptr_t p, HistEvent *ev, int n) > +{ > + history_t *h =3D (history_t *) p; > + > + if (h->cur =3D=3D 0) { > + he_seterrev(ev, _HE_EMPTY_LIST); > + return (-1); > + } > + for (h->cursor =3D h->list.prev; h->cursor !=3D &h->list; > + h->cursor =3D h->cursor->prev) > + if (n-- <=3D 0) > + break; > + if (h->cursor =3D=3D &h->list) { > + he_seterrev(ev, _HE_NOT_FOUND); > + return (-1); > + } > + return (0); > +} > + > + > /* history_def_add(): > * Append string to element > */ > @@ -363,6 +392,24 @@ history_def_add(ptr_t p, HistEvent *ev,=20 > } > =20 > =20 > +private int > +history_deldata_nth(history_t *h, HistEvent *ev, > + int num, void **data) > +{ > + if (history_set_nth(h, ev, num) !=3D 0) > + return (-1); > + /* magic value to skip delete (just set to n-th history) */ > + if (data =3D=3D (void **)-1) > + return (0); > + ev->str =3D strdup(h->cursor->ev.str); > + ev->num =3D h->cursor->ev.num; > + if (data) > + *data =3D h->cursor->data; > + history_def_delete(h, ev, h->cursor); > + return (0); > +} > + > + > /* history_def_del(): > * Delete element hp of the h list > */ > @@ -392,8 +439,11 @@ history_def_delete(history_t *h,=20 > HistEventPrivate *evp =3D (void *)&hp->ev; > if (hp =3D=3D &h->list) > abort(); > - if (h->cursor =3D=3D hp) > + if (h->cursor =3D=3D hp) { > h->cursor =3D hp->prev; > + if (h->cursor =3D=3D &h->list) > + h->cursor =3D hp->next; > + } > hp->prev->next =3D hp->next; > hp->next->prev =3D hp->prev; > h_free((ptr_t) evp->str); > @@ -416,6 +466,7 @@ history_def_insert(history_t *h, HistEve > h_free((ptr_t)h->cursor); > goto oomem; > } > + h->cursor->data =3D NULL; > h->cursor->ev.num =3D ++h->eventid; > h->cursor->next =3D h->list.next; > h->cursor->prev =3D &h->list; > @@ -711,8 +762,8 @@ history_load(History *h, const char *fna > (void) strunvis(ptr, line); > line[sz] =3D c; > if (HENTER(h, &ev, ptr) =3D=3D -1) { > - h_free((ptr_t)ptr); > - return -1; > + i =3D -1; > + goto oomem; > } > } > oomem: > @@ -787,6 +838,23 @@ history_prev_event(History *h, HistEvent > } > =20 > =20 > +private int > +history_next_evdata(History *h, HistEvent *ev, int num, void **d) > +{ > + int retval; > + > + for (retval =3D HCURR(h, ev); retval !=3D -1; retval =3D HPREV(h, ev)) > + if (num-- <=3D 0) { > + if (d) > + *d =3D ((history_t *)h->h_ref)->cursor->data; > + return (0); > + } > + > + he_seterrev(ev, _HE_NOT_FOUND); > + return (-1); > +} > + > + > /* history_next_event(): > * Find the next event, with number given > */ > @@ -976,11 +1044,42 @@ history(History *h, HistEvent *ev, int f > retval =3D 0; > break; > =20 > + case H_NEXT_EVDATA: > + { > + int num =3D va_arg(va, int); > + void **d =3D va_arg(va, void **); > + retval =3D history_next_evdata(h, ev, num, d); > + break; > + } > + > + case H_DELDATA: > + { > + int num =3D va_arg(va, int); > + void **d =3D va_arg(va, void **); > + retval =3D history_deldata_nth((history_t *)h->h_ref, ev, num, d); > + break; > + } > + > + case H_REPLACE: /* only use after H_NEXT_EVDATA */ > + { > + const char *line =3D va_arg(va, const char *); > + void *d =3D va_arg(va, void *); > + const char *s; > + if(!line || !(s =3D strdup(line))) { > + retval =3D -1; > + break; > + } > + ((history_t *)h->h_ref)->cursor->ev.str =3D s; > + ((history_t *)h->h_ref)->cursor->data =3D d; > + retval =3D 0; > + break; > + } > + > default: > retval =3D -1; > he_seterrev(ev, _HE_UNKNOWN); > break; > } > va_end(va); > - return (retval); > + return retval; > } >=20 > Modified: head/lib/libedit/key.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/key.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/key.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -29,7 +29,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * > - * $NetBSD: key.c,v 1.19 2006/03/23 20:22:51 christos Exp $ > + * $NetBSD: key.c,v 1.20 2009/02/15 21:55:23 christos Exp $ > */ > =20 > #if !defined(lint) && !defined(SCCSID) > @@ -86,8 +86,8 @@ private void node__free(key_node_t *); > private void node__put(EditLine *, key_node_t *); > private int node__delete(EditLine *, key_node_t **, const char *); > private int node_lookup(EditLine *, const char *, key_node_t *, > - int); > -private int node_enum(EditLine *, key_node_t *, int); > + size_t); > +private int node_enum(EditLine *, key_node_t *, size_t); > =20 > #define KEY_BUFSIZ EL_BUFSIZ > =20 > @@ -478,9 +478,9 @@ node__free(key_node_t *k) > * Print if last node > */ > private int > -node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt) > +node_lookup(EditLine *el, const char *str, key_node_t *ptr, size_t cnt) > { > - int ncnt; > + size_t ncnt; > =20 > if (ptr =3D=3D NULL) > return (-1); /* cannot have null ptr */ > @@ -493,7 +493,8 @@ node_lookup(EditLine *el, const char *st > /* If match put this char into el->el_key.buf. Recurse */ > if (ptr->ch =3D=3D *str) { > /* match found */ > - ncnt =3D key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt, > + ncnt =3D key__decode_char(el->el_key.buf, > + (size_t)KEY_BUFSIZ, cnt, > (unsigned char) ptr->ch); > if (ptr->next !=3D NULL) > /* not yet at leaf */ > @@ -527,9 +528,9 @@ node_lookup(EditLine *el, const char *st > * Traverse the node printing the characters it is bound in buffer > */ > private int > -node_enum(EditLine *el, key_node_t *ptr, int cnt) > +node_enum(EditLine *el, key_node_t *ptr, size_t cnt) > { > - int ncnt; > + size_t ncnt; > =20 > if (cnt >=3D KEY_BUFSIZ - 5) { /* buffer too small */ > el->el_key.buf[++cnt] =3D '"'; > @@ -547,7 +548,7 @@ node_enum(EditLine *el, key_node_t *ptr, > return (-1); > } > /* put this char at end of str */ > - ncnt =3D key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt, > + ncnt =3D key__decode_char(el->el_key.buf, (size_t)KEY_BUFSIZ, cnt, > (unsigned char)ptr->ch); > if (ptr->next =3D=3D NULL) { > /* print this key and function */ > @@ -615,8 +616,8 @@ key_kprint(EditLine *el, const char *key > /* key__decode_char(): > * Put a printable form of char in buf. > */ > -protected int > -key__decode_char(char *buf, int cnt, int off, int ch) > +protected size_t > +key__decode_char(char *buf, size_t cnt, size_t off, int ch) > { > char *sb =3D buf + off; > char *eb =3D buf + cnt; > @@ -626,7 +627,7 @@ key__decode_char(char *buf, int cnt, int > if (ch =3D=3D 0) { > ADDC('^'); > ADDC('@'); > - return b - sb; > + return (int)(b - sb); > } > if (iscntrl(ch)) { > ADDC('^'); > @@ -648,15 +649,15 @@ key__decode_char(char *buf, int cnt, int > ADDC((((unsigned int) ch >> 3) & 7) + '0'); > ADDC((ch & 7) + '0'); > } > - return b - sb; > + return (size_t)(b - sb); > } > =20 > =20 > /* key__decode_str(): > * Make a printable version of the ey > */ > -protected int > -key__decode_str(const char *str, char *buf, int len, const char *sep) > +protected size_t > +key__decode_str(const char *str, char *buf, size_t len, const char *sep) > { > char *b =3D buf, *eb =3D b + len; > const char *p; > @@ -699,7 +700,7 @@ key__decode_str(const char *str, char *b > } > done: > ADDC('\0'); > - if (b - buf >=3D len) > + if ((size_t)(b - buf) >=3D len) > buf[len - 1] =3D '\0'; > - return b - buf; > + return (size_t)(b - buf); > } >=20 > Modified: head/lib/libedit/key.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/key.h Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/key.h Fri Jun 22 18:01:22 2012 (r237448) > @@ -76,8 +76,8 @@ protected int key_delete(EditLine *, c > protected void key_print(EditLine *, const char *); > protected void key_kprint(EditLine *, const char *, key_value_t= *, > int); > -protected int key__decode_str(const char *, char *, int, > +protected size_t key__decode_str(const char *, char *, size_t, > const char *); > -protected int key__decode_char(char *, int, int, int); > +protected size_t key__decode_char(char *, size_t, size_t, int); > =20 > #endif /* _h_el_key */ >=20 > Modified: head/lib/libedit/prompt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/prompt.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/prompt.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -85,14 +85,23 @@ prompt_print(EditLine *el, int op) > { > el_prompt_t *elp; > char *p; > + int ignore =3D 0; > =20 > if (op =3D=3D EL_PROMPT) > elp =3D &el->el_prompt; > else > elp =3D &el->el_rprompt; > - p =3D (elp->p_func) (el); > - while (*p) > - re_putc(el, *p++, 1); > + > + for (p =3D (*elp->p_func)(el); *p; p++) { > + if (elp->p_ignore =3D=3D *p) { > + ignore =3D !ignore; > + continue; > + } > + if (ignore) > + term__putc(el, *p); > + else > + re_putc(el, *p, 1); > + } > =20 > elp->p_pos.v =3D el->el_refresh.r_cursor.v; > elp->p_pos.h =3D el->el_refresh.r_cursor.h; > @@ -109,10 +118,12 @@ prompt_init(EditLine *el) > el->el_prompt.p_func =3D prompt_default; > el->el_prompt.p_pos.v =3D 0; > el->el_prompt.p_pos.h =3D 0; > + el->el_prompt.p_ignore =3D '\0'; > el->el_rprompt.p_func =3D prompt_default_r; > el->el_rprompt.p_pos.v =3D 0; > el->el_rprompt.p_pos.h =3D 0; > - return (0); > + el->el_rprompt.p_ignore =3D '\0'; > + return 0; > } > =20 > =20 > @@ -130,24 +141,29 @@ prompt_end(EditLine *el __unused) > * Install a prompt printing function > */ > protected int > -prompt_set(EditLine *el, el_pfunc_t prf, int op) > +prompt_set(EditLine *el, el_pfunc_t prf, char c, int op) > { > el_prompt_t *p; > =20 > - if (op =3D=3D EL_PROMPT) > + if (op =3D=3D EL_PROMPT || op =3D=3D EL_PROMPT_ESC) > p =3D &el->el_prompt; > else > p =3D &el->el_rprompt; > + > if (prf =3D=3D NULL) { > - if (op =3D=3D EL_PROMPT) > + if (op =3D=3D EL_PROMPT || op =3D=3D EL_PROMPT_ESC) > p->p_func =3D prompt_default; > else > p->p_func =3D prompt_default_r; > } else > p->p_func =3D prf; > + > + p->p_ignore =3D c; > + > p->p_pos.v =3D 0; > p->p_pos.h =3D 0; > - return (0); > + > + return 0; > } > =20 > =20 > @@ -155,14 +171,22 @@ prompt_set(EditLine *el, el_pfunc_t prf, > * Retrieve the prompt printing function > */ > protected int > -prompt_get(EditLine *el, el_pfunc_t *prf, int op) > +prompt_get(EditLine *el, el_pfunc_t *prf, char *c, int op) > { > + el_prompt_t *p; > =20 > if (prf =3D=3D NULL) > - return (-1); > + return -1; > + > if (op =3D=3D EL_PROMPT) > - *prf =3D el->el_prompt.p_func; > + p =3D &el->el_prompt; > else > - *prf =3D el->el_rprompt.p_func; > - return (0); > + p =3D &el->el_rprompt; > + > + *prf =3D el->el_rprompt.p_func; > + > + if (c) > + *c =3D p->p_ignore; > + > + return 0; > } >=20 > Modified: head/lib/libedit/prompt.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/prompt.h Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/prompt.h Fri Jun 22 18:01:22 2012 (r237448) > @@ -47,11 +47,13 @@ typedef char * (*el_pfunc_t)(EditLine*); > typedef struct el_prompt_t { > el_pfunc_t p_func; /* Function to return the prompt */ > coord_t p_pos; /* position in the line after prompt */ > + char p_ignore; /* character to start/end literal=20 > +*/ > } el_prompt_t; > =20 > protected void prompt_print(EditLine *, int); > -protected int prompt_set(EditLine *, el_pfunc_t, int); > -protected int prompt_get(EditLine *, el_pfunc_t *, int); > +protected int prompt_set(EditLine *, el_pfunc_t, char, int); > +protected int prompt_get(EditLine *, el_pfunc_t *, char *, int); > protected int prompt_init(EditLine *); > protected void prompt_end(EditLine *); > =20 >=20 > Modified: head/lib/libedit/read.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/read.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/read.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -29,7 +29,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * > - * $NetBSD: read.c,v 1.40 2007/03/01 21:41:45 christos Exp $ > + * $NetBSD: read.c,v 1.52 2009/07/22 15:57:00 christos Exp $ > */ > =20 > #if !defined(lint) && !defined(SCCSID) > @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); > #include > #include "el.h" > =20 > -#define OKCMD -1 > +#define OKCMD -1 /* must be -1! */ > =20 > private int read__fixio(int, int); > private int read_preread(EditLine *); > @@ -170,7 +170,7 @@ read__fixio(int fd __unused, int e) > return (e ? 0 : -1); > =20 > case EINTR: > - return (0); > + return (-1); > =20 > default: > return (-1); > @@ -222,7 +222,7 @@ el_push(EditLine *el, const char *str) > ma->level--; > } > term_beep(el); > - term__flush(); > + term__flush(el); > } > =20 > =20 > @@ -235,9 +235,12 @@ read_getcmd(EditLine *el, el_action_t *c > el_action_t cmd; > int num; > =20 > + el->el_errno =3D 0; > do { > - if ((num =3D el_getc(el, ch)) !=3D 1) /* if EOF or error */ > + if ((num =3D el_getc(el, ch)) !=3D 1) { /* if EOF or error */ > + el->el_errno =3D num =3D=3D 0 ? 0 : errno; > return (num); > + } > =20 > #ifdef KANJI > if ((*ch & 0200)) { > @@ -286,18 +289,25 @@ read_getcmd(EditLine *el, el_action_t *c > private int > read_char(EditLine *el, char *cp) > { > - int num_read; > + ssize_t num_read; > int tried =3D 0; > =20 > - while ((num_read =3D read(el->el_infd, cp, 1)) =3D=3D -1) > + again: > + el->el_signal->sig_no =3D 0; > + while ((num_read =3D read(el->el_infd, cp, 1)) =3D=3D -1) { > + if (el->el_signal->sig_no =3D=3D SIGCONT) { > + sig_set(el); > + el_set(el, EL_REFRESH); > + goto again; > + } > if (!tried && read__fixio(el->el_infd, errno) =3D=3D 0) > tried =3D 1; > else { > *cp =3D '\0'; > return (-1); > } > - > - return (num_read); > + } > + return (int)num_read; > } > =20 > /* read_pop(): > @@ -309,8 +319,9 @@ read_pop(c_macro_t *ma) > int i; > =20 > el_free(ma->macro[0]); > - for (i =3D ma->level--; i > 0; i--) > - ma->macro[i - 1] =3D ma->macro[i]; > + for (i =3D 0; i < ma->level; i++) > + ma->macro[i] =3D ma->macro[i + 1]; > + ma->level--; > ma->offset =3D 0; > } > =20 > @@ -323,7 +334,7 @@ el_getc(EditLine *el, char *cp) > int num_read; > c_macro_t *ma =3D &el->el_chared.c_macro; > =20 > - term__flush(); > + term__flush(el); > for (;;) { > if (ma->level < 0) { > if (!read_preread(el)) > @@ -382,7 +393,7 @@ read_prepare(EditLine *el) > re_refresh(el); /* print the prompt */ > =20 > if (el->el_flags & UNBUFFERED) > - term__flush(); > + term__flush(el); > } > =20 > protected void > @@ -402,15 +413,20 @@ el_gets(EditLine *el, int *nread) > int num; /* how many chars we have read at NL */ > char ch; > int crlf =3D 0; > + int nrb; > #ifdef FIONREAD > c_macro_t *ma =3D &el->el_chared.c_macro; > #endif /* FIONREAD */ > =20 > + if (nread =3D=3D NULL) > + nread =3D &nrb; > + *nread =3D 0; > + > if (el->el_flags & NO_TTY) { > char *cp =3D el->el_line.buffer; > size_t idx; > =20 > - while ((*el->el_read.read_char)(el, cp) =3D=3D 1) { > + while ((num =3D (*el->el_read.read_char)(el, cp)) =3D=3D 1) { > /* make sure there is space for next character */ > if (cp + 1 >=3D el->el_line.limit) { > idx =3D (cp - el->el_line.buffer); > @@ -424,12 +440,16 @@ el_gets(EditLine *el, int *nread) > if (cp[-1] =3D=3D '\r' || cp[-1] =3D=3D '\n') > break; > } > + if (num =3D=3D -1) { > + if (errno =3D=3D EINTR) > + cp =3D el->el_line.buffer; > + el->el_errno =3D errno; > + } > =20 > el->el_line.cursor =3D el->el_line.lastchar =3D cp; > *cp =3D '\0'; > - if (nread) > - *nread =3D el->el_line.cursor - el->el_line.buffer; > - return (el->el_line.buffer); > + *nread =3D (int)(el->el_line.cursor - el->el_line.buffer); > + goto done; > } > =20 > =20 > @@ -440,8 +460,8 @@ el_gets(EditLine *el, int *nread) > (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Thanks you for this work !! regards, Bapt --G6nVm6DDWH/FONJq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/kzBMACgkQ8kTtMUmk6EyyAACffsLhGWZ9evLdTHAsKhIO3gDU xUAAnRKAKSX84WuXvcMJ1V/naFEEZ36e =QL50 -----END PGP SIGNATURE----- --G6nVm6DDWH/FONJq-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 20:29:08 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id CDDC2106564A; Fri, 22 Jun 2012 20:29:08 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 42AB8151DCA; Fri, 22 Jun 2012 20:29:08 +0000 (UTC) Message-ID: <4FE4D593.4040907@FreeBSD.org> Date: Fri, 22 Jun 2012 13:29:07 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120621 Thunderbird/13.0.1 MIME-Version: 1.0 To: Baptiste Daroussin References: <201206221801.q5MI1NxN092238@svn.freebsd.org> <20120622194835.GE83730@ithaqua.etoilebsd.net> In-Reply-To: <20120622194835.GE83730@ithaqua.etoilebsd.net> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, "Pedro F. Giffuni" , src-committers@FreeBSD.org Subject: Re: svn commit: r237448 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 20:29:08 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 As a general rule, please trim out replies. This list is worse than most in the sense that people often reply to hundreds of lines only to add a line or 2 at the bottom. By trimming your reply you both save electrons, and make it easier for people to see what you have to say. Doug -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJP5NWTAAoJEFzGhvEaGryEpVsH/3I60AiJ6JODDA9mx+ufW9LG SAr/p13YGlswZxL5LOLCLOvwjNrvK6CJieb42XI+70PYkGAGH8syKunTy9s4EPuQ 2wXWHw4jlJaUfMTOFsXOvoZIFTrH0YPRt3qZic4TdfuxWlEkqrk4G37+lVNMhdsW 0MLJD/eJC5rV3Ve/YMKB2OSPK47mukOmY0spFXG/N2NQRryOuV8N3D6ycbWGDn7q YJwpO98YxbbyxLEV394rGwVCK8T6taJXRBOLMu9VFR0L7321TPuayPc3cLg+0hQC owr6vN2ga0uD7vjhoKbApBTTHzWAGYVWN1LU+rpE0/b5QGZByq2Muiz5SARBncI= =cYw2 -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 20:38:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A5FA106564A; Fri, 22 Jun 2012 20:38:01 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E91B08FC15; Fri, 22 Jun 2012 20:38:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MKc0IO099048; Fri, 22 Jun 2012 20:38:00 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MKc0T7099046; Fri, 22 Jun 2012 20:38:00 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206222038.q5MKc0T7099046@svn.freebsd.org> From: Martin Matuska Date: Fri, 22 Jun 2012 20:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237456 - stable/9/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 20:38:01 -0000 Author: mm Date: Fri Jun 22 20:38:00 2012 New Revision: 237456 URL: http://svn.freebsd.org/changeset/base/237456 Log: MFC r237119: Do not remount ZFS dataset if changing canmount property to "on" and dataset is already mounted. PR: 167905 Submitted by: Bryan Drewery Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jun 22 19:19:58 2012 (r237455) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jun 22 20:38:00 2012 (r237456) @@ -1485,11 +1485,13 @@ zfs_prop_set(zfs_handle_t *zhp, const ch /* * If the dataset's canmount property is being set to noauto, + * or being set to on and the dataset is already mounted, * then we want to prevent unmounting & remounting it. */ do_prefix = !((prop == ZFS_PROP_CANMOUNT) && (zprop_string_to_index(prop, propval, &idx, - ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO)); + ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO || + (idx == ZFS_CANMOUNT_ON && zfs_is_mounted(zhp, NULL)))); if (do_prefix && (ret = changelist_prefix(cl)) != 0) goto error; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 20:38:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA6131065787; Fri, 22 Jun 2012 20:38:09 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E3CE8FC0C; Fri, 22 Jun 2012 20:38:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MKc9VF099095; Fri, 22 Jun 2012 20:38:09 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MKc9Jp099093; Fri, 22 Jun 2012 20:38:09 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206222038.q5MKc9Jp099093@svn.freebsd.org> From: Martin Matuska Date: Fri, 22 Jun 2012 20:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237457 - stable/8/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 20:38:09 -0000 Author: mm Date: Fri Jun 22 20:38:08 2012 New Revision: 237457 URL: http://svn.freebsd.org/changeset/base/237457 Log: MFC r237119: Do not remount ZFS dataset if changing canmount property to "on" and dataset is already mounted. PR: 167905 Submitted by: Bryan Drewery Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jun 22 20:38:00 2012 (r237456) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jun 22 20:38:08 2012 (r237457) @@ -1485,11 +1485,13 @@ zfs_prop_set(zfs_handle_t *zhp, const ch /* * If the dataset's canmount property is being set to noauto, + * or being set to on and the dataset is already mounted, * then we want to prevent unmounting & remounting it. */ do_prefix = !((prop == ZFS_PROP_CANMOUNT) && (zprop_string_to_index(prop, propval, &idx, - ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO)); + ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO || + (idx == ZFS_CANMOUNT_ON && zfs_is_mounted(zhp, NULL)))); if (do_prefix && (ret = changelist_prefix(cl)) != 0) goto error; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 20:42:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 021B8106564A; Fri, 22 Jun 2012 20:42:12 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E192F8FC12; Fri, 22 Jun 2012 20:42:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MKgBtk099298; Fri, 22 Jun 2012 20:42:11 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MKgBvR099296; Fri, 22 Jun 2012 20:42:11 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206222042.q5MKgBvR099296@svn.freebsd.org> From: Martin Matuska Date: Fri, 22 Jun 2012 20:42:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237458 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 20:42:12 -0000 Author: mm Date: Fri Jun 22 20:42:11 2012 New Revision: 237458 URL: http://svn.freebsd.org/changeset/base/237458 Log: Import Illumos revision 13736:9f1d48e1681f 2901 ZFS receive fails for exabyte sparse files References: https://www.illumos.org/issues/2901 Obtained from: illumos (issue #2901) MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Jun 22 20:38:08 2012 (r237457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Jun 22 20:42:11 2012 (r237458) @@ -93,6 +93,9 @@ dump_free(dmu_sendarg_t *dsp, uint64_t o { struct drr_free *drrf = &(dsp->dsa_drr->drr_u.drr_free); + if (length != -1ULL && offset + length < offset) + length = -1ULL; + /* * If there is a pending op, but it's not PENDING_FREE, push it out, * since free block aggregation can only be done for blocks of the From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 21:26:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9AFD5106566B; Fri, 22 Jun 2012 21:26:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 868298FC08; Fri, 22 Jun 2012 21:26:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MLQZPu001261; Fri, 22 Jun 2012 21:26:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MLQZtv001259; Fri, 22 Jun 2012 21:26:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206222126.q5MLQZtv001259@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 22 Jun 2012 21:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237459 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 21:26:35 -0000 Author: bz Date: Fri Jun 22 21:26:35 2012 New Revision: 237459 URL: http://svn.freebsd.org/changeset/base/237459 Log: Just add a comment to further investigate when being closer to that code again next time. The condition of the 2nd if() is very unlikely ever met. Modified: head/sys/netinet6/in6_src.c Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Fri Jun 22 20:42:11 2012 (r237458) +++ head/sys/netinet6/in6_src.c Fri Jun 22 21:26:35 2012 (r237459) @@ -597,6 +597,7 @@ selectroute(struct sockaddr_in6 *dstsock if (ron->ro_rt == NULL) { in6_rtalloc(ron, fibnum); /* multi path case? */ if (ron->ro_rt == NULL) { + /* XXX-BZ WT.? */ if (ron->ro_rt) { RTFREE(ron->ro_rt); ron->ro_rt = NULL; From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 21:46:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C07E11065673; Fri, 22 Jun 2012 21:46:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB5718FC12; Fri, 22 Jun 2012 21:46:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MLkgHq002120; Fri, 22 Jun 2012 21:46:42 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MLkgvI002118; Fri, 22 Jun 2012 21:46:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206222146.q5MLkgvI002118@svn.freebsd.org> From: Alexander Motin Date: Fri, 22 Jun 2012 21:46:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237460 - head/sys/dev/twa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 21:46:42 -0000 Author: mav Date: Fri Jun 22 21:46:41 2012 New Revision: 237460 URL: http://svn.freebsd.org/changeset/base/237460 Log: Return CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE instead of CAM_TID_INVALID and CAM_LUN_INVALID for case of missing devices. In removes tons of error messages from CAM during bus scans. Reported and tested by: Mike Tancsa MFC after: 3 days Modified: head/sys/dev/twa/tw_osl_cam.c Modified: head/sys/dev/twa/tw_osl_cam.c ============================================================================== --- head/sys/dev/twa/tw_osl_cam.c Fri Jun 22 21:26:35 2012 (r237459) +++ head/sys/dev/twa/tw_osl_cam.c Fri Jun 22 21:46:41 2012 (r237460) @@ -678,9 +678,9 @@ tw_osl_complete_io(struct tw_cl_req_hand ccb->ccb_h.status = CAM_REQ_CMP; else { if (req_pkt->status & TW_CL_ERR_REQ_INVALID_TARGET) - ccb->ccb_h.status |= CAM_TID_INVALID; + ccb->ccb_h.status |= CAM_SEL_TIMEOUT; else if (req_pkt->status & TW_CL_ERR_REQ_INVALID_LUN) - ccb->ccb_h.status |= CAM_LUN_INVALID; + ccb->ccb_h.status |= CAM_DEV_NOT_THERE; else if (req_pkt->status & TW_CL_ERR_REQ_SCSI_ERROR) ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; else if (req_pkt->status & TW_CL_ERR_REQ_BUS_RESET) From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 22:59:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75462106564A; Fri, 22 Jun 2012 22:59:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 469568FC08; Fri, 22 Jun 2012 22:59:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MMxhnR005243; Fri, 22 Jun 2012 22:59:43 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MMxhNA005240; Fri, 22 Jun 2012 22:59:43 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201206222259.q5MMxhNA005240@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 22 Jun 2012 22:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237463 - head/sys/dev/cxgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 22:59:43 -0000 Author: np Date: Fri Jun 22 22:59:42 2012 New Revision: 237463 URL: http://svn.freebsd.org/changeset/base/237463 Log: Do not allocate extra vectors when adapter is not TOE capable (or toecaps have been disallowed by the user). + one very minor unrelated cleanup in t4_sge.c Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jun 22 22:50:50 2012 (r237462) +++ head/sys/dev/cxgbe/t4_main.c Fri Jun 22 22:59:42 2012 (r237463) @@ -1308,10 +1308,12 @@ cfg_itype_and_nqueues(struct adapter *sc iaq->nrxq10g = nrxq10g = t4_nrxq10g; iaq->nrxq1g = nrxq1g = t4_nrxq1g; #ifdef TCP_OFFLOAD - iaq->nofldtxq10g = t4_nofldtxq10g; - iaq->nofldtxq1g = t4_nofldtxq1g; - iaq->nofldrxq10g = nofldrxq10g = t4_nofldrxq10g; - iaq->nofldrxq1g = nofldrxq1g = t4_nofldrxq1g; + if (is_offload(sc)) { + iaq->nofldtxq10g = t4_nofldtxq10g; + iaq->nofldtxq1g = t4_nofldtxq1g; + iaq->nofldrxq10g = nofldrxq10g = t4_nofldrxq10g; + iaq->nofldrxq1g = nofldrxq1g = t4_nofldrxq1g; + } #endif for (itype = INTR_MSIX; itype; itype >>= 1) { @@ -1380,7 +1382,8 @@ restart: } iaq->nrxq10g = min(n, nrxq10g); #ifdef TCP_OFFLOAD - iaq->nofldrxq10g = min(n, nofldrxq10g); + if (is_offload(sc)) + iaq->nofldrxq10g = min(n, nofldrxq10g); #endif } @@ -1395,7 +1398,8 @@ restart: } iaq->nrxq1g = min(n, nrxq1g); #ifdef TCP_OFFLOAD - iaq->nofldrxq1g = min(n, nofldrxq1g); + if (is_offload(sc)) + iaq->nofldrxq1g = min(n, nofldrxq1g); #endif } @@ -1408,7 +1412,8 @@ restart: */ iaq->nirq = iaq->nrxq10g = iaq->nrxq1g = 1; #ifdef TCP_OFFLOAD - iaq->nofldrxq10g = iaq->nofldrxq1g = 1; + if (is_offload(sc)) + iaq->nofldrxq10g = iaq->nofldrxq1g = 1; #endif allocate: Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Jun 22 22:50:50 2012 (r237462) +++ head/sys/dev/cxgbe/t4_sge.c Fri Jun 22 22:59:42 2012 (r237463) @@ -1031,7 +1031,7 @@ get_fl_payload(struct adapter *sc, struc static int t4_eth_rx(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m0) { - struct sge_rxq *rxq = (void *)iq; + struct sge_rxq *rxq = iq_to_rxq(iq); struct ifnet *ifp = rxq->ifp; const struct cpl_rx_pkt *cpl = (const void *)(rss + 1); #ifdef INET From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 00:37:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D306106572C; Sat, 23 Jun 2012 00:37:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB3538FC14; Sat, 23 Jun 2012 00:37:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N0bWoO009248; Sat, 23 Jun 2012 00:37:32 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N0bW0o009246; Sat, 23 Jun 2012 00:37:32 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206230037.q5N0bW0o009246@svn.freebsd.org> From: Xin LI Date: Sat, 23 Jun 2012 00:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237464 - in stable: 7/usr.bin/makewhatis 8/usr.bin/makewhatis 9/usr.bin/makewhatis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 00:37:33 -0000 Author: delphij Date: Sat Jun 23 00:37:32 2012 New Revision: 237464 URL: http://svn.freebsd.org/changeset/base/237464 Log: MFC r237348: Currently the code uses gzFile * for a zlib file descriptor, which is not correct. The code works by accident because gzFile is currently defined as void *, and internally it would be casted from or to its real type. A newer version of zlib will instead define it as a pointer to a specific type pointer (namely, struct gzFile_s *). This therefore would cause stricter checks and compiler would catch this type mismatch. This change does not cause any changes to the resulting binary, as validated with md5(1). Modified: stable/9/usr.bin/makewhatis/makewhatis.c Directory Properties: stable/9/usr.bin/makewhatis/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.bin/makewhatis/makewhatis.c stable/8/usr.bin/makewhatis/makewhatis.c Directory Properties: stable/7/usr.bin/makewhatis/ (props changed) stable/8/usr.bin/makewhatis/ (props changed) Modified: stable/9/usr.bin/makewhatis/makewhatis.c ============================================================================== --- stable/9/usr.bin/makewhatis/makewhatis.c Fri Jun 22 22:59:42 2012 (r237463) +++ stable/9/usr.bin/makewhatis/makewhatis.c Sat Jun 23 00:37:32 2012 (r237464) @@ -693,7 +693,7 @@ enum { STATE_UNKNOWN, STATE_MANSTYLE, ST static void process_page(struct page_info *page, char *section_dir) { - gzFile *in; + gzFile in; char buffer[4096]; char *line; StringList *names; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 00:37:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43DBF1065732; Sat, 23 Jun 2012 00:37:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DE0D8FC15; Sat, 23 Jun 2012 00:37:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N0bXhU009254; Sat, 23 Jun 2012 00:37:33 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N0bWfG009252; Sat, 23 Jun 2012 00:37:32 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206230037.q5N0bWfG009252@svn.freebsd.org> From: Xin LI Date: Sat, 23 Jun 2012 00:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237464 - in stable: 7/usr.bin/makewhatis 8/usr.bin/makewhatis 9/usr.bin/makewhatis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 00:37:33 -0000 Author: delphij Date: Sat Jun 23 00:37:32 2012 New Revision: 237464 URL: http://svn.freebsd.org/changeset/base/237464 Log: MFC r237348: Currently the code uses gzFile * for a zlib file descriptor, which is not correct. The code works by accident because gzFile is currently defined as void *, and internally it would be casted from or to its real type. A newer version of zlib will instead define it as a pointer to a specific type pointer (namely, struct gzFile_s *). This therefore would cause stricter checks and compiler would catch this type mismatch. This change does not cause any changes to the resulting binary, as validated with md5(1). Modified: stable/8/usr.bin/makewhatis/makewhatis.c Directory Properties: stable/8/usr.bin/makewhatis/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.bin/makewhatis/makewhatis.c stable/9/usr.bin/makewhatis/makewhatis.c Directory Properties: stable/7/usr.bin/makewhatis/ (props changed) stable/9/usr.bin/makewhatis/ (props changed) Modified: stable/8/usr.bin/makewhatis/makewhatis.c ============================================================================== --- stable/8/usr.bin/makewhatis/makewhatis.c Fri Jun 22 22:59:42 2012 (r237463) +++ stable/8/usr.bin/makewhatis/makewhatis.c Sat Jun 23 00:37:32 2012 (r237464) @@ -693,7 +693,7 @@ enum { STATE_UNKNOWN, STATE_MANSTYLE, ST static void process_page(struct page_info *page, char *section_dir) { - gzFile *in; + gzFile in; char buffer[4096]; char *line; StringList *names; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 00:37:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7884A10656DC; Sat, 23 Jun 2012 00:37:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 625D48FC17; Sat, 23 Jun 2012 00:37:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N0bX4P009260; Sat, 23 Jun 2012 00:37:33 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N0bXov009258; Sat, 23 Jun 2012 00:37:33 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206230037.q5N0bXov009258@svn.freebsd.org> From: Xin LI Date: Sat, 23 Jun 2012 00:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237464 - in stable: 7/usr.bin/makewhatis 8/usr.bin/makewhatis 9/usr.bin/makewhatis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 00:37:33 -0000 Author: delphij Date: Sat Jun 23 00:37:32 2012 New Revision: 237464 URL: http://svn.freebsd.org/changeset/base/237464 Log: MFC r237348: Currently the code uses gzFile * for a zlib file descriptor, which is not correct. The code works by accident because gzFile is currently defined as void *, and internally it would be casted from or to its real type. A newer version of zlib will instead define it as a pointer to a specific type pointer (namely, struct gzFile_s *). This therefore would cause stricter checks and compiler would catch this type mismatch. This change does not cause any changes to the resulting binary, as validated with md5(1). Modified: stable/7/usr.bin/makewhatis/makewhatis.c Directory Properties: stable/7/usr.bin/makewhatis/ (props changed) Changes in other areas also in this revision: Modified: stable/8/usr.bin/makewhatis/makewhatis.c stable/9/usr.bin/makewhatis/makewhatis.c Directory Properties: stable/8/usr.bin/makewhatis/ (props changed) stable/9/usr.bin/makewhatis/ (props changed) Modified: stable/7/usr.bin/makewhatis/makewhatis.c ============================================================================== --- stable/7/usr.bin/makewhatis/makewhatis.c Fri Jun 22 22:59:42 2012 (r237463) +++ stable/7/usr.bin/makewhatis/makewhatis.c Sat Jun 23 00:37:32 2012 (r237464) @@ -692,7 +692,7 @@ enum { STATE_UNKNOWN, STATE_MANSTYLE, ST static void process_page(struct page_info *page, char *section_dir) { - gzFile *in; + gzFile in; char buffer[4096]; char *line; StringList *names; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 06:03:52 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6A65B106566C; Sat, 23 Jun 2012 06:03:52 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 4545F8FC16; Sat, 23 Jun 2012 06:03:52 +0000 (UTC) Received: from [192.168.2.58] (wifi.xcllnt.net [70.36.220.6] (may be forged)) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id q5N63e9M061390 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 22 Jun 2012 23:03:51 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Marcel Moolenaar In-Reply-To: <201206210310.q5L3AmLd084976@svn.freebsd.org> Date: Fri, 22 Jun 2012 23:03:40 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <6526CF11-F29B-4BEC-B577-5F5392D17223@xcllnt.net> References: <201206210310.q5L3AmLd084976@svn.freebsd.org> To: Max Khon X-Mailer: Apple Mail (2.1278) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237350 - head/sys/dev/puc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 06:03:52 -0000 On Jun 20, 2012, at 8:10 PM, Max Khon wrote: >=20 > Modified: head/sys/dev/puc/puc_cfg.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/puc/puc_cfg.h Thu Jun 21 02:48:49 2012 = (r237349) > +++ head/sys/dev/puc/puc_cfg.h Thu Jun 21 03:10:48 2012 = (r237350) > @@ -79,7 +79,7 @@ struct puc_cfg { > int8_t ports; > int8_t rid; /* Rid of first port */ > int8_t d_rid; /* Delta rid of next ports */ > - int8_t d_ofs; /* Delta offset of next ports */ > + int16_t d_ofs; /* Delta offset of next ports */ > puc_config_f *config_function; > }; The purpose of the uint8_t is to minimize wastage. For the uncommon cases there's the config_function. Given that uint8_t has been adequate for a very long time, I think it's fair to say that the MOXA devices have an uncommon configuration and that you shouldn't pessimize the common case by extending the type of d_ofs and as a side-effect add padding before it *and* after it -- the structure was optimal for both ILP32 and LP64. Please revert the above change and handle the uncommonly large offset by extending the existing moxa configuration file. It's the precedence that should have been followed anyway. Thanks, --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 07:45:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 194421065672; Sat, 23 Jun 2012 07:45:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 031FC8FC19; Sat, 23 Jun 2012 07:45:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N7jEwe027334; Sat, 23 Jun 2012 07:45:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N7jEXN027332; Sat, 23 Jun 2012 07:45:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206230745.q5N7jEXN027332@svn.freebsd.org> From: Alexander Motin Date: Sat, 23 Jun 2012 07:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237469 - stable/9/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 07:45:15 -0000 Author: mav Date: Sat Jun 23 07:45:14 2012 New Revision: 237469 URL: http://svn.freebsd.org/changeset/base/237469 Log: MFC r237335: Check status of cam_periph_hold() inside cdclose(). If cd device was invalidated while open, cam_periph_hold() will return error and won't get the reference. Following reference release will crash the system. Sponsored by: iXsystems, Inc. Modified: stable/9/sys/cam/scsi/scsi_cd.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Sat Jun 23 04:47:41 2012 (r237468) +++ stable/9/sys/cam/scsi/scsi_cd.c Sat Jun 23 07:45:14 2012 (r237469) @@ -1043,6 +1043,7 @@ cdclose(struct disk *dp) { struct cam_periph *periph; struct cd_softc *softc; + int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) @@ -1051,7 +1052,11 @@ cdclose(struct disk *dp) softc = (struct cd_softc *)periph->softc; cam_periph_lock(periph); - cam_periph_hold(periph, PRIBIO); + if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + cam_periph_unlock(periph); + cam_periph_release(periph); + return (0); + } CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("cdclose\n")); From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 07:46:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB2B01065670; Sat, 23 Jun 2012 07:46:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5CBF8FC08; Sat, 23 Jun 2012 07:46:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N7kXb0027522; Sat, 23 Jun 2012 07:46:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N7kXd2027520; Sat, 23 Jun 2012 07:46:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206230746.q5N7kXd2027520@svn.freebsd.org> From: Alexander Motin Date: Sat, 23 Jun 2012 07:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237470 - stable/8/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 07:46:34 -0000 Author: mav Date: Sat Jun 23 07:46:33 2012 New Revision: 237470 URL: http://svn.freebsd.org/changeset/base/237470 Log: MFC r237335: Check status of cam_periph_hold() inside cdclose(). If cd device was invalidated while open, cam_periph_hold() will return error and won't get the reference. Following reference release will crash the system. Sponsored by: iXsystems, Inc. Modified: stable/8/sys/cam/scsi/scsi_cd.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Sat Jun 23 07:45:14 2012 (r237469) +++ stable/8/sys/cam/scsi/scsi_cd.c Sat Jun 23 07:46:33 2012 (r237470) @@ -1036,6 +1036,7 @@ cdclose(struct disk *dp) { struct cam_periph *periph; struct cd_softc *softc; + int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) @@ -1044,7 +1045,11 @@ cdclose(struct disk *dp) softc = (struct cd_softc *)periph->softc; cam_periph_lock(periph); - cam_periph_hold(periph, PRIBIO); + if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + cam_periph_unlock(periph); + cam_periph_release(periph); + return (0); + } CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("cdclose\n")); From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 07:48:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A32A1065670; Sat, 23 Jun 2012 07:48:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5F678FC15; Sat, 23 Jun 2012 07:48:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N7m0eo027719; Sat, 23 Jun 2012 07:48:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N7m07k027716; Sat, 23 Jun 2012 07:48:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206230748.q5N7m07k027716@svn.freebsd.org> From: Alexander Motin Date: Sat, 23 Jun 2012 07:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237471 - stable/9/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 07:48:01 -0000 Author: mav Date: Sat Jun 23 07:48:00 2012 New Revision: 237471 URL: http://svn.freebsd.org/changeset/base/237471 Log: MFC r237336: Remove unused error variables in cdclose() and daclose(). Modified: stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Sat Jun 23 07:46:33 2012 (r237470) +++ stable/9/sys/cam/scsi/scsi_cd.c Sat Jun 23 07:48:00 2012 (r237471) @@ -1043,7 +1043,6 @@ cdclose(struct disk *dp) { struct cam_periph *periph; struct cd_softc *softc; - int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) @@ -1052,7 +1051,7 @@ cdclose(struct disk *dp) softc = (struct cd_softc *)periph->softc; cam_periph_lock(periph); - if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + if (cam_periph_hold(periph, PRIBIO) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (0); Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Jun 23 07:46:33 2012 (r237470) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Jun 23 07:48:00 2012 (r237471) @@ -984,14 +984,13 @@ daclose(struct disk *dp) { struct cam_periph *periph; struct da_softc *softc; - int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) return (0); cam_periph_lock(periph); - if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + if (cam_periph_hold(periph, PRIBIO) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (0); From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 07:49:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E35C106566B; Sat, 23 Jun 2012 07:49:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 583808FC12; Sat, 23 Jun 2012 07:49:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N7nB80027889; Sat, 23 Jun 2012 07:49:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N7nB23027886; Sat, 23 Jun 2012 07:49:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206230749.q5N7nB23027886@svn.freebsd.org> From: Alexander Motin Date: Sat, 23 Jun 2012 07:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237472 - stable/8/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 07:49:11 -0000 Author: mav Date: Sat Jun 23 07:49:10 2012 New Revision: 237472 URL: http://svn.freebsd.org/changeset/base/237472 Log: MFC r237336: Remove unused error variables in cdclose() and daclose(). Modified: stable/8/sys/cam/scsi/scsi_cd.c stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Sat Jun 23 07:48:00 2012 (r237471) +++ stable/8/sys/cam/scsi/scsi_cd.c Sat Jun 23 07:49:10 2012 (r237472) @@ -1036,7 +1036,6 @@ cdclose(struct disk *dp) { struct cam_periph *periph; struct cd_softc *softc; - int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) @@ -1045,7 +1044,7 @@ cdclose(struct disk *dp) softc = (struct cd_softc *)periph->softc; cam_periph_lock(periph); - if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + if (cam_periph_hold(periph, PRIBIO) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (0); Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Sat Jun 23 07:48:00 2012 (r237471) +++ stable/8/sys/cam/scsi/scsi_da.c Sat Jun 23 07:49:10 2012 (r237472) @@ -956,14 +956,13 @@ daclose(struct disk *dp) { struct cam_periph *periph; struct da_softc *softc; - int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) return (0); cam_periph_lock(periph); - if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + if (cam_periph_hold(periph, PRIBIO) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (0); From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 09:33:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D9EE106566B; Sat, 23 Jun 2012 09:33:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16E268FC17; Sat, 23 Jun 2012 09:33:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N9X6Bl032385; Sat, 23 Jun 2012 09:33:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N9X6gr032380; Sat, 23 Jun 2012 09:33:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206230933.q5N9X6gr032380@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 23 Jun 2012 09:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237474 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 09:33:07 -0000 Author: kib Date: Sat Jun 23 09:33:06 2012 New Revision: 237474 URL: http://svn.freebsd.org/changeset/base/237474 Log: Stop updating the struct vdso_timehands from even handler executed in the scheduled task from tc_windup(). Do it directly from tc_windup in interrupt context [1]. Establish the permanent mapping of the shared page into the kernel address space, avoiding the potential need to sleep waiting for allocation of sf buffer during vdso_timehands update. As a consequence, shared_page_write_start() and shared_page_write_end() functions are not needed anymore. Guess and memorize the pointers to native host and compat32 sysentvec during initialization, to avoid the need to get shared_page_alloc_sx lock during the update. In tc_fill_vdso_timehands(), do not loop waiting for timehands generation to stabilize, since vdso_timehands is written in the same interrupt context which wrote timehands. Requested by: mav [1] MFC after: 29 days Modified: head/sys/kern/kern_exec.c head/sys/kern/kern_tc.c head/sys/sys/sysent.h head/sys/sys/vdso.h Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Sat Jun 23 08:36:49 2012 (r237473) +++ head/sys/kern/kern_exec.c Sat Jun 23 09:33:06 2012 (r237474) @@ -1517,42 +1517,13 @@ exec_unregister(execsw_arg) static struct sx shared_page_alloc_sx; static vm_object_t shared_page_obj; static int shared_page_free; - -struct sf_buf * -shared_page_write_start(int base) -{ - vm_page_t m; - struct sf_buf *s; - - VM_OBJECT_LOCK(shared_page_obj); - m = vm_page_grab(shared_page_obj, OFF_TO_IDX(base), VM_ALLOC_RETRY); - VM_OBJECT_UNLOCK(shared_page_obj); - s = sf_buf_alloc(m, SFB_DEFAULT); - return (s); -} - -void -shared_page_write_end(struct sf_buf *sf) -{ - vm_page_t m; - - m = sf_buf_page(sf); - sf_buf_free(sf); - VM_OBJECT_LOCK(shared_page_obj); - vm_page_wakeup(m); - VM_OBJECT_UNLOCK(shared_page_obj); -} +char *shared_page_mapping; void shared_page_write(int base, int size, const void *data) { - struct sf_buf *sf; - vm_offset_t sk; - sf = shared_page_write_start(base); - sk = sf_buf_kva(sf); - bcopy(data, (void *)(sk + (base & PAGE_MASK)), size); - shared_page_write_end(sf); + bcopy(data, shared_page_mapping + base, size); } static int @@ -1596,6 +1567,7 @@ static void shared_page_init(void *dummy __unused) { vm_page_t m; + vm_offset_t addr; sx_init(&shared_page_alloc_sx, "shpsx"); shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, @@ -1605,25 +1577,24 @@ shared_page_init(void *dummy __unused) VM_ALLOC_ZERO); m->valid = VM_PAGE_BITS_ALL; VM_OBJECT_UNLOCK(shared_page_obj); + addr = kmem_alloc_nofault(kernel_map, PAGE_SIZE); + pmap_qenter(addr, &m, 1); + shared_page_mapping = (char *)addr; } SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)shared_page_init, NULL); static void -timehands_update(void *arg) +timehands_update(struct sysentvec *sv) { - struct sysentvec *sv; - struct sf_buf *sf; struct vdso_timehands th; struct vdso_timekeep *tk; uint32_t enabled, idx; - sv = arg; - sx_xlock(&shared_page_alloc_sx); enabled = tc_fill_vdso_timehands(&th); - sf = shared_page_write_start(sv->sv_timekeep_off); - tk = (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); + tk = (struct vdso_timekeep *)(shared_page_mapping + + sv->sv_timekeep_off); idx = sv->sv_timekeep_curr; atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); if (++idx >= VDSO_TH_NUM) @@ -1637,25 +1608,19 @@ timehands_update(void *arg) tk->tk_enabled = enabled; atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); tk->tk_current = idx; - shared_page_write_end(sf); - sx_xunlock(&shared_page_alloc_sx); } #ifdef COMPAT_FREEBSD32 static void -timehands_update32(void *arg) +timehands_update32(struct sysentvec *sv) { - struct sysentvec *sv; - struct sf_buf *sf; struct vdso_timekeep32 *tk; struct vdso_timehands32 th; uint32_t enabled, idx; - sv = arg; - sx_xlock(&shared_page_alloc_sx); enabled = tc_fill_vdso_timehands32(&th); - sf = shared_page_write_start(sv->sv_timekeep_off); - tk = (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); + tk = (struct vdso_timekeep32 *)(shared_page_mapping + + sv->sv_timekeep_off); idx = sv->sv_timekeep_curr; atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); if (++idx >= VDSO_TH_NUM) @@ -1669,11 +1634,32 @@ timehands_update32(void *arg) tk->tk_enabled = enabled; atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); tk->tk_current = idx; - shared_page_write_end(sf); - sx_xunlock(&shared_page_alloc_sx); } #endif +/* + * This is hackish, but easiest way to avoid creating list structures + * that needs to be iterated over from the hardclock interrupt + * context. + */ +static struct sysentvec *host_sysentvec; +#ifdef COMPAT_FREEBSD32 +static struct sysentvec *compat32_sysentvec; +#endif + +void +timekeep_push_vdso(void) +{ + + if (host_sysentvec != NULL && host_sysentvec->sv_timekeep_base != 0) + timehands_update(host_sysentvec); +#ifdef COMPAT_FREEBSD32 + if (compat32_sysentvec != NULL && + compat32_sysentvec->sv_timekeep_base != 0) + timehands_update32(compat32_sysentvec); +#endif +} + void exec_sysvec_init(void *param) { @@ -1688,29 +1674,32 @@ exec_sysvec_init(void *param) sv->sv_shared_page_obj = shared_page_obj; sv->sv_sigcode_base = sv->sv_shared_page_base + shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); + if ((sv->sv_flags & SV_ABI_MASK) != SV_ABI_FREEBSD) + return; tk_ver = VDSO_TK_VER_CURR; #ifdef COMPAT_FREEBSD32 if ((sv->sv_flags & SV_ILP32) != 0) { tk_base = shared_page_alloc(sizeof(struct vdso_timekeep32) + sizeof(struct vdso_timehands32) * VDSO_TH_NUM, 16); KASSERT(tk_base != -1, ("tk_base -1 for 32bit")); - EVENTHANDLER_REGISTER(tc_windup, timehands_update32, sv, - EVENTHANDLER_PRI_ANY); shared_page_write(tk_base + offsetof(struct vdso_timekeep32, tk_ver), sizeof(uint32_t), &tk_ver); + KASSERT(compat32_sysentvec == 0, + ("Native compat32 already registered")); + compat32_sysentvec = sv; } else { #endif tk_base = shared_page_alloc(sizeof(struct vdso_timekeep) + sizeof(struct vdso_timehands) * VDSO_TH_NUM, 16); KASSERT(tk_base != -1, ("tk_base -1 for native")); - EVENTHANDLER_REGISTER(tc_windup, timehands_update, sv, - EVENTHANDLER_PRI_ANY); shared_page_write(tk_base + offsetof(struct vdso_timekeep, tk_ver), sizeof(uint32_t), &tk_ver); + KASSERT(host_sysentvec == 0, ("Native already registered")); + host_sysentvec = sv; #ifdef COMPAT_FREEBSD32 } #endif sv->sv_timekeep_base = sv->sv_shared_page_base + tk_base; sv->sv_timekeep_off = tk_base; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); } Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Sat Jun 23 08:36:49 2012 (r237473) +++ head/sys/kern/kern_tc.c Sat Jun 23 09:33:06 2012 (r237474) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -121,12 +120,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, ×tepwarnings, 0, "Log time steps"); static void tc_windup(void); -static void tc_windup_push_vdso(void *ctx, int pending); static void cpu_tick_calibrate(int); -static struct task tc_windup_push_vdso_task = TASK_INITIALIZER(0, - tc_windup_push_vdso, 0); - static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { @@ -1367,7 +1362,7 @@ tc_windup(void) #endif timehands = th; - taskqueue_enqueue_fast(taskqueue_fast, &tc_windup_push_vdso_task); + timekeep_push_vdso(); } /* Report or change the active timecounter hardware. */ @@ -1394,7 +1389,7 @@ sysctl_kern_timecounter_hardware(SYSCTL_ (void)newtc->tc_get_timecount(newtc); timecounter = newtc; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); return (0); } return (EINVAL); @@ -1865,7 +1860,7 @@ sysctl_fast_gettime(SYSCTL_HANDLER_ARGS) if (error != 0) return (error); vdso_th_enable = old_vdso_th_enable; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); return (0); } SYSCTL_PROC(_kern_timecounter, OID_AUTO, fast_gettime, @@ -1877,19 +1872,15 @@ tc_fill_vdso_timehands(struct vdso_timeh { struct timehands *th; uint32_t enabled; - int gen; - do { - th = timehands; - gen = th->th_generation; - vdso_th->th_algo = VDSO_TH_ALGO_1; - vdso_th->th_scale = th->th_scale; - vdso_th->th_offset_count = th->th_offset_count; - vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; - vdso_th->th_offset = th->th_offset; - vdso_th->th_boottime = boottimebin; - enabled = cpu_fill_vdso_timehands(vdso_th); - } while (gen == 0 || timehands->th_generation != gen); + th = timehands; + vdso_th->th_algo = VDSO_TH_ALGO_1; + vdso_th->th_scale = th->th_scale; + vdso_th->th_offset_count = th->th_offset_count; + vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; + vdso_th->th_offset = th->th_offset; + vdso_th->th_boottime = boottimebin; + enabled = cpu_fill_vdso_timehands(vdso_th); if (!vdso_th_enable) enabled = 0; return (enabled); @@ -1901,30 +1892,19 @@ tc_fill_vdso_timehands32(struct vdso_tim { struct timehands *th; uint32_t enabled; - int gen; - do { - th = timehands; - gen = th->th_generation; - vdso_th32->th_algo = VDSO_TH_ALGO_1; - *(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale; - vdso_th32->th_offset_count = th->th_offset_count; - vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; - vdso_th32->th_offset.sec = th->th_offset.sec; - *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; - vdso_th32->th_boottime.sec = boottimebin.sec; - *(uint64_t *)&vdso_th32->th_boottime.frac[0] = boottimebin.frac; - enabled = cpu_fill_vdso_timehands32(vdso_th32); - } while (gen == 0 || timehands->th_generation != gen); + th = timehands; + vdso_th32->th_algo = VDSO_TH_ALGO_1; + *(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale; + vdso_th32->th_offset_count = th->th_offset_count; + vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; + vdso_th32->th_offset.sec = th->th_offset.sec; + *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; + vdso_th32->th_boottime.sec = boottimebin.sec; + *(uint64_t *)&vdso_th32->th_boottime.frac[0] = boottimebin.frac; + enabled = cpu_fill_vdso_timehands32(vdso_th32); if (!vdso_th_enable) enabled = 0; return (enabled); } #endif - -static void -tc_windup_push_vdso(void *ctx, int pending) -{ - - EVENTHANDLER_INVOKE(tc_windup); -} Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sat Jun 23 08:36:49 2012 (r237473) +++ head/sys/sys/sysent.h Sat Jun 23 09:33:06 2012 (r237474) @@ -265,8 +265,6 @@ int shared_page_alloc(int size, int alig int shared_page_fill(int size, int align, const void *data); void shared_page_write(int base, int size, const void *data); void exec_sysvec_init(void *param); -struct sf_buf *shared_page_write_start(int base); -void shared_page_write_end(struct sf_buf *sf); #define INIT_SYSENTVEC(name, sv) \ SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \ Modified: head/sys/sys/vdso.h ============================================================================== --- head/sys/sys/vdso.h Sat Jun 23 08:36:49 2012 (r237473) +++ head/sys/sys/vdso.h Sat Jun 23 09:33:06 2012 (r237474) @@ -29,7 +29,6 @@ #define _SYS_VDSO_H #include -#include #include struct vdso_timehands { @@ -74,6 +73,8 @@ u_int __vdso_gettc(const struct vdso_tim #ifdef _KERNEL +void timekeep_push_vdso(void); + uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vdso_th); /* @@ -86,9 +87,6 @@ uint32_t tc_fill_vdso_timehands(struct v */ uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th); -typedef void (*tc_windup_fn)(void *); -EVENTHANDLER_DECLARE(tc_windup, tc_windup_fn); - #define VDSO_TH_NUM 4 #ifdef COMPAT_FREEBSD32 From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 10:14:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8952106566C; Sat, 23 Jun 2012 10:14:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D36028FC0A; Sat, 23 Jun 2012 10:14:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NAEpgB034213; Sat, 23 Jun 2012 10:14:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NAEpUL034211; Sat, 23 Jun 2012 10:14:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206231014.q5NAEpUL034211@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 23 Jun 2012 10:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237476 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 10:14:52 -0000 Author: kib Date: Sat Jun 23 10:14:51 2012 New Revision: 237476 URL: http://svn.freebsd.org/changeset/base/237476 Log: Remove no longer needed forward declaration for struct sf_buf. MFC after: 29 days Modified: head/sys/sys/sysent.h Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sat Jun 23 09:50:41 2012 (r237475) +++ head/sys/sys/sysent.h Sat Jun 23 10:14:51 2012 (r237476) @@ -260,7 +260,6 @@ int lkmressys(struct thread *, struct no int syscall_thread_enter(struct thread *td, struct sysent *se); void syscall_thread_exit(struct thread *td, struct sysent *se); -struct sf_buf; int shared_page_alloc(int size, int align); int shared_page_fill(int size, int align, const void *data); void shared_page_write(int base, int size, const void *data); From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 10:15:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DFC8310657C1; Sat, 23 Jun 2012 10:15:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C959C8FC14; Sat, 23 Jun 2012 10:15:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NAFNhU034278; Sat, 23 Jun 2012 10:15:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NAFN7v034274; Sat, 23 Jun 2012 10:15:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206231015.q5NAFN7v034274@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 23 Jun 2012 10:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237477 - in head/sys: conf kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 10:15:24 -0000 Author: kib Date: Sat Jun 23 10:15:23 2012 New Revision: 237477 URL: http://svn.freebsd.org/changeset/base/237477 Log: Move the code dealing with shared page into a dedicated kern_sharedpage.c source file from kern_exec.c. MFC after: 29 days Added: head/sys/kern/kern_sharedpage.c - copied, changed from r237475, head/sys/kern/kern_exec.c Modified: head/sys/conf/files head/sys/kern/kern_exec.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Jun 23 10:14:51 2012 (r237476) +++ head/sys/conf/files Sat Jun 23 10:15:23 2012 (r237477) @@ -2567,6 +2567,7 @@ kern/kern_rmlock.c standard kern/kern_rwlock.c standard kern/kern_sdt.c optional kdtrace_hooks kern/kern_sema.c standard +kern/kern_sharedpage.c standard kern/kern_shutdown.c standard kern/kern_sig.c standard kern/kern_switch.c standard Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Sat Jun 23 10:14:51 2012 (r237476) +++ head/sys/kern/kern_exec.c Sat Jun 23 10:15:23 2012 (r237477) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" -#include "opt_compat.h" #include "opt_hwpmc_hooks.h" #include "opt_kdtrace.h" #include "opt_ktrace.h" @@ -65,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #ifdef KTRACE @@ -1513,193 +1511,3 @@ exec_unregister(execsw_arg) execsw = newexecsw; return (0); } - -static struct sx shared_page_alloc_sx; -static vm_object_t shared_page_obj; -static int shared_page_free; -char *shared_page_mapping; - -void -shared_page_write(int base, int size, const void *data) -{ - - bcopy(data, shared_page_mapping + base, size); -} - -static int -shared_page_alloc_locked(int size, int align) -{ - int res; - - res = roundup(shared_page_free, align); - if (res + size >= IDX_TO_OFF(shared_page_obj->size)) - res = -1; - else - shared_page_free = res + size; - return (res); -} - -int -shared_page_alloc(int size, int align) -{ - int res; - - sx_xlock(&shared_page_alloc_sx); - res = shared_page_alloc_locked(size, align); - sx_xunlock(&shared_page_alloc_sx); - return (res); -} - -int -shared_page_fill(int size, int align, const void *data) -{ - int res; - - sx_xlock(&shared_page_alloc_sx); - res = shared_page_alloc_locked(size, align); - if (res != -1) - shared_page_write(res, size, data); - sx_xunlock(&shared_page_alloc_sx); - return (res); -} - -static void -shared_page_init(void *dummy __unused) -{ - vm_page_t m; - vm_offset_t addr; - - sx_init(&shared_page_alloc_sx, "shpsx"); - shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, - VM_PROT_DEFAULT, 0, NULL); - VM_OBJECT_LOCK(shared_page_obj); - m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_RETRY | VM_ALLOC_NOBUSY | - VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; - VM_OBJECT_UNLOCK(shared_page_obj); - addr = kmem_alloc_nofault(kernel_map, PAGE_SIZE); - pmap_qenter(addr, &m, 1); - shared_page_mapping = (char *)addr; -} - -SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)shared_page_init, - NULL); - -static void -timehands_update(struct sysentvec *sv) -{ - struct vdso_timehands th; - struct vdso_timekeep *tk; - uint32_t enabled, idx; - - enabled = tc_fill_vdso_timehands(&th); - tk = (struct vdso_timekeep *)(shared_page_mapping + - sv->sv_timekeep_off); - idx = sv->sv_timekeep_curr; - atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); - if (++idx >= VDSO_TH_NUM) - idx = 0; - sv->sv_timekeep_curr = idx; - if (++sv->sv_timekeep_gen == 0) - sv->sv_timekeep_gen = 1; - th.th_gen = 0; - if (enabled) - tk->tk_th[idx] = th; - tk->tk_enabled = enabled; - atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); - tk->tk_current = idx; -} - -#ifdef COMPAT_FREEBSD32 -static void -timehands_update32(struct sysentvec *sv) -{ - struct vdso_timekeep32 *tk; - struct vdso_timehands32 th; - uint32_t enabled, idx; - - enabled = tc_fill_vdso_timehands32(&th); - tk = (struct vdso_timekeep32 *)(shared_page_mapping + - sv->sv_timekeep_off); - idx = sv->sv_timekeep_curr; - atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); - if (++idx >= VDSO_TH_NUM) - idx = 0; - sv->sv_timekeep_curr = idx; - if (++sv->sv_timekeep_gen == 0) - sv->sv_timekeep_gen = 1; - th.th_gen = 0; - if (enabled) - tk->tk_th[idx] = th; - tk->tk_enabled = enabled; - atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); - tk->tk_current = idx; -} -#endif - -/* - * This is hackish, but easiest way to avoid creating list structures - * that needs to be iterated over from the hardclock interrupt - * context. - */ -static struct sysentvec *host_sysentvec; -#ifdef COMPAT_FREEBSD32 -static struct sysentvec *compat32_sysentvec; -#endif - -void -timekeep_push_vdso(void) -{ - - if (host_sysentvec != NULL && host_sysentvec->sv_timekeep_base != 0) - timehands_update(host_sysentvec); -#ifdef COMPAT_FREEBSD32 - if (compat32_sysentvec != NULL && - compat32_sysentvec->sv_timekeep_base != 0) - timehands_update32(compat32_sysentvec); -#endif -} - -void -exec_sysvec_init(void *param) -{ - struct sysentvec *sv; - int tk_base; - uint32_t tk_ver; - - sv = (struct sysentvec *)param; - - if ((sv->sv_flags & SV_SHP) == 0) - return; - sv->sv_shared_page_obj = shared_page_obj; - sv->sv_sigcode_base = sv->sv_shared_page_base + - shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); - if ((sv->sv_flags & SV_ABI_MASK) != SV_ABI_FREEBSD) - return; - tk_ver = VDSO_TK_VER_CURR; -#ifdef COMPAT_FREEBSD32 - if ((sv->sv_flags & SV_ILP32) != 0) { - tk_base = shared_page_alloc(sizeof(struct vdso_timekeep32) + - sizeof(struct vdso_timehands32) * VDSO_TH_NUM, 16); - KASSERT(tk_base != -1, ("tk_base -1 for 32bit")); - shared_page_write(tk_base + offsetof(struct vdso_timekeep32, - tk_ver), sizeof(uint32_t), &tk_ver); - KASSERT(compat32_sysentvec == 0, - ("Native compat32 already registered")); - compat32_sysentvec = sv; - } else { -#endif - tk_base = shared_page_alloc(sizeof(struct vdso_timekeep) + - sizeof(struct vdso_timehands) * VDSO_TH_NUM, 16); - KASSERT(tk_base != -1, ("tk_base -1 for native")); - shared_page_write(tk_base + offsetof(struct vdso_timekeep, - tk_ver), sizeof(uint32_t), &tk_ver); - KASSERT(host_sysentvec == 0, ("Native already registered")); - host_sysentvec = sv; -#ifdef COMPAT_FREEBSD32 - } -#endif - sv->sv_timekeep_base = sv->sv_shared_page_base + tk_base; - sv->sv_timekeep_off = tk_base; - timekeep_push_vdso(); -} Copied and modified: head/sys/kern/kern_sharedpage.c (from r237475, head/sys/kern/kern_exec.c) ============================================================================== --- head/sys/kern/kern_exec.c Sat Jun 23 09:50:41 2012 (r237475, copy source) +++ head/sys/kern/kern_sharedpage.c Sat Jun 23 10:15:23 2012 (r237477) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1993, David Greenman + * Copyright (c) 2010, 2012 Konstantin Belousov * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,1493 +27,28 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_capsicum.h" #include "opt_compat.h" -#include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" -#include "opt_ktrace.h" #include "opt_vm.h" #include -#include #include -#include -#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include #include #include -#include -#include -#ifdef KTRACE -#include -#endif #include #include #include -#include -#include -#include #include +#include +#include #include +#include #include -#ifdef HWPMC_HOOKS -#include -#endif - -#include - -#include -#include - -#ifdef KDTRACE_HOOKS -#include -dtrace_execexit_func_t dtrace_fasttrap_exec; -#endif - -SDT_PROVIDER_DECLARE(proc); -SDT_PROBE_DEFINE(proc, kernel, , exec, exec); -SDT_PROBE_ARGTYPE(proc, kernel, , exec, 0, "char *"); -SDT_PROBE_DEFINE(proc, kernel, , exec_failure, exec-failure); -SDT_PROBE_ARGTYPE(proc, kernel, , exec_failure, 0, "int"); -SDT_PROBE_DEFINE(proc, kernel, , exec_success, exec-success); -SDT_PROBE_ARGTYPE(proc, kernel, , exec_success, 0, "char *"); - -MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments"); - -static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS); -static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS); -static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS); -static int do_execve(struct thread *td, struct image_args *args, - struct mac *mac_p); - -/* XXX This should be vm_size_t. */ -SYSCTL_PROC(_kern, KERN_PS_STRINGS, ps_strings, CTLTYPE_ULONG|CTLFLAG_RD, - NULL, 0, sysctl_kern_ps_strings, "LU", ""); - -/* XXX This should be vm_size_t. */ -SYSCTL_PROC(_kern, KERN_USRSTACK, usrstack, CTLTYPE_ULONG|CTLFLAG_RD| - CTLFLAG_CAPRD, NULL, 0, sysctl_kern_usrstack, "LU", ""); - -SYSCTL_PROC(_kern, OID_AUTO, stackprot, CTLTYPE_INT|CTLFLAG_RD, - NULL, 0, sysctl_kern_stackprot, "I", ""); - -u_long ps_arg_cache_limit = PAGE_SIZE / 16; -SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, - &ps_arg_cache_limit, 0, ""); - -static int map_at_zero = 0; -TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); -SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, - "Permit processes to map an object at virtual address 0."); - -static int -sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) -{ - struct proc *p; - int error; - - p = curproc; -#ifdef SCTL_MASK32 - if (req->flags & SCTL_MASK32) { - unsigned int val; - val = (unsigned int)p->p_sysent->sv_psstrings; - error = SYSCTL_OUT(req, &val, sizeof(val)); - } else -#endif - error = SYSCTL_OUT(req, &p->p_sysent->sv_psstrings, - sizeof(p->p_sysent->sv_psstrings)); - return error; -} - -static int -sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS) -{ - struct proc *p; - int error; - - p = curproc; -#ifdef SCTL_MASK32 - if (req->flags & SCTL_MASK32) { - unsigned int val; - val = (unsigned int)p->p_sysent->sv_usrstack; - error = SYSCTL_OUT(req, &val, sizeof(val)); - } else -#endif - error = SYSCTL_OUT(req, &p->p_sysent->sv_usrstack, - sizeof(p->p_sysent->sv_usrstack)); - return error; -} - -static int -sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS) -{ - struct proc *p; - - p = curproc; - return (SYSCTL_OUT(req, &p->p_sysent->sv_stackprot, - sizeof(p->p_sysent->sv_stackprot))); -} - -/* - * Each of the items is a pointer to a `const struct execsw', hence the - * double pointer here. - */ -static const struct execsw **execsw; - -#ifndef _SYS_SYSPROTO_H_ -struct execve_args { - char *fname; - char **argv; - char **envv; -}; -#endif - -int -sys_execve(td, uap) - struct thread *td; - struct execve_args /* { - char *fname; - char **argv; - char **envv; - } */ *uap; -{ - int error; - struct image_args args; - - error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, - uap->argv, uap->envv); - if (error == 0) - error = kern_execve(td, &args, NULL); - return (error); -} - -#ifndef _SYS_SYSPROTO_H_ -struct fexecve_args { - int fd; - char **argv; - char **envv; -} -#endif -int -sys_fexecve(struct thread *td, struct fexecve_args *uap) -{ - int error; - struct image_args args; - - error = exec_copyin_args(&args, NULL, UIO_SYSSPACE, - uap->argv, uap->envv); - if (error == 0) { - args.fd = uap->fd; - error = kern_execve(td, &args, NULL); - } - return (error); -} - -#ifndef _SYS_SYSPROTO_H_ -struct __mac_execve_args { - char *fname; - char **argv; - char **envv; - struct mac *mac_p; -}; -#endif - -int -sys___mac_execve(td, uap) - struct thread *td; - struct __mac_execve_args /* { - char *fname; - char **argv; - char **envv; - struct mac *mac_p; - } */ *uap; -{ -#ifdef MAC - int error; - struct image_args args; - - error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, - uap->argv, uap->envv); - if (error == 0) - error = kern_execve(td, &args, uap->mac_p); - return (error); -#else - return (ENOSYS); -#endif -} - -/* - * XXX: kern_execve has the astonishing property of not always returning to - * the caller. If sufficiently bad things happen during the call to - * do_execve(), it can end up calling exit1(); as a result, callers must - * avoid doing anything which they might need to undo (e.g., allocating - * memory). - */ -int -kern_execve(td, args, mac_p) - struct thread *td; - struct image_args *args; - struct mac *mac_p; -{ - struct proc *p = td->td_proc; - int error; - - AUDIT_ARG_ARGV(args->begin_argv, args->argc, - args->begin_envv - args->begin_argv); - AUDIT_ARG_ENVV(args->begin_envv, args->envc, - args->endp - args->begin_envv); - if (p->p_flag & P_HADTHREADS) { - PROC_LOCK(p); - if (thread_single(SINGLE_BOUNDARY)) { - PROC_UNLOCK(p); - exec_free_args(args); - return (ERESTART); /* Try again later. */ - } - PROC_UNLOCK(p); - } - - error = do_execve(td, args, mac_p); - - if (p->p_flag & P_HADTHREADS) { - PROC_LOCK(p); - /* - * If success, we upgrade to SINGLE_EXIT state to - * force other threads to suicide. - */ - if (error == 0) - thread_single(SINGLE_EXIT); - else - thread_single_end(); - PROC_UNLOCK(p); - } - - return (error); -} - -/* - * In-kernel implementation of execve(). All arguments are assumed to be - * userspace pointers from the passed thread. - */ -static int -do_execve(td, args, mac_p) - struct thread *td; - struct image_args *args; - struct mac *mac_p; -{ - struct proc *p = td->td_proc; - struct nameidata nd; - struct ucred *newcred = NULL, *oldcred; - struct uidinfo *euip; - register_t *stack_base; - int error, i; - struct image_params image_params, *imgp; - struct vattr attr; - int (*img_first)(struct image_params *); - struct pargs *oldargs = NULL, *newargs = NULL; - struct sigacts *oldsigacts, *newsigacts; -#ifdef KTRACE - struct vnode *tracevp = NULL; - struct ucred *tracecred = NULL; -#endif - struct vnode *textvp = NULL, *binvp = NULL; - int credential_changing; - int vfslocked; - int textset; -#ifdef MAC - struct label *interpvplabel = NULL; - int will_transition; -#endif -#ifdef HWPMC_HOOKS - struct pmckern_procexec pe; -#endif - static const char fexecv_proc_title[] = "(fexecv)"; - - vfslocked = 0; - imgp = &image_params; - - /* - * Lock the process and set the P_INEXEC flag to indicate that - * it should be left alone until we're done here. This is - * necessary to avoid race conditions - e.g. in ptrace() - - * that might allow a local user to illicitly obtain elevated - * privileges. - */ - PROC_LOCK(p); - KASSERT((p->p_flag & P_INEXEC) == 0, - ("%s(): process already has P_INEXEC flag", __func__)); - p->p_flag |= P_INEXEC; - PROC_UNLOCK(p); - - /* - * Initialize part of the common data - */ - imgp->proc = p; - imgp->execlabel = NULL; - imgp->attr = &attr; - imgp->entry_addr = 0; - imgp->reloc_base = 0; - imgp->vmspace_destroyed = 0; - imgp->interpreted = 0; - imgp->opened = 0; - imgp->interpreter_name = NULL; - imgp->auxargs = NULL; - imgp->vp = NULL; - imgp->object = NULL; - imgp->firstpage = NULL; - imgp->ps_strings = 0; - imgp->auxarg_size = 0; - imgp->args = args; - imgp->execpath = imgp->freepath = NULL; - imgp->execpathp = 0; - imgp->canary = 0; - imgp->canarylen = 0; - imgp->pagesizes = 0; - imgp->pagesizeslen = 0; - imgp->stack_prot = 0; - -#ifdef MAC - error = mac_execve_enter(imgp, mac_p); - if (error) - goto exec_fail; -#endif - - imgp->image_header = NULL; - - /* - * Translate the file name. namei() returns a vnode pointer - * in ni_vp amoung other things. - * - * XXXAUDIT: It would be desirable to also audit the name of the - * interpreter if this is an interpreted binary. - */ - if (args->fname != NULL) { - NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME - | MPSAFE | AUDITVNODE1, UIO_SYSSPACE, args->fname, td); - } - - SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); - -interpret: - if (args->fname != NULL) { -#ifdef CAPABILITY_MODE - /* - * While capability mode can't reach this point via direct - * path arguments to execve(), we also don't allow - * interpreters to be used in capability mode (for now). - * Catch indirect lookups and return a permissions error. - */ - if (IN_CAPABILITY_MODE(td)) { - error = ECAPMODE; - goto exec_fail; - } -#endif - error = namei(&nd); - if (error) - goto exec_fail; - - vfslocked = NDHASGIANT(&nd); - binvp = nd.ni_vp; - imgp->vp = binvp; - } else { - AUDIT_ARG_FD(args->fd); - /* - * Some might argue that CAP_READ and/or CAP_MMAP should also - * be required here; such arguments will be entertained. - */ - error = fgetvp_read(td, args->fd, CAP_FEXECVE, &binvp); - if (error) - goto exec_fail; - vfslocked = VFS_LOCK_GIANT(binvp->v_mount); - vn_lock(binvp, LK_EXCLUSIVE | LK_RETRY); - AUDIT_ARG_VNODE1(binvp); - imgp->vp = binvp; - } - - /* - * Check file permissions (also 'opens' file) - */ - error = exec_check_permissions(imgp); - if (error) - goto exec_fail_dealloc; - - imgp->object = imgp->vp->v_object; - if (imgp->object != NULL) - vm_object_reference(imgp->object); - - /* - * Set VV_TEXT now so no one can write to the executable while we're - * activating it. - * - * Remember if this was set before and unset it in case this is not - * actually an executable image. - */ - textset = imgp->vp->v_vflag & VV_TEXT; - ASSERT_VOP_ELOCKED(imgp->vp, "vv_text"); - imgp->vp->v_vflag |= VV_TEXT; - - error = exec_map_first_page(imgp); - if (error) - goto exec_fail_dealloc; - - imgp->proc->p_osrel = 0; - /* - * If the current process has a special image activator it - * wants to try first, call it. For example, emulating shell - * scripts differently. - */ - error = -1; - if ((img_first = imgp->proc->p_sysent->sv_imgact_try) != NULL) - error = img_first(imgp); - - /* - * Loop through the list of image activators, calling each one. - * An activator returns -1 if there is no match, 0 on success, - * and an error otherwise. - */ - for (i = 0; error == -1 && execsw[i]; ++i) { - if (execsw[i]->ex_imgact == NULL || - execsw[i]->ex_imgact == img_first) { - continue; - } - error = (*execsw[i]->ex_imgact)(imgp); - } - - if (error) { - if (error == -1) { - if (textset == 0) { - ASSERT_VOP_ELOCKED(imgp->vp, "vv_text"); - imgp->vp->v_vflag &= ~VV_TEXT; - } - error = ENOEXEC; - } - goto exec_fail_dealloc; - } - - /* - * Special interpreter operation, cleanup and loop up to try to - * activate the interpreter. - */ - if (imgp->interpreted) { - exec_unmap_first_page(imgp); - /* - * VV_TEXT needs to be unset for scripts. There is a short - * period before we determine that something is a script where - * VV_TEXT will be set. The vnode lock is held over this - * entire period so nothing should illegitimately be blocked. - */ - imgp->vp->v_vflag &= ~VV_TEXT; - /* free name buffer and old vnode */ - if (args->fname != NULL) - NDFREE(&nd, NDF_ONLY_PNBUF); -#ifdef MAC - mac_execve_interpreter_enter(binvp, &interpvplabel); -#endif - if (imgp->opened) { - VOP_CLOSE(binvp, FREAD, td->td_ucred, td); - imgp->opened = 0; - } - vput(binvp); - vm_object_deallocate(imgp->object); - imgp->object = NULL; - VFS_UNLOCK_GIANT(vfslocked); - vfslocked = 0; - /* set new name to that of the interpreter */ - NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME | MPSAFE, - UIO_SYSSPACE, imgp->interpreter_name, td); - args->fname = imgp->interpreter_name; - goto interpret; - } - - /* - * NB: We unlock the vnode here because it is believed that none - * of the sv_copyout_strings/sv_fixup operations require the vnode. - */ - VOP_UNLOCK(imgp->vp, 0); - - /* - * Do the best to calculate the full path to the image file. - */ - if (imgp->auxargs != NULL && - ((args->fname != NULL && args->fname[0] == '/') || - vn_fullpath(td, imgp->vp, &imgp->execpath, &imgp->freepath) != 0)) - imgp->execpath = args->fname; - - /* - * Copy out strings (args and env) and initialize stack base - */ - if (p->p_sysent->sv_copyout_strings) - stack_base = (*p->p_sysent->sv_copyout_strings)(imgp); - else - stack_base = exec_copyout_strings(imgp); - - /* - * If custom stack fixup routine present for this process - * let it do the stack setup. - * Else stuff argument count as first item on stack - */ - if (p->p_sysent->sv_fixup != NULL) - (*p->p_sysent->sv_fixup)(&stack_base, imgp); - else - suword(--stack_base, imgp->args->argc); - - /* - * For security and other reasons, the file descriptor table cannot - * be shared after an exec. - */ - fdunshare(p, td); - - /* - * Malloc things before we need locks. - */ - newcred = crget(); - euip = uifind(attr.va_uid); - i = imgp->args->begin_envv - imgp->args->begin_argv; - /* Cache arguments if they fit inside our allowance */ - if (ps_arg_cache_limit >= i + sizeof(struct pargs)) { - newargs = pargs_alloc(i); - bcopy(imgp->args->begin_argv, newargs->ar_args, i); - } - - /* close files on exec */ - fdcloseexec(td); - vn_lock(imgp->vp, LK_SHARED | LK_RETRY); - - /* Get a reference to the vnode prior to locking the proc */ - VREF(binvp); - - /* - * For security and other reasons, signal handlers cannot - * be shared after an exec. The new process gets a copy of the old - * handlers. In execsigs(), the new process will have its signals - * reset. - */ - PROC_LOCK(p); - oldcred = crcopysafe(p, newcred); - if (sigacts_shared(p->p_sigacts)) { - oldsigacts = p->p_sigacts; - PROC_UNLOCK(p); - newsigacts = sigacts_alloc(); - sigacts_copy(newsigacts, oldsigacts); - PROC_LOCK(p); - p->p_sigacts = newsigacts; - } else - oldsigacts = NULL; - - /* Stop profiling */ - stopprofclock(p); - - /* reset caught signals */ - execsigs(p); - - /* name this process - nameiexec(p, ndp) */ - bzero(p->p_comm, sizeof(p->p_comm)); - if (args->fname) - bcopy(nd.ni_cnd.cn_nameptr, p->p_comm, - min(nd.ni_cnd.cn_namelen, MAXCOMLEN)); - else if (vn_commname(binvp, p->p_comm, sizeof(p->p_comm)) != 0) - bcopy(fexecv_proc_title, p->p_comm, sizeof(fexecv_proc_title)); - bcopy(p->p_comm, td->td_name, sizeof(td->td_name)); -#ifdef KTR - sched_clear_tdname(td); -#endif - - /* - * mark as execed, wakeup the process that vforked (if any) and tell - * it that it now has its own resources back - */ - p->p_flag |= P_EXEC; - if (p->p_pptr && (p->p_flag & P_PPWAIT)) { - p->p_flag &= ~P_PPWAIT; - cv_broadcast(&p->p_pwait); - } - - /* - * Implement image setuid/setgid. - * - * Don't honor setuid/setgid if the filesystem prohibits it or if - * the process is being traced. - * - * We disable setuid/setgid/etc in compatibility mode on the basis - * that most setugid applications are not written with that - * environment in mind, and will therefore almost certainly operate - * incorrectly. In principle there's no reason that setugid - * applications might not be useful in capability mode, so we may want - * to reconsider this conservative design choice in the future. - * - * XXXMAC: For the time being, use NOSUID to also prohibit - * transitions on the file system. - */ - credential_changing = 0; - credential_changing |= (attr.va_mode & S_ISUID) && oldcred->cr_uid != - attr.va_uid; - credential_changing |= (attr.va_mode & S_ISGID) && oldcred->cr_gid != - attr.va_gid; -#ifdef MAC - will_transition = mac_vnode_execve_will_transition(oldcred, imgp->vp, - interpvplabel, imgp); - credential_changing |= will_transition; -#endif - - if (credential_changing && -#ifdef CAPABILITY_MODE - ((oldcred->cr_flags & CRED_FLAG_CAPMODE) == 0) && -#endif - (imgp->vp->v_mount->mnt_flag & MNT_NOSUID) == 0 && - (p->p_flag & P_TRACED) == 0) { - /* - * Turn off syscall tracing for set-id programs, except for - * root. Record any set-id flags first to make sure that - * we do not regain any tracing during a possible block. - */ - setsugid(p); - -#ifdef KTRACE - if (priv_check_cred(oldcred, PRIV_DEBUG_DIFFCRED, 0)) - ktrprocexec(p, &tracecred, &tracevp); -#endif - /* - * Close any file descriptors 0..2 that reference procfs, - * then make sure file descriptors 0..2 are in use. - * - * setugidsafety() may call closef() and then pfind() - * which may grab the process lock. - * fdcheckstd() may call falloc() which may block to - * allocate memory, so temporarily drop the process lock. - */ - PROC_UNLOCK(p); - VOP_UNLOCK(imgp->vp, 0); - setugidsafety(td); - error = fdcheckstd(td); - vn_lock(imgp->vp, LK_SHARED | LK_RETRY); - if (error != 0) - goto done1; - PROC_LOCK(p); - /* - * Set the new credentials. - */ - if (attr.va_mode & S_ISUID) - change_euid(newcred, euip); - if (attr.va_mode & S_ISGID) - change_egid(newcred, attr.va_gid); -#ifdef MAC - if (will_transition) { - mac_vnode_execve_transition(oldcred, newcred, imgp->vp, - interpvplabel, imgp); - } -#endif - /* - * Implement correct POSIX saved-id behavior. - * - * XXXMAC: Note that the current logic will save the - * uid and gid if a MAC domain transition occurs, even - * though maybe it shouldn't. - */ - change_svuid(newcred, newcred->cr_uid); - change_svgid(newcred, newcred->cr_gid); - p->p_ucred = newcred; - newcred = NULL; - } else { - if (oldcred->cr_uid == oldcred->cr_ruid && - oldcred->cr_gid == oldcred->cr_rgid) - p->p_flag &= ~P_SUGID; - /* - * Implement correct POSIX saved-id behavior. - * - * XXX: It's not clear that the existing behavior is - * POSIX-compliant. A number of sources indicate that the - * saved uid/gid should only be updated if the new ruid is - * not equal to the old ruid, or the new euid is not equal - * to the old euid and the new euid is not equal to the old - * ruid. The FreeBSD code always updates the saved uid/gid. - * Also, this code uses the new (replaced) euid and egid as - * the source, which may or may not be the right ones to use. - */ - if (oldcred->cr_svuid != oldcred->cr_uid || - oldcred->cr_svgid != oldcred->cr_gid) { - change_svuid(newcred, newcred->cr_uid); - change_svgid(newcred, newcred->cr_gid); - p->p_ucred = newcred; - newcred = NULL; - } - } - - /* - * Store the vp for use in procfs. This vnode was referenced prior - * to locking the proc lock. - */ - textvp = p->p_textvp; - p->p_textvp = binvp; - -#ifdef KDTRACE_HOOKS - /* - * Tell the DTrace fasttrap provider about the exec if it - * has declared an interest. - */ - if (dtrace_fasttrap_exec) - dtrace_fasttrap_exec(p); -#endif - - /* - * Notify others that we exec'd, and clear the P_INEXEC flag - * as we're now a bona fide freshly-execed process. - */ - KNOTE_LOCKED(&p->p_klist, NOTE_EXEC); - p->p_flag &= ~P_INEXEC; - - /* clear "fork but no exec" flag, as we _are_ execing */ - p->p_acflag &= ~AFORK; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 12:32:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39C30106566B; Sat, 23 Jun 2012 12:32:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E5D78FC19; Sat, 23 Jun 2012 12:32:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NCWrgo040973; Sat, 23 Jun 2012 12:32:53 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NCWrc5040967; Sat, 23 Jun 2012 12:32:53 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206231232.q5NCWrc5040967@svn.freebsd.org> From: Alexander Motin Date: Sat, 23 Jun 2012 12:32:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237478 - in head/sys/cam: . scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 12:32:54 -0000 Author: mav Date: Sat Jun 23 12:32:53 2012 New Revision: 237478 URL: http://svn.freebsd.org/changeset/base/237478 Log: Add scsi_extract_sense_ccb() -- wrapper around scsi_extract_sense_len(). It allows to remove number of duplicate checks from several places. Modified: head/sys/cam/cam_periph.c head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Sat Jun 23 10:15:23 2012 (r237477) +++ head/sys/cam/cam_periph.c Sat Jun 23 12:32:53 2012 (r237478) @@ -1147,22 +1147,15 @@ camperiphdone(struct cam_periph *periph, union ccb *saved_ccb; cam_status status; struct scsi_start_stop_unit *scsi_cmd; + int error_code, sense_key, asc, ascq; scsi_cmd = (struct scsi_start_stop_unit *) &done_ccb->csio.cdb_io.cdb_bytes; status = done_ccb->ccb_h.status; if ((status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if ((status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR && - (status & CAM_AUTOSNS_VALID)) { - struct scsi_sense_data *sense; - int error_code, sense_key, asc, ascq, sense_len; - - sense = &done_ccb->csio.sense_data; - sense_len = done_ccb->csio.sense_len - - done_ccb->csio.sense_resid; - scsi_extract_sense_len(sense, sense_len, &error_code, - &sense_key, &asc, &ascq, /*show_errors*/ 1); + if (scsi_extract_sense_ccb(done_ccb, + &error_code, &sense_key, &asc, &ascq)) { /* * If the error is "invalid field in CDB", * and the load/eject flag is set, turn the @@ -1421,12 +1414,8 @@ camperiphscsisenseerror(union ccb *ccb, cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if ((ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0) - err_action = scsi_error_action(&ccb->csio, - &cgd.inq_data, - sense_flags); - else - err_action = SS_RETRY|SSQ_DECREMENT_COUNT|EIO; + err_action = scsi_error_action(&ccb->csio, &cgd.inq_data, + sense_flags); error = err_action & SS_ERRMASK; /* Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Sat Jun 23 10:15:23 2012 (r237477) +++ head/sys/cam/scsi/scsi_all.c Sat Jun 23 12:32:53 2012 (r237478) @@ -2834,11 +2834,10 @@ scsi_error_action(struct ccb_scsiio *csi int error_code, sense_key, asc, ascq; scsi_sense_action action; - scsi_extract_sense_len(&csio->sense_data, csio->sense_len - - csio->sense_resid, &error_code, - &sense_key, &asc, &ascq, /*show_errors*/ 1); - - if ((error_code == SSD_DEFERRED_ERROR) + if (!scsi_extract_sense_ccb((union ccb *)csio, + &error_code, &sense_key, &asc, &ascq)) { + action = SS_RETRY | SSQ_DECREMENT_COUNT | SSQ_PRINT_SENSE | EIO; + } else if ((error_code == SSD_DEFERRED_ERROR) || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* * XXX dufault@FreeBSD.org @@ -4622,6 +4621,36 @@ scsi_extract_sense(struct scsi_sense_dat } /* + * Extract basic sense information from SCSI I/O CCB structure. + */ +int +scsi_extract_sense_ccb(union ccb *ccb, + int *error_code, int *sense_key, int *asc, int *ascq) +{ + struct scsi_sense_data *sense_data; + + /* Make sure there are some sense data we can access. */ + if (ccb->ccb_h.func_code != XPT_SCSI_IO || + (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR || + (ccb->csio.scsi_status != SCSI_STATUS_CHECK_COND) || + (ccb->ccb_h.status & CAM_AUTOSNS_VALID) == 0 || + (ccb->ccb_h.flags & CAM_SENSE_PHYS)) + return (0); + + if (ccb->ccb_h.flags & CAM_SENSE_PTR) + bcopy(&ccb->csio.sense_data, &sense_data, + sizeof(struct scsi_sense_data *)); + else + sense_data = &ccb->csio.sense_data; + scsi_extract_sense_len(sense_data, + ccb->csio.sense_len - ccb->csio.sense_resid, + error_code, sense_key, asc, ascq, 1); + if (*error_code == -1) + return (0); + return (1); +} + +/* * Extract basic sense information. If show_errors is set, sense values * will be set to -1 if they are not present. */ Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Sat Jun 23 10:15:23 2012 (r237477) +++ head/sys/cam/scsi/scsi_all.h Sat Jun 23 12:32:53 2012 (r237478) @@ -2388,6 +2388,8 @@ int scsi_devid_match(uint8_t *rhs, size void scsi_extract_sense(struct scsi_sense_data *sense, int *error_code, int *sense_key, int *asc, int *ascq); +int scsi_extract_sense_ccb(union ccb *ccb, int *error_code, int *sense_key, + int *asc, int *ascq); void scsi_extract_sense_len(struct scsi_sense_data *sense, u_int sense_len, int *error_code, int *sense_key, int *asc, int *ascq, int show_errors); Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Sat Jun 23 10:15:23 2012 (r237477) +++ head/sys/cam/scsi/scsi_cd.c Sat Jun 23 12:32:53 2012 (r237478) @@ -1676,7 +1676,6 @@ cddone(struct cam_periph *periph, union return; } else if (error != 0) { - struct scsi_sense_data *sense; int asc, ascq; int sense_key, error_code; int have_sense; @@ -1699,20 +1698,12 @@ cddone(struct cam_periph *periph, union cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if (((csio->ccb_h.flags & CAM_SENSE_PHYS) != 0) - || ((csio->ccb_h.flags & CAM_SENSE_PTR) != 0) - || ((status & CAM_AUTOSNS_VALID) == 0)) - have_sense = FALSE; - else + if (scsi_extract_sense_ccb(done_ccb, + &error_code, &sense_key, &asc, &ascq)) have_sense = TRUE; + else + have_sense = FALSE; - if (have_sense) { - sense = &csio->sense_data; - scsi_extract_sense_len(sense, - csio->sense_len - csio->sense_resid, - &error_code, &sense_key, &asc, - &ascq, /*show_errors*/ 1); - } /* * Attach to anything that claims to be a * CDROM or WORM device, as long as it @@ -3138,7 +3129,7 @@ cderror(union ccb *ccb, u_int32_t cam_fl { struct cd_softc *softc; struct cam_periph *periph; - int error; + int error, error_code, sense_key, asc, ascq; periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct cd_softc *)periph->softc; @@ -3152,19 +3143,10 @@ cderror(union ccb *ccb, u_int32_t cam_fl */ if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { error = cd6byteworkaround(ccb); - } else if (((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) - && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) - && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) - && ((ccb->ccb_h.flags & CAM_SENSE_PHYS) == 0) - && ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) { - int sense_key, error_code, asc, ascq; - - scsi_extract_sense_len(&ccb->csio.sense_data, - ccb->csio.sense_len - ccb->csio.sense_resid, &error_code, - &sense_key, &asc, &ascq, /*show_errors*/ 1); + } else if (scsi_extract_sense_ccb(ccb, + &error_code, &sense_key, &asc, &ascq)) { if (sense_key == SSD_KEY_ILLEGAL_REQUEST) - error = cd6byteworkaround(ccb); + error = cd6byteworkaround(ccb); } if (error == ERESTART) Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sat Jun 23 10:15:23 2012 (r237477) +++ head/sys/cam/scsi/scsi_da.c Sat Jun 23 12:32:53 2012 (r237478) @@ -2254,7 +2254,6 @@ dadone(struct cam_periph *periph, union */ return; } else if (error != 0) { - struct scsi_sense_data *sense; int asc, ascq; int sense_key, error_code; int have_sense; @@ -2277,20 +2276,12 @@ dadone(struct cam_periph *periph, union cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if (((csio->ccb_h.flags & CAM_SENSE_PHYS) != 0) - || ((csio->ccb_h.flags & CAM_SENSE_PTR) != 0) - || ((status & CAM_AUTOSNS_VALID) == 0)) - have_sense = FALSE; - else + if (scsi_extract_sense_ccb(done_ccb, + &error_code, &sense_key, &asc, &ascq)) have_sense = TRUE; + else + have_sense = FALSE; - if (have_sense) { - sense = &csio->sense_data; - scsi_extract_sense_len(sense, - csio->sense_len - csio->sense_resid, - &error_code, &sense_key, &asc, - &ascq, /*show_errors*/ 1); - } /* * If we tried READ CAPACITY(16) and failed, * fallback to READ CAPACITY(10). @@ -2428,7 +2419,7 @@ daerror(union ccb *ccb, u_int32_t cam_fl { struct da_softc *softc; struct cam_periph *periph; - int error; + int error, error_code, sense_key, asc, ascq; periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct da_softc *)periph->softc; @@ -2440,16 +2431,8 @@ daerror(union ccb *ccb, u_int32_t cam_fl error = 0; if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { error = cmd6workaround(ccb); - } else if (((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) - && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) - && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) - && ((ccb->ccb_h.flags & CAM_SENSE_PHYS) == 0) - && ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) { - int sense_key, error_code, asc, ascq; - - scsi_extract_sense(&ccb->csio.sense_data, - &error_code, &sense_key, &asc, &ascq); + } else if (scsi_extract_sense_ccb(ccb, + &error_code, &sense_key, &asc, &ascq)) { if (sense_key == SSD_KEY_ILLEGAL_REQUEST) error = cmd6workaround(ccb); /* From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 12:40:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 47C4E106564A; Sat, 23 Jun 2012 12:40:25 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E96F8FC0A; Sat, 23 Jun 2012 12:40:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NCeO1t041305; Sat, 23 Jun 2012 12:40:24 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NCeOQB041303; Sat, 23 Jun 2012 12:40:24 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201206231240.q5NCeOQB041303@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 23 Jun 2012 12:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237479 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 12:40:25 -0000 Author: melifaro Date: Sat Jun 23 12:40:24 2012 New Revision: 237479 URL: http://svn.freebsd.org/changeset/base/237479 Log: Fix interface matching by ipfw table Submitted by: Ihor Kaharlichenko Tested by: Ihor Kaharlichenko Approved by: kib(mentor) MFC after: 3 days Modified: head/sys/netinet/ipfw/ip_fw_table.c Modified: head/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_table.c Sat Jun 23 12:32:53 2012 (r237478) +++ head/sys/netinet/ipfw/ip_fw_table.c Sat Jun 23 12:40:24 2012 (r237479) @@ -568,7 +568,8 @@ ipfw_lookup_table_extended(struct ip_fw_ break; case IPFW_TABLE_INTERFACE: - KEY_LEN(iface) = strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE); + KEY_LEN(iface) = KEY_LEN_IFACE + + strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE); /* Assume direct match */ /* FIXME: Add interface pattern matching */ xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, rnh)); From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 13:18:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C56E106564A; Sat, 23 Jun 2012 13:18:05 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 1ECE68FC08; Sat, 23 Jun 2012 13:18:04 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5NDHvGq042912; Sat, 23 Jun 2012 15:17:57 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5NDHvLf042911; Sat, 23 Jun 2012 15:17:57 +0200 (CEST) (envelope-from marius) Date: Sat, 23 Jun 2012 15:17:57 +0200 From: Marius Strobl To: Konstantin Belousov Message-ID: <20120623131757.GB46065@alchemy.franken.de> References: <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de> <20120622074817.GA2337@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120622074817.GA2337@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 13:18:05 -0000 On Fri, Jun 22, 2012 at 10:48:17AM +0300, Konstantin Belousov wrote: > On Fri, Jun 22, 2012 at 09:34:56AM +0200, Marius Strobl wrote: > > On Fri, Jun 22, 2012 at 07:13:31AM +0000, Konstantin Belousov wrote: > > > Author: kib > > > Date: Fri Jun 22 07:13:30 2012 > > > New Revision: 237434 > > > URL: http://svn.freebsd.org/changeset/base/237434 > > > > > > Log: > > > Use struct vdso_timehands data to implement fast gettimeofday(2) and > > > clock_gettime(2) functions if supported. The speedup seen in > > > microbenchmarks is in range 4x-7x depending on the hardware. > > > > > > Only amd64 and i386 architectures are supported. Libc uses rdtsc and > > > kernel data to calculate current time, if enabled by kernel. > > > > I don't know much about x86 CPUs but is my understanding correct > > that TSCs are not synchronized in any way across CPUs, i.e. > > reading it on different CPUs may result in time going backwards > > etc., which is okay for this application though? > > Generally speaking, tsc state among different CPU after boot is not > synchronized, you are right. > > Kernel has somewhat doubtful test which verifies whether the after-boot > state of tsc looks good. If the test fails, TSC is not enabled by > default as timecounter, and then usermode follows kernel policy and > falls back to slow syscall. So we err on the safe side. > I tested this on Core i7 2xxx, where the test (usually) passes. Okay, so for x86 the TSCs are not used as timecounters by either the kernel or userland in the SMP case if they don't appear to be synchronized, correct? > > While you are there. do you have comments about sparc64 TICK counter ? > On SMP, the counter of BSP is used by IPI. Is it unavoidable ? The TICK counters are per-core and not synchronized by the hardware. We synchronize APs with the BSP on bring-up but they drift over time and the initial synchronization might not be perfect in the first place. At least in the past, drifting TICK counters caused all sorts of issues and strange behavior in FreeBSD when used as timecounter in the SMP case. If my understanding of the above is right, as is this still rules them out as timecounters for userland. Linux has some complex code (based on equivalent code origining in their ia64 port) for constantly synchronizing the TICK counters. In order to avoid that complexity and overhead, what I do in FreeBSD in the SMP case is to (ab)use counters (either intended for that purpose or bus cycle counters probably intended for debugging the hardware during development) available in the various host-to-foo bridges so it doesn't matter which CPU they are read by. This works just fine except for pre-PCI-Express based USIIIi machines, where the bus cycle counters are broken. That's where the TICK counter is always read from the BSP using an IPI in the SMP case. The latter is done as sched_bind(9) isn't possible with td_critnest > 1 according to information from jhb@ and mav@. So apart from introducing code to constantly synchronize the TICK counters, using the timecounters on the host busses also seems to be the only viable solution for userland. The latter should be doable but is long-winded as besides duplicating portions of the corresponding device drivers in userland, it probably also means to get some additional infrastructure like being able to memory map registers for devices on the nexus(4) level in place ... Marius From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 13:52:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0A8C106564A; Sat, 23 Jun 2012 13:52:45 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B1868FC0C; Sat, 23 Jun 2012 13:52:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NDqjch044371; Sat, 23 Jun 2012 13:52:45 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NDqjbp044369; Sat, 23 Jun 2012 13:52:45 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201206231352.q5NDqjbp044369@svn.freebsd.org> From: Justin Hibbits Date: Sat, 23 Jun 2012 13:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237480 - head/sys/dev/adb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 13:52:45 -0000 Author: jhibbits Date: Sat Jun 23 13:52:44 2012 New Revision: 237480 URL: http://svn.freebsd.org/changeset/base/237480 Log: Release the ADB keyboard mutex when handling the power button press/release. Found by WITNESS. Approved by: nwhitehorn (mentor) MFC after: 3 days Modified: head/sys/dev/adb/adb_kbd.c Modified: head/sys/dev/adb/adb_kbd.c ============================================================================== --- head/sys/dev/adb/adb_kbd.c Sat Jun 23 12:40:24 2012 (r237479) +++ head/sys/dev/adb/adb_kbd.c Sat Jun 23 13:52:44 2012 (r237480) @@ -426,8 +426,10 @@ adb_kbd_receive_packet(device_t dev, u_c /* 0x7f is always the power button */ if (data[0] == 0x7f && devctl_process_running()) { devctl_notify("PMU", "Button", "pressed", NULL); + mtx_unlock(&sc->sc_mutex); return (0); } else if (data[0] == 0xff) { + mtx_unlock(&sc->sc_mutex); return (0); /* Ignore power button release. */ } if ((data[0] & 0x7f) == 57 && sc->buffers < 7) { From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 14:06:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A96A2106566B; Sat, 23 Jun 2012 14:06:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 3EFA48FC1E; Sat, 23 Jun 2012 14:06:02 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5NE5u5x076827; Sat, 23 Jun 2012 17:05:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5NE5uWm063779; Sat, 23 Jun 2012 17:05:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5NE5uFC063778; Sat, 23 Jun 2012 17:05:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 23 Jun 2012 17:05:56 +0300 From: Konstantin Belousov To: Marius Strobl Message-ID: <20120623140556.GU2337@deviant.kiev.zoral.com.ua> References: <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de> <20120622074817.GA2337@deviant.kiev.zoral.com.ua> <20120623131757.GB46065@alchemy.franken.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x5H/dHEtcMgsAT6y" Content-Disposition: inline In-Reply-To: <20120623131757.GB46065@alchemy.franken.de> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 14:06:02 -0000 --x5H/dHEtcMgsAT6y Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 23, 2012 at 03:17:57PM +0200, Marius Strobl wrote: > On Fri, Jun 22, 2012 at 10:48:17AM +0300, Konstantin Belousov wrote: > > On Fri, Jun 22, 2012 at 09:34:56AM +0200, Marius Strobl wrote: > > > On Fri, Jun 22, 2012 at 07:13:31AM +0000, Konstantin Belousov wrote: > > > > Author: kib > > > > Date: Fri Jun 22 07:13:30 2012 > > > > New Revision: 237434 > > > > URL: http://svn.freebsd.org/changeset/base/237434 > > > >=20 > > > > Log: > > > > Use struct vdso_timehands data to implement fast gettimeofday(2) = and > > > > clock_gettime(2) functions if supported. The speedup seen in > > > > microbenchmarks is in range 4x-7x depending on the hardware. > > > > =20 > > > > Only amd64 and i386 architectures are supported. Libc uses rdtsc = and > > > > kernel data to calculate current time, if enabled by kernel. > > >=20 > > > I don't know much about x86 CPUs but is my understanding correct > > > that TSCs are not synchronized in any way across CPUs, i.e. > > > reading it on different CPUs may result in time going backwards > > > etc., which is okay for this application though? > >=20 > > Generally speaking, tsc state among different CPU after boot is not > > synchronized, you are right. > >=20 > > Kernel has somewhat doubtful test which verifies whether the after-boot > > state of tsc looks good. If the test fails, TSC is not enabled by > > default as timecounter, and then usermode follows kernel policy and > > falls back to slow syscall. So we err on the safe side. > > I tested this on Core i7 2xxx, where the test (usually) passes. >=20 > Okay, so for x86 the TSCs are not used as timecounters by either > the kernel or userland in the SMP case if they don't appear to > be synchronized, correct? Correct as for now. But this is bug and not a feature. The tscs shall be synchronized, or skew tables calculated instead of refusing to use it. >=20 > >=20 > > While you are there. do you have comments about sparc64 TICK counter ? > > On SMP, the counter of BSP is used by IPI. Is it unavoidable ? >=20 > The TICK counters are per-core and not synchronized by the hardware. > We synchronize APs with the BSP on bring-up but they drift over time > and the initial synchronization might not be perfect in the first > place. At least in the past, drifting TICK counters caused all sorts > of issues and strange behavior in FreeBSD when used as timecounter > in the SMP case. If my understanding of the above is right, as is > this still rules them out as timecounters for userland. > Linux has some complex code (based on equivalent code origining in > their ia64 port) for constantly synchronizing the TICK counters. > In order to avoid that complexity and overhead, what I do in > FreeBSD in the SMP case is to (ab)use counters (either intended > for that purpose or bus cycle counters probably intended for > debugging the hardware during development) available in the > various host-to-foo bridges so it doesn't matter which CPU they > are read by. This works just fine except for pre-PCI-Express > based USIIIi machines, where the bus cycle counters are broken. > That's where the TICK counter is always read from the BSP > using an IPI in the SMP case. The latter is done as sched_bind(9) > isn't possible with td_critnest > 1 according to information > from jhb@ and mav@. > So apart from introducing code to constantly synchronize the > TICK counters, using the timecounters on the host busses also > seems to be the only viable solution for userland. The latter > should be doable but is long-winded as besides duplicating > portions of the corresponding device drivers in userland, it > probably also means to get some additional infrastructure > like being able to memory map registers for devices on the > nexus(4) level in place ... Understand. I do plan eventually to map HPET counters page into usermode on x86. Also, as I noted above, some code to synchronize per-package counters would be useful for x86, so it might be developed with multi-arch usage in mind. --x5H/dHEtcMgsAT6y Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/lzUQACgkQC3+MBN1Mb4jrTwCgjeoJh5/3fqsZBgaU+F4o3bou yg8An2Ac82EdegqYqBYGUVZhiyI6NuzC =fGTg -----END PGP SIGNATURE----- --x5H/dHEtcMgsAT6y-- From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 14:36:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1E6E1065679; Sat, 23 Jun 2012 14:36:01 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 9858E8FC15; Sat, 23 Jun 2012 14:36:01 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5NEa0xH043192; Sat, 23 Jun 2012 16:36:00 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5NEa0vr043191; Sat, 23 Jun 2012 16:36:00 +0200 (CEST) (envelope-from marius) Date: Sat, 23 Jun 2012 16:35:59 +0200 From: Marius Strobl To: Konstantin Belousov Message-ID: <20120623143559.GF69382@alchemy.franken.de> References: <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de> <20120622074817.GA2337@deviant.kiev.zoral.com.ua> <20120623131757.GB46065@alchemy.franken.de> <20120623140556.GU2337@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120623140556.GU2337@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 14:36:02 -0000 On Sat, Jun 23, 2012 at 05:05:56PM +0300, Konstantin Belousov wrote: > On Sat, Jun 23, 2012 at 03:17:57PM +0200, Marius Strobl wrote: > > On Fri, Jun 22, 2012 at 10:48:17AM +0300, Konstantin Belousov wrote: > > > On Fri, Jun 22, 2012 at 09:34:56AM +0200, Marius Strobl wrote: > > > > On Fri, Jun 22, 2012 at 07:13:31AM +0000, Konstantin Belousov wrote: > > > > > Author: kib > > > > > Date: Fri Jun 22 07:13:30 2012 > > > > > New Revision: 237434 > > > > > URL: http://svn.freebsd.org/changeset/base/237434 > > > > > > > > > > Log: > > > > > Use struct vdso_timehands data to implement fast gettimeofday(2) and > > > > > clock_gettime(2) functions if supported. The speedup seen in > > > > > microbenchmarks is in range 4x-7x depending on the hardware. > > > > > > > > > > Only amd64 and i386 architectures are supported. Libc uses rdtsc and > > > > > kernel data to calculate current time, if enabled by kernel. > > > > > > > > I don't know much about x86 CPUs but is my understanding correct > > > > that TSCs are not synchronized in any way across CPUs, i.e. > > > > reading it on different CPUs may result in time going backwards > > > > etc., which is okay for this application though? > > > > > > Generally speaking, tsc state among different CPU after boot is not > > > synchronized, you are right. > > > > > > Kernel has somewhat doubtful test which verifies whether the after-boot > > > state of tsc looks good. If the test fails, TSC is not enabled by > > > default as timecounter, and then usermode follows kernel policy and > > > falls back to slow syscall. So we err on the safe side. > > > I tested this on Core i7 2xxx, where the test (usually) passes. > > > > Okay, so for x86 the TSCs are not used as timecounters by either > > the kernel or userland in the SMP case if they don't appear to > > be synchronized, correct? > Correct as for now. But this is bug and not a feature. The tscs shall > be synchronized, or skew tables calculated instead of refusing to use it. > > > > > > > > > While you are there. do you have comments about sparc64 TICK counter ? > > > On SMP, the counter of BSP is used by IPI. Is it unavoidable ? > > > > The TICK counters are per-core and not synchronized by the hardware. > > We synchronize APs with the BSP on bring-up but they drift over time > > and the initial synchronization might not be perfect in the first > > place. At least in the past, drifting TICK counters caused all sorts > > of issues and strange behavior in FreeBSD when used as timecounter > > in the SMP case. If my understanding of the above is right, as is > > this still rules them out as timecounters for userland. > > Linux has some complex code (based on equivalent code origining in > > their ia64 port) for constantly synchronizing the TICK counters. > > In order to avoid that complexity and overhead, what I do in > > FreeBSD in the SMP case is to (ab)use counters (either intended > > for that purpose or bus cycle counters probably intended for > > debugging the hardware during development) available in the > > various host-to-foo bridges so it doesn't matter which CPU they > > are read by. This works just fine except for pre-PCI-Express > > based USIIIi machines, where the bus cycle counters are broken. > > That's where the TICK counter is always read from the BSP > > using an IPI in the SMP case. The latter is done as sched_bind(9) > > isn't possible with td_critnest > 1 according to information > > from jhb@ and mav@. > > So apart from introducing code to constantly synchronize the > > TICK counters, using the timecounters on the host busses also > > seems to be the only viable solution for userland. The latter > > should be doable but is long-winded as besides duplicating > > portions of the corresponding device drivers in userland, it > > probably also means to get some additional infrastructure > > like being able to memory map registers for devices on the > > nexus(4) level in place ... > > Understand. I do plan eventually to map HPET counters page into usermode > on x86. > > Also, as I noted above, some code to synchronize per-package counters > would be useful for x86, so it might be developed with multi-arch > usage in mind. That would be great. Marius From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 14:43:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8BD51065674; Sat, 23 Jun 2012 14:43:25 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA5568FC08; Sat, 23 Jun 2012 14:43:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NEhP4I046643; Sat, 23 Jun 2012 14:43:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NEhPoX046641; Sat, 23 Jun 2012 14:43:25 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206231443.q5NEhPoX046641@svn.freebsd.org> From: Marius Strobl Date: Sat, 23 Jun 2012 14:43:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237483 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 14:43:25 -0000 Author: marius Date: Sat Jun 23 14:43:25 2012 New Revision: 237483 URL: http://svn.freebsd.org/changeset/base/237483 Log: Unbreak options ZFS after r236884. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Jun 23 14:15:13 2012 (r237482) +++ head/sys/conf/files Sat Jun 23 14:43:25 2012 (r237483) @@ -161,9 +161,11 @@ cddl/compat/opensolaris/kern/opensolaris cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/common/nvpair/fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/unicode/u8_textprep.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/common/zfs/zfeature_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_comutil.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_deleg.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c optional zfs compile-with "${ZFS_C}" @@ -177,6 +179,7 @@ cddl/contrib/opensolaris/uts/common/fs/v cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c optional zfs compile-with "${ZFS_C}" @@ -228,6 +231,7 @@ cddl/contrib/opensolaris/uts/common/fs/z cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c optional zfs compile-with "${ZFS_C}" From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 14:56:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1A671065674; Sat, 23 Jun 2012 14:56:19 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 6F6BE8FC0C; Sat, 23 Jun 2012 14:56:19 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5NEuI7l043265; Sat, 23 Jun 2012 16:56:18 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5NEuIee043264; Sat, 23 Jun 2012 16:56:18 +0200 (CEST) (envelope-from marius) Date: Sat, 23 Jun 2012 16:56:18 +0200 From: Marius Strobl To: Martin Matuska Message-ID: <20120623145618.GG69382@alchemy.franken.de> References: <201206111135.q5BBZMva081982@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206111135.q5BBZMva081982@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236884 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/l... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 14:56:20 -0000 On Mon, Jun 11, 2012 at 11:35:22AM +0000, Martin Matuska wrote: > Author: mm > Date: Mon Jun 11 11:35:22 2012 > New Revision: 236884 > URL: http://svn.freebsd.org/changeset/base/236884 > > Log: > Introduce "feature flags" for ZFS pools (bump SPA version to 5000). > Add first feature "com.delphix:async_destroy" (asynchronous destroy > of ZFS datasets). > Implement features support in ZFS boot code. This commit is strange; it broke compling ZFS statically as the newly added kernel files referenced by dsl*.c etc. were missing from sys/conf/files (fixed in r237483). However, I don't see how these files except fnvpair.c but including dsl*.c are compiled into the module case either, but for some reason it apparently links and works anyway ... Marius From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 15:26:25 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2046A1065675; Sat, 23 Jun 2012 15:26:25 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx06.syd.optusnet.com.au (fallbackmx06.syd.optusnet.com.au [211.29.132.8]) by mx1.freebsd.org (Postfix) with ESMTP id 92E6B8FC18; Sat, 23 Jun 2012 15:26:24 +0000 (UTC) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by fallbackmx06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5NFQGPh015068; Sun, 24 Jun 2012 01:26:16 +1000 Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5NFQ1Ma028943 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 24 Jun 2012 01:26:02 +1000 Date: Sun, 24 Jun 2012 01:26:01 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov In-Reply-To: <20120623140556.GU2337@deviant.kiev.zoral.com.ua> Message-ID: <20120624005418.W2417@besplex.bde.org> References: <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de> <20120622074817.GA2337@deviant.kiev.zoral.com.ua> <20120623131757.GB46065@alchemy.franken.de> <20120623140556.GU2337@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Marius Strobl Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 15:26:25 -0000 On Sat, 23 Jun 2012, Konstantin Belousov wrote: > On Sat, Jun 23, 2012 at 03:17:57PM +0200, Marius Strobl wrote: >> On Fri, Jun 22, 2012 at 10:48:17AM +0300, Konstantin Belousov wrote: >>> On Fri, Jun 22, 2012 at 09:34:56AM +0200, Marius Strobl wrote: >>>> On Fri, Jun 22, 2012 at 07:13:31AM +0000, Konstantin Belousov wrote: >>>>> Author: kib >>>>> Date: Fri Jun 22 07:13:30 2012 >>>>> New Revision: 237434 >>>>> URL: http://svn.freebsd.org/changeset/base/237434 >>>>> >>>>> Log: >>>>> Use struct vdso_timehands data to implement fast gettimeofday(2) and >>>>> clock_gettime(2) functions if supported. The speedup seen in >>>>> microbenchmarks is in range 4x-7x depending on the hardware. >>>>> >>>>> Only amd64 and i386 architectures are supported. Libc uses rdtsc and >>>>> kernel data to calculate current time, if enabled by kernel. >>>> >>>> I don't know much about x86 CPUs but is my understanding correct >>>> that TSCs are not synchronized in any way across CPUs, i.e. >>>> reading it on different CPUs may result in time going backwards >>>> etc., which is okay for this application though? >>> >>> Generally speaking, tsc state among different CPU after boot is not >>> synchronized, you are right. >>> >>> Kernel has somewhat doubtful test which verifies whether the after-boot >>> state of tsc looks good. If the test fails, TSC is not enabled by >>> default as timecounter, and then usermode follows kernel policy and >>> falls back to slow syscall. So we err on the safe side. >>> I tested this on Core i7 2xxx, where the test (usually) passes. >> >> Okay, so for x86 the TSCs are not used as timecounters by either >> the kernel or userland in the SMP case if they don't appear to >> be synchronized, correct? > Correct as for now. But this is bug and not a feature. The tscs shall > be synchronized, or skew tables calculated instead of refusing to use it. >>> >>> While you are there. do you have comments about sparc64 TICK counter ? >>> On SMP, the counter of BSP is used by IPI. Is it unavoidable ? >> >> The TICK counters are per-core and not synchronized by the hardware. >> We synchronize APs with the BSP on bring-up but they drift over time >> and the initial synchronization might not be perfect in the first >> place. At least in the past, drifting TICK counters caused all sorts >> of issues and strange behavior in FreeBSD when used as timecounter >> in the SMP case. If my understanding of the above is right, as is >> this still rules them out as timecounters for userland. >> Linux has some complex code (based on equivalent code origining in >> their ia64 port) for constantly synchronizing the TICK counters. >> In order to avoid that complexity and overhead, what I do in >> FreeBSD in the SMP case is to (ab)use counters (either intended Attempted synchronization of TSCs is left out for the same reason on x86. Except some half-baked synchronization for a home made time function in dtrace (dtrace_gethrtime() on amd64 and i386) crept in. >> for that purpose or bus cycle counters probably intended for >> debugging the hardware during development) available in the >> various host-to-foo bridges so it doesn't matter which CPU they >> are read by. This works just fine except for pre-PCI-Express >> based USIIIi machines, where the bus cycle counters are broken. >> That's where the TICK counter is always read from the BSP >> using an IPI in the SMP case. The latter is done as sched_bind(9) >> isn't possible with td_critnest > 1 according to information >> from jhb@ and mav@. How can it work fine? Buses are too slow. On x86, ACPI-fast takes 700-1900 nsec on machines that I've tested (mostly pre-PCIe ones). HPET seems to be only slightly faster (maybe 500 nsec). >> So apart from introducing code to constantly synchronize the >> TICK counters, using the timecounters on the host busses also >> seems to be the only viable solution for userland. The latter >> should be doable but is long-winded as besides duplicating >> portions of the corresponding device drivers in userland, it >> probably also means to get some additional infrastructure >> like being able to memory map registers for devices on the >> nexus(4) level in place ... There is little point in optimizations to avoid syscalls for hardware. On x86, a syscall takes 100-400 nsec extra, so if the hardware takes 500-2000 nsec then reduction the total time by 100-400 nsec is not very useful. > Understand. I do plan eventually to map HPET counters page into usermode > on x86. This should be left out too. > Also, as I noted above, some code to synchronize per-package counters > would be useful for x86, so it might be developed with multi-arch > usage in mind. It's only worth synchonizing fast timecounter hardware so that it can be used in more cases. It probably needs to be non-bus based to be fast. That means the TSC on x86. The new timeout code to support tickless kernels looks like it will give large pessimizations unless the timecounter is fast. Instead of using the tick counter (1 atomic increment on every clock tick) and some getbinuptime() calls in places like select(), it uses the hardware timecounter via binuptime() in most places (since without a tick counter and without clock interrupts updating the timehands periodically, it takes a hardware timecounter read to determine the time). So callout_reset() might start taking thousands of nsec for per call, depending on how slow the timecounter is. This fix is probably to use a fuzzy time for long long timeouts and to discourage use of short timeouts and/or to turn them into long or fuzzy timeouts so that they are not very useful. Bruce From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 15:36:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3FC3106564A; Sat, 23 Jun 2012 15:36:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF0C68FC1A; Sat, 23 Jun 2012 15:36:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NFaWqT049030; Sat, 23 Jun 2012 15:36:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NFaWuJ049028; Sat, 23 Jun 2012 15:36:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206231536.q5NFaWuJ049028@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 23 Jun 2012 15:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237484 - head/sys/dev/agp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 15:36:32 -0000 Author: kib Date: Sat Jun 23 15:36:32 2012 New Revision: 237484 URL: http://svn.freebsd.org/changeset/base/237484 Log: Correct device id for GPU on some server SandyBridge model. Submitted and tested by: Thomas Zander MFC after: 3 days Modified: head/sys/dev/agp/agp_i810.c Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Sat Jun 23 14:43:25 2012 (r237483) +++ head/sys/dev/agp/agp_i810.c Sat Jun 23 15:36:32 2012 (r237484) @@ -700,7 +700,7 @@ static const struct agp_i810_match { .driver = &agp_i810_sb_driver }, { - .devid = 0x01088086, + .devid = 0x010a8086, .name = "SandyBridge server IG", .driver = &agp_i810_sb_driver }, From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 17:39:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89DD21065672; Sat, 23 Jun 2012 17:39:41 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73DFA8FC08; Sat, 23 Jun 2012 17:39:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NHdfk3054737; Sat, 23 Jun 2012 17:39:41 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NHdfg5054735; Sat, 23 Jun 2012 17:39:41 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206231739.q5NHdfg5054735@svn.freebsd.org> From: Davide Italiano Date: Sat, 23 Jun 2012 17:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237485 - stable/9/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 17:39:41 -0000 Author: davide Date: Sat Jun 23 17:39:40 2012 New Revision: 237485 URL: http://svn.freebsd.org/changeset/base/237485 Log: MFC r237195: The variable 'error' in sys_poll() is initialized in declaration to value zero but in any case is overwritten by successive copyin(), making the previous initialization useless. Remove this. As an added bonus this fixes a style(9) bug. Approved by: gnn (mentor) Modified: stable/9/sys/kern/sys_generic.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sys_generic.c ============================================================================== --- stable/9/sys/kern/sys_generic.c Sat Jun 23 15:36:32 2012 (r237484) +++ stable/9/sys/kern/sys_generic.c Sat Jun 23 17:39:40 2012 (r237485) @@ -1255,7 +1255,7 @@ sys_poll(td, uap) struct pollfd *bits; struct pollfd smallbits[32]; struct timeval atv, rtv, ttv; - int error = 0, timo; + int error, timo; u_int nfds; size_t ni; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 17:42:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20BBB106566C; Sat, 23 Jun 2012 17:42:38 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BC638FC08; Sat, 23 Jun 2012 17:42:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NHgbsg054906; Sat, 23 Jun 2012 17:42:37 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NHgbcK054904; Sat, 23 Jun 2012 17:42:37 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206231742.q5NHgbcK054904@svn.freebsd.org> From: Davide Italiano Date: Sat, 23 Jun 2012 17:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237486 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 17:42:38 -0000 Author: davide Date: Sat Jun 23 17:42:37 2012 New Revision: 237486 URL: http://svn.freebsd.org/changeset/base/237486 Log: MFC r237195: The variable 'error' in sys_poll() is initialized in declaration to value zero but in any case is overwritten by successive copyin(), making the previous initialization useless. Remove this. As an added bonus this fixes a style(9) bug. Approved by: gnn (mentor) Modified: stable/8/sys/kern/sys_generic.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/sys_generic.c ============================================================================== --- stable/8/sys/kern/sys_generic.c Sat Jun 23 17:39:40 2012 (r237485) +++ stable/8/sys/kern/sys_generic.c Sat Jun 23 17:42:37 2012 (r237486) @@ -1208,7 +1208,7 @@ poll(td, uap) struct pollfd *bits; struct pollfd smallbits[32]; struct timeval atv, rtv, ttv; - int error = 0, timo; + int error, timo; u_int nfds; size_t ni; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 17:46:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B176C1065673; Sat, 23 Jun 2012 17:46:42 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B86D8FC08; Sat, 23 Jun 2012 17:46:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NHkga0055146; Sat, 23 Jun 2012 17:46:42 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NHkgUm055144; Sat, 23 Jun 2012 17:46:42 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206231746.q5NHkgUm055144@svn.freebsd.org> From: Davide Italiano Date: Sat, 23 Jun 2012 17:46:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237487 - stable/9/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 17:46:42 -0000 Author: davide Date: Sat Jun 23 17:46:42 2012 New Revision: 237487 URL: http://svn.freebsd.org/changeset/base/237487 Log: MFC r237196: Disable hwpmc(4) support for Intel Xeon Sandy Bridge (Model 0x2D). Due to some differences in MSRs between Xeon Sandy Bridge and Core Sandy Bridge (Model 0x2A), wrmsr() may generate in a GP# fault exception and so a panic of the machine. Approved by: gnn (mentor) Modified: stable/9/sys/dev/hwpmc/hwpmc_intel.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/hwpmc/hwpmc_intel.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_intel.c Sat Jun 23 17:42:37 2012 (r237486) +++ stable/9/sys/dev/hwpmc/hwpmc_intel.c Sat Jun 23 17:46:42 2012 (r237487) @@ -143,7 +143,6 @@ pmc_intel_initialize(void) nclasses = 5; break; case 0x2A: /* Per Intel document 253669-039US 05/2011. */ - case 0x2D: /* Per Intel document 253669-041US 12/2011. */ cputype = PMC_CPU_INTEL_SANDYBRIDGE; nclasses = 5; break; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 17:59:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7440B1065674; Sat, 23 Jun 2012 17:59:33 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E9738FC08; Sat, 23 Jun 2012 17:59:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NHxXoS055711; Sat, 23 Jun 2012 17:59:33 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NHxX97055709; Sat, 23 Jun 2012 17:59:33 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201206231759.q5NHxX97055709@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 23 Jun 2012 17:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237488 - stable/9/usr.sbin/traceroute6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 17:59:33 -0000 Author: ume Date: Sat Jun 23 17:59:32 2012 New Revision: 237488 URL: http://svn.freebsd.org/changeset/base/237488 Log: MFC r235138: Add -a and -A option to the usage. Modified: stable/9/usr.sbin/traceroute6/traceroute6.c Directory Properties: stable/9/usr.sbin/traceroute6/ (props changed) Modified: stable/9/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- stable/9/usr.sbin/traceroute6/traceroute6.c Sat Jun 23 17:46:42 2012 (r237487) +++ stable/9/usr.sbin/traceroute6/traceroute6.c Sat Jun 23 17:59:32 2012 (r237488) @@ -1448,7 +1448,8 @@ usage() { fprintf(stderr, -"usage: traceroute6 [-dIlnNrUv] [-f firsthop] [-g gateway] [-m hoplimit]\n" -" [-p port] [-q probes] [-s src] [-w waittime] target [datalen]\n"); +"usage: traceroute6 [-adIlnNrUv] [-A as_server] [-f firsthop] [-g gateway]\n" +" [-m hoplimit] [-p port] [-q probes] [-s src] [-w waittime] target\n" +" [datalen]\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:07:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BCD2F1065675; Sat, 23 Jun 2012 18:07:48 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A75D68FC1D; Sat, 23 Jun 2012 18:07:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NI7mnu056124; Sat, 23 Jun 2012 18:07:48 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NI7mpU056122; Sat, 23 Jun 2012 18:07:48 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201206231807.q5NI7mpU056122@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 23 Jun 2012 18:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237489 - stable/8/usr.sbin/traceroute6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:07:48 -0000 Author: ume Date: Sat Jun 23 18:07:48 2012 New Revision: 237489 URL: http://svn.freebsd.org/changeset/base/237489 Log: MFC r235138: Add -a and -A option to the usage. Modified: stable/8/usr.sbin/traceroute6/traceroute6.c Directory Properties: stable/8/usr.sbin/traceroute6/ (props changed) Modified: stable/8/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- stable/8/usr.sbin/traceroute6/traceroute6.c Sat Jun 23 17:59:32 2012 (r237488) +++ stable/8/usr.sbin/traceroute6/traceroute6.c Sat Jun 23 18:07:48 2012 (r237489) @@ -1453,7 +1453,8 @@ usage() { fprintf(stderr, -"usage: traceroute6 [-dIlnNrUv] [-f firsthop] [-g gateway] [-m hoplimit]\n" -" [-p port] [-q probes] [-s src] [-w waittime] target [datalen]\n"); +"usage: traceroute6 [-adIlnNrUv] [-A as_server] [-f firsthop] [-g gateway]\n" +" [-m hoplimit] [-p port] [-q probes] [-s src] [-w waittime] target\n" +" [datalen]\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:26:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7DDDB106566B; Sat, 23 Jun 2012 18:26:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 683508FC08; Sat, 23 Jun 2012 18:26:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIQOEY056915; Sat, 23 Jun 2012 18:26:24 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIQOgY056913; Sat, 23 Jun 2012 18:26:24 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231826.q5NIQOgY056913@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 18:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237490 - stable/9/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:26:24 -0000 Author: trasz Date: Sat Jun 23 18:26:23 2012 New Revision: 237490 URL: http://svn.freebsd.org/changeset/base/237490 Log: MFC r234036: Fix panic in ffs_reload(), which may happen when read-only filesystem gets resized and then reloaded. MFC r234537: Fix use-after-free introduced in r234036. Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vfsops.c Sat Jun 23 18:07:48 2012 (r237489) +++ stable/9/sys/ufs/ffs/ffs_vfsops.c Sat Jun 23 18:26:23 2012 (r237490) @@ -675,8 +675,14 @@ ffs_reload(struct mount *mp, struct thre /* * Step 3: re-read summary information from disk. */ - blks = howmany(fs->fs_cssize, fs->fs_fsize); - space = fs->fs_csp; + size = fs->fs_cssize; + blks = howmany(size, fs->fs_fsize); + if (fs->fs_contigsumsize > 0) + size += fs->fs_ncg * sizeof(int32_t); + size += fs->fs_ncg * sizeof(u_int8_t); + free(fs->fs_csp, M_UFSMNT); + space = malloc((u_long)size, M_UFSMNT, M_WAITOK); + fs->fs_csp = space; for (i = 0; i < blks; i += fs->fs_frag) { size = fs->fs_bsize; if (i + fs->fs_frag > blks) @@ -693,10 +699,14 @@ ffs_reload(struct mount *mp, struct thre * We no longer know anything about clusters per cylinder group. */ if (fs->fs_contigsumsize > 0) { - lp = fs->fs_maxcluster; + fs->fs_maxcluster = lp = space; for (i = 0; i < fs->fs_ncg; i++) *lp++ = fs->fs_contigsumsize; + space = lp; } + size = fs->fs_ncg * sizeof(u_int8_t); + fs->fs_contigdirs = (u_int8_t *)space; + bzero(fs->fs_contigdirs, size); loop: MNT_VNODE_FOREACH_ALL(vp, mp, mvp) { From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:39:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D610A106566C; Sat, 23 Jun 2012 18:39:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B60208FC12; Sat, 23 Jun 2012 18:39:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIdZsN057496; Sat, 23 Jun 2012 18:39:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIdZOD057490; Sat, 23 Jun 2012 18:39:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206231839.q5NIdZOD057490@svn.freebsd.org> From: Marius Strobl Date: Sat, 23 Jun 2012 18:39:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237491 - in stable/9: lib/libc/arm lib/libc/arm/gen sys/arm/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:39:35 -0000 Author: marius Date: Sat Jun 23 18:39:35 2012 New Revision: 237491 URL: http://svn.freebsd.org/changeset/base/237491 Log: MFC: r231616, r232497, r234337 Add __aeabi_read_tp function required for thread-local storage. Added: stable/9/lib/libc/arm/gen/__aeabi_read_tp.S - copied unchanged from r234337, head/lib/libc/arm/gen/__aeabi_read_tp.S Modified: stable/9/lib/libc/arm/Symbol.map stable/9/lib/libc/arm/gen/Makefile.inc stable/9/sys/arm/include/armreg.h stable/9/sys/arm/include/sysarch.h Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/lib/libc/uuid/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/lib/libc/arm/Symbol.map ============================================================================== --- stable/9/lib/libc/arm/Symbol.map Sat Jun 23 18:26:23 2012 (r237490) +++ stable/9/lib/libc/arm/Symbol.map Sat Jun 23 18:39:35 2012 (r237491) @@ -41,6 +41,7 @@ FBSDprivate_1.0 { __sys_exit; _set_tp; + __aeabi_read_tp; ___longjmp; __umodsi3; __modsi3; Modified: stable/9/lib/libc/arm/gen/Makefile.inc ============================================================================== --- stable/9/lib/libc/arm/gen/Makefile.inc Sat Jun 23 18:26:23 2012 (r237490) +++ stable/9/lib/libc/arm/gen/Makefile.inc Sat Jun 23 18:39:35 2012 (r237491) @@ -3,4 +3,4 @@ SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ getcontextx.c infinity.c ldexp.c makecontext.c modf.c \ - setjmp.S signalcontext.c sigsetjmp.S divsi3.S + __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S divsi3.S Copied: stable/9/lib/libc/arm/gen/__aeabi_read_tp.S (from r234337, head/lib/libc/arm/gen/__aeabi_read_tp.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libc/arm/gen/__aeabi_read_tp.S Sat Jun 23 18:39:35 2012 (r237491, copy of r234337, head/lib/libc/arm/gen/__aeabi_read_tp.S) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +ENTRY(__aeabi_read_tp) + ldr r0, .Larm_tp_address + ldr r0, [r0] + RET + +.Larm_tp_address: + .word ARM_TP_ADDRESS + Modified: stable/9/sys/arm/include/armreg.h ============================================================================== --- stable/9/sys/arm/include/armreg.h Sat Jun 23 18:26:23 2012 (r237490) +++ stable/9/sys/arm/include/armreg.h Sat Jun 23 18:39:35 2012 (r237491) @@ -316,8 +316,13 @@ /* * Address of the vector page, low and high versions. */ +#ifndef __ASSEMBLER__ #define ARM_VECTORS_LOW 0x00000000U #define ARM_VECTORS_HIGH 0xffff0000U +#else +#define ARM_VECTORS_LOW 0 +#define ARM_VECTORS_HIGH 0xffff0000 +#endif /* * ARM Instructions Modified: stable/9/sys/arm/include/sysarch.h ============================================================================== --- stable/9/sys/arm/include/sysarch.h Sat Jun 23 18:26:23 2012 (r237490) +++ stable/9/sys/arm/include/sysarch.h Sat Jun 23 18:39:35 2012 (r237491) @@ -55,6 +55,7 @@ #define ARM_RAS_END (ARM_TP_ADDRESS + 8) #ifndef LOCORE +#ifndef __ASSEMBLER__ #include @@ -85,6 +86,7 @@ int sysarch(int, void *); __END_DECLS #endif +#endif /* __ASSEMBLER__ */ #endif /* LOCORE */ #endif /* !_ARM_SYSARCH_H_ */ From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:43:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DDBF106564A; Sat, 23 Jun 2012 18:43:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DCC28FC08; Sat, 23 Jun 2012 18:43:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIhBs3057758; Sat, 23 Jun 2012 18:43:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIhBNk057754; Sat, 23 Jun 2012 18:43:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206231843.q5NIhBNk057754@svn.freebsd.org> From: Marius Strobl Date: Sat, 23 Jun 2012 18:43:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237492 - in stable/9/gnu: lib/libgomp lib/libstdc++ usr.bin/cc/cc_tools X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:43:12 -0000 Author: marius Date: Sat Jun 23 18:43:11 2012 New Revision: 237492 URL: http://svn.freebsd.org/changeset/base/237492 Log: MFC: r231620, r237098 Enable TLS support for ARM toolchain Modified: stable/9/gnu/lib/libgomp/config.h stable/9/gnu/lib/libstdc++/config.h stable/9/gnu/usr.bin/cc/cc_tools/auto-host.h Directory Properties: stable/9/gnu/lib/libgomp/ (props changed) stable/9/gnu/lib/libstdc++/ (props changed) stable/9/gnu/usr.bin/cc/cc_tools/ (props changed) Modified: stable/9/gnu/lib/libgomp/config.h ============================================================================== --- stable/9/gnu/lib/libgomp/config.h Sat Jun 23 18:39:35 2012 (r237491) +++ stable/9/gnu/lib/libgomp/config.h Sat Jun 23 18:43:11 2012 (r237492) @@ -59,7 +59,7 @@ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if the target supports thread-local storage. */ -#if !defined(__arm__) && !defined(__mips__) +#if !defined(__mips__) #define HAVE_TLS 1 #endif Modified: stable/9/gnu/lib/libstdc++/config.h ============================================================================== --- stable/9/gnu/lib/libstdc++/config.h Sat Jun 23 18:39:35 2012 (r237491) +++ stable/9/gnu/lib/libstdc++/config.h Sat Jun 23 18:43:11 2012 (r237492) @@ -371,7 +371,7 @@ /* #undef HAVE_TANL */ /* Define to 1 if the target supports thread-local storage. */ -#if !defined(__arm__) && !defined(__mips__) +#if !defined(__mips__) #define HAVE_TLS 1 #endif Modified: stable/9/gnu/usr.bin/cc/cc_tools/auto-host.h ============================================================================== --- stable/9/gnu/usr.bin/cc/cc_tools/auto-host.h Sat Jun 23 18:39:35 2012 (r237491) +++ stable/9/gnu/usr.bin/cc/cc_tools/auto-host.h Sat Jun 23 18:43:11 2012 (r237492) @@ -287,10 +287,8 @@ /* Define if your assembler supports thread-local storage. */ #ifndef USED_FOR_TARGET -#if !defined(__arm__) #define HAVE_AS_TLS 1 #endif -#endif /* Define to 1 if you have the `atoll' function. */ From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:43:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B04F1065672; Sat, 23 Jun 2012 18:43:55 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 646508FC0C; Sat, 23 Jun 2012 18:43:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIhtqi057818; Sat, 23 Jun 2012 18:43:55 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIhtoh057816; Sat, 23 Jun 2012 18:43:55 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206231843.q5NIhtoh057816@svn.freebsd.org> From: Mitsuru IWASAKI Date: Sat, 23 Jun 2012 18:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237493 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:43:56 -0000 Author: iwasaki Date: Sat Jun 23 18:43:54 2012 New Revision: 237493 URL: http://svn.freebsd.org/changeset/base/237493 Log: Add in-driver event handler. MFC after: 3 days Modified: head/sys/dev/acpi_support/acpi_ibm.c Modified: head/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- head/sys/dev/acpi_support/acpi_ibm.c Sat Jun 23 18:43:11 2012 (r237492) +++ head/sys/dev/acpi_support/acpi_ibm.c Sat Jun 23 18:43:54 2012 (r237493) @@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -70,6 +72,7 @@ ACPI_MODULE_NAME("IBM") #define ACPI_IBM_METHOD_FANLEVEL 11 #define ACPI_IBM_METHOD_FANSTATUS 12 #define ACPI_IBM_METHOD_THERMAL 13 +#define ACPI_IBM_METHOD_HANDLEREVENTS 14 /* Hotkeys/Buttons */ #define IBM_RTC_HOTKEY1 0x64 @@ -126,6 +129,21 @@ ACPI_MODULE_NAME("IBM") #define IBM_NAME_EVENTS_GET "MHKP" #define IBM_NAME_EVENTS_AVAILMASK "MHKA" +/* Event Code */ +#define IBM_EVENT_LCD_BACKLIGHT 0x03 +#define IBM_EVENT_SUSPEND_TO_RAM 0x04 +#define IBM_EVENT_BLUETOOTH 0x05 +#define IBM_EVENT_SCREEN_EXPAND 0x07 +#define IBM_EVENT_SUSPEND_TO_DISK 0x0c +#define IBM_EVENT_BRIGHTNESS_UP 0x10 +#define IBM_EVENT_BRIGHTNESS_DOWN 0x11 +#define IBM_EVENT_THINKLIGHT 0x12 +#define IBM_EVENT_ZOOM 0x14 +#define IBM_EVENT_VOLUME_UP 0x15 +#define IBM_EVENT_VOLUME_DOWN 0x16 +#define IBM_EVENT_MUTE 0x17 +#define IBM_EVENT_ACCESS_IBM_BUTTON 0x18 + #define ABS(x) (((x) < 0)? -(x) : (x)) struct acpi_ibm_softc { @@ -164,6 +182,8 @@ struct acpi_ibm_softc { int events_mask_supported; int events_enable; + unsigned int handler_events; + struct sysctl_ctx_list *sysctl_ctx; struct sysctl_oid *sysctl_tree; }; @@ -267,8 +287,15 @@ static int acpi_ibm_sysctl_set(struct ac static int acpi_ibm_eventmask_set(struct acpi_ibm_softc *sc, int val); static int acpi_ibm_thermal_sysctl(SYSCTL_HANDLER_ARGS); +static int acpi_ibm_handlerevents_sysctl(SYSCTL_HANDLER_ARGS); static void acpi_ibm_notify(ACPI_HANDLE h, UINT32 notify, void *context); +static int acpi_ibm_brightness_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_bluetooth_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_thinklight_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_volume_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_mute_set(struct acpi_ibm_softc *sc, int arg); + static device_method_t acpi_ibm_methods[] = { /* Device interface */ DEVMETHOD(device_probe, acpi_ibm_probe), @@ -404,6 +431,15 @@ acpi_ibm_attach(device_t dev) "Thermal zones"); } + /* Hook up handlerevents node */ + if (acpi_ibm_sysctl_init(sc, ACPI_IBM_METHOD_HANDLEREVENTS)) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + "handlerevents", CTLTYPE_STRING | CTLFLAG_RW, + sc, 0, acpi_ibm_handlerevents_sysctl, "I", + "devd(8) events handled by acpi_ibm"); + } + /* Handle notifies */ AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY, acpi_ibm_notify, dev); @@ -656,10 +692,8 @@ acpi_ibm_sysctl_get(struct acpi_ibm_soft static int acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int method, int arg) { - int val, step; + int val; UINT64 val_ec; - ACPI_OBJECT Arg; - ACPI_OBJECT_LIST Args; ACPI_STATUS status; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -683,101 +717,23 @@ acpi_ibm_sysctl_set(struct acpi_ibm_soft break; case ACPI_IBM_METHOD_BRIGHTNESS: - if (arg < 0 || arg > 7) - return (EINVAL); - - if (sc->cmos_handle) { - /* Read the current brightness */ - status = ACPI_EC_READ(sc->ec_dev, IBM_EC_BRIGHTNESS, &val_ec, 1); - if (ACPI_FAILURE(status)) - return (status); - val = val_ec & IBM_EC_MASK_BRI; - - Args.Count = 1; - Args.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = (arg > val) ? IBM_CMOS_BRIGHTNESS_UP : IBM_CMOS_BRIGHTNESS_DOWN; - - step = (arg > val) ? 1 : -1; - for (int i = val; i != arg; i += step) { - status = AcpiEvaluateObject(sc->cmos_handle, NULL, &Args, NULL); - if (ACPI_FAILURE(status)) - break; - } - } - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_BRIGHTNESS, arg, 1); + return acpi_ibm_brightness_set(sc, arg); break; case ACPI_IBM_METHOD_VOLUME: - if (arg < 0 || arg > 14) - return (EINVAL); - - status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); - if (ACPI_FAILURE(status)) - return (status); - - if (sc->cmos_handle) { - val = val_ec & IBM_EC_MASK_VOL; - - Args.Count = 1; - Args.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = (arg > val) ? IBM_CMOS_VOLUME_UP : IBM_CMOS_VOLUME_DOWN; - - step = (arg > val) ? 1 : -1; - for (int i = val; i != arg; i += step) { - status = AcpiEvaluateObject(sc->cmos_handle, NULL, &Args, NULL); - if (ACPI_FAILURE(status)) - break; - } - } - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, arg + (val_ec & (~IBM_EC_MASK_VOL)), 1); + return acpi_ibm_volume_set(sc, arg); break; case ACPI_IBM_METHOD_MUTE: - if (arg < 0 || arg > 1) - return (EINVAL); - - status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); - if (ACPI_FAILURE(status)) - return (status); - - if (sc->cmos_handle) { - Args.Count = 1; - Args.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = IBM_CMOS_VOLUME_MUTE; - - status = AcpiEvaluateObject(sc->cmos_handle, NULL, &Args, NULL); - if (ACPI_FAILURE(status)) - break; - } - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, (arg==1) ? val_ec | IBM_EC_MASK_MUTE : val_ec & (~IBM_EC_MASK_MUTE), 1); + return acpi_ibm_mute_set(sc, arg); break; case ACPI_IBM_METHOD_THINKLIGHT: - if (arg < 0 || arg > 1) - return (EINVAL); - - if (sc->light_set_supported) { - Args.Count = 1; - Args.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = arg ? sc->light_cmd_on : sc->light_cmd_off; - - status = AcpiEvaluateObject(sc->light_handle, NULL, &Args, NULL); - if (ACPI_SUCCESS(status)) - sc->light_val = arg; - return (status); - } + return acpi_ibm_thinklight_set(sc, arg); break; case ACPI_IBM_METHOD_BLUETOOTH: - if (arg < 0 || arg > 1) - return (EINVAL); - - val = (arg == 1) ? sc->wlan_bt_flags | IBM_NAME_MASK_BT : sc->wlan_bt_flags & (~IBM_NAME_MASK_BT); - return acpi_SetInteger(sc->handle, IBM_NAME_WLAN_BT_SET, val); + return acpi_ibm_bluetooth_set(sc, arg); break; case ACPI_IBM_METHOD_FANLEVEL: @@ -898,6 +854,9 @@ acpi_ibm_sysctl_init(struct acpi_ibm_sof return (TRUE); } return (FALSE); + + case ACPI_IBM_METHOD_HANDLEREVENTS: + return (TRUE); } return (FALSE); } @@ -937,6 +896,328 @@ acpi_ibm_thermal_sysctl(SYSCTL_HANDLER_A return (error); } +static int +acpi_ibm_handlerevents_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct acpi_ibm_softc *sc; + int error = 0; + struct sbuf sb; + char *cp, *ep; + int l, val; + unsigned int handler_events; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + sc = (struct acpi_ibm_softc *)oidp->oid_arg1; + + if (sbuf_new(&sb, NULL, 128, SBUF_AUTOEXTEND) == NULL) + return (ENOMEM); + + ACPI_SERIAL_BEGIN(ibm); + + /* Get old values if this is a get request. */ + if (req->newptr == NULL) { + for (int i = 0; i < 8 * sizeof(sc->handler_events); i++) + if (sc->handler_events & (1 << i)) + sbuf_printf(&sb, "0x%02x ", i + 1); + if (sbuf_len(&sb) == 0) + sbuf_printf(&sb, "NONE"); + } + + sbuf_trim(&sb); + sbuf_finish(&sb); + + /* Copy out the old values to the user. */ + error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb)); + sbuf_delete(&sb); + + if (error != 0 || req->newptr == NULL) + goto out; + + /* If the user is setting a string, parse it. */ + handler_events = 0; + cp = (char *)req->newptr; + while (*cp) { + if (isspace(*cp)) { + cp++; + continue; + } + + ep = cp; + + while (*ep && !isspace(*ep)) + ep++; + + l = ep - cp; + if (l == 0) + break; + + if (strncmp(cp, "NONE", 4) == 0) { + cp = ep; + continue; + } + + if (l >= 3 && cp[0] == '0' && (cp[1] == 'X' || cp[1] == 'x')) + val = strtoul(cp, &ep, 16); + else + val = strtoul(cp, &ep, 10); + + if (val == 0 || ep == cp || val >= 8 * sizeof(handler_events)) { + cp[l] = '\0'; + device_printf(sc->dev, "invalid event code: %s\n", cp); + error = EINVAL; + goto out; + } + + handler_events |= 1 << (val - 1); + + cp = ep; + } + + sc->handler_events = handler_events; +out: + ACPI_SERIAL_END(ibm); + return (error); +} + +static int +acpi_ibm_brightness_set(struct acpi_ibm_softc *sc, int arg) +{ + int val, step; + UINT64 val_ec; + ACPI_OBJECT Arg; + ACPI_OBJECT_LIST Args; + ACPI_STATUS status; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 7) + return (EINVAL); + + /* Read the current brightness */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_BRIGHTNESS, &val_ec, 1); + if (ACPI_FAILURE(status)) + return (status); + + if (sc->cmos_handle) { + val = val_ec & IBM_EC_MASK_BRI; + + Args.Count = 1; + Args.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = (arg > val) ? IBM_CMOS_BRIGHTNESS_UP : + IBM_CMOS_BRIGHTNESS_DOWN; + + step = (arg > val) ? 1 : -1; + for (int i = val; i != arg; i += step) { + status = AcpiEvaluateObject(sc->cmos_handle, NULL, + &Args, NULL); + if (ACPI_FAILURE(status)) { + /* Record the last value */ + if (i != val) { + ACPI_EC_WRITE(sc->ec_dev, + IBM_EC_BRIGHTNESS, i - step, 1); + } + return (status); + } + } + } + + return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_BRIGHTNESS, arg, 1); +} + +static int +acpi_ibm_bluetooth_set(struct acpi_ibm_softc *sc, int arg) +{ + int val; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 1) + return (EINVAL); + + val = (arg == 1) ? sc->wlan_bt_flags | IBM_NAME_MASK_BT : + sc->wlan_bt_flags & (~IBM_NAME_MASK_BT); + return acpi_SetInteger(sc->handle, IBM_NAME_WLAN_BT_SET, val); +} + +static int +acpi_ibm_thinklight_set(struct acpi_ibm_softc *sc, int arg) +{ + ACPI_OBJECT Arg; + ACPI_OBJECT_LIST Args; + ACPI_STATUS status; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 1) + return (EINVAL); + + if (sc->light_set_supported) { + Args.Count = 1; + Args.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = arg ? sc->light_cmd_on : sc->light_cmd_off; + + status = AcpiEvaluateObject(sc->light_handle, NULL, + &Args, NULL); + if (ACPI_SUCCESS(status)) + sc->light_val = arg; + return (status); + } + + return (0); +} + +static int +acpi_ibm_volume_set(struct acpi_ibm_softc *sc, int arg) +{ + int val, step; + UINT64 val_ec; + ACPI_OBJECT Arg; + ACPI_OBJECT_LIST Args; + ACPI_STATUS status; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 14) + return (EINVAL); + + /* Read the current volume */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); + if (ACPI_FAILURE(status)) + return (status); + + if (sc->cmos_handle) { + val = val_ec & IBM_EC_MASK_VOL; + + Args.Count = 1; + Args.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = (arg > val) ? IBM_CMOS_VOLUME_UP : + IBM_CMOS_VOLUME_DOWN; + + step = (arg > val) ? 1 : -1; + for (int i = val; i != arg; i += step) { + status = AcpiEvaluateObject(sc->cmos_handle, NULL, + &Args, NULL); + if (ACPI_FAILURE(status)) { + /* Record the last value */ + if (i != val) { + val_ec = i - step + + (val_ec & (~IBM_EC_MASK_VOL)); + ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, + val_ec, 1); + } + return (status); + } + } + } + + val_ec = arg + (val_ec & (~IBM_EC_MASK_VOL)); + return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, val_ec, 1); +} + +static int +acpi_ibm_mute_set(struct acpi_ibm_softc *sc, int arg) +{ + UINT64 val_ec; + ACPI_OBJECT Arg; + ACPI_OBJECT_LIST Args; + ACPI_STATUS status; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 1) + return (EINVAL); + + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); + if (ACPI_FAILURE(status)) + return (status); + + if (sc->cmos_handle) { + Args.Count = 1; + Args.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = IBM_CMOS_VOLUME_MUTE; + + status = AcpiEvaluateObject(sc->cmos_handle, NULL, &Args, NULL); + if (ACPI_FAILURE(status)) + return (status); + } + + val_ec = (arg == 1) ? val_ec | IBM_EC_MASK_MUTE : + val_ec & (~IBM_EC_MASK_MUTE); + return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, val_ec, 1); +} + +static void +acpi_ibm_eventhandler(struct acpi_ibm_softc *sc, int arg) +{ + int val; + UINT64 val_ec; + ACPI_STATUS status; + + ACPI_SERIAL_BEGIN(ibm); + switch (arg) { + case IBM_EVENT_SUSPEND_TO_RAM: + power_pm_suspend(POWER_SLEEP_STATE_SUSPEND); + break; + + case IBM_EVENT_BLUETOOTH: + acpi_ibm_bluetooth_set(sc, (sc->wlan_bt_flags == 0)); + break; + + case IBM_EVENT_BRIGHTNESS_UP: + case IBM_EVENT_BRIGHTNESS_DOWN: + /* Read the current brightness */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_BRIGHTNESS, + &val_ec, 1); + if (ACPI_FAILURE(status)) + return; + + val = val_ec & IBM_EC_MASK_BRI; + val = (arg == IBM_EVENT_BRIGHTNESS_UP) ? val + 1 : val - 1; + acpi_ibm_brightness_set(sc, val); + break; + + case IBM_EVENT_THINKLIGHT: + acpi_ibm_thinklight_set(sc, (sc->light_val == 0)); + break; + + case IBM_EVENT_VOLUME_UP: + case IBM_EVENT_VOLUME_DOWN: + /* Read the current volume */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); + if (ACPI_FAILURE(status)) + return; + + val = val_ec & IBM_EC_MASK_VOL; + val = (arg == IBM_EVENT_VOLUME_UP) ? val + 1 : val - 1; + acpi_ibm_volume_set(sc, val); + break; + + case IBM_EVENT_MUTE: + /* Read the current value */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); + if (ACPI_FAILURE(status)) + return; + + val = ((val_ec & IBM_EC_MASK_MUTE) == IBM_EC_MASK_MUTE); + acpi_ibm_mute_set(sc, (val == 0)); + break; + + default: + break; + } + ACPI_SERIAL_END(ibm); +} + static void acpi_ibm_notify(ACPI_HANDLE h, UINT32 notify, void *context) { @@ -965,6 +1246,10 @@ acpi_ibm_notify(ACPI_HANDLE h, UINT32 no break; } + /* Execute event handler */ + if (sc->handler_events & (1 << (arg - 1))) + acpi_ibm_eventhandler(sc, (arg & 0xff)); + /* Notify devd(8) */ acpi_UserNotify("IBM", h, (arg & 0xff)); break; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:45:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B7C05106564A; Sat, 23 Jun 2012 18:45:32 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A325E8FC16; Sat, 23 Jun 2012 18:45:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIjWR0057952; Sat, 23 Jun 2012 18:45:32 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIjWqV057950; Sat, 23 Jun 2012 18:45:32 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206231845.q5NIjWqV057950@svn.freebsd.org> From: Mitsuru IWASAKI Date: Sat, 23 Jun 2012 18:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237494 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:45:32 -0000 Author: iwasaki Date: Sat Jun 23 18:45:32 2012 New Revision: 237494 URL: http://svn.freebsd.org/changeset/base/237494 Log: Add description about dev.acpi_ibm.0.handlerevents. MFC after: 3 days Modified: head/share/man/man4/acpi_ibm.4 Modified: head/share/man/man4/acpi_ibm.4 ============================================================================== --- head/share/man/man4/acpi_ibm.4 Sat Jun 23 18:43:54 2012 (r237493) +++ head/share/man/man4/acpi_ibm.4 Sat Jun 23 18:45:32 2012 (r237494) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2010 +.Dd June 24, 2012 .Dt ACPI_IBM 4 .Os .Sh NAME @@ -335,6 +335,17 @@ Built-in battery .It UltraBay battery .El +.It Va dev.acpi_ibm.0.handlerevents +.Xr devd 8 +events handled by +.Nm +when +.Va events +is set to 1. +Events are specified as a whitespace-separated list of event code in +hexadecimal or decimal form. +Note that the event maybe handled twice (eg. Brightness up/down) if ACPI BIOS +already handled the event. .El .Pp Defaults for these sysctls can be set in @@ -436,6 +447,20 @@ then fi exit 0 .Ed +.Pp +The following example specify that event code 0x04 (Suspend to RAM), +0x10 (Brightness up) and 0x11 (Brightness down) are handled by +.Nm . +.Bd -literal -offset indent +sysctl dev.acpi_ibm.0.handlerevents='0x04 0x10 0x11' +.Ed +.Pp +in +.Xr sysctl.conf 5 : +.Bd -literal -offset indent +dev.acpi_ibm.0.handlerevents=0x04\\ 0x10\\ 0x11 +.Ed +.Pp .Sh SEE ALSO .Xr acpi 4 , .Xr led 4 , From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:51:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 636921065679; Sat, 23 Jun 2012 18:51:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D3D58FC08; Sat, 23 Jun 2012 18:51:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIpYaO058241; Sat, 23 Jun 2012 18:51:34 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIpYuG058239; Sat, 23 Jun 2012 18:51:34 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231851.q5NIpYuG058239@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 18:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237495 - stable/9/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:51:34 -0000 Author: trasz Date: Sat Jun 23 18:51:33 2012 New Revision: 237495 URL: http://svn.freebsd.org/changeset/base/237495 Log: MFC r227081 by ed@: Add missing static keywords for global variables to tools in sbin/. These tools declare global variables without using the static keyword, even though their use is limited to a single C-file, or without placing an extern declaration of them in the proper header file. Modified: stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/growfs.c ============================================================================== --- stable/9/sbin/growfs/growfs.c Sat Jun 23 18:45:32 2012 (r237494) +++ stable/9/sbin/growfs/growfs.c Sat Jun 23 18:51:33 2012 (r237495) @@ -116,7 +116,7 @@ union dinode { } while (0) static ufs2_daddr_t inoblk; /* inode block address */ static char inobuf[MAXBSIZE]; /* inode block */ -ino_t maxino; /* last valid inode */ +static ino_t maxino; /* last valid inode */ static int unlabeled; /* unlabeled partition, e.g. vinum volume etc. */ /* From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:54:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B44DA1065674; Sat, 23 Jun 2012 18:54:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E5568FC18; Sat, 23 Jun 2012 18:54:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIsPM1058397; Sat, 23 Jun 2012 18:54:25 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIsP26058395; Sat, 23 Jun 2012 18:54:25 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231854.q5NIsP26058395@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 18:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237496 - stable/9/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:54:25 -0000 Author: trasz Date: Sat Jun 23 18:54:24 2012 New Revision: 237496 URL: http://svn.freebsd.org/changeset/base/237496 Log: MFC r230289 by ed@: Allow growfs to be built with GCC 4.7 and -Werror. The dp1 variable is only used when FSIRAND is defined. Just place the variable behind #ifdefs entirely. Modified: stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/growfs.c ============================================================================== --- stable/9/sbin/growfs/growfs.c Sat Jun 23 18:51:33 2012 (r237495) +++ stable/9/sbin/growfs/growfs.c Sat Jun 23 18:54:24 2012 (r237496) @@ -374,7 +374,9 @@ initcg(int cylno, time_t modtime, int fs static caddr_t iobuf; long blkno, start; ufs2_daddr_t i, cbase, dmax; +#ifdef FSIRAND struct ufs1_dinode *dp1; +#endif struct csum *cs; uint d, dupper, dlower; @@ -452,8 +454,8 @@ initcg(int cylno, time_t modtime, int fs bzero(iobuf, sblock.fs_bsize); for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) { - dp1 = (struct ufs1_dinode *)(void *)iobuf; #ifdef FSIRAND + dp1 = (struct ufs1_dinode *)(void *)iobuf; for (j = 0; j < INOPB(&sblock); j++) { dp1->di_gen = random(); dp1++; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 18:58:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAB371065672; Sat, 23 Jun 2012 18:58:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2DE28FC0A; Sat, 23 Jun 2012 18:58:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIw25n058625; Sat, 23 Jun 2012 18:58:02 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIw2I8058622; Sat, 23 Jun 2012 18:58:02 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231858.q5NIw2I8058622@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 18:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237497 - stable/9/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:58:02 -0000 Author: trasz Date: Sat Jun 23 18:58:02 2012 New Revision: 237497 URL: http://svn.freebsd.org/changeset/base/237497 Log: MFC r232548: Make growfs(8) mostly style compliant. No functional changes, verified with MD5. MFC r232858: After r232548, clang complains about the apparent '=-' operator (a left-over from ancient C times, and a frequent typo) in growfs.c: sbin/growfs/growfs.c:1550:8: error: use of unary operator that may be intended as compound assignment (-=) [-Werror] blkno =- 1; ^~ Use 'blkno = -1' instead, to silence the error. Modified: stable/9/sbin/growfs/debug.c stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/debug.c ============================================================================== --- stable/9/sbin/growfs/debug.c Sat Jun 23 18:54:24 2012 (r237496) +++ stable/9/sbin/growfs/debug.c Sat Jun 23 18:58:02 2012 (r237497) @@ -44,7 +44,6 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -/* ********************************************************** INCLUDES ***** */ #include #include @@ -57,15 +56,13 @@ static const char rcsid[] = #ifdef FS_DEBUG -/* *********************************************************** GLOBALS ***** */ -static FILE *dbg_log=NULL; -static unsigned int indent=0; +static FILE *dbg_log = NULL; +static unsigned int indent = 0; /* * prototypes not done here, as they come with debug.h */ -/* ********************************************************** dbg_open ***** */ /* * Open the filehandle where all debug output has to go. */ @@ -74,14 +71,13 @@ dbg_open(const char *fn) { if (strcmp(fn, "-") == 0) - dbg_log=fopen("/dev/stdout", "a"); + dbg_log = fopen("/dev/stdout", "a"); else - dbg_log=fopen(fn, "a"); + dbg_log = fopen(fn, "a"); return; } -/* ********************************************************* dbg_close ***** */ /* * Close the filehandle where all debug output went to. */ @@ -89,15 +85,14 @@ void dbg_close(void) { - if(dbg_log) { + if (dbg_log) { fclose(dbg_log); - dbg_log=NULL; + dbg_log = NULL; } return; } -/* ****************************************************** dbg_dump_hex ***** */ /* * Dump out a full file system block in hex. */ @@ -106,17 +101,16 @@ dbg_dump_hex(struct fs *sb, const char * { int i, j, k; - if(!dbg_log) { + if (!dbg_log) return; - } + fprintf(dbg_log, "===== START HEXDUMP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)mem, comment); indent++; - for (i=0; ifs_bsize; i+=24) { - for (j=0; j<3; j++) { - for (k=0; k<8; k++) { + for (i = 0; i < sb->fs_bsize; i += 24) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 8; k++) fprintf(dbg_log, "%02x ", *mem++); - } fprintf(dbg_log, " "); } fprintf(dbg_log, "\n"); @@ -127,7 +121,6 @@ dbg_dump_hex(struct fs *sb, const char * return; } -/* ******************************************************* dbg_dump_fs ***** */ /* * Dump the superblock. */ @@ -135,12 +128,11 @@ void dbg_dump_fs(struct fs *sb, const char *comment) { #ifdef FSMAXSNAP - int j; + int j; #endif /* FSMAXSNAP */ - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START SUPERBLOCK =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)sb, comment); @@ -308,10 +300,10 @@ dbg_dump_fs(struct fs *sb, const char *c sb->fs_pendinginodes); #ifdef FSMAXSNAP - for(j=0; jfs_snapinum[j]); - if(!sb->fs_snapinum[j]) { /* list is dense */ + if (!sb->fs_snapinum[j]) { /* list is dense */ break; } } @@ -356,7 +348,6 @@ dbg_dump_fs(struct fs *sb, const char *c return; } -/* ******************************************************* dbg_dump_cg ***** */ /* * Dump a cylinder group. */ @@ -365,9 +356,8 @@ dbg_dump_cg(const char *comment, struct { int j; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START CYLINDER GROUP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment); @@ -383,7 +373,7 @@ dbg_dump_cg(const char *comment, struct fprintf(dbg_log, "rotor int32_t 0x%08x\n", cgr->cg_rotor); fprintf(dbg_log, "frotor int32_t 0x%08x\n", cgr->cg_frotor); fprintf(dbg_log, "irotor int32_t 0x%08x\n", cgr->cg_irotor); - for(j=0; jcg_frsum[j]); } @@ -411,7 +401,6 @@ dbg_dump_cg(const char *comment, struct return; } -/* ***************************************************** dbg_dump_csum ***** */ /* * Dump a cylinder summary. */ @@ -419,9 +408,8 @@ void dbg_dump_csum(const char *comment, struct csum *cs) { - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START CYLINDER SUMMARY =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cs, comment); @@ -438,7 +426,6 @@ dbg_dump_csum(const char *comment, struc return; } -/* ************************************************ dbg_dump_csum_total ***** */ /* * Dump a cylinder summary. */ @@ -446,9 +433,8 @@ void dbg_dump_csum_total(const char *comment, struct csum_total *cs) { - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START CYLINDER SUMMARY TOTAL =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cs, comment); @@ -475,7 +461,6 @@ dbg_dump_csum_total(const char *comment, return; } -/* **************************************************** dbg_dump_inmap ***** */ /* * Dump the inode allocation map in one cylinder group. */ @@ -485,30 +470,29 @@ dbg_dump_inmap(struct fs *sb, const char int j,k,l,e; unsigned char *cp; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START INODE ALLOCATION MAP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment); indent++; - cp=(unsigned char *)cg_inosused(cgr); - e=sb->fs_ipg/8; - for(j=0; jfs_ipg / 8; + for (j = 0; j < e; j += 32) { fprintf(dbg_log, "%08x: ", j); - for(k=0; k<32; k+=8) { - if(j+k+8fs_old_nspf) - e=howmany((sb->fs_old_cpg * sb->fs_old_spc / sb->fs_old_nspf), CHAR_BIT); + e = howmany((sb->fs_old_cpg * sb->fs_old_spc / sb->fs_old_nspf), CHAR_BIT); else e = 0; - for(j=0; jfs_old_nspf) - e=howmany(sb->fs_old_cpg * sb->fs_old_spc / (sb->fs_old_nspf << sb->fs_fragshift), CHAR_BIT); + e = howmany(sb->fs_old_cpg * sb->fs_old_spc / (sb->fs_old_nspf << sb->fs_fragshift), CHAR_BIT); else e = 0; - for(j=0; jfs_contigsumsize; j++) { + ip = (int *)cg_clustersum(cgr); + for (j = 0; j <= sb->fs_contigsumsize; j++) { fprintf(dbg_log, "%02d: %8d\n", j, *ip++); } @@ -651,7 +629,6 @@ dbg_dump_clsum(struct fs *sb, const char * will leave it disabled for now; it should probably be re-enabled * specifically for UFS1. */ -/* **************************************************** dbg_dump_sptbl ***** */ /* * Dump the block summary, and the rotational layout table. */ @@ -661,23 +638,21 @@ dbg_dump_sptbl(struct fs *sb, const char int j,k; int *ip; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START BLOCK SUMMARY AND POSITION TABLE =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment); indent++; - ip=(int *)cg_blktot(cgr); - for(j=0; jfs_old_cpg; j++) { + ip = (int *)cg_blktot(cgr); + for (j = 0; j < sb->fs_old_cpg; j++) { fprintf(dbg_log, "%2d: %5d = ", j, *ip++); - for(k=0; kfs_old_nrpos; k++) { + for (k = 0; k < sb->fs_old_nrpos; k++) { fprintf(dbg_log, "%4d", cg_blks(sb, cgr, j)[k]); - if(kfs_old_nrpos-1) { + if (k < sb->fs_old_nrpos - 1) fprintf(dbg_log, " + "); - } } fprintf(dbg_log, "\n"); } @@ -689,7 +664,6 @@ dbg_dump_sptbl(struct fs *sb, const char } #endif -/* ************************************************** dbg_dump_ufs1_ino ***** */ /* * Dump a UFS1 inode structure. */ @@ -699,9 +673,8 @@ dbg_dump_ufs1_ino(struct fs *sb, const c int ictr; int remaining_blocks; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START UFS1 INODE DUMP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment); @@ -723,25 +696,25 @@ dbg_dump_ufs1_ino(struct fs *sb, const c fprintf(dbg_log, "ctimensec int32_t 0x%08x\n", ino->di_ctimensec); - remaining_blocks=howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */ - for(ictr=0; ictr < MIN(NDADDR, remaining_blocks); ictr++) { + remaining_blocks = howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */ + for (ictr = 0; ictr < MIN(NDADDR, remaining_blocks); ictr++) { fprintf(dbg_log, "db ufs_daddr_t[%x] 0x%08x\n", ictr, ino->di_db[ictr]); } - remaining_blocks-=NDADDR; - if(remaining_blocks>0) { + remaining_blocks -= NDADDR; + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs_daddr_t[0] 0x%08x\n", ino->di_ib[0]); } - remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs1_daddr_t)); - if(remaining_blocks>0) { + remaining_blocks -= howmany(sb->fs_bsize, sizeof(ufs1_daddr_t)); + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs_daddr_t[1] 0x%08x\n", ino->di_ib[1]); } -#define SQUARE(a) ((a)*(a)) - remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs1_daddr_t))); +#define SQUARE(a) ((a) * (a)) + remaining_blocks -= SQUARE(howmany(sb->fs_bsize, sizeof(ufs1_daddr_t))); #undef SQUARE - if(remaining_blocks>0) { + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs_daddr_t[2] 0x%08x\n", ino->di_ib[2]); } @@ -758,7 +731,6 @@ dbg_dump_ufs1_ino(struct fs *sb, const c return; } -/* ************************************************** dbg_dump_ufs2_ino ***** */ /* * Dump a UFS2 inode structure. */ @@ -768,9 +740,8 @@ dbg_dump_ufs2_ino(struct fs *sb, const c int ictr; int remaining_blocks; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START UFS2 INODE DUMP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment); @@ -785,8 +756,8 @@ dbg_dump_ufs2_ino(struct fs *sb, const c ((unsigned int *)&(ino->di_size))[1], ((unsigned int *)&(ino->di_size))[0]); fprintf(dbg_log, "blocks u_int64_t 0x%08x%08x\n", - ((unsigned int *)&(ino->di_blocks))[1], - ((unsigned int *)&(ino->di_blocks))[0]); + ((unsigned int *)&(ino->di_blocks))[1], + ((unsigned int *)&(ino->di_blocks))[0]); fprintf(dbg_log, "atime ufs_time_t %10jd\n", ino->di_atime); fprintf(dbg_log, "mtime ufs_time_t %10jd\n", ino->di_mtime); fprintf(dbg_log, "ctime ufs_time_t %10jd\n", ino->di_ctime); @@ -802,25 +773,25 @@ dbg_dump_ufs2_ino(struct fs *sb, const c /* XXX: What do we do with di_extb[NXADDR]? */ - remaining_blocks=howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */ - for(ictr=0; ictr < MIN(NDADDR, remaining_blocks); ictr++) { + remaining_blocks = howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */ + for (ictr = 0; ictr < MIN(NDADDR, remaining_blocks); ictr++) { fprintf(dbg_log, "db ufs2_daddr_t[%x] 0x%16jx\n", ictr, ino->di_db[ictr]); } - remaining_blocks-=NDADDR; - if(remaining_blocks>0) { + remaining_blocks -= NDADDR; + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs2_daddr_t[0] 0x%16jx\n", ino->di_ib[0]); } - remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs2_daddr_t)); - if(remaining_blocks>0) { + remaining_blocks -= howmany(sb->fs_bsize, sizeof(ufs2_daddr_t)); + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs2_daddr_t[1] 0x%16jx\n", ino->di_ib[1]); } -#define SQUARE(a) ((a)*(a)) - remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs2_daddr_t))); +#define SQUARE(a) ((a) * (a)) + remaining_blocks -= SQUARE(howmany(sb->fs_bsize, sizeof(ufs2_daddr_t))); #undef SQUARE - if(remaining_blocks>0) { + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs2_daddr_t[2] 0x%16jx\n", ino->di_ib[2]); } @@ -831,7 +802,6 @@ dbg_dump_ufs2_ino(struct fs *sb, const c return; } -/* ***************************************************** dbg_dump_iblk ***** */ /* * Dump an indirect block. The iteration to dump a full file has to be * written around. @@ -841,9 +811,8 @@ dbg_dump_iblk(struct fs *sb, const char { unsigned int *mem, i, j, size; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START INDIRECT BLOCK DUMP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)block, @@ -855,14 +824,13 @@ dbg_dump_iblk(struct fs *sb, const char else size = sizeof(ufs2_daddr_t); - mem=(unsigned int *)block; - for (i=0; (size_t)ifs_bsize, size), - length); i+=8) { + mem = (unsigned int *)block; + for (i = 0; (size_t)i < MIN(howmany(sb->fs_bsize, size), length); + i += 8) { fprintf(dbg_log, "%04x: ", i); - for (j=0; j<8; j++) { - if((size_t)(i+j) __FBSDID("$FreeBSD$"); -/* ********************************************************** INCLUDES ***** */ #include #include #include @@ -72,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include "debug.h" -/* *************************************************** GLOBALS & TYPES ***** */ #ifdef FS_DEBUG int _dbg_lvl_ = (DL_INFO); /* DL_TRC */ #endif /* FS_DEBUG */ @@ -117,7 +115,7 @@ union dinode { static ufs2_daddr_t inoblk; /* inode block address */ static char inobuf[MAXBSIZE]; /* inode block */ static ino_t maxino; /* last valid inode */ -static int unlabeled; /* unlabeled partition, e.g. vinum volume etc. */ +static int unlabeled; /* unlabeled partition, e.g. vinum volume */ /* * An array of elements of type struct gfs_bpp describes all blocks to @@ -130,10 +128,9 @@ struct gfs_bpp { #define GFS_FL_FIRST 1 #define GFS_FL_LAST 2 unsigned int flags; /* special handling required */ - int found; /* how many references were updated */ + int found; /* how many references were updated */ }; -/* ******************************************************** PROTOTYPES ***** */ static void growfs(int, int, unsigned int); static void rdfs(ufs2_daddr_t, size_t, void *, int); static void wtfs(ufs2_daddr_t, size_t, void *, int, unsigned int); @@ -158,7 +155,6 @@ static void indirchk(ufs_lbn_t, ufs_lbn_ struct gfs_bpp *, int, int, unsigned int); static void get_dev_size(int, int *); -/* ************************************************************ growfs ***** */ /* * Here we actually start growing the file system. We basically read the * cylinder summary from the first cylinder group as we want to update @@ -174,12 +170,12 @@ static void growfs(int fsi, int fso, unsigned int Nflag) { DBG_FUNC("growfs") - time_t modtime; - uint cylno; - int i, j, width; - char tmpbuf[100]; + time_t modtime; + uint cylno; + int i, j, width; + char tmpbuf[100]; #ifdef FSIRAND - static int randinit=0; + static int randinit=0; DBG_ENTER; @@ -198,37 +194,35 @@ growfs(int fsi, int fso, unsigned int Nf * Get the cylinder summary into the memory. */ fscs = (struct csum *)calloc((size_t)1, (size_t)sblock.fs_cssize); - if(fscs == NULL) { + if (fscs == NULL) errx(1, "calloc failed"); - } for (i = 0; i < osblock.fs_cssize; i += osblock.fs_bsize) { rdfs(fsbtodb(&osblock, osblock.fs_csaddr + numfrags(&osblock, i)), (size_t)MIN(osblock.fs_cssize - i, - osblock.fs_bsize), (void *)(((char *)fscs)+i), fsi); + osblock.fs_bsize), (void *)(((char *)fscs) + i), fsi); } #ifdef FS_DEBUG -{ - struct csum *dbg_csp; - int dbg_csc; - char dbg_line[80]; - - dbg_csp=fscs; - for(dbg_csc=0; dbg_csc= width) { printf("\n"); i = 0; @@ -288,20 +282,18 @@ growfs(int fsi, int fso, unsigned int Nf DBG_PRINT0("fscs written\n"); #ifdef FS_DEBUG -{ - struct csum *dbg_csp; - int dbg_csc; - char dbg_line[80]; - - dbg_csp=fscs; - for(dbg_csc=0; dbg_csc 0) @@ -549,7 +538,6 @@ initcg(int cylno, time_t modtime, int fs return; } -/* ******************************************************* frag_adjust ***** */ /* * Here we add or subtract (sign +1/-1) the available fragments in a given * block to or from the fragment statistics. By subtracting before and adding @@ -570,45 +558,38 @@ frag_adjust(ufs2_daddr_t frag, int sign) * Here frag only needs to point to any fragment in the block we want * to examine. */ - for(f=rounddown(frag, sblock.fs_frag); - ffound++; DBG_PRINT3("scg (%jd->%jd)[%d] reference updated\n", - (intmax_t)f->old, - (intmax_t)f->new, - fragnum); + (intmax_t)f->old, (intmax_t)f->new, fragnum); /* * Copy the block back immediately. @@ -669,7 +648,6 @@ cond_bl_upd(ufs2_daddr_t *block, struct return (0); } -/* ************************************************************ updjcg ***** */ /* * Here we do all needed work for the former last cylinder group. It has to be * changed in any case, even if the file system ended exactly on the end of @@ -685,10 +663,10 @@ static void updjcg(int cylno, time_t modtime, int fsi, int fso, unsigned int Nflag) { DBG_FUNC("updjcg") - ufs2_daddr_t cbase, dmax, dupper; - struct csum *cs; - int i,k; - int j=0; + ufs2_daddr_t cbase, dmax, dupper; + struct csum *cs; + int i, k; + int j = 0; DBG_ENTER; @@ -699,9 +677,7 @@ updjcg(int cylno, time_t modtime, int fs rdfs(fsbtodb(&osblock, cgtod(&osblock, cylno)), (size_t)osblock.fs_cgsize, (void *)&aocg, fsi); DBG_PRINT0("jcg read\n"); - DBG_DUMP_CG(&sblock, - "old joining cg", - &aocg); + DBG_DUMP_CG(&sblock, "old joining cg", &aocg); memcpy((void *)&cgun1, (void *)&cgun2, sizeof(cgun2)); @@ -713,16 +689,14 @@ updjcg(int cylno, time_t modtime, int fs * cylinder group we have to change that value now to fs_cpg. */ - if(cgbase(&osblock, cylno+1) == osblock.fs_size) { + if (cgbase(&osblock, cylno + 1) == osblock.fs_size) { if (sblock.fs_magic == FS_UFS1_MAGIC) acg.cg_old_ncyl=sblock.fs_old_cpg; wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); DBG_PRINT0("jcg written\n"); - DBG_DUMP_CG(&sblock, - "new joining cg", - &acg); + DBG_DUMP_CG(&sblock, "new joining cg", &acg); DBG_LEAVE; return; @@ -736,9 +710,8 @@ updjcg(int cylno, time_t modtime, int fs if (dmax > sblock.fs_size) dmax = sblock.fs_size; dupper = cgdmin(&sblock, cylno) - cbase; - if (cylno == 0) { /* XXX fscs may be relocated */ + if (cylno == 0) /* XXX fscs may be relocated */ dupper += howmany(sblock.fs_cssize, sblock.fs_fsize); - } /* * Set pointer to the cylinder summary for our cylinder group. @@ -760,21 +733,16 @@ updjcg(int cylno, time_t modtime, int fs } else { acg.cg_old_ncyl = sblock.fs_old_cpg; } - DBG_PRINT2("jcg dbg: %d %u", - cylno, - sblock.fs_ncg); + DBG_PRINT2("jcg dbg: %d %u", cylno, sblock.fs_ncg); #ifdef FS_DEBUG if (sblock.fs_magic == FS_UFS1_MAGIC) - DBG_PRINT2("%d %u", - acg.cg_old_ncyl, - sblock.fs_old_cpg); + DBG_PRINT2("%d %u", acg.cg_old_ncyl, sblock.fs_old_cpg); #endif DBG_PRINT0("\n"); acg.cg_ndblk = dmax - cbase; - sblock.fs_dsize += acg.cg_ndblk-aocg.cg_ndblk; - if (sblock.fs_contigsumsize > 0) { + sblock.fs_dsize += acg.cg_ndblk - aocg.cg_ndblk; + if (sblock.fs_contigsumsize > 0) acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag; - } /* * Now we have to update the free fragment bitmap for our new free @@ -788,15 +756,16 @@ updjcg(int cylno, time_t modtime, int fs * Handle the first new block here if it was partially available * before. */ - if(osblock.fs_size % sblock.fs_frag) { - if(roundup(osblock.fs_size, sblock.fs_frag)<=sblock.fs_size) { + if (osblock.fs_size % sblock.fs_frag) { + if (roundup(osblock.fs_size, sblock.fs_frag) <= + sblock.fs_size) { /* * The new space is enough to fill at least this * block */ - j=0; - for(i=roundup(osblock.fs_size-cbase, sblock.fs_frag)-1; - i>=osblock.fs_size-cbase; + j = 0; + for (i = roundup(osblock.fs_size - cbase, + sblock.fs_frag) - 1; i >= osblock.fs_size - cbase; i--) { setbit(cg_blksfree(&acg), i); acg.cg_cs.cs_nffree++; @@ -808,44 +777,43 @@ updjcg(int cylno, time_t modtime, int fs * already existing fragment at the former end of the * file system. */ - if(isblock(&sblock, cg_blksfree(&acg), - ((osblock.fs_size - cgbase(&sblock, cylno))/ - sblock.fs_frag))) { + if (isblock(&sblock, cg_blksfree(&acg), + ((osblock.fs_size - cgbase(&sblock, cylno)) / + sblock.fs_frag))) { /* * The block is now completely available. */ DBG_PRINT0("block was\n"); - acg.cg_frsum[osblock.fs_size%sblock.fs_frag]--; + acg.cg_frsum[osblock.fs_size % sblock.fs_frag]--; acg.cg_cs.cs_nbfree++; - acg.cg_cs.cs_nffree-=sblock.fs_frag; - k=rounddown(osblock.fs_size-cbase, + acg.cg_cs.cs_nffree -= sblock.fs_frag; + k = rounddown(osblock.fs_size - cbase, + sblock.fs_frag); + updclst((osblock.fs_size - cbase) / sblock.fs_frag); - updclst((osblock.fs_size-cbase)/sblock.fs_frag); } else { /* * Lets rejoin a possible partially growed * fragment. */ - k=0; - while(isset(cg_blksfree(&acg), i) && - (i>=rounddown(osblock.fs_size-cbase, + k = 0; + while (isset(cg_blksfree(&acg), i) && + (i >= rounddown(osblock.fs_size - cbase, sblock.fs_frag))) { i--; k++; } - if(k) { + if (k) acg.cg_frsum[k]--; - } - acg.cg_frsum[k+j]++; + acg.cg_frsum[k + j]++; } } else { /* * We only grow by some fragments within this last * block. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 19:01:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C3BA61065677; Sat, 23 Jun 2012 19:01:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACDD18FC1D; Sat, 23 Jun 2012 19:01:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NJ1gKu058843; Sat, 23 Jun 2012 19:01:42 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NJ1gbu058841; Sat, 23 Jun 2012 19:01:42 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231901.q5NJ1gbu058841@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 19:01:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237498 - stable/9/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 19:01:42 -0000 Author: trasz Date: Sat Jun 23 19:01:42 2012 New Revision: 237498 URL: http://svn.freebsd.org/changeset/base/237498 Log: MFC r233656: Remove disklabel handling code from growfs. This should be done via geom_part(4), and it doesn't belong in growfs anyway. Reviewed by: kib, mckusick Sponsored by: The FreeBSD Foundation Modified: stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/growfs.c ============================================================================== --- stable/9/sbin/growfs/growfs.c Sat Jun 23 18:58:02 2012 (r237497) +++ stable/9/sbin/growfs/growfs.c Sat Jun 23 19:01:42 2012 (r237498) @@ -50,7 +50,6 @@ All rights reserved.\n"; __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -115,7 +114,6 @@ union dinode { static ufs2_daddr_t inoblk; /* inode block address */ static char inobuf[MAXBSIZE]; /* inode block */ static ino_t maxino; /* last valid inode */ -static int unlabeled; /* unlabeled partition, e.g. vinum volume */ /* * An array of elements of type struct gfs_bpp describes all blocks to @@ -143,8 +141,6 @@ static void setblock(struct fs *, unsign static void initcg(int, time_t, int, unsigned int); static void updjcg(int, time_t, int, int, unsigned int); static void updcsloc(time_t, int, int, unsigned int); -static struct disklabel *get_disklabel(int); -static void return_disklabel(int, struct disklabel *, unsigned int); static union dinode *ginode(ino_t, int, int); static void frag_adjust(ufs2_daddr_t, int); static int cond_bl_upd(ufs2_daddr_t *, struct gfs_bpp *, int, int, @@ -1814,8 +1810,7 @@ charsperline(void) } /* - * Get the size of the partition if we can't figure it out from the disklabel, - * e.g. from vinum volumes. + * Get the size of the partition. */ static void get_dev_size(int fd, int *size) @@ -1841,8 +1836,7 @@ get_dev_size(int fd, int *size) * and it does some basic checkings. The old file system size is determined * and after some more checks like we can really access the new last block * on the disk etc. we calculate the new parameters for the superblock. After - * having done this we just call growfs() which will do the work. Before - * we finish the only thing left is to update the disklabel. + * having done this we just call growfs() which will do the work. * We still have to provide support for snapshots. Therefore we first have to * understand what data structures are always replicated in the snapshot on * creation, for all other blocks we touch during our procedure, we have to @@ -1860,15 +1854,13 @@ int main(int argc, char **argv) { DBG_FUNC("main") - char *device, *special, *cp; + char *device, *special; int ch; unsigned int size = 0; size_t len; unsigned int Nflag = 0; int ExpertFlag = 0; struct stat st; - struct disklabel *lp; - struct partition *pp; int i, fsi, fso; u_int32_t p_size; char reply[5]; @@ -1960,24 +1952,11 @@ main(int argc, char **argv) err(1, "%s", device); /* - * Try to read a label and guess the slice if not specified. This - * code should guess the right thing and avoid to bother the user - * with the task of specifying the option -v on vinum volumes. - */ - cp = device + strlen(device) - 1; - lp = get_disklabel(fsi); - pp = NULL; - if (lp != NULL) { - if (isdigit(*cp)) - pp = &lp->d_partitions[2]; - else if (*cp>='a' && *cp<='h') - pp = &lp->d_partitions[*cp - 'a']; - else - errx(1, "unknown device"); - p_size = pp->p_size; - } else { - get_dev_size(fsi, &p_size); - } + * Try to guess the slice if not specified. This code should guess + * the right thing and avoid to bother the user with the task + * of specifying the option -v on vinum volumes. + */ + get_dev_size(fsi, &p_size); /* * Check if that partition is suitable for growing a file system. @@ -2007,8 +1986,7 @@ main(int argc, char **argv) DBG_DUMP_FS(&sblock, "old sblock"); /* - * Determine size to grow to. Default to the full size specified in - * the disk label. + * Determine size to grow to. Default to the device size. */ sblock.fs_size = dbtofsb(&osblock, p_size); if (size != 0) { @@ -2068,7 +2046,7 @@ main(int argc, char **argv) /* * Now calculate new superblock values and check for reasonable * bound for new file system size: - * fs_size: is derived from label or user input + * fs_size: is derived from user input * fs_dsize: should get updated in the routines creating or * updating the cylinder groups on the fly * fs_cstotal: should get updated in the routines creating or @@ -2120,18 +2098,6 @@ main(int argc, char **argv) */ growfs(fsi, fso, Nflag); - /* - * Update the disk label. - */ - if (!unlabeled) { - pp->p_fsize = sblock.fs_fsize; - pp->p_frag = sblock.fs_frag; - pp->p_cpg = sblock.fs_fpg; - - return_disklabel(fso, lp, Nflag); - DBG_PRINT0("label rewritten\n"); - } - close(fsi); if (fso > -1) close(fso); @@ -2143,68 +2109,6 @@ main(int argc, char **argv) } /* - * Write the updated disklabel back to disk. - */ -static void -return_disklabel(int fd, struct disklabel *lp, unsigned int Nflag) -{ - DBG_FUNC("return_disklabel") - u_short sum; - u_short *ptr; - - DBG_ENTER; - - if (!lp) { - DBG_LEAVE; - return; - } - if (!Nflag) { - lp->d_checksum = 0; - sum = 0; - ptr = (u_short *)lp; - - /* - * recalculate checksum - */ - while (ptr < (u_short *)&lp->d_partitions[lp->d_npartitions]) - sum ^= *ptr++; - lp->d_checksum=sum; - - if (ioctl(fd, DIOCWDINFO, (char *)lp) < 0) - errx(1, "DIOCWDINFO failed"); - } - free(lp); - - DBG_LEAVE; - return ; -} - -/* - * Read the disklabel from disk. - */ -static struct disklabel * -get_disklabel(int fd) -{ - DBG_FUNC("get_disklabel") - static struct disklabel *lab; - - DBG_ENTER; - - lab = (struct disklabel *)malloc(sizeof(struct disklabel)); - if (!lab) - errx(1, "malloc failed"); - - if (!ioctl(fd, DIOCGDINFO, (char *)lab)) - return (lab); - - unlabeled++; - - DBG_LEAVE; - return (NULL); -} - - -/* * Dump a line of usage. */ static void From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 19:03:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C4AC1065675; Sat, 23 Jun 2012 19:03:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 057EF8FC17; Sat, 23 Jun 2012 19:03:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NJ3gx1058973; Sat, 23 Jun 2012 19:03:42 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NJ3gxf058971; Sat, 23 Jun 2012 19:03:42 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231903.q5NJ3gxf058971@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 19:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237499 - stable/9/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 19:03:43 -0000 Author: trasz Date: Sat Jun 23 19:03:42 2012 New Revision: 237499 URL: http://svn.freebsd.org/changeset/base/237499 Log: MFC r234178: Remove block reallocation used to make room for the cylinder group summary structure. From now on, when there is no room for it, we simply allocate new one in a newly added cylinder group. This patch removes a conditional in updcsloc(), reindents some code there, and removes unused routines. I decided to do it this way instead of disabling reallocation when the filesystem is live and leaving it as it is otherwise, because this allows for removal of lots of complicated and hard to test code. Also, conditionally disabling it would result in a different layout in filesystems resized online and offline, which would look somewhat weird. Reviewed by: mckusick No objections from: kib Sponsored by: The FreeBSD Foundation Modified: stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/growfs.c ============================================================================== --- stable/9/sbin/growfs/growfs.c Sat Jun 23 19:01:42 2012 (r237498) +++ stable/9/sbin/growfs/growfs.c Sat Jun 23 19:03:42 2012 (r237499) @@ -94,45 +94,11 @@ static union { #define acg cgun1.cg /* a cylinder cgroup (new) */ #define aocg cgun2.cg /* an old cylinder group */ -static char ablk[MAXBSIZE]; /* a block */ - static struct csum *fscs; /* cylinder summary */ -union dinode { - struct ufs1_dinode dp1; - struct ufs2_dinode dp2; -}; -#define DIP(dp, field) \ - ((sblock.fs_magic == FS_UFS1_MAGIC) ? \ - (uint32_t)(dp)->dp1.field : (dp)->dp2.field) -#define DIP_SET(dp, field, val) do { \ - if (sblock.fs_magic == FS_UFS1_MAGIC) \ - (dp)->dp1.field = (val); \ - else \ - (dp)->dp2.field = (val); \ - } while (0) -static ufs2_daddr_t inoblk; /* inode block address */ -static char inobuf[MAXBSIZE]; /* inode block */ -static ino_t maxino; /* last valid inode */ - -/* - * An array of elements of type struct gfs_bpp describes all blocks to - * be relocated in order to free the space needed for the cylinder group - * summary for all cylinder groups located in the first cylinder group. - */ -struct gfs_bpp { - ufs2_daddr_t old; /* old block number */ - ufs2_daddr_t new; /* new block number */ -#define GFS_FL_FIRST 1 -#define GFS_FL_LAST 2 - unsigned int flags; /* special handling required */ - int found; /* how many references were updated */ -}; - static void growfs(int, int, unsigned int); static void rdfs(ufs2_daddr_t, size_t, void *, int); static void wtfs(ufs2_daddr_t, size_t, void *, int, unsigned int); -static ufs2_daddr_t alloc(void); static int charsperline(void); static void usage(void); static int isblock(struct fs *, unsigned char *, int); @@ -141,14 +107,8 @@ static void setblock(struct fs *, unsign static void initcg(int, time_t, int, unsigned int); static void updjcg(int, time_t, int, int, unsigned int); static void updcsloc(time_t, int, int, unsigned int); -static union dinode *ginode(ino_t, int, int); static void frag_adjust(ufs2_daddr_t, int); -static int cond_bl_upd(ufs2_daddr_t *, struct gfs_bpp *, int, int, - unsigned int); static void updclst(int); -static void updrefs(int, ino_t, struct gfs_bpp *, int, int, unsigned int); -static void indirchk(ufs_lbn_t, ufs_lbn_t, ufs2_daddr_t, ufs_lbn_t, - struct gfs_bpp *, int, int, unsigned int); static void get_dev_size(int, int *); /* @@ -587,64 +547,6 @@ frag_adjust(ufs2_daddr_t frag, int sign) } /* - * Here we conditionally update a pointer to a fragment. We check for all - * relocated blocks if any of its fragments is referenced by the current - * field, and update the pointer to the respective fragment in our new - * block. If we find a reference we write back the block immediately, - * as there is no easy way for our general block reading engine to figure - * out if a write back operation is needed. - */ -static int -cond_bl_upd(ufs2_daddr_t *block, struct gfs_bpp *field, int fsi, int fso, - unsigned int Nflag) -{ - DBG_FUNC("cond_bl_upd") - struct gfs_bpp *f; - ufs2_daddr_t src, dst; - int fragnum; - void *ibuf; - - DBG_ENTER; - - for (f = field; f->old != 0; f++) { - src = *block; - if (fragstoblks(&sblock, src) != f->old) - continue; - /* - * The fragment is part of the block, so update. - */ - dst = blkstofrags(&sblock, f->new); - fragnum = fragnum(&sblock, src); - *block = dst + fragnum; - f->found++; - DBG_PRINT3("scg (%jd->%jd)[%d] reference updated\n", - (intmax_t)f->old, (intmax_t)f->new, fragnum); - - /* - * Copy the block back immediately. - * - * XXX If src is from an indirect block we have - * to implement copy on write here in case of - * active snapshots. - */ - ibuf = malloc(sblock.fs_bsize); - if (!ibuf) - errx(1, "malloc failed"); - src -= fragnum; - rdfs(fsbtodb(&sblock, src), (size_t)sblock.fs_bsize, ibuf, fsi); - wtfs(dst, (size_t)sblock.fs_bsize, ibuf, fso, Nflag); - free(ibuf); - /* - * The same block can't be found again in this loop. - */ - return (1); - } - - DBG_LEAVE; - return (0); -} - -/* * Here we do all needed work for the former last cylinder group. It has to be * changed in any case, even if the file system ended exactly on the end of * this group, as there is some slightly inconsistent handling of the number @@ -890,11 +792,8 @@ updjcg(int cylno, time_t modtime, int fs * longer in the beginning of the first cylinder group you should never * use a version of fsck which is not aware of the possibility to have * this structure in a non standard place. - * Option (1) is considered to be less intrusive to the structure of the file- - * system. So we try to stick to that whenever possible. If there is not enough - * space in the cylinder group containing the cylinder summary we have to use - * method (2). In case of active snapshots in the file system we probably can - * completely avoid implementing copy on write if we stick to method (2) only. + * Option (2) is considered to be less intrusive to the structure of the file- + * system, so that's the one being used. */ static void updcsloc(time_t modtime, int fsi, int fso, unsigned int Nflag) @@ -903,11 +802,7 @@ updcsloc(time_t modtime, int fsi, int fs struct csum *cs; int ocscg, ncscg; int blocks; - ufs2_daddr_t cbase, dupper, odupper, d, f, g; - int ind, inc; - uint cylno; - struct gfs_bpp *bp; - int i, l; + ufs2_daddr_t d; int lcs = 0; int block; @@ -951,117 +846,86 @@ updcsloc(time_t modtime, int fsi, int fs * also up to 8*3 blocks for indirect blocks for all possible * references. */ - if (/*((int)sblock.fs_time&0x3)>0||*/ cs->cs_nbfree < blocks) { - /* - * There is not enough space in the old cylinder group to - * relocate all blocks as needed, so we relocate the whole - * cylinder group summary to a new group. We try to use the - * first complete new cylinder group just created. Within the - * cylinder group we align the area immediately after the - * cylinder group information location in order to be as - * close as possible to the original implementation of ffs. - * - * First we have to make sure we'll find enough space in the - * new cylinder group. If not, then we currently give up. - * We start with freeing everything which was used by the - * fragments of the old cylinder summary in the current group. - * Now we write back the group meta data, read in the needed - * meta data from the new cylinder group, and start allocating - * within that group. Here we can assume, the group to be - * completely empty. Which makes the handling of fragments and - * clusters a lot easier. - */ - DBG_TRC; - if (sblock.fs_ncg - osblock.fs_ncg < 2) - errx(2, "panic: not enough space"); + /* + * There is not enough space in the old cylinder group to + * relocate all blocks as needed, so we relocate the whole + * cylinder group summary to a new group. We try to use the + * first complete new cylinder group just created. Within the + * cylinder group we align the area immediately after the + * cylinder group information location in order to be as + * close as possible to the original implementation of ffs. + * + * First we have to make sure we'll find enough space in the + * new cylinder group. If not, then we currently give up. + * We start with freeing everything which was used by the + * fragments of the old cylinder summary in the current group. + * Now we write back the group meta data, read in the needed + * meta data from the new cylinder group, and start allocating + * within that group. Here we can assume, the group to be + * completely empty. Which makes the handling of fragments and + * clusters a lot easier. + */ + DBG_TRC; + if (sblock.fs_ncg - osblock.fs_ncg < 2) + errx(2, "panic: not enough space"); - /* - * Point "d" to the first fragment not used by the cylinder - * summary. - */ - d = osblock.fs_csaddr + (osblock.fs_cssize / osblock.fs_fsize); + /* + * Point "d" to the first fragment not used by the cylinder + * summary. + */ + d = osblock.fs_csaddr + (osblock.fs_cssize / osblock.fs_fsize); - /* - * Set up last cluster size ("lcs") already here. Calculate - * the size for the trailing cluster just behind where "d" - * points to. - */ - if (sblock.fs_contigsumsize > 0) { - for (block = howmany(d % sblock.fs_fpg, sblock.fs_frag), - lcs = 0; lcs < sblock.fs_contigsumsize; - block++, lcs++) { - if (isclr(cg_clustersfree(&acg), block)) - break; - } + /* + * Set up last cluster size ("lcs") already here. Calculate + * the size for the trailing cluster just behind where "d" + * points to. + */ + if (sblock.fs_contigsumsize > 0) { + for (block = howmany(d % sblock.fs_fpg, sblock.fs_frag), + lcs = 0; lcs < sblock.fs_contigsumsize; + block++, lcs++) { + if (isclr(cg_clustersfree(&acg), block)) + break; } + } + /* + * Point "d" to the last frag used by the cylinder summary. + */ + d--; + + DBG_PRINT1("d=%jd\n", (intmax_t)d); + if ((d + 1) % sblock.fs_frag) { /* - * Point "d" to the last frag used by the cylinder summary. + * The end of the cylinder summary is not a complete + * block. */ - d--; - - DBG_PRINT1("d=%jd\n", (intmax_t)d); - if ((d + 1) % sblock.fs_frag) { - /* - * The end of the cylinder summary is not a complete - * block. - */ - DBG_TRC; - frag_adjust(d % sblock.fs_fpg, -1); - for (; (d + 1) % sblock.fs_frag; d--) { - DBG_PRINT1("d=%jd\n", (intmax_t)d); - setbit(cg_blksfree(&acg), d % sblock.fs_fpg); - acg.cg_cs.cs_nffree++; - sblock.fs_cstotal.cs_nffree++; - } - /* - * Point "d" to the last fragment of the last - * (incomplete) block of the cylinder summary. - */ - d++; - frag_adjust(d%sblock.fs_fpg, 1); - - if (isblock(&sblock, cg_blksfree(&acg), - (d % sblock.fs_fpg) / sblock.fs_frag)) { - DBG_PRINT1("d=%jd\n", (intmax_t)d); - acg.cg_cs.cs_nffree -= sblock.fs_frag; - acg.cg_cs.cs_nbfree++; - sblock.fs_cstotal.cs_nffree -= sblock.fs_frag; - sblock.fs_cstotal.cs_nbfree++; - if (sblock.fs_contigsumsize > 0) { - setbit(cg_clustersfree(&acg), - (d % sblock.fs_fpg) / - sblock.fs_frag); - if (lcs < sblock.fs_contigsumsize) { - if (lcs) - cg_clustersum(&acg)[lcs]--; - lcs++; - cg_clustersum(&acg)[lcs]++; - } - } - } - /* - * Point "d" to the first fragment of the block before - * the last incomplete block. - */ - d--; + DBG_TRC; + frag_adjust(d % sblock.fs_fpg, -1); + for (; (d + 1) % sblock.fs_frag; d--) { + DBG_PRINT1("d=%jd\n", (intmax_t)d); + setbit(cg_blksfree(&acg), d % sblock.fs_fpg); + acg.cg_cs.cs_nffree++; + sblock.fs_cstotal.cs_nffree++; } + /* + * Point "d" to the last fragment of the last + * (incomplete) block of the cylinder summary. + */ + d++; + frag_adjust(d%sblock.fs_fpg, 1); - DBG_PRINT1("d=%jd\n", (intmax_t)d); - for (d = rounddown(d, sblock.fs_frag); d >= osblock.fs_csaddr; - d -= sblock.fs_frag) { - DBG_TRC; + if (isblock(&sblock, cg_blksfree(&acg), + (d % sblock.fs_fpg) / sblock.fs_frag)) { DBG_PRINT1("d=%jd\n", (intmax_t)d); - setblock(&sblock, cg_blksfree(&acg), - (d % sblock.fs_fpg) / sblock.fs_frag); + acg.cg_cs.cs_nffree -= sblock.fs_frag; acg.cg_cs.cs_nbfree++; + sblock.fs_cstotal.cs_nffree -= sblock.fs_frag; sblock.fs_cstotal.cs_nbfree++; if (sblock.fs_contigsumsize > 0) { setbit(cg_clustersfree(&acg), - (d % sblock.fs_fpg) / sblock.fs_frag); - /* - * The last cluster size is already set up. - */ + (d % sblock.fs_fpg) / + sblock.fs_frag); if (lcs < sblock.fs_contigsumsize) { if (lcs) cg_clustersum(&acg)[lcs]--; @@ -1070,392 +934,138 @@ updcsloc(time_t modtime, int fsi, int fs } } } - *cs = acg.cg_cs; - /* - * Now write the former cylinder group containing the cylinder - * summary back to disk. + * Point "d" to the first fragment of the block before + * the last incomplete block. */ - wtfs(fsbtodb(&sblock, cgtod(&sblock, ocscg)), - (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); - DBG_PRINT0("oscg written\n"); - DBG_DUMP_CG(&sblock, "old summary cg", &acg); - - /* - * Find the beginning of the new cylinder group containing the - * cylinder summary. - */ - sblock.fs_csaddr = cgdmin(&sblock, osblock.fs_ncg); - ncscg = dtog(&sblock, sblock.fs_csaddr); - cs = fscs + ncscg; - - /* - * If Nflag is specified, we would now read random data instead - * of an empty cg structure from disk. So we can't simulate that - * part for now. - */ - if (Nflag) { - DBG_PRINT0("nscg update skipped\n"); - DBG_LEAVE; - return; - } - - /* - * Read the future cylinder group containing the cylinder - * summary from disk, and make a copy. - */ - rdfs(fsbtodb(&sblock, cgtod(&sblock, ncscg)), - (size_t)sblock.fs_cgsize, (void *)&aocg, fsi); - DBG_PRINT0("nscg read\n"); - DBG_DUMP_CG(&sblock, "new summary cg", &aocg); - - memcpy((void *)&cgun1, (void *)&cgun2, sizeof(cgun2)); + d--; + } - /* - * Allocate all complete blocks used by the new cylinder - * summary. - */ - for (d = sblock.fs_csaddr; d + sblock.fs_frag <= - sblock.fs_csaddr + (sblock.fs_cssize / sblock.fs_fsize); - d += sblock.fs_frag) { - clrblock(&sblock, cg_blksfree(&acg), + DBG_PRINT1("d=%jd\n", (intmax_t)d); + for (d = rounddown(d, sblock.fs_frag); d >= osblock.fs_csaddr; + d -= sblock.fs_frag) { + DBG_TRC; + DBG_PRINT1("d=%jd\n", (intmax_t)d); + setblock(&sblock, cg_blksfree(&acg), + (d % sblock.fs_fpg) / sblock.fs_frag); + acg.cg_cs.cs_nbfree++; + sblock.fs_cstotal.cs_nbfree++; + if (sblock.fs_contigsumsize > 0) { + setbit(cg_clustersfree(&acg), (d % sblock.fs_fpg) / sblock.fs_frag); - acg.cg_cs.cs_nbfree--; - sblock.fs_cstotal.cs_nbfree--; - if (sblock.fs_contigsumsize > 0) { - clrbit(cg_clustersfree(&acg), - (d % sblock.fs_fpg) / sblock.fs_frag); - } - } - - /* - * Allocate all fragments used by the cylinder summary in the - * last block. - */ - if (d < - sblock.fs_csaddr + (sblock.fs_cssize / sblock.fs_fsize)) { - for (; d - sblock.fs_csaddr < - sblock.fs_cssize/sblock.fs_fsize; d++) { - clrbit(cg_blksfree(&acg), d % sblock.fs_fpg); - acg.cg_cs.cs_nffree--; - sblock.fs_cstotal.cs_nffree--; + /* + * The last cluster size is already set up. + */ + if (lcs < sblock.fs_contigsumsize) { + if (lcs) + cg_clustersum(&acg)[lcs]--; + lcs++; + cg_clustersum(&acg)[lcs]++; } - acg.cg_cs.cs_nbfree--; - acg.cg_cs.cs_nffree += sblock.fs_frag; - sblock.fs_cstotal.cs_nbfree--; - sblock.fs_cstotal.cs_nffree += sblock.fs_frag; - if (sblock.fs_contigsumsize > 0) - clrbit(cg_clustersfree(&acg), - (d % sblock.fs_fpg) / sblock.fs_frag); - - frag_adjust(d % sblock.fs_fpg, 1); } - /* - * XXX Handle the cluster statistics here in the case this - * cylinder group is now almost full, and the remaining - * space is less then the maximum cluster size. This is - * probably not needed, as you would hardly find a file - * system which has only MAXCSBUFS+FS_MAXCONTIG of free - * space right behind the cylinder group information in - * any new cylinder group. - */ - - /* - * Update our statistics in the cylinder summary. - */ - *cs = acg.cg_cs; - - /* - * Write the new cylinder group containing the cylinder summary - * back to disk. - */ - wtfs(fsbtodb(&sblock, cgtod(&sblock, ncscg)), - (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); - DBG_PRINT0("nscg written\n"); - DBG_DUMP_CG(&sblock, "new summary cg", &acg); - - DBG_LEAVE; - return; } - /* - * We have got enough of space in the current cylinder group, so we - * can relocate just a few blocks, and let the summary information - * grow in place where it is right now. - */ - DBG_TRC; - - cbase = cgbase(&osblock, ocscg); /* old and new are equal */ - dupper = sblock.fs_csaddr - cbase + - howmany(sblock.fs_cssize, sblock.fs_fsize); - odupper = osblock.fs_csaddr - cbase + - howmany(osblock.fs_cssize, osblock.fs_fsize); - - sblock.fs_dsize -= dupper - odupper; + *cs = acg.cg_cs; /* - * Allocate the space for the array of blocks to be relocated. + * Now write the former cylinder group containing the cylinder + * summary back to disk. */ - bp = (struct gfs_bpp *)malloc(((dupper - odupper) / - sblock.fs_frag + 2) * sizeof(struct gfs_bpp)); - if (bp == NULL) - errx(1, "malloc failed"); - memset((char *)bp, 0, ((dupper - odupper) / sblock.fs_frag + 2) * - sizeof(struct gfs_bpp)); + wtfs(fsbtodb(&sblock, cgtod(&sblock, ocscg)), + (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); + DBG_PRINT0("oscg written\n"); + DBG_DUMP_CG(&sblock, "old summary cg", &acg); /* - * Lock all new frags needed for the cylinder group summary. This is - * done per fragment in the first and last block of the new required - * area, and per block for all other blocks. - * - * Handle the first new block here (but only if some fragments where - * already used for the cylinder summary). + * Find the beginning of the new cylinder group containing the + * cylinder summary. */ - ind = 0; - frag_adjust(odupper, -1); - for (d = odupper; ((d < dupper) && (d % sblock.fs_frag)); d++) { - DBG_PRINT1("scg first frag check loop d=%jd\n", (intmax_t)d); - if (isclr(cg_blksfree(&acg), d)) { - if (!ind) { - bp[ind].old = d / sblock.fs_frag; - bp[ind].flags |= GFS_FL_FIRST; - if (roundup(d, sblock.fs_frag) >= dupper) - bp[ind].flags |= GFS_FL_LAST; - ind++; - } - } else { - clrbit(cg_blksfree(&acg), d); - acg.cg_cs.cs_nffree--; - sblock.fs_cstotal.cs_nffree--; - } - /* - * No cluster handling is needed here, as there was at least - * one fragment in use by the cylinder summary in the old - * file system. - * No block-free counter handling here as this block was not - * a free block. - */ - } - frag_adjust(odupper, 1); + sblock.fs_csaddr = cgdmin(&sblock, osblock.fs_ncg); + ncscg = dtog(&sblock, sblock.fs_csaddr); + cs = fscs + ncscg; /* - * Handle all needed complete blocks here. + * If Nflag is specified, we would now read random data instead + * of an empty cg structure from disk. So we can't simulate that + * part for now. */ - for (; d + sblock.fs_frag <= dupper; d += sblock.fs_frag) { - DBG_PRINT1("scg block check loop d=%jd\n", (intmax_t)d); - if (!isblock(&sblock, cg_blksfree(&acg), d / sblock.fs_frag)) { - for (f = d; f < d + sblock.fs_frag; f++) { - if (isset(cg_blksfree(&aocg), f)) { - acg.cg_cs.cs_nffree--; - sblock.fs_cstotal.cs_nffree--; - } - } - clrblock(&sblock, cg_blksfree(&acg), d / sblock.fs_frag); - bp[ind].old = d / sblock.fs_frag; - ind++; - } else { - clrblock(&sblock, cg_blksfree(&acg), d / sblock.fs_frag); - acg.cg_cs.cs_nbfree--; - sblock.fs_cstotal.cs_nbfree--; - if (sblock.fs_contigsumsize > 0) { - clrbit(cg_clustersfree(&acg), d / sblock.fs_frag); - for (lcs = 0, l = (d / sblock.fs_frag) + 1; - lcs < sblock.fs_contigsumsize; l++, lcs++ ) { - if (isclr(cg_clustersfree(&acg), l)) - break; - } - if (lcs < sblock.fs_contigsumsize) { - cg_clustersum(&acg)[lcs + 1]--; - if (lcs) - cg_clustersum(&acg)[lcs]++; - } - } - } - /* - * No fragment counter handling is needed here, as this finally - * doesn't change after the relocation. - */ + if (Nflag) { + DBG_PRINT0("nscg update skipped\n"); + DBG_LEAVE; + return; } /* - * Handle all fragments needed in the last new affected block. + * Read the future cylinder group containing the cylinder + * summary from disk, and make a copy. */ - if (d < dupper) { - frag_adjust(dupper - 1, -1); + rdfs(fsbtodb(&sblock, cgtod(&sblock, ncscg)), + (size_t)sblock.fs_cgsize, (void *)&aocg, fsi); + DBG_PRINT0("nscg read\n"); + DBG_DUMP_CG(&sblock, "new summary cg", &aocg); - if (isblock(&sblock, cg_blksfree(&acg), d / sblock.fs_frag)) { - acg.cg_cs.cs_nbfree--; - sblock.fs_cstotal.cs_nbfree--; - acg.cg_cs.cs_nffree += sblock.fs_frag; - sblock.fs_cstotal.cs_nffree += sblock.fs_frag; - if (sblock.fs_contigsumsize > 0) { - clrbit(cg_clustersfree(&acg), d / sblock.fs_frag); - for (lcs = 0, l =(d / sblock.fs_frag) + 1; - lcs < sblock.fs_contigsumsize; l++, lcs++ ) { - if (isclr(cg_clustersfree(&acg),l)) - break; - } - if (lcs < sblock.fs_contigsumsize) { - cg_clustersum(&acg)[lcs + 1]--; - if (lcs) - cg_clustersum(&acg)[lcs]++; - } - } - } + memcpy((void *)&cgun1, (void *)&cgun2, sizeof(cgun2)); - for (; d < dupper; d++) { - DBG_PRINT1("scg second frag check loop d=%jd\n", - (intmax_t)d); - if (isclr(cg_blksfree(&acg), d)) { - bp[ind].old = d / sblock.fs_frag; - bp[ind].flags |= GFS_FL_LAST; - } else { - clrbit(cg_blksfree(&acg), d); - acg.cg_cs.cs_nffree--; - sblock.fs_cstotal.cs_nffree--; - } + /* + * Allocate all complete blocks used by the new cylinder + * summary. + */ + for (d = sblock.fs_csaddr; d + sblock.fs_frag <= + sblock.fs_csaddr + (sblock.fs_cssize / sblock.fs_fsize); + d += sblock.fs_frag) { + clrblock(&sblock, cg_blksfree(&acg), + (d % sblock.fs_fpg) / sblock.fs_frag); + acg.cg_cs.cs_nbfree--; + sblock.fs_cstotal.cs_nbfree--; + if (sblock.fs_contigsumsize > 0) { + clrbit(cg_clustersfree(&acg), + (d % sblock.fs_fpg) / sblock.fs_frag); } - if (bp[ind].flags & GFS_FL_LAST) /* we have to advance here */ - ind++; - frag_adjust(dupper - 1, 1); } /* - * If we found a block to relocate just do so. + * Allocate all fragments used by the cylinder summary in the + * last block. */ - if (ind) { - for (i = 0; i < ind; i++) { - if (!bp[i].old) { /* no more blocks listed */ - /* - * XXX A relative blocknumber should not be - * zero, which is not explicitly - * guaranteed by our code. - */ - break; - } - /* - * Allocate a complete block in the same (current) - * cylinder group. - */ - bp[i].new = alloc() / sblock.fs_frag; - - /* - * There is no frag_adjust() needed for the new block - * as it will have no fragments yet :-). - */ - for (f = bp[i].old * sblock.fs_frag, - g = bp[i].new * sblock.fs_frag; - f < (bp[i].old + 1) * sblock.fs_frag; - f++, g++) { - if (isset(cg_blksfree(&aocg), f)) { - setbit(cg_blksfree(&acg), g); - acg.cg_cs.cs_nffree++; - sblock.fs_cstotal.cs_nffree++; - } - } - - /* - * Special handling is required if this was the first - * block. We have to consider the fragments which were - * used by the cylinder summary in the original block - * which re to be free in the copy of our block. We - * have to be careful if this first block happens to - * be also the last block to be relocated. - */ - if (bp[i].flags & GFS_FL_FIRST) { - for (f = bp[i].old * sblock.fs_frag, - g =bp[i].new * sblock.fs_frag; - f < odupper; f++, g++) { - setbit(cg_blksfree(&acg), g); - acg.cg_cs.cs_nffree++; - sblock.fs_cstotal.cs_nffree++; - } - if (!(bp[i].flags & GFS_FL_LAST)) - frag_adjust(bp[i].new * sblock.fs_frag, 1); - } - - /* - * Special handling is required if this is the last - * block to be relocated. - */ - if (bp[i].flags & GFS_FL_LAST) { - frag_adjust(bp[i].new * sblock.fs_frag, 1); - frag_adjust(bp[i].old * sblock.fs_frag, -1); - for (f = dupper; - f < roundup(dupper, sblock.fs_frag); f++) { - if (isclr(cg_blksfree(&acg), f)) { - setbit(cg_blksfree(&acg), f); - acg.cg_cs.cs_nffree++; - sblock.fs_cstotal.cs_nffree++; - } - } - frag_adjust(bp[i].old * sblock.fs_frag, 1); - } - - /* - * !!! Attach the cylindergroup offset here. - */ - bp[i].old += cbase / sblock.fs_frag; - bp[i].new += cbase / sblock.fs_frag; - - /* - * Copy the content of the block. - */ - /* - * XXX Here we will have to implement a copy on write - * in the case we have any active snapshots. - */ - rdfs(fsbtodb(&sblock, bp[i].old * sblock.fs_frag), - (size_t)sblock.fs_bsize, (void *)&ablk, fsi); - wtfs(fsbtodb(&sblock, bp[i].new * sblock.fs_frag), - (size_t)sblock.fs_bsize, (void *)&ablk, fso, Nflag); - DBG_DUMP_HEX(&sblock, "copied full block", - (unsigned char *)&ablk); - DBG_PRINT2("scg (%jd->%jd) block relocated\n", - (intmax_t)bp[i].old, (intmax_t)bp[i].new); - } - - /* - * Now we have to update all references to any fragment which - * belongs to any block relocated. We iterate now over all - * cylinder groups, within those over all non zero length - * inodes. - */ - for (cylno = 0; cylno < osblock.fs_ncg; cylno++) { - DBG_PRINT1("scg doing cg (%d)\n", cylno); - for (inc = osblock.fs_ipg - 1 ; inc > 0 ; inc--) - updrefs(cylno, (ino_t)inc, bp, fsi, fso, Nflag); + if (d < + sblock.fs_csaddr + (sblock.fs_cssize / sblock.fs_fsize)) { + for (; d - sblock.fs_csaddr < + sblock.fs_cssize/sblock.fs_fsize; d++) { + clrbit(cg_blksfree(&acg), d % sblock.fs_fpg); + acg.cg_cs.cs_nffree--; + sblock.fs_cstotal.cs_nffree--; } + acg.cg_cs.cs_nbfree--; + acg.cg_cs.cs_nffree += sblock.fs_frag; + sblock.fs_cstotal.cs_nbfree--; + sblock.fs_cstotal.cs_nffree += sblock.fs_frag; + if (sblock.fs_contigsumsize > 0) + clrbit(cg_clustersfree(&acg), + (d % sblock.fs_fpg) / sblock.fs_frag); - /* - * All inodes are checked, now make sure the number of - * references found make sense. - */ - for (i = 0; i < ind; i++) { - if (!bp[i].found || (bp[i].found > sblock.fs_frag)) { - warnx("error: %jd refs found for block %jd.", - (intmax_t)bp[i].found, (intmax_t)bp[i].old); - } - } + frag_adjust(d % sblock.fs_fpg, 1); } /* - * The following statistics are not changed here: - * sblock.fs_cstotal.cs_ndir - * sblock.fs_cstotal.cs_nifree - * The following statistics were already updated on the fly: - * sblock.fs_cstotal.cs_nffree - * sblock.fs_cstotal.cs_nbfree - * As the statistics for this cylinder group are ready, copy it to - * the summary information array. + * XXX Handle the cluster statistics here in the case this + * cylinder group is now almost full, and the remaining + * space is less then the maximum cluster size. This is + * probably not needed, as you would hardly find a file + * system which has only MAXCSBUFS+FS_MAXCONTIG of free + * space right behind the cylinder group information in + * any new cylinder group. */ + /* + * Update our statistics in the cylinder summary. + */ *cs = acg.cg_cs; /* - * Write summary cylinder group back to disk. + * Write the new cylinder group containing the cylinder summary + * back to disk. */ - wtfs(fsbtodb(&sblock, cgtod(&sblock, ocscg)), (size_t)sblock.fs_cgsize, - (void *)&acg, fso, Nflag); - DBG_PRINT0("scg written\n"); + wtfs(fsbtodb(&sblock, cgtod(&sblock, ncscg)), + (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); + DBG_PRINT0("nscg written\n"); DBG_DUMP_CG(&sblock, "new summary cg", &acg); DBG_LEAVE; @@ -1511,126 +1121,6 @@ wtfs(ufs2_daddr_t bno, size_t size, void } /* - * Here we allocate a free block in the current cylinder group. It is assumed, - * that acg contains the current cylinder group. As we may take a block from - * somewhere in the file system we have to handle cluster summary here. - */ -static ufs2_daddr_t -alloc(void) -{ - DBG_FUNC("alloc") - ufs2_daddr_t d, blkno; - int lcs1, lcs2; - int l; - int csmin, csmax; - int dlower, dupper, dmax; - - DBG_ENTER; - - if (acg.cg_magic != CG_MAGIC) { - warnx("acg: bad magic number"); - DBG_LEAVE; - return (0); - } - if (acg.cg_cs.cs_nbfree == 0) { - warnx("error: cylinder group ran out of space"); - DBG_LEAVE; - return (0); - } - /* - * We start seeking for free blocks only from the space available after - * the end of the new grown cylinder summary. Otherwise we allocate a - * block here which we have to relocate a couple of seconds later again - * again, and we are not prepared to to this anyway. - */ - blkno = -1; - dlower = cgsblock(&sblock, acg.cg_cgx) - cgbase(&sblock, acg.cg_cgx); - dupper = cgdmin(&sblock, acg.cg_cgx) - cgbase(&sblock, acg.cg_cgx); - dmax = cgbase(&sblock, acg.cg_cgx) + sblock.fs_fpg; - if (dmax > sblock.fs_size) - dmax = sblock.fs_size; - dmax -= cgbase(&sblock, acg.cg_cgx); /* retransform into cg */ - csmin = sblock.fs_csaddr - cgbase(&sblock, acg.cg_cgx); - csmax = csmin + howmany(sblock.fs_cssize, sblock.fs_fsize); - DBG_PRINT3("seek range: dl=%d, du=%d, dm=%d\n", dlower, dupper, dmax); - DBG_PRINT2("range cont: csmin=%d, csmax=%d\n", csmin, csmax); - - for (d = 0; (d < dlower && blkno == -1); d += sblock.fs_frag) { - if (d >= csmin && d <= csmax) - continue; - if (isblock(&sblock, cg_blksfree(&acg), fragstoblks(&sblock, d))) { - blkno = fragstoblks(&sblock, d);/* Yeah found a block */ - break; - } - } - for (d = dupper; (d < dmax && blkno == -1); d += sblock.fs_frag) { - if (d >= csmin && d <= csmax) { - continue; - } - if (isblock(&sblock, cg_blksfree(&acg), fragstoblks(&sblock, d))) { - blkno = fragstoblks(&sblock, d);/* Yeah found a block */ - break; - } - } - if (blkno == -1) { - warnx("internal error: couldn't find promised block in cg"); - DBG_LEAVE; - return (0); - } - - /* - * This is needed if the block was found already in the first loop. - */ - d = blkstofrags(&sblock, blkno); - - clrblock(&sblock, cg_blksfree(&acg), blkno); - if (sblock.fs_contigsumsize > 0) { - /* - * Handle the cluster allocation bitmap. - */ - clrbit(cg_clustersfree(&acg), blkno); - /* - * We possibly have split a cluster here, so we have to do - * recalculate the sizes of the remaining cluster halves now, - * and use them for updating the cluster summary information. - * - * Lets start with the blocks before our allocated block ... - */ - for (lcs1 = 0, l = blkno - 1; lcs1 < sblock.fs_contigsumsize; - l--, lcs1++ ) { - if (isclr(cg_clustersfree(&acg), l)) - break; - } - /* - * ... and continue with the blocks right after our allocated - * block. - */ - for (lcs2 = 0, l = blkno + 1; lcs2 < sblock.fs_contigsumsize; - l++, lcs2++ ) { - if (isclr(cg_clustersfree(&acg), l)) - break; - } - - /* - * Now update all counters. - */ - cg_clustersum(&acg)[MIN(lcs1 + lcs2 + 1, sblock.fs_contigsumsize)]--; - if (lcs1) - cg_clustersum(&acg)[lcs1]++; - if (lcs2) - cg_clustersum(&acg)[lcs2]++; - } - /* - * Update all statistics based on blocks. - */ - acg.cg_cs.cs_nbfree--; - sblock.fs_cstotal.cs_nbfree--; - - DBG_LEAVE; - return (d); -} - -/* * Here we check if all frags of a block are free. For more details again * please see the source of newfs(8), as this function is taken over almost * unchanged. @@ -1735,54 +1225,6 @@ setblock(struct fs *fs, unsigned char *c } /* - * This function provides access to an individual inode. We find out in which - * block the requested inode is located, read it from disk if needed, and - * return the pointer into that block. We maintain a cache of one block to - * not read the same block again and again if we iterate linearly over all - * inodes. - */ -static union dinode * -ginode(ino_t inumber, int fsi, int cg) -{ - DBG_FUNC("ginode") - static ino_t startinum = 0; /* first inode in cached block */ - - DBG_ENTER; - - /* - * The inumber passed in is relative to the cg, so use it here to see - * if the inode has been allocated yet. - */ - if (isclr(cg_inosused(&aocg), inumber)) { - DBG_LEAVE; - return NULL; - } - /* - * Now make the inumber relative to the entire inode space so it can - * be sanity checked. - */ - inumber += (cg * sblock.fs_ipg); - if (inumber < ROOTINO) { - DBG_LEAVE; - return NULL; - } - if (inumber > maxino) - errx(8, "bad inode number %d to ginode", inumber); - if (startinum == 0 || - inumber < startinum || inumber >= startinum + INOPB(&sblock)) { - inoblk = fsbtodb(&sblock, ino_to_fsba(&sblock, inumber)); - rdfs(inoblk, (size_t)sblock.fs_bsize, inobuf, fsi); - startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock); - } - DBG_LEAVE; - if (sblock.fs_magic == FS_UFS1_MAGIC) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 19:08:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73A061065748; Sat, 23 Jun 2012 19:08:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D4A18FC12; Sat, 23 Jun 2012 19:08:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NJ8Pkd059254; Sat, 23 Jun 2012 19:08:25 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NJ8O0a059251; Sat, 23 Jun 2012 19:08:24 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231908.q5NJ8O0a059251@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 19:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237500 - stable/9/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 19:08:27 -0000 Author: trasz Date: Sat Jun 23 19:08:24 2012 New Revision: 237500 URL: http://svn.freebsd.org/changeset/base/237500 Log: MFC r234189: Style. MFC r234312: Remove FSIRAND and FSMAXSWAP ifdefs, removing code unconditionally. Reviewed by: kib, mckusick Sponsored by: The FreeBSD Foundation MFC r234314: Style. MFC r234420: Style. Modified: stable/9/sbin/growfs/debug.c stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/debug.c ============================================================================== --- stable/9/sbin/growfs/debug.c Sat Jun 23 19:03:42 2012 (r237499) +++ stable/9/sbin/growfs/debug.c Sat Jun 23 19:08:24 2012 (r237500) @@ -127,9 +127,7 @@ dbg_dump_hex(struct fs *sb, const char * void dbg_dump_fs(struct fs *sb, const char *comment) { -#ifdef FSMAXSNAP int j; -#endif /* FSMAXSNAP */ if (!dbg_log) return; @@ -299,7 +297,6 @@ dbg_dump_fs(struct fs *sb, const char *c fprintf(dbg_log, "pendinginodes int32_t 0x%08x\n", sb->fs_pendinginodes); -#ifdef FSMAXSNAP for (j = 0; j < FSMAXSNAP; j++) { fprintf(dbg_log, "snapinum int32_t[%2d] 0x%08x\n", j, sb->fs_snapinum[j]); @@ -307,7 +304,6 @@ dbg_dump_fs(struct fs *sb, const char *c break; } } -#endif /* FSMAXSNAP */ fprintf(dbg_log, "avgfilesize int32_t 0x%08x\n", sb->fs_avgfilesize); fprintf(dbg_log, "avgfpdir int32_t 0x%08x\n", Modified: stable/9/sbin/growfs/growfs.c ============================================================================== --- stable/9/sbin/growfs/growfs.c Sat Jun 23 19:03:42 2012 (r237499) +++ stable/9/sbin/growfs/growfs.c Sat Jun 23 19:08:24 2012 (r237500) @@ -76,7 +76,7 @@ int _dbg_lvl_ = (DL_INFO); /* DL_TRC */ static union { struct fs fs; - char pad[SBLOCKSIZE]; + char pad[SBLOCKSIZE]; } fsun1, fsun2; #define sblock fsun1.fs /* the new superblock */ #define osblock fsun2.fs /* the old superblock */ @@ -89,7 +89,7 @@ static ufs2_daddr_t sblockloc; static union { struct cg cg; - char pad[MAXBSIZE]; + char pad[MAXBSIZE]; } cgun1, cgun2; #define acg cgun1.cg /* a cylinder cgroup (new) */ #define aocg cgun2.cg /* an old cylinder group */ @@ -130,8 +130,7 @@ growfs(int fsi, int fso, unsigned int Nf uint cylno; int i, j, width; char tmpbuf[100]; -#ifdef FSIRAND - static int randinit=0; + static int randinit = 0; DBG_ENTER; @@ -139,11 +138,6 @@ growfs(int fsi, int fso, unsigned int Nf randinit = 1; srandomdev(); } -#else /* not FSIRAND */ - - DBG_ENTER; - -#endif /* FSIRAND */ time(&modtime); /* @@ -183,7 +177,7 @@ growfs(int fsi, int fso, unsigned int Nf /* * Dump out summary information about file system. */ -# define B2MBFACTOR (1 / (1024.0 * 1024.0)) +#define B2MBFACTOR (1 / (1024.0 * 1024.0)) printf("growfs: %.1fMB (%jd sectors) block size %d, fragment size %d\n", (float)sblock.fs_size * sblock.fs_fsize * B2MBFACTOR, (intmax_t)fsbtodb(&sblock, sblock.fs_size), sblock.fs_bsize, @@ -193,7 +187,7 @@ growfs(int fsi, int fso, unsigned int Nf sblock.fs_fpg / sblock.fs_frag, sblock.fs_ipg); if (sblock.fs_flags & FS_DOSOFTDEP) printf("\twith soft updates\n"); -# undef B2MBFACTOR +#undef B2MBFACTOR /* * Now build the cylinders group blocks and @@ -319,11 +313,9 @@ initcg(int cylno, time_t modtime, int fs static caddr_t iobuf; long blkno, start; ufs2_daddr_t i, cbase, dmax; -#ifdef FSIRAND struct ufs1_dinode *dp1; -#endif struct csum *cs; - uint d, dupper, dlower; + uint j, d, dupper, dlower; if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize * 3)) == NULL) errx(37, "panic: cannot allocate I/O buffer"); @@ -399,13 +391,11 @@ initcg(int cylno, time_t modtime, int fs bzero(iobuf, sblock.fs_bsize); for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) { -#ifdef FSIRAND dp1 = (struct ufs1_dinode *)(void *)iobuf; for (j = 0; j < INOPB(&sblock); j++) { dp1->di_gen = random(); dp1++; } -#endif wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i), sblock.fs_bsize, iobuf, fso, Nflag); } @@ -509,7 +499,7 @@ frag_adjust(ufs2_daddr_t frag, int sign) DBG_ENTER; - fragsize=0; + fragsize = 0; /* * Here frag only needs to point to any fragment in the block we want * to examine. @@ -526,7 +516,7 @@ frag_adjust(ufs2_daddr_t frag, int sign) /* * We found something in between. */ - acg.cg_frsum[fragsize]+=sign; + acg.cg_frsum[fragsize] += sign; DBG_PRINT2("frag_adjust [%d]+=%d\n", fragsize, sign); } @@ -589,7 +579,7 @@ updjcg(int cylno, time_t modtime, int fs if (cgbase(&osblock, cylno + 1) == osblock.fs_size) { if (sblock.fs_magic == FS_UFS1_MAGIC) - acg.cg_old_ncyl=sblock.fs_old_cpg; + acg.cg_old_ncyl = sblock.fs_old_cpg; wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); @@ -882,8 +872,7 @@ updcsloc(time_t modtime, int fsi, int fs */ if (sblock.fs_contigsumsize > 0) { for (block = howmany(d % sblock.fs_fpg, sblock.fs_frag), - lcs = 0; lcs < sblock.fs_contigsumsize; - block++, lcs++) { + lcs = 0; lcs < sblock.fs_contigsumsize; block++, lcs++) { if (isclr(cg_clustersfree(&acg), block)) break; } @@ -913,7 +902,7 @@ updcsloc(time_t modtime, int fsi, int fs * (incomplete) block of the cylinder summary. */ d++; - frag_adjust(d%sblock.fs_fpg, 1); + frag_adjust(d % sblock.fs_fpg, 1); if (isblock(&sblock, cg_blksfree(&acg), (d % sblock.fs_fpg) / sblock.fs_frag)) { @@ -924,8 +913,7 @@ updcsloc(time_t modtime, int fsi, int fs sblock.fs_cstotal.cs_nbfree++; if (sblock.fs_contigsumsize > 0) { setbit(cg_clustersfree(&acg), - (d % sblock.fs_fpg) / - sblock.fs_frag); + (d % sblock.fs_fpg) / sblock.fs_frag); if (lcs < sblock.fs_contigsumsize) { if (lcs) cg_clustersum(&acg)[lcs]--; @@ -1026,8 +1014,7 @@ updcsloc(time_t modtime, int fsi, int fs * Allocate all fragments used by the cylinder summary in the * last block. */ - if (d < - sblock.fs_csaddr + (sblock.fs_cssize / sblock.fs_fsize)) { + if (d < sblock.fs_csaddr + (sblock.fs_cssize / sblock.fs_fsize)) { for (; d - sblock.fs_csaddr < sblock.fs_cssize/sblock.fs_fsize; d++) { clrbit(cg_blksfree(&acg), d % sblock.fs_fpg); @@ -1248,7 +1235,7 @@ charsperline(void) columns = 80; /* last resort */ DBG_LEAVE; - return columns; + return (columns); } /* @@ -1306,9 +1293,7 @@ main(int argc, char **argv) int i, fsi, fso; u_int32_t p_size; char reply[5]; -#ifdef FSMAXSNAP int j; -#endif /* FSMAXSNAP */ DBG_ENTER; @@ -1445,8 +1430,6 @@ main(int argc, char **argv) (intmax_t)osblock.fs_size, (intmax_t)sblock.fs_size); } - -#ifdef FSMAXSNAP /* * Check if we find an active snapshot. */ @@ -1461,7 +1444,6 @@ main(int argc, char **argv) break; } } -#endif if (ExpertFlag == 0 && Nflag == 0) { printf("We strongly recommend you to make a backup " @@ -1544,7 +1526,7 @@ main(int argc, char **argv) DBG_CLOSE; DBG_LEAVE; - return 0; + return (0); } /* From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 19:15:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49B19106566C; Sat, 23 Jun 2012 19:15:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32F6E8FC0C; Sat, 23 Jun 2012 19:15:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NJFDEn059634; Sat, 23 Jun 2012 19:15:13 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NJFDt9059630; Sat, 23 Jun 2012 19:15:13 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231915.q5NJFDt9059630@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 19:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237501 - stable/9/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 19:15:13 -0000 Author: trasz Date: Sat Jun 23 19:15:12 2012 New Revision: 237501 URL: http://svn.freebsd.org/changeset/base/237501 Log: MFC r234846: Improve growfs(8) in a few ways; unfortunately, it's somewhat hard to untangle them and commit separately. 1. Rewrite the way growfs(8) finds the device and mount point. This makes it possible to use e.g. "growfs /mnt"; it's also used to display more helpful messages. 2. Be more user-friendly, using descriptive messages, like this: OK to grow filesystem on /dev/md0, mounted on /mnt, from 9.8GB to 20GB? [Yes/No]" 3. Allow to specify the size (-s option) just like with mdconfig(8), i.e. with postfixes ("mdconfig -s 10g").4. Reload read-only filesystem after growing. Reviewed by: kib, mckusick (earlier version) Sponsored by: The FreeBSD Foundation MFC r235079: Fix offset calculation to actually rewrite the _last_ block. Modified: stable/9/sbin/growfs/Makefile stable/9/sbin/growfs/growfs.8 stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/Makefile ============================================================================== --- stable/9/sbin/growfs/Makefile Sat Jun 23 19:08:24 2012 (r237500) +++ stable/9/sbin/growfs/Makefile Sat Jun 23 19:15:12 2012 (r237501) @@ -6,12 +6,18 @@ #GFSDBG= +.PATH: ${.CURDIR}/../mount + PROG= growfs -SRCS= growfs.c +SRCS= growfs.c getmntopts.c MAN= growfs.8 +CFLAGS+=-I${.CURDIR}/../mount .if defined(GFSDBG) SRCS+= debug.c .endif +DPADD= ${LIBUTIL} +LDADD= -lutil + .include Modified: stable/9/sbin/growfs/growfs.8 ============================================================================== --- stable/9/sbin/growfs/growfs.8 Sat Jun 23 19:08:24 2012 (r237500) +++ stable/9/sbin/growfs/growfs.8 Sat Jun 23 19:15:12 2012 (r237501) @@ -37,7 +37,7 @@ .\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $ .\" $FreeBSD$ .\" -.Dd June 29, 2011 +.Dd April 30, 2012 .Dt GROWFS 8 .Os .Sh NAME @@ -47,41 +47,20 @@ .Nm .Op Fl Ny .Op Fl s Ar size -.Ar special +.Ar special | filesystem .Sh DESCRIPTION The .Nm -utility extends the -.Xr newfs 8 -program. -Before starting -.Nm -the disk must be labeled to a bigger size using -.Xr bsdlabel 8 . -If you wish to grow a file system beyond the boundary of -the slice it resides in, you must re-size the slice using -.Xr gpart 8 -before running -.Nm . +utility makes it possible to expand an UFS file system. +Before running +.Nm +the partition or slice containing the file system must be extended using +.Xr gpart 8 . If you are using volumes you must enlarge them by using .Xr gvinum 8 . The .Nm utility extends the size of the file system on the specified special file. -Currently -.Nm -can only enlarge unmounted file systems. -Do not try enlarging a mounted file system, your system may panic and you will -not be able to use the file system any longer. -Most of the -.Xr newfs 8 -options cannot be changed by -.Nm . -In fact, you can only increase the size of the file system. -Use -.Xr tunefs 8 -for other changes. -.Pp The following options are available: .Bl -tag -width indent .It Fl N @@ -103,6 +82,13 @@ So use this option with great care! Determines the .Ar size of the file system after enlarging in sectors. +.Ar Size +is the number of 512 byte sectors unless suffixed with a +.Cm b , k , m , g , +or +.Cm t +which +denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively. This value defaults to the size of the raw partition specified in .Ar special (in other words, @@ -110,19 +96,18 @@ This value defaults to the size of the r will enlarge the file system to the size of the entire partition). .El .Sh EXAMPLES -.Dl growfs -s 4194304 /dev/vinum/testvol +.Dl growfs -s 2G /dev/ada0p1 .Pp will enlarge -.Pa /dev/vinum/testvol +.Pa /dev/ada0p1 up to 2GB if there is enough space in -.Pa /dev/vinum/testvol . +.Pa /dev/ada0p1 . .Sh SEE ALSO -.Xr bsdlabel 8 , .Xr dumpfs 8 , .Xr ffsinfo 8 , .Xr fsck 8 , +.Xr fsdb 8 , .Xr gpart 8 , -.Xr gvinum 8 , .Xr newfs 8 , .Xr tunefs 8 .Sh HISTORY @@ -134,61 +119,12 @@ utility first appeared in .An Christoph Herrmann Aq chm@FreeBSD.org .An Thomas-Henning von Kamptz Aq tomsoft@FreeBSD.org .An The GROWFS team Aq growfs@Tomsoft.COM +.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .Sh BUGS -The -.Nm -utility works starting with -.Fx -3.x. -There may be cases on -.Fx -3.x only, when -.Nm -does not recognize properly whether or not the file system is mounted and -exits with an error message. -Then please use -.Nm -.Fl y -if you are sure that the file system is not mounted. -It is also recommended to always use -.Xr fsck 8 -after enlarging (just to be on the safe side). -.Pp -For enlarging beyond certain limits, it is essential to have some free blocks -available in the first cylinder group. -If that space is not available in the first cylinder group, a critical data -structure has to be relocated into one of the new available cylinder groups. -On -.Fx -3.x this will cause problems with -.Xr fsck 8 -afterwards. -So -.Xr fsck 8 -needs to be patched if you want to use -.Nm -for -.Fx -3.x. -This patch is already integrated in -.Fx -starting with -.Fx 4.4 . -To avoid an unexpected relocation of that structure it is possible to use -.Nm ffsinfo -.Fl g Ar 0 -.Fl l Ar 4 -on the first cylinder group to verify that -.Em nbfree -in the CYLINDER SUMMARY (internal cs) of the CYLINDER GROUP -.Em cgr0 -has enough blocks. -As a rule of thumb for default file system parameters one block is needed for -every 2 GB of total file system size. .Pp Normally .Nm -writes this critical structure to disk and reads it again later for doing more +writes cylinder group summary to disk and reads it again later for doing more updates. This read operation will provide unexpected data when using .Fl N . Modified: stable/9/sbin/growfs/growfs.c ============================================================================== --- stable/9/sbin/growfs/growfs.c Sat Jun 23 19:08:24 2012 (r237500) +++ stable/9/sbin/growfs/growfs.c Sat Jun 23 19:15:12 2012 (r237501) @@ -1,11 +1,15 @@ /* - * Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz * Copyright (c) 1980, 1989, 1993 The Regents of the University of California. + * Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz + * Copyright (c) 2012 The FreeBSD Foundation * All rights reserved. * * This code is derived from software contributed to Berkeley by * Christoph Herrmann and Thomas-Henning von Kamptz, Munich and Frankfurt. * + * Portions of this software were developed by Edward Tomasz Napierala + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -53,13 +57,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include #include #include +#include +#include #include +#include #include #include #include @@ -67,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "debug.h" @@ -109,7 +119,7 @@ static void updjcg(int, time_t, int, int static void updcsloc(time_t, int, int, unsigned int); static void frag_adjust(ufs2_daddr_t, int); static void updclst(int); -static void get_dev_size(int, int *); +static void mount_reload(const struct statfs *stfs); /* * Here we actually start growing the file system. We basically read the @@ -177,6 +187,7 @@ growfs(int fsi, int fso, unsigned int Nf /* * Dump out summary information about file system. */ +#ifdef FS_DEBUG #define B2MBFACTOR (1 / (1024.0 * 1024.0)) printf("growfs: %.1fMB (%jd sectors) block size %d, fragment size %d\n", (float)sblock.fs_size * sblock.fs_fsize * B2MBFACTOR, @@ -188,6 +199,7 @@ growfs(int fsi, int fso, unsigned int Nf if (sblock.fs_flags & FS_DOSOFTDEP) printf("\twith soft updates\n"); #undef B2MBFACTOR +#endif /* FS_DEBUG */ /* * Now build the cylinders group blocks and @@ -774,7 +786,7 @@ updjcg(int cylno, time_t modtime, int fs /* * Here we update the location of the cylinder summary. We have two possible - * ways of growing the cylinder summary. + * ways of growing the cylinder summary: * (1) We can try to grow the summary in the current location, and relocate * possibly used blocks within the current cylinder group. * (2) Alternatively we can relocate the whole cylinder summary to the first @@ -1238,24 +1250,104 @@ charsperline(void) return (columns); } +static int +is_dev(const char *name) +{ + struct stat devstat; + + if (stat(name, &devstat) != 0) + return (0); + if (!S_ISCHR(devstat.st_mode)) + return (0); + return (1); +} + /* - * Get the size of the partition. - */ -static void -get_dev_size(int fd, int *size) + * Return mountpoint on which the device is currently mounted. + */ +static const struct statfs * +dev_to_statfs(const char *dev) { - int sectorsize; - off_t mediasize; + struct stat devstat, mntdevstat; + struct statfs *mntbuf, *statfsp; + char device[MAXPATHLEN]; + char *mntdevname; + int i, mntsize; + + /* + * First check the mounted filesystems. + */ + if (stat(dev, &devstat) != 0) + return (NULL); + if (!S_ISCHR(devstat.st_mode) && !S_ISBLK(devstat.st_mode)) + return (NULL); + + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + for (i = 0; i < mntsize; i++) { + statfsp = &mntbuf[i]; + mntdevname = statfsp->f_mntfromname; + if (*mntdevname != '/') { + strcpy(device, _PATH_DEV); + strcat(device, mntdevname); + mntdevname = device; + } + if (stat(mntdevname, &mntdevstat) == 0 && + mntdevstat.st_rdev == devstat.st_rdev) + return (statfsp); + } - if (ioctl(fd, DIOCGSECTORSIZE, §orsize) == -1) - err(1,"DIOCGSECTORSIZE"); - if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) == -1) - err(1,"DIOCGMEDIASIZE"); + return (NULL); +} - if (sectorsize <= 0) - errx(1, "bogus sectorsize: %d", sectorsize); +static const char * +mountpoint_to_dev(const char *mountpoint) +{ + struct statfs *mntbuf, *statfsp; + struct fstab *fs; + int i, mntsize; - *size = mediasize / sectorsize; + /* + * First check the mounted filesystems. + */ + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + for (i = 0; i < mntsize; i++) { + statfsp = &mntbuf[i]; + + if (strcmp(statfsp->f_mntonname, mountpoint) == 0) + return (statfsp->f_mntfromname); + } + + /* + * Check the fstab. + */ + fs = getfsfile(mountpoint); + if (fs != NULL) + return (fs->fs_spec); + + return (NULL); +} + +static const char * +getdev(const char *name) +{ + static char device[MAXPATHLEN]; + const char *cp, *dev; + + if (is_dev(name)) + return (name); + + cp = strrchr(name, '/'); + if (cp == 0) { + snprintf(device, sizeof(device), "%s%s", _PATH_DEV, name); + if (is_dev(device)) + return (device); + } + + dev = mountpoint_to_dev(name); + if (dev != NULL && is_dev(dev)) + return (dev); + + return (NULL); } /* @@ -1283,17 +1375,13 @@ int main(int argc, char **argv) { DBG_FUNC("main") - char *device, *special; - int ch; - unsigned int size = 0; - size_t len; - unsigned int Nflag = 0; - int ExpertFlag = 0; - struct stat st; - int i, fsi, fso; - u_int32_t p_size; - char reply[5]; - int j; + const char *device; + const struct statfs *statfsp; + uint64_t size = 0; + off_t mediasize; + int error, i, j, fsi, fso, ch, Nflag = 0, yflag = 0; + char *p, reply[5], oldsizebuf[6], newsizebuf[6]; + void *testbuf; DBG_ENTER; @@ -1303,14 +1391,27 @@ main(int argc, char **argv) Nflag = 1; break; case 's': - size = (size_t)atol(optarg); - if (size < 1) - usage(); + size = (off_t)strtoumax(optarg, &p, 0); + if (p == NULL || *p == '\0') + size *= DEV_BSIZE; + else if (*p == 'b' || *p == 'B') + ; /* do nothing */ + else if (*p == 'k' || *p == 'K') + size <<= 10; + else if (*p == 'm' || *p == 'M') + size <<= 20; + else if (*p == 'g' || *p == 'G') + size <<= 30; + else if (*p == 't' || *p == 'T') { + size <<= 30; + size <<= 10; + } else + errx(1, "unknown suffix on -s argument"); break; case 'v': /* for compatibility to newfs */ break; case 'y': - ExpertFlag = 1; + yflag = 1; break; case '?': /* FALLTHROUGH */ @@ -1324,71 +1425,29 @@ main(int argc, char **argv) if (argc != 1) usage(); - device = *argv; - /* - * Now try to guess the (raw)device name. + * Now try to guess the device name. */ - if (0 == strrchr(device, '/')) { - /* - * No path prefix was given, so try in that order: - * /dev/r%s - * /dev/%s - * /dev/vinum/r%s - * /dev/vinum/%s. - * - * FreeBSD now doesn't distinguish between raw and block - * devices any longer, but it should still work this way. - */ - len = strlen(device) + strlen(_PATH_DEV) + 2 + strlen("vinum/"); - special = (char *)malloc(len); - if (special == NULL) - errx(1, "malloc failed"); - snprintf(special, len, "%sr%s", _PATH_DEV, device); - if (stat(special, &st) == -1) { - snprintf(special, len, "%s%s", _PATH_DEV, device); - if (stat(special, &st) == -1) { - snprintf(special, len, "%svinum/r%s", - _PATH_DEV, device); - if (stat(special, &st) == -1) { - /* For now this is the 'last resort' */ - snprintf(special, len, "%svinum/%s", - _PATH_DEV, device); - } - } - } - device = special; - } + device = getdev(*argv); + if (device == NULL) + errx(1, "cannot find special device for %s", *argv); - /* - * Try to access our devices for writing ... - */ - if (Nflag) { - fso = -1; - } else { - fso = open(device, O_WRONLY); - if (fso < 0) - err(1, "%s", device); - } + statfsp = dev_to_statfs(device); - /* - * ... and reading. - */ fsi = open(device, O_RDONLY); if (fsi < 0) err(1, "%s", device); /* - * Try to guess the slice if not specified. This code should guess - * the right thing and avoid to bother the user with the task - * of specifying the option -v on vinum volumes. + * Try to guess the slice size if not specified. */ - get_dev_size(fsi, &p_size); + if (ioctl(fsi, DIOCGMEDIASIZE, &mediasize) == -1) + err(1,"DIOCGMEDIASIZE"); /* * Check if that partition is suitable for growing a file system. */ - if (p_size < 1) + if (mediasize < 1) errx(1, "partition is unavailable"); /* @@ -1414,16 +1473,36 @@ main(int argc, char **argv) /* * Determine size to grow to. Default to the device size. */ - sblock.fs_size = dbtofsb(&osblock, p_size); - if (size != 0) { - if (size > p_size) - errx(1, "there is not enough space (%d < %d)", - p_size, size); - sblock.fs_size = dbtofsb(&osblock, size); + if (size == 0) + size = mediasize; + else { + if (size > (uint64_t)mediasize) { + humanize_number(oldsizebuf, sizeof(oldsizebuf), size, + "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + humanize_number(newsizebuf, sizeof(newsizebuf), + mediasize, + "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + + errx(1, "requested size %s is larger " + "than the available %s", oldsizebuf, newsizebuf); + } + } + + if (size <= (uint64_t)(osblock.fs_size * osblock.fs_fsize)) { + humanize_number(oldsizebuf, sizeof(oldsizebuf), + osblock.fs_size * osblock.fs_fsize, + "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + humanize_number(newsizebuf, sizeof(newsizebuf), size, + "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + + errx(1, "requested size %s is not larger than the current " + "filesystem size %s", newsizebuf, oldsizebuf); } + sblock.fs_size = dbtofsb(&osblock, size / DEV_BSIZE); + /* - * Are we really growing ? + * Are we really growing? */ if (osblock.fs_size >= sblock.fs_size) { errx(1, "we are not growing (%jd->%jd)", @@ -1433,7 +1512,7 @@ main(int argc, char **argv) /* * Check if we find an active snapshot. */ - if (ExpertFlag == 0) { + if (yflag == 0) { for (j = 0; j < FSMAXSNAP; j++) { if (sblock.fs_snapinum[j]) { errx(1, "active snapshot found in file system; " @@ -1445,10 +1524,23 @@ main(int argc, char **argv) } } - if (ExpertFlag == 0 && Nflag == 0) { - printf("We strongly recommend you to make a backup " + if (yflag == 0 && Nflag == 0) { + if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0) + errx(1, "%s is mounted read-write on %s", + statfsp->f_mntfromname, statfsp->f_mntonname); + printf("It's strongly recommended to make a backup " "before growing the file system.\n" - "Did you backup your data (Yes/No)? "); + "OK to grow filesystem on %s", device); + if (statfsp != NULL) + printf(", mounted on %s,", statfsp->f_mntonname); + humanize_number(oldsizebuf, sizeof(oldsizebuf), + osblock.fs_size * osblock.fs_fsize, + "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + humanize_number(newsizebuf, sizeof(newsizebuf), + sblock.fs_size * sblock.fs_fsize, + "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + printf(" from %s to %s? [Yes/No] ", oldsizebuf, newsizebuf); + fflush(stdout); fgets(reply, (int)sizeof(reply), stdin); if (strcmp(reply, "Yes\n")){ printf("\nNothing done\n"); @@ -1456,15 +1548,30 @@ main(int argc, char **argv) } } - printf("New file system size is %jd frags\n", (intmax_t)sblock.fs_size); + /* + * Try to access our device for writing. If it's not mounted, + * or mounted read-only, simply open it; otherwise, use UFS + * suspension mechanism. + */ + if (Nflag) { + fso = -1; + } else { + fso = open(device, O_WRONLY); + if (fso < 0) + err(1, "%s", device); + } /* - * Try to access our new last block in the file system. Even if we - * later on realize we have to abort our operation, on that block - * there should be no data, so we can't destroy something yet. + * Try to access our new last block in the file system. */ - wtfs((ufs2_daddr_t)p_size - 1, (size_t)DEV_BSIZE, (void *)&sblock, - fso, Nflag); + testbuf = malloc(sblock.fs_fsize); + if (testbuf == NULL) + err(1, "malloc"); + rdfs((ufs2_daddr_t)((size - sblock.fs_fsize) / DEV_BSIZE), + sblock.fs_fsize, testbuf, fsi); + wtfs((ufs2_daddr_t)((size - sblock.fs_fsize) / DEV_BSIZE), + sblock.fs_fsize, testbuf, fso, Nflag); + free(testbuf); /* * Now calculate new superblock values and check for reasonable @@ -1520,8 +1627,13 @@ main(int argc, char **argv) growfs(fsi, fso, Nflag); close(fsi); - if (fso > -1) - close(fso); + if (fso > -1) { + error = close(fso); + if (error != 0) + err(1, "close"); + } + if (statfsp != NULL) + mount_reload(statfsp); DBG_CLOSE; @@ -1539,7 +1651,7 @@ usage(void) DBG_ENTER; - fprintf(stderr, "usage: growfs [-Ny] [-s size] special\n"); + fprintf(stderr, "usage: growfs [-Ny] [-s size] special | filesystem\n"); DBG_LEAVE; exit(1); @@ -1586,3 +1698,26 @@ updclst(int block) DBG_LEAVE; return; } + +static void +mount_reload(const struct statfs *stfs) +{ + char errmsg[255]; + struct iovec *iov; + int iovlen; + + iov = NULL; + iovlen = 0; + *errmsg = '\0'; + build_iovec(&iov, &iovlen, "fstype", __DECONST(char *, "ffs"), 4); + build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, stfs->f_mntonname), (size_t)-1); + build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); + build_iovec(&iov, &iovlen, "update", NULL, 0); + build_iovec(&iov, &iovlen, "reload", NULL, 0); + + if (nmount(iov, iovlen, stfs->f_flags) < 0) { + errmsg[sizeof(errmsg) - 1] = '\0'; + err(9, "%s: cannot reload filesystem%s%s", stfs->f_mntonname, + *errmsg != '\0' ? ": " : "", errmsg); + } +} From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 19:42:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A151106567E; Sat, 23 Jun 2012 19:42:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 148EE8FC12; Sat, 23 Jun 2012 19:42:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NJg6iI060972; Sat, 23 Jun 2012 19:42:06 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NJg6Tb060970; Sat, 23 Jun 2012 19:42:06 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206231942.q5NJg6Tb060970@svn.freebsd.org> From: Eitan Adler Date: Sat, 23 Jun 2012 19:42:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237503 - stable/8/sbin/geom/class/sched X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 19:42:07 -0000 Author: eadler Date: Sat Jun 23 19:42:06 2012 New Revision: 237503 URL: http://svn.freebsd.org/changeset/base/237503 Log: MFC r231992: Remove reference to gsched_as module, which doesn't actually exist. Approved by: cperciva (implicit) Modified: stable/8/sbin/geom/class/sched/gsched.8 (contents, props changed) Directory Properties: stable/8/sbin/geom/ (props changed) Modified: stable/8/sbin/geom/class/sched/gsched.8 ============================================================================== --- stable/8/sbin/geom/class/sched/gsched.8 Sat Jun 23 19:39:03 2012 (r237502) +++ stable/8/sbin/geom/class/sched/gsched.8 Sat Jun 23 19:42:06 2012 (r237503) @@ -141,7 +141,7 @@ and how to destroy it. # Load the geom_sched module: kldload geom_sched # Load some scheduler classes used by geom_sched: -kldload gsched_rr gsched_as +kldload gsched_rr # Configure device ad0 to use scheduler "rr": geom sched insert -a rr ad0 # Now provider ad0 uses the "rr" algorithm; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 19:42:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3FB73106567F; Sat, 23 Jun 2012 19:42:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29F9B8FC14; Sat, 23 Jun 2012 19:42:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NJg7IH060976; Sat, 23 Jun 2012 19:42:07 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NJg6h1060974; Sat, 23 Jun 2012 19:42:06 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206231942.q5NJg6h1060974@svn.freebsd.org> From: Eitan Adler Date: Sat, 23 Jun 2012 19:42:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237504 - stable/9/sbin/geom/class/sched X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 19:42:07 -0000 Author: eadler Date: Sat Jun 23 19:42:06 2012 New Revision: 237504 URL: http://svn.freebsd.org/changeset/base/237504 Log: MFC r231992: Remove reference to gsched_as module, which doesn't actually exist. Approved by: cperciva (implicit) Modified: stable/9/sbin/geom/class/sched/gsched.8 Directory Properties: stable/9/sbin/geom/ (props changed) Modified: stable/9/sbin/geom/class/sched/gsched.8 ============================================================================== --- stable/9/sbin/geom/class/sched/gsched.8 Sat Jun 23 19:42:06 2012 (r237503) +++ stable/9/sbin/geom/class/sched/gsched.8 Sat Jun 23 19:42:06 2012 (r237504) @@ -141,7 +141,7 @@ and how to destroy it. # Load the geom_sched module: kldload geom_sched # Load some scheduler classes used by geom_sched: -kldload gsched_rr gsched_as +kldload gsched_rr # Configure device ad0 to use scheduler "rr": geom sched insert -a rr ad0 # Now provider ad0 uses the "rr" algorithm; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 19:46:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 87E971065676; Sat, 23 Jun 2012 19:46:08 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7347B8FC0A; Sat, 23 Jun 2012 19:46:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NJk8nG061199; Sat, 23 Jun 2012 19:46:08 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NJk8Jp061197; Sat, 23 Jun 2012 19:46:08 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231946.q5NJk8Jp061197@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 19:46:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237505 - stable/9/sbin/newfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 19:46:08 -0000 Author: trasz Date: Sat Jun 23 19:46:07 2012 New Revision: 237505 URL: http://svn.freebsd.org/changeset/base/237505 Log: Make newfs(8) display "super-block backups (for fsck_ffs -b #)" instead of super-block backups (for fsck -b #), since fsck(8) doesn't accept the "-b" option; only fsck_ffs(8) does. PR: bin/82720 MFC after: 1 week Modified: stable/9/sbin/newfs/mkfs.c Modified: stable/9/sbin/newfs/mkfs.c ============================================================================== --- stable/9/sbin/newfs/mkfs.c Sat Jun 23 19:42:06 2012 (r237504) +++ stable/9/sbin/newfs/mkfs.c Sat Jun 23 19:46:07 2012 (r237505) @@ -539,7 +539,7 @@ restart: * Now build the cylinders group blocks and * then print out indices of cylinder groups. */ - printf("super-block backups (for fsck -b #) at:\n"); + printf("super-block backups (for fsck_ffs -b #) at:\n"); i = 0; width = charsperline(); /* From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 20:01:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0003106564A; Sat, 23 Jun 2012 20:01:37 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0658FC0C; Sat, 23 Jun 2012 20:01:36 +0000 (UTC) Received: by lbon10 with SMTP id n10so6053921lbo.13 for ; Sat, 23 Jun 2012 13:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=UxHRq11drzO9aLCPpmSfVKOsy/JsYWriSoBZ0UdeyAM=; b=bgCWX2CjSwA9KexYntx3c7INIgcmM7UjcEeYYVnfeWL9LmMu8cpmJvxIrX0qn68tUL hM3XA1MKlup8pOBrB3HL3YpoTUFr/eX9nE7BdG037wptbIgr4O1294xn6pIqnBnyw0ch szMTz7lau6O0bl3Y/CIDKmcWK+vXVL+w0EmL5PM3DAVz4tUF6rA+znpki78gcaVbUORG /46dKYnmpEkn4zcGk1zuXY8fisjZInvTGvHT1BnyxfvQIbsMk48yrWV2h42QatumK/0h UJuXq6u59E2e+Qk6llg1Z4GMFA+drlEcxYrLa7J3SfXdM3b2Rv0tECREk6ZgPSw7PDVH HdjQ== Received: by 10.112.30.136 with SMTP id s8mr3417033lbh.51.1340481695323; Sat, 23 Jun 2012 13:01:35 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id xx8sm60286269lab.10.2012.06.23.13.01.32 (version=SSLv3 cipher=OTHER); Sat, 23 Jun 2012 13:01:34 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FE6209B.7050809@FreeBSD.org> Date: Sat, 23 Jun 2012 23:01:31 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120621 Thunderbird/13.0.1 MIME-Version: 1.0 To: Bruce Evans References: <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de> <20120622074817.GA2337@deviant.kiev.zoral.com.ua> <20120623131757.GB46065@alchemy.franken.de> <20120623140556.GU2337@deviant.kiev.zoral.com.ua> <20120624005418.W2417@besplex.bde.org> In-Reply-To: <20120624005418.W2417@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Davide Italiano , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Marius Strobl , Konstantin Belousov Subject: Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 20:01:37 -0000 On 06/23/12 18:26, Bruce Evans wrote: > On Sat, 23 Jun 2012, Konstantin Belousov wrote: >> On Sat, Jun 23, 2012 at 03:17:57PM +0200, Marius Strobl wrote: >>> So apart from introducing code to constantly synchronize the >>> TICK counters, using the timecounters on the host busses also >>> seems to be the only viable solution for userland. The latter >>> should be doable but is long-winded as besides duplicating >>> portions of the corresponding device drivers in userland, it >>> probably also means to get some additional infrastructure >>> like being able to memory map registers for devices on the >>> nexus(4) level in place ... > > There is little point in optimizations to avoid syscalls for hardware. > On x86, a syscall takes 100-400 nsec extra, so if the hardware takes > 500-2000 nsec then reduction the total time by 100-400 nsec is not > very useful. Just out of curiosity I've run my own binuptime() micro-benchmarks: - on Core i5-650: TSC 11ns HPET 433ns ACPI-fast 515ns i8254 3736ns - on dual-socket Xeon E5645: TSC 15ns HPET 580ns ACPI-fast 1118ns i8254 3911ns I think it could be useful to have that small benchmark in base kernel. >> Understand. I do plan eventually to map HPET counters page into usermode >> on x86. > > This should be left out too. > >> Also, as I noted above, some code to synchronize per-package counters >> would be useful for x86, so it might be developed with multi-arch >> usage in mind. > > It's only worth synchonizing fast timecounter hardware so that it can be > used in more cases. It probably needs to be non-bus based to be fast. > That means the TSC on x86. > > The new timeout code to support tickless kernels looks like it will give > large pessimizations unless the timecounter is fast. Instead of using > the tick counter (1 atomic increment on every clock tick) and some > getbinuptime() calls in places like select(), it uses the hardware > timecounter via binuptime() in most places (since without a tick counter > and without clock interrupts updating the timehands periodically, it takes > a hardware timecounter read to determine the time). So callout_reset() > might start taking thousands of nsec for per call, depending on how slow > the timecounter is. This fix is probably to use a fuzzy time for long > long timeouts and to discourage use of short timeouts and/or to turn them > into long or fuzzy timeouts so that they are not very useful. The new timeout code is still in active development and optimization was not the first priority yet. My idea was to use much faster getbinuptime() for periods above let's say 100ms. Legacy ticks-oriented callout_reset() functions are by default not supposed to provide sub-tick resolution and with some assumptions could use getbinuptime(). For new interfaces it depends on caller, how will it get present time. I understand that integer tick counter is as fast as nothing else can ever be. But sorry, 32bit counter doesn't fit present goals. To have more we need some artificial atomicity -- exactly what getbinuptime() implements. What I would like to see there is tc_tick removal to make tc_windup() called for every hardclock tick. Having new tick-irrelevant callout interfaces we probably won't so much need to increase HZ too high any more, while this simplification would make ticks and getbinuptime() precision equal, solving some of your valid arguments against the last. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 20:33:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E54D106566C; Sat, 23 Jun 2012 20:33:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 766AD8FC0C; Sat, 23 Jun 2012 20:33:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NKXTPj063198; Sat, 23 Jun 2012 20:33:29 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NKXTY3063187; Sat, 23 Jun 2012 20:33:29 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206232033.q5NKXTY3063187@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sat, 23 Jun 2012 20:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237507 - stable/9/contrib/libstdc++/include/bits X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 20:33:29 -0000 Author: pfg Date: Sat Jun 23 20:33:29 2012 New Revision: 237507 URL: http://svn.freebsd.org/changeset/base/237507 Log: MFC: r236829 Bring a couple of libstdc++ patches from Apple's llvm-gcc project. Modified Fri Jul 10 07:44:34 2009 CDT by rafael backport part of http://gcc.gnu.org/ml/gcc-cvs/2007-10/msg00118.html The patch is for libstdc++ and it was GPL2 at the time. Modified Tue Apr 29 01:20:19 2008 CDT by asl Backport from mainline (pre-GPLv3). Fix for sizeof(const void*) > sizeof(unsigned long). Modified: stable/9/contrib/libstdc++/include/bits/locale_facets.tcc stable/9/contrib/libstdc++/include/bits/stl_bvector.h stable/9/contrib/libstdc++/include/bits/stl_deque.h stable/9/contrib/libstdc++/include/bits/stl_list.h stable/9/contrib/libstdc++/include/bits/stl_map.h stable/9/contrib/libstdc++/include/bits/stl_multimap.h stable/9/contrib/libstdc++/include/bits/stl_multiset.h stable/9/contrib/libstdc++/include/bits/stl_set.h stable/9/contrib/libstdc++/include/bits/stl_tree.h stable/9/contrib/libstdc++/include/bits/stl_vector.h Directory Properties: stable/9/contrib/libstdc++/ (props changed) Modified: stable/9/contrib/libstdc++/include/bits/locale_facets.tcc ============================================================================== --- stable/9/contrib/libstdc++/include/bits/locale_facets.tcc Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/locale_facets.tcc Sat Jun 23 20:33:29 2012 (r237507) @@ -887,7 +887,11 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE const fmtflags __fmt = __io.flags(); __io.flags(__fmt & ~ios_base::basefield | ios_base::hex); - unsigned long __ul; + typedef __gnu_cxx::__conditional_type<(sizeof(void*) + <= sizeof(unsigned long)), + unsigned long, unsigned long long>::__type _UIntPtrType; + + _UIntPtrType __ul; __beg = _M_extract_int(__beg, __end, __io, __err, __ul); // Reset from hex formatted input. @@ -1309,8 +1313,12 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE | ios_base::internal); __io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase)); + typedef __gnu_cxx::__conditional_type<(sizeof(const void*) + <= sizeof(unsigned long)), + unsigned long, unsigned long long>::__type _UIntPtrType; + __s = _M_insert_int(__s, __io, __fill, - reinterpret_cast(__v)); + reinterpret_cast<_UIntPtrType>(__v)); __io.flags(__flags); return __s; } Modified: stable/9/contrib/libstdc++/include/bits/stl_bvector.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_bvector.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_bvector.h Sat Jun 23 20:33:29 2012 (r237507) @@ -385,6 +385,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL _Bit_iterator _M_start; _Bit_iterator _M_finish; _Bit_type* _M_end_of_storage; + + _Bvector_impl() + : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage(0) + { } + _Bvector_impl(const _Bit_alloc_type& __a) : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0) { } @@ -405,7 +410,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Bit_allocator()); } - _Bvector_base(const allocator_type& __a) : _M_impl(__a) { } + _Bvector_base() + : _M_impl() { } + + _Bvector_base(const allocator_type& __a) + : _M_impl(__a) { } ~_Bvector_base() { this->_M_deallocate(); } @@ -480,8 +489,11 @@ template using _Base::_M_get_Bit_allocator; public: + vector() + : _Base() { } + explicit - vector(const allocator_type& __a = allocator_type()) + vector(const allocator_type& __a) : _Base(__a) { } explicit @@ -678,7 +690,7 @@ template } void - swap(vector& __x) + swap(vector& __x) { std::swap(this->_M_impl._M_start, __x._M_impl._M_start); std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); Modified: stable/9/contrib/libstdc++/include/bits/stl_deque.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_deque.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_deque.h Sat Jun 23 20:33:29 2012 (r237507) @@ -380,6 +380,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; + _Deque_base() + : _M_impl() + { _M_initialize_map(0); } + _Deque_base(const allocator_type& __a, size_t __num_elements) : _M_impl(__a) { _M_initialize_map(__num_elements); } @@ -406,6 +410,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL iterator _M_start; iterator _M_finish; + _Deque_impl() + : _Tp_alloc_type(), _M_map(0), _M_map_size(0), + _M_start(), _M_finish() + { } + _Deque_impl(const _Tp_alloc_type& __a) : _Tp_alloc_type(__a), _M_map(0), _M_map_size(0), _M_start(), _M_finish() @@ -679,8 +688,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + deque() + : _Base() { } + explicit - deque(const allocator_type& __a = allocator_type()) + deque(const allocator_type& __a) : _Base(__a, 0) {} /** Modified: stable/9/contrib/libstdc++/include/bits/stl_list.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_list.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_list.h Sat Jun 23 20:33:29 2012 (r237507) @@ -305,6 +305,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL { _List_node_base _M_node; + _List_impl() + : _Node_alloc_type(), _M_node() + { } + _List_impl(const _Node_alloc_type& __a) : _Node_alloc_type(__a), _M_node() { } @@ -339,6 +343,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Node_allocator()); } + _List_base() + : _M_impl() + { _M_init(); } + _List_base(const allocator_type& __a) : _M_impl(__a) { _M_init(); } @@ -468,8 +476,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + list() + : _Base() { } + explicit - list(const allocator_type& __a = allocator_type()) + list(const allocator_type& __a) : _Base(__a) { } /** Modified: stable/9/contrib/libstdc++/include/bits/stl_map.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_map.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_map.h Sat Jun 23 20:33:29 2012 (r237507) @@ -155,7 +155,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ map() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } // for some reason this was made a separate function /** @@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template map(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_unique(__first, __last); } /** Modified: stable/9/contrib/libstdc++/include/bits/stl_multimap.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_multimap.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_multimap.h Sat Jun 23 20:33:29 2012 (r237507) @@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ multimap() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } // for some reason this was made a separate function /** @@ -184,8 +184,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template multimap(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t._M_insert_equal(__first, __last); } + : _M_t() + { _M_t._M_insert_unique(__first, __last); } /** * @brief Builds a %multimap from a range. Modified: stable/9/contrib/libstdc++/include/bits/stl_multiset.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_multiset.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_multiset.h Sat Jun 23 20:33:29 2012 (r237507) @@ -134,7 +134,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ multiset() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } explicit multiset(const _Compare& __comp, @@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template multiset(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_equal(__first, __last); } /** @@ -180,7 +180,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * The newly-created %multiset uses a copy of the allocation object used * by @a x. */ - multiset(const multiset<_Key,_Compare,_Alloc>& __x) + multiset(const multiset& __x) : _M_t(__x._M_t) { } /** @@ -190,8 +190,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * All the elements of @a x are copied, but unlike the copy constructor, * the allocator object is not copied. */ - multiset<_Key,_Compare,_Alloc>& - operator=(const multiset<_Key,_Compare,_Alloc>& __x) + multiset& + operator=(const multiset& __x) { _M_t = __x._M_t; return *this; @@ -275,7 +275,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * std::swap(s1,s2) will feed to this function. */ void - swap(multiset<_Key, _Compare, _Alloc>& __x) + swap(multiset& __x) { _M_t.swap(__x._M_t); } // insert/erase Modified: stable/9/contrib/libstdc++/include/bits/stl_set.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_set.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_set.h Sat Jun 23 20:33:29 2012 (r237507) @@ -138,7 +138,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL // allocation/deallocation /// Default constructor creates no elements. set() - : _M_t(_Compare(), allocator_type()) {} + : _M_t() { } /** * @brief Default constructor creates no elements. @@ -162,7 +162,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template set(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_unique(__first, __last); } /** @@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * The newly-created %set uses a copy of the allocation object used * by @a x. */ - set(const set<_Key,_Compare,_Alloc>& __x) + set(const set& __x) : _M_t(__x._M_t) { } /** @@ -200,8 +200,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * All the elements of @a x are copied, but unlike the copy constructor, * the allocator object is not copied. */ - set<_Key,_Compare,_Alloc>& - operator=(const set<_Key, _Compare, _Alloc>& __x) + set& + operator=(const set& __x) { _M_t = __x._M_t; return *this; @@ -283,7 +283,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * std::swap(s1,s2) will feed to this function. */ void - swap(set<_Key,_Compare,_Alloc>& __x) + swap(set& __x) { _M_t.swap(__x._M_t); } // insert/erase Modified: stable/9/contrib/libstdc++/include/bits/stl_tree.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_tree.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_tree.h Sat Jun 23 20:33:29 2012 (r237507) @@ -410,10 +410,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree_node_base _M_header; size_type _M_node_count; // Keeps track of size of tree. - _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(), - const _Key_compare& __comp = _Key_compare()) - : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), + _Rb_tree_impl() + : _Node_allocator(), _M_key_compare(), _M_header(), _M_node_count(0) + { _M_initialize(); } + + _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) + : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), + _M_node_count(0) + { _M_initialize(); } + + private: + void + _M_initialize() { this->_M_header._M_color = _S_red; this->_M_header._M_parent = 0; @@ -431,11 +440,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree_node_base _M_header; size_type _M_node_count; // Keeps track of size of tree. - _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(), - const _Key_compare& __comp = _Key_compare()) + _Rb_tree_impl() + : _Node_allocator(), _M_key_compare(), _M_header(), + _M_node_count(0) + { _M_initialize(); } + + _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), _M_node_count(0) - { + { _M_initialize(); } + + private: + void + _M_initialize() + { this->_M_header._M_color = _S_red; this->_M_header._M_parent = 0; this->_M_header._M_left = &this->_M_header; @@ -568,16 +586,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree() { } - _Rb_tree(const _Compare& __comp) - : _M_impl(allocator_type(), __comp) - { } - - _Rb_tree(const _Compare& __comp, const allocator_type& __a) - : _M_impl(__a, __comp) + _Rb_tree(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_impl(__comp, __a) { } - _Rb_tree(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x) - : _M_impl(__x._M_get_Node_allocator(), __x._M_impl._M_key_compare) + _Rb_tree(const _Rb_tree& __x) + : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator()) { if (__x._M_root() != 0) { @@ -591,8 +606,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ~_Rb_tree() { _M_erase(_M_begin()); } - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& - operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x); + _Rb_tree& + operator=(const _Rb_tree& __x); // Accessors. _Compare @@ -653,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return get_allocator().max_size(); } void - swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t); + swap(_Rb_tree& __t); // Insert/erase. pair Modified: stable/9/contrib/libstdc++/include/bits/stl_vector.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/stl_vector.h Sat Jun 23 19:49:18 2012 (r237506) +++ stable/9/contrib/libstdc++/include/bits/stl_vector.h Sat Jun 23 20:33:29 2012 (r237507) @@ -84,6 +84,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL _Tp* _M_start; _Tp* _M_finish; _Tp* _M_end_of_storage; + + _Vector_impl() + : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0) + { } + _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) { } @@ -104,6 +109,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Tp_allocator()); } + _Vector_base() + : _M_impl() { } + _Vector_base(const allocator_type& __a) : _M_impl(__a) { } @@ -194,8 +202,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + vector() + : _Base() { } + explicit - vector(const allocator_type& __a = allocator_type()) + vector(const allocator_type& __a) : _Base(__a) { } From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 20:37:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28090106566B; Sat, 23 Jun 2012 20:37:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F6608FC0A; Sat, 23 Jun 2012 20:37:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NKbSW7063404; Sat, 23 Jun 2012 20:37:28 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NKbRP5063393; Sat, 23 Jun 2012 20:37:27 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206232037.q5NKbRP5063393@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sat, 23 Jun 2012 20:37:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237508 - stable/8/contrib/libstdc++/include/bits X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 20:37:28 -0000 Author: pfg Date: Sat Jun 23 20:37:27 2012 New Revision: 237508 URL: http://svn.freebsd.org/changeset/base/237508 Log: MFC: r236829 Bring a couple of libstdc++ patches from Apple's llvm-gcc project. Modified Fri Jul 10 07:44:34 2009 CDT by rafael backport part of http://gcc.gnu.org/ml/gcc-cvs/2007-10/msg00118.html The patch is for libstdc++ and it was GPL2 at the time. Modified Tue Apr 29 01:20:19 2008 CDT by asl Backport from mainline (pre-GPLv3). Fix for sizeof(const void*) > sizeof(unsigned long). Modified: stable/8/contrib/libstdc++/include/bits/locale_facets.tcc stable/8/contrib/libstdc++/include/bits/stl_bvector.h stable/8/contrib/libstdc++/include/bits/stl_deque.h stable/8/contrib/libstdc++/include/bits/stl_list.h stable/8/contrib/libstdc++/include/bits/stl_map.h stable/8/contrib/libstdc++/include/bits/stl_multimap.h stable/8/contrib/libstdc++/include/bits/stl_multiset.h stable/8/contrib/libstdc++/include/bits/stl_set.h stable/8/contrib/libstdc++/include/bits/stl_tree.h stable/8/contrib/libstdc++/include/bits/stl_vector.h Directory Properties: stable/8/contrib/libstdc++/ (props changed) Modified: stable/8/contrib/libstdc++/include/bits/locale_facets.tcc ============================================================================== --- stable/8/contrib/libstdc++/include/bits/locale_facets.tcc Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/locale_facets.tcc Sat Jun 23 20:37:27 2012 (r237508) @@ -887,7 +887,11 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE const fmtflags __fmt = __io.flags(); __io.flags(__fmt & ~ios_base::basefield | ios_base::hex); - unsigned long __ul; + typedef __gnu_cxx::__conditional_type<(sizeof(void*) + <= sizeof(unsigned long)), + unsigned long, unsigned long long>::__type _UIntPtrType; + + _UIntPtrType __ul; __beg = _M_extract_int(__beg, __end, __io, __err, __ul); // Reset from hex formatted input. @@ -1309,8 +1313,12 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE | ios_base::internal); __io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase)); + typedef __gnu_cxx::__conditional_type<(sizeof(const void*) + <= sizeof(unsigned long)), + unsigned long, unsigned long long>::__type _UIntPtrType; + __s = _M_insert_int(__s, __io, __fill, - reinterpret_cast(__v)); + reinterpret_cast<_UIntPtrType>(__v)); __io.flags(__flags); return __s; } Modified: stable/8/contrib/libstdc++/include/bits/stl_bvector.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_bvector.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_bvector.h Sat Jun 23 20:37:27 2012 (r237508) @@ -385,6 +385,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL _Bit_iterator _M_start; _Bit_iterator _M_finish; _Bit_type* _M_end_of_storage; + + _Bvector_impl() + : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage(0) + { } + _Bvector_impl(const _Bit_alloc_type& __a) : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0) { } @@ -405,7 +410,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Bit_allocator()); } - _Bvector_base(const allocator_type& __a) : _M_impl(__a) { } + _Bvector_base() + : _M_impl() { } + + _Bvector_base(const allocator_type& __a) + : _M_impl(__a) { } ~_Bvector_base() { this->_M_deallocate(); } @@ -480,8 +489,11 @@ template using _Base::_M_get_Bit_allocator; public: + vector() + : _Base() { } + explicit - vector(const allocator_type& __a = allocator_type()) + vector(const allocator_type& __a) : _Base(__a) { } explicit @@ -678,7 +690,7 @@ template } void - swap(vector& __x) + swap(vector& __x) { std::swap(this->_M_impl._M_start, __x._M_impl._M_start); std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); Modified: stable/8/contrib/libstdc++/include/bits/stl_deque.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_deque.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_deque.h Sat Jun 23 20:37:27 2012 (r237508) @@ -380,6 +380,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; + _Deque_base() + : _M_impl() + { _M_initialize_map(0); } + _Deque_base(const allocator_type& __a, size_t __num_elements) : _M_impl(__a) { _M_initialize_map(__num_elements); } @@ -406,6 +410,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL iterator _M_start; iterator _M_finish; + _Deque_impl() + : _Tp_alloc_type(), _M_map(0), _M_map_size(0), + _M_start(), _M_finish() + { } + _Deque_impl(const _Tp_alloc_type& __a) : _Tp_alloc_type(__a), _M_map(0), _M_map_size(0), _M_start(), _M_finish() @@ -679,8 +688,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + deque() + : _Base() { } + explicit - deque(const allocator_type& __a = allocator_type()) + deque(const allocator_type& __a) : _Base(__a, 0) {} /** Modified: stable/8/contrib/libstdc++/include/bits/stl_list.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_list.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_list.h Sat Jun 23 20:37:27 2012 (r237508) @@ -305,6 +305,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL { _List_node_base _M_node; + _List_impl() + : _Node_alloc_type(), _M_node() + { } + _List_impl(const _Node_alloc_type& __a) : _Node_alloc_type(__a), _M_node() { } @@ -339,6 +343,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Node_allocator()); } + _List_base() + : _M_impl() + { _M_init(); } + _List_base(const allocator_type& __a) : _M_impl(__a) { _M_init(); } @@ -468,8 +476,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + list() + : _Base() { } + explicit - list(const allocator_type& __a = allocator_type()) + list(const allocator_type& __a) : _Base(__a) { } /** Modified: stable/8/contrib/libstdc++/include/bits/stl_map.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_map.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_map.h Sat Jun 23 20:37:27 2012 (r237508) @@ -155,7 +155,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ map() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } // for some reason this was made a separate function /** @@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template map(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_unique(__first, __last); } /** Modified: stable/8/contrib/libstdc++/include/bits/stl_multimap.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_multimap.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_multimap.h Sat Jun 23 20:37:27 2012 (r237508) @@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ multimap() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } // for some reason this was made a separate function /** @@ -184,8 +184,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template multimap(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t._M_insert_equal(__first, __last); } + : _M_t() + { _M_t._M_insert_unique(__first, __last); } /** * @brief Builds a %multimap from a range. Modified: stable/8/contrib/libstdc++/include/bits/stl_multiset.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_multiset.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_multiset.h Sat Jun 23 20:37:27 2012 (r237508) @@ -134,7 +134,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ multiset() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } explicit multiset(const _Compare& __comp, @@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template multiset(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_equal(__first, __last); } /** @@ -180,7 +180,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * The newly-created %multiset uses a copy of the allocation object used * by @a x. */ - multiset(const multiset<_Key,_Compare,_Alloc>& __x) + multiset(const multiset& __x) : _M_t(__x._M_t) { } /** @@ -190,8 +190,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * All the elements of @a x are copied, but unlike the copy constructor, * the allocator object is not copied. */ - multiset<_Key,_Compare,_Alloc>& - operator=(const multiset<_Key,_Compare,_Alloc>& __x) + multiset& + operator=(const multiset& __x) { _M_t = __x._M_t; return *this; @@ -275,7 +275,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * std::swap(s1,s2) will feed to this function. */ void - swap(multiset<_Key, _Compare, _Alloc>& __x) + swap(multiset& __x) { _M_t.swap(__x._M_t); } // insert/erase Modified: stable/8/contrib/libstdc++/include/bits/stl_set.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_set.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_set.h Sat Jun 23 20:37:27 2012 (r237508) @@ -138,7 +138,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL // allocation/deallocation /// Default constructor creates no elements. set() - : _M_t(_Compare(), allocator_type()) {} + : _M_t() { } /** * @brief Default constructor creates no elements. @@ -162,7 +162,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template set(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_unique(__first, __last); } /** @@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * The newly-created %set uses a copy of the allocation object used * by @a x. */ - set(const set<_Key,_Compare,_Alloc>& __x) + set(const set& __x) : _M_t(__x._M_t) { } /** @@ -200,8 +200,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * All the elements of @a x are copied, but unlike the copy constructor, * the allocator object is not copied. */ - set<_Key,_Compare,_Alloc>& - operator=(const set<_Key, _Compare, _Alloc>& __x) + set& + operator=(const set& __x) { _M_t = __x._M_t; return *this; @@ -283,7 +283,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * std::swap(s1,s2) will feed to this function. */ void - swap(set<_Key,_Compare,_Alloc>& __x) + swap(set& __x) { _M_t.swap(__x._M_t); } // insert/erase Modified: stable/8/contrib/libstdc++/include/bits/stl_tree.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_tree.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_tree.h Sat Jun 23 20:37:27 2012 (r237508) @@ -410,10 +410,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree_node_base _M_header; size_type _M_node_count; // Keeps track of size of tree. - _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(), - const _Key_compare& __comp = _Key_compare()) - : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), + _Rb_tree_impl() + : _Node_allocator(), _M_key_compare(), _M_header(), _M_node_count(0) + { _M_initialize(); } + + _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) + : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), + _M_node_count(0) + { _M_initialize(); } + + private: + void + _M_initialize() { this->_M_header._M_color = _S_red; this->_M_header._M_parent = 0; @@ -431,11 +440,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree_node_base _M_header; size_type _M_node_count; // Keeps track of size of tree. - _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(), - const _Key_compare& __comp = _Key_compare()) + _Rb_tree_impl() + : _Node_allocator(), _M_key_compare(), _M_header(), + _M_node_count(0) + { _M_initialize(); } + + _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), _M_node_count(0) - { + { _M_initialize(); } + + private: + void + _M_initialize() + { this->_M_header._M_color = _S_red; this->_M_header._M_parent = 0; this->_M_header._M_left = &this->_M_header; @@ -568,16 +586,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree() { } - _Rb_tree(const _Compare& __comp) - : _M_impl(allocator_type(), __comp) - { } - - _Rb_tree(const _Compare& __comp, const allocator_type& __a) - : _M_impl(__a, __comp) + _Rb_tree(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_impl(__comp, __a) { } - _Rb_tree(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x) - : _M_impl(__x._M_get_Node_allocator(), __x._M_impl._M_key_compare) + _Rb_tree(const _Rb_tree& __x) + : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator()) { if (__x._M_root() != 0) { @@ -591,8 +606,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ~_Rb_tree() { _M_erase(_M_begin()); } - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& - operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x); + _Rb_tree& + operator=(const _Rb_tree& __x); // Accessors. _Compare @@ -653,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return get_allocator().max_size(); } void - swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t); + swap(_Rb_tree& __t); // Insert/erase. pair Modified: stable/8/contrib/libstdc++/include/bits/stl_vector.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/stl_vector.h Sat Jun 23 20:33:29 2012 (r237507) +++ stable/8/contrib/libstdc++/include/bits/stl_vector.h Sat Jun 23 20:37:27 2012 (r237508) @@ -84,6 +84,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL _Tp* _M_start; _Tp* _M_finish; _Tp* _M_end_of_storage; + + _Vector_impl() + : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0) + { } + _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) { } @@ -104,6 +109,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Tp_allocator()); } + _Vector_base() + : _M_impl() { } + _Vector_base(const allocator_type& __a) : _M_impl(__a) { } @@ -194,8 +202,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + vector() + : _Base() { } + explicit - vector(const allocator_type& __a = allocator_type()) + vector(const allocator_type& __a) : _Base(__a) { } From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 20:44:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02DA9106566B; Sat, 23 Jun 2012 20:44:46 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9C4D8FC08; Sat, 23 Jun 2012 20:44:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NKijTi063743; Sat, 23 Jun 2012 20:44:45 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NKij1q063741; Sat, 23 Jun 2012 20:44:45 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206232044.q5NKij1q063741@svn.freebsd.org> From: Joel Dahl Date: Sat, 23 Jun 2012 20:44:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237509 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 20:44:46 -0000 Author: joel (doc committer) Date: Sat Jun 23 20:44:45 2012 New Revision: 237509 URL: http://svn.freebsd.org/changeset/base/237509 Log: Remove superfluous paragraph macro. Modified: head/share/man/man4/acpi_ibm.4 Modified: head/share/man/man4/acpi_ibm.4 ============================================================================== --- head/share/man/man4/acpi_ibm.4 Sat Jun 23 20:37:27 2012 (r237508) +++ head/share/man/man4/acpi_ibm.4 Sat Jun 23 20:44:45 2012 (r237509) @@ -460,7 +460,6 @@ in .Bd -literal -offset indent dev.acpi_ibm.0.handlerevents=0x04\\ 0x10\\ 0x11 .Ed -.Pp .Sh SEE ALSO .Xr acpi 4 , .Xr led 4 , From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 21:29:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 129761065673; Sat, 23 Jun 2012 21:29:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F08228FC0C; Sat, 23 Jun 2012 21:29:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NLTrua065797; Sat, 23 Jun 2012 21:29:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NLTrQp065794; Sat, 23 Jun 2012 21:29:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206232129.q5NLTrQp065794@svn.freebsd.org> From: Eitan Adler Date: Sat, 23 Jun 2012 21:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237511 - stable/9/share/syscons/keymaps X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 21:29:54 -0000 Author: eadler Date: Sat Jun 23 21:29:53 2012 New Revision: 237511 URL: http://svn.freebsd.org/changeset/base/237511 Log: MFC r235251: Add Spanish Dvorak keyboard model to syscons. PR: conf/160235 Approved by: cperciva (implicit) Added: stable/9/share/syscons/keymaps/spanish.dvorak.kbd - copied unchanged from r235251, head/share/syscons/keymaps/spanish.dvorak.kbd Modified: stable/9/share/syscons/keymaps/Makefile Directory Properties: stable/9/share/syscons/ (props changed) Modified: stable/9/share/syscons/keymaps/Makefile ============================================================================== --- stable/9/share/syscons/keymaps/Makefile Sat Jun 23 21:03:50 2012 (r237510) +++ stable/9/share/syscons/keymaps/Makefile Sat Jun 23 21:29:53 2012 (r237511) @@ -36,6 +36,7 @@ FILES= INDEX.keymaps \ ru.cp866.kbd ru.iso5.kbd \ si.iso.kbd \ sk.iso2.kbd \ + spanish.dvorak.kbd \ spanish.iso.kbd spanish.iso.acc.kbd spanish.iso15.acc.kbd \ swedish.iso.kbd swedish.cp850.kbd \ swissfrench.iso.kbd swissfrench.iso.acc.kbd swissfrench.cp850.kbd \ Copied: stable/9/share/syscons/keymaps/spanish.dvorak.kbd (from r235251, head/share/syscons/keymaps/spanish.dvorak.kbd) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/syscons/keymaps/spanish.dvorak.kbd Sat Jun 23 21:29:53 2012 (r237511, copy of r235251, head/share/syscons/keymaps/spanish.dvorak.kbd) @@ -0,0 +1,139 @@ +# $FreeBSD$ +# alt +# scan cntrl alt alt cntrl lock +# code base shift cntrl shift alt shift cntrl shift state +# ------------------------------------------------------------------ + 000 nop nop nop nop nop nop nop nop O + 001 esc esc esc esc esc esc debug esc O + 002 '1' '!' nop nop '|' '!' nop nop O + 003 '2' '"' nop nop '@' '"' nop nop O + 004 '3' 183 nop nop '#' '#' nop nop O + 005 '4' '$' nop nop '~' '~' nop nop O + 006 '5' '%' nop nop '5' '%' nop nop O + 007 '6' '&' nop nop 172 172 nop nop O + 008 '7' '/' nop nop '7' '/' nop nop O + 009 '8' '(' nop nop '8' '(' nop nop O + 010 '9' ')' nop nop '9' ')' nop nop O + 011 '0' '=' nop nop '0' '=' nop nop O + 012 ''' '?' nop nop ''' '?' nop nop O + 013 161 191 nop nop 161 191 nop nop O + 014 bs bs del del bs bs del del O + 015 ht btab nop nop ht btab nop nop O + 016 '.' ':' nop nop '.' ':' nop nop O + 017 ',' ';' nop nop ',' ';' nop nop O + 018 241 209 nop nop '~' '~' nop nop O + 019 'p' 'P' dle dle 'p' 'P' dle dle C + 020 'y' 'Y' em em 'y' 'Y' em em C + 021 'f' 'F' ack ack 'f' 'F' ack ack C + 022 'g' 'G' bel bel 'g' 'G' bel bel C + 023 'c' 'C' etx etx 'c' 'C' etx etx C + 024 'h' 'H' bs bs 'h' 'H' bs bs C + 025 'l' 'L' ff ff 'l' 'L' ff ff C + 026 dgra dcir esc esc '[' '[' esc esc O + 027 '+' '*' gs gs ']' ']' gs gs O + 028 cr cr nl nl cr cr nl nl O + 029 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 030 'a' 'A' soh soh 'a' 'A' soh soh C + 031 'o' 'O' si si 243 211 si si C + 032 'e' 'E' enq enq 164 164 enq enq C + 033 'u' 'U' nak nak 250 218 nak nak C + 034 'i' 'I' ht ht 237 205 ht ht C + 035 'd' 'D' eot eot 'd' 'D' eot eot C + 036 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C + 037 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C + 038 'n' 'N' so so 'n' 'N' so so C + 039 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C + 040 dacu duml nop nop '{' '{' nop nop O + 041 '\' '|' fs fs '\' '|' fs fs O + 042 lshift lshift lshift lshift lshift lshift lshift lshift O + 043 231 199 rs rs '}' '}' rs rs O + 044 '-' '_' us us '-' '_' us us O + 045 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C + 046 'j' 'J' nl nl 'j' 'J' nl nl C + 047 'k' 'K' vt vt 'k' 'K' vt vt C + 048 'x' 'X' can can 'x' 'X' can can C + 049 'b' 'B' stx stx 'b' 'B' stx stx C + 050 'm' 'M' cr cr 'm' 'M' cr cr C + 051 'w' 'W' etb etb 'w' 'W' etb etb C + 052 'v' 'V' syn syn 'v' 'V' syn syn C + 053 'z' 'Z' sub sub 'z' 'Z' sub sub C + 054 rshift rshift rshift rshift rshift rshift rshift rshift O + 055 '*' '*' '*' '*' '*' '*' '*' '*' O + 056 lalt lalt lalt lalt lalt lalt lalt lalt O + 057 ' ' ' ' nul ' ' ' ' ' ' susp ' ' O + 058 clock clock clock clock clock clock clock clock O + 059 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O + 060 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O + 061 fkey03 fkey15 fkey27 fkey39 scr03 scr13 scr03 scr13 O + 062 fkey04 fkey16 fkey28 fkey40 scr04 scr14 scr04 scr14 O + 063 fkey05 fkey17 fkey29 fkey41 scr05 scr15 scr05 scr15 O + 064 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O + 065 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O + 066 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O + 067 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O + 068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O + 069 nlock nlock nlock nlock nlock nlock nlock nlock O + 070 slock slock slock slock slock slock slock slock O + 071 fkey49 '7' '7' '7' '7' '7' '7' '7' N + 072 fkey50 '8' '8' '8' '8' '8' '8' '8' N + 073 fkey51 '9' '9' '9' '9' '9' '9' '9' N + 074 fkey52 '-' '-' '-' '-' '-' '-' '-' N + 075 fkey53 '4' '4' '4' '4' '4' '4' '4' N + 076 fkey54 '5' '5' '5' '5' '5' '5' '5' N + 077 fkey55 '6' '6' '6' '6' '6' '6' '6' N + 078 fkey56 '+' '+' '+' '+' '+' '+' '+' N + 079 fkey57 '1' '1' '1' '1' '1' '1' '1' N + 080 fkey58 '2' '2' '2' '2' '2' '2' '2' N + 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N + 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N + 083 del '.' '.' '.' '.' '.' boot boot N + 084 nop nop nop nop nop nop nop nop O + 085 nop nop nop nop nop nop nop nop O + 086 '<' '>' nop nop '<' '>' nop nop O + 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O + 088 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O + 089 cr cr nl nl cr cr nl nl O + 090 rctrl rctrl rctrl rctrl rctrl rctrl rctrl rctrl O + 091 '/' '/' '/' '/' '/' '/' '/' '/' N + 092 nscr pscr debug debug nop nop nop nop O + 093 ralt ralt ralt ralt ralt ralt ralt ralt O + 094 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O + 095 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O + 096 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O + 097 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O + 098 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O + 099 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O + 100 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O + 101 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O + 102 fkey60 paste fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O + 103 fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot fkey61 O + 104 slock saver slock saver susp nop susp nop O + 105 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O + 106 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O + 107 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O + 108 nop nop nop nop nop nop nop nop O + + dgra '`' ( 'a' 224 ) ( 'A' 192 ) ( 'e' 232 ) ( 'E' 200 ) + ( 'i' 236 ) ( 'I' 204 ) ( 'o' 242 ) ( 'O' 210 ) + ( 'u' 249 ) ( 'U' 217 ) + dacu 180 ( 'a' 225 ) ( 'A' 193 ) ( 'e' 233 ) ( 'E' 201 ) + ( 'i' 237 ) ( 'I' 205 ) ( 'o' 243 ) ( 'O' 211 ) + ( 'u' 250 ) ( 'U' 218 ) ( 'y' 253 ) ( 'Y' 221 ) + dcir '^' ( 'a' 226 ) ( 'A' 194 ) ( 'e' 234 ) ( 'E' 202 ) + ( 'i' 238 ) ( 'I' 206 ) ( 'o' 244 ) ( 'O' 212 ) + ( 'u' 251 ) ( 'U' 219 ) + dtil '~' ( 'a' 227 ) ( 'A' 195 ) ( 'n' 241 ) ( 'N' 209 ) + ( 'o' 245 ) ( 'O' 213 ) + dmac 000 + dbre 000 + ddot 000 + duml 168 ( 'a' 228 ) ( 'A' 196 ) ( 'e' 235 ) ( 'E' 203 ) + ( 'i' 239 ) ( 'I' 207 ) ( 'o' 246 ) ( 'O' 214 ) + ( 'u' 252 ) ( 'U' 220 ) ( 'y' 255 ) + dsla 000 + drin 176 ( 'a' 229 ) ( 'A' 197 ) + dced 184 ( 'c' 231 ) ( 'C' 199 ) + dapo 000 + ddac 000 + dogo 000 + dcar 000 From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 22:12:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B961106564A; Sat, 23 Jun 2012 22:12:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DAFD8FC18; Sat, 23 Jun 2012 22:12:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NMCSkv067616; Sat, 23 Jun 2012 22:12:28 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NMCRwR067614; Sat, 23 Jun 2012 22:12:27 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201206232212.q5NMCRwR067614@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 23 Jun 2012 22:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237512 - head/sys/dev/cxgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 22:12:28 -0000 Author: np Date: Sat Jun 23 22:12:27 2012 New Revision: 237512 URL: http://svn.freebsd.org/changeset/base/237512 Log: Better way to determine the status page length and rx pad boundary. Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat Jun 23 21:29:53 2012 (r237511) +++ head/sys/dev/cxgbe/t4_sge.c Sat Jun 23 22:12:27 2012 (r237512) @@ -70,12 +70,8 @@ enum { FL_PKTSHIFT = 2 }; -#define FL_ALIGN min(CACHE_LINE_SIZE, 32) -#if CACHE_LINE_SIZE > 64 -#define SPG_LEN 128 -#else -#define SPG_LEN 64 -#endif +static int fl_pad = CACHE_LINE_SIZE; +static int spg_len = 64; /* Used to track coalesced tx work request */ struct txpkts { @@ -167,6 +163,10 @@ static int handle_fw_rpl(struct sge_iq * static int sysctl_uint16(SYSCTL_HANDLER_ARGS); +#if defined(__i386__) || defined(__amd64__) +extern u_int cpu_clflush_line_size; +#endif + /* * Called on MOD_LOAD and fills up fl_buf_info[]. */ @@ -188,6 +188,11 @@ t4_sge_modload(void) FL_BUF_TYPE(i) = m_gettype(bufsize[i]); FL_BUF_ZONE(i) = m_getzone(bufsize[i]); } + +#if defined(__i386__) || defined(__amd64__) + fl_pad = max(cpu_clflush_line_size, 32); + spg_len = cpu_clflush_line_size > 64 ? 128 : 64; +#endif } /** @@ -209,8 +214,8 @@ t4_sge_init(struct adapter *sc) V_INGPADBOUNDARY(M_INGPADBOUNDARY) | F_EGRSTATUSPAGESIZE; ctrl_val = V_PKTSHIFT(FL_PKTSHIFT) | F_RXPKTCPLMODE | - V_INGPADBOUNDARY(ilog2(FL_ALIGN) - 5) | - V_EGRSTATUSPAGESIZE(SPG_LEN == 128); + V_INGPADBOUNDARY(ilog2(fl_pad) - 5) | + V_EGRSTATUSPAGESIZE(spg_len == 128); hpsize = V_HOSTPAGESIZEPF0(PAGE_SHIFT - 10) | V_HOSTPAGESIZEPF1(PAGE_SHIFT - 10) | @@ -1372,8 +1377,8 @@ t4_update_fl_bufsize(struct ifnet *ifp) int i, bufsize; /* large enough for a frame even when VLAN extraction is disabled */ - bufsize = FL_PKTSHIFT + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + - ifp->if_mtu; + bufsize = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ifp->if_mtu; + bufsize = roundup(bufsize + FL_PKTSHIFT, fl_pad); for_each_rxq(pi, i, rxq) { fl = &rxq->fl; @@ -1570,7 +1575,7 @@ alloc_iq_fl(struct port_info *pi, struct return (rc); /* Allocate space for one software descriptor per buffer. */ - fl->cap = (fl->qsize - SPG_LEN / RX_FL_ESIZE) * 8; + fl->cap = (fl->qsize - spg_len / RX_FL_ESIZE) * 8; FL_LOCK(fl); rc = alloc_fl_sdesc(fl); FL_UNLOCK(fl); @@ -2070,7 +2075,7 @@ alloc_eq(struct adapter *sc, struct port if (rc) return (rc); - eq->cap = eq->qsize - SPG_LEN / EQ_ESIZE; + eq->cap = eq->qsize - spg_len / EQ_ESIZE; eq->spg = (void *)&eq->desc[eq->cap]; eq->avail = eq->cap - 1; /* one less to avoid cidx = pidx */ eq->pidx = eq->cidx = 0; From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 22:16:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC677106566B; Sat, 23 Jun 2012 22:16:28 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 62C888FC0A; Sat, 23 Jun 2012 22:16:28 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5NMGQKn045015; Sun, 24 Jun 2012 00:16:27 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5NMGQGg045014; Sun, 24 Jun 2012 00:16:26 +0200 (CEST) (envelope-from marius) Date: Sun, 24 Jun 2012 00:16:26 +0200 From: Marius Strobl To: John Baldwin Message-ID: <20120623221626.GH69382@alchemy.franken.de> References: <201206131504.q5DF4opt031336@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206131504.q5DF4opt031336@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237008 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 22:16:29 -0000 On Wed, Jun 13, 2012 at 03:04:50PM +0000, John Baldwin wrote: > Author: jhb > Date: Wed Jun 13 15:04:50 2012 > New Revision: 237008 > URL: http://svn.freebsd.org/changeset/base/237008 > > Log: > Fix a couple of bugs that prevented windows in PCI-PCI bridges from > growing "downward" (moving the start address down). First, an off by > one error caused the end address to be moved down an extra alignment > chunk unnecessarily. Second, when aligning the new candidate starting > address, the wrong bits were masked off. > Unfortunately, this now panics a sparc64 machine on the first attempt to use a grown resource via bus_space(9) for me: pcib3: at device 0.0 on pci2 pcib2: allocated I/O port range (0x1000-0x1fff) for rid 1c of pcib3 pcib2: allocated memory range (0x200000-0x3ffffff) for rid 20 of pcib3 pcib3: domain 0 pcib3: secondary bus 5 pcib3: subordinate bus 5 pcib3: I/O decode 0x1000-0x1fff pcib3: memory decode 0x200000-0x3ffffff pcib3: no prefetched decode pcib3: Subtractively decoded bridge. <...> pci3: on pcib3 <...> isab0: at device 30.0 on pci3 isa0: on isab0 <...> rtc0: at port 0x70-0x73 on isa0 pcib3: attempting to grow I/O port window for (0x70-0x73,0x4) front candidate range: 0x70-0x73 pcib3: grew I/O port window to 0x70-0x1fff panic: start address is not aligned Alternatively, this may also be a data access trap, which also indicates that some invalid address being used for the access. before: rtc0: at port 0x70-0x73 on isa0 pcib3: attempting to grow I/O port window for (0x70-0x73,0x4) pcib2: allocated I/O port range (0x70-0x73) for rid 0 of rtc0 Shouldn't a subtractively decoded resource actually be outside of the window of the parent PCI-PCI bridge, i.e. it seems we shouldn't try to grow the window in that case? The below patch fixes this for me, I'm not sure whether that actually is the right approach though. Marius Index: pci_pci.c =================================================================== --- pci_pci.c (revision 237511) +++ pci_pci.c (working copy) @@ -1038,7 +1038,7 @@ pcib_alloc_resource(device_t dev, device_t child, case SYS_RES_IOPORT: r = pcib_suballoc_resource(sc, &sc->io, child, type, rid, start, end, count, flags); - if (r != NULL) + if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) break; if (pcib_grow_window(sc, &sc->io, type, start, end, count, flags) == 0) @@ -1062,7 +1062,7 @@ pcib_alloc_resource(device_t dev, device_t child, } r = pcib_suballoc_resource(sc, &sc->mem, child, type, rid, start, end, count, flags); - if (r != NULL) + if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) break; if (flags & RF_PREFETCHABLE) { if (pcib_grow_window(sc, &sc->pmem, type, start, end, From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 22:54:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 499741065672; Sat, 23 Jun 2012 22:54:26 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34AE88FC0C; Sat, 23 Jun 2012 22:54:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NMsQkk069427; Sat, 23 Jun 2012 22:54:26 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NMsPGR069425; Sat, 23 Jun 2012 22:54:26 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206232254.q5NMsPGR069425@svn.freebsd.org> From: Alan Cox Date: Sat, 23 Jun 2012 22:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237513 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 22:54:26 -0000 Author: alc Date: Sat Jun 23 22:54:25 2012 New Revision: 237513 URL: http://svn.freebsd.org/changeset/base/237513 Log: Introduce reserve_pv_entry() and use it in pmap_pv_demote_pde(). In order to add PV list locking to pmap_pv_demote_pde(), it is necessary to change the way that pmap_pv_demote_pde() allocates PV entries. Specifically, once pmap_pv_demote_pde() begins modifying the PV lists, it can't allocate any new PV chunks, because that could require the PV list lock to be dropped. So, all necessary PV chunks must be allocated in advance. To my surprise, this new approach is a few percent faster than the old one. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Jun 23 22:12:27 2012 (r237512) +++ head/sys/amd64/amd64/pmap.c Sat Jun 23 22:54:25 2012 (r237513) @@ -256,6 +256,8 @@ static caddr_t crashdumpmap; static void free_pv_chunk(struct pv_chunk *pc); static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try); +static int popcnt_pc_map_elem(uint64_t elem); +static void reserve_pv_entry(pmap_t pmap, int needed); static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, struct rwlock **lockp); @@ -2331,6 +2333,85 @@ retry: } /* + * Returns the number of one bits within the given PV chunk map element. + */ +static int +popcnt_pc_map_elem(uint64_t elem) +{ + int count; + + /* + * This simple method of counting the one bits performs well because + * the given element typically contains more zero bits than one bits. + */ + count = 0; + for (; elem != 0; elem &= elem - 1) + count++; + return (count); +} + +/* + * Ensure that the number of spare PV entries in the specified pmap meets or + * exceeds the given count, "needed". + */ +static void +reserve_pv_entry(pmap_t pmap, int needed) +{ + struct pch new_tail; + struct pv_chunk *pc; + int avail, free; + vm_page_t m; + + rw_assert(&pvh_global_lock, RA_LOCKED); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + + /* + * Newly allocated PV chunks must be stored in a private list until + * the required number of PV chunks have been allocated. Otherwise, + * pmap_pv_reclaim() could recycle one of these chunks. In contrast, + * these chunks must be added to the pmap upon allocation. + */ + TAILQ_INIT(&new_tail); +retry: + avail = 0; + TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) { + free = popcnt_pc_map_elem(pc->pc_map[0]); + free += popcnt_pc_map_elem(pc->pc_map[1]); + free += popcnt_pc_map_elem(pc->pc_map[2]); + if (free == 0) + break; + avail += free; + if (avail >= needed) + break; + } + for (; avail < needed; avail += _NPCPV) { + m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED); + if (m == NULL) { + m = pmap_pv_reclaim(pmap); + if (m == NULL) + goto retry; + } + PV_STAT(atomic_add_int(&pc_chunk_count, 1)); + PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); + dump_add_page(m->phys_addr); + pc = (void *)PHYS_TO_DMAP(m->phys_addr); + pc->pc_pmap = pmap; + pc->pc_map[0] = PC_FREE0; + pc->pc_map[1] = PC_FREE1; + pc->pc_map[2] = PC_FREE2; + TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); + TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); + PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); + } + if (!TAILQ_EMPTY(&new_tail)) { + mtx_lock(&pv_chunks_mutex); + TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru); + mtx_unlock(&pv_chunks_mutex); + } +} + +/* * First find and then remove the pv entry for the specified pmap and virtual * address from the specified pv list. Returns the pv entry if found and NULL * otherwise. This operation can be performed on pv lists for either 4KB or @@ -2367,6 +2448,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse rw_assert(&pvh_global_lock, RA_WLOCKED); KASSERT((pa & PDRMASK) == 0, ("pmap_pv_demote_pde: pa is not 2mpage aligned")); + reserve_pv_entry(pmap, NPTEPG - 1); /* * Transfer the 2mpage's pv entry for this mapping to the first @@ -2385,7 +2467,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_pv_demote_pde: page %p is not managed", m)); va += PAGE_SIZE; - pv = get_pv_entry(pmap, FALSE); + pv = get_pv_entry(pmap, TRUE); pv->pv_va = va; TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); } while (va < va_last);