From owner-svn-src-stable@FreeBSD.ORG Sun Dec 8 02:48:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6215F3AC; Sun, 8 Dec 2013 02:48:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4E23A1A59; Sun, 8 Dec 2013 02:48:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB82m7lg047648; Sun, 8 Dec 2013 02:48:07 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB82m7HY047647; Sun, 8 Dec 2013 02:48:07 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201312080248.rB82m7HY047647@svn.freebsd.org> From: Warner Losh Date: Sun, 8 Dec 2013 02:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259090 - stable/9/sys/arm/conf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Dec 2013 02:48:07 -0000 Author: imp Date: Sun Dec 8 02:48:06 2013 New Revision: 259090 URL: http://svnweb.freebsd.org/changeset/base/259090 Log: 4096 is 4MB, and macb doesn't even come close to working, so don't say it is an altenative. It hasn't worked in quite some time. The die hards can still try to use macb in the tree if they want... Modified: stable/9/sys/arm/conf/SAM9G20EK Modified: stable/9/sys/arm/conf/SAM9G20EK ============================================================================== --- stable/9/sys/arm/conf/SAM9G20EK Sun Dec 8 00:59:04 2013 (r259089) +++ stable/9/sys/arm/conf/SAM9G20EK Sun Dec 8 02:48:06 2013 (r259090) @@ -37,18 +37,18 @@ options FFS #Berkeley Fast Filesystem #options UFS_ACL #Support for access control lists #options UFS_DIRHASH #Improve performance on big directories #options MD_ROOT #MD is a potential root device -#options MD_ROOT_SIZE=4096 # 3MB ram disk +#options MD_ROOT_SIZE=4096 #4MB ram disk options NFSCL #New Network Filesystem Client -#options NFSD #New Network Filesystem Server -#options NFSLOCKD #Network Lock Manager -#options NFS_ROOT #NFS usable as /, requires NFSCL -#options BOOTP_NFSROOT -#options BOOTP -#options BOOTP_NFSV3 -#options BOOTP_WIRED_TO=ate0 -#options BOOTP_COMPAT +options NFSD #New Network Filesystem Server +options NFSLOCKD #Network Lock Manager +options NFS_ROOT #NFS usable as /, requires NFSCL +options BOOTP_NFSROOT +options BOOTP +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=ate0 +options BOOTP_COMPAT -options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" +#options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" options ALT_BREAK_TO_DEBUGGER @@ -86,7 +86,6 @@ device uart # Serial Ports # Ethernet device ate # Ethernet Driver -#device macb # Alternate Ethernet driver device mii option AT91_ATE_USE_RMII From owner-svn-src-stable@FreeBSD.ORG Sun Dec 8 03:49:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8ED8723B; Sun, 8 Dec 2013 03:49:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7A35D1EB3; Sun, 8 Dec 2013 03:49:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB83nkX7070670; Sun, 8 Dec 2013 03:49:46 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB83nkhC070669; Sun, 8 Dec 2013 03:49:46 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201312080349.rB83nkhC070669@svn.freebsd.org> From: Warner Losh Date: Sun, 8 Dec 2013 03:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259093 - stable/9/sys/arm/arm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Dec 2013 03:49:46 -0000 Author: imp Date: Sun Dec 8 03:49:45 2013 New Revision: 259093 URL: http://svnweb.freebsd.org/changeset/base/259093 Log: MFC: r246881 | ian | 2013-02-16 13:43:16 -0700 (Sat, 16 Feb 2013) | 4 lines In _bus_dmamap_addseg(), the return value must be zero for error, or the size actually added to the segment (possibly smaller than the requested size if boundary crossings had to be avoided). This fixes NFS root on Atmel platforms, and likely others. Modified: stable/9/sys/arm/arm/busdma_machdep.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/arm/arm/busdma_machdep.c ============================================================================== --- stable/9/sys/arm/arm/busdma_machdep.c Sun Dec 8 03:02:44 2013 (r259092) +++ stable/9/sys/arm/arm/busdma_machdep.c Sun Dec 8 03:49:45 2013 (r259093) @@ -913,7 +913,7 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, b dr = _bus_dma_inrange(dmat->ranges, dmat->_nranges, curaddr); if (dr == NULL) - return (EINVAL); + return (0); /* * In a valid DMA range. Translate the physical * memory address to an address in the DMA window. @@ -935,12 +935,12 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, b segs[seg].ds_len += sgsize; } else { if (++seg >= dmat->nsegments) - return (EFBIG); + return (0); segs[seg].ds_addr = curaddr; segs[seg].ds_len = sgsize; } *segp = seg; - return (0); + return (sgsize); } /* From owner-svn-src-stable@FreeBSD.ORG Mon Dec 9 20:47:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7BCD8F2; Mon, 9 Dec 2013 20:47:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 92DAA1F3A; Mon, 9 Dec 2013 20:47:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB9KloI2080715; Mon, 9 Dec 2013 20:47:50 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB9KloV7080714; Mon, 9 Dec 2013 20:47:50 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201312092047.rB9KloV7080714@svn.freebsd.org> From: Bryan Drewery Date: Mon, 9 Dec 2013 20:47:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259138 - stable/10/tools/build/options X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2013 20:47:50 -0000 Author: bdrewery (ports committer) Date: Mon Dec 9 20:47:50 2013 New Revision: 259138 URL: http://svnweb.freebsd.org/changeset/base/259138 Log: MFC r258924: Add missing period for WITHOUT_PKGBOOTSTRAP so that it matches all other entries. Approved by: bapt (implicit) Modified: stable/10/tools/build/options/WITHOUT_PKGBOOTSTRAP Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/build/options/WITHOUT_PKGBOOTSTRAP ============================================================================== --- stable/10/tools/build/options/WITHOUT_PKGBOOTSTRAP Mon Dec 9 20:29:54 2013 (r259137) +++ stable/10/tools/build/options/WITHOUT_PKGBOOTSTRAP Mon Dec 9 20:47:50 2013 (r259138) @@ -1,4 +1,4 @@ .\" $FreeBSD$ Set to not build .Xr pkg 7 -bootstrap tool +bootstrap tool. From owner-svn-src-stable@FreeBSD.ORG Mon Dec 9 21:07:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 59FB1FC0; Mon, 9 Dec 2013 21:07:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 459EE10BF; Mon, 9 Dec 2013 21:07:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB9L7wls088183; Mon, 9 Dec 2013 21:07:58 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB9L7w5a088182; Mon, 9 Dec 2013 21:07:58 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201312092107.rB9L7w5a088182@svn.freebsd.org> From: Bryan Drewery Date: Mon, 9 Dec 2013 21:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259139 - stable/10/share/man/man5 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2013 21:07:58 -0000 Author: bdrewery (ports committer) Date: Mon Dec 9 21:07:57 2013 New Revision: 259139 URL: http://svnweb.freebsd.org/changeset/base/259139 Log: Regenerate after r259138 Approved by: bapt (implicit) Modified: stable/10/share/man/man5/src.conf.5 Modified: stable/10/share/man/man5/src.conf.5 ============================================================================== --- stable/10/share/man/man5/src.conf.5 Mon Dec 9 20:47:50 2013 (r259138) +++ stable/10/share/man/man5/src.conf.5 Mon Dec 9 21:07:57 2013 (r259139) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: stable/10/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des .\" $FreeBSD$ -.Dd November 11, 2013 +.Dd December 9, 2013 .Dt SRC.CONF 5 .Os .Sh NAME @@ -851,10 +851,10 @@ When set, it also enforces the following .Va WITHOUT_AUTHPF .El .It Va WITHOUT_PKGBOOTSTRAP -.\" from FreeBSD: stable/10/tools/build/options/WITHOUT_PKGBOOTSTRAP 257573 2013-11-03 13:06:43Z bdrewery +.\" from FreeBSD: stable/10/tools/build/options/WITHOUT_PKGBOOTSTRAP 259138 2013-12-09 20:47:50Z bdrewery Set to not build .Xr pkg 7 -bootstrap tool +bootstrap tool. .It Va WITH_PKGTOOLS .\" from FreeBSD: stable/10/tools/build/options/WITH_PKGTOOLS 253305 2013-07-12 23:11:17Z bapt Set to build From owner-svn-src-stable@FreeBSD.ORG Mon Dec 9 21:32:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61DCF3FC; Mon, 9 Dec 2013 21:32:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4DC821228; Mon, 9 Dec 2013 21:32:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB9LWbxj098516; Mon, 9 Dec 2013 21:32:37 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB9LWb28098515; Mon, 9 Dec 2013 21:32:37 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201312092132.rB9LWb28098515@svn.freebsd.org> From: Peter Wemm Date: Mon, 9 Dec 2013 21:32:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259141 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2013 21:32:37 -0000 Author: peter Date: Mon Dec 9 21:32:36 2013 New Revision: 259141 URL: http://svnweb.freebsd.org/changeset/base/259141 Log: MFC r259094 - Fix undocumented side effect of r256256 that changes/breaks existing jails. This burned us in the freebsd cluster yesterday. Modified: stable/10/etc/rc.d/jail Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/jail ============================================================================== --- stable/10/etc/rc.d/jail Mon Dec 9 21:08:52 2013 (r259140) +++ stable/10/etc/rc.d/jail Mon Dec 9 21:32:36 2013 (r259141) @@ -319,8 +319,8 @@ jail_extract_address() _mask=${_mask:-/32} elif [ "${_type}" = "inet6" ]; then - # In case _maske is not set for IPv6, use /64. - _mask=${_mask:-/64} + # In case _maske is not set for IPv6, use /128. + _mask=${_mask:-/128} fi } From owner-svn-src-stable@FreeBSD.ORG Mon Dec 9 22:40:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EAA9027B; Mon, 9 Dec 2013 22:40:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D495816CE; Mon, 9 Dec 2013 22:40:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB9MeOjl023355; Mon, 9 Dec 2013 22:40:24 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB9MeNG9023345; Mon, 9 Dec 2013 22:40:23 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201312092240.rB9MeNG9023345@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 9 Dec 2013 22:40:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259142 - in stable/10: sys/dev/cxgbe sys/dev/cxgbe/common tools/tools/cxgbetool X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2013 22:40:25 -0000 Author: np Date: Mon Dec 9 22:40:22 2013 New Revision: 259142 URL: http://svnweb.freebsd.org/changeset/base/259142 Log: MFC r257654, r257772, r258441, r258689, r258698, r258879, r259048, and r259103. r257654: cxgbe(4): Exclude MPS_RPLC_MAP_CTL (0x11114) from the register dump. Turns out it's a write-only register with strange side effects on read. r257772: cxgbe(4): Tidy up the display for payload memory statistics (pm_stats). r258441: cxgbe(4): update the internal list of device features. r258689: Disable an assertion that relies on some code[1] that isn't in HEAD yet. r258698: cxgbetool: "modinfo" command to display SFP+ module information. r258879: cxgbe(4): T4_SET_SCHED_CLASS and T4_SET_SCHED_QUEUE ioctls to program scheduling classes in the chip and to bind tx queue(s) to a scheduling class respectively. These can be used for various kinds of tx traffic throttling (to force selected tx queues to drain at a fixed Kbps rate, or a % of the port's total bandwidth, or at a fixed pps rate, etc.). r259048: Two new cxgbetool subcommands to set up scheduler classes and to bind them to NIC queues. r259103: cxgbe(4): save a copy of the RSS map for each port for the driver's use. Modified: stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/common/common.h stable/10/sys/dev/cxgbe/common/t4_hw.c stable/10/sys/dev/cxgbe/t4_ioctl.h stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_sge.c stable/10/tools/tools/cxgbetool/Makefile stable/10/tools/tools/cxgbetool/cxgbetool.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/10/sys/dev/cxgbe/adapter.h Mon Dec 9 21:32:36 2013 (r259141) +++ stable/10/sys/dev/cxgbe/adapter.h Mon Dec 9 22:40:22 2013 (r259142) @@ -194,6 +194,7 @@ struct port_info { unsigned long flags; int if_flags; + uint16_t *rss; uint16_t viid; int16_t xact_addr_filt;/* index of exact MAC address filter */ uint16_t rss_size; /* size of VI's RSS table slice */ Modified: stable/10/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/10/sys/dev/cxgbe/common/common.h Mon Dec 9 21:32:36 2013 (r259141) +++ stable/10/sys/dev/cxgbe/common/common.h Mon Dec 9 22:40:22 2013 (r259142) @@ -587,4 +587,8 @@ int t4_sge_ctxt_rd_bd(struct adapter *ad 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_sched_config(struct adapter *adapter, int type, int minmaxen); +int t4_sched_params(struct adapter *adapter, int type, int level, int mode, + int rateunit, int ratemode, int channel, int cl, + int minrate, int maxrate, int weight, int pktsize); #endif /* __CHELSIO_COMMON_H */ Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/10/sys/dev/cxgbe/common/t4_hw.c Mon Dec 9 21:32:36 2013 (r259141) +++ stable/10/sys/dev/cxgbe/common/t4_hw.c Mon Dec 9 22:40:22 2013 (r259142) @@ -5661,3 +5661,50 @@ int __devinit t4_port_init(struct port_i return 0; } + +int t4_sched_config(struct adapter *adapter, int type, int minmaxen) +{ + struct fw_sched_cmd cmd; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_SCHED_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE); + cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); + + cmd.u.config.sc = FW_SCHED_SC_CONFIG; + cmd.u.config.type = type; + cmd.u.config.minmaxen = minmaxen; + + return t4_wr_mbox_meat(adapter,adapter->mbox, &cmd, sizeof(cmd), + NULL, 1); +} + +int t4_sched_params(struct adapter *adapter, int type, int level, int mode, + int rateunit, int ratemode, int channel, int cl, + int minrate, int maxrate, int weight, int pktsize) +{ + struct fw_sched_cmd cmd; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_SCHED_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE); + cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); + + cmd.u.params.sc = FW_SCHED_SC_PARAMS; + cmd.u.params.type = type; + cmd.u.params.level = level; + cmd.u.params.mode = mode; + cmd.u.params.ch = channel; + cmd.u.params.cl = cl; + cmd.u.params.unit = rateunit; + cmd.u.params.rate = ratemode; + cmd.u.params.min = cpu_to_be32(minrate); + cmd.u.params.max = cpu_to_be32(maxrate); + cmd.u.params.weight = cpu_to_be16(weight); + cmd.u.params.pktsize = cpu_to_be16(pktsize); + + return t4_wr_mbox_meat(adapter,adapter->mbox, &cmd, sizeof(cmd), + NULL, 1); +} Modified: stable/10/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- stable/10/sys/dev/cxgbe/t4_ioctl.h Mon Dec 9 21:32:36 2013 (r259141) +++ stable/10/sys/dev/cxgbe/t4_ioctl.h Mon Dec 9 22:40:22 2013 (r259142) @@ -208,6 +208,74 @@ struct t4_filter { struct t4_filter_specification fs; }; +/* + * Support for "sched-class" command to allow a TX Scheduling Class to be + * programmed with various parameters. + */ +struct t4_sched_params { + int8_t subcmd; /* sub-command */ + int8_t type; /* packet or flow */ + union { + struct { /* sub-command SCHED_CLASS_CONFIG */ + int8_t minmax; /* minmax enable */ + } config; + struct { /* sub-command SCHED_CLASS_PARAMS */ + int8_t level; /* scheduler hierarchy level */ + int8_t mode; /* per-class or per-flow */ + int8_t rateunit; /* bit or packet rate */ + int8_t ratemode; /* %port relative or kbps + absolute */ + int8_t channel; /* scheduler channel [0..N] */ + int8_t cl; /* scheduler class [0..N] */ + int32_t minrate; /* minimum rate */ + int32_t maxrate; /* maximum rate */ + int16_t weight; /* percent weight */ + int16_t pktsize; /* average packet size */ + } params; + uint8_t reserved[6 + 8 * 8]; + } u; +}; + +enum { + SCHED_CLASS_SUBCMD_CONFIG, /* config sub-command */ + SCHED_CLASS_SUBCMD_PARAMS, /* params sub-command */ +}; + +enum { + SCHED_CLASS_TYPE_PACKET, +}; + +enum { + SCHED_CLASS_LEVEL_CL_RL, /* class rate limiter */ + SCHED_CLASS_LEVEL_CL_WRR, /* class weighted round robin */ + SCHED_CLASS_LEVEL_CH_RL, /* channel rate limiter */ +}; + +enum { + SCHED_CLASS_MODE_CLASS, /* per-class scheduling */ + SCHED_CLASS_MODE_FLOW, /* per-flow scheduling */ +}; + +enum { + SCHED_CLASS_RATEUNIT_BITS, /* bit rate scheduling */ + SCHED_CLASS_RATEUNIT_PKTS, /* packet rate scheduling */ +}; + +enum { + SCHED_CLASS_RATEMODE_REL, /* percent of port bandwidth */ + SCHED_CLASS_RATEMODE_ABS, /* Kb/s */ +}; + +/* + * Support for "sched_queue" command to allow one or more NIC TX Queues to be + * bound to a TX Scheduling Class. + */ +struct t4_sched_queue { + uint8_t port; + int8_t queue; /* queue index; -1 => all queues */ + int8_t cl; /* class index; -1 => unbind */ +}; + #define T4_SGE_CONTEXT_SIZE 24 enum { SGE_CONTEXT_EGRESS, @@ -261,6 +329,10 @@ struct t4_tracer { #define CHELSIO_T4_GET_MEM _IOW('f', T4_GET_MEM, struct t4_mem_range) #define CHELSIO_T4_GET_I2C _IOWR('f', T4_GET_I2C, struct t4_i2c_data) #define CHELSIO_T4_CLEAR_STATS _IOW('f', T4_CLEAR_STATS, uint32_t) +#define CHELSIO_T4_SCHED_CLASS _IOW('f', T4_SET_SCHED_CLASS, \ + struct t4_sched_params) +#define CHELSIO_T4_SCHED_QUEUE _IOW('f', T4_SET_SCHED_QUEUE, \ + struct t4_sched_queue) #define CHELSIO_T4_GET_TRACER _IOWR('f', T4_GET_TRACER, struct t4_tracer) #define CHELSIO_T4_SET_TRACER _IOW('f', T4_SET_TRACER, struct t4_tracer) #endif Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Mon Dec 9 21:32:36 2013 (r259141) +++ stable/10/sys/dev/cxgbe/t4_main.c Mon Dec 9 22:40:22 2013 (r259142) @@ -425,6 +425,8 @@ static int get_sge_context(struct adapte static int load_fw(struct adapter *, struct t4_data *); static int read_card_mem(struct adapter *, int, struct t4_mem_range *); static int read_i2c(struct adapter *, struct t4_i2c_data *); +static int set_sched_class(struct adapter *, struct t4_sched_params *); +static int set_sched_queue(struct adapter *, struct t4_sched_queue *); #ifdef TCP_OFFLOAD static int toe_capability(struct port_info *, int); #endif @@ -3155,7 +3157,7 @@ port_full_init(struct port_info *pi) struct ifnet *ifp = pi->ifp; uint16_t *rss; struct sge_rxq *rxq; - int rc, i; + int rc, i, j; ASSERT_SYNCHRONIZED_OP(sc); KASSERT((pi->flags & PORT_INIT_DONE) == 0, @@ -3172,21 +3174,25 @@ port_full_init(struct port_info *pi) goto done; /* error message displayed already */ /* - * Setup RSS for this port. + * Setup RSS for this port. Save a copy of the RSS table for later use. */ - rss = malloc(pi->nrxq * sizeof (*rss), M_CXGBE, - M_ZERO | M_WAITOK); - for_each_rxq(pi, i, rxq) { - rss[i] = rxq->iq.abs_id; + rss = malloc(pi->rss_size * sizeof (*rss), M_CXGBE, M_ZERO | M_WAITOK); + for (i = 0; i < pi->rss_size;) { + for_each_rxq(pi, j, rxq) { + rss[i++] = rxq->iq.abs_id; + if (i == pi->rss_size) + break; + } } - rc = -t4_config_rss_range(sc, sc->mbox, pi->viid, 0, - pi->rss_size, rss, pi->nrxq); - free(rss, M_CXGBE); + + rc = -t4_config_rss_range(sc, sc->mbox, pi->viid, 0, pi->rss_size, rss, + pi->rss_size); if (rc != 0) { if_printf(ifp, "rss_config failed: %d\n", rc); goto done; } + pi->rss = rss; pi->flags |= PORT_INIT_DONE; done: if (rc != 0) @@ -3235,6 +3241,7 @@ port_full_uninit(struct port_info *pi) quiesce_fl(sc, &ofld_rxq->fl); } #endif + free(pi->rss, M_CXGBE); } t4_teardown_port_queues(pi); @@ -3401,7 +3408,8 @@ t4_get_regs(struct adapter *sc, struct t 0xd004, 0xd03c, 0xdfc0, 0xdfe0, 0xe000, 0xea7c, - 0xf000, 0x11190, + 0xf000, 0x11110, + 0x11118, 0x11190, 0x19040, 0x1906c, 0x19078, 0x19080, 0x1908c, 0x19124, @@ -3607,7 +3615,8 @@ t4_get_regs(struct adapter *sc, struct t 0xd004, 0xd03c, 0xdfc0, 0xdfe0, 0xe000, 0x11088, - 0x1109c, 0x1117c, + 0x1109c, 0x11110, + 0x11118, 0x1117c, 0x11190, 0x11204, 0x19040, 0x1906c, 0x19078, 0x19080, @@ -4165,13 +4174,15 @@ t4_sysctls(struct adapter *sc) struct sysctl_oid_list *children, *c0; static char *caps[] = { "\20\1PPP\2QFC\3DCBX", /* caps[0] linkcaps */ - "\20\1NIC\2VM\3IDS\4UM\5UM_ISGL", /* caps[1] niccaps */ + "\20\1NIC\2VM\3IDS\4UM\5UM_ISGL" /* caps[1] niccaps */ + "\6HASHFILTER\7ETHOFLD", "\20\1TOE", /* caps[2] toecaps */ "\20\1RDDP\2RDMAC", /* caps[3] rdmacaps */ "\20\1INITIATOR_PDU\2TARGET_PDU" /* caps[4] iscsicaps */ "\3INITIATOR_CNXOFLD\4TARGET_CNXOFLD" "\5INITIATOR_SSNOFLD\6TARGET_SSNOFLD", "\20\1INITIATOR\2TARGET\3CTRL_OFLD" /* caps[5] fcoecaps */ + "\4PO_INITIAOR\5PO_TARGET" }; static char *doorbells = {"\20\1UDB\2WCWR\3UDBWC\4KDB"}; @@ -5953,10 +5964,13 @@ sysctl_pm_stats(SYSCTL_HANDLER_ARGS) struct adapter *sc = arg1; struct sbuf *sb; int rc, i; - uint32_t tx_cnt[PM_NSTATS], rx_cnt[PM_NSTATS]; - uint64_t tx_cyc[PM_NSTATS], rx_cyc[PM_NSTATS]; - static const char *pm_stats[] = { - "Read:", "Write bypass:", "Write mem:", "Flush:", "FIFO wait:" + uint32_t cnt[PM_NSTATS]; + uint64_t cyc[PM_NSTATS]; + static const char *rx_stats[] = { + "Read:", "Write bypass:", "Write mem:", "Flush:" + }; + static const char *tx_stats[] = { + "Read:", "Write bypass:", "Write mem:", "Bypass + mem:" }; rc = sysctl_wire_old_buffer(req, 0); @@ -5967,14 +5981,17 @@ sysctl_pm_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - t4_pmtx_get_stats(sc, tx_cnt, tx_cyc); - t4_pmrx_get_stats(sc, rx_cnt, rx_cyc); - - sbuf_printf(sb, " Tx count Tx cycles " - "Rx count Rx cycles"); - for (i = 0; i < PM_NSTATS; i++) - sbuf_printf(sb, "\n%-13s %10u %20ju %10u %20ju", - pm_stats[i], tx_cnt[i], tx_cyc[i], rx_cnt[i], rx_cyc[i]); + t4_pmtx_get_stats(sc, cnt, cyc); + sbuf_printf(sb, " Tx pcmds Tx bytes"); + for (i = 0; i < ARRAY_SIZE(tx_stats); i++) + sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], cnt[i], + cyc[i]); + + t4_pmrx_get_stats(sc, cnt, cyc); + sbuf_printf(sb, "\n Rx pcmds Rx bytes"); + for (i = 0; i < ARRAY_SIZE(rx_stats); i++) + sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], cnt[i], + cyc[i]); rc = sbuf_finish(sb); sbuf_delete(sb); @@ -7285,6 +7302,228 @@ read_i2c(struct adapter *sc, struct t4_i return (rc); } +static int +in_range(int val, int lo, int hi) +{ + + return (val < 0 || (val <= hi && val >= lo)); +} + +static int +set_sched_class(struct adapter *sc, struct t4_sched_params *p) +{ + int fw_subcmd, fw_type, rc; + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4setsc"); + if (rc) + return (rc); + + if (!(sc->flags & FULL_INIT_DONE)) { + rc = EAGAIN; + goto done; + } + + /* + * Translate the cxgbetool parameters into T4 firmware parameters. (The + * sub-command and type are in common locations.) + */ + if (p->subcmd == SCHED_CLASS_SUBCMD_CONFIG) + fw_subcmd = FW_SCHED_SC_CONFIG; + else if (p->subcmd == SCHED_CLASS_SUBCMD_PARAMS) + fw_subcmd = FW_SCHED_SC_PARAMS; + else { + rc = EINVAL; + goto done; + } + if (p->type == SCHED_CLASS_TYPE_PACKET) + fw_type = FW_SCHED_TYPE_PKTSCHED; + else { + rc = EINVAL; + goto done; + } + + if (fw_subcmd == FW_SCHED_SC_CONFIG) { + /* Vet our parameters ..*/ + if (p->u.config.minmax < 0) { + rc = EINVAL; + goto done; + } + + /* And pass the request to the firmware ...*/ + rc = -t4_sched_config(sc, fw_type, p->u.config.minmax); + goto done; + } + + if (fw_subcmd == FW_SCHED_SC_PARAMS) { + int fw_level; + int fw_mode; + int fw_rateunit; + int fw_ratemode; + + if (p->u.params.level == SCHED_CLASS_LEVEL_CL_RL) + fw_level = FW_SCHED_PARAMS_LEVEL_CL_RL; + else if (p->u.params.level == SCHED_CLASS_LEVEL_CL_WRR) + fw_level = FW_SCHED_PARAMS_LEVEL_CL_WRR; + else if (p->u.params.level == SCHED_CLASS_LEVEL_CH_RL) + fw_level = FW_SCHED_PARAMS_LEVEL_CH_RL; + else { + rc = EINVAL; + goto done; + } + + if (p->u.params.mode == SCHED_CLASS_MODE_CLASS) + fw_mode = FW_SCHED_PARAMS_MODE_CLASS; + else if (p->u.params.mode == SCHED_CLASS_MODE_FLOW) + fw_mode = FW_SCHED_PARAMS_MODE_FLOW; + else { + rc = EINVAL; + goto done; + } + + if (p->u.params.rateunit == SCHED_CLASS_RATEUNIT_BITS) + fw_rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; + else if (p->u.params.rateunit == SCHED_CLASS_RATEUNIT_PKTS) + fw_rateunit = FW_SCHED_PARAMS_UNIT_PKTRATE; + else { + rc = EINVAL; + goto done; + } + + if (p->u.params.ratemode == SCHED_CLASS_RATEMODE_REL) + fw_ratemode = FW_SCHED_PARAMS_RATE_REL; + else if (p->u.params.ratemode == SCHED_CLASS_RATEMODE_ABS) + fw_ratemode = FW_SCHED_PARAMS_RATE_ABS; + else { + rc = EINVAL; + goto done; + } + + /* Vet our parameters ... */ + if (!in_range(p->u.params.channel, 0, 3) || + !in_range(p->u.params.cl, 0, is_t4(sc) ? 15 : 16) || + !in_range(p->u.params.minrate, 0, 10000000) || + !in_range(p->u.params.maxrate, 0, 10000000) || + !in_range(p->u.params.weight, 0, 100)) { + rc = ERANGE; + goto done; + } + + /* + * Translate any unset parameters into the firmware's + * nomenclature and/or fail the call if the parameters + * are required ... + */ + if (p->u.params.rateunit < 0 || p->u.params.ratemode < 0 || + p->u.params.channel < 0 || p->u.params.cl < 0) { + rc = EINVAL; + goto done; + } + if (p->u.params.minrate < 0) + p->u.params.minrate = 0; + if (p->u.params.maxrate < 0) { + if (p->u.params.level == SCHED_CLASS_LEVEL_CL_RL || + p->u.params.level == SCHED_CLASS_LEVEL_CH_RL) { + rc = EINVAL; + goto done; + } else + p->u.params.maxrate = 0; + } + if (p->u.params.weight < 0) { + if (p->u.params.level == SCHED_CLASS_LEVEL_CL_WRR) { + rc = EINVAL; + goto done; + } else + p->u.params.weight = 0; + } + if (p->u.params.pktsize < 0) { + if (p->u.params.level == SCHED_CLASS_LEVEL_CL_RL || + p->u.params.level == SCHED_CLASS_LEVEL_CH_RL) { + rc = EINVAL; + goto done; + } else + p->u.params.pktsize = 0; + } + + /* See what the firmware thinks of the request ... */ + rc = -t4_sched_params(sc, fw_type, fw_level, fw_mode, + fw_rateunit, fw_ratemode, p->u.params.channel, + p->u.params.cl, p->u.params.minrate, p->u.params.maxrate, + p->u.params.weight, p->u.params.pktsize); + goto done; + } + + rc = EINVAL; +done: + end_synchronized_op(sc, 0); + return (rc); +} + +static int +set_sched_queue(struct adapter *sc, struct t4_sched_queue *p) +{ + struct port_info *pi = NULL; + struct sge_txq *txq; + uint32_t fw_mnem, fw_queue, fw_class; + int i, rc; + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4setsq"); + if (rc) + return (rc); + + if (!(sc->flags & FULL_INIT_DONE)) { + rc = EAGAIN; + goto done; + } + + if (p->port >= sc->params.nports) { + rc = EINVAL; + goto done; + } + + pi = sc->port[p->port]; + if (!in_range(p->queue, 0, pi->ntxq - 1) || !in_range(p->cl, 0, 7)) { + rc = EINVAL; + goto done; + } + + /* + * Create a template for the FW_PARAMS_CMD mnemonic and value (TX + * Scheduling Class in this case). + */ + fw_mnem = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH)); + fw_class = p->cl < 0 ? 0xffffffff : p->cl; + + /* + * If op.queue is non-negative, then we're only changing the scheduling + * on a single specified TX queue. + */ + if (p->queue >= 0) { + txq = &sc->sge.txq[pi->first_txq + p->queue]; + fw_queue = (fw_mnem | V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_queue, + &fw_class); + goto done; + } + + /* + * Change the scheduling on all the TX queues for the + * interface. + */ + for_each_txq(pi, i, txq) { + fw_queue = (fw_mnem | V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_queue, + &fw_class); + if (rc) + goto done; + } + + rc = 0; +done: + end_synchronized_op(sc, 0); + return (rc); +} + int t4_os_find_pci_capability(struct adapter *sc, int cap) { @@ -7528,6 +7767,12 @@ t4_ioctl(struct cdev *dev, unsigned long } break; } + case CHELSIO_T4_SCHED_CLASS: + rc = set_sched_class(sc, (struct t4_sched_params *)data); + break; + case CHELSIO_T4_SCHED_QUEUE: + rc = set_sched_queue(sc, (struct t4_sched_queue *)data); + break; case CHELSIO_T4_GET_TRACER: rc = t4_get_tracer(sc, (struct t4_tracer *)data); break; Modified: stable/10/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_sge.c Mon Dec 9 21:32:36 2013 (r259141) +++ stable/10/sys/dev/cxgbe/t4_sge.c Mon Dec 9 22:40:22 2013 (r259142) @@ -1391,7 +1391,7 @@ rxb_free(struct mbuf *m, void *arg1, voi { uma_zone_t zone = arg1; caddr_t cl = arg2; -#ifdef INVARIANTS +#ifdef notyet u_int refcount; refcount = *find_buf_refcnt(cl); @@ -1677,7 +1677,7 @@ t4_eth_rx(struct sge_iq *iq, const struc m0->m_pkthdr.rcvif = ifp; m0->m_flags |= M_FLOWID; - m0->m_pkthdr.flowid = rss->hash_val; + m0->m_pkthdr.flowid = be32toh(rss->hash_val); if (cpl->csum_calc && !cpl->err_vec) { if (ifp->if_capenable & IFCAP_RXCSUM && Modified: stable/10/tools/tools/cxgbetool/Makefile ============================================================================== --- stable/10/tools/tools/cxgbetool/Makefile Mon Dec 9 21:32:36 2013 (r259141) +++ stable/10/tools/tools/cxgbetool/Makefile Mon Dec 9 22:40:22 2013 (r259142) @@ -3,7 +3,7 @@ PROG= cxgbetool SRCS= cxgbetool.c NO_MAN= -CFLAGS+= -I${.CURDIR}/../../../sys/dev/cxgbe -I. +CFLAGS+= -I${.CURDIR}/../../../sys/dev/cxgbe -I${.CURDIR}/../../../sys -I. BINDIR?= /usr/sbin .include Modified: stable/10/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- stable/10/tools/tools/cxgbetool/cxgbetool.c Mon Dec 9 21:32:36 2013 (r259141) +++ stable/10/tools/tools/cxgbetool/cxgbetool.c Mon Dec 9 22:40:22 2013 (r259142) @@ -46,11 +46,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "t4_ioctl.h" #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) - +#define in_range(val, lo, hi) ( val < 0 || (val <= hi && val >= lo)) #define max(x, y) ((x) > (y) ? (x) : (y)) static const char *progname, *nexus; @@ -94,12 +95,15 @@ usage(FILE *fp) "\ti2c [] read from i2c device\n" "\tloadfw install firmware\n" "\tmemdump dump a memory range\n" + "\tmodinfo optics/cable information\n" "\treg
[=] read/write register\n" "\treg64
[=] read/write 64 bit register\n" "\tregdump [] ... dump registers\n" + "\tsched-class params .. configure TX scheduler class\n" + "\tsched-queue bind NIC queues to TX Scheduling class\n" "\tstdio interactive mode\n" "\ttcb read TCB\n" - "\ttracer tx|rx set and enable a tracer)\n" + "\ttracer tx|rx set and enable a tracer\n" "\ttracer disable|enable disable or enable a tracer\n" "\ttracer list list all tracers\n" ); @@ -321,7 +325,7 @@ dump_regs_t4(int argc, const char *argv[ T4_MODREGS(ma), { "edc0", t4_edc_0_regs }, { "edc1", t4_edc_1_regs }, - T4_MODREGS(cim), + T4_MODREGS(cim), T4_MODREGS(tp), T4_MODREGS(ulp_rx), T4_MODREGS(ulp_tx), @@ -333,7 +337,7 @@ dump_regs_t4(int argc, const char *argv[ { "i2c", t4_i2cm_regs }, T4_MODREGS(mi), T4_MODREGS(uart), - T4_MODREGS(pmu), + T4_MODREGS(pmu), T4_MODREGS(sf), T4_MODREGS(pl), T4_MODREGS(le), @@ -1869,6 +1873,420 @@ tracer_cmd(int argc, const char *argv[]) } static int +modinfo(int argc, const char *argv[]) +{ + long port; + char string[16], *p; + struct t4_i2c_data i2cd; + int rc, i; + uint16_t temp, vcc, tx_bias, tx_power, rx_power; + + if (argc != 1) { + warnx("must supply a port"); + return (EINVAL); + } + + p = str_to_number(argv[0], &port, NULL); + if (*p || port > UCHAR_MAX) { + warnx("invalid port id \"%s\"", argv[0]); + return (EINVAL); + } + + bzero(&i2cd, sizeof(i2cd)); + i2cd.len = 1; + i2cd.port_id = port; + i2cd.dev_addr = SFF_8472_BASE; + + i2cd.offset = SFF_8472_ID; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + + if (i2cd.data[0] > SFF_8472_ID_LAST) + printf("Unknown ID\n"); + else + printf("ID: %s\n", sff_8472_id[i2cd.data[0]]); + + bzero(&string, sizeof(string)); + for (i = SFF_8472_VENDOR_START; i < SFF_8472_VENDOR_END; i++) { + i2cd.offset = i; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + string[i - SFF_8472_VENDOR_START] = i2cd.data[0]; + } + printf("Vendor %s\n", string); + + bzero(&string, sizeof(string)); + for (i = SFF_8472_SN_START; i < SFF_8472_SN_END; i++) { + i2cd.offset = i; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + string[i - SFF_8472_SN_START] = i2cd.data[0]; + } + printf("SN %s\n", string); + + bzero(&string, sizeof(string)); + for (i = SFF_8472_PN_START; i < SFF_8472_PN_END; i++) { + i2cd.offset = i; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + string[i - SFF_8472_PN_START] = i2cd.data[0]; + } + printf("PN %s\n", string); + + bzero(&string, sizeof(string)); + for (i = SFF_8472_REV_START; i < SFF_8472_REV_END; i++) { + i2cd.offset = i; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + string[i - SFF_8472_REV_START] = i2cd.data[0]; + } + printf("Rev %s\n", string); + + i2cd.offset = SFF_8472_DIAG_TYPE; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + + if ((char )i2cd.data[0] & (SFF_8472_DIAG_IMPL | + SFF_8472_DIAG_INTERNAL)) { + + /* Switch to reading from the Diagnostic address. */ + i2cd.dev_addr = SFF_8472_DIAG; + i2cd.len = 1; + + i2cd.offset = SFF_8472_TEMP; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + temp = i2cd.data[0] << 8; + printf("Temp: "); + if ((temp & SFF_8472_TEMP_SIGN) == SFF_8472_TEMP_SIGN) + printf("-"); + else + printf("+"); + printf("%dC\n", (temp & SFF_8472_TEMP_MSK) >> + SFF_8472_TEMP_SHIFT); + + i2cd.offset = SFF_8472_VCC; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + vcc = i2cd.data[0] << 8; + printf("Vcc %fV\n", vcc / SFF_8472_VCC_FACTOR); + + i2cd.offset = SFF_8472_TX_BIAS; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + tx_bias = i2cd.data[0] << 8; + printf("TX Bias %fuA\n", tx_bias / SFF_8472_BIAS_FACTOR); + + i2cd.offset = SFF_8472_TX_POWER; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + tx_power = i2cd.data[0] << 8; + printf("TX Power %fmW\n", tx_power / SFF_8472_POWER_FACTOR); + + i2cd.offset = SFF_8472_RX_POWER; + if ((rc = doit(CHELSIO_T4_GET_I2C, &i2cd)) != 0) + goto fail; + rx_power = i2cd.data[0] << 8; + printf("RX Power %fmW\n", rx_power / SFF_8472_POWER_FACTOR); + + } else + printf("Diagnostics not supported.\n"); + + return(0); + +fail: + if (rc == EPERM) + warnx("No module/cable in port %ld", port); + return (rc); + +} + +/* XXX: pass in a low/high and do range checks as well */ +static int +get_sched_param(const char *param, const char *args[], long *val) +{ + char *p; + + if (strcmp(param, args[0]) != 0) + return (EINVAL); + + p = str_to_number(args[1], val, NULL); + if (*p) { + warnx("parameter \"%s\" has bad value \"%s\"", args[0], + args[1]); + return (EINVAL); + } + + return (0); +} + +static int +sched_class(int argc, const char *argv[]) +{ + struct t4_sched_params op; + int errs, i; + + memset(&op, 0xff, sizeof(op)); + op.subcmd = -1; + op.type = -1; + if (argc == 0) { + warnx("missing scheduling sub-command"); + return (EINVAL); + } + if (!strcmp(argv[0], "config")) { + op.subcmd = SCHED_CLASS_SUBCMD_CONFIG; + op.u.config.minmax = -1; + } else if (!strcmp(argv[0], "params")) { + op.subcmd = SCHED_CLASS_SUBCMD_PARAMS; + op.u.params.level = op.u.params.mode = op.u.params.rateunit = + op.u.params.ratemode = op.u.params.channel = + op.u.params.cl = op.u.params.minrate = op.u.params.maxrate = + op.u.params.weight = op.u.params.pktsize = -1; + } else { + warnx("invalid scheduling sub-command \"%s\"", argv[0]); + return (EINVAL); + } + + /* Decode remaining arguments ... */ + errs = 0; + for (i = 1; i < argc; i += 2) { + const char **args = &argv[i]; + long l; + + if (i + 1 == argc) { + warnx("missing argument for \"%s\"", args[0]); + errs++; + break; + } + + if (!strcmp(args[0], "type")) { + if (!strcmp(args[1], "packet")) + op.type = SCHED_CLASS_TYPE_PACKET; + else { + warnx("invalid type parameter \"%s\"", args[1]); + errs++; + } + + continue; + } + + if (op.subcmd == SCHED_CLASS_SUBCMD_CONFIG) { + if(!get_sched_param("minmax", args, &l)) + op.u.config.minmax = (int8_t)l; + else { + warnx("unknown scheduler config parameter " + "\"%s\"", args[0]); + errs++; + } + + continue; + } + + /* Rest applies only to SUBCMD_PARAMS */ + if (op.subcmd != SCHED_CLASS_SUBCMD_PARAMS) + continue; + + if (!strcmp(args[0], "level")) { + if (!strcmp(args[1], "cl-rl")) + op.u.params.level = SCHED_CLASS_LEVEL_CL_RL; + else if (!strcmp(args[1], "cl-wrr")) + op.u.params.level = SCHED_CLASS_LEVEL_CL_WRR; + else if (!strcmp(args[1], "ch-rl")) + op.u.params.level = SCHED_CLASS_LEVEL_CH_RL; + else { + warnx("invalid level parameter \"%s\"", + args[1]); + errs++; + } + } else if (!strcmp(args[0], "mode")) { + if (!strcmp(args[1], "class")) + op.u.params.mode = SCHED_CLASS_MODE_CLASS; + else if (!strcmp(args[1], "flow")) + op.u.params.mode = SCHED_CLASS_MODE_FLOW; + else { + warnx("invalid mode parameter \"%s\"", args[1]); + errs++; + } + } else if (!strcmp(args[0], "rate-unit")) { + if (!strcmp(args[1], "bits")) + op.u.params.rateunit = SCHED_CLASS_RATEUNIT_BITS; + else if (!strcmp(args[1], "pkts")) + op.u.params.rateunit = SCHED_CLASS_RATEUNIT_PKTS; + else { + warnx("invalid rate-unit parameter \"%s\"", + args[1]); + errs++; + } + } else if (!strcmp(args[0], "rate-mode")) { + if (!strcmp(args[1], "relative")) + op.u.params.ratemode = SCHED_CLASS_RATEMODE_REL; + else if (!strcmp(args[1], "absolute")) + op.u.params.ratemode = SCHED_CLASS_RATEMODE_ABS; + else { + warnx("invalid rate-mode parameter \"%s\"", + args[1]); + errs++; + } + } else if (!get_sched_param("channel", args, &l)) + op.u.params.channel = (int8_t)l; + else if (!get_sched_param("class", args, &l)) + op.u.params.cl = (int8_t)l; + else if (!get_sched_param("min-rate", args, &l)) + op.u.params.minrate = (int32_t)l; + else if (!get_sched_param("max-rate", args, &l)) + op.u.params.maxrate = (int32_t)l; + else if (!get_sched_param("weight", args, &l)) + op.u.params.weight = (int16_t)l; + else if (!get_sched_param("pkt-size", args, &l)) + op.u.params.pktsize = (int16_t)l; + else { + warnx("unknown scheduler parameter \"%s\"", args[0]); + errs++; + } + } + + /* + * Catch some logical fallacies in terms of argument combinations here + * so we can offer more than just the EINVAL return from the driver. + * The driver will be able to catch a lot more issues since it knows + * the specifics of the device hardware capabilities like how many + * channels, classes, etc. the device supports. + */ + if (op.type < 0) { + warnx("sched \"type\" parameter missing"); + errs++; + } + if (op.subcmd == SCHED_CLASS_SUBCMD_CONFIG) { + if (op.u.config.minmax < 0) { + warnx("sched config \"minmax\" parameter missing"); + errs++; + } + } + if (op.subcmd == SCHED_CLASS_SUBCMD_PARAMS) { + if (op.u.params.level < 0) { + warnx("sched params \"level\" parameter missing"); + errs++; + } + if (op.u.params.mode < 0) { + warnx("sched params \"mode\" parameter missing"); + errs++; + } + if (op.u.params.rateunit < 0) { + warnx("sched params \"rate-unit\" parameter missing"); + errs++; + } + if (op.u.params.ratemode < 0) { + warnx("sched params \"rate-mode\" parameter missing"); + errs++; + } + if (op.u.params.channel < 0) { + warnx("sched params \"channel\" missing"); + errs++; + } + if (op.u.params.cl < 0) { + warnx("sched params \"class\" missing"); + errs++; + } + if (op.u.params.maxrate < 0 && + (op.u.params.level == SCHED_CLASS_LEVEL_CL_RL || + op.u.params.level == SCHED_CLASS_LEVEL_CH_RL)) { + warnx("sched params \"max-rate\" missing for " + "rate-limit level"); + errs++; + } + if (op.u.params.weight < 0 && + op.u.params.level == SCHED_CLASS_LEVEL_CL_WRR) { + warnx("sched params \"weight\" missing for " + "weighted-round-robin level"); + errs++; + } + if (op.u.params.pktsize < 0 && + (op.u.params.level == SCHED_CLASS_LEVEL_CL_RL || + op.u.params.level == SCHED_CLASS_LEVEL_CH_RL)) { + warnx("sched params \"pkt-size\" missing for " + "rate-limit level"); + errs++; + } + if (op.u.params.mode == SCHED_CLASS_MODE_FLOW && + op.u.params.ratemode != SCHED_CLASS_RATEMODE_ABS) { + warnx("sched params mode flow needs rate-mode absolute"); + errs++; + } + if (op.u.params.ratemode == SCHED_CLASS_RATEMODE_REL && + !in_range(op.u.params.maxrate, 1, 100)) { + warnx("sched params \"max-rate\" takes " + "percentage value(1-100) for rate-mode relative"); + errs++; + } + if (op.u.params.ratemode == SCHED_CLASS_RATEMODE_ABS && + !in_range(op.u.params.maxrate, 1, 10000000)) { + warnx("sched params \"max-rate\" takes " + "value(1-10000000) for rate-mode absolute"); + errs++; + } + if (op.u.params.maxrate > 0 && + op.u.params.maxrate < op.u.params.minrate) { + warnx("sched params \"max-rate\" is less than " + "\"min-rate\""); + errs++; + } + } + + if (errs > 0) { + warnx("%d error%s in sched-class command", errs, + errs == 1 ? "" : "s"); + return (EINVAL); + } + + return doit(CHELSIO_T4_SCHED_CLASS, &op); +} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 00:35:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D1F1761; Tue, 10 Dec 2013 00:35:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 68497101E; Tue, 10 Dec 2013 00:35:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBA0ZYKm066424; Tue, 10 Dec 2013 00:35:34 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBA0ZY51066422; Tue, 10 Dec 2013 00:35:34 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312100035.rBA0ZY51066422@svn.freebsd.org> From: Glen Barber Date: Tue, 10 Dec 2013 00:35:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259151 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 00:35:34 -0000 Author: gjb Date: Tue Dec 10 00:35:33 2013 New Revision: 259151 URL: http://svnweb.freebsd.org/changeset/base/259151 Log: MFC r259079: Add WITH_DVD to RELEASE_RMAKEFLAGS, otherwise it is not actually passed to 'make release'. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/release.conf.sample stable/10/release/release.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/release/release.conf.sample ============================================================================== --- stable/10/release/release.conf.sample Tue Dec 10 00:07:04 2013 (r259150) +++ stable/10/release/release.conf.sample Tue Dec 10 00:35:33 2013 (r259151) @@ -39,3 +39,4 @@ PORTBRANCH="ports/head@rHEAD" #NODOC= #NOPORTS= #RELSTRING= +#WITH_DVD= Modified: stable/10/release/release.sh ============================================================================== --- stable/10/release/release.sh Tue Dec 10 00:07:04 2013 (r259150) +++ stable/10/release/release.sh Tue Dec 10 00:35:33 2013 (r259151) @@ -72,6 +72,9 @@ KERNEL="GENERIC" NODOC= NOPORTS= +# Set to non-empty value to build dvd1.iso as part of the release. +WITH_DVD= + usage() { echo "Usage: $0 [-c release.conf]" exit 1 @@ -129,7 +132,7 @@ CHROOT_DMAKEFLAGS="${CONF_FILES}" RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} ${CONF_FILES}" RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} KERNCONF=\"${KERNEL}\" ${ARCH_FLAGS} ${CONF_FILES}" RELEASE_RMAKEFLAGS="${ARCH_FLAGS} KERNCONF=\"${KERNEL}\" ${CONF_FILES} \ - ${DOCPORTS}" + ${DOCPORTS} WITH_DVD=${WITH_DVD}" # Force src checkout if configured FORCE_SRC_KEY= From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 07:25:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6948E297; Tue, 10 Dec 2013 07:25:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5325C1B19; Tue, 10 Dec 2013 07:25:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBA7PQ8E017714; Tue, 10 Dec 2013 07:25:26 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBA7PP93017712; Tue, 10 Dec 2013 07:25:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312100725.rBA7PP93017712@svn.freebsd.org> From: Dimitry Andric Date: Tue, 10 Dec 2013 07:25:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259157 - in stable: 10/contrib/llvm/tools/clang/lib/Driver 9/contrib/llvm/tools/clang/lib/Driver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 07:25:26 -0000 Author: dim Date: Tue Dec 10 07:25:25 2013 New Revision: 259157 URL: http://svnweb.freebsd.org/changeset/base/259157 Log: MFC r259053: Pull in r196590 from upstream clang trunk (by rdivacky): Move the body of GCCInstallationDetector ctor into an init() function and call it from its only user. The linux toolchain. This saves quite a lot of directory searching on other platforms. See http://docs.freebsd.org/cgi/mid.cgi?51E6FAF5.3080802 for the original discussion. With this fix, the search for gcc installations is completely eliminated on FreeBSD. Reported by: Kurt Lidl Modified: stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Modified: stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp ============================================================================== --- stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp Tue Dec 10 05:01:01 2013 (r259156) +++ stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp Tue Dec 10 07:25:25 2013 (r259157) @@ -991,7 +991,7 @@ static StringRef getGCCToolchainDir(cons return GCC_INSTALL_PREFIX; } -/// \brief Construct a GCCInstallationDetector from the driver. +/// \brief Initialize a GCCInstallationDetector from the driver. /// /// This performs all of the autodetection and sets up the various paths. /// Once constructed, a GCCInstallationDetector is essentially immutable. @@ -1000,11 +1000,9 @@ static StringRef getGCCToolchainDir(cons /// should instead pull the target out of the driver. This is currently /// necessary because the driver doesn't store the final version of the target /// triple. -Generic_GCC::GCCInstallationDetector::GCCInstallationDetector( - const Driver &D, - const llvm::Triple &TargetTriple, - const ArgList &Args) - : IsValid(false) { +void +Generic_GCC::GCCInstallationDetector::init( + const Driver &D, const llvm::Triple &TargetTriple, const ArgList &Args) { llvm::Triple MultiarchTriple = TargetTriple.isArch32Bit() ? TargetTriple.get64BitArchVariant() : TargetTriple.get32BitArchVariant(); @@ -1448,7 +1446,7 @@ void Generic_GCC::GCCInstallationDetecto Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) - : ToolChain(D, Triple, Args), GCCInstallation(getDriver(), Triple, Args) { + : ToolChain(D, Triple, Args), GCCInstallation() { getProgramPaths().push_back(getDriver().getInstalledDir()); if (getDriver().getInstalledDir() != getDriver().Dir) getProgramPaths().push_back(getDriver().Dir); @@ -2243,6 +2241,7 @@ static StringRef getMultilibDir(const ll Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : Generic_ELF(D, Triple, Args) { + GCCInstallation.init(D, Triple, Args); llvm::Triple::ArchType Arch = Triple.getArch(); std::string SysRoot = computeSysRoot(Args); Modified: stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.h ============================================================================== --- stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Tue Dec 10 05:01:01 2013 (r259156) +++ stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Tue Dec 10 07:25:25 2013 (r259157) @@ -78,7 +78,8 @@ protected: GCCVersion Version; public: - GCCInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple, + GCCInstallationDetector() : IsValid(false) {} + void init(const Driver &D, const llvm::Triple &TargetTriple, const ArgList &Args); /// \brief Check whether we detected a valid GCC install. From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 07:25:25 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3282296; Tue, 10 Dec 2013 07:25:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BCC461B18; Tue, 10 Dec 2013 07:25:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBA7PP5M017707; Tue, 10 Dec 2013 07:25:25 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBA7PPUV017705; Tue, 10 Dec 2013 07:25:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312100725.rBA7PPUV017705@svn.freebsd.org> From: Dimitry Andric Date: Tue, 10 Dec 2013 07:25:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259157 - in stable: 10/contrib/llvm/tools/clang/lib/Driver 9/contrib/llvm/tools/clang/lib/Driver X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 07:25:26 -0000 Author: dim Date: Tue Dec 10 07:25:25 2013 New Revision: 259157 URL: http://svnweb.freebsd.org/changeset/base/259157 Log: MFC r259053: Pull in r196590 from upstream clang trunk (by rdivacky): Move the body of GCCInstallationDetector ctor into an init() function and call it from its only user. The linux toolchain. This saves quite a lot of directory searching on other platforms. See http://docs.freebsd.org/cgi/mid.cgi?51E6FAF5.3080802 for the original discussion. With this fix, the search for gcc installations is completely eliminated on FreeBSD. Reported by: Kurt Lidl Modified: stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Directory Properties: stable/10/ (props changed) Modified: stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp Tue Dec 10 05:01:01 2013 (r259156) +++ stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp Tue Dec 10 07:25:25 2013 (r259157) @@ -991,7 +991,7 @@ static StringRef getGCCToolchainDir(cons return GCC_INSTALL_PREFIX; } -/// \brief Construct a GCCInstallationDetector from the driver. +/// \brief Initialize a GCCInstallationDetector from the driver. /// /// This performs all of the autodetection and sets up the various paths. /// Once constructed, a GCCInstallationDetector is essentially immutable. @@ -1000,11 +1000,9 @@ static StringRef getGCCToolchainDir(cons /// should instead pull the target out of the driver. This is currently /// necessary because the driver doesn't store the final version of the target /// triple. -Generic_GCC::GCCInstallationDetector::GCCInstallationDetector( - const Driver &D, - const llvm::Triple &TargetTriple, - const ArgList &Args) - : IsValid(false) { +void +Generic_GCC::GCCInstallationDetector::init( + const Driver &D, const llvm::Triple &TargetTriple, const ArgList &Args) { llvm::Triple MultiarchTriple = TargetTriple.isArch32Bit() ? TargetTriple.get64BitArchVariant() : TargetTriple.get32BitArchVariant(); @@ -1448,7 +1446,7 @@ void Generic_GCC::GCCInstallationDetecto Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) - : ToolChain(D, Triple, Args), GCCInstallation(getDriver(), Triple, Args) { + : ToolChain(D, Triple, Args), GCCInstallation() { getProgramPaths().push_back(getDriver().getInstalledDir()); if (getDriver().getInstalledDir() != getDriver().Dir) getProgramPaths().push_back(getDriver().Dir); @@ -2211,6 +2209,7 @@ static StringRef getMultilibDir(const ll Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : Generic_ELF(D, Triple, Args) { + GCCInstallation.init(D, Triple, Args); llvm::Triple::ArchType Arch = Triple.getArch(); std::string SysRoot = computeSysRoot(Args); Modified: stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.h ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Tue Dec 10 05:01:01 2013 (r259156) +++ stable/9/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Tue Dec 10 07:25:25 2013 (r259157) @@ -78,7 +78,8 @@ protected: GCCVersion Version; public: - GCCInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple, + GCCInstallationDetector() : IsValid(false) {} + void init(const Driver &D, const llvm::Triple &TargetTriple, const ArgList &Args); /// \brief Check whether we detected a valid GCC install. From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 07:28:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4D11516; Tue, 10 Dec 2013 07:28:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B030D1B30; Tue, 10 Dec 2013 07:28:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBA7SRVB018257; Tue, 10 Dec 2013 07:28:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBA7SRbb018256; Tue, 10 Dec 2013 07:28:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312100728.rBA7SRbb018256@svn.freebsd.org> From: Dimitry Andric Date: Tue, 10 Dec 2013 07:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259158 - in stable: 10/share/mk 9/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 07:28:27 -0000 Author: dim Date: Tue Dec 10 07:28:26 2013 New Revision: 259158 URL: http://svnweb.freebsd.org/changeset/base/259158 Log: MFC r259083: For WARNS <= 3, change the clang warning flag -Wno-conversion to -Wno-enum-conversion. In earlier clang versions (before 3.2), the latter did not exist, and suppressing enum conversion warnings was really the goal of this warning suppression flag. This should enable the same kind of warning again as was fixed by r259072 ("incompatible integer to pointer conversion passing 'Elf_Addr' (aka 'unsigned int') to parameter of type 'void *'"), and which was only emitted by gcc. Noticed by: kib Modified: stable/10/share/mk/bsd.sys.mk Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/share/mk/bsd.sys.mk (contents, props changed) Directory Properties: stable/9/share/mk/ (props changed) Modified: stable/10/share/mk/bsd.sys.mk ============================================================================== --- stable/10/share/mk/bsd.sys.mk Tue Dec 10 07:25:25 2013 (r259157) +++ stable/10/share/mk/bsd.sys.mk Tue Dec 10 07:28:26 2013 (r259158) @@ -73,7 +73,7 @@ CWARNFLAGS+= -Wno-empty-body -Wno-string .endif # WARNS <= 6 .if ${WARNS} <= 3 CWARNFLAGS+= -Wno-tautological-compare -Wno-unused-value\ - -Wno-parentheses-equality -Wno-unused-function -Wno-conversion + -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion .endif # WARNS <= 3 .if ${WARNS} <= 2 CWARNFLAGS+= -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 07:28:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FB52515; Tue, 10 Dec 2013 07:28:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5AA411B2F; Tue, 10 Dec 2013 07:28:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBA7SRtl018251; Tue, 10 Dec 2013 07:28:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBA7SRI4018249; Tue, 10 Dec 2013 07:28:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312100728.rBA7SRI4018249@svn.freebsd.org> From: Dimitry Andric Date: Tue, 10 Dec 2013 07:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259158 - in stable: 10/share/mk 9/share/mk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 07:28:27 -0000 Author: dim Date: Tue Dec 10 07:28:26 2013 New Revision: 259158 URL: http://svnweb.freebsd.org/changeset/base/259158 Log: MFC r259083: For WARNS <= 3, change the clang warning flag -Wno-conversion to -Wno-enum-conversion. In earlier clang versions (before 3.2), the latter did not exist, and suppressing enum conversion warnings was really the goal of this warning suppression flag. This should enable the same kind of warning again as was fixed by r259072 ("incompatible integer to pointer conversion passing 'Elf_Addr' (aka 'unsigned int') to parameter of type 'void *'"), and which was only emitted by gcc. Noticed by: kib Modified: stable/9/share/mk/bsd.sys.mk (contents, props changed) Directory Properties: stable/9/share/mk/ (props changed) Changes in other areas also in this revision: Modified: stable/10/share/mk/bsd.sys.mk Directory Properties: stable/10/ (props changed) Modified: stable/9/share/mk/bsd.sys.mk ============================================================================== --- stable/9/share/mk/bsd.sys.mk Tue Dec 10 07:25:25 2013 (r259157) +++ stable/9/share/mk/bsd.sys.mk Tue Dec 10 07:28:26 2013 (r259158) @@ -69,7 +69,7 @@ CWARNFLAGS+= -Wno-empty-body -Wno-string .endif # WARNS <= 6 .if ${WARNS} <= 3 CWARNFLAGS+= -Wno-tautological-compare -Wno-unused-value\ - -Wno-parentheses-equality -Wno-unused-function -Wno-conversion + -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion .endif # WARNS <= 3 .if ${WARNS} <= 2 CWARNFLAGS+= -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 13:35:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 79A2A65B; Tue, 10 Dec 2013 13:35:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 659ED1CB0; Tue, 10 Dec 2013 13:35:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBADZ5pZ052867; Tue, 10 Dec 2013 13:35:05 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBADZ5rV052865; Tue, 10 Dec 2013 13:35:05 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201312101335.rBADZ5rV052865@svn.freebsd.org> From: Gavin Atkinson Date: Tue, 10 Dec 2013 13:35:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259172 - stable/10/sys/net80211 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 13:35:05 -0000 Author: gavin Date: Tue Dec 10 13:35:04 2013 New Revision: 259172 URL: http://svnweb.freebsd.org/changeset/base/259172 Log: Merge r257754 (by adrian) from head: Don't return ENOBUFS if the transmit path handles the frame but queues it (eg in power save.) 10.0 candidate. PR: kern/183727 Modified: stable/10/sys/net80211/ieee80211_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net80211/ieee80211_output.c ============================================================================== --- stable/10/sys/net80211/ieee80211_output.c Tue Dec 10 13:34:28 2013 (r259171) +++ stable/10/sys/net80211/ieee80211_output.c Tue Dec 10 13:35:04 2013 (r259172) @@ -143,8 +143,12 @@ ieee80211_vap_pkt_send_dest(struct ieee8 */ (void) ieee80211_pwrsave(ni, m); ieee80211_free_node(ni); - /* XXX better status? */ - return (ENOBUFS); + + /* + * We queued it fine, so tell the upper layer + * that we consumed it. + */ + return (0); } /* calculate priority so drivers can find the tx queue */ if (ieee80211_classify(ni, m)) { @@ -155,8 +159,9 @@ ieee80211_vap_pkt_send_dest(struct ieee8 ifp->if_oerrors++; m_freem(m); ieee80211_free_node(ni); + /* XXX better status? */ - return (ENOBUFS); + return (0); } /* * Stash the node pointer. Note that we do this after @@ -168,7 +173,6 @@ ieee80211_vap_pkt_send_dest(struct ieee8 BPF_MTAP(ifp, m); /* 802.3 tx */ - /* * Check if A-MPDU tx aggregation is setup or if we * should try to enable it. The sta must be associated From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 13:36:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D2D97A9; Tue, 10 Dec 2013 13:36:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 092F91CC2; Tue, 10 Dec 2013 13:36:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBADauFw053098; Tue, 10 Dec 2013 13:36:56 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBADauFV053097; Tue, 10 Dec 2013 13:36:56 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201312101336.rBADauFV053097@svn.freebsd.org> From: Gavin Atkinson Date: Tue, 10 Dec 2013 13:36:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259173 - stable/10/sys/net80211 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 13:36:57 -0000 Author: gavin Date: Tue Dec 10 13:36:56 2013 New Revision: 259173 URL: http://svnweb.freebsd.org/changeset/base/259173 Log: Merge r258758 (by adrian) from head: Make sure any waiters on the scan results get notified if the scan task decides to do nothing. If this isn't done, then a scan request whilst a scan occurs in an active channel set or a completed channel set will hang. Candidate for 10.0. Modified: stable/10/sys/net80211/ieee80211_scan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net80211/ieee80211_scan.c ============================================================================== --- stable/10/sys/net80211/ieee80211_scan.c Tue Dec 10 13:35:04 2013 (r259172) +++ stable/10/sys/net80211/ieee80211_scan.c Tue Dec 10 13:36:56 2013 (r259173) @@ -859,6 +859,7 @@ scan_task(void *arg, int pending) if (ss->ss_next == ss->ss_last) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: no channels to scan\n", __func__); + scandone = 1; goto done; } From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 13:38:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA9799C2; Tue, 10 Dec 2013 13:38:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9647E1CD3; Tue, 10 Dec 2013 13:38:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBADcd6J053329; Tue, 10 Dec 2013 13:38:39 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBADcdH3053328; Tue, 10 Dec 2013 13:38:39 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201312101338.rBADcdH3053328@svn.freebsd.org> From: Gavin Atkinson Date: Tue, 10 Dec 2013 13:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259174 - stable/10/sys/net80211 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 13:38:39 -0000 Author: gavin Date: Tue Dec 10 13:38:39 2013 New Revision: 259174 URL: http://svnweb.freebsd.org/changeset/base/259174 Log: Merge r256294 (by adrian) from head: Fix the "am I a net80211 vap" check for bpf listeners. I changed it to use if_transmit a while ago but apparently with monitor mode the if_transmit method is overridden. This is (mostly) a workaround until a more permanent solution can be found. Candidate for 10.0. Submitted by: Patrick Kelsey Modified: stable/10/sys/net80211/ieee80211_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net80211/ieee80211_freebsd.c ============================================================================== --- stable/10/sys/net80211/ieee80211_freebsd.c Tue Dec 10 13:36:56 2013 (r259173) +++ stable/10/sys/net80211/ieee80211_freebsd.c Tue Dec 10 13:38:39 2013 (r259174) @@ -808,9 +808,9 @@ static eventhandler_tag wlan_ifllevent; static void bpf_track(void *arg, struct ifnet *ifp, int dlt, int attach) { - /* NB: identify vap's by if_start */ + /* NB: identify vap's by if_init */ if (dlt == DLT_IEEE802_11_RADIO && - ifp->if_transmit == ieee80211_vap_transmit) { + ifp->if_init == ieee80211_init) { struct ieee80211vap *vap = ifp->if_softc; /* * Track bpf radiotap listener state. We mark the vap From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 13:43:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBF23B78; Tue, 10 Dec 2013 13:43:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AC06C1D40; Tue, 10 Dec 2013 13:43:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBADh0XE056190; Tue, 10 Dec 2013 13:43:00 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBADh0Ih056181; Tue, 10 Dec 2013 13:43:00 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201312101343.rBADh0Ih056181@svn.freebsd.org> From: Gavin Atkinson Date: Tue, 10 Dec 2013 13:43:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259175 - stable/10/sys/net80211 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 13:43:01 -0000 Author: gavin Date: Tue Dec 10 13:42:59 2013 New Revision: 259175 URL: http://svnweb.freebsd.org/changeset/base/259175 Log: Merge r257065 (by adrian) from head: Fix a use-after-free node reference issue when waiting for a return from a management frame transmission. This bug is a bit loopy, so here goes. The underlying cause is pretty easy to understand - the node isn't referenced before passing into the callout, so if the node is deleted before the callout fires, it'll dereference free'd memory. The code path however is slightly more convoluted. The functions _say_ mgt_tx - ie management transmit - which is partially true. Yes, that callback is attached to the mbuf for some management frames. However, it's only for frames relating to scanning and authentication attempts. It helpfully drives the VAP state back to "SCAN" if the transmission fails _OR_ (as I subsequently found out!) if the transmission succeeds but the state machine doesn't make progress towards being authenticated and active. Now, the code itself isn't terribly clear about this. It _looks_ like it's just handling the transmit failure case. However, when you look at what goes on in the transmit success case, it's moving the VAP state back to SCAN if it hasn't changed state since the time the callback was scheduled. Ie, if it's in ASSOC or AUTH still, it'll go back to SCAN. But if it has transitioned to the RUN state, the comparison will fail and it'll not transition things back to the SCAN state. So, to fix this, I decided to leave everything the way it is and merely fix the locking and remove the node reference. The _better_ fix would be to turn this callout into a "assoc/auth request" timeout callback and make the callout locked, thus eliminating all races. However, until all the drivers have been fixed so that transmit completions occur outside of any locking that's going on, it's going to be impossible to do this without introducing LORs. So, I leave some of the evilness in there. Candidate for 10.0. Modified: stable/10/sys/net80211/ieee80211_output.c stable/10/sys/net80211/ieee80211_proto.c stable/10/sys/net80211/ieee80211_proto.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net80211/ieee80211_output.c ============================================================================== --- stable/10/sys/net80211/ieee80211_output.c Tue Dec 10 13:38:39 2013 (r259174) +++ stable/10/sys/net80211/ieee80211_output.c Tue Dec 10 13:42:59 2013 (r259175) @@ -2736,20 +2736,35 @@ ieee80211_alloc_cts(struct ieee80211com static void ieee80211_tx_mgt_timeout(void *arg) { - struct ieee80211_node *ni = arg; - struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211vap *vap = arg; + IEEE80211_LOCK(vap->iv_ic); if (vap->iv_state != IEEE80211_S_INIT && (vap->iv_ic->ic_flags & IEEE80211_F_SCAN) == 0) { /* * NB: it's safe to specify a timeout as the reason here; * it'll only be used in the right state. */ - ieee80211_new_state(vap, IEEE80211_S_SCAN, + ieee80211_new_state_locked(vap, IEEE80211_S_SCAN, IEEE80211_SCAN_FAIL_TIMEOUT); } + IEEE80211_UNLOCK(vap->iv_ic); } +/* + * This is the callback set on net80211-sourced transmitted + * authentication request frames. + * + * This does a couple of things: + * + * + If the frame transmitted was a success, it schedules a future + * event which will transition the interface to scan. + * If a state transition _then_ occurs before that event occurs, + * said state transition will cancel this callout. + * + * + If the frame transmit was a failure, it immediately schedules + * the transition back to scan. + */ static void ieee80211_tx_mgt_cb(struct ieee80211_node *ni, void *arg, int status) { @@ -2767,10 +2782,11 @@ ieee80211_tx_mgt_cb(struct ieee80211_nod * * XXX what happens if !acked but response shows up before callback? */ - if (vap->iv_state == ostate) + if (vap->iv_state == ostate) { callout_reset(&vap->iv_mgtsend, status == 0 ? IEEE80211_TRANS_WAIT*hz : 0, - ieee80211_tx_mgt_timeout, ni); + ieee80211_tx_mgt_timeout, vap); + } } static void Modified: stable/10/sys/net80211/ieee80211_proto.c ============================================================================== --- stable/10/sys/net80211/ieee80211_proto.c Tue Dec 10 13:38:39 2013 (r259174) +++ stable/10/sys/net80211/ieee80211_proto.c Tue Dec 10 13:42:59 2013 (r259175) @@ -107,8 +107,6 @@ static void update_promisc(void *, int); static void update_channel(void *, int); static void update_chw(void *, int); static void ieee80211_newstate_cb(void *, int); -static int ieee80211_new_state_locked(struct ieee80211vap *, - enum ieee80211_state, int); static int null_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, @@ -1834,7 +1832,7 @@ done: * is usually a mistake and indicates lack of proper integration * with the net80211 layer. */ -static int +int ieee80211_new_state_locked(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { Modified: stable/10/sys/net80211/ieee80211_proto.h ============================================================================== --- stable/10/sys/net80211/ieee80211_proto.h Tue Dec 10 13:38:39 2013 (r259174) +++ stable/10/sys/net80211/ieee80211_proto.h Tue Dec 10 13:42:59 2013 (r259175) @@ -332,6 +332,8 @@ void ieee80211_dturbo_switch(struct ieee void ieee80211_swbmiss(void *arg); void ieee80211_beacon_miss(struct ieee80211com *); int ieee80211_new_state(struct ieee80211vap *, enum ieee80211_state, int); +int ieee80211_new_state_locked(struct ieee80211vap *, enum ieee80211_state, + int); void ieee80211_print_essid(const uint8_t *, int); void ieee80211_dump_pkt(struct ieee80211com *, const uint8_t *, int, int, int); From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 19:48:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7F5ED4C; Tue, 10 Dec 2013 19:48:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 997BD19FA; Tue, 10 Dec 2013 19:48:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBAJmmKg090145; Tue, 10 Dec 2013 19:48:48 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBAJmmOL090144; Tue, 10 Dec 2013 19:48:48 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201312101948.rBAJmmOL090144@svn.freebsd.org> From: Warner Losh Date: Tue, 10 Dec 2013 19:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259190 - stable/9/sys/arm/arm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 19:48:48 -0000 Author: imp Date: Tue Dec 10 19:48:48 2013 New Revision: 259190 URL: http://svnweb.freebsd.org/changeset/base/259190 Log: Hand merge from current r235717: Implement pmap_mincore for arm. Now programs using it don't cause a flood of console messages. Reviewed by: alc@ Modified: stable/9/sys/arm/arm/pmap.c Modified: stable/9/sys/arm/arm/pmap.c ============================================================================== --- stable/9/sys/arm/arm/pmap.c Tue Dec 10 19:42:35 2013 (r259189) +++ stable/9/sys/arm/arm/pmap.c Tue Dec 10 19:48:48 2013 (r259190) @@ -4675,9 +4675,59 @@ pmap_remove_write(vm_page_t m) int pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) { - printf("pmap_mincore()\n"); - - return (0); + struct l2_bucket *l2b; + pt_entry_t *ptep, pte; + vm_paddr_t pa; + vm_page_t m; + int val; + boolean_t managed; + + PMAP_LOCK(pmap); +retry: + l2b = pmap_get_l2_bucket(pmap, addr); + if (l2b == NULL) { + val = 0; + goto out; + } + ptep = &l2b->l2b_kva[l2pte_index(addr)]; + pte = *ptep; + if (!l2pte_valid(pte)) { + val = 0; + goto out; + } + val = MINCORE_INCORE; + if (pte & L2_S_PROT_W) + val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; + managed = false; + pa = l2pte_pa(pte); + m = PHYS_TO_VM_PAGE(pa); + if (m != NULL && !(m->oflags & VPO_UNMANAGED)) + managed = true; + if (managed) { + /* + * The ARM pmap tries to maintain a per-mapping + * reference bit. The trouble is that it's kept in + * the PV entry, not the PTE, so it's costly to access + * here. You would need to acquire the pvh global + * lock, call pmap_find_pv(), and introduce a custom + * version of vm_page_pa_tryrelock() that releases and + * reacquires the pvh global lock. In the end, I + * doubt it's worthwhile. This may falsely report + * the given address as referenced. + */ + if ((m->md.pvh_attrs & PVF_REF) != 0) + val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; + } + if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != + (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { + /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ + if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) + goto retry; + } else +out: + PA_UNLOCK_COND(*locked_pa); + PMAP_UNLOCK(pmap); + return (val); } From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 22:04:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 274564E3; Tue, 10 Dec 2013 22:04:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 126DC14AB; Tue, 10 Dec 2013 22:04:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBAM3xa9041732; Tue, 10 Dec 2013 22:03:59 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBAM3xfx041731; Tue, 10 Dec 2013 22:03:59 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201312102203.rBAM3xfx041731@svn.freebsd.org> From: Rick Macklem Date: Tue, 10 Dec 2013 22:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259201 - stable/9/sys/fs/nfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 22:04:00 -0000 Author: rmacklem Date: Tue Dec 10 22:03:59 2013 New Revision: 259201 URL: http://svnweb.freebsd.org/changeset/base/259201 Log: MFC: r257598 During code inspection, I spotted that there was a code path where CLNT_CONTROL() would be called on "client" after it was released via CLNT_RELEASE(). It was unlikely that this code path gets executed and I have not heard of any problem report caused by this bug. This patch fixes the code so that this cannot happen. Modified: stable/9/sys/fs/nfs/nfs_commonkrpc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonkrpc.c Tue Dec 10 21:15:18 2013 (r259200) +++ stable/9/sys/fs/nfs/nfs_commonkrpc.c Tue Dec 10 22:03:59 2013 (r259201) @@ -316,24 +316,25 @@ newnfs_connect(struct nfsmount *nmp, str mtx_lock(&nrp->nr_mtx); if (nrp->nr_client != NULL) { + mtx_unlock(&nrp->nr_mtx); /* * Someone else already connected. */ CLNT_RELEASE(client); } else { nrp->nr_client = client; + /* + * Protocols that do not require connections may be optionally + * left unconnected for servers that reply from a port other + * than NFS_PORT. + */ + if (nmp == NULL || (nmp->nm_flag & NFSMNT_NOCONN) == 0) { + mtx_unlock(&nrp->nr_mtx); + CLNT_CONTROL(client, CLSET_CONNECT, &one); + } else + mtx_unlock(&nrp->nr_mtx); } - /* - * Protocols that do not require connections may be optionally left - * unconnected for servers that reply from a port other than NFS_PORT. - */ - if (nmp == NULL || (nmp->nm_flag & NFSMNT_NOCONN) == 0) { - mtx_unlock(&nrp->nr_mtx); - CLNT_CONTROL(client, CLSET_CONNECT, &one); - } else { - mtx_unlock(&nrp->nr_mtx); - } /* Restore current thread's credentials. */ td->td_ucred = origcred; From owner-svn-src-stable@FreeBSD.ORG Tue Dec 10 22:55:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4E8E15FC; Tue, 10 Dec 2013 22:55:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 36E29184E; Tue, 10 Dec 2013 22:55:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBAMtOI3060089; Tue, 10 Dec 2013 22:55:24 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBAMtNv6060083; Tue, 10 Dec 2013 22:55:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201312102255.rBAMtNv6060083@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 10 Dec 2013 22:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259204 - in stable/10: lib/libcam sbin/camcontrol sys/cam sys/cam/scsi sys/powerpc/pseries X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 22:55:24 -0000 Author: nwhitehorn Date: Tue Dec 10 22:55:22 2013 New Revision: 259204 URL: http://svnweb.freebsd.org/changeset/base/259204 Log: MFC r257345,257382,257388: Implement extended LUN support. If PIM_EXTLUNS is set by a SIM, encode the upper 32-bits of the LUN, if possible, into the target_lun field as passed directly from the REPORT LUNs response. This allows extended LUN support to work for all LUNs with zeros in the lower 32-bits, which covers most addressing modes without breaking KBI. Behavior for drivers not setting PIM_EXTLUNS is unchanged. No user-facing interfaces are modified. Extended LUNs are stored with swizzled 16-bit word order so that, for devices implementing LUN addressing (like SCSI-2), the numerical representation of the LUN is identical with and without PIM_EXTLUNS. Thus setting PIM_EXTLUNS keeps most behavior, and user-facing LUN IDs, unchanged. This follows the strategy used in Solaris. A macro (CAM_EXTLUN_BYTE_SWIZZLE) is provided to transform a lun_id_t into a uint64_t ordered for the wire. This is the second part of work for full 64-bit extended LUN support and is designed to a bridge for stable/10 to the final 64-bit LUN code. The third and final part will involve widening lun_id_t to 64 bits and will not be MFCed. This third part will break the KBI but will keep the KPI unchanged so that all drivers that will care about this can be updated now and not require code changes between HEAD and stable/10. Reviewed by: scottl Modified: stable/10/lib/libcam/camlib.c stable/10/sbin/camcontrol/camcontrol.c stable/10/sys/cam/cam.h stable/10/sys/cam/cam_xpt.c stable/10/sys/cam/scsi/scsi_xpt.c stable/10/sys/powerpc/pseries/phyp_vscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libcam/camlib.c ============================================================================== --- stable/10/lib/libcam/camlib.c Tue Dec 10 22:33:02 2013 (r259203) +++ stable/10/lib/libcam/camlib.c Tue Dec 10 22:55:22 2013 (r259204) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -348,16 +349,16 @@ cam_open_btl(path_id_t path_id, target_i if (ccb.cdm.status == CAM_DEV_MATCH_MORE) { snprintf(cam_errbuf, CAM_ERRBUF_SIZE, "%s: CDM reported more than one" - " passthrough device at %d:%d:%d!!\n", - func_name, path_id, target_id, target_lun); + " passthrough device at %d:%d:%jx!!\n", + func_name, path_id, target_id, (uintmax_t)target_lun); goto btl_bailout; } if (ccb.cdm.num_matches == 0) { snprintf(cam_errbuf, CAM_ERRBUF_SIZE, "%s: no passthrough device found at" - " %d:%d:%d", func_name, path_id, target_id, - target_lun); + " %d:%d:%jx", func_name, path_id, target_id, + (uintmax_t)target_lun); goto btl_bailout; } @@ -687,14 +688,14 @@ cam_path_string(struct cam_device *dev, return(str); } - snprintf(str, len, "(%s%d:%s%d:%d:%d:%d): ", + snprintf(str, len, "(%s%d:%s%d:%d:%d:%jx): ", (dev->device_name[0] != '\0') ? dev->device_name : "pass", dev->dev_unit_num, (dev->sim_name[0] != '\0') ? dev->sim_name : "unknown", dev->sim_unit_number, dev->bus_id, dev->target_id, - dev->target_lun); + (uintmax_t)dev->target_lun); return(str); } Modified: stable/10/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/10/sbin/camcontrol/camcontrol.c Tue Dec 10 22:33:02 2013 (r259203) +++ stable/10/sbin/camcontrol/camcontrol.c Tue Dec 10 22:55:22 2013 (r259204) @@ -566,11 +566,11 @@ getdevtree(void) } fprintf(stdout, "%-33s at scbus%d " - "target %d lun %d (", + "target %d lun %jx (", tmpstr, dev_result->path_id, dev_result->target_id, - dev_result->target_lun); + (uintmax_t)dev_result->target_lun); need_close = 1; Modified: stable/10/sys/cam/cam.h ============================================================================== --- stable/10/sys/cam/cam.h Tue Dec 10 22:33:02 2013 (r259203) +++ stable/10/sys/cam/cam.h Tue Dec 10 22:55:22 2013 (r259204) @@ -50,6 +50,12 @@ typedef union { #define CAM_TARGET_WILDCARD ((target_id_t)~0) #define CAM_LUN_WILDCARD ((lun_id_t)~0) +#define CAM_EXTLUN_BYTE_SWIZZLE(lun) ( \ + ((((u_int64_t)lun) & 0xffff000000000000L) >> 48) | \ + ((((u_int64_t)lun) & 0x0000ffff00000000L) >> 16) | \ + ((((u_int64_t)lun) & 0x00000000ffff0000L) << 16) | \ + ((((u_int64_t)lun) & 0x000000000000ffffL) << 48)) + /* * Maximum length for a CAM CDB. */ Modified: stable/10/sys/cam/cam_xpt.c ============================================================================== --- stable/10/sys/cam/cam_xpt.c Tue Dec 10 22:33:02 2013 (r259203) +++ stable/10/sys/cam/cam_xpt.c Tue Dec 10 22:55:22 2013 (r259204) @@ -1025,14 +1025,14 @@ xpt_announce_periph(struct cam_periph *p mtx_assert(periph->sim->mtx, MA_OWNED); periph->flags |= CAM_PERIPH_ANNOUNCED; - printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", + printf("%s%d at %s%d bus %d scbus%d target %d lun %jx\n", periph->periph_name, periph->unit_number, path->bus->sim->sim_name, path->bus->sim->unit_number, path->bus->sim->bus_id, path->bus->path_id, path->target->target_id, - path->device->lun_id); + (uintmax_t)path->device->lun_id); printf("%s%d: ", periph->periph_name, periph->unit_number); if (path->device->protocol == PROTO_SCSI) scsi_print_inquiry(&path->device->inq_data); @@ -1078,14 +1078,14 @@ xpt_denounce_periph(struct cam_periph *p struct cam_path *path = periph->path; mtx_assert(periph->sim->mtx, MA_OWNED); - printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", + printf("%s%d at %s%d bus %d scbus%d target %d lun %jx\n", periph->periph_name, periph->unit_number, path->bus->sim->sim_name, path->bus->sim->unit_number, path->bus->sim->bus_id, path->bus->path_id, path->target->target_id, - path->device->lun_id); + (uintmax_t)path->device->lun_id); printf("%s%d: ", periph->periph_name, periph->unit_number); if (path->device->protocol == PROTO_SCSI) scsi_print_inquiry_short(&path->device->inq_data); @@ -3652,7 +3652,7 @@ xpt_print_path(struct cam_path *path) printf("X:"); if (path->device != NULL) - printf("%d): ", path->device->lun_id); + printf("%jx): ", (uintmax_t)path->device->lun_id); else printf("X): "); } @@ -3665,11 +3665,11 @@ xpt_print_device(struct cam_ed *device) if (device == NULL) printf("(nopath): "); else { - printf("(noperiph:%s%d:%d:%d:%d): ", device->sim->sim_name, + printf("(noperiph:%s%d:%d:%d:%jx): ", device->sim->sim_name, device->sim->unit_number, device->sim->bus_id, device->target->target_id, - device->lun_id); + (uintmax_t)device->lun_id); } } @@ -3717,7 +3717,8 @@ xpt_path_string(struct cam_path *path, c sbuf_printf(&sb, "X:"); if (path->device != NULL) - sbuf_printf(&sb, "%d): ", path->device->lun_id); + sbuf_printf(&sb, "%jx): ", + (uintmax_t)path->device->lun_id); else sbuf_printf(&sb, "X): "); } Modified: stable/10/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_xpt.c Tue Dec 10 22:33:02 2013 (r259203) +++ stable/10/sys/cam/scsi/scsi_xpt.c Tue Dec 10 22:55:22 2013 (r259204) @@ -100,6 +100,12 @@ SYSCTL_PROC(_kern_cam, OID_AUTO, cam_src (lval) <<= 8; \ (lval) |= (lp)->luns[(i)].lundata[1]; \ } +#define CAM_GET_LUN(lp, i, lval) \ + (lval) = scsi_4btoul((lp)->luns[(i)].lundata); \ + (lval) = ((lval) >> 16) | ((lval) << 16); +#define CAM_LUN_ONLY_32BITS(lp, i) \ + (scsi_4btoul(&((lp)->luns[(i)].lundata[4])) == 0) + /* * If we're not quirked to search <= the first 8 luns * and we are either quirked to search above lun 8, @@ -175,7 +181,8 @@ do { \ typedef enum { PROBE_INQUIRY_CKSUM = 0x01, PROBE_SERIAL_CKSUM = 0x02, - PROBE_NO_ANNOUNCE = 0x04 + PROBE_NO_ANNOUNCE = 0x04, + PROBE_EXTLUN = 0x08 } probe_flags; typedef struct { @@ -561,10 +568,9 @@ static void proberequestdefaultnegotiat static int proberequestbackoff(struct cam_periph *periph, struct cam_ed *device); static void probedone(struct cam_periph *periph, union ccb *done_ccb); -static int probe_strange_rpl_data(struct scsi_report_luns_data *rp, - uint32_t maxlun); static void probe_purge_old(struct cam_path *path, - struct scsi_report_luns_data *new); + struct scsi_report_luns_data *new, + probe_flags flags); static void probecleanup(struct cam_periph *periph); static void scsi_find_quirk(struct cam_ed *device); static void scsi_scan_bus(struct cam_periph *periph, union ccb *ccb); @@ -699,6 +705,11 @@ probeschedule(struct cam_periph *periph) else softc->flags &= ~PROBE_NO_ANNOUNCE; + if (cpi.hba_misc & PIM_EXTLUNS) + softc->flags |= PROBE_EXTLUN; + else + softc->flags &= ~PROBE_EXTLUN; + xpt_schedule(periph, CAM_PRIORITY_XPT); } @@ -1277,13 +1288,6 @@ out: */ free(lp, M_CAMXPT); lp = NULL; - } else if (probe_strange_rpl_data(lp, maxlun)) { - /* - * If we can't understand the lun format - * of any entry, bail. - */ - free(lp, M_CAMXPT); - lp = NULL; } else { lun_id_t lun; int idx; @@ -1291,14 +1295,14 @@ out: CAM_DEBUG(path, CAM_DEBUG_PROBE, ("Probe: %u lun(s) reported\n", nlun)); - CAM_GET_SIMPLE_LUN(lp, 0, lun); + CAM_GET_LUN(lp, 0, lun); /* * If the first lun is not lun 0, then either there * is no lun 0 in the list, or the list is unsorted. */ if (lun != 0) { for (idx = 0; idx < nlun; idx++) { - CAM_GET_SIMPLE_LUN(lp, idx, lun); + CAM_GET_LUN(lp, idx, lun); if (lun == 0) { break; } @@ -1330,7 +1334,7 @@ out: * This function will also install the new list * in the target structure. */ - probe_purge_old(path, lp); + probe_purge_old(path, lp, softc->flags); lp = NULL; } if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) { @@ -1702,26 +1706,14 @@ probe_device_check: } } -static int -probe_strange_rpl_data(struct scsi_report_luns_data *rp, uint32_t maxlun) -{ - uint32_t idx; - uint32_t nlun = MIN(maxlun, (scsi_4btoul(rp->length) / 8)); - - for (idx = 0; idx < nlun; idx++) { - if (!CAM_CAN_GET_SIMPLE_LUN(rp, idx)) { - return (-1); - } - } - return (0); -} - static void -probe_purge_old(struct cam_path *path, struct scsi_report_luns_data *new) +probe_purge_old(struct cam_path *path, struct scsi_report_luns_data *new, + probe_flags flags) { struct cam_path *tp; struct scsi_report_luns_data *old; - u_int idx1, idx2, nlun_old, nlun_new, this_lun; + u_int idx1, idx2, nlun_old, nlun_new; + lun_id_t this_lun; u_int8_t *ol, *nl; if (path->target == NULL) { @@ -1755,17 +1747,26 @@ probe_purge_old(struct cam_path *path, s * that would be what the probe state * machine is currently working on, * so we won't do that. - * - * We also cannot nuke it if it is - * not in a lun format we understand. */ - if (!CAM_CAN_GET_SIMPLE_LUN(old, idx1)) { - continue; - } - CAM_GET_SIMPLE_LUN(old, idx1, this_lun); + CAM_GET_LUN(old, idx1, this_lun); if (this_lun == 0) { continue; } + + /* + * We also cannot nuke it if it is + * not in a lun format we understand + * and replace the LUN with a "simple" LUN + * if that is all the HBA supports. + */ + if (!(flags & PROBE_EXTLUN)) { + if (!CAM_CAN_GET_SIMPLE_LUN(old, idx1)) + continue; + CAM_GET_SIMPLE_LUN(old, idx1, this_lun); + } + if (!CAM_LUN_ONLY_32BITS(old, idx1)) + continue; + if (xpt_create_path(&tp, NULL, xpt_path_path_id(path), xpt_path_target_id(path), this_lun) == CAM_REQ_CMP) { xpt_async(AC_LOST_DEVICE, tp, NULL); @@ -2001,7 +2002,7 @@ scsi_scan_bus(struct cam_periph *periph, next_target = 1; if (target->luns) { - uint32_t first; + lun_id_t first; u_int nluns = scsi_4btoul(target->luns->length) / 8; /* @@ -2009,19 +2010,44 @@ scsi_scan_bus(struct cam_periph *periph, * of the list as we've actually just finished probing * it. */ - CAM_GET_SIMPLE_LUN(target->luns, 0, first); + CAM_GET_LUN(target->luns, 0, first); if (first == 0 && scan_info->lunindex[target_id] == 0) { scan_info->lunindex[target_id]++; } + /* + * Skip any LUNs that the HBA can't deal with. + */ + while (scan_info->lunindex[target_id] < nluns) { + if (scan_info->cpi->hba_misc & PIM_EXTLUNS) { + CAM_GET_LUN(target->luns, + scan_info->lunindex[target_id], + lun_id); + break; + } + + /* XXX print warning? */ + if (!CAM_LUN_ONLY_32BITS(target->luns, + scan_info->lunindex[target_id])) + continue; + if (CAM_CAN_GET_SIMPLE_LUN(target->luns, + scan_info->lunindex[target_id])) { + CAM_GET_SIMPLE_LUN(target->luns, + scan_info->lunindex[target_id], + lun_id); + break; + } + + scan_info->lunindex[target_id]++; + } + if (scan_info->lunindex[target_id] < nluns) { - CAM_GET_SIMPLE_LUN(target->luns, - scan_info->lunindex[target_id], lun_id); next_target = 0; 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)); + ("next lun to try at index %u is %jx\n", + scan_info->lunindex[target_id], + (uintmax_t)lun_id)); scan_info->lunindex[target_id]++; } else { /* Modified: stable/10/sys/powerpc/pseries/phyp_vscsi.c ============================================================================== --- stable/10/sys/powerpc/pseries/phyp_vscsi.c Tue Dec 10 22:33:02 2013 (r259203) +++ stable/10/sys/powerpc/pseries/phyp_vscsi.c Tue Dec 10 22:55:22 2013 (r259204) @@ -548,12 +548,6 @@ vscsi_task_management(struct vscsi_softc TAILQ_REMOVE(&sc->free_xferq, xp, queue); TAILQ_INSERT_TAIL(&sc->active_xferq, xp, queue); - if (!(ccb->ccb_h.xflags & CAM_EXTLUN_VALID)) { - ccb->ccb_h.xflags |= CAM_EXTLUN_VALID; - ccb->ccb_h.ext_lun.lun64 = (0x1UL << 62) | - ((uint64_t)ccb->ccb_h.target_lun << 48); - } - xp->srp_iu_size = crq.iu_length = sizeof(*cmd); err = vmem_alloc(xp->sc->srp_iu_arena, xp->srp_iu_size, M_BESTFIT | M_NOWAIT, &xp->srp_iu_offset); @@ -565,7 +559,7 @@ vscsi_task_management(struct vscsi_softc bzero(cmd, xp->srp_iu_size); cmd->type = SRP_TSK_MGMT; cmd->tag = (uint64_t)xp; - cmd->lun = ccb->ccb_h.ext_lun.lun64; + cmd->lun = htobe64(CAM_EXTLUN_BYTE_SWIZZLE(ccb->ccb_h.target_lun)); switch (ccb->ccb_h.func_code) { case XPT_RESET_DEV: @@ -608,12 +602,6 @@ vscsi_scsi_command(void *xxp, bus_dma_se cdb = (ccb->ccb_h.flags & CAM_CDB_POINTER) ? ccb->csio.cdb_io.cdb_ptr : ccb->csio.cdb_io.cdb_bytes; - if (!(ccb->ccb_h.xflags & CAM_EXTLUN_VALID)) { - ccb->ccb_h.xflags |= CAM_EXTLUN_VALID; - ccb->ccb_h.ext_lun.lun64 = (0x1UL << 62) | - ((uint64_t)ccb->ccb_h.target_lun << 48); - } - /* Command format from Table 20, page 37 of SRP spec */ crq.iu_length = 48 + ((nsegs > 1) ? 20 : 16) + ((ccb->csio.cdb_len > 16) ? (ccb->csio.cdb_len - 16) : 0); @@ -635,7 +623,7 @@ vscsi_scsi_command(void *xxp, bus_dma_se memcpy(cmd->cdb, cdb, ccb->csio.cdb_len); cmd->tag = (uint64_t)(xp); /* Let the responder find this again */ - cmd->lun = ccb->ccb_h.ext_lun.lun64; + cmd->lun = htobe64(CAM_EXTLUN_BYTE_SWIZZLE(ccb->ccb_h.target_lun)); if (nsegs > 1) { /* Use indirect descriptors */ From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 00:17:14 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18B86ADA; Wed, 11 Dec 2013 00:17:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 024651E62; Wed, 11 Dec 2013 00:17:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBB0HDkF090836; Wed, 11 Dec 2013 00:17:13 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBB0HDgX090835; Wed, 11 Dec 2013 00:17:13 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201312110017.rBB0HDgX090835@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 11 Dec 2013 00:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259206 - stable/10/sys/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 00:17:14 -0000 Author: np Date: Wed Dec 11 00:17:13 2013 New Revision: 259206 URL: http://svnweb.freebsd.org/changeset/base/259206 Log: MFC r258692 (gnn). Add constants for use in interrogating various fiber and copper connectors most often used with network interfaces. The SFF-8472 standard defines the information that can be retrieved from an optic or a copper cable plugged into a NIC, most often referred to as SFP+. Examples of values that can be read include the cable vendor's name, part number, date of manufacture as well as running data such as temperature, voltage and tx and rx power. Copious comments on how to use these values with an I2C interface are given in the header file itself. Discussed with: gnn Added: stable/10/sys/net/sff8472.h - copied unchanged from r258692, head/sys/net/sff8472.h Modified: Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/net/sff8472.h (from r258692, head/sys/net/sff8472.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/net/sff8472.h Wed Dec 11 00:17:13 2013 (r259206, copy of r258692, head/sys/net/sff8472.h) @@ -0,0 +1,433 @@ +/*- + * Copyright (c) 2013 George V. Neville-Neil + * 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$ + */ + +/* + * The following set of constants are from Document SFF-8472 + * "Diagnostic Monitoring Interface for Optical Transceivers" revision + * 11.3 published by the SFF Committee on June 11, 2013 + * + * The SFF standard defines two ranges of addresses, each 255 bytes + * long for the storage of data and diagnostics on cables, such as + * SFP+ optics and TwinAx cables. The ranges are defined in the + * following way: + * + * Base Address 0xa0 (Identification Data) + * 0-95 Serial ID Defined by SFP MSA + * 96-127 Vendor Specific Data + * 128-255 Reserved + * + * Base Address 0xa2 (Diagnostic Data) + * 0-55 Alarm and Warning Thresholds + * 56-95 Cal Constants + * 96-119 Real Time Diagnostic Interface + * 120-127 Vendor Specific + * 128-247 User Writable EEPROM + * 248-255 Vendor Specific + * + * Note that not all addresses are supported. Where support is + * optional this is noted and instructions for checking for the + * support are supplied. + * + * All these values are read across an I2C (i squared C) bus. Any + * device wishing to read these addresses must first have support for + * i2c calls. The Chelsio T4/T5 driver (dev/cxgbe) is one such + * driver. + */ + + +/* Table 3.1 Two-wire interface ID: Data Fields */ + +#define SFF_8472_BASE 0xa0 /* Base address for all our queries. */ +#define SFF_8472_ID 0 /* Transceiver Type (Table 3.2) */ +#define SFF_8472_EXT_ID 1 /* Extended transceiver type (Table 3.3) */ +#define SFF_8472_CONNECTOR 2 /* Connector type (Table 3.4) */ +#define SFF_8472_TRANS_START 3 /* Elec or Optical Compatibility + * (Table 3.5) */ +#define SFF_8472_TRANS_END 10 +#define SFF_8472_ENCODING 11 /* Encoding Code for high speed + * serial encoding algorithm (see + * Table 3.6) */ +#define SFF_8472_BITRATE 12 /* Nominal signaling rate, units + * of 100MBd. (see details for + * rates > 25.0Gb/s) */ +#define SFF_8472_RATEID 13 /* Type of rate select + * functionality (see Table + * 3.6a) */ +#define SFF_8472_LEN_SMF_KM 14 /* Link length supported for single + * mode fiber, units of km */ +#define SFF_8472_LEN_SMF 15 /* Link length supported for single + * mode fiber, units of 100 m */ +#define SFF_8472_LEN_50UM 16 /* Link length supported for 50 um + * OM2 fiber, units of 10 m */ +#define SFF_8472_LEN_625UM 17 /* Link length supported for 62.5 + * um OM1 fiber, units of 10 m */ +#define SFF_8472_LEN_OM4 18 /* Link length supported for 50um + * OM4 fiber, units of 10m. + * Alternatively copper or direct + * attach cable, units of m */ +#define SFF_8472_LEN_OM3 19 /* Link length supported for 50 um OM3 fiber, units of 10 m */ +#define SFF_8472_VENDOR_START 20 /* Vendor name [Address A0h, Bytes + * 20-35] */ +#define SFF_8472_VENDOR_END 35 +#define SFF_8472_TRANS 36 /* Transceiver Code for electronic + * or optical compatibility (see + * Table 3.5) */ +#define SFF_8472_VENDOR_OUI_START 37 /* Vendor OUI SFP vendor IEEE + * company ID */ +#define SFF_8472_VENDOR_OUI_END 39 +#define SFF_8472_PN_START 40 /* Vendor PN */ +#define SFF_8472_PN_END 55 +#define SFF_8472_REV_START 56 /* Vendor Revision */ +#define SFF_8472_REV_END 59 +#define SFF_8472_WAVELEN_START 60 /* Wavelength Laser wavelength + * (Passive/Active Cable + * Specification Compliance) */ +#define SFF_8472_WAVELEN_END 61 +#define SFF_8472_CC_BASE 63 /* CC_BASE Check code for Base ID + * Fields (addresses 0 to 62) */ + +/* + * Extension Fields (optional) check the options before reading other + * addresses. + */ +#define SFF_8472_OPTIONS_MSB 64 /* Options Indicates which optional + * transceiver signals are + * implemented */ +#define SFF_8472_OPTIONS_LSB 65 /* (see Table 3.7) */ +#define SFF_8472_BR_MAX 66 /* BR max Upper bit rate margin, + * units of % (see details for + * rates > 25.0Gb/s) */ +#define SFF_8472_BR_MIN 67 /* Lower bit rate margin, units of + * % (see details for rates > + * 25.0Gb/s) */ +#define SFF_8472_SN_START 68 /* Vendor SN [Address A0h, Bytes 68-83] */ +#define SFF_8472_SN_END 83 +#define SFF_8472_DATE_START 84 /* Date code Vendor’s manufacturing + * date code (see Table 3.8) */ +#define SFF_8472_DATE_END 91 +#define SFF_8472_DIAG_TYPE 92 /* Diagnostic Monitoring Type + * Indicates which type of + * diagnostic monitoring is + * implemented (if any) in the + * transceiver (see Table 3.9) + */ +#define SFF_8472_DIAG_IMPL (1 << 6) /* Required to be 1 */ +#define SFF_8472_DIAG_INTERNAL (1 << 5) /* Internal measurements. */ +#define SFF_8472_DIAG_EXTERNAL (1 << 4) /* External measurements. */ +#define SFF_8472_DIAG_POWER (1 << 3) /* Power measurement type */ +#define SFF_8472_DIAG_ADDR_CHG (1 << 2) /* Address change required. + * See SFF-8472 doc. */ + +#define SFF_8472_ENHANCED 93 /* Enhanced Options Indicates which + * optional enhanced features are + * implemented (if any) in the + * transceiver (see Table 3.10) */ +#define SFF_8472_COMPLIANCE 94 /* SFF-8472 Compliance Indicates + * which revision of SFF-8472 the + * transceiver complies with. (see + * Table 3.12)*/ +#define SFF_8472_CC_EXT 95 /* Check code for the Extended ID + * Fields (addresses 64 to 94) + */ + +#define SFF_8472_VENDOR_RSRVD_START 96 +#define SFF_8472_VENDOR_RSRVD_END 127 + +#define SFF_8472_RESERVED_START 128 +#define SFF_8472_RESERVED_END 255 + + /* + * Diagnostics are available at the two wire address 0xa2. All + * diagnostics are OPTIONAL so you should check 0xa0 registers 92 to + * see which, if any are supported. + */ + +#define SFF_8472_DIAG 0xa2 /* Base address for diagnostics. */ + + /* + * Table 3.15 Alarm and Warning Thresholds All values are 2 bytes + * and MUST be read in a single read operation starting at the MSB + */ + +#define SFF_8472_TEMP_HIGH_ALM 0 /* Temp High Alarm */ +#define SFF_8472_TEMP_LOW_ALM 2 /* Temp Low Alarm */ +#define SFF_8472_TEMP_HIGH_WARN 4 /* Temp High Warning */ +#define SFF_8472_TEMP_LOW_WARN 6 /* Temp Low Warning */ +#define SFF_8472_VOLTAGE_HIGH_ALM 8 /* Voltage High Alarm */ +#define SFF_8472_VOLTAGE_LOW_ALM 10 /* Voltage Low Alarm */ +#define SFF_8472_VOLTAGE_HIGH_WARN 12 /* Voltage High Warning */ +#define SFF_8472_VOLTAGE_LOW_WARN 14 /* Voltage Low Warning */ +#define SFF_8472_BIAS_HIGH_ALM 16 /* Bias High Alarm */ +#define SFF_8472_BIAS_LOW_ALM 18 /* Bias Low Alarm */ +#define SFF_8472_BIAS_HIGH_WARN 20 /* Bias High Warning */ +#define SFF_8472_BIAS_LOW_WARN 22 /* Bias Low Warning */ +#define SFF_8472_TX_POWER_HIGH_ALM 24 /* TX Power High Alarm */ +#define SFF_8472_TX_POWER_LOW_ALM 26 /* TX Power Low Alarm */ +#define SFF_8472_TX_POWER_HIGH_WARN 28 /* TX Power High Warning */ +#define SFF_8472_TX_POWER_LOW_WARN 30 /* TX Power Low Warning */ +#define SFF_8472_RX_POWER_HIGH_ALM 32 /* RX Power High Alarm */ +#define SFF_8472_RX_POWER_LOW_ALM 34 /* RX Power Low Alarm */ +#define SFF_8472_RX_POWER_HIGH_WARN 36 /* RX Power High Warning */ +#define SFF_8472_RX_POWER_LOW_WARN 38 /* RX Power Low Warning */ + +#define SFF_8472_RX_POWER4 56 /* Rx_PWR(4) Single precision + * floating point calibration data + * - Rx optical power. Bit 7 of + * byte 56 is MSB. Bit 0 of byte + * 59 is LSB. Rx_PWR(4) should be + * set to zero for “internally + * calibrated” devices. */ +#define SFF_8472_RX_POWER3 60 /* Rx_PWR(3) Single precision + * floating point calibration data + * - Rx optical power. Bit 7 of + * byte 60 is MSB. Bit 0 of byte 63 + * is LSB. Rx_PWR(3) should be set + * to zero for “internally + * calibrated” devices.*/ +#define SFF_8472_RX_POWER2 64 /* Rx_PWR(2) Single precision + * floating point calibration data, + * Rx optical power. Bit 7 of byte + * 64 is MSB, bit 0 of byte 67 is + * LSB. Rx_PWR(2) should be set to + * zero for “internally calibrated” + * devices. */ +#define SFF_8472_RX_POWER1 68 /* Rx_PWR(1) Single precision + * floating point calibration data, + * Rx optical power. Bit 7 of byte + * 68 is MSB, bit 0 of byte 71 is + * LSB. Rx_PWR(1) should be set to + * 1 for “internally calibrated” + * devices. */ +#define SFF_8472_RX_POWER0 72 /* Rx_PWR(0) Single precision + * floating point calibration data, + * Rx optical power. Bit 7 of byte + * 72 is MSB, bit 0 of byte 75 is + * LSB. Rx_PWR(0) should be set to + * zero for “internally calibrated” + * devices. */ +#define SFF_8472_TX_I_SLOPE 76 /* Tx_I(Slope) Fixed decimal + * (unsigned) calibration data, + * laser bias current. Bit 7 of + * byte 76 is MSB, bit 0 of byte 77 + * is LSB. Tx_I(Slope) should be + * set to 1 for “internally + * calibrated” devices. */ +#define SFF_8472_TX_I_OFFSET 78 /* Tx_I(Offset) Fixed decimal + * (signed two’s complement) + * calibration data, laser bias + * current. Bit 7 of byte 78 is + * MSB, bit 0 of byte 79 is + * LSB. Tx_I(Offset) should be set + * to zero for “internally + * calibrated” devices. */ +#define SFF_8472_TX_POWER_SLOPE 80 /* Tx_PWR(Slope) Fixed decimal + * (unsigned) calibration data, + * transmitter coupled output + * power. Bit 7 of byte 80 is MSB, + * bit 0 of byte 81 is LSB. + * Tx_PWR(Slope) should be set to 1 + * for “internally calibrated” + * devices. */ +#define SFF_8472_TX_POWER_OFFSET 82 /* Tx_PWR(Offset) Fixed decimal + * (signed two’s complement) + * calibration data, transmitter + * coupled output power. Bit 7 of + * byte 82 is MSB, bit 0 of byte 83 + * is LSB. Tx_PWR(Offset) should be + * set to zero for “internally + * calibrated” devices. */ +#define SFF_8472_T_SLOPE 84 /* T (Slope) Fixed decimal + * (unsigned) calibration data, + * internal module temperature. Bit + * 7 of byte 84 is MSB, bit 0 of + * byte 85 is LSB. T(Slope) should + * be set to 1 for “internally + * calibrated” devices. */ +#define SFF_8472_T_OFFSET 86 /* T (Offset) Fixed decimal (signed + * two’s complement) calibration + * data, internal module + * temperature. Bit 7 of byte 86 is + * MSB, bit 0 of byte 87 is LSB. + * T(Offset) should be set to zero + * for “internally calibrated” + * devices. */ +#define SFF_8472_V_SLOPE 88 /* V (Slope) Fixed decimal + * (unsigned) calibration data, + * internal module supply + * voltage. Bit 7 of byte 88 is + * MSB, bit 0 of byte 89 is + * LSB. V(Slope) should be set to 1 + * for “internally calibrated” + * devices. */ +#define SFF_8472_V_OFFSET 90 /* V (Offset) Fixed decimal (signed + * two’s complement) calibration + * data, internal module supply + * voltage. Bit 7 of byte 90 is + * MSB. Bit 0 of byte 91 is + * LSB. V(Offset) should be set to + * zero for “internally calibrated” + * devices. */ +#define SFF_8472_CHECKSUM 95 /* Checksum Byte 95 contains the + * low order 8 bits of the sum of + * bytes 0 – 94. */ + /* Internal measurements. */ + +#define SFF_8472_TEMP 96 /* Internally measured module temperature. */ +#define SFF_8472_VCC 98 /* Internally measured supply + * voltage in transceiver. + */ +#define SFF_8472_TX_BIAS 100 /* Internally measured TX Bias Current. */ +#define SFF_8472_TX_POWER 102 /* Measured TX output power. */ +#define SFF_8472_RX_POWER 104 /* Measured RX input power. */ + +#define SFF_8472_STATUS 110 /* See below */ + + /* Status Bits Described */ + +/* + * TX Disable State Digital state of the TX Disable Input Pin. Updated + * within 100ms of change on pin. + */ +#define SFF_8472_STATUS_TX_DISABLE (1 << 7) + +/* + * Select Read/write bit that allows software disable of + * laser. Writing ‘1’ disables laser. See Table 3.11 for + * enable/disable timing requirements. This bit is “OR”d with the hard + * TX_DISABLE pin value. Note, per SFP MSA TX_DISABLE pin is default + * enabled unless pulled low by hardware. If Soft TX Disable is not + * implemented, the transceiver ignores the value of this bit. Default + * power up value is zero/low. + */ +#define SFF_8472_STATUS_SOFT_TX_DISABLE (1 << 6) + +/* + * RS(1) State Digital state of SFP input pin AS(1) per SFF-8079 or + * RS(1) per SFF-8431. Updated within 100ms of change on pin. See A2h + * Byte 118, Bit 3 for Soft RS(1) Select control information. + */ +#define SFF_8472_RS_STATE (1 << 5) + +/* + * Rate_Select State [aka. “RS(0)”] Digital state of the SFP + * Rate_Select Input Pin. Updated within 100ms of change on pin. Note: + * This pin is also known as AS(0) in SFF-8079 and RS(0) in SFF-8431. + */ +#define SFF_8472_STATUS_SELECT_STATE (1 << 4) + +/* + * Read/write bit that allows software rate select control. Writing + * ‘1’ selects full bandwidth operation. This bit is “OR’d with the + * hard Rate_Select, AS(0) or RS(0) pin value. See Table 3.11 for + * timing requirements. Default at power up is logic zero/low. If Soft + * Rate Select is not implemented, the transceiver ignores the value + * of this bit. Note: Specific transceiver behaviors of this bit are + * identified in Table 3.6a and referenced documents. See Table 3.18a, + * byte 118, bit 3 for Soft RS(1) Select. + */ +#define SFF_8472_STATUS_SOFT_RATE_SELECT (1 << 3) + +/* + * TX Fault State Digital state of the TX Fault Output Pin. Updated + * within 100ms of change on pin. + */ +#define SFF_8472_STATUS_TX_FAULT_STATE (1 << 2) + +/* + * Digital state of the RX_LOS Output Pin. Updated within 100ms of + * change on pin. + */ +#define SFF_8472_STATUS_RX_LOS (1 << 1) + +/* + * Indicates transceiver has achieved power up and data is ready. Bit + * remains high until data is ready to be read at which time the + * device sets the bit low. + */ +#define SFF_8472_STATUS_DATA_READY (1 << 0) + +/* Table 3.2 Identifier values */ +#define SFF_8472_ID_UNKNOWN 0x0 /* Unknown or unspecified */ +#define SFF_8472_ID_GBIC 0x1 /* GBIC */ +#define SFF_8472_ID_SFF 0x2 /* Module soldered to motherboard (ex: SFF)*/ +#define SFF_8472_ID_SFP 0x3 /* SFP or SFP “Plus” */ +#define SFF_8472_ID_XBI 0x4 /* Reserved for “300 pin XBI” devices */ +#define SFF_8472_ID_XENPAK 0x5 /* Reserved for “Xenpak” devices */ +#define SFF_8472_ID_XFP 0x6 /* Reserved for “XFP” devices */ +#define SFF_8472_ID_XFF 0x7 /* Reserved for “XFF” devices */ +#define SFF_8472_ID_XFPE 0x8 /* Reserved for “XFP-E” devices */ +#define SFF_8472_ID_XPAK 0x9 /* Reserved for “XPak” devices */ +#define SFF_8472_ID_X2 0xA /* Reserved for “X2” devices */ +#define SFF_8472_ID_DWDM_SFP 0xB /* Reserved for “DWDM-SFP” devices */ +#define SFF_8472_ID_QSFP 0xC /* Reserved for “QSFP” devices */ +#define SFF_8472_ID_LAST SFF_8472_ID_QSFP + +static char *sff_8472_id[SFF_8472_ID_LAST + 1] = {"Unknown", + "GBIC", + "SFF", + "SFP", + "XBI", + "Xenpak", + "XFP", + "XFF", + "XFP-E", + "XPak", + "X2", + "DWDM-SFP", + "QSFP"}; + +/* Table 3.13 and 3.14 Temperature Conversion Values */ +#define SFF_8472_TEMP_SIGN (1 << 15) +#define SFF_8472_TEMP_SHIFT 8 +#define SFF_8472_TEMP_MSK 0xEF00 +#define SFF_8472_TEMP_FRAC 0x00FF + +/* Internal Callibration Conversion factors */ + +/* + * Represented as a 16 bit unsigned integer with the voltage defined + * as the full 16 bit value (0 – 65535) with LSB equal to 100 uVolt, + * yielding a total range of 0 to +6.55 Volts. + */ +#define SFF_8472_VCC_FACTOR 10000.0 + +/* + * Represented as a 16 bit unsigned integer with the current defined + * as the full 16 bit value (0 – 65535) with LSB equal to 2 uA, + * yielding a total range of 0 to 131 mA. + */ + +#define SFF_8472_BIAS_FACTOR 2000.0 + +/* + * Represented as a 16 bit unsigned integer with the power defined as + * the full 16 bit value (0 – 65535) with LSB equal to 0.1 uW, + * yielding a total range of 0 to 6.5535 mW (~ -40 to +8.2 dBm). + */ + +#define SFF_8472_POWER_FACTOR 10000.0 From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 00:39:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7C8E2AF; Wed, 11 Dec 2013 00:39:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9230C1FBD; Wed, 11 Dec 2013 00:39:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBB0duJb098268; Wed, 11 Dec 2013 00:39:56 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBB0dulK098266; Wed, 11 Dec 2013 00:39:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201312110039.rBB0dulK098266@svn.freebsd.org> From: Rick Macklem Date: Wed, 11 Dec 2013 00:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259207 - stable/10/sys/fs/nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 00:39:56 -0000 Author: rmacklem Date: Wed Dec 11 00:39:56 2013 New Revision: 259207 URL: http://svnweb.freebsd.org/changeset/base/259207 Log: MFC: r257598 During code inspection, I spotted that there was a code path where CLNT_CONTROL() would be called on "client" after it was released via CLNT_RELEASE(). It was unlikely that this code path gets executed and I have not heard of any problem report caused by this bug. This patch fixes the code so that this cannot happen. Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonkrpc.c Wed Dec 11 00:17:13 2013 (r259206) +++ stable/10/sys/fs/nfs/nfs_commonkrpc.c Wed Dec 11 00:39:56 2013 (r259207) @@ -336,24 +336,25 @@ newnfs_connect(struct nfsmount *nmp, str mtx_lock(&nrp->nr_mtx); if (nrp->nr_client != NULL) { + mtx_unlock(&nrp->nr_mtx); /* * Someone else already connected. */ CLNT_RELEASE(client); } else { nrp->nr_client = client; + /* + * Protocols that do not require connections may be optionally + * left unconnected for servers that reply from a port other + * than NFS_PORT. + */ + if (nmp == NULL || (nmp->nm_flag & NFSMNT_NOCONN) == 0) { + mtx_unlock(&nrp->nr_mtx); + CLNT_CONTROL(client, CLSET_CONNECT, &one); + } else + mtx_unlock(&nrp->nr_mtx); } - /* - * Protocols that do not require connections may be optionally left - * unconnected for servers that reply from a port other than NFS_PORT. - */ - if (nmp == NULL || (nmp->nm_flag & NFSMNT_NOCONN) == 0) { - mtx_unlock(&nrp->nr_mtx); - CLNT_CONTROL(client, CLSET_CONNECT, &one); - } else { - mtx_unlock(&nrp->nr_mtx); - } /* Restore current thread's credentials. */ td->td_ucred = origcred; From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 07:34:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7995A7A; Wed, 11 Dec 2013 07:34:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A2A4112D6; Wed, 11 Dec 2013 07:34:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBB7YYYd051119; Wed, 11 Dec 2013 07:34:34 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBB7YYsh051118; Wed, 11 Dec 2013 07:34:34 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312110734.rBB7YYsh051118@svn.freebsd.org> From: Dimitry Andric Date: Wed, 11 Dec 2013 07:34:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259214 - in stable: 10/contrib/llvm/tools/clang/lib/CodeGen 9/contrib/llvm/tools/clang/lib/CodeGen X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 07:34:34 -0000 Author: dim Date: Wed Dec 11 07:34:34 2013 New Revision: 259214 URL: http://svnweb.freebsd.org/changeset/base/259214 Log: MFC r259100: Pull in r196658 from upstream clang trunk: CodeGen: Don't emit linkage on thunks that aren't emitted because they're vararg. This can happen when we're trying to emit a thunk with available_externally linkage with optimization enabled but bail because it doesn't make sense for vararg functions. [LLVM] PR18098. This should fix clang "Broken module found, compilation aborted" errors when building the qt4-based dvbcut port. Reported by: se Modified: stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp Directory Properties: stable/10/ (props changed) Modified: stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp Wed Dec 11 06:28:44 2013 (r259213) +++ stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp Wed Dec 11 07:34:34 2013 (r259214) @@ -454,10 +454,9 @@ void CodeGenVTables::EmitThunk(GlobalDec } else { // Normal thunk body generation. CodeGenFunction(CGM).GenerateThunk(ThunkFn, FnInfo, GD, Thunk); + if (UseAvailableExternallyLinkage) + ThunkFn->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); } - - if (UseAvailableExternallyLinkage) - ThunkFn->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); } void CodeGenVTables::MaybeEmitThunkAvailableExternally(GlobalDecl GD, From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 07:34:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1B834A7B; Wed, 11 Dec 2013 07:34:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 03F4412D7; Wed, 11 Dec 2013 07:34:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBB7YYMM051125; Wed, 11 Dec 2013 07:34:34 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBB7YY68051124; Wed, 11 Dec 2013 07:34:34 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312110734.rBB7YY68051124@svn.freebsd.org> From: Dimitry Andric Date: Wed, 11 Dec 2013 07:34:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259214 - in stable: 10/contrib/llvm/tools/clang/lib/CodeGen 9/contrib/llvm/tools/clang/lib/CodeGen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 07:34:35 -0000 Author: dim Date: Wed Dec 11 07:34:34 2013 New Revision: 259214 URL: http://svnweb.freebsd.org/changeset/base/259214 Log: MFC r259100: Pull in r196658 from upstream clang trunk: CodeGen: Don't emit linkage on thunks that aren't emitted because they're vararg. This can happen when we're trying to emit a thunk with available_externally linkage with optimization enabled but bail because it doesn't make sense for vararg functions. [LLVM] PR18098. This should fix clang "Broken module found, compilation aborted" errors when building the qt4-based dvbcut port. Reported by: se Modified: stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Modified: stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp ============================================================================== --- stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp Wed Dec 11 06:28:44 2013 (r259213) +++ stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp Wed Dec 11 07:34:34 2013 (r259214) @@ -454,10 +454,9 @@ void CodeGenVTables::EmitThunk(GlobalDec } else { // Normal thunk body generation. CodeGenFunction(CGM).GenerateThunk(ThunkFn, FnInfo, GD, Thunk); + if (UseAvailableExternallyLinkage) + ThunkFn->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); } - - if (UseAvailableExternallyLinkage) - ThunkFn->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); } void CodeGenVTables::MaybeEmitThunkAvailableExternally(GlobalDecl GD, From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 07:43:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 495ABF8A; Wed, 11 Dec 2013 07:43:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1B05113AB; Wed, 11 Dec 2013 07:43:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBB7hUI1054571; Wed, 11 Dec 2013 07:43:30 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBB7hU64054570; Wed, 11 Dec 2013 07:43:30 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312110743.rBB7hU64054570@svn.freebsd.org> From: Dimitry Andric Date: Wed, 11 Dec 2013 07:43:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259216 - in stable: 10/contrib/gcc/config/i386 9/contrib/gcc/config/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 07:43:31 -0000 Author: dim Date: Wed Dec 11 07:43:30 2013 New Revision: 259216 URL: http://svnweb.freebsd.org/changeset/base/259216 Log: MFC r259111: Use correct casts in gcc's emmintrin.h for the first arguments of the following builtin functions: * __builtin_ia32_pslldi128() takes __v4si instead of __v8hi * __builtin_ia32_psllqi128() takes __v2di instead of __v8hi * __builtin_ia32_psradi128() takes __v4si instead of __v8hi This should fix the following errors when building the LINT kernel with gcc: sys/crypto/aesni/aesni_wrap.c:191: error: incompatible type for argument 1 of '__builtin_ia32_psradi128' sys/crypto/aesni/aesni_wrap.c:195: error: incompatible type for argument 1 of '__builtin_ia32_pslldi128' Modified: stable/9/contrib/gcc/config/i386/emmintrin.h Directory Properties: stable/9/contrib/gcc/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/gcc/config/i386/emmintrin.h Directory Properties: stable/10/ (props changed) Modified: stable/9/contrib/gcc/config/i386/emmintrin.h ============================================================================== --- stable/9/contrib/gcc/config/i386/emmintrin.h Wed Dec 11 07:41:28 2013 (r259215) +++ stable/9/contrib/gcc/config/i386/emmintrin.h Wed Dec 11 07:43:30 2013 (r259216) @@ -1126,9 +1126,9 @@ _mm_slli_epi64 (__m128i __A, int __B) #define _mm_slli_epi16(__A, __B) \ ((__m128i)__builtin_ia32_psllwi128 ((__v8hi)(__A), __B)) #define _mm_slli_epi32(__A, __B) \ - ((__m128i)__builtin_ia32_pslldi128 ((__v8hi)(__A), __B)) + ((__m128i)__builtin_ia32_pslldi128 ((__v4si)(__A), __B)) #define _mm_slli_epi64(__A, __B) \ - ((__m128i)__builtin_ia32_psllqi128 ((__v8hi)(__A), __B)) + ((__m128i)__builtin_ia32_psllqi128 ((__v2di)(__A), __B)) #endif #if 0 @@ -1147,7 +1147,7 @@ _mm_srai_epi32 (__m128i __A, int __B) #define _mm_srai_epi16(__A, __B) \ ((__m128i)__builtin_ia32_psrawi128 ((__v8hi)(__A), __B)) #define _mm_srai_epi32(__A, __B) \ - ((__m128i)__builtin_ia32_psradi128 ((__v8hi)(__A), __B)) + ((__m128i)__builtin_ia32_psradi128 ((__v4si)(__A), __B)) #endif #if 0 From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 07:43:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9D8D0F8B; Wed, 11 Dec 2013 07:43:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6EDB013AC; Wed, 11 Dec 2013 07:43:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBB7hVRp054577; Wed, 11 Dec 2013 07:43:31 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBB7hVqf054576; Wed, 11 Dec 2013 07:43:31 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312110743.rBB7hVqf054576@svn.freebsd.org> From: Dimitry Andric Date: Wed, 11 Dec 2013 07:43:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259216 - in stable: 10/contrib/gcc/config/i386 9/contrib/gcc/config/i386 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 07:43:31 -0000 Author: dim Date: Wed Dec 11 07:43:30 2013 New Revision: 259216 URL: http://svnweb.freebsd.org/changeset/base/259216 Log: MFC r259111: Use correct casts in gcc's emmintrin.h for the first arguments of the following builtin functions: * __builtin_ia32_pslldi128() takes __v4si instead of __v8hi * __builtin_ia32_psllqi128() takes __v2di instead of __v8hi * __builtin_ia32_psradi128() takes __v4si instead of __v8hi This should fix the following errors when building the LINT kernel with gcc: sys/crypto/aesni/aesni_wrap.c:191: error: incompatible type for argument 1 of '__builtin_ia32_psradi128' sys/crypto/aesni/aesni_wrap.c:195: error: incompatible type for argument 1 of '__builtin_ia32_pslldi128' Modified: stable/10/contrib/gcc/config/i386/emmintrin.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/contrib/gcc/config/i386/emmintrin.h Directory Properties: stable/9/contrib/gcc/ (props changed) Modified: stable/10/contrib/gcc/config/i386/emmintrin.h ============================================================================== --- stable/10/contrib/gcc/config/i386/emmintrin.h Wed Dec 11 07:41:28 2013 (r259215) +++ stable/10/contrib/gcc/config/i386/emmintrin.h Wed Dec 11 07:43:30 2013 (r259216) @@ -1126,9 +1126,9 @@ _mm_slli_epi64 (__m128i __A, int __B) #define _mm_slli_epi16(__A, __B) \ ((__m128i)__builtin_ia32_psllwi128 ((__v8hi)(__A), __B)) #define _mm_slli_epi32(__A, __B) \ - ((__m128i)__builtin_ia32_pslldi128 ((__v8hi)(__A), __B)) + ((__m128i)__builtin_ia32_pslldi128 ((__v4si)(__A), __B)) #define _mm_slli_epi64(__A, __B) \ - ((__m128i)__builtin_ia32_psllqi128 ((__v8hi)(__A), __B)) + ((__m128i)__builtin_ia32_psllqi128 ((__v2di)(__A), __B)) #endif #if 0 @@ -1147,7 +1147,7 @@ _mm_srai_epi32 (__m128i __A, int __B) #define _mm_srai_epi16(__A, __B) \ ((__m128i)__builtin_ia32_psrawi128 ((__v8hi)(__A), __B)) #define _mm_srai_epi32(__A, __B) \ - ((__m128i)__builtin_ia32_psradi128 ((__v8hi)(__A), __B)) + ((__m128i)__builtin_ia32_psradi128 ((__v4si)(__A), __B)) #endif #if 0 From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 19:25:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5ECF4E37; Wed, 11 Dec 2013 19:25:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3EF931F6C; Wed, 11 Dec 2013 19:25:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBJPJOq012557; Wed, 11 Dec 2013 19:25:19 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBJPI4S012549; Wed, 11 Dec 2013 19:25:18 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312111925.rBBJPI4S012549@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 11 Dec 2013 19:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259223 - in stable/10: sbin/fsck_ffs sbin/growfs sys/fs/ext2fs sys/ufs/ffs sys/ufs/ufs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 19:25:19 -0000 Author: pfg Date: Wed Dec 11 19:25:17 2013 New Revision: 259223 URL: http://svnweb.freebsd.org/changeset/base/259223 Log: MFC r256448, r257029; Make di_blocks unsigned in UFS1 as is the case already for UFS2. Most of the code between UFS1 and UFS2 is shared so this change is pretty safe. Not only this makes UFS1 and 2 consistent but it also matches what NetBSD and MacOS X have for some years now. UFS2: make di_extsize unsigned. di_extsize is the EA size and as such it should be unsigned. Adjust related types for consistency. Reviewed by: mckusick Modified: stable/10/sbin/fsck_ffs/ea.c stable/10/sbin/growfs/debug.c stable/10/sys/fs/ext2fs/ext2_vnops.c stable/10/sys/ufs/ffs/ffs_vnops.c stable/10/sys/ufs/ufs/dinode.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_ffs/ea.c ============================================================================== --- stable/10/sbin/fsck_ffs/ea.c Wed Dec 11 17:40:35 2013 (r259222) +++ stable/10/sbin/fsck_ffs/ea.c Wed Dec 11 19:25:17 2013 (r259223) @@ -65,7 +65,7 @@ eascan(struct inodesc *idesc, struct ufs char dbuf[DIRBLKSIZ]; printf("Inode %ju extsize %ju\n", - (intmax_t)idesc->id_number, (intmax_t)dp->di_extsize); + (intmax_t)idesc->id_number, (uintmax_t)dp->di_extsize); if (dp->di_extsize == 0) return 0; if (dp->di_extsize <= sblock.fs_fsize) Modified: stable/10/sbin/growfs/debug.c ============================================================================== --- stable/10/sbin/growfs/debug.c Wed Dec 11 17:40:35 2013 (r259222) +++ stable/10/sbin/growfs/debug.c Wed Dec 11 19:25:17 2013 (r259223) @@ -765,7 +765,7 @@ dbg_dump_ufs2_ino(struct fs *sb, const c fprintf(dbg_log, "gen int32_t 0x%08x\n", ino->di_gen); fprintf(dbg_log, "kernflags u_int32_t 0x%08x\n", ino->di_kernflags); fprintf(dbg_log, "flags u_int32_t 0x%08x\n", ino->di_flags); - fprintf(dbg_log, "extsize int32_t 0x%08x\n", ino->di_extsize); + fprintf(dbg_log, "extsize u_int32_t 0x%08x\n", ino->di_extsize); /* XXX: What do we do with di_extb[NXADDR]? */ Modified: stable/10/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_vnops.c Wed Dec 11 17:40:35 2013 (r259222) +++ stable/10/sys/fs/ext2fs/ext2_vnops.c Wed Dec 11 19:25:17 2013 (r259223) @@ -1689,7 +1689,7 @@ ext2_ind_read(struct vop_read_args *ap) NOCRED, blkoffset + uio->uio_resid, seqcount, 0, &bp); } else if (seqcount > 1) { - int nextsize = blksize(fs, ip, nextlbn); + u_int nextsize = blksize(fs, ip, nextlbn); error = breadn(vp, lbn, size, &nextlbn, &nextsize, 1, NOCRED, &bp); } else Modified: stable/10/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_vnops.c Wed Dec 11 17:40:35 2013 (r259222) +++ stable/10/sys/ufs/ffs/ffs_vnops.c Wed Dec 11 19:25:17 2013 (r259223) @@ -531,7 +531,7 @@ ffs_read(ap) * arguments point to arrays of the size specified in * the 6th argument. */ - int nextsize = blksize(fs, ip, nextlbn); + u_int nextsize = blksize(fs, ip, nextlbn); error = breadn_flags(vp, lbn, size, &nextlbn, &nextsize, 1, NOCRED, GB_UNMAPPED, &bp); } else { @@ -956,7 +956,7 @@ ffs_extread(struct vnode *vp, struct uio * arguments point to arrays of the size specified in * the 6th argument. */ - int nextsize = sblksize(fs, dp->di_extsize, nextlbn); + u_int nextsize = sblksize(fs, dp->di_extsize, nextlbn); nextlbn = -1 - nextlbn; error = breadn(vp, -1 - lbn, @@ -1218,7 +1218,8 @@ ffs_rdextattr(u_char **p, struct vnode * struct fs *fs; struct uio luio; struct iovec liovec; - int easize, error; + u_int easize; + int error; u_char *eae; ip = VTOI(vp); Modified: stable/10/sys/ufs/ufs/dinode.h ============================================================================== --- stable/10/sys/ufs/ufs/dinode.h Wed Dec 11 17:40:35 2013 (r259222) +++ stable/10/sys/ufs/ufs/dinode.h Wed Dec 11 19:25:17 2013 (r259223) @@ -141,7 +141,7 @@ struct ufs2_dinode { u_int32_t di_gen; /* 80: Generation number. */ u_int32_t di_kernflags; /* 84: Kernel flags. */ u_int32_t di_flags; /* 88: Status flags (chflags). */ - int32_t di_extsize; /* 92: External attributes block. */ + u_int32_t di_extsize; /* 92: External attributes size. */ ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */ ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */ ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */ @@ -179,7 +179,7 @@ struct ufs1_dinode { ufs1_daddr_t di_db[NDADDR]; /* 40: Direct disk blocks. */ ufs1_daddr_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */ u_int32_t di_flags; /* 100: Status flags (chflags). */ - int32_t di_blocks; /* 104: Blocks actually held. */ + u_int32_t di_blocks; /* 104: Blocks actually held. */ u_int32_t di_gen; /* 108: Generation number. */ u_int32_t di_uid; /* 112: File owner. */ u_int32_t di_gid; /* 116: File group. */ From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 19:25:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8026EF6D; Wed, 11 Dec 2013 19:25:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 603CC1F74; Wed, 11 Dec 2013 19:25:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBJPeOM012628; Wed, 11 Dec 2013 19:25:40 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBJPd0m012620; Wed, 11 Dec 2013 19:25:39 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312111925.rBBJPd0m012620@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 11 Dec 2013 19:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259224 - in stable/9: sbin/fsck_ffs sbin/growfs sys/fs/ext2fs sys/ufs/ffs sys/ufs/ufs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 19:25:40 -0000 Author: pfg Date: Wed Dec 11 19:25:38 2013 New Revision: 259224 URL: http://svnweb.freebsd.org/changeset/base/259224 Log: MFC r256448, r257029; Make di_blocks unsigned in UFS1 as is the case already for UFS2. Most of the code between UFS1 and UFS2 is shared so this change is pretty safe. Not only this makes UFS1 and 2 consistent but it also matches what NetBSD and MacOS X have for some years now. UFS2: make di_extsize unsigned. di_extsize is the EA size and as such it should be unsigned. Adjust related types for consistency. Reviewed by: mckusick Modified: stable/9/sbin/fsck_ffs/ea.c stable/9/sbin/growfs/debug.c stable/9/sys/fs/ext2fs/ext2_vnops.c stable/9/sys/ufs/ffs/ffs_vnops.c stable/9/sys/ufs/ufs/dinode.h Directory Properties: stable/9/ (props changed) stable/9/sbin/ (props changed) stable/9/sbin/fsck_ffs/ (props changed) stable/9/sbin/growfs/ (props changed) stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sbin/fsck_ffs/ea.c ============================================================================== --- stable/9/sbin/fsck_ffs/ea.c Wed Dec 11 19:25:17 2013 (r259223) +++ stable/9/sbin/fsck_ffs/ea.c Wed Dec 11 19:25:38 2013 (r259224) @@ -65,7 +65,7 @@ eascan(struct inodesc *idesc, struct ufs char dbuf[DIRBLKSIZ]; printf("Inode %ju extsize %ju\n", - (intmax_t)idesc->id_number, (intmax_t)dp->di_extsize); + (intmax_t)idesc->id_number, (uintmax_t)dp->di_extsize); if (dp->di_extsize == 0) return 0; if (dp->di_extsize <= sblock.fs_fsize) Modified: stable/9/sbin/growfs/debug.c ============================================================================== --- stable/9/sbin/growfs/debug.c Wed Dec 11 19:25:17 2013 (r259223) +++ stable/9/sbin/growfs/debug.c Wed Dec 11 19:25:38 2013 (r259224) @@ -765,7 +765,7 @@ dbg_dump_ufs2_ino(struct fs *sb, const c fprintf(dbg_log, "gen int32_t 0x%08x\n", ino->di_gen); fprintf(dbg_log, "kernflags u_int32_t 0x%08x\n", ino->di_kernflags); fprintf(dbg_log, "flags u_int32_t 0x%08x\n", ino->di_flags); - fprintf(dbg_log, "extsize int32_t 0x%08x\n", ino->di_extsize); + fprintf(dbg_log, "extsize u_int32_t 0x%08x\n", ino->di_extsize); /* XXX: What do we do with di_extb[NXADDR]? */ Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vnops.c Wed Dec 11 19:25:17 2013 (r259223) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Wed Dec 11 19:25:38 2013 (r259224) @@ -1694,7 +1694,7 @@ ext2_ind_read(struct vop_read_args *ap) error = cluster_read(vp, ip->i_size, lbn, size, NOCRED, blkoffset + uio->uio_resid, seqcount, &bp); else if (seqcount > 1) { - int nextsize = blksize(fs, ip, nextlbn); + u_int nextsize = blksize(fs, ip, nextlbn); error = breadn(vp, lbn, size, &nextlbn, &nextsize, 1, NOCRED, &bp); } else Modified: stable/9/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vnops.c Wed Dec 11 19:25:17 2013 (r259223) +++ stable/9/sys/ufs/ffs/ffs_vnops.c Wed Dec 11 19:25:38 2013 (r259224) @@ -530,7 +530,7 @@ ffs_read(ap) * arguments point to arrays of the size specified in * the 6th argument. */ - int nextsize = blksize(fs, ip, nextlbn); + u_int nextsize = blksize(fs, ip, nextlbn); error = breadn_flags(vp, lbn, size, &nextlbn, &nextsize, 1, NOCRED, GB_UNMAPPED, &bp); } else { @@ -956,7 +956,7 @@ ffs_extread(struct vnode *vp, struct uio * arguments point to arrays of the size specified in * the 6th argument. */ - int nextsize = sblksize(fs, dp->di_extsize, nextlbn); + u_int nextsize = sblksize(fs, dp->di_extsize, nextlbn); nextlbn = -1 - nextlbn; error = breadn(vp, -1 - lbn, @@ -1218,7 +1218,8 @@ ffs_rdextattr(u_char **p, struct vnode * struct fs *fs; struct uio luio; struct iovec liovec; - int easize, error; + u_int easize; + int error; u_char *eae; ip = VTOI(vp); Modified: stable/9/sys/ufs/ufs/dinode.h ============================================================================== --- stable/9/sys/ufs/ufs/dinode.h Wed Dec 11 19:25:17 2013 (r259223) +++ stable/9/sys/ufs/ufs/dinode.h Wed Dec 11 19:25:38 2013 (r259224) @@ -141,7 +141,7 @@ struct ufs2_dinode { u_int32_t di_gen; /* 80: Generation number. */ u_int32_t di_kernflags; /* 84: Kernel flags. */ u_int32_t di_flags; /* 88: Status flags (chflags). */ - int32_t di_extsize; /* 92: External attributes block. */ + u_int32_t di_extsize; /* 92: External attributes size. */ ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */ ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */ ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */ @@ -179,7 +179,7 @@ struct ufs1_dinode { ufs1_daddr_t di_db[NDADDR]; /* 40: Direct disk blocks. */ ufs1_daddr_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */ u_int32_t di_flags; /* 100: Status flags (chflags). */ - int32_t di_blocks; /* 104: Blocks actually held. */ + u_int32_t di_blocks; /* 104: Blocks actually held. */ u_int32_t di_gen; /* 108: Generation number. */ u_int32_t di_uid; /* 112: File owner. */ u_int32_t di_gid; /* 116: File group. */ From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 19:26:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9538515B; Wed, 11 Dec 2013 19:26:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 80CD41F8B; Wed, 11 Dec 2013 19:26:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBJQvxv012825; Wed, 11 Dec 2013 19:26:57 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBJQuos012821; Wed, 11 Dec 2013 19:26:56 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312111926.rBBJQuos012821@svn.freebsd.org> From: Glen Barber Date: Wed, 11 Dec 2013 19:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259225 - in stable/10: release share/man/man7 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 19:26:57 -0000 Author: gjb Date: Wed Dec 11 19:26:56 2013 New Revision: 259225 URL: http://svnweb.freebsd.org/changeset/base/259225 Log: MFC r257805, r257806, r257807, r257942: r257805: Add a 'mini-memstick.img' release target, which will use the 'bootonly.iso' components to create a smaller memory stick image. This is useful for system recovery, where a full memstick.img image is not necessarily needed (or wanted). In addition, it is possible to do bootonly-style installation, where the base.txz, kernel.txz, etc. are fetched from a remote source. Provide backwards-compatible target (mini-memstick), to keep in sync with the targets documented in release/Makefile. r257806: Remove extra target from 'memstick' that I forgot to remove before previous commit. r257807: Update release(7) to include 'mini-memstick'. r257942: Fix a few style nits. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile stable/10/release/release.sh stable/10/share/man/man7/release.7 Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Wed Dec 11 19:25:38 2013 (r259224) +++ stable/10/release/Makefile Wed Dec 11 19:26:56 2013 (r259225) @@ -6,6 +6,7 @@ # cdrom: Builds release CD-ROM media (disc1.iso) # dvdrom: Builds release DVD-ROM media (dvd1.iso) # memstick: Builds memory stick image (memstick.img) +# mini-memstick: Builds minimal memory stick image (mini-memstick.img) # ftp: Sets up FTP distribution area (ftp) # release: Build all media and FTP distribution area # install: Copies all release media into ${DESTDIR} @@ -84,7 +85,9 @@ IMAGES+= dvd1.iso .endif .if exists(${.CURDIR}/${TARGET}/make-memstick.sh) RELEASE_TARGETS+= memstick.img +RELEASE_TARGETS+= mini-memstick.img IMAGES+= memstick.img +IMAGES+= mini-memstick.img .endif CLEANFILES= packagesystem *.txz MANIFEST system ${IMAGES} @@ -208,6 +211,10 @@ memstick: memstick.img memstick.img: system sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET} +mini-memstick: mini-memstick.img +mini-memstick.img: system + sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET} + packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST touch ${.TARGET} Modified: stable/10/release/release.sh ============================================================================== --- stable/10/release/release.sh Wed Dec 11 19:25:38 2013 (r259224) +++ stable/10/release/release.sh Wed Dec 11 19:26:56 2013 (r259225) @@ -111,10 +111,10 @@ fi # instead of their values. DOCPORTS= if [ "x${NOPORTS}" != "x" ]; then - DOCPORTS="NOPORTS=yes " + DOCPORTS="NOPORTS=yes " fi if [ "x${NODOC}" != "x" ]; then - DOCPORTS="${DOCPORTS}NODOC=yes" + DOCPORTS="${DOCPORTS}NODOC=yes" fi # The aggregated build-time flags based upon variables defined within @@ -137,7 +137,7 @@ RELEASE_RMAKEFLAGS="${ARCH_FLAGS} KERNCO # Force src checkout if configured FORCE_SRC_KEY= if [ "x${SRC_FORCE_CHECKOUT}" != "x" ]; then - FORCE_SRC_KEY="--force" + FORCE_SRC_KEY="--force" fi if [ ! ${CHROOTDIR} ]; then Modified: stable/10/share/man/man7/release.7 ============================================================================== --- stable/10/share/man/man7/release.7 Wed Dec 11 19:25:38 2013 (r259224) +++ stable/10/share/man/man7/release.7 Wed Dec 11 19:26:56 2013 (r259225) @@ -292,6 +292,11 @@ Requires that the .Pq memory disk device driver be present in the kernel .Pq either by being compiled in or available as a module . +.It Cm mini-memstick +Similar to +.Cm memstick , +with the exception that the installation distribution sets +are not included. .It Cm ftp Creates a directory named .Pa ftp From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 19:30:28 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8590A3BE; Wed, 11 Dec 2013 19:30:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7098F1FB1; Wed, 11 Dec 2013 19:30:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBJUSrQ015482; Wed, 11 Dec 2013 19:30:28 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBJURC4015474; Wed, 11 Dec 2013 19:30:27 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312111930.rBBJURC4015474@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 11 Dec 2013 19:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259226 - in stable/8: sbin/fsck_ffs sbin/growfs sys/ufs/ffs sys/ufs/ufs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 19:30:28 -0000 Author: pfg Date: Wed Dec 11 19:30:27 2013 New Revision: 259226 URL: http://svnweb.freebsd.org/changeset/base/259226 Log: MFC r256448, r257029; Make di_blocks unsigned in UFS1 as is the case already for UFS2. Most of the code between UFS1 and UFS2 is shared so this change is pretty safe. Not only this makes UFS1 and 2 consistent but it also matches what NetBSD and MacOS X have for some years now. UFS2: make di_extsize unsigned. di_extsize is the EA size and as such it should be unsigned. Adjust related types for consistency. Reviewed by: mckusick Modified: stable/8/sbin/fsck_ffs/ea.c stable/8/sbin/growfs/debug.c stable/8/sys/ufs/ffs/ffs_vnops.c stable/8/sys/ufs/ufs/dinode.h Directory Properties: stable/8/ (props changed) stable/8/sbin/ (props changed) stable/8/sbin/fsck_ffs/ (props changed) stable/8/sbin/growfs/ (props changed) stable/8/sys/ (props changed) stable/8/sys/fs/ (props changed) stable/8/sys/ufs/ (props changed) Modified: stable/8/sbin/fsck_ffs/ea.c ============================================================================== --- stable/8/sbin/fsck_ffs/ea.c Wed Dec 11 19:26:56 2013 (r259225) +++ stable/8/sbin/fsck_ffs/ea.c Wed Dec 11 19:30:27 2013 (r259226) @@ -65,7 +65,7 @@ eascan(struct inodesc *idesc, struct ufs char dbuf[DIRBLKSIZ]; printf("Inode %ju extsize %ju\n", - (intmax_t)idesc->id_number, (intmax_t)dp->di_extsize); + (intmax_t)idesc->id_number, (uintmax_t)dp->di_extsize); if (dp->di_extsize == 0) return 0; if (dp->di_extsize <= sblock.fs_fsize) Modified: stable/8/sbin/growfs/debug.c ============================================================================== --- stable/8/sbin/growfs/debug.c Wed Dec 11 19:26:56 2013 (r259225) +++ stable/8/sbin/growfs/debug.c Wed Dec 11 19:30:27 2013 (r259226) @@ -798,7 +798,7 @@ dbg_dump_ufs2_ino(struct fs *sb, const c fprintf(dbg_log, "gen int32_t 0x%08x\n", ino->di_gen); fprintf(dbg_log, "kernflags u_int32_t 0x%08x\n", ino->di_kernflags); fprintf(dbg_log, "flags u_int32_t 0x%08x\n", ino->di_flags); - fprintf(dbg_log, "extsize int32_t 0x%08x\n", ino->di_extsize); + fprintf(dbg_log, "extsize u_int32_t 0x%08x\n", ino->di_extsize); /* XXX: What do we do with di_extb[NXADDR]? */ Modified: stable/8/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_vnops.c Wed Dec 11 19:26:56 2013 (r259225) +++ stable/8/sys/ufs/ffs/ffs_vnops.c Wed Dec 11 19:30:27 2013 (r259226) @@ -539,7 +539,7 @@ ffs_read(ap) * arguments point to arrays of the size specified in * the 6th argument. */ - int nextsize = blksize(fs, ip, nextlbn); + u_int nextsize = blksize(fs, ip, nextlbn); error = breadn(vp, lbn, size, &nextlbn, &nextsize, 1, NOCRED, &bp); } else { @@ -938,7 +938,7 @@ ffs_extread(struct vnode *vp, struct uio * arguments point to arrays of the size specified in * the 6th argument. */ - int nextsize = sblksize(fs, dp->di_extsize, nextlbn); + u_int nextsize = sblksize(fs, dp->di_extsize, nextlbn); nextlbn = -1 - nextlbn; error = breadn(vp, -1 - lbn, @@ -1201,7 +1201,8 @@ ffs_rdextattr(u_char **p, struct vnode * struct fs *fs; struct uio luio; struct iovec liovec; - int easize, error; + u_int easize; + int error; u_char *eae; ip = VTOI(vp); Modified: stable/8/sys/ufs/ufs/dinode.h ============================================================================== --- stable/8/sys/ufs/ufs/dinode.h Wed Dec 11 19:26:56 2013 (r259225) +++ stable/8/sys/ufs/ufs/dinode.h Wed Dec 11 19:30:27 2013 (r259226) @@ -141,7 +141,7 @@ struct ufs2_dinode { int32_t di_gen; /* 80: Generation number. */ u_int32_t di_kernflags; /* 84: Kernel flags. */ u_int32_t di_flags; /* 88: Status flags (chflags). */ - int32_t di_extsize; /* 92: External attributes block. */ + u_int32_t di_extsize; /* 92: External attributes size. */ ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */ ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */ ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */ @@ -180,7 +180,7 @@ struct ufs1_dinode { ufs1_daddr_t di_db[NDADDR]; /* 40: Direct disk blocks. */ ufs1_daddr_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */ u_int32_t di_flags; /* 100: Status flags (chflags). */ - int32_t di_blocks; /* 104: Blocks actually held. */ + u_int32_t di_blocks; /* 104: Blocks actually held. */ int32_t di_gen; /* 108: Generation number. */ u_int32_t di_uid; /* 112: File owner. */ u_int32_t di_gid; /* 116: File group. */ From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 20:56:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1DBFE9C5; Wed, 11 Dec 2013 20:56:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 098E116E6; Wed, 11 Dec 2013 20:56:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBKuNr6047468; Wed, 11 Dec 2013 20:56:23 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBKuNJo047467; Wed, 11 Dec 2013 20:56:23 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312112056.rBBKuNJo047467@svn.freebsd.org> From: Andreas Tobler Date: Wed, 11 Dec 2013 20:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259227 - stable/10/sys/powerpc/pseries X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 20:56:24 -0000 Author: andreast Date: Wed Dec 11 20:56:23 2013 New Revision: 259227 URL: http://svnweb.freebsd.org/changeset/base/259227 Log: MFC r258503 Limit the large page size to 16MB for now. Modified: stable/10/sys/powerpc/pseries/mmu_phyp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/pseries/mmu_phyp.c ============================================================================== --- stable/10/sys/powerpc/pseries/mmu_phyp.c Wed Dec 11 19:30:27 2013 (r259226) +++ stable/10/sys/powerpc/pseries/mmu_phyp.c Wed Dec 11 20:56:23 2013 (r259227) @@ -165,6 +165,11 @@ mphyp_bootstrap(mmu_t mmup, vm_offset_t nptlp--; } } + + /* For now we allow shift only to be <= 0x18. */ + if (shift >= 0x18) + shift = 0x18; + moea64_large_page_shift = shift; moea64_large_page_size = 1 << shift; } From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 21:37:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D89089BB; Wed, 11 Dec 2013 21:37:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A9A571A76; Wed, 11 Dec 2013 21:37:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBLbWOI062394; Wed, 11 Dec 2013 21:37:32 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBLbW7S062393; Wed, 11 Dec 2013 21:37:32 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312112137.rBBLbW7S062393@svn.freebsd.org> From: Andreas Tobler Date: Wed, 11 Dec 2013 21:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259230 - stable/10/sys/powerpc/pseries X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 21:37:32 -0000 Author: andreast Date: Wed Dec 11 21:37:32 2013 New Revision: 259230 URL: http://svnweb.freebsd.org/changeset/base/259230 Log: MFC r258615 Take care to handle the full 16 byte buffer in the get/put routines. Also, skip the VTERM header once when receiving data from the hypervisor call when we have a HVTERMPROT connection. Modified: stable/10/sys/powerpc/pseries/phyp_console.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/pseries/phyp_console.c ============================================================================== --- stable/10/sys/powerpc/pseries/phyp_console.c Wed Dec 11 21:21:03 2013 (r259229) +++ stable/10/sys/powerpc/pseries/phyp_console.c Wed Dec 11 21:37:32 2013 (r259230) @@ -286,6 +286,7 @@ static int uart_phyp_get(struct uart_phyp_softc *sc, void *buffer, size_t bufsize) { int err; + int hdr = 0; uart_lock(&sc->sc_mtx); if (sc->inbuflen == 0) { @@ -296,6 +297,7 @@ uart_phyp_get(struct uart_phyp_softc *sc uart_unlock(&sc->sc_mtx); return (-1); } + hdr = 1; } if (sc->inbuflen == 0) { @@ -305,6 +307,14 @@ uart_phyp_get(struct uart_phyp_softc *sc if (bufsize > sc->inbuflen) bufsize = sc->inbuflen; + + if ((sc->protocol == HVTERMPROT) && (hdr == 1)) { + sc->inbuflen = sc->inbuflen - 4; + /* The VTERM protocol has a 4 byte header, skip it here. */ + memmove(&sc->phyp_inbuf.str[0], &sc->phyp_inbuf.str[4], + sc->inbuflen); + } + memcpy(buffer, sc->phyp_inbuf.str, bufsize); sc->inbuflen -= bufsize; if (sc->inbuflen > 0) @@ -320,32 +330,40 @@ uart_phyp_put(struct uart_phyp_softc *sc { uint16_t seqno; uint64_t len = 0; + int err; + union { - uint64_t u64; - char bytes[8]; + uint64_t u64[2]; + char bytes[16]; } cbuf; uart_lock(&sc->sc_mtx); switch (sc->protocol) { case HVTERM1: - if (bufsize > 8) - bufsize = 8; + if (bufsize > 16) + bufsize = 16; memcpy(&cbuf, buffer, bufsize); len = bufsize; break; case HVTERMPROT: - if (bufsize > 4) - bufsize = 4; + if (bufsize > 12) + bufsize = 12; seqno = sc->outseqno++; cbuf.bytes[0] = VS_DATA_PACKET_HEADER; - cbuf.bytes[1] = 4 + bufsize; /* total length */ + cbuf.bytes[1] = 4 + bufsize; /* total length, max 16 bytes */ cbuf.bytes[2] = (seqno >> 8) & 0xff; cbuf.bytes[3] = seqno & 0xff; memcpy(&cbuf.bytes[4], buffer, bufsize); len = 4 + bufsize; break; } - phyp_hcall(H_PUT_TERM_CHAR, sc->vtermid, len, cbuf.u64, 0); + + do { + err = phyp_hcall(H_PUT_TERM_CHAR, sc->vtermid, len, cbuf.u64[0], + cbuf.u64[1]); + DELAY(100); + } while (err == H_BUSY); + uart_unlock(&sc->sc_mtx); return (bufsize); From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 21:41:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 99753B33; Wed, 11 Dec 2013 21:41:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 852A21AD3; Wed, 11 Dec 2013 21:41:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBLfLV8065190; Wed, 11 Dec 2013 21:41:21 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBLfLOT065189; Wed, 11 Dec 2013 21:41:21 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312112141.rBBLfLOT065189@svn.freebsd.org> From: Andreas Tobler Date: Wed, 11 Dec 2013 21:41:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259231 - stable/10/sys/powerpc/ofw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 21:41:21 -0000 Author: andreast Date: Wed Dec 11 21:41:21 2013 New Revision: 259231 URL: http://svnweb.freebsd.org/changeset/base/259231 Log: MFC r258778 Add a printf to inform about the logical memory block size which is in use by the system. This might give a hint why a pSeries system is not booting. Modified: stable/10/sys/powerpc/ofw/ofw_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- stable/10/sys/powerpc/ofw/ofw_machdep.c Wed Dec 11 21:37:32 2013 (r259230) +++ stable/10/sys/powerpc/ofw/ofw_machdep.c Wed Dec 11 21:41:21 2013 (r259231) @@ -282,6 +282,7 @@ parse_drconf_memory(int *msz, int *asz, res = OF_getprop(phandle, "ibm,lmb-size", lmb_size, sizeof(lmb_size)); if (res == -1) return (0); + printf("Logical Memory Block size: %d MB\n", lmb_size[1] >> 20); /* Parse the /ibm,dynamic-memory. The first position gives the # of entries. The next two words From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 22:00:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2142B9DF; Wed, 11 Dec 2013 22:00:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0D2521D6B; Wed, 11 Dec 2013 22:00:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBM03Or070394; Wed, 11 Dec 2013 22:00:03 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBM03RY070392; Wed, 11 Dec 2013 22:00:03 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312112200.rBBM03RY070392@svn.freebsd.org> From: Andreas Tobler Date: Wed, 11 Dec 2013 22:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259233 - stable/10/sys/powerpc/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 22:00:04 -0000 Author: andreast Date: Wed Dec 11 22:00:03 2013 New Revision: 259233 URL: http://svnweb.freebsd.org/changeset/base/259233 Log: MFC r259007 Increase PHYS_AVAIL_SZ because on pSeries machines we can have many logical regions which represent the total amount of memory. The size of these regions is not the physical size of the chip but it is a logical one and it is given by the OpenFirmware, it is selectable at boot time and varies between 16MB and 256MB in my case. There is an 'automatic' option which would select the size as 64MB in case you have around 16GB of RAM. To make sure we can allocate RAM with the automatic option bump this value of PHYS_AVAIL_SZ to 256. Modified: stable/10/sys/powerpc/include/pmap.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/include/pmap.h ============================================================================== --- stable/10/sys/powerpc/include/pmap.h Wed Dec 11 21:48:04 2013 (r259232) +++ stable/10/sys/powerpc/include/pmap.h Wed Dec 11 22:00:03 2013 (r259233) @@ -240,7 +240,11 @@ boolean_t pmap_mmu_install(char *name, i #define vtophys(va) pmap_kextract((vm_offset_t)(va)) -#define PHYS_AVAIL_SZ 128 +#define PHYS_AVAIL_SZ 256 /* Allows up to 16GB Ram on pSeries with + * logical memory block size of 64MB. + * For more Ram increase the lmb or this value. + */ + extern vm_offset_t phys_avail[PHYS_AVAIL_SZ]; extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 22:26:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D85D166; Wed, 11 Dec 2013 22:26:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 586821F29; Wed, 11 Dec 2013 22:26:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBMQArf081057; Wed, 11 Dec 2013 22:26:10 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBMQAtG081056; Wed, 11 Dec 2013 22:26:10 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201312112226.rBBMQAtG081056@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Wed, 11 Dec 2013 22:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259234 - stable/10/sys/dev/drm2/radeon X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 22:26:10 -0000 Author: dumbbell Date: Wed Dec 11 22:26:09 2013 New Revision: 259234 URL: http://svnweb.freebsd.org/changeset/base/259234 Log: MFC r259101: drm/radeon: agp_info->ai_aperture_size is in bytes, not Mbytes This fixes radeon_agp_init() and gtt_size is now correct. However, this is not enough to make Radeon AGP cards work: ttm_agp_backend.c isn't implemented yet. Submitted by: tijl@ Modified: stable/10/sys/dev/drm2/radeon/radeon_agp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm2/radeon/radeon_agp.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_agp.c Wed Dec 11 22:00:03 2013 (r259233) +++ stable/10/sys/dev/drm2/radeon/radeon_agp.c Wed Dec 11 22:26:09 2013 (r259234) @@ -153,11 +153,11 @@ int radeon_agp_init(struct radeon_device return ret; } - if (rdev->ddev->agp->info.ai_aperture_size < 32) { + if ((rdev->ddev->agp->info.ai_aperture_size >> 20) < 32) { drm_agp_release(rdev->ddev); dev_warn(rdev->dev, "AGP aperture too small (%zuM) " "need at least 32M, disabling AGP\n", - rdev->ddev->agp->info.ai_aperture_size); + rdev->ddev->agp->info.ai_aperture_size >> 20); return -EINVAL; } @@ -246,7 +246,7 @@ int radeon_agp_init(struct radeon_device } rdev->mc.agp_base = rdev->ddev->agp->info.ai_aperture_base; - rdev->mc.gtt_size = rdev->ddev->agp->info.ai_aperture_size << 20; + rdev->mc.gtt_size = rdev->ddev->agp->info.ai_aperture_size; rdev->mc.gtt_start = rdev->mc.agp_base; rdev->mc.gtt_end = rdev->mc.gtt_start + rdev->mc.gtt_size - 1; dev_info(rdev->dev, "GTT: %juM 0x%08jX - 0x%08jX\n", From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 22:36:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B2D953EE; Wed, 11 Dec 2013 22:36:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9C9371FDE; Wed, 11 Dec 2013 22:36:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBMaM4w084721; Wed, 11 Dec 2013 22:36:22 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBMaLcZ084710; Wed, 11 Dec 2013 22:36:21 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312112236.rBBMaLcZ084710@svn.freebsd.org> From: Andreas Tobler Date: Wed, 11 Dec 2013 22:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259235 - in stable/10/sys: conf dev/tsec powerpc/aim powerpc/include powerpc/ofw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 22:36:22 -0000 Author: andreast Date: Wed Dec 11 22:36:20 2013 New Revision: 259235 URL: http://svnweb.freebsd.org/changeset/base/259235 Log: MFC r257991, r257992, 257993, 258504 r257991: Consolidate Apple firmware hacks and improve them by switching on the presence of mac-io devices in the tree, which uniquely identifies Apple hardware. r257992: Allow OF_decode_addr() to also be able to map resources on big-endian devices. To this end, make PCI device detection rely on the device_type field rather than name, as per the standard. r257993: Make tsec work with the device tree present on the RB800. The previous code assumed that the MDIO bus was a direct child of the Ethernet interface. It may not be and indeed on many device trees is not. While here, add proper locking for MII transactions, which may be on a bus shared by several MACs. r258504: Save and restore the trap vectors when doing OF calls on pSeries machines. It turned out that on pSeries machines the call into OF modified the trap vectors and this made further behaviour unpredictable. With this commit I'm now able to boot multi user on a network booted environment on my IntelliStation 285. This is a POWER5+ machine. Modified: stable/10/sys/conf/files.powerpc stable/10/sys/dev/tsec/if_tsec.c stable/10/sys/dev/tsec/if_tsec.h stable/10/sys/dev/tsec/if_tsec_fdt.c stable/10/sys/dev/tsec/if_tsecreg.h stable/10/sys/powerpc/aim/machdep.c stable/10/sys/powerpc/include/ofw_machdep.h stable/10/sys/powerpc/ofw/ofw_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.powerpc ============================================================================== --- stable/10/sys/conf/files.powerpc Wed Dec 11 22:26:09 2013 (r259234) +++ stable/10/sys/conf/files.powerpc Wed Dec 11 22:36:20 2013 (r259235) @@ -140,7 +140,7 @@ powerpc/mpc85xx/mpc85xx.c optional mpc85 powerpc/mpc85xx/nexus.c optional mpc85xx powerpc/mpc85xx/pci_fdt.c optional pci mpc85xx powerpc/ofw/ofw_cpu.c optional aim -powerpc/ofw/ofw_machdep.c optional aim +powerpc/ofw/ofw_machdep.c standard powerpc/ofw/ofw_pci.c optional pci aim powerpc/ofw/ofw_pcibus.c optional pci aim powerpc/ofw/ofw_pcib_pci.c optional pci aim Modified: stable/10/sys/dev/tsec/if_tsec.c ============================================================================== --- stable/10/sys/dev/tsec/if_tsec.c Wed Dec 11 22:26:09 2013 (r259234) +++ stable/10/sys/dev/tsec/if_tsec.c Wed Dec 11 22:36:20 2013 (r259235) @@ -111,6 +111,8 @@ DRIVER_MODULE(miibus, tsec, miibus_drive MODULE_DEPEND(tsec, ether, 1, 1, 1); MODULE_DEPEND(tsec, miibus, 1, 1, 1); +struct mtx tsec_phy_mtx; + int tsec_attach(struct tsec_softc *sc) { @@ -121,6 +123,10 @@ tsec_attach(struct tsec_softc *sc) int error = 0; int i; + /* Initialize global (because potentially shared) MII lock */ + if (!mtx_initialized(&tsec_phy_mtx)) + mtx_init(&tsec_phy_mtx, "tsec mii", NULL, MTX_DEF); + /* Reset all TSEC counters */ TSEC_TX_RX_COUNTERS_INIT(sc); @@ -406,21 +412,24 @@ tsec_init_locked(struct tsec_softc *sc) */ TSEC_WRITE(sc, TSEC_REG_TBIPA, 5); + TSEC_PHY_LOCK(sc); + /* Step 6: Reset the management interface */ - TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_RESETMGMT); + TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_RESETMGMT); /* Step 7: Setup the MII Mgmt clock speed */ - TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_CLKDIV28); + TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_CLKDIV28); /* Step 8: Read MII Mgmt indicator register and check for Busy = 0 */ timeout = TSEC_READ_RETRY; - while (--timeout && (TSEC_READ(sc->phy_sc, TSEC_REG_MIIMIND) & + while (--timeout && (TSEC_PHY_READ(sc, TSEC_REG_MIIMIND) & TSEC_MIIMIND_BUSY)) DELAY(TSEC_READ_DELAY); if (timeout == 0) { if_printf(ifp, "tsec_init_locked(): Mgmt busy timeout\n"); return; } + TSEC_PHY_UNLOCK(sc); /* Step 9: Setup the MII Mgmt */ mii_mediachg(sc->tsec_mii); @@ -1561,22 +1570,27 @@ tsec_miibus_readreg(device_t dev, int ph { struct tsec_softc *sc; uint32_t timeout; + int rv; sc = device_get_softc(dev); - TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMADD, (phy << 8) | reg); - TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCOM, 0); - TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCOM, TSEC_MIIMCOM_READCYCLE); + TSEC_PHY_LOCK(); + TSEC_PHY_WRITE(sc, TSEC_REG_MIIMADD, (phy << 8) | reg); + TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCOM, 0); + TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCOM, TSEC_MIIMCOM_READCYCLE); timeout = TSEC_READ_RETRY; - while (--timeout && TSEC_READ(sc->phy_sc, TSEC_REG_MIIMIND) & + while (--timeout && TSEC_PHY_READ(sc, TSEC_REG_MIIMIND) & (TSEC_MIIMIND_NOTVALID | TSEC_MIIMIND_BUSY)) DELAY(TSEC_READ_DELAY); if (timeout == 0) device_printf(dev, "Timeout while reading from PHY!\n"); - return (TSEC_READ(sc->phy_sc, TSEC_REG_MIIMSTAT)); + rv = TSEC_PHY_READ(sc, TSEC_REG_MIIMSTAT); + TSEC_PHY_UNLOCK(); + + return (rv); } int @@ -1587,13 +1601,15 @@ tsec_miibus_writereg(device_t dev, int p sc = device_get_softc(dev); - TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMADD, (phy << 8) | reg); - TSEC_WRITE(sc->phy_sc, TSEC_REG_MIIMCON, value); + TSEC_PHY_LOCK(); + TSEC_PHY_WRITE(sc, TSEC_REG_MIIMADD, (phy << 8) | reg); + TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCON, value); timeout = TSEC_READ_RETRY; - while (--timeout && (TSEC_READ(sc->phy_sc, TSEC_REG_MIIMIND) & + while (--timeout && (TSEC_READ(sc, TSEC_REG_MIIMIND) & TSEC_MIIMIND_BUSY)) DELAY(TSEC_READ_DELAY); + TSEC_PHY_UNLOCK(); if (timeout == 0) device_printf(dev, "Timeout while writing to PHY!\n"); Modified: stable/10/sys/dev/tsec/if_tsec.h ============================================================================== --- stable/10/sys/dev/tsec/if_tsec.h Wed Dec 11 22:26:09 2013 (r259234) +++ stable/10/sys/dev/tsec/if_tsec.h Wed Dec 11 22:36:20 2013 (r259235) @@ -133,7 +133,8 @@ struct tsec_softc { struct mbuf *frame; int phyaddr; - struct tsec_softc *phy_sc; + bus_space_tag_t phy_bst; + bus_space_handle_t phy_bsh; }; /* interface to get/put generic objects */ @@ -253,6 +254,14 @@ struct tsec_softc { #define TSEC_WRITE(sc, reg, val) \ bus_space_write_4((sc)->sc_bas.bst, (sc)->sc_bas.bsh, (reg), (val)) +extern struct mtx tsec_phy_mtx; +#define TSEC_PHY_LOCK(sc) mtx_lock(&tsec_phy_mtx) +#define TSEC_PHY_UNLOCK(sc) mtx_unlock(&tsec_phy_mtx) +#define TSEC_PHY_READ(sc, reg) \ + bus_space_read_4((sc)->phy_bst, (sc)->phy_bsh, (reg)) +#define TSEC_PHY_WRITE(sc, reg, val) \ + bus_space_write_4((sc)->phy_bst, (sc)->phy_bsh, (reg), (val)) + /* Lock for transmitter */ #define TSEC_TRANSMIT_LOCK(sc) do { \ mtx_assert(&(sc)->receive_lock, MA_NOTOWNED); \ Modified: stable/10/sys/dev/tsec/if_tsec_fdt.c ============================================================================== --- stable/10/sys/dev/tsec/if_tsec_fdt.c Wed Dec 11 22:26:09 2013 (r259234) +++ stable/10/sys/dev/tsec/if_tsec_fdt.c Wed Dec 11 22:36:20 2013 (r259235) @@ -110,6 +110,10 @@ tsec_fdt_probe(device_t dev) struct tsec_softc *sc; uint32_t id; + if (ofw_bus_get_type(dev) == NULL || + strcmp(ofw_bus_get_type(dev), "network") != 0) + return (ENXIO); + if (!ofw_bus_is_compatible(dev, "gianfar")) return (ENXIO); @@ -148,6 +152,7 @@ static int tsec_fdt_attach(device_t dev) { struct tsec_softc *sc; + phandle_t phy; int error = 0; sc = device_get_softc(dev); @@ -155,9 +160,14 @@ tsec_fdt_attach(device_t dev) sc->node = ofw_bus_get_node(dev); /* Get phy address from fdt */ - if (fdt_get_phyaddr(sc->node, sc->dev, &sc->phyaddr, - (void **)&sc->phy_sc) != 0) + if (OF_getencprop(sc->node, "phy-handle", &phy, sizeof(phy)) <= 0) { + device_printf(dev, "PHY not found in device tree"); return (ENXIO); + } + + phy = OF_xref_phandle(phy); + OF_decode_addr(OF_parent(phy), 0, &sc->phy_bst, &sc->phy_bsh); + OF_getencprop(phy, "reg", &sc->phyaddr, sizeof(sc->phyaddr)); /* Init timer */ callout_init(&sc->tsec_callout, 1); @@ -324,6 +334,13 @@ tsec_get_hwaddr(struct tsec_softc *sc, u return; } + /* Also try the mac-address property, which is second-best */ + i = OF_getprop(sc->node, "mac-address", (void *)hw.addr, 6); + if (i == 6 && (hw.reg[0] != 0 || hw.reg[1] != 0)) { + bcopy(hw.addr, addr, 6); + return; + } + /* * Fall back -- use the currently programmed address in the hope that * it was set be firmware... Modified: stable/10/sys/dev/tsec/if_tsecreg.h ============================================================================== --- stable/10/sys/dev/tsec/if_tsecreg.h Wed Dec 11 22:26:09 2013 (r259234) +++ stable/10/sys/dev/tsec/if_tsecreg.h Wed Dec 11 22:36:20 2013 (r259235) @@ -77,12 +77,13 @@ * register */ #define TSEC_REG_HAFDUP 0x50c /* Half-duplex register */ #define TSEC_REG_MAXFRM 0x510 /* Maximum frame length register */ -#define TSEC_REG_MIIMCFG 0x520 /* MII Management configuration register */ -#define TSEC_REG_MIIMCOM 0x524 /* MII Management command register */ -#define TSEC_REG_MIIMADD 0x528 /* MII Management address register */ -#define TSEC_REG_MIIMCON 0x52c /* MII Management control register */ -#define TSEC_REG_MIIMSTAT 0x530 /* MII Management status register */ -#define TSEC_REG_MIIMIND 0x534 /* MII Management indicator register */ +#define TSEC_REG_MIIBASE 0x520 /* MII Management base, rest offsets */ +#define TSEC_REG_MIIMCFG 0x0 /* MII Management configuration register */ +#define TSEC_REG_MIIMCOM 0x4 /* MII Management command register */ +#define TSEC_REG_MIIMADD 0x8 /* MII Management address register */ +#define TSEC_REG_MIIMCON 0xc /* MII Management control register */ +#define TSEC_REG_MIIMSTAT 0x10 /* MII Management status register */ +#define TSEC_REG_MIIMIND 0x14 /* MII Management indicator register */ #define TSEC_REG_IFSTAT 0x53c /* Interface status register */ #define TSEC_REG_MACSTNADDR1 0x540 /* Station address register, part 1 */ #define TSEC_REG_MACSTNADDR2 0x544 /* Station address register, part 2 */ Modified: stable/10/sys/powerpc/aim/machdep.c ============================================================================== --- stable/10/sys/powerpc/aim/machdep.c Wed Dec 11 22:26:09 2013 (r259234) +++ stable/10/sys/powerpc/aim/machdep.c Wed Dec 11 22:36:20 2013 (r259235) @@ -123,6 +123,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -249,6 +250,7 @@ extern void *dblow, *dbsize; extern void *imisstrap, *imisssize; extern void *dlmisstrap, *dlmisssize; extern void *dsmisstrap, *dsmisssize; +char save_trap_init[0x2f00]; /* EXC_LAST */ uintptr_t powerpc_init(vm_offset_t startkernel, vm_offset_t endkernel, @@ -273,6 +275,9 @@ powerpc_init(vm_offset_t startkernel, vm trap_offset = 0; cacheline_warn = 0; + /* Save trap vectors. */ + ofw_save_trap_vec(save_trap_init); + #ifdef WII /* * The Wii loader doesn't pass us any environment so, mdp Modified: stable/10/sys/powerpc/include/ofw_machdep.h ============================================================================== --- stable/10/sys/powerpc/include/ofw_machdep.h Wed Dec 11 22:26:09 2013 (r259234) +++ stable/10/sys/powerpc/include/ofw_machdep.h Wed Dec 11 22:36:20 2013 (r259235) @@ -47,5 +47,6 @@ void OF_reboot(void); void ofw_mem_regions(struct mem_region **, int *, struct mem_region **, int *); void ofw_quiesce(void); /* Must be called before VM is up! */ +void ofw_save_trap_vec(char *); #endif /* _MACHINE_OFW_MACHDEP_H_ */ Modified: stable/10/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- stable/10/sys/powerpc/ofw/ofw_machdep.c Wed Dec 11 22:26:09 2013 (r259234) +++ stable/10/sys/powerpc/ofw/ofw_machdep.c Wed Dec 11 22:36:20 2013 (r259235) @@ -59,18 +59,43 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include static struct mem_region OFmem[PHYS_AVAIL_SZ], OFavail[PHYS_AVAIL_SZ]; static struct mem_region OFfree[PHYS_AVAIL_SZ]; +static int apple_hacks; + +#ifdef AIM extern register_t ofmsr[5]; extern void *openfirmware_entry; static void *fdt; int ofw_real_mode; +extern char save_trap_init[0x2f00]; /* EXC_LAST */ +char save_trap_of[0x2f00]; /* EXC_LAST */ int ofwcall(void *); static int openfirmware(void *args); +__inline void +ofw_save_trap_vec(char *save_trap_vec) +{ + if (apple_hacks) + return; + + bcopy((void *)EXC_RST, save_trap_vec, EXC_LAST - EXC_RST); +} + +static __inline void +ofw_restore_trap_vec(char *restore_trap_vec) +{ + if (apple_hacks) + return; + + bcopy(restore_trap_vec, (void *)EXC_RST, EXC_LAST - EXC_RST); + __syncicache(EXC_RSVD, EXC_LAST - EXC_RSVD); +} + /* * Saved SPRG0-3 from OpenFirmware. Will be restored prior to the callback. */ @@ -79,6 +104,9 @@ register_t ofw_sprg0_save; static __inline void ofw_sprg_prepare(void) { + if (!apple_hacks) + return; + /* * Assume that interrupt are disabled at this point, or * SPRG1-3 could be trashed @@ -98,6 +126,9 @@ ofw_sprg_prepare(void) static __inline void ofw_sprg_restore(void) { + if (!apple_hacks) + return; + /* * Note that SPRG1-3 contents are irrelevant. They are scratch * registers used in the early portion of trap handling when @@ -107,6 +138,7 @@ ofw_sprg_restore(void) */ __asm __volatile("mtsprg0 %0" :: "r"(ofw_sprg0_save)); } +#endif /* * Memory region utilities: determine if two regions overlap, @@ -178,15 +210,10 @@ parse_ofw_memory(phandle_t node, const c /* * On Apple hardware, address_cells is always 1 for "available", - * even when it is explicitly set to 2. Then all memory above 4 GB - * should be added by hand to the available list. Detect Apple hardware - * by seeing if ofw_real_mode is set -- only Apple seems to use - * virtual-mode OF. + * even when it is explicitly set to 2. All memory above 4 GB + * also needs to be added by hand to the available list. */ - if (strcmp(prop, "available") == 0 && !ofw_real_mode) - apple_hack_mode = 1; - - if (apple_hack_mode) + if (strcmp(prop, "available") == 0 && apple_hacks) address_cells = 1; /* @@ -241,7 +268,7 @@ parse_ofw_memory(phandle_t node, const c sz = j*sizeof(output[0]); #ifdef __powerpc64__ - if (apple_hack_mode) { + if (strcmp(prop, "available") == 0 && apple_hacks) { /* Add in regions above 4 GB to the available list */ struct mem_region himem[16]; int hisz; @@ -435,6 +462,7 @@ ofw_mem_regions(struct mem_region **memp *availsz = fsz; } +#ifdef AIM void OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *)) { @@ -481,6 +509,9 @@ OF_bootstrap() OF_init(fdt); } + /* Apple firmware has some bugs. Check for a "mac-io" alias. */ + apple_hacks = (OF_finddevice("mac-io") != -1) ? 1 : 0; + return (status); } @@ -516,6 +547,12 @@ openfirmware_core(void *args) ofw_sprg_prepare(); + /* Save trap vectors */ + ofw_save_trap_vec(save_trap_of); + + /* Restore initially saved trap vectors */ + ofw_restore_trap_vec(save_trap_init); + #if defined(AIM) && !defined(__powerpc64__) /* * Clear battable[] translations @@ -527,6 +564,10 @@ openfirmware_core(void *args) #endif result = ofwcall(args); + + /* Restore trap vecotrs */ + ofw_restore_trap_vec(save_trap_of); + ofw_sprg_restore(); intr_restore(oldmsr); @@ -603,6 +644,8 @@ OF_reboot() for (;;); /* just in case */ } +#endif /* AIM */ + void OF_getetheraddr(device_t dev, u_char *addr) { @@ -623,7 +666,7 @@ OF_getetheraddr(device_t dev, u_char *ad static void OF_get_addr_props(phandle_t node, uint32_t *addrp, uint32_t *sizep, int *pcip) { - char name[16]; + char type[64]; uint32_t addr, size; int pci, res; @@ -635,10 +678,10 @@ OF_get_addr_props(phandle_t node, uint32 size = 1; pci = 0; if (addr == 3 && size == 2) { - res = OF_getprop(node, "name", name, sizeof(name)); + res = OF_getprop(node, "device_type", type, sizeof(type)); if (res != -1) { - name[sizeof(name) - 1] = '\0'; - pci = (strcmp(name, "pci") == 0) ? 1 : 0; + type[sizeof(type) - 1] = '\0'; + pci = (strcmp(type, "pci") == 0) ? 1 : 0; } } if (addrp != NULL) @@ -672,8 +715,13 @@ OF_decode_addr(phandle_t dev, int regno, if (tag == NULL || handle == NULL) return (EINVAL); + /* Assume big-endian unless we find a PCI device */ + *tag = &bs_be_tag; + /* Get the requested register. */ OF_get_addr_props(bridge, &naddr, &nsize, &pci); + if (pci) + *tag = &bs_le_tag; res = OF_getprop(dev, (pci) ? "assigned-addresses" : "reg", cell, sizeof(cell)); if (res == -1) @@ -701,6 +749,8 @@ OF_decode_addr(phandle_t dev, int regno, parent = OF_parent(bridge); while (parent != 0) { OF_get_addr_props(parent, &nbridge, NULL, &pcib); + if (pcib) + *tag = &bs_le_tag; res = OF_getprop(bridge, "ranges", cell, sizeof(cell)); if (res == -1) goto next; @@ -741,7 +791,6 @@ OF_decode_addr(phandle_t dev, int regno, OF_get_addr_props(bridge, &naddr, &nsize, &pci); } - *tag = &bs_le_tag; return (bus_space_map(*tag, addr, size, prefetch ? BUS_SPACE_MAP_PREFETCHABLE : 0, handle)); } From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 23:06:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6EC7DD1E; Wed, 11 Dec 2013 23:06:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5A1F211F5; Wed, 11 Dec 2013 23:06:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBN643M095396; Wed, 11 Dec 2013 23:06:04 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBN64HJ095395; Wed, 11 Dec 2013 23:06:04 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201312112306.rBBN64HJ095395@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Wed, 11 Dec 2013 23:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259236 - stable/10/sys/dev/drm2/radeon X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 23:06:04 -0000 Author: dumbbell Date: Wed Dec 11 23:06:03 2013 New Revision: 259236 URL: http://svnweb.freebsd.org/changeset/base/259236 Log: MFC r259104: drm/radeon: radeon_dp_i2c_aux_ch() must return 0 on FreeBSD The code was unmodified compared to Linux and returned the amount of received bytes from the i2c bus. This led to non-working i2c bus and failure to eg. read monitor's EDID, if connected to DisplayPort. Tested by: Mikaël Urankar Modified: stable/10/sys/dev/drm2/radeon/atombios_dp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm2/radeon/atombios_dp.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/atombios_dp.c Wed Dec 11 22:36:20 2013 (r259235) +++ stable/10/sys/dev/drm2/radeon/atombios_dp.c Wed Dec 11 23:06:03 2013 (r259236) @@ -272,7 +272,7 @@ int radeon_dp_i2c_aux_ch(device_t dev, i case AUX_I2C_REPLY_ACK: if (mode == MODE_I2C_READ) *read_byte = reply[0]; - return ret; + return (0); /* Return ret on Linux. */ case AUX_I2C_REPLY_NACK: DRM_DEBUG_KMS("aux_i2c nack\n"); return -EREMOTEIO; From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 23:15:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE4CA3E7; Wed, 11 Dec 2013 23:15:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C9E2812CA; Wed, 11 Dec 2013 23:15:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBNFJCh099268; Wed, 11 Dec 2013 23:15:19 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBNFJ23099267; Wed, 11 Dec 2013 23:15:19 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201312112315.rBBNFJ23099267@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Wed, 11 Dec 2013 23:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259237 - stable/10/sys/dev/drm2 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 23:15:20 -0000 Author: dumbbell Date: Wed Dec 11 23:15:19 2013 New Revision: 259237 URL: http://svnweb.freebsd.org/changeset/base/259237 Log: MFC r258930: drm: Read PCIER_LINK_CAP/PCIER_LINK_CAP2 from the PCI bridge Before this fix, capabilities were read from vgapci and were incorrect. Modified: stable/10/sys/dev/drm2/drm_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm2/drm_pci.c ============================================================================== --- stable/10/sys/dev/drm2/drm_pci.c Wed Dec 11 23:06:03 2013 (r259236) +++ stable/10/sys/dev/drm2/drm_pci.c Wed Dec 11 23:15:19 2013 (r259237) @@ -134,7 +134,11 @@ int drm_pcie_get_speed_cap_mask(struct d if (!drm_device_is_pcie(dev)) return -EINVAL; - root = device_get_parent(dev->device); + root = + device_get_parent( /* pcib */ + device_get_parent( /* `-- pci */ + device_get_parent( /* `-- vgapci */ + dev->device))); /* `-- drmn */ pos = 0; pci_find_cap(root, PCIY_EXPRESS, &pos); From owner-svn-src-stable@FreeBSD.ORG Wed Dec 11 23:28:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92DE3654; Wed, 11 Dec 2013 23:28:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7D9491365; Wed, 11 Dec 2013 23:28:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBBNSWvk003150; Wed, 11 Dec 2013 23:28:32 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBBNSVhI003147; Wed, 11 Dec 2013 23:28:31 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201312112328.rBBNSVhI003147@svn.freebsd.org> From: Rick Macklem Date: Wed, 11 Dec 2013 23:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259238 - in stable/10/sys/fs: nfs nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2013 23:28:32 -0000 Author: rmacklem Date: Wed Dec 11 23:28:31 2013 New Revision: 259238 URL: http://svnweb.freebsd.org/changeset/base/259238 Log: MFC: r257901 Fix an NFSv4.1 client specific case where a forced dismount would hang. The hang occurred in nfsv4_setsequence() when it couldn't find an available session slot and is fixed by checking for a forced dismount in progress and just returning for this case. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c stable/10/sys/fs/nfs/nfs_var.h stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Wed Dec 11 23:15:19 2013 (r259237) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Wed Dec 11 23:28:31 2013 (r259238) @@ -3693,8 +3693,8 @@ nfsv4_seqsess_cacherep(uint32_t slotid, * Generate the xdr for an NFSv4.1 Sequence Operation. */ APPLESTATIC void -nfsv4_setsequence(struct nfsrv_descript *nd, struct nfsclsession *sep, - int dont_replycache) +nfsv4_setsequence(struct nfsmount *nmp, struct nfsrv_descript *nd, + struct nfsclsession *sep, int dont_replycache) { uint32_t *tl, slotseq = 0; int i, maxslot, slotpos; @@ -3717,9 +3717,21 @@ nfsv4_setsequence(struct nfsrv_descript } bitval <<= 1; } - if (slotpos == -1) + if (slotpos == -1) { + /* + * If a forced dismount is in progress, just return. + * This RPC attempt will fail when it calls + * newnfs_request(). + */ + if ((nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) + != 0) { + mtx_unlock(&sep->nfsess_mtx); + return; + } + /* Wake up once/sec, to check for a forced dismount. */ (void)mtx_sleep(&sep->nfsess_slots, &sep->nfsess_mtx, - PZERO, "nfsclseq", 0); + PZERO, "nfsclseq", hz); + } } while (slotpos == -1); /* Now, find the highest slot in use. (nfsc_slots is 64bits) */ bitval = 1; Modified: stable/10/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/10/sys/fs/nfs/nfs_var.h Wed Dec 11 23:15:19 2013 (r259237) +++ stable/10/sys/fs/nfs/nfs_var.h Wed Dec 11 23:28:31 2013 (r259238) @@ -265,7 +265,8 @@ int nfsv4_getipaddr(struct nfsrv_descrip int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, struct nfsslot *, struct mbuf **, uint16_t); void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, struct mbuf *); -void nfsv4_setsequence(struct nfsrv_descript *, struct nfsclsession *, int); +void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *, + struct nfsclsession *, int); void nfsv4_freeslot(struct nfsclsession *, int); /* nfs_clcomsubs.c */ Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Wed Dec 11 23:15:19 2013 (r259237) +++ stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Wed Dec 11 23:28:31 2013 (r259238) @@ -203,10 +203,11 @@ nfscl_reqstart(struct nfsrv_descript *nd NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_SEQUENCE); if (sep == NULL) - nfsv4_setsequence(nd, NFSMNT_MDSSESSION(nmp), + nfsv4_setsequence(nmp, nd, + NFSMNT_MDSSESSION(nmp), nfs_bigreply[procnum]); else - nfsv4_setsequence(nd, sep, + nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); } if (nfsv4_opflag[nfsv4_opmap[procnum].op].needscfh > 0) { From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 00:27:28 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6A9BC98A; Thu, 12 Dec 2013 00:27:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 565011820; Thu, 12 Dec 2013 00:27:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBC0RSjV025715; Thu, 12 Dec 2013 00:27:28 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBC0RSeJ025714; Thu, 12 Dec 2013 00:27:28 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201312120027.rBC0RSeJ025714@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 12 Dec 2013 00:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259241 - stable/10/sys/dev/cxgbe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 00:27:28 -0000 Author: np Date: Thu Dec 12 00:27:27 2013 New Revision: 259241 URL: http://svnweb.freebsd.org/changeset/base/259241 Log: MFC r259145: Unstaticize t4_list and t4_uld_list. This works around a clang annoyance[1] and allows kgdb to find these symbols. [1] http://lists.freebsd.org/pipermail/freebsd-hackers/2012-November/041166.html Modified: stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Thu Dec 12 00:27:22 2013 (r259240) +++ stable/10/sys/dev/cxgbe/t4_main.c Thu Dec 12 00:27:27 2013 (r259241) @@ -161,10 +161,10 @@ MALLOC_DEFINE(M_CXGBE, "cxgbe", "Chelsio * then ADAPTER_LOCK, then t4_uld_list_lock. */ static struct sx t4_list_lock; -static SLIST_HEAD(, adapter) t4_list; +SLIST_HEAD(, adapter) t4_list; #ifdef TCP_OFFLOAD static struct sx t4_uld_list_lock; -static SLIST_HEAD(, uld_info) t4_uld_list; +SLIST_HEAD(, uld_info) t4_uld_list; #endif /* From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 02:03:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BFA6E0C; Thu, 12 Dec 2013 02:03:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 872BA1F52; Thu, 12 Dec 2013 02:03:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBC23gRq060420; Thu, 12 Dec 2013 02:03:42 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBC23gm1060419; Thu, 12 Dec 2013 02:03:42 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201312120203.rBC23gm1060419@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 12 Dec 2013 02:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259242 - stable/10/contrib/gcclibs/libcpp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 02:03:42 -0000 Author: mdf Date: Thu Dec 12 02:03:42 2013 New Revision: 259242 URL: http://svnweb.freebsd.org/changeset/base/259242 Log: MFC r258658: Fix a segfault / internal compiler error. Among other causes, when gcc throws a warning before parsing any tokens, the cur_token pointer is at the beginning of malloc'd memory. Dereferencing cur_token[-1] can cause a segfault. Code taken from OpenBSD http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/gcc/libcpp/errors.c which was a more complete fix than the one I originally coded. Modified: stable/10/contrib/gcclibs/libcpp/errors.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcclibs/libcpp/errors.c ============================================================================== --- stable/10/contrib/gcclibs/libcpp/errors.c Thu Dec 12 00:27:27 2013 (r259241) +++ stable/10/contrib/gcclibs/libcpp/errors.c Thu Dec 12 02:03:42 2013 (r259242) @@ -153,7 +153,20 @@ cpp_error (cpp_reader * pfile, int level } else { - src_loc = pfile->cur_token[-1].src_loc; + /* Find actual previous token. */ + cpp_token *t; + + if (pfile->cur_token != pfile->cur_run->base) + t = pfile->cur_token - 1; + else + { + if (pfile->cur_run->prev != NULL) + t = pfile->cur_run->prev->limit; + else + t = NULL; + } + /* Retrieve corresponding source location, unless we failed. */ + src_loc = t ? t->src_loc : 0; } if (_cpp_begin_message (pfile, level, src_loc, 0)) From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 02:05:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61116F57; Thu, 12 Dec 2013 02:05:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4D0731F63; Thu, 12 Dec 2013 02:05:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBC250k2060656; Thu, 12 Dec 2013 02:05:00 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBC250iP060654; Thu, 12 Dec 2013 02:05:00 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201312120205.rBC250iP060654@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 12 Dec 2013 02:05:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259243 - stable/9/contrib/gcclibs/libcpp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 02:05:00 -0000 Author: mdf Date: Thu Dec 12 02:04:59 2013 New Revision: 259243 URL: http://svnweb.freebsd.org/changeset/base/259243 Log: MFC r258658: Fix a segfault / internal compiler error. Among other causes, when gcc throws a warning before parsing any tokens, the cur_token pointer is at the beginning of malloc'd memory. Dereferencing cur_token[-1] can cause a segfault. Code taken from OpenBSD http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/gcc/libcpp/errors.c which was a more complete fix than the one I originally coded. Modified: stable/9/contrib/gcclibs/libcpp/errors.c Directory Properties: stable/9/contrib/gcclibs/ (props changed) Modified: stable/9/contrib/gcclibs/libcpp/errors.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/errors.c Thu Dec 12 02:03:42 2013 (r259242) +++ stable/9/contrib/gcclibs/libcpp/errors.c Thu Dec 12 02:04:59 2013 (r259243) @@ -153,7 +153,20 @@ cpp_error (cpp_reader * pfile, int level } else { - src_loc = pfile->cur_token[-1].src_loc; + /* Find actual previous token. */ + cpp_token *t; + + if (pfile->cur_token != pfile->cur_run->base) + t = pfile->cur_token - 1; + else + { + if (pfile->cur_run->prev != NULL) + t = pfile->cur_run->prev->limit; + else + t = NULL; + } + /* Retrieve corresponding source location, unless we failed. */ + src_loc = t ? t->src_loc : 0; } if (_cpp_begin_message (pfile, level, src_loc, 0)) From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 12:17:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A04612D; Thu, 12 Dec 2013 12:17:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 857EE1A9F; Thu, 12 Dec 2013 12:17:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCCHLNO090435; Thu, 12 Dec 2013 12:17:21 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCCHLwu090433; Thu, 12 Dec 2013 12:17:21 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312121217.rBCCHLwu090433@svn.freebsd.org> From: Andreas Tobler Date: Thu, 12 Dec 2013 12:17:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259255 - stable/10/sys/dev/ofw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 12:17:21 -0000 Author: andreast Date: Thu Dec 12 12:17:20 2013 New Revision: 259255 URL: http://svnweb.freebsd.org/changeset/base/259255 Log: MFC: r256932, r256938, r256953 r256932: Add a new function (OF_getencprop()) that undoes the transformation applied by encode-int. Specifically, it takes a set of 32-bit cell values and changes them to host byte order. Most non-string instances of OF_getprop() should be using this function, which is a no-op on big-endian platforms. r256938: A few other common cases for encode-int decoding: OF_getencprop_alloc() and OF_searchencprop(). I thought about using the element size parameter to OF_getprop_alloc() to do endian-switching automatically, but it breaks use with structs and a *lot* of FDT code (which can hopefully be moved to these new APIs). r256953: Fix build. Modified: stable/10/sys/dev/ofw/openfirm.c stable/10/sys/dev/ofw/openfirm.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ofw/openfirm.c ============================================================================== --- stable/10/sys/dev/ofw/openfirm.c Thu Dec 12 11:05:48 2013 (r259254) +++ stable/10/sys/dev/ofw/openfirm.c Thu Dec 12 12:17:20 2013 (r259255) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -280,6 +281,21 @@ OF_getprop(phandle_t package, const char return (OFW_GETPROP(ofw_obj, package, propname, buf, buflen)); } +ssize_t +OF_getencprop(phandle_t node, const char *propname, pcell_t *buf, size_t len) +{ + ssize_t retval; + int i; + + KASSERT(len % 4 == 0, ("Need a multiple of 4 bytes")); + + retval = OF_getprop(node, propname, buf, len); + for (i = 0; i < len/4; i++) + buf[i] = be32toh(buf[i]); + + return (retval); +} + /* * Recursively search the node and its parent for the given property, working * downward from the node to the device tree root. Returns the value of the @@ -296,6 +312,17 @@ OF_searchprop(phandle_t node, const char return (-1); } +ssize_t +OF_searchencprop(phandle_t node, const char *propname, void *buf, size_t len) +{ + ssize_t rv; + + for (; node != 0; node = OF_parent(node)) + if ((rv = OF_getencprop(node, propname, buf, len)) != -1) + return (rv); + return (-1); +} + /* * Store the value of a property of a package into newly allocated memory * (using the M_OFWPROP malloc pool and M_WAITOK). elsz is the size of a @@ -320,6 +347,26 @@ OF_getprop_alloc(phandle_t package, cons return (len / elsz); } +ssize_t +OF_getencprop_alloc(phandle_t package, const char *name, int elsz, void **buf) +{ + ssize_t retval; + pcell_t *cell; + int i; + + KASSERT(elsz % 4 == 0, ("Need a multiple of 4 bytes")); + + retval = OF_getprop_alloc(package, name, elsz, buf); + if (retval == -1) + return (retval); + + cell = *buf; + for (i = 0; i < retval*elsz/4; i++) + cell[i] = be32toh(cell[i]); + + return (retval); +} + /* Get the next property of a package. */ int OF_nextprop(phandle_t package, const char *previous, char *buf, size_t size) Modified: stable/10/sys/dev/ofw/openfirm.h ============================================================================== --- stable/10/sys/dev/ofw/openfirm.h Thu Dec 12 11:05:48 2013 (r259254) +++ stable/10/sys/dev/ofw/openfirm.h Thu Dec 12 12:17:20 2013 (r259255) @@ -105,11 +105,17 @@ phandle_t OF_parent(phandle_t node); ssize_t OF_getproplen(phandle_t node, const char *propname); ssize_t OF_getprop(phandle_t node, const char *propname, void *buf, size_t len); +ssize_t OF_getencprop(phandle_t node, const char *prop, pcell_t *buf, + size_t len); /* Same as getprop, but maintains endianness */ int OF_hasprop(phandle_t node, const char *propname); ssize_t OF_searchprop(phandle_t node, const char *propname, void *buf, size_t len); +ssize_t OF_searchencprop(phandle_t node, const char *propname, + void *buf, size_t len); ssize_t OF_getprop_alloc(phandle_t node, const char *propname, int elsz, void **buf); +ssize_t OF_getencprop_alloc(phandle_t node, const char *propname, + int elsz, void **buf); int OF_nextprop(phandle_t node, const char *propname, char *buf, size_t len); int OF_setprop(phandle_t node, const char *name, const void *buf, From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 12:29:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4A75358F; Thu, 12 Dec 2013 12:29:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1C7E31C95; Thu, 12 Dec 2013 12:29:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCCTZXs094368; Thu, 12 Dec 2013 12:29:35 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCCTZSY094367; Thu, 12 Dec 2013 12:29:35 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312121229.rBCCTZSY094367@svn.freebsd.org> From: Andreas Tobler Date: Thu, 12 Dec 2013 12:29:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259256 - stable/10/sys/powerpc/powerpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 12:29:36 -0000 Author: andreast Date: Thu Dec 12 12:29:35 2013 New Revision: 259256 URL: http://svnweb.freebsd.org/changeset/base/259256 Log: MFC: r258722, r258757 r258722: Give some output about the CPU clock on IBMPOWER machines, currently read from OF. Linux does it similar, means they also read the OF values and display them. r258757: Use the Open Firmware-based CPU frequency determination as a generic fallback if we can't measure CPU frequency. This is also useful on a variety of embedded systems using FDT. Modified: stable/10/sys/powerpc/powerpc/cpu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/10/sys/powerpc/powerpc/cpu.c Thu Dec 12 12:17:20 2013 (r259255) +++ stable/10/sys/powerpc/powerpc/cpu.c Thu Dec 12 12:29:35 2013 (r259256) @@ -74,6 +74,8 @@ #include #include +#include + static void cpu_6xx_setup(int cpuid, uint16_t vers); static void cpu_970_setup(int cpuid, uint16_t vers); static void cpu_booke_setup(int cpuid, uint16_t vers); @@ -273,6 +275,9 @@ cpu_est_clockrate(int cpu_id, uint64_t * { uint16_t vers; register_t msr; + phandle_t cpu, dev, root; + int res = 0; + char buf[8]; vers = mfpvr() >> 16; msr = mfmsr(); @@ -316,9 +321,40 @@ cpu_est_clockrate(int cpu_id, uint64_t * mtmsr(msr); return (0); + + default: + root = OF_peer(0); + if (root == 0) + return (ENXIO); + + dev = OF_child(root); + while (dev != 0) { + res = OF_getprop(dev, "name", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpus") == 0) + break; + dev = OF_peer(dev); + } + cpu = OF_child(dev); + while (cpu != 0) { + res = OF_getprop(cpu, "device_type", buf, + sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) + break; + cpu = OF_peer(cpu); + } + if (cpu == 0) + return (ENOENT); + if (OF_getprop(cpu, "ibm,extended-clock-frequency", + cps, sizeof(*cps)) >= 0) { + return (0); + } else if (OF_getprop(cpu, "clock-frequency", cps, + sizeof(cell_t)) >= 0) { + *cps >>= 32; + return (0); + } else { + return (ENOENT); + } } - - return (ENXIO); } void From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 12:36:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 363FBBB3; Thu, 12 Dec 2013 12:36:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 206811D71; Thu, 12 Dec 2013 12:36:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCCafIa097601; Thu, 12 Dec 2013 12:36:41 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCCaeTG097595; Thu, 12 Dec 2013 12:36:40 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312121236.rBCCaeTG097595@svn.freebsd.org> From: Andreas Tobler Date: Thu, 12 Dec 2013 12:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259257 - in stable/10/sys: conf powerpc/ofw powerpc/pseries X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 12:36:42 -0000 Author: andreast Date: Thu Dec 12 12:36:40 2013 New Revision: 259257 URL: http://svnweb.freebsd.org/changeset/base/259257 Log: MFC: r258051, r258052 r258052: Following the approach with ACPI DMAR on x86, split IOMMU handling into a variant PCI bus instead of trying to shoehorn it into the PCI host bridge adapter. Besides matching better the architecture on other platforms, this also allows systems with multiple partitionable endpoints per PCI host bridge to work correctly. r258051: Actually add IOMMU domain to the list of known mappings. This fixes a bug where multiple devices in the same IOMMU domain would be allocated conflicting mappings unless they also shared a DMA tag. Added: stable/10/sys/powerpc/ofw/ofw_pcibus.h - copied unchanged from r258052, head/sys/powerpc/ofw/ofw_pcibus.h stable/10/sys/powerpc/pseries/plpar_pcibus.c - copied unchanged from r258052, head/sys/powerpc/pseries/plpar_pcibus.c Modified: stable/10/sys/conf/files.powerpc stable/10/sys/powerpc/ofw/ofw_pcibus.c stable/10/sys/powerpc/pseries/plpar_iommu.c stable/10/sys/powerpc/pseries/rtas_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.powerpc ============================================================================== --- stable/10/sys/conf/files.powerpc Thu Dec 12 12:29:35 2013 (r259256) +++ stable/10/sys/conf/files.powerpc Thu Dec 12 12:36:40 2013 (r259257) @@ -232,6 +232,7 @@ powerpc/pseries/phyp_llan.c optional lla powerpc/pseries/phyp_vscsi.c optional pseries powerpc64 scbus powerpc/pseries/platform_chrp.c optional pseries powerpc/pseries/plpar_iommu.c optional pseries powerpc64 +powerpc/pseries/plpar_pcibus.c optional pseries powerpc64 pci powerpc/pseries/rtas_dev.c optional pseries powerpc/pseries/rtas_pci.c optional pseries pci powerpc/pseries/vdevice.c optional pseries powerpc64 Modified: stable/10/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- stable/10/sys/powerpc/ofw/ofw_pcibus.c Thu Dec 12 12:29:35 2013 (r259256) +++ stable/10/sys/powerpc/ofw/ofw_pcibus.c Thu Dec 12 12:36:40 2013 (r259257) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "ofw_pcibus.h" #include "pcib_if.h" #include "pci_if.h" @@ -85,12 +86,7 @@ static device_method_t ofw_pcibus_method DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { 0, 0 } -}; - -struct ofw_pcibus_devinfo { - struct pci_devinfo opd_dinfo; - struct ofw_bus_devinfo opd_obdinfo; + DEVMETHOD_END }; static devclass_t pci_devclass; @@ -195,6 +191,7 @@ ofw_pcibus_enum_devtree(device_t dev, u_ pci_freecfg((struct pci_devinfo *)dinfo); continue; } + dinfo->opd_dma_tag = NULL; pci_add_child(dev, (struct pci_devinfo *)dinfo); /* @@ -274,6 +271,7 @@ ofw_pcibus_enum_bus(device_t dev, u_int if (dinfo == NULL) continue; + dinfo->opd_dma_tag = NULL; dinfo->opd_obdinfo.obd_node = -1; dinfo->opd_obdinfo.obd_name = NULL; Copied: stable/10/sys/powerpc/ofw/ofw_pcibus.h (from r258052, head/sys/powerpc/ofw/ofw_pcibus.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/powerpc/ofw/ofw_pcibus.h Thu Dec 12 12:36:40 2013 (r259257, copy of r258052, head/sys/powerpc/ofw/ofw_pcibus.h) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2011 Nathan Whitehorn + * 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$ + */ + +#ifndef POWERPC_OFW_OFW_PCIBUS_H +#define POWERPC_OFW_OFW_PCIBUS_H + +#include +#include + +#include +#include +#include + +/* + * Export class definition for inheritance purposes + */ +DECLARE_CLASS(ofw_pcibus_driver); /* PCI Bus Enumerators */ + +struct ofw_pcibus_devinfo { + struct pci_devinfo opd_dinfo; + struct ofw_bus_devinfo opd_obdinfo; + bus_dma_tag_t opd_dma_tag; +}; + +#endif // POWERPC_OFW_OFW_PCIBUS_H + Modified: stable/10/sys/powerpc/pseries/plpar_iommu.c ============================================================================== --- stable/10/sys/powerpc/pseries/plpar_iommu.c Thu Dec 12 12:29:35 2013 (r259256) +++ stable/10/sys/powerpc/pseries/plpar_iommu.c Thu Dec 12 12:36:40 2013 (r259257) @@ -115,6 +115,8 @@ phyp_iommu_set_dma_tag(device_t dev, dev (((uint64_t)(dmawindow[dma_acells + 1]) << 32) | dmawindow[dma_acells + 2]); + if (bootverbose) + device_printf(dev, "Mapping IOMMU domain %#x\n", dmawindow[0]); window->map = NULL; SLIST_FOREACH(i, &iommu_map_head, entries) { if (i->iobn == dmawindow[0]) { @@ -134,6 +136,7 @@ phyp_iommu_set_dma_tag(device_t dev, dev window->map->vmem = vmem_create("IOMMU mappings", PAGE_SIZE, trunc_page(VMEM_ADDR_MAX) - PAGE_SIZE, PAGE_SIZE, 0, M_BESTFIT | M_NOWAIT); + SLIST_INSERT_HEAD(&iommu_map_head, window->map, entries); } /* Copied: stable/10/sys/powerpc/pseries/plpar_pcibus.c (from r258052, head/sys/powerpc/pseries/plpar_pcibus.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/powerpc/pseries/plpar_pcibus.c Thu Dec 12 12:36:40 2013 (r259257, copy of r258052, head/sys/powerpc/pseries/plpar_pcibus.c) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2011 Nathan Whitehorn + * 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 +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include "pci_if.h" +#include "iommu_if.h" + +static int plpar_pcibus_probe(device_t); +static bus_dma_tag_t plpar_pcibus_get_dma_tag(device_t dev, device_t child); + +/* + * Driver methods. + */ +static device_method_t plpar_pcibus_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, plpar_pcibus_probe), + + /* IOMMU functions */ + DEVMETHOD(bus_get_dma_tag, plpar_pcibus_get_dma_tag), + DEVMETHOD(iommu_map, phyp_iommu_map), + DEVMETHOD(iommu_unmap, phyp_iommu_unmap), + + DEVMETHOD_END +}; + +static devclass_t pci_devclass; +DEFINE_CLASS_1(pci, plpar_pcibus_driver, plpar_pcibus_methods, + sizeof(struct pci_softc), ofw_pcibus_driver); +DRIVER_MODULE(plpar_pcibus, pcib, plpar_pcibus_driver, pci_devclass, 0, 0); + +static int +plpar_pcibus_probe(device_t dev) +{ + phandle_t rtas; + + if (ofw_bus_get_node(dev) == -1 || !rtas_exists()) + return (ENXIO); + + rtas = OF_finddevice("/rtas"); + if (!OF_hasprop(rtas, "ibm,hypertas-functions")) + return (ENXIO); + + device_set_desc(dev, "POWER Hypervisor PCI bus"); + + return (BUS_PROBE_SPECIFIC); +} + +static bus_dma_tag_t +plpar_pcibus_get_dma_tag(device_t dev, device_t child) +{ + struct ofw_pcibus_devinfo *dinfo; + + while (device_get_parent(child) != dev) + child = device_get_parent(child); + + dinfo = device_get_ivars(child); + + if (dinfo->opd_dma_tag != NULL) + return (dinfo->opd_dma_tag); + + bus_dma_tag_create(bus_get_dma_tag(dev), + 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, + BUS_SPACE_MAXSIZE, 0, NULL, NULL, &dinfo->opd_dma_tag); + phyp_iommu_set_dma_tag(dev, child, dinfo->opd_dma_tag); + + return (dinfo->opd_dma_tag); +} + Modified: stable/10/sys/powerpc/pseries/rtas_pci.c ============================================================================== --- stable/10/sys/powerpc/pseries/rtas_pci.c Thu Dec 12 12:29:35 2013 (r259256) +++ stable/10/sys/powerpc/pseries/rtas_pci.c Thu Dec 12 12:36:40 2013 (r259257) @@ -74,11 +74,6 @@ static void rtaspci_write_config(device u_int, u_int32_t, int); /* - * IOMMU LPAR interface - */ -static bus_dma_tag_t rtaspci_get_dma_tag(device_t dev, device_t child); - -/* * Driver methods. */ static device_method_t rtaspci_methods[] = { @@ -90,19 +85,11 @@ static device_method_t rtaspci_methods[] DEVMETHOD(pcib_read_config, rtaspci_read_config), DEVMETHOD(pcib_write_config, rtaspci_write_config), - /* IOMMU functions */ - DEVMETHOD(bus_get_dma_tag, rtaspci_get_dma_tag), -#ifdef __powerpc64__ - DEVMETHOD(iommu_map, phyp_iommu_map), - DEVMETHOD(iommu_unmap, phyp_iommu_unmap), -#endif - DEVMETHOD_END }; struct rtaspci_softc { struct ofw_pci_softc pci_sc; - bus_dma_tag_t dma_tag; cell_t read_pci_config, write_pci_config; cell_t ex_read_pci_config, ex_write_pci_config; @@ -149,15 +136,6 @@ rtaspci_attach(device_t dev) OF_getprop(ofw_bus_get_node(dev), "ibm,pci-config-space-type", &sc->sc_extended_config, sizeof(sc->sc_extended_config)); - bus_dma_tag_create(bus_get_dma_tag(dev), - 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, - BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->dma_tag); -#ifdef __powerpc64__ - if (!(mfmsr() & PSL_HV)) - phyp_iommu_set_dma_tag(dev, dev, sc->dma_tag); -#endif - return (ofw_pci_attach(dev)); } @@ -225,12 +203,3 @@ rtaspci_write_config(device_t dev, u_int width, val, &pcierror); } -static bus_dma_tag_t -rtaspci_get_dma_tag(device_t dev, device_t child) -{ - struct rtaspci_softc *sc; - - sc = device_get_softc(dev); - return (sc->dma_tag); -} - From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 13:00:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B9EB8D4; Thu, 12 Dec 2013 13:00:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A66901F32; Thu, 12 Dec 2013 13:00:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCD082s005633; Thu, 12 Dec 2013 13:00:08 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCD08Df005630; Thu, 12 Dec 2013 13:00:08 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201312121300.rBCD08Df005630@svn.freebsd.org> From: Andreas Tobler Date: Thu, 12 Dec 2013 13:00:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259258 - in stable/10/sys/powerpc: ofw pseries X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 13:00:08 -0000 Author: andreast Date: Thu Dec 12 13:00:07 2013 New Revision: 259258 URL: http://svnweb.freebsd.org/changeset/base/259258 Log: MFC: r258427, r258694 r258694: Make RTAS calls, which call setfault() to recover from machine checks, preserve any existing fault buffer. RTAS calls are meant to be safe from interrupt context (and are indeed used there to implement the xics PIC driver). Without this, calling into RTAS in interrupt context would have the effect of clearing any existing onfault state of the interrupted thread, potentially leading to a panic. r258427: For PCI<->PCI bridges, #address-cells may be 3. Allow this when parsing the ibm,dma-window properties. This is especially a concern when #ibm,dma-address-cells is not specified and we have to use the regular #address-cells property. Modified: stable/10/sys/powerpc/ofw/rtas.c stable/10/sys/powerpc/pseries/plpar_iommu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/ofw/rtas.c ============================================================================== --- stable/10/sys/powerpc/ofw/rtas.c Thu Dec 12 12:36:40 2013 (r259257) +++ stable/10/sys/powerpc/ofw/rtas.c Thu Dec 12 13:00:07 2013 (r259258) @@ -192,7 +192,7 @@ int rtas_call_method(cell_t token, int nargs, int nreturns, ...) { vm_offset_t argsptr; - faultbuf env; + faultbuf env, *oldfaultbuf; va_list ap; struct { cell_t token; @@ -221,6 +221,7 @@ rtas_call_method(cell_t token, int nargs /* Get rid of any stale machine checks that have been waiting. */ __asm __volatile ("sync; isync"); + oldfaultbuf = curthread->td_pcb->pcb_onfault; if (!setfault(env)) { __asm __volatile ("sync"); result = rtascall(argsptr, rtas_private_data); @@ -228,7 +229,7 @@ rtas_call_method(cell_t token, int nargs } else { result = RTAS_HW_ERROR; } - curthread->td_pcb->pcb_onfault = 0; + curthread->td_pcb->pcb_onfault = oldfaultbuf; __asm __volatile ("sync"); rtas_real_unmap(argsptr, &args, sizeof(args)); Modified: stable/10/sys/powerpc/pseries/plpar_iommu.c ============================================================================== --- stable/10/sys/powerpc/pseries/plpar_iommu.c Thu Dec 12 12:36:40 2013 (r259257) +++ stable/10/sys/powerpc/pseries/plpar_iommu.c Thu Dec 12 13:00:07 2013 (r259258) @@ -73,8 +73,9 @@ phyp_iommu_set_dma_tag(device_t dev, dev { device_t p; phandle_t node; - cell_t dma_acells, dma_scells, dmawindow[5]; + cell_t dma_acells, dma_scells, dmawindow[6]; struct iommu_map *i; + int cell; for (p = child; p != NULL; p = device_get_parent(p)) { if (ofw_bus_has_prop(p, "ibm,my-dma-window")) @@ -104,16 +105,17 @@ phyp_iommu_set_dma_tag(device_t dev, dev struct dma_window *window = malloc(sizeof(struct dma_window), M_PHYPIOMMU, M_WAITOK); - if (dma_acells == 1) - window->start = dmawindow[1]; - else - window->start = ((uint64_t)(dmawindow[1]) << 32) | dmawindow[2]; - if (dma_scells == 1) - window->end = window->start + dmawindow[dma_acells + 1]; - else - window->end = window->start + - (((uint64_t)(dmawindow[dma_acells + 1]) << 32) | - dmawindow[dma_acells + 2]); + window->start = 0; + for (cell = 1; cell < 1 + dma_acells; cell++) { + window->start <<= 32; + window->start |= dmawindow[cell]; + } + window->end = 0; + for (; cell < 1 + dma_acells + dma_scells; cell++) { + window->end <<= 32; + window->end |= dmawindow[cell]; + } + window->end += window->start; if (bootverbose) device_printf(dev, "Mapping IOMMU domain %#x\n", dmawindow[0]); From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 15:05:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 249BE70A; Thu, 12 Dec 2013 15:05:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0D750194D; Thu, 12 Dec 2013 15:05:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCF52DM052493; Thu, 12 Dec 2013 15:05:02 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCF502g052425; Thu, 12 Dec 2013 15:05:00 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201312121505.rBCF502g052425@svn.freebsd.org> From: Tijl Coosemans Date: Thu, 12 Dec 2013 15:05:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259262 - in stable/9/usr.bin/m4: . TEST lib X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 15:05:02 -0000 Author: tijl Date: Thu Dec 12 15:04:59 2013 New Revision: 259262 URL: http://svnweb.freebsd.org/changeset/base/259262 Log: MFC r226422, r227241, r228063, r228697, r228698, r228701, r234310, r234850, r250226, r250926. This brings m4 up to date with the version in head and fixes the eval command when called with a 2nd and 3rd argument. The only differences remaining are related to the updated flex and byacc in head. PR: bin/166994 Added: stable/9/usr.bin/m4/lib/ - copied from r228063, head/usr.bin/m4/lib/ stable/9/usr.bin/m4/parser.y - copied, changed from r228697, head/usr.bin/m4/parser.y stable/9/usr.bin/m4/tokenizer.l - copied, changed from r228697, head/usr.bin/m4/tokenizer.l Modified: stable/9/usr.bin/m4/Makefile stable/9/usr.bin/m4/TEST/ack.m4 stable/9/usr.bin/m4/TEST/hanoi.m4 stable/9/usr.bin/m4/TEST/hash.m4 stable/9/usr.bin/m4/TEST/sqroot.m4 stable/9/usr.bin/m4/TEST/string.m4 stable/9/usr.bin/m4/TEST/test.m4 stable/9/usr.bin/m4/eval.c stable/9/usr.bin/m4/expr.c stable/9/usr.bin/m4/extern.h stable/9/usr.bin/m4/gnum4.c stable/9/usr.bin/m4/look.c stable/9/usr.bin/m4/m4.1 stable/9/usr.bin/m4/main.c stable/9/usr.bin/m4/mdef.h stable/9/usr.bin/m4/misc.c stable/9/usr.bin/m4/pathnames.h stable/9/usr.bin/m4/stdd.h stable/9/usr.bin/m4/trace.c Directory Properties: stable/9/usr.bin/m4/ (props changed) Modified: stable/9/usr.bin/m4/Makefile ============================================================================== --- stable/9/usr.bin/m4/Makefile Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/Makefile Thu Dec 12 15:04:59 2013 (r259262) @@ -5,10 +5,21 @@ # if you want the paste & spaste macros. PROG= m4 -CFLAGS+=-DEXTENDED +CFLAGS+=-DEXTENDED -I${.CURDIR}/lib +DPADD= ${LIBY} ${LIBL} ${LIBM} +LDADD= -ly -ll -lm +# clang needs 1 while with gcc we can use 2 +#WARNS= 1 -SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c +SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l +.PATH: ${.CURDIR}/lib +SRCS+= ohash_create_entry.c ohash_delete.c ohash_do.c ohash_entries.c \ + ohash_enum.c ohash_init.c ohash_int.h ohash_interval.c \ + ohash_lookup_interval.c ohash_lookup_memory.c ohash_qlookup.c \ + ohash_qlookupi.c -WARNS?= 0 +tokenizer.o: parser.h + +CLEANFILES+= parser.c parser.h tokenizer.o .include Modified: stable/9/usr.bin/m4/TEST/ack.m4 ============================================================================== --- stable/9/usr.bin/m4/TEST/ack.m4 Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/TEST/ack.m4 Thu Dec 12 15:04:59 2013 (r259262) @@ -1,4 +1,4 @@ -# $OpenBSD: ack.m4,v 1.2 1996/06/26 05:36:18 deraadt Exp $ +# $OpenBSD: ack.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: ack.m4,v 1.4 1995/09/28 05:37:54 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,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. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # Modified: stable/9/usr.bin/m4/TEST/hanoi.m4 ============================================================================== --- stable/9/usr.bin/m4/TEST/hanoi.m4 Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/TEST/hanoi.m4 Thu Dec 12 15:04:59 2013 (r259262) @@ -1,4 +1,4 @@ -# $OpenBSD: hanoi.m4,v 1.2 1996/06/26 05:36:19 deraadt Exp $ +# $OpenBSD: hanoi.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: hanoi.m4,v 1.4 1995/09/28 05:37:56 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,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. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # Modified: stable/9/usr.bin/m4/TEST/hash.m4 ============================================================================== --- stable/9/usr.bin/m4/TEST/hash.m4 Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/TEST/hash.m4 Thu Dec 12 15:04:59 2013 (r259262) @@ -1,4 +1,4 @@ -# $OpenBSD: hash.m4,v 1.2 1996/06/26 05:36:19 deraadt Exp $ +# $OpenBSD: hash.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: hash.m4,v 1.4 1995/09/28 05:37:58 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,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. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # Modified: stable/9/usr.bin/m4/TEST/sqroot.m4 ============================================================================== --- stable/9/usr.bin/m4/TEST/sqroot.m4 Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/TEST/sqroot.m4 Thu Dec 12 15:04:59 2013 (r259262) @@ -1,4 +1,4 @@ -# $OpenBSD: sqroot.m4,v 1.2 1996/06/26 05:36:20 deraadt Exp $ +# $OpenBSD: sqroot.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: sqroot.m4,v 1.4 1995/09/28 05:38:01 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,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. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # Modified: stable/9/usr.bin/m4/TEST/string.m4 ============================================================================== --- stable/9/usr.bin/m4/TEST/string.m4 Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/TEST/string.m4 Thu Dec 12 15:04:59 2013 (r259262) @@ -1,4 +1,4 @@ -# $OpenBSD: string.m4,v 1.2 1996/06/26 05:36:20 deraadt Exp $ +# $OpenBSD: string.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: string.m4,v 1.4 1995/09/28 05:38:03 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,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. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # Modified: stable/9/usr.bin/m4/TEST/test.m4 ============================================================================== --- stable/9/usr.bin/m4/TEST/test.m4 Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/TEST/test.m4 Thu Dec 12 15:04:59 2013 (r259262) @@ -1,4 +1,4 @@ -# $OpenBSD: test.m4,v 1.2 1996/06/26 05:36:21 deraadt Exp $ +# $OpenBSD: test.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: test.m4,v 1.4 1995/09/28 05:38:05 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,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. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # Modified: stable/9/usr.bin/m4/eval.c ============================================================================== --- stable/9/usr.bin/m4/eval.c Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/eval.c Thu Dec 12 15:04:59 2013 (r259262) @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $ */ +/* $OpenBSD: eval.c,v 1.70 2012/04/12 17:00:11 espie Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* @@ -16,7 +16,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. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -33,19 +33,10 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95"; -#else -#if 0 -static char rcsid[] = "$OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $"; -#endif -#endif -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); + /* * eval.c * Facility: m4 macro processor @@ -53,21 +44,21 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include +#include #include +#include #include #include #include #include #include -#include #include "mdef.h" #include "stdd.h" #include "extern.h" #include "pathnames.h" -#define BUILTIN_MARKER "__builtin_" - static void dodefn(const char *); static void dopushdef(const char *, const char *); static void dodump(const char *[], int); @@ -75,10 +66,9 @@ static void dotrace(const char *[], int, static void doifelse(const char *[], int); static int doincl(const char *); static int dopaste(const char *); -static void gnu_dochq(const char *[], int); static void dochq(const char *[], int); -static void gnu_dochc(const char *[], int); static void dochc(const char *[], int); +static void dom4wrap(const char *); static void dodiv(int); static void doundiv(const char *[], int); static void dosub(const char *[], int); @@ -86,7 +76,7 @@ static void map(char *, const char *, co static const char *handledash(char *, char *, const char *); static void expand_builtin(const char *[], int, int); static void expand_macro(const char *[], int); -static void dump_one_def(ndptr); +static void dump_one_def(const char *, struct macro_definition *); unsigned long expansion_id; @@ -95,7 +85,7 @@ unsigned long expansion_id; * argc - number of elements in argv. * argv - element vector : * argv[0] = definition of a user - * macro or nil if built-in. + * macro or NULL if built-in. * argv[1] = name of the macro or * built-in. * argv[2] = parameters to user-defined @@ -110,21 +100,20 @@ unsigned long expansion_id; * argc is 3 for macro-or-builtin() and 2 for macro-or-builtin */ void -eval(const char *argv[], int argc, int td) +eval(const char *argv[], int argc, int td, int is_traced) { - ssize_t mark = -1; + size_t mark = SIZE_MAX; expansion_id++; if (td & RECDEF) - errx(1, "%s at line %lu: expanding recursive definition for %s", - CURRENT_NAME, CURRENT_LINE, argv[1]); - if (traced_macros && is_traced(argv[1])) + m4errx(1, "expanding recursive definition for %s.", argv[1]); + if (is_traced) mark = trace(argv, argc, infile+ilevel); if (td == MACRTYPE) expand_macro(argv, argc); else expand_builtin(argv, argc, td); - if (mark != -1) + if (mark != SIZE_MAX) finish_trace(mark); } @@ -150,9 +139,12 @@ expand_builtin(const char *argv[], int a * have macro-or-builtin() type call. We adjust * argc to avoid further checking.. */ - ac = argc; + /* we keep the initial value for those built-ins that differentiate + * between builtin() and builtin. + */ + ac = argc; - if (argc == 3 && !*(argv[2])) + if (argc == 3 && !*(argv[2]) && !mimic_gnu) argc--; switch (td & TYPEMASK) { @@ -184,9 +176,27 @@ expand_builtin(const char *argv[], int a * doexpr - evaluate arithmetic * expression */ + { + int base = 10; + int maxdigits = 0; + const char *errstr; + + if (argc > 3) { + base = strtonum(argv[3], 2, 36, &errstr); + if (errstr) { + m4errx(1, "expr: base %s invalid.", argv[3]); + } + } + if (argc > 4) { + maxdigits = strtonum(argv[4], 0, INT_MAX, &errstr); + if (errstr) { + m4errx(1, "expr: maxdigits %s invalid.", argv[4]); + } + } if (argc > 2) - pbnum(expr(argv[2])); + pbnumbase(expr(argv[2]), base, maxdigits); break; + } case IFELTYPE: if (argc > 4) @@ -200,7 +210,7 @@ expand_builtin(const char *argv[], int a * another definition */ if (argc > 3) { - if (lookup(argv[2]) != nil) + if (lookup_macro_definition(argv[2]) != NULL) pbstr(argv[3]); else if (argc > 4) pbstr(argv[4]); @@ -238,7 +248,7 @@ expand_builtin(const char *argv[], int a * dosys - execute system command */ if (argc > 2) { - fflush(NULL); + fflush(stdout); sysval = system(argv[2]); } break; @@ -255,12 +265,18 @@ expand_builtin(const char *argv[], int a case ESYSCMDTYPE: if (argc > 2) doesyscmd(argv[2]); - break; + break; case INCLTYPE: if (argc > 2) - if (!doincl(argv[2])) - err(1, "%s at line %lu: include(%s)", - CURRENT_NAME, CURRENT_LINE, argv[2]); + if (!doincl(argv[2])) { + if (mimic_gnu) { + warn("%s at line %lu: include(%s)", + CURRENT_NAME, CURRENT_LINE, argv[2]); + exit_code = 1; + } else + err(1, "%s at line %lu: include(%s)", + CURRENT_NAME, CURRENT_LINE, argv[2]); + } break; case SINCTYPE: @@ -271,7 +287,7 @@ expand_builtin(const char *argv[], int a case PASTTYPE: if (argc > 2) if (!dopaste(argv[2])) - err(1, "%s at line %lu: paste(%s)", + err(1, "%s at line %lu: paste(%s)", CURRENT_NAME, CURRENT_LINE, argv[2]); break; @@ -279,19 +295,16 @@ expand_builtin(const char *argv[], int a if (argc > 2) (void) dopaste(argv[2]); break; + case FORMATTYPE: + doformat(argv, argc); + break; #endif case CHNQTYPE: - if (mimic_gnu) - gnu_dochq(argv, ac); - else - dochq(argv, argc); + dochq(argv, ac); break; case CHNCTYPE: - if (mimic_gnu) - gnu_dochc(argv, ac); - else - dochc(argv, argc); + dochc(argv, argc); break; case SUBSTYPE: @@ -314,7 +327,7 @@ expand_builtin(const char *argv[], int a pbstr(rquote); pbstr(argv[n]); pbstr(lquote); - putback(COMMA); + pushback(COMMA); } pbstr(rquote); pbstr(argv[3]); @@ -350,7 +363,7 @@ expand_builtin(const char *argv[], int a */ if (argc > 2) for (n = 2; n < argc; n++) - remhash(argv[n], ALL); + macro_undefine(argv[n]); break; case POPDTYPE: @@ -361,7 +374,7 @@ expand_builtin(const char *argv[], int a */ if (argc > 2) for (n = 2; n < argc; n++) - remhash(argv[n], TOP); + macro_popdef(argv[n]); break; case MKTMTYPE: @@ -395,7 +408,7 @@ expand_builtin(const char *argv[], int a if (argc > 3) { char *temp; - temp = xalloc(strlen(argv[2])+1); + temp = xalloc(strlen(argv[2])+1, NULL); if (argc > 4) map(temp, argv[2], argv[3], argv[4]); else @@ -441,7 +454,8 @@ expand_builtin(const char *argv[], int a * dom4wrap - set up for * wrap-up/wind-down activity */ - m4wraps = (argc > 2) ? xstrdup(argv[2]) : null; + if (argc > 2) + dom4wrap(argv[2]); break; case EXITTYPE: @@ -488,8 +502,7 @@ expand_builtin(const char *argv[], int a pbstr(lquote); break; default: - errx(1, "%s at line %lu: eval: major botch.", - CURRENT_NAME, CURRENT_LINE); + m4errx(1, "eval: major botch."); break; } } @@ -512,7 +525,7 @@ expand_macro(const char *argv[], int arg p--; /* last character of defn */ while (p > t) { if (*(p - 1) != ARGFLAG) - PUTBACK(*p); + PUSHBACK(*p); else { switch (*p) { @@ -536,10 +549,10 @@ expand_macro(const char *argv[], int arg if (argc > 2) { for (n = argc - 1; n > 2; n--) { pbstr(argv[n]); - putback(COMMA); + pushback(COMMA); } pbstr(argv[2]); - } + } break; case '@': if (argc > 2) { @@ -547,7 +560,7 @@ expand_macro(const char *argv[], int arg pbstr(rquote); pbstr(argv[n]); pbstr(lquote); - putback(COMMA); + pushback(COMMA); } pbstr(rquote); pbstr(argv[2]); @@ -555,8 +568,8 @@ expand_macro(const char *argv[], int arg } break; default: - PUTBACK(*p); - PUTBACK('$'); + PUSHBACK(*p); + PUSHBACK('$'); break; } p--; @@ -564,42 +577,20 @@ expand_macro(const char *argv[], int arg p--; } if (p == t) /* do last character */ - PUTBACK(*p); + PUSHBACK(*p); } + /* * dodefine - install definition in the table */ void dodefine(const char *name, const char *defn) { - ndptr p; - int n; - - if (!*name) - errx(1, "%s at line %lu: null definition.", CURRENT_NAME, - CURRENT_LINE); - if ((p = lookup(name)) == nil) - p = addent(name); - else if (p->defn != null) - free((char *) p->defn); - if (strncmp(defn, BUILTIN_MARKER, sizeof(BUILTIN_MARKER)-1) == 0) { - n = builtin_type(defn+sizeof(BUILTIN_MARKER)-1); - if (n != -1) { - p->type = n & TYPEMASK; - if ((n & NOARGS) == 0) - p->type |= NEEDARGS; - p->defn = null; - return; - } - } - if (!*defn) - p->defn = null; + if (!*name && !mimic_gnu) + m4errx(1, "null definition."); else - p->defn = xstrdup(defn); - p->type = MACRTYPE; - if (STREQ(name, defn)) - p->type |= RECDEF; + macro_define(name, defn); } /* @@ -609,16 +600,15 @@ dodefine(const char *name, const char *d static void dodefn(const char *name) { - ndptr p; - const char *real; + struct macro_definition *p; - if ((p = lookup(name)) != nil) { - if (p->defn != null) { + if ((p = lookup_macro_definition(name)) != NULL) { + if ((p->type & TYPEMASK) == MACRTYPE) { pbstr(rquote); pbstr(p->defn); pbstr(lquote); - } else if ((real = builtin_realname(p->type)) != NULL) { - pbstr(real); + } else { + pbstr(p->defn); pbstr(BUILTIN_MARKER); } } @@ -634,40 +624,28 @@ dodefn(const char *name) static void dopushdef(const char *name, const char *defn) { - ndptr p; - - if (!*name) - errx(1, "%s at line %lu: null definition", CURRENT_NAME, - CURRENT_LINE); - p = addent(name); - if (!*defn) - p->defn = null; + if (!*name && !mimic_gnu) + m4errx(1, "null definition."); else - p->defn = xstrdup(defn); - p->type = MACRTYPE; - if (STREQ(name, defn)) - p->type |= RECDEF; + macro_pushdef(name, defn); } /* * dump_one_def - dump the specified definition. */ static void -dump_one_def(ndptr p) +dump_one_def(const char *name, struct macro_definition *p) { - const char *real; - + if (!traceout) + traceout = stderr; if (mimic_gnu) { if ((p->type & TYPEMASK) == MACRTYPE) - fprintf(traceout, "%s:\t%s\n", p->name, p->defn); + fprintf(traceout, "%s:\t%s\n", name, p->defn); else { - real = builtin_realname(p->type); - if (real == NULL) - real = null; - fprintf(traceout, "%s:\t<%s>\n", p->name, real); - } + fprintf(traceout, "%s:\t<%s>\n", name, p->defn); + } } else - fprintf(traceout, "`%s'\t`%s'\n", p->name, p->defn); + fprintf(traceout, "`%s'\t`%s'\n", name, p->defn); } /* @@ -679,17 +657,14 @@ static void dodump(const char *argv[], int argc) { int n; - ndptr p; + struct macro_definition *p; if (argc > 2) { for (n = 2; n < argc; n++) - if ((p = lookup(argv[n])) != nil) - dump_one_def(p); - } else { - for (n = 0; n < HASHSIZE; n++) - for (p = hashtab[n]; p != nil; p = p->nxtptr) - dump_one_def(p); - } + if ((p = lookup_macro_definition(argv[n])) != NULL) + dump_one_def(argv[n], p); + } else + macro_for_all(dump_one_def); } /* @@ -734,15 +709,10 @@ static int doincl(const char *ifile) { if (ilevel + 1 == MAXINP) - errx(1, "%s at line %lu: too many include files.", - CURRENT_NAME, CURRENT_LINE); + m4errx(1, "too many include files."); if (fopen_trypath(infile+ilevel+1, ifile) != NULL) { ilevel++; - if ((inname[ilevel] = strdup(ifile)) == NULL) - err(1, NULL); - inlineno[ilevel] = 1; bbase[ilevel] = bufbase = bp; - emitline(); return (1); } else return (0); @@ -760,97 +730,74 @@ dopaste(const char *pfile) int c; if ((pf = fopen(pfile, "r")) != NULL) { - fprintf(active, "#line 1 \"%s\"\n", pfile); + if (synch_lines) + fprintf(active, "#line 1 \"%s\"\n", pfile); while ((c = getc(pf)) != EOF) putc(c, active); (void) fclose(pf); - emitline(); + emit_synchline(); return (1); } else return (0); } #endif +/* + * dochq - change quote characters + */ static void -gnu_dochq(const char *argv[], int ac) +dochq(const char *argv[], int ac) { - /* In gnu-m4 mode, the only way to restore quotes is to have no - * arguments at all. */ if (ac == 2) { - lquote[0] = LQUOTE, lquote[1] = EOS; - rquote[0] = RQUOTE, rquote[1] = EOS; + lquote[0] = LQUOTE; lquote[1] = EOS; + rquote[0] = RQUOTE; rquote[1] = EOS; } else { strlcpy(lquote, argv[2], sizeof(lquote)); - if(ac > 3) + if (ac > 3) { strlcpy(rquote, argv[3], sizeof(rquote)); - else - rquote[0] = EOS; + } else { + rquote[0] = ECOMMT; rquote[1] = EOS; + } } } /* - * dochq - change quote characters + * dochc - change comment characters */ static void -dochq(const char *argv[], int argc) -{ - if (argc > 2) { - if (*argv[2]) - strlcpy(lquote, argv[2], sizeof(lquote)); - else { - lquote[0] = LQUOTE; - lquote[1] = EOS; - } - if (argc > 3) { - if (*argv[3]) - strlcpy(rquote, argv[3], sizeof(rquote)); - } else - strcpy(rquote, lquote); - } else { - lquote[0] = LQUOTE, lquote[1] = EOS; - rquote[0] = RQUOTE, rquote[1] = EOS; - } -} - -static void -gnu_dochc(const char *argv[], int ac) +dochc(const char *argv[], int argc) { - /* In gnu-m4 mode, no arguments mean no comment - * arguments at all. */ - if (ac == 2) { +/* XXX Note that there is no difference between no argument and a single + * empty argument. + */ + if (argc == 2) { scommt[0] = EOS; ecommt[0] = EOS; } else { - if (*argv[2]) - strlcpy(scommt, argv[2], sizeof(scommt)); - else - scommt[0] = SCOMMT, scommt[1] = EOS; - if(ac > 3 && *argv[3]) + strlcpy(scommt, argv[2], sizeof(scommt)); + if (argc == 3) { + ecommt[0] = ECOMMT; ecommt[1] = EOS; + } else { strlcpy(ecommt, argv[3], sizeof(ecommt)); - else - ecommt[0] = ECOMMT, ecommt[1] = EOS; + } } } + /* - * dochc - change comment characters + * dom4wrap - expand text at EOF */ static void -dochc(const char *argv[], int argc) +dom4wrap(const char *text) { - if (argc > 2) { - if (*argv[2]) - strlcpy(scommt, argv[2], sizeof(scommt)); - if (argc > 3) { - if (*argv[3]) - strlcpy(ecommt, argv[3], sizeof(ecommt)); - } + if (wrapindex >= maxwraps) { + if (maxwraps == 0) + maxwraps = 16; else - ecommt[0] = ECOMMT, ecommt[1] = EOS; - } - else { - scommt[0] = SCOMMT, scommt[1] = EOS; - ecommt[0] = ECOMMT, ecommt[1] = EOS; + maxwraps *= 2; + m4wraps = xrealloc(m4wraps, maxwraps * sizeof(*m4wraps), + "too many m4wraps"); } + m4wraps[wrapindex++] = xstrdup(text); } /* @@ -867,14 +814,14 @@ dodiv(int n) resizedivs(n + 10); else n = 0; /* bitbucket */ - } + } if (n < 0) n = 0; /* bitbucket */ if (outfile[n] == NULL) { char fname[] = _PATH_DIVNAME; - if ((fd = mkstemp(fname)) < 0 || + if ((fd = mkstemp(fname)) < 0 || (outfile[n] = fdopen(fd, "w+")) == NULL) err(1, "%s: cannot divert", fname); if (unlink(fname) == -1) @@ -895,10 +842,15 @@ doundiv(const char *argv[], int argc) if (argc > 2) { for (ind = 2; ind < argc; ind++) { - n = atoi(argv[ind]); - if (n > 0 && n < maxout && outfile[n] != NULL) - getdiv(n); - + const char *errstr; + n = strtonum(argv[ind], 1, INT_MAX, &errstr); + if (errstr) { + if (errno == EINVAL && mimic_gnu) + getdivfile(argv[ind]); + } else { + if (n < maxout && outfile[n] != NULL) + getdiv(n); + } } } else @@ -931,7 +883,7 @@ dosub(const char *argv[], int argc) #endif if (fc >= ap && fc < ap + strlen(ap)) for (k = fc + nc - 1; k >= fc; k--) - putback(*k); + pushback(*k); } /* @@ -939,25 +891,11 @@ dosub(const char *argv[], int argc) * map every character of s1 that is specified in from * into s3 and replace in s. (source s1 remains untouched) * - * This is a standard implementation of map(s,from,to) function of ICON - * language. Within mapvec, we replace every character of "from" with - * the corresponding character in "to". If "to" is shorter than "from", - * than the corresponding entries are null, which means that those - * characters dissapear altogether. Furthermore, imagine - * map(dest, "sourcestring", "srtin", "rn..*") type call. In this case, - * `s' maps to `r', `r' maps to `n' and `n' maps to `*'. Thus, `s' - * ultimately maps to `*'. In order to achieve this effect in an efficient - * manner (i.e. without multiple passes over the destination string), we - * loop over mapvec, starting with the initial source character. if the - * character value (dch) in this location is different than the source - * character (sch), sch becomes dch, once again to index into mapvec, until - * the character value stabilizes (i.e. sch = dch, in other words - * mapvec[n] == n). Even if the entry in the mapvec is null for an ordinary - * character, it will stabilize, since mapvec[0] == 0 at all times. At the - * end, we restore mapvec* back to normal where mapvec[n] == n for - * 0 <= n <= 127. This strategy, along with the restoration of mapvec, is - * about 5 times faster than any algorithm that makes multiple passes over - * destination string. + * This is derived from the a standard implementation of map(s,from,to) + * function of ICON language. Within mapvec, we replace every character + * of "from" with the corresponding character in "to". + * If "to" is shorter than "from", than the corresponding entries are null, + * which means that those characters dissapear altogether. */ static void map(char *dest, const char *src, const char *from, const char *to) @@ -966,6 +904,8 @@ map(char *dest, const char *src, const c unsigned char sch, dch; static char frombis[257]; static char tobis[257]; + int i; + char seen[256]; static unsigned char mapvec[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, @@ -1000,17 +940,21 @@ map(char *dest, const char *src, const c * create a mapping between "from" and * "to" */ - while (*from) - mapvec[(unsigned char)(*from++)] = (*to) ? - (unsigned char)(*to++) : 0; + for (i = 0; i < 256; i++) + seen[i] = 0; + while (*from) { + if (!seen[(unsigned char)(*from)]) { + mapvec[(unsigned char)(*from)] = (unsigned char)(*to); + seen[(unsigned char)(*from)] = 1; + } + from++; + if (*to) + to++; + } while (*src) { sch = (unsigned char)(*src++); dch = mapvec[sch]; - while (dch != sch) { - sch = dch; - dch = mapvec[sch]; - } if ((*dest = (char)dch)) dest++; } @@ -1040,12 +984,23 @@ handledash(char *buffer, char *end, cons while(*src) { if (src[1] == '-' && src[2]) { unsigned char i; - for (i = (unsigned char)src[0]; - i <= (unsigned char)src[2]; i++) { - *p++ = i; - if (p == end) { - *p = '\0'; - return buffer; + if ((unsigned char)src[0] <= (unsigned char)src[2]) { + for (i = (unsigned char)src[0]; + i <= (unsigned char)src[2]; i++) { + *p++ = i; + if (p == end) { + *p = '\0'; + return buffer; + } + } + } else { + for (i = (unsigned char)src[0]; + i >= (unsigned char)src[2]; i--) { + *p++ = i; + if (p == end) { + *p = '\0'; + return buffer; + } } } src += 3; Modified: stable/9/usr.bin/m4/expr.c ============================================================================== --- stable/9/usr.bin/m4/expr.c Thu Dec 12 14:49:26 2013 (r259261) +++ stable/9/usr.bin/m4/expr.c Thu Dec 12 15:04:59 2013 (r259262) @@ -1,641 +1,47 @@ -/* $OpenBSD: expr.c,v 1.14 2002/04/26 16:15:16 espie Exp $ */ -/* $NetBSD: expr.c,v 1.7 1995/09/28 05:37:31 tls Exp $ */ - +/* $OpenBSD: expr.c,v 1.18 2010/09/07 19:58:09 marco Exp $ */ /* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ozan Yigit at York University. - * - * 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. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * Copyright (c) 2004 Marc Espie * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)expr.c 8.2 (Berkeley) 4/29/95"; -#else -#if 0 -static char rcsid[] = "$OpenBSD: expr.c,v 1.14 2002/04/26 16:15:16 espie Exp $"; -#endif -#endif -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include +#include #include +#include #include "mdef.h" #include "extern.h" -/* - * expression evaluator: performs a standard recursive - * descent parse to evaluate any expression permissible - * within the following grammar: - * - * expr : query EOS - * query : lor - * | lor "?" query ":" query - * lor : land { "||" land } - * land : bor { "&&" bor } - * bor : xor { "|" xor } - * xor : band { "^" eqrel } - * band : eqrel { "&" eqrel } - * eqrel : nerel { ("==" | "!=") nerel } - * nerel : shift { ("<" | ">" | "<=" | ">=") shift } - * shift : primary { ("<<" | ">>") primary } - * primary : term { ("+" | "-") term } - * term : exp { ("*" | "/" | "%") exp } - * exp : unary { "**" unary } - * unary : factor - * | ("+" | "-" | "~" | "!") unary - * factor : constant *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 16:18:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE8CB2B3; Thu, 12 Dec 2013 16:18:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 98A151FD8; Thu, 12 Dec 2013 16:18:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCGIkMP078952; Thu, 12 Dec 2013 16:18:46 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCGIjhs078943; Thu, 12 Dec 2013 16:18:45 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312121618.rBCGIjhs078943@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 12 Dec 2013 16:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259263 - in stable/8/contrib/libstdc++: include/debug include/ext libsupc++ src X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 16:18:46 -0000 Author: pfg Date: Thu Dec 12 16:18:45 2013 New Revision: 259263 URL: http://svnweb.freebsd.org/changeset/base/259263 Log: MFC r241959: Fix a number of other clang warnings in libstdc++, which could appear when building other C++ software with it. Also fix one actual bug in libsupc++, which was exposed by such a warning. This latter fix is the only functional change. This is required for newer versions of gcc and clang which have stricter warnings about parenthesis in C++ programs. Modified: stable/8/contrib/libstdc++/include/debug/safe_iterator.tcc stable/8/contrib/libstdc++/include/ext/ropeimpl.h stable/8/contrib/libstdc++/libsupc++/tinfo.cc stable/8/contrib/libstdc++/src/locale.cc stable/8/contrib/libstdc++/src/strstream.cc stable/8/contrib/libstdc++/src/tree.cc Directory Properties: stable/8/ (props changed) stable/8/contrib/ (props changed) stable/8/contrib/libstdc++/ (props changed) Modified: stable/8/contrib/libstdc++/include/debug/safe_iterator.tcc ============================================================================== --- stable/8/contrib/libstdc++/include/debug/safe_iterator.tcc Thu Dec 12 15:04:59 2013 (r259262) +++ stable/8/contrib/libstdc++/include/debug/safe_iterator.tcc Thu Dec 12 16:18:45 2013 (r259263) @@ -54,8 +54,8 @@ namespace __gnu_debug static_cast(_M_sequence)->begin(); std::pair __dist = this->_M_get_distance(__begin, *this); - bool __ok = (__dist.second == __dp_exact && __dist.first >= -__n - || __dist.second != __dp_exact && __dist.first > 0); + bool __ok = ((__dist.second == __dp_exact && __dist.first >= -__n) + || (__dist.second != __dp_exact && __dist.first > 0)); return __ok; } else @@ -64,8 +64,8 @@ namespace __gnu_debug static_cast(_M_sequence)->end(); std::pair __dist = this->_M_get_distance(*this, __end); - bool __ok = (__dist.second == __dp_exact && __dist.first >= __n - || __dist.second != __dp_exact && __dist.first > 0); + bool __ok = ((__dist.second == __dp_exact && __dist.first >= __n) + || (__dist.second != __dp_exact && __dist.first > 0)); return __ok; } } Modified: stable/8/contrib/libstdc++/include/ext/ropeimpl.h ============================================================================== --- stable/8/contrib/libstdc++/include/ext/ropeimpl.h Thu Dec 12 15:04:59 2013 (r259262) +++ stable/8/contrib/libstdc++/include/ext/ropeimpl.h Thu Dec 12 16:18:45 2013 (r259263) @@ -1143,7 +1143,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) } else { - char* __kind; + const char* __kind; switch (__r->_M_tag) { Modified: stable/8/contrib/libstdc++/libsupc++/tinfo.cc ============================================================================== --- stable/8/contrib/libstdc++/libsupc++/tinfo.cc Thu Dec 12 15:04:59 2013 (r259262) +++ stable/8/contrib/libstdc++/libsupc++/tinfo.cc Thu Dec 12 16:18:45 2013 (r259263) @@ -499,9 +499,9 @@ __do_dyncast (ptrdiff_t src2dst, result.whole2dst = __sub_kind (result.whole2dst | result2.whole2dst); } - else if ((result.dst_ptr != 0 & result2.dst_ptr != 0) - || (result.dst_ptr != 0 & result2_ambig) - || (result2.dst_ptr != 0 & result_ambig)) + else if ((result.dst_ptr != 0 && result2.dst_ptr != 0) + || (result.dst_ptr != 0 && result2_ambig) + || (result2.dst_ptr != 0 && result_ambig)) { // Found two different DST_TYPE bases, or a valid one and a set of // ambiguous ones, must disambiguate. See whether SRC_PTR is Modified: stable/8/contrib/libstdc++/src/locale.cc ============================================================================== --- stable/8/contrib/libstdc++/src/locale.cc Thu Dec 12 15:04:59 2013 (r259262) +++ stable/8/contrib/libstdc++/src/locale.cc Thu Dec 12 16:18:45 2013 (r259263) @@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) locale::_S_normalize_category(category __cat) { int __ret = 0; - if (__cat == none || (__cat & all) && !(__cat & ~all)) + if (__cat == none || ((__cat & all) && !(__cat & ~all))) __ret = __cat; else { Modified: stable/8/contrib/libstdc++/src/strstream.cc ============================================================================== --- stable/8/contrib/libstdc++/src/strstream.cc Thu Dec 12 15:04:59 2013 (r259262) +++ stable/8/contrib/libstdc++/src/strstream.cc Thu Dec 12 16:18:45 2013 (r259263) @@ -311,10 +311,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) strstreambuf::_M_free(char* p) { if (p) - if (_M_free_fun) - _M_free_fun(p); - else - delete[] p; + { + if (_M_free_fun) + _M_free_fun(p); + else + delete[] p; + } } void Modified: stable/8/contrib/libstdc++/src/tree.cc ============================================================================== --- stable/8/contrib/libstdc++/src/tree.cc Thu Dec 12 15:04:59 2013 (r259262) +++ stable/8/contrib/libstdc++/src/tree.cc Thu Dec 12 16:18:45 2013 (r259263) @@ -316,17 +316,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std) else __z->_M_parent->_M_right = __x; if (__leftmost == __z) - if (__z->_M_right == 0) // __z->_M_left must be null also - __leftmost = __z->_M_parent; - // makes __leftmost == _M_header if __z == __root - else - __leftmost = _Rb_tree_node_base::_S_minimum(__x); + { + if (__z->_M_right == 0) // __z->_M_left must be null also + __leftmost = __z->_M_parent; + // makes __leftmost == _M_header if __z == __root + else + __leftmost = _Rb_tree_node_base::_S_minimum(__x); + } if (__rightmost == __z) - if (__z->_M_left == 0) // __z->_M_right must be null also - __rightmost = __z->_M_parent; - // makes __rightmost == _M_header if __z == __root - else // __x == __z->_M_left - __rightmost = _Rb_tree_node_base::_S_maximum(__x); + { + if (__z->_M_left == 0) // __z->_M_right must be null also + __rightmost = __z->_M_parent; + // makes __rightmost == _M_header if __z == __root + else // __x == __z->_M_left + __rightmost = _Rb_tree_node_base::_S_maximum(__x); + } } if (__y->_M_color != _S_red) { From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 18:15:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E9D1BDDA; Thu, 12 Dec 2013 18:15:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D2F1D19ED; Thu, 12 Dec 2013 18:15:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCIFauQ022120; Thu, 12 Dec 2013 18:15:36 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCIFX9b022103; Thu, 12 Dec 2013 18:15:33 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312121815.rBCIFX9b022103@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 12 Dec 2013 18:15:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259268 - in stable/10/contrib: gcc gcc/config/rs6000 gcc/cp gcc/doc gcclibs/libcpp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 18:15:37 -0000 Author: pfg Date: Thu Dec 12 18:15:32 2013 New Revision: 259268 URL: http://svnweb.freebsd.org/changeset/base/259268 Log: MFC r258081, r258138, r258143, r258179, r258157, r258204, 258205, r258206, r258207, r258321 This is a series of commits inspired on Google's gcc-4.2.1 for Android that were taken from the gcc pre-4.3 under the GPLv2. gcc: Backport fixes for -W parentheses in C++ This fixes GCC 19564. gcc: merge rs6000 change from FSF pre-gcc43 Don't set MASK_PPC_GFXOPT for 8540 or 8548. Merge vrp-tree fix from gcc-4.3 Fix missed conversion from / to >> (GCC PR32521) Merge in GCCr120505 to include definition of TREE_OVERFLOW_P gcc: warn about integer overflow in constant expressions in the C++ frontend. gcc: Add a new option -Wvla to warn variable length array. libcpp: preprocessor speedup patches from upstream gcc. gcc: add femit-struct-debug support to reduce Reduce dwarf debug size gcc: Fix postreload-gcse treatment of call-clobbered registers. gcc: Record some previous commits in the ChangeLog.gcc43 file. Modified: stable/10/contrib/gcc/ChangeLog.gcc43 stable/10/contrib/gcc/c-common.c stable/10/contrib/gcc/c-common.h stable/10/contrib/gcc/c-decl.c stable/10/contrib/gcc/c-opts.c stable/10/contrib/gcc/c-typeck.c stable/10/contrib/gcc/c.opt stable/10/contrib/gcc/config/rs6000/rs6000.c stable/10/contrib/gcc/cp/cp-lang.c stable/10/contrib/gcc/cp/cp-tree.h stable/10/contrib/gcc/cp/decl.c stable/10/contrib/gcc/cp/parser.c stable/10/contrib/gcc/cp/pt.c stable/10/contrib/gcc/cp/semantics.c stable/10/contrib/gcc/cp/tree.c stable/10/contrib/gcc/cp/typeck.c stable/10/contrib/gcc/doc/invoke.texi stable/10/contrib/gcc/dwarf2out.c stable/10/contrib/gcc/flags.h stable/10/contrib/gcc/langhooks-def.h stable/10/contrib/gcc/langhooks.h stable/10/contrib/gcc/opts.c stable/10/contrib/gcc/postreload-gcse.c stable/10/contrib/gcc/regs.h stable/10/contrib/gcc/rtlanal.c stable/10/contrib/gcc/tree-vrp.c stable/10/contrib/gcc/tree.h stable/10/contrib/gcclibs/libcpp/files.c stable/10/contrib/gcclibs/libcpp/internal.h stable/10/contrib/gcclibs/libcpp/lex.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/ChangeLog.gcc43 Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/ChangeLog.gcc43 Thu Dec 12 18:15:32 2013 (r259268) @@ -1,9 +1,35 @@ -2007-06-05 Joerg Wunsch (r23479) +2007-08-08 Andrew Haley (r128087) + + * config/arm/libunwind.S (UNWIND_WRAPPER _Unwind_Backtrace): New. + * config/arm/unwind-arm.h (__gnu_Unwind_Backtrace): New. + * config/arm/unwind-arm.c (__gnu_Unwind_Backtrace): New. + +2007-06-05 Joerg Wunsch (r125346) PR preprocessor/23479 * doc/extend.texi: Document the 0b-prefixed binary integer constant extension. +2007-05-24 Richard Sandiford (r125037) + + * postreload-gcse.c (reg_changed_after_insn_p): New function. + (oprs_unchanged_p): Use it to check all registers in a REG. + (record_opr_changes): Look for clobbers in CALL_INSN_FUNCTION_USAGE. + (reg_set_between_after_reload_p): Delete. + (reg_used_between_after_reload_p): Likewise. + (reg_set_or_used_since_bb_start): Likewise. + (eliminate_partially_redundant_load): Use reg_changed_after_insn_p + and reg_used_between_p instead of reg_set_or_used_since_bb_start. + Use reg_set_between_p instead of reg_set_between_after_reload_p. + * rtlanal.c (reg_set_p): Check whether REG overlaps + regs_invalidated_by_call, rather than just checking the + membership of REGNO (REG). + +2007-05-03 Ian Lance Taylor (r124381) + + * config/rs6000/rs6000.c (rs6000_override_options): Don't set + MASK_PPC_GFXOPT for 8540 or 8548. + 2007-05-01 Dwarakanath Rajagopal (r124341) * doc/invoke.texi: Fix typo, 'AMD Family 10h core' instead of @@ -22,6 +48,57 @@ alignment for amdfam10 architecture. Increasing the max loop alignment to 24 bytes. +2007-04-16 Lawrence Crowl + + * doc/invoke.texi (Debugging Options): Add documentation for the + -femit-struct-debug options -femit-struct-debug-baseonly, + -femit-struct-debug-reduced, and + -femit-struct-debug-detailed[=...]. + + * c-opts.c (c_common_handle_option): Add + OPT_femit_struct_debug_baseonly, OPT_femit_struct_debug_reduced, + and OPT_femit_struct_debug_detailed_. + * c.opt: Add specifications for + -femit-struct-debug-baseonly, -femit-struct-debug-reduced, + and -femit-struct-debug-detailed[=...]. + * opts.c (set_struct_debug_option): Parse the + -femit-struct-debug-... options. + * opts.c (matches_main_base, main_input_basename, + main_input_baselength, base_of_path, matches_main_base): Add + variables and functions to compare header base name to compilation + unit base name. + * opts.c (should_emit_struct_debug): Add to determine to emit a + structure based on the option. + (dump_struct_debug) Also disabled function to debug this + function. + * opts.c (handle_options): Save the base name of the + compilation unit. + + * langhooks-def.h (LANG_HOOKS_GENERIC_TYPE_P): Define. + (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add. + This hook indicates if a type is generic. Set it by default + to "never generic". + * langhooks.h (struct lang_hooks_for_types): Add a new hook + to determine if a struct type is generic or not. + * cp/cp-tree.h (class_tmpl_impl_spec_p): Declare a C++ hook. + * cp/tree.c (class_tmpl_impl_spec_p): Implement the C++ hook. + * cp/cp-lang.c (LANG_HOOKS_GENERIC_TYPE_P): Override null C hook + with live C++ hook. + + * flags.h (enum debug_info_usage): Add an enumeration to describe + a program's use of a structure type. + * dwarf2out.c (gen_struct_or_union_type_die): Add a new parameter + to indicate the program's usage of the type. Filter structs based + on the -femit-struct-debug-... specification. + (gen_type_die): Split into two routines, gen_type_die and + gen_type_die_with_usage. gen_type_die is now a wrapper + that assumes direct usage. + (gen_type_die_with_usage): Replace calls to gen_type_die + with gen_type_die_with_usage adding the program usage of + the referenced type. + (dwarf2out_imported_module_or_decl): Suppress struct debug + information using should_emit_struct_debug when appropriate. + 2007-04-12 Richard Guenther (r123736) PR tree-optimization/24689 @@ -44,6 +121,19 @@ * config/i386/i386.c (override_options): Likewise. * doc/invoke.texi: Likewise. +2007-03-12 Seongbae Park + + * c-decl.c (warn_variable_length_array): New function. + Refactored from grokdeclarator to handle warn_vla + and handle unnamed array case. + (grokdeclarator): Refactored VLA warning case. + * c.opt (Wvla): New flag. + +2007-03-11 Ian Lance Taylor (r122831 - partial) + + * tree-vrp.c (vrp_int_const_binop): Handle PLUS_EXPR and + the *_DIV_EXPR codes correctly with overflow infinities. + 2007-02-09 Dwarakanath Rajagopal (r121763) * config/i386/driver-i386.c: Turn on -mtune=native for AMDFAM10. @@ -232,6 +322,17 @@ * config.gcc: Support core2 processor. +2006-12-13 Ian Lance Taylor (r119855) + + PR c++/19564 + PR c++/19756 + * c-typeck.c (parser_build_binary_op): Move parentheses warnings + to warn_about_parentheses in c-common.c. + * c-common.c (warn_about_parentheses): New function. + * c-common.h (warn_about_parentheses): Declare. + * doc/invoke.texi (Warning Options): Update -Wparentheses + description. + 2006-12-02 H.J. Lu (r119454 - partial) PR target/30040 @@ -270,6 +371,35 @@ (override_options): Add entries for Core2. (ix86_issue_rate): Add case for Core2. +2006-10-31 Geoffrey Keating (r118356) + + * c-decl.c (grokdeclarator): Don't set DECL_EXTERNAL on + inline static functions in c99 mode. + + PR 16622 + * doc/extend.texi (Inline): Update. + * c-tree.h (struct language_function): Remove field 'extern_inline'. + * c-decl.c (current_extern_inline): Delete. + (pop_scope): Adjust test for an undefined nested function. + Add warning about undeclared inline function. + (diagnose_mismatched_decls): Update comments. Disallow overriding + of inline functions in a translation unit in C99. Allow inline + declarations in C99 at any time. + (merge_decls): Boolize variables. Handle C99 'extern inline' + semantics. + (grokdeclarator): Set DECL_EXTERNAL here for functions. Handle + C99 inline semantics. + (start_function): Don't clear current_extern_inline. Don't set + DECL_EXTERNAL. + (c_push_function_context): Don't push current_extern_inline. + (c_pop_function_context): Don't restore current_extern_inline. + + PR 11377 + * c-typeck.c (build_external_ref): Warn about static variables + used in extern inline functions. + * c-decl.c (start_decl): Warn about static variables declared + in extern inline functions. + 2006-10-27 Vladimir Makarov (r118090) * config/i386/i386.h (TARGET_GEODE): Modified: stable/10/contrib/gcc/c-common.c ============================================================================== --- stable/10/contrib/gcc/c-common.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/c-common.c Thu Dec 12 18:15:32 2013 (r259268) @@ -2585,9 +2585,13 @@ c_common_truthvalue_conversion (tree exp break; case MODIFY_EXPR: - if (!TREE_NO_WARNING (expr)) - warning (OPT_Wparentheses, - "suggest parentheses around assignment used as truth value"); + if (!TREE_NO_WARNING (expr) + && warn_parentheses) + { + warning (OPT_Wparentheses, + "suggest parentheses around assignment used as truth value"); + TREE_NO_WARNING (expr) = 1; + } break; default: @@ -6471,5 +6475,87 @@ warn_array_subscript_with_type_char (tre warning (OPT_Wchar_subscripts, "array subscript has type %"); } +/* Implement -Wparentheses for the unexpected C precedence rules, to + cover cases like x + y << z which readers are likely to + misinterpret. We have seen an expression in which CODE is a binary + operator used to combine expressions headed by CODE_LEFT and + CODE_RIGHT. CODE_LEFT and CODE_RIGHT may be ERROR_MARK, which + means that that side of the expression was not formed using a + binary operator, or it was enclosed in parentheses. */ + +void +warn_about_parentheses (enum tree_code code, enum tree_code code_left, + enum tree_code code_right) +{ + if (!warn_parentheses) + return; + + if (code == LSHIFT_EXPR || code == RSHIFT_EXPR) + { + if (code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around + or - inside shift"); + } + + if (code == TRUTH_ORIF_EXPR) + { + if (code_left == TRUTH_ANDIF_EXPR + || code_right == TRUTH_ANDIF_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around && within ||"); + } + + if (code == BIT_IOR_EXPR) + { + if (code_left == BIT_AND_EXPR || code_left == BIT_XOR_EXPR + || code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == BIT_AND_EXPR || code_right == BIT_XOR_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around arithmetic in operand of |"); + /* Check cases like x|y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of |"); + } + + if (code == BIT_XOR_EXPR) + { + if (code_left == BIT_AND_EXPR + || code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == BIT_AND_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around arithmetic in operand of ^"); + /* Check cases like x^y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of ^"); + } + + if (code == BIT_AND_EXPR) + { + if (code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around + or - in operand of &"); + /* Check cases like x&y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of &"); + } + + /* Similarly, check for cases like 1<=i<=10 that are probably errors. */ + if (TREE_CODE_CLASS (code) == tcc_comparison + && (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison)) + warning (OPT_Wparentheses, "comparisons like X<=Y<=Z do not " + "have their mathematical meaning"); +} + #include "gt-c-common.h" Modified: stable/10/contrib/gcc/c-common.h ============================================================================== --- stable/10/contrib/gcc/c-common.h Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/c-common.h Thu Dec 12 18:15:32 2013 (r259268) @@ -850,6 +850,9 @@ extern int complete_array_type (tree *, extern tree builtin_type_for_size (int, bool); extern void warn_array_subscript_with_type_char (tree); +extern void warn_about_parentheses (enum tree_code, enum tree_code, + enum tree_code); + /* In c-gimplify.c */ extern void c_genericize (tree); Modified: stable/10/contrib/gcc/c-decl.c ============================================================================== --- stable/10/contrib/gcc/c-decl.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/c-decl.c Thu Dec 12 18:15:32 2013 (r259268) @@ -3931,6 +3931,61 @@ check_bitfield_type_and_width (tree *typ } + +/* Print warning about variable length array if necessary. */ + +static void +warn_variable_length_array (const char *name, tree size) +{ + int ped = !flag_isoc99 && pedantic && warn_vla != 0; + int const_size = TREE_CONSTANT (size); + + if (ped) + { + if (const_size) + { + if (name) + pedwarn ("ISO C90 forbids array %qs whose size " + "can%'t be evaluated", + name); + else + pedwarn ("ISO C90 forbids array whose size " + "can%'t be evaluated"); + } + else + { + if (name) + pedwarn ("ISO C90 forbids variable length array %qs", + name); + else + pedwarn ("ISO C90 forbids variable length array"); + } + } + else if (warn_vla > 0) + { + if (const_size) + { + if (name) + warning (OPT_Wvla, + "the size of array %qs can" + "%'t be evaluated", name); + else + warning (OPT_Wvla, + "the size of array can %'t be evaluated"); + } + else + { + if (name) + warning (OPT_Wvla, + "variable length array %qs is used", + name); + else + warning (OPT_Wvla, + "variable length array is used"); + } + } +} + /* Given declspecs and a declarator, determine the name and type of the object declared and construct a ..._DECL node for it. @@ -4329,17 +4384,7 @@ grokdeclarator (const struct c_declarato nonconstant even if it is (eg) a const variable with known value. */ size_varies = 1; - - if (!flag_isoc99 && pedantic) - { - if (TREE_CONSTANT (size)) - pedwarn ("ISO C90 forbids array %qs whose size " - "can%'t be evaluated", - name); - else - pedwarn ("ISO C90 forbids variable-size array %qs", - name); - } + warn_variable_length_array (orig_name, size); if (warn_variable_decl) warning (0, "variable-sized array %qs", name); } Modified: stable/10/contrib/gcc/c-opts.c ============================================================================== --- stable/10/contrib/gcc/c-opts.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/c-opts.c Thu Dec 12 18:15:32 2013 (r259268) @@ -818,6 +818,18 @@ c_common_handle_option (size_t scode, co flag_gen_declaration = 1; break; + case OPT_femit_struct_debug_baseonly: + set_struct_debug_option ("base"); + break; + + case OPT_femit_struct_debug_reduced: + set_struct_debug_option ("dir:ord:sys,dir:gen:any,ind:base"); + break; + + case OPT_femit_struct_debug_detailed_: + set_struct_debug_option (arg); + break; + case OPT_idirafter: add_path (xstrdup (arg), AFTER, 0, true); break; Modified: stable/10/contrib/gcc/c-typeck.c ============================================================================== --- stable/10/contrib/gcc/c-typeck.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/c-typeck.c Thu Dec 12 18:15:32 2013 (r259268) @@ -2631,73 +2631,7 @@ parser_build_binary_op (enum tree_code c /* Check for cases such as x+y< Detailed reduced debug info for structs + idirafter C ObjC C++ ObjC++ Joined Separate -idirafter Add to the end of the system include path Modified: stable/10/contrib/gcc/config/rs6000/rs6000.c ============================================================================== --- stable/10/contrib/gcc/config/rs6000/rs6000.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/config/rs6000/rs6000.c Thu Dec 12 18:15:32 2013 (r259268) @@ -1171,11 +1171,9 @@ rs6000_override_options (const char *def {"801", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"821", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"823", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, - {"8540", PROCESSOR_PPC8540, - POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_STRICT_ALIGN}, + {"8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN}, /* 8548 has a dummy entry for now. */ - {"8548", PROCESSOR_PPC8540, - POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_STRICT_ALIGN}, + {"8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN}, {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"970", PROCESSOR_POWER4, POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64}, Modified: stable/10/contrib/gcc/cp/cp-lang.c ============================================================================== --- stable/10/contrib/gcc/cp/cp-lang.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/cp/cp-lang.c Thu Dec 12 18:15:32 2013 (r259268) @@ -44,6 +44,8 @@ static void cp_init_ts (void); #define LANG_HOOKS_NAME "GNU C++" #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT cxx_init +#undef LANG_HOOKS_GENERIC_TYPE_P +#define LANG_HOOKS_GENERIC_TYPE_P class_tmpl_impl_spec_p #undef LANG_HOOKS_DECL_PRINTABLE_NAME #define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name #undef LANG_HOOKS_FOLD_OBJ_TYPE_REF Modified: stable/10/contrib/gcc/cp/cp-tree.h ============================================================================== --- stable/10/contrib/gcc/cp/cp-tree.h Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/cp/cp-tree.h Thu Dec 12 18:15:32 2013 (r259268) @@ -4373,6 +4373,7 @@ extern tree add_stmt_to_compound (tree, extern tree cxx_maybe_build_cleanup (tree); extern void init_tree (void); extern int pod_type_p (tree); +extern bool class_tmpl_impl_spec_p (tree); extern int zero_init_p (tree); extern tree canonical_type_variant (tree); extern tree copy_binfo (tree, tree, tree, @@ -4460,8 +4461,9 @@ extern tree build_x_indirect_ref (tree, extern tree build_indirect_ref (tree, const char *); extern tree build_array_ref (tree, tree); extern tree get_member_function_from_ptrfunc (tree *, tree); -extern tree build_x_binary_op (enum tree_code, tree, tree, - bool *); +extern tree build_x_binary_op (enum tree_code, tree, + enum tree_code, tree, + enum tree_code, bool *); extern tree build_x_unary_op (enum tree_code, tree); extern tree unary_complex_lvalue (enum tree_code, tree); extern tree build_x_conditional_expr (tree, tree, tree); Modified: stable/10/contrib/gcc/cp/decl.c ============================================================================== --- stable/10/contrib/gcc/cp/decl.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/cp/decl.c Thu Dec 12 18:15:32 2013 (r259268) @@ -6702,12 +6702,21 @@ compute_array_index_type (tree name, tre error ("size of array is not an integral constant-expression"); size = integer_one_node; } - else if (pedantic) + else if (pedantic && warn_vla != 0) { if (name) - pedwarn ("ISO C++ forbids variable-size array %qD", name); + pedwarn ("ISO C++ forbids variable length array %qD", name); else - pedwarn ("ISO C++ forbids variable-size array"); + pedwarn ("ISO C++ forbids variable length array"); + } + else if (warn_vla > 0) + { + if (name) + warning (OPT_Wvla, + "variable length array %qD is used", name); + else + warning (OPT_Wvla, + "variable length array is used"); } if (processing_template_decl && !TREE_CONSTANT (size)) Modified: stable/10/contrib/gcc/cp/parser.c ============================================================================== --- stable/10/contrib/gcc/cp/parser.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/cp/parser.c Thu Dec 12 18:15:32 2013 (r259268) @@ -1177,8 +1177,15 @@ typedef enum cp_parser_status_kind typedef struct cp_parser_expression_stack_entry { + /* Left hand side of the binary operation we are currently + parsing. */ tree lhs; + /* Original tree code for left hand side, if it was a binary + expression itself (used for -Wparentheses). */ + enum tree_code lhs_type; + /* Tree code for the binary operation we are parsing. */ enum tree_code tree_type; + /* Precedence of the binary operation we are parsing. */ int prec; } cp_parser_expression_stack_entry; @@ -1536,7 +1543,7 @@ static tree cp_parser_builtin_offsetof /* Statements [gram.stmt.stmt] */ static void cp_parser_statement - (cp_parser *, tree, bool); + (cp_parser *, tree, bool, bool *); static void cp_parser_label_for_labeled_statement (cp_parser *); static tree cp_parser_expression_statement @@ -1546,7 +1553,7 @@ static tree cp_parser_compound_statement static void cp_parser_statement_seq_opt (cp_parser *, tree); static tree cp_parser_selection_statement - (cp_parser *); + (cp_parser *, bool *); static tree cp_parser_condition (cp_parser *); static tree cp_parser_iteration_statement @@ -1559,7 +1566,7 @@ static void cp_parser_declaration_statem (cp_parser *); static tree cp_parser_implicitly_scoped_statement - (cp_parser *); + (cp_parser *, bool *); static void cp_parser_already_scoped_statement (cp_parser *); @@ -5730,12 +5737,13 @@ cp_parser_binary_expression (cp_parser* cp_parser_expression_stack_entry *sp = &stack[0]; tree lhs, rhs; cp_token *token; - enum tree_code tree_type; + enum tree_code tree_type, lhs_type, rhs_type; enum cp_parser_prec prec = PREC_NOT_OPERATOR, new_prec, lookahead_prec; bool overloaded_p; /* Parse the first expression. */ lhs = cp_parser_cast_expression (parser, /*address_p=*/false, cast_p); + lhs_type = ERROR_MARK; for (;;) { @@ -5768,6 +5776,7 @@ cp_parser_binary_expression (cp_parser* /* Extract another operand. It may be the RHS of this expression or the LHS of a new, higher priority expression. */ rhs = cp_parser_simple_cast_expression (parser); + rhs_type = ERROR_MARK; /* Get another operator token. Look up its precedence to avoid building a useless (immediately popped) stack entry for common @@ -5783,8 +5792,10 @@ cp_parser_binary_expression (cp_parser* sp->prec = prec; sp->tree_type = tree_type; sp->lhs = lhs; + sp->lhs_type = lhs_type; sp++; lhs = rhs; + lhs_type = rhs_type; prec = new_prec; new_prec = lookahead_prec; goto get_rhs; @@ -5801,11 +5812,15 @@ cp_parser_binary_expression (cp_parser* prec = sp->prec; tree_type = sp->tree_type; rhs = lhs; + rhs_type = lhs_type; lhs = sp->lhs; + lhs_type = sp->lhs_type; } overloaded_p = false; - lhs = build_x_binary_op (tree_type, lhs, rhs, &overloaded_p); + lhs = build_x_binary_op (tree_type, lhs, lhs_type, rhs, rhs_type, + &overloaded_p); + lhs_type = tree_type; /* If the binary operator required the use of an overloaded operator, then this expression cannot be an integral constant-expression. @@ -6222,17 +6237,23 @@ cp_parser_builtin_offsetof (cp_parser *p try-block IN_COMPOUND is true when the statement is nested inside a - cp_parser_compound_statement; this matters for certain pragmas. */ + cp_parser_compound_statement; this matters for certain pragmas. + + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in braces + and has an else clause. This is used to implement -Wparentheses. */ static void cp_parser_statement (cp_parser* parser, tree in_statement_expr, - bool in_compound) + bool in_compound, bool *if_p) { tree statement; cp_token *token; location_t statement_location; restart: + if (if_p != NULL) + *if_p = false; /* There is no statement yet. */ statement = NULL_TREE; /* Peek at the next token. */ @@ -6257,7 +6278,7 @@ cp_parser_statement (cp_parser* parser, case RID_IF: case RID_SWITCH: - statement = cp_parser_selection_statement (parser); + statement = cp_parser_selection_statement (parser, if_p); break; case RID_WHILE: @@ -6522,7 +6543,7 @@ cp_parser_statement_seq_opt (cp_parser* break; /* Parse the statement. */ - cp_parser_statement (parser, in_statement_expr, true); + cp_parser_statement (parser, in_statement_expr, true, NULL); } } @@ -6533,14 +6554,22 @@ cp_parser_statement_seq_opt (cp_parser* if ( condition ) statement else statement switch ( condition ) statement - Returns the new IF_STMT or SWITCH_STMT. */ + Returns the new IF_STMT or SWITCH_STMT. + + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in + braces and has an else clause. This is used to implement + -Wparentheses. */ static tree -cp_parser_selection_statement (cp_parser* parser) +cp_parser_selection_statement (cp_parser* parser, bool *if_p) { cp_token *token; enum rid keyword; + if (if_p != NULL) + *if_p = false; + /* Peek at the next token. */ token = cp_parser_require (parser, CPP_KEYWORD, "selection-statement"); @@ -6576,11 +6605,13 @@ cp_parser_selection_statement (cp_parser if (keyword == RID_IF) { + bool nested_if; + /* Add the condition. */ finish_if_stmt_cond (condition, statement); /* Parse the then-clause. */ - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, &nested_if); finish_then_clause (statement); /* If the next token is `else', parse the else-clause. */ @@ -6591,8 +6622,28 @@ cp_parser_selection_statement (cp_parser cp_lexer_consume_token (parser->lexer); begin_else_clause (statement); /* Parse the else-clause. */ - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); finish_else_clause (statement); + + /* If we are currently parsing a then-clause, then + IF_P will not be NULL. We set it to true to + indicate that this if statement has an else clause. + This may trigger the Wparentheses warning below + when we get back up to the parent if statement. */ + if (if_p != NULL) + *if_p = true; + } + else + { + /* This if statement does not have an else clause. If + NESTED_IF is true, then the then-clause is an if + statement which does have an else clause. We warn + about the potential ambiguity. */ + if (nested_if) + warning (OPT_Wparentheses, + ("%Hsuggest explicit braces " + "to avoid ambiguous %"), + EXPR_LOCUS (statement)); } /* Now we're all done with the if-statement. */ @@ -6611,7 +6662,7 @@ cp_parser_selection_statement (cp_parser in_statement = parser->in_statement; parser->in_switch_statement_p = true; parser->in_statement |= IN_SWITCH_STMT; - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); parser->in_switch_statement_p = in_switch_statement_p; parser->in_statement = in_statement; @@ -6789,7 +6840,7 @@ cp_parser_iteration_statement (cp_parser statement = begin_do_stmt (); /* Parse the body of the do-statement. */ parser->in_statement = IN_ITERATION_STMT; - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); parser->in_statement = in_statement; finish_do_body (statement); /* Look for the `while' keyword. */ @@ -7031,13 +7082,21 @@ cp_parser_declaration_statement (cp_pars but ensures that is in its own scope, even if it is not a compound-statement. + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in + braces and has an else clause. This is used to implement + -Wparentheses. + Returns the new statement. */ static tree -cp_parser_implicitly_scoped_statement (cp_parser* parser) +cp_parser_implicitly_scoped_statement (cp_parser* parser, bool *if_p) { tree statement; + if (if_p != NULL) + *if_p = false; + /* Mark if () ; with a special NOP_EXPR. */ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) { @@ -7053,7 +7112,7 @@ cp_parser_implicitly_scoped_statement (c /* Create a compound-statement. */ statement = begin_compound_stmt (0); /* Parse the dependent-statement. */ - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, if_p); /* Finish the dummy compound-statement. */ finish_compound_stmt (statement); } @@ -7072,7 +7131,7 @@ cp_parser_already_scoped_statement (cp_p { /* If the token is a `{', then we must take special action. */ if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); else { /* Avoid calling cp_parser_compound_statement, so that we @@ -18645,7 +18704,7 @@ cp_parser_omp_structured_block (cp_parse tree stmt = begin_omp_structured_block (); unsigned int save = cp_parser_begin_omp_structured_block (parser); - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); cp_parser_end_omp_structured_block (parser, save); return finish_omp_structured_block (stmt); @@ -18890,7 +18949,7 @@ cp_parser_omp_for_loop (cp_parser *parse /* Note that the grammar doesn't call for a structured block here, though the loop as a whole is a structured block. */ body = push_stmt_list (); - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); body = pop_stmt_list (body); return finish_omp_for (loc, decl, init, cond, incr, body, pre_body); @@ -18983,7 +19042,7 @@ cp_parser_omp_sections_scope (cp_parser while (1) { - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); tok = cp_lexer_peek_token (parser->lexer); if (tok->pragma_kind == PRAGMA_OMP_SECTION) Modified: stable/10/contrib/gcc/cp/pt.c ============================================================================== --- stable/10/contrib/gcc/cp/pt.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/cp/pt.c Thu Dec 12 18:15:32 2013 (r259268) @@ -9078,7 +9078,13 @@ tsubst_copy_and_build (tree t, return build_x_binary_op (TREE_CODE (t), RECUR (TREE_OPERAND (t, 0)), + (TREE_NO_WARNING (TREE_OPERAND (t, 0)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 0))), RECUR (TREE_OPERAND (t, 1)), + (TREE_NO_WARNING (TREE_OPERAND (t, 1)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 1))), /*overloaded_p=*/NULL); case SCOPE_REF: @@ -9087,7 +9093,14 @@ tsubst_copy_and_build (tree t, case ARRAY_REF: op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0), args, complain, in_decl); - return build_x_binary_op (ARRAY_REF, op1, RECUR (TREE_OPERAND (t, 1)), + return build_x_binary_op (ARRAY_REF, op1, + (TREE_NO_WARNING (TREE_OPERAND (t, 0)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 0))), + RECUR (TREE_OPERAND (t, 1)), + (TREE_NO_WARNING (TREE_OPERAND (t, 1)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 1))), /*overloaded_p=*/NULL); case SIZEOF_EXPR: Modified: stable/10/contrib/gcc/cp/semantics.c ============================================================================== --- stable/10/contrib/gcc/cp/semantics.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/cp/semantics.c Thu Dec 12 18:15:32 2013 (r259268) @@ -587,6 +587,16 @@ maybe_convert_cond (tree cond) /* Do the conversion. */ cond = convert_from_reference (cond); + + if (TREE_CODE (cond) == MODIFY_EXPR + && !TREE_NO_WARNING (cond) + && warn_parentheses) + { + warning (OPT_Wparentheses, + "suggest parentheses around assignment used as truth value"); + TREE_NO_WARNING (cond) = 1; + } + return condition_conversion (cond); } Modified: stable/10/contrib/gcc/cp/tree.c ============================================================================== --- stable/10/contrib/gcc/cp/tree.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/cp/tree.c Thu Dec 12 18:15:32 2013 (r259268) @@ -1762,6 +1762,14 @@ pod_type_p (tree t) return 1; } +/* Nonzero iff type T is a class template implicit specialization. */ + +bool +class_tmpl_impl_spec_p (tree t) +{ + return CLASS_TYPE_P (t) && CLASSTYPE_TEMPLATE_INSTANTIATION (t); +} + /* Returns 1 iff zero initialization of type T means actually storing zeros in it. */ Modified: stable/10/contrib/gcc/cp/typeck.c ============================================================================== --- stable/10/contrib/gcc/cp/typeck.c Thu Dec 12 18:08:31 2013 (r259267) +++ stable/10/contrib/gcc/cp/typeck.c Thu Dec 12 18:15:32 2013 (r259268) @@ -1690,17 +1690,20 @@ rationalize_conditional_expr (enum tree_ are equal, so we know what conditional expression this used to be. */ if (TREE_CODE (t) == MIN_EXPR || TREE_CODE (t) == MAX_EXPR) { + tree op0 = TREE_OPERAND (t, 0); + tree op1 = TREE_OPERAND (t, 1); + /* The following code is incorrect if either operand side-effects. */ - gcc_assert (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 0)) - && !TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1))); + gcc_assert (!TREE_SIDE_EFFECTS (op0) + && !TREE_SIDE_EFFECTS (op1)); return build_conditional_expr (build_x_binary_op ((TREE_CODE (t) == MIN_EXPR ? LE_EXPR : GE_EXPR), - TREE_OPERAND (t, 0), - TREE_OPERAND (t, 1), + op0, TREE_CODE (op0), + op1, TREE_CODE (op1), /*overloaded_p=*/NULL), - build_unary_op (code, TREE_OPERAND (t, 0), 0), - build_unary_op (code, TREE_OPERAND (t, 1), 0)); + build_unary_op (code, op0, 0), + build_unary_op (code, op1, 0)); } return @@ -2908,8 +2911,8 @@ convert_arguments (tree typelist, tree v conversions on the operands. CODE is the kind of expression to build. */ tree -build_x_binary_op (enum tree_code code, tree arg1, tree arg2, - bool *overloaded_p) +build_x_binary_op (enum tree_code code, tree arg1, enum tree_code arg1_code, + tree arg2, enum tree_code arg2_code, bool *overloaded_p) { tree orig_arg1; tree orig_arg2; @@ -2933,6 +2936,17 @@ build_x_binary_op (enum tree_code code, expr = build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE, overloaded_p); + /* Check for cases such as x+y< Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B1318F5A; Thu, 12 Dec 2013 18:16:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9B13119FC; Thu, 12 Dec 2013 18:16:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCIGoTw022301; Thu, 12 Dec 2013 18:16:50 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCIGlhG022281; Thu, 12 Dec 2013 18:16:47 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312121816.rBCIGlhG022281@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 12 Dec 2013 18:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259269 - in stable/9/contrib: gcc gcc/config/rs6000 gcc/cp gcc/doc gcclibs/libcpp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 18:16:50 -0000 Author: pfg Date: Thu Dec 12 18:16:46 2013 New Revision: 259269 URL: http://svnweb.freebsd.org/changeset/base/259269 Log: MFC r258081, r258138, r258143, r258179, r258157, r258204, 258205, r258206, r258207, r258321 This is a series of commits inspired on Google's gcc-4.2.1 for Android that were taken from the gcc pre-4.3 under the GPLv2. gcc: Backport fixes for -W parentheses in C++ This fixes GCC 19564. gcc: merge rs6000 change from FSF pre-gcc43 Don't set MASK_PPC_GFXOPT for 8540 or 8548. Merge vrp-tree fix from gcc-4.3 Fix missed conversion from / to >> (GCC PR32521) Merge in GCCr120505 to include definition of TREE_OVERFLOW_P gcc: warn about integer overflow in constant expressions in the C++ frontend. gcc: Add a new option -Wvla to warn variable length array. libcpp: preprocessor speedup patches from upstream gcc. gcc: add femit-struct-debug support to reduce Reduce dwarf debug size gcc: Fix postreload-gcse treatment of call-clobbered registers. gcc: Record some previous commits in the ChangeLog.gcc43 file. Modified: stable/9/contrib/gcc/ChangeLog.gcc43 stable/9/contrib/gcc/c-common.c stable/9/contrib/gcc/c-common.h stable/9/contrib/gcc/c-decl.c stable/9/contrib/gcc/c-opts.c stable/9/contrib/gcc/c-typeck.c stable/9/contrib/gcc/c.opt stable/9/contrib/gcc/config/rs6000/rs6000.c stable/9/contrib/gcc/cp/cp-lang.c stable/9/contrib/gcc/cp/cp-tree.h stable/9/contrib/gcc/cp/decl.c stable/9/contrib/gcc/cp/parser.c stable/9/contrib/gcc/cp/pt.c stable/9/contrib/gcc/cp/semantics.c stable/9/contrib/gcc/cp/tree.c stable/9/contrib/gcc/cp/typeck.c stable/9/contrib/gcc/doc/invoke.texi stable/9/contrib/gcc/dwarf2out.c stable/9/contrib/gcc/flags.h stable/9/contrib/gcc/langhooks-def.h stable/9/contrib/gcc/langhooks.h stable/9/contrib/gcc/opts.c stable/9/contrib/gcc/postreload-gcse.c stable/9/contrib/gcc/regs.h stable/9/contrib/gcc/rtlanal.c stable/9/contrib/gcc/tree-vrp.c stable/9/contrib/gcc/tree.h stable/9/contrib/gcclibs/libcpp/files.c stable/9/contrib/gcclibs/libcpp/internal.h stable/9/contrib/gcclibs/libcpp/lex.c Directory Properties: stable/9/ (props changed) stable/9/contrib/gcc/ (props changed) stable/9/contrib/gcclibs/ (props changed) Modified: stable/9/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/9/contrib/gcc/ChangeLog.gcc43 Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/ChangeLog.gcc43 Thu Dec 12 18:16:46 2013 (r259269) @@ -1,9 +1,35 @@ -2007-06-05 Joerg Wunsch (r23479) +2007-08-08 Andrew Haley (r128087) + + * config/arm/libunwind.S (UNWIND_WRAPPER _Unwind_Backtrace): New. + * config/arm/unwind-arm.h (__gnu_Unwind_Backtrace): New. + * config/arm/unwind-arm.c (__gnu_Unwind_Backtrace): New. + +2007-06-05 Joerg Wunsch (r125346) PR preprocessor/23479 * doc/extend.texi: Document the 0b-prefixed binary integer constant extension. +2007-05-24 Richard Sandiford (r125037) + + * postreload-gcse.c (reg_changed_after_insn_p): New function. + (oprs_unchanged_p): Use it to check all registers in a REG. + (record_opr_changes): Look for clobbers in CALL_INSN_FUNCTION_USAGE. + (reg_set_between_after_reload_p): Delete. + (reg_used_between_after_reload_p): Likewise. + (reg_set_or_used_since_bb_start): Likewise. + (eliminate_partially_redundant_load): Use reg_changed_after_insn_p + and reg_used_between_p instead of reg_set_or_used_since_bb_start. + Use reg_set_between_p instead of reg_set_between_after_reload_p. + * rtlanal.c (reg_set_p): Check whether REG overlaps + regs_invalidated_by_call, rather than just checking the + membership of REGNO (REG). + +2007-05-03 Ian Lance Taylor (r124381) + + * config/rs6000/rs6000.c (rs6000_override_options): Don't set + MASK_PPC_GFXOPT for 8540 or 8548. + 2007-05-01 Dwarakanath Rajagopal (r124341) * doc/invoke.texi: Fix typo, 'AMD Family 10h core' instead of @@ -22,6 +48,57 @@ alignment for amdfam10 architecture. Increasing the max loop alignment to 24 bytes. +2007-04-16 Lawrence Crowl + + * doc/invoke.texi (Debugging Options): Add documentation for the + -femit-struct-debug options -femit-struct-debug-baseonly, + -femit-struct-debug-reduced, and + -femit-struct-debug-detailed[=...]. + + * c-opts.c (c_common_handle_option): Add + OPT_femit_struct_debug_baseonly, OPT_femit_struct_debug_reduced, + and OPT_femit_struct_debug_detailed_. + * c.opt: Add specifications for + -femit-struct-debug-baseonly, -femit-struct-debug-reduced, + and -femit-struct-debug-detailed[=...]. + * opts.c (set_struct_debug_option): Parse the + -femit-struct-debug-... options. + * opts.c (matches_main_base, main_input_basename, + main_input_baselength, base_of_path, matches_main_base): Add + variables and functions to compare header base name to compilation + unit base name. + * opts.c (should_emit_struct_debug): Add to determine to emit a + structure based on the option. + (dump_struct_debug) Also disabled function to debug this + function. + * opts.c (handle_options): Save the base name of the + compilation unit. + + * langhooks-def.h (LANG_HOOKS_GENERIC_TYPE_P): Define. + (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add. + This hook indicates if a type is generic. Set it by default + to "never generic". + * langhooks.h (struct lang_hooks_for_types): Add a new hook + to determine if a struct type is generic or not. + * cp/cp-tree.h (class_tmpl_impl_spec_p): Declare a C++ hook. + * cp/tree.c (class_tmpl_impl_spec_p): Implement the C++ hook. + * cp/cp-lang.c (LANG_HOOKS_GENERIC_TYPE_P): Override null C hook + with live C++ hook. + + * flags.h (enum debug_info_usage): Add an enumeration to describe + a program's use of a structure type. + * dwarf2out.c (gen_struct_or_union_type_die): Add a new parameter + to indicate the program's usage of the type. Filter structs based + on the -femit-struct-debug-... specification. + (gen_type_die): Split into two routines, gen_type_die and + gen_type_die_with_usage. gen_type_die is now a wrapper + that assumes direct usage. + (gen_type_die_with_usage): Replace calls to gen_type_die + with gen_type_die_with_usage adding the program usage of + the referenced type. + (dwarf2out_imported_module_or_decl): Suppress struct debug + information using should_emit_struct_debug when appropriate. + 2007-04-12 Richard Guenther (r123736) PR tree-optimization/24689 @@ -44,6 +121,19 @@ * config/i386/i386.c (override_options): Likewise. * doc/invoke.texi: Likewise. +2007-03-12 Seongbae Park + + * c-decl.c (warn_variable_length_array): New function. + Refactored from grokdeclarator to handle warn_vla + and handle unnamed array case. + (grokdeclarator): Refactored VLA warning case. + * c.opt (Wvla): New flag. + +2007-03-11 Ian Lance Taylor (r122831 - partial) + + * tree-vrp.c (vrp_int_const_binop): Handle PLUS_EXPR and + the *_DIV_EXPR codes correctly with overflow infinities. + 2007-02-09 Dwarakanath Rajagopal (r121763) * config/i386/driver-i386.c: Turn on -mtune=native for AMDFAM10. @@ -232,6 +322,17 @@ * config.gcc: Support core2 processor. +2006-12-13 Ian Lance Taylor (r119855) + + PR c++/19564 + PR c++/19756 + * c-typeck.c (parser_build_binary_op): Move parentheses warnings + to warn_about_parentheses in c-common.c. + * c-common.c (warn_about_parentheses): New function. + * c-common.h (warn_about_parentheses): Declare. + * doc/invoke.texi (Warning Options): Update -Wparentheses + description. + 2006-12-02 H.J. Lu (r119454 - partial) PR target/30040 @@ -270,6 +371,35 @@ (override_options): Add entries for Core2. (ix86_issue_rate): Add case for Core2. +2006-10-31 Geoffrey Keating (r118356) + + * c-decl.c (grokdeclarator): Don't set DECL_EXTERNAL on + inline static functions in c99 mode. + + PR 16622 + * doc/extend.texi (Inline): Update. + * c-tree.h (struct language_function): Remove field 'extern_inline'. + * c-decl.c (current_extern_inline): Delete. + (pop_scope): Adjust test for an undefined nested function. + Add warning about undeclared inline function. + (diagnose_mismatched_decls): Update comments. Disallow overriding + of inline functions in a translation unit in C99. Allow inline + declarations in C99 at any time. + (merge_decls): Boolize variables. Handle C99 'extern inline' + semantics. + (grokdeclarator): Set DECL_EXTERNAL here for functions. Handle + C99 inline semantics. + (start_function): Don't clear current_extern_inline. Don't set + DECL_EXTERNAL. + (c_push_function_context): Don't push current_extern_inline. + (c_pop_function_context): Don't restore current_extern_inline. + + PR 11377 + * c-typeck.c (build_external_ref): Warn about static variables + used in extern inline functions. + * c-decl.c (start_decl): Warn about static variables declared + in extern inline functions. + 2006-10-27 Vladimir Makarov (r118090) * config/i386/i386.h (TARGET_GEODE): Modified: stable/9/contrib/gcc/c-common.c ============================================================================== --- stable/9/contrib/gcc/c-common.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/c-common.c Thu Dec 12 18:16:46 2013 (r259269) @@ -2585,9 +2585,13 @@ c_common_truthvalue_conversion (tree exp break; case MODIFY_EXPR: - if (!TREE_NO_WARNING (expr)) - warning (OPT_Wparentheses, - "suggest parentheses around assignment used as truth value"); + if (!TREE_NO_WARNING (expr) + && warn_parentheses) + { + warning (OPT_Wparentheses, + "suggest parentheses around assignment used as truth value"); + TREE_NO_WARNING (expr) = 1; + } break; default: @@ -6471,5 +6475,87 @@ warn_array_subscript_with_type_char (tre warning (OPT_Wchar_subscripts, "array subscript has type %"); } +/* Implement -Wparentheses for the unexpected C precedence rules, to + cover cases like x + y << z which readers are likely to + misinterpret. We have seen an expression in which CODE is a binary + operator used to combine expressions headed by CODE_LEFT and + CODE_RIGHT. CODE_LEFT and CODE_RIGHT may be ERROR_MARK, which + means that that side of the expression was not formed using a + binary operator, or it was enclosed in parentheses. */ + +void +warn_about_parentheses (enum tree_code code, enum tree_code code_left, + enum tree_code code_right) +{ + if (!warn_parentheses) + return; + + if (code == LSHIFT_EXPR || code == RSHIFT_EXPR) + { + if (code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around + or - inside shift"); + } + + if (code == TRUTH_ORIF_EXPR) + { + if (code_left == TRUTH_ANDIF_EXPR + || code_right == TRUTH_ANDIF_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around && within ||"); + } + + if (code == BIT_IOR_EXPR) + { + if (code_left == BIT_AND_EXPR || code_left == BIT_XOR_EXPR + || code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == BIT_AND_EXPR || code_right == BIT_XOR_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around arithmetic in operand of |"); + /* Check cases like x|y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of |"); + } + + if (code == BIT_XOR_EXPR) + { + if (code_left == BIT_AND_EXPR + || code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == BIT_AND_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around arithmetic in operand of ^"); + /* Check cases like x^y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of ^"); + } + + if (code == BIT_AND_EXPR) + { + if (code_left == PLUS_EXPR || code_left == MINUS_EXPR + || code_right == PLUS_EXPR || code_right == MINUS_EXPR) + warning (OPT_Wparentheses, + "suggest parentheses around + or - in operand of &"); + /* Check cases like x&y==z */ + if (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison) + warning (OPT_Wparentheses, + "suggest parentheses around comparison in operand of &"); + } + + /* Similarly, check for cases like 1<=i<=10 that are probably errors. */ + if (TREE_CODE_CLASS (code) == tcc_comparison + && (TREE_CODE_CLASS (code_left) == tcc_comparison + || TREE_CODE_CLASS (code_right) == tcc_comparison)) + warning (OPT_Wparentheses, "comparisons like X<=Y<=Z do not " + "have their mathematical meaning"); +} + #include "gt-c-common.h" Modified: stable/9/contrib/gcc/c-common.h ============================================================================== --- stable/9/contrib/gcc/c-common.h Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/c-common.h Thu Dec 12 18:16:46 2013 (r259269) @@ -850,6 +850,9 @@ extern int complete_array_type (tree *, extern tree builtin_type_for_size (int, bool); extern void warn_array_subscript_with_type_char (tree); +extern void warn_about_parentheses (enum tree_code, enum tree_code, + enum tree_code); + /* In c-gimplify.c */ extern void c_genericize (tree); Modified: stable/9/contrib/gcc/c-decl.c ============================================================================== --- stable/9/contrib/gcc/c-decl.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/c-decl.c Thu Dec 12 18:16:46 2013 (r259269) @@ -3931,6 +3931,61 @@ check_bitfield_type_and_width (tree *typ } + +/* Print warning about variable length array if necessary. */ + +static void +warn_variable_length_array (const char *name, tree size) +{ + int ped = !flag_isoc99 && pedantic && warn_vla != 0; + int const_size = TREE_CONSTANT (size); + + if (ped) + { + if (const_size) + { + if (name) + pedwarn ("ISO C90 forbids array %qs whose size " + "can%'t be evaluated", + name); + else + pedwarn ("ISO C90 forbids array whose size " + "can%'t be evaluated"); + } + else + { + if (name) + pedwarn ("ISO C90 forbids variable length array %qs", + name); + else + pedwarn ("ISO C90 forbids variable length array"); + } + } + else if (warn_vla > 0) + { + if (const_size) + { + if (name) + warning (OPT_Wvla, + "the size of array %qs can" + "%'t be evaluated", name); + else + warning (OPT_Wvla, + "the size of array can %'t be evaluated"); + } + else + { + if (name) + warning (OPT_Wvla, + "variable length array %qs is used", + name); + else + warning (OPT_Wvla, + "variable length array is used"); + } + } +} + /* Given declspecs and a declarator, determine the name and type of the object declared and construct a ..._DECL node for it. @@ -4329,17 +4384,7 @@ grokdeclarator (const struct c_declarato nonconstant even if it is (eg) a const variable with known value. */ size_varies = 1; - - if (!flag_isoc99 && pedantic) - { - if (TREE_CONSTANT (size)) - pedwarn ("ISO C90 forbids array %qs whose size " - "can%'t be evaluated", - name); - else - pedwarn ("ISO C90 forbids variable-size array %qs", - name); - } + warn_variable_length_array (orig_name, size); if (warn_variable_decl) warning (0, "variable-sized array %qs", name); } Modified: stable/9/contrib/gcc/c-opts.c ============================================================================== --- stable/9/contrib/gcc/c-opts.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/c-opts.c Thu Dec 12 18:16:46 2013 (r259269) @@ -818,6 +818,18 @@ c_common_handle_option (size_t scode, co flag_gen_declaration = 1; break; + case OPT_femit_struct_debug_baseonly: + set_struct_debug_option ("base"); + break; + + case OPT_femit_struct_debug_reduced: + set_struct_debug_option ("dir:ord:sys,dir:gen:any,ind:base"); + break; + + case OPT_femit_struct_debug_detailed_: + set_struct_debug_option (arg); + break; + case OPT_idirafter: add_path (xstrdup (arg), AFTER, 0, true); break; Modified: stable/9/contrib/gcc/c-typeck.c ============================================================================== --- stable/9/contrib/gcc/c-typeck.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/c-typeck.c Thu Dec 12 18:16:46 2013 (r259269) @@ -2631,73 +2631,7 @@ parser_build_binary_op (enum tree_code c /* Check for cases such as x+y< Detailed reduced debug info for structs + idirafter C ObjC C++ ObjC++ Joined Separate -idirafter Add to the end of the system include path Modified: stable/9/contrib/gcc/config/rs6000/rs6000.c ============================================================================== --- stable/9/contrib/gcc/config/rs6000/rs6000.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/config/rs6000/rs6000.c Thu Dec 12 18:16:46 2013 (r259269) @@ -1171,11 +1171,9 @@ rs6000_override_options (const char *def {"801", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"821", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"823", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, - {"8540", PROCESSOR_PPC8540, - POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_STRICT_ALIGN}, + {"8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN}, /* 8548 has a dummy entry for now. */ - {"8548", PROCESSOR_PPC8540, - POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_STRICT_ALIGN}, + {"8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN}, {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"970", PROCESSOR_POWER4, POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64}, Modified: stable/9/contrib/gcc/cp/cp-lang.c ============================================================================== --- stable/9/contrib/gcc/cp/cp-lang.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/cp/cp-lang.c Thu Dec 12 18:16:46 2013 (r259269) @@ -44,6 +44,8 @@ static void cp_init_ts (void); #define LANG_HOOKS_NAME "GNU C++" #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT cxx_init +#undef LANG_HOOKS_GENERIC_TYPE_P +#define LANG_HOOKS_GENERIC_TYPE_P class_tmpl_impl_spec_p #undef LANG_HOOKS_DECL_PRINTABLE_NAME #define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name #undef LANG_HOOKS_FOLD_OBJ_TYPE_REF Modified: stable/9/contrib/gcc/cp/cp-tree.h ============================================================================== --- stable/9/contrib/gcc/cp/cp-tree.h Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/cp/cp-tree.h Thu Dec 12 18:16:46 2013 (r259269) @@ -4373,6 +4373,7 @@ extern tree add_stmt_to_compound (tree, extern tree cxx_maybe_build_cleanup (tree); extern void init_tree (void); extern int pod_type_p (tree); +extern bool class_tmpl_impl_spec_p (tree); extern int zero_init_p (tree); extern tree canonical_type_variant (tree); extern tree copy_binfo (tree, tree, tree, @@ -4460,8 +4461,9 @@ extern tree build_x_indirect_ref (tree, extern tree build_indirect_ref (tree, const char *); extern tree build_array_ref (tree, tree); extern tree get_member_function_from_ptrfunc (tree *, tree); -extern tree build_x_binary_op (enum tree_code, tree, tree, - bool *); +extern tree build_x_binary_op (enum tree_code, tree, + enum tree_code, tree, + enum tree_code, bool *); extern tree build_x_unary_op (enum tree_code, tree); extern tree unary_complex_lvalue (enum tree_code, tree); extern tree build_x_conditional_expr (tree, tree, tree); Modified: stable/9/contrib/gcc/cp/decl.c ============================================================================== --- stable/9/contrib/gcc/cp/decl.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/cp/decl.c Thu Dec 12 18:16:46 2013 (r259269) @@ -6702,12 +6702,21 @@ compute_array_index_type (tree name, tre error ("size of array is not an integral constant-expression"); size = integer_one_node; } - else if (pedantic) + else if (pedantic && warn_vla != 0) { if (name) - pedwarn ("ISO C++ forbids variable-size array %qD", name); + pedwarn ("ISO C++ forbids variable length array %qD", name); else - pedwarn ("ISO C++ forbids variable-size array"); + pedwarn ("ISO C++ forbids variable length array"); + } + else if (warn_vla > 0) + { + if (name) + warning (OPT_Wvla, + "variable length array %qD is used", name); + else + warning (OPT_Wvla, + "variable length array is used"); } if (processing_template_decl && !TREE_CONSTANT (size)) Modified: stable/9/contrib/gcc/cp/parser.c ============================================================================== --- stable/9/contrib/gcc/cp/parser.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/cp/parser.c Thu Dec 12 18:16:46 2013 (r259269) @@ -1177,8 +1177,15 @@ typedef enum cp_parser_status_kind typedef struct cp_parser_expression_stack_entry { + /* Left hand side of the binary operation we are currently + parsing. */ tree lhs; + /* Original tree code for left hand side, if it was a binary + expression itself (used for -Wparentheses). */ + enum tree_code lhs_type; + /* Tree code for the binary operation we are parsing. */ enum tree_code tree_type; + /* Precedence of the binary operation we are parsing. */ int prec; } cp_parser_expression_stack_entry; @@ -1536,7 +1543,7 @@ static tree cp_parser_builtin_offsetof /* Statements [gram.stmt.stmt] */ static void cp_parser_statement - (cp_parser *, tree, bool); + (cp_parser *, tree, bool, bool *); static void cp_parser_label_for_labeled_statement (cp_parser *); static tree cp_parser_expression_statement @@ -1546,7 +1553,7 @@ static tree cp_parser_compound_statement static void cp_parser_statement_seq_opt (cp_parser *, tree); static tree cp_parser_selection_statement - (cp_parser *); + (cp_parser *, bool *); static tree cp_parser_condition (cp_parser *); static tree cp_parser_iteration_statement @@ -1559,7 +1566,7 @@ static void cp_parser_declaration_statem (cp_parser *); static tree cp_parser_implicitly_scoped_statement - (cp_parser *); + (cp_parser *, bool *); static void cp_parser_already_scoped_statement (cp_parser *); @@ -5730,12 +5737,13 @@ cp_parser_binary_expression (cp_parser* cp_parser_expression_stack_entry *sp = &stack[0]; tree lhs, rhs; cp_token *token; - enum tree_code tree_type; + enum tree_code tree_type, lhs_type, rhs_type; enum cp_parser_prec prec = PREC_NOT_OPERATOR, new_prec, lookahead_prec; bool overloaded_p; /* Parse the first expression. */ lhs = cp_parser_cast_expression (parser, /*address_p=*/false, cast_p); + lhs_type = ERROR_MARK; for (;;) { @@ -5768,6 +5776,7 @@ cp_parser_binary_expression (cp_parser* /* Extract another operand. It may be the RHS of this expression or the LHS of a new, higher priority expression. */ rhs = cp_parser_simple_cast_expression (parser); + rhs_type = ERROR_MARK; /* Get another operator token. Look up its precedence to avoid building a useless (immediately popped) stack entry for common @@ -5783,8 +5792,10 @@ cp_parser_binary_expression (cp_parser* sp->prec = prec; sp->tree_type = tree_type; sp->lhs = lhs; + sp->lhs_type = lhs_type; sp++; lhs = rhs; + lhs_type = rhs_type; prec = new_prec; new_prec = lookahead_prec; goto get_rhs; @@ -5801,11 +5812,15 @@ cp_parser_binary_expression (cp_parser* prec = sp->prec; tree_type = sp->tree_type; rhs = lhs; + rhs_type = lhs_type; lhs = sp->lhs; + lhs_type = sp->lhs_type; } overloaded_p = false; - lhs = build_x_binary_op (tree_type, lhs, rhs, &overloaded_p); + lhs = build_x_binary_op (tree_type, lhs, lhs_type, rhs, rhs_type, + &overloaded_p); + lhs_type = tree_type; /* If the binary operator required the use of an overloaded operator, then this expression cannot be an integral constant-expression. @@ -6222,17 +6237,23 @@ cp_parser_builtin_offsetof (cp_parser *p try-block IN_COMPOUND is true when the statement is nested inside a - cp_parser_compound_statement; this matters for certain pragmas. */ + cp_parser_compound_statement; this matters for certain pragmas. + + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in braces + and has an else clause. This is used to implement -Wparentheses. */ static void cp_parser_statement (cp_parser* parser, tree in_statement_expr, - bool in_compound) + bool in_compound, bool *if_p) { tree statement; cp_token *token; location_t statement_location; restart: + if (if_p != NULL) + *if_p = false; /* There is no statement yet. */ statement = NULL_TREE; /* Peek at the next token. */ @@ -6257,7 +6278,7 @@ cp_parser_statement (cp_parser* parser, case RID_IF: case RID_SWITCH: - statement = cp_parser_selection_statement (parser); + statement = cp_parser_selection_statement (parser, if_p); break; case RID_WHILE: @@ -6522,7 +6543,7 @@ cp_parser_statement_seq_opt (cp_parser* break; /* Parse the statement. */ - cp_parser_statement (parser, in_statement_expr, true); + cp_parser_statement (parser, in_statement_expr, true, NULL); } } @@ -6533,14 +6554,22 @@ cp_parser_statement_seq_opt (cp_parser* if ( condition ) statement else statement switch ( condition ) statement - Returns the new IF_STMT or SWITCH_STMT. */ + Returns the new IF_STMT or SWITCH_STMT. + + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in + braces and has an else clause. This is used to implement + -Wparentheses. */ static tree -cp_parser_selection_statement (cp_parser* parser) +cp_parser_selection_statement (cp_parser* parser, bool *if_p) { cp_token *token; enum rid keyword; + if (if_p != NULL) + *if_p = false; + /* Peek at the next token. */ token = cp_parser_require (parser, CPP_KEYWORD, "selection-statement"); @@ -6576,11 +6605,13 @@ cp_parser_selection_statement (cp_parser if (keyword == RID_IF) { + bool nested_if; + /* Add the condition. */ finish_if_stmt_cond (condition, statement); /* Parse the then-clause. */ - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, &nested_if); finish_then_clause (statement); /* If the next token is `else', parse the else-clause. */ @@ -6591,8 +6622,28 @@ cp_parser_selection_statement (cp_parser cp_lexer_consume_token (parser->lexer); begin_else_clause (statement); /* Parse the else-clause. */ - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); finish_else_clause (statement); + + /* If we are currently parsing a then-clause, then + IF_P will not be NULL. We set it to true to + indicate that this if statement has an else clause. + This may trigger the Wparentheses warning below + when we get back up to the parent if statement. */ + if (if_p != NULL) + *if_p = true; + } + else + { + /* This if statement does not have an else clause. If + NESTED_IF is true, then the then-clause is an if + statement which does have an else clause. We warn + about the potential ambiguity. */ + if (nested_if) + warning (OPT_Wparentheses, + ("%Hsuggest explicit braces " + "to avoid ambiguous %"), + EXPR_LOCUS (statement)); } /* Now we're all done with the if-statement. */ @@ -6611,7 +6662,7 @@ cp_parser_selection_statement (cp_parser in_statement = parser->in_statement; parser->in_switch_statement_p = true; parser->in_statement |= IN_SWITCH_STMT; - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); parser->in_switch_statement_p = in_switch_statement_p; parser->in_statement = in_statement; @@ -6789,7 +6840,7 @@ cp_parser_iteration_statement (cp_parser statement = begin_do_stmt (); /* Parse the body of the do-statement. */ parser->in_statement = IN_ITERATION_STMT; - cp_parser_implicitly_scoped_statement (parser); + cp_parser_implicitly_scoped_statement (parser, NULL); parser->in_statement = in_statement; finish_do_body (statement); /* Look for the `while' keyword. */ @@ -7031,13 +7082,21 @@ cp_parser_declaration_statement (cp_pars but ensures that is in its own scope, even if it is not a compound-statement. + If IF_P is not NULL, *IF_P is set to indicate whether the statement + is a (possibly labeled) if statement which is not enclosed in + braces and has an else clause. This is used to implement + -Wparentheses. + Returns the new statement. */ static tree -cp_parser_implicitly_scoped_statement (cp_parser* parser) +cp_parser_implicitly_scoped_statement (cp_parser* parser, bool *if_p) { tree statement; + if (if_p != NULL) + *if_p = false; + /* Mark if () ; with a special NOP_EXPR. */ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) { @@ -7053,7 +7112,7 @@ cp_parser_implicitly_scoped_statement (c /* Create a compound-statement. */ statement = begin_compound_stmt (0); /* Parse the dependent-statement. */ - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, if_p); /* Finish the dummy compound-statement. */ finish_compound_stmt (statement); } @@ -7072,7 +7131,7 @@ cp_parser_already_scoped_statement (cp_p { /* If the token is a `{', then we must take special action. */ if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); else { /* Avoid calling cp_parser_compound_statement, so that we @@ -18645,7 +18704,7 @@ cp_parser_omp_structured_block (cp_parse tree stmt = begin_omp_structured_block (); unsigned int save = cp_parser_begin_omp_structured_block (parser); - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); cp_parser_end_omp_structured_block (parser, save); return finish_omp_structured_block (stmt); @@ -18890,7 +18949,7 @@ cp_parser_omp_for_loop (cp_parser *parse /* Note that the grammar doesn't call for a structured block here, though the loop as a whole is a structured block. */ body = push_stmt_list (); - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); body = pop_stmt_list (body); return finish_omp_for (loc, decl, init, cond, incr, body, pre_body); @@ -18983,7 +19042,7 @@ cp_parser_omp_sections_scope (cp_parser while (1) { - cp_parser_statement (parser, NULL_TREE, false); + cp_parser_statement (parser, NULL_TREE, false, NULL); tok = cp_lexer_peek_token (parser->lexer); if (tok->pragma_kind == PRAGMA_OMP_SECTION) Modified: stable/9/contrib/gcc/cp/pt.c ============================================================================== --- stable/9/contrib/gcc/cp/pt.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/cp/pt.c Thu Dec 12 18:16:46 2013 (r259269) @@ -9078,7 +9078,13 @@ tsubst_copy_and_build (tree t, return build_x_binary_op (TREE_CODE (t), RECUR (TREE_OPERAND (t, 0)), + (TREE_NO_WARNING (TREE_OPERAND (t, 0)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 0))), RECUR (TREE_OPERAND (t, 1)), + (TREE_NO_WARNING (TREE_OPERAND (t, 1)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 1))), /*overloaded_p=*/NULL); case SCOPE_REF: @@ -9087,7 +9093,14 @@ tsubst_copy_and_build (tree t, case ARRAY_REF: op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0), args, complain, in_decl); - return build_x_binary_op (ARRAY_REF, op1, RECUR (TREE_OPERAND (t, 1)), + return build_x_binary_op (ARRAY_REF, op1, + (TREE_NO_WARNING (TREE_OPERAND (t, 0)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 0))), + RECUR (TREE_OPERAND (t, 1)), + (TREE_NO_WARNING (TREE_OPERAND (t, 1)) + ? ERROR_MARK + : TREE_CODE (TREE_OPERAND (t, 1))), /*overloaded_p=*/NULL); case SIZEOF_EXPR: Modified: stable/9/contrib/gcc/cp/semantics.c ============================================================================== --- stable/9/contrib/gcc/cp/semantics.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/cp/semantics.c Thu Dec 12 18:16:46 2013 (r259269) @@ -587,6 +587,16 @@ maybe_convert_cond (tree cond) /* Do the conversion. */ cond = convert_from_reference (cond); + + if (TREE_CODE (cond) == MODIFY_EXPR + && !TREE_NO_WARNING (cond) + && warn_parentheses) + { + warning (OPT_Wparentheses, + "suggest parentheses around assignment used as truth value"); + TREE_NO_WARNING (cond) = 1; + } + return condition_conversion (cond); } Modified: stable/9/contrib/gcc/cp/tree.c ============================================================================== --- stable/9/contrib/gcc/cp/tree.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/cp/tree.c Thu Dec 12 18:16:46 2013 (r259269) @@ -1762,6 +1762,14 @@ pod_type_p (tree t) return 1; } +/* Nonzero iff type T is a class template implicit specialization. */ + +bool +class_tmpl_impl_spec_p (tree t) +{ + return CLASS_TYPE_P (t) && CLASSTYPE_TEMPLATE_INSTANTIATION (t); +} + /* Returns 1 iff zero initialization of type T means actually storing zeros in it. */ Modified: stable/9/contrib/gcc/cp/typeck.c ============================================================================== --- stable/9/contrib/gcc/cp/typeck.c Thu Dec 12 18:15:32 2013 (r259268) +++ stable/9/contrib/gcc/cp/typeck.c Thu Dec 12 18:16:46 2013 (r259269) @@ -1690,17 +1690,20 @@ rationalize_conditional_expr (enum tree_ are equal, so we know what conditional expression this used to be. */ if (TREE_CODE (t) == MIN_EXPR || TREE_CODE (t) == MAX_EXPR) { + tree op0 = TREE_OPERAND (t, 0); + tree op1 = TREE_OPERAND (t, 1); + /* The following code is incorrect if either operand side-effects. */ - gcc_assert (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 0)) - && !TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1))); + gcc_assert (!TREE_SIDE_EFFECTS (op0) + && !TREE_SIDE_EFFECTS (op1)); return build_conditional_expr (build_x_binary_op ((TREE_CODE (t) == MIN_EXPR ? LE_EXPR : GE_EXPR), - TREE_OPERAND (t, 0), - TREE_OPERAND (t, 1), + op0, TREE_CODE (op0), + op1, TREE_CODE (op1), /*overloaded_p=*/NULL), - build_unary_op (code, TREE_OPERAND (t, 0), 0), - build_unary_op (code, TREE_OPERAND (t, 1), 0)); + build_unary_op (code, op0, 0), + build_unary_op (code, op1, 0)); } return @@ -2908,8 +2911,8 @@ convert_arguments (tree typelist, tree v conversions on the operands. CODE is the kind of expression to build. */ tree -build_x_binary_op (enum tree_code code, tree arg1, tree arg2, - bool *overloaded_p) +build_x_binary_op (enum tree_code code, tree arg1, enum tree_code arg1_code, + tree arg2, enum tree_code arg2_code, bool *overloaded_p) { tree orig_arg1; tree orig_arg2; @@ -2933,6 +2936,17 @@ build_x_binary_op (enum tree_code code, expr = build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE, overloaded_p); + /* Check for cases such as x+y< Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5144CC8A; Thu, 12 Dec 2013 19:01:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3D2DB1E45; Thu, 12 Dec 2013 19:01:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCJ1pRv039440; Thu, 12 Dec 2013 19:01:51 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCJ1pmL039439; Thu, 12 Dec 2013 19:01:51 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312121901.rBCJ1pmL039439@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 12 Dec 2013 19:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259271 - stable/10/contrib/gcclibs/libcpp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 19:01:51 -0000 Author: pfg Date: Thu Dec 12 19:01:50 2013 New Revision: 259271 URL: http://svnweb.freebsd.org/changeset/base/259271 Log: MFC r258712; libcpp: fix an underflow. Similar fix seen in Apple's gcc42. Obtained from: OpenBSD (Rev 1.2) MFC after: 2 weeks Modified: stable/10/contrib/gcclibs/libcpp/charset.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcclibs/libcpp/charset.c ============================================================================== --- stable/10/contrib/gcclibs/libcpp/charset.c Thu Dec 12 18:29:36 2013 (r259270) +++ stable/10/contrib/gcclibs/libcpp/charset.c Thu Dec 12 19:01:50 2013 (r259271) @@ -1628,7 +1628,7 @@ _cpp_convert_input (cpp_reader *pfile, c terminate with another \r, not an \n, so that we do not mistake the \r\n sequence for a single DOS line ending and erroneously issue the "No newline at end of file" diagnostic. */ - if (to.text[to.len - 1] == '\r') + if (to.len > 0 && to.text[to.len - 1] == '\r') to.text[to.len] = '\r'; else to.text[to.len] = '\n'; From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 19:02:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53F90E24; Thu, 12 Dec 2013 19:02:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3FE8F1E4F; Thu, 12 Dec 2013 19:02:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCJ2JtC039557; Thu, 12 Dec 2013 19:02:19 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCJ2JMs039556; Thu, 12 Dec 2013 19:02:19 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312121902.rBCJ2JMs039556@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 12 Dec 2013 19:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259272 - stable/9/contrib/gcclibs/libcpp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 19:02:19 -0000 Author: pfg Date: Thu Dec 12 19:02:18 2013 New Revision: 259272 URL: http://svnweb.freebsd.org/changeset/base/259272 Log: MFC r258712; libcpp: fix an underflow. Similar fix seen in Apple's gcc42. Obtained from: OpenBSD (Rev 1.2) MFC after: 2 weeks Modified: stable/9/contrib/gcclibs/libcpp/charset.c Directory Properties: stable/9/ (props changed) stable/9/contrib/gcclibs/ (props changed) Modified: stable/9/contrib/gcclibs/libcpp/charset.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/charset.c Thu Dec 12 19:01:50 2013 (r259271) +++ stable/9/contrib/gcclibs/libcpp/charset.c Thu Dec 12 19:02:18 2013 (r259272) @@ -1628,7 +1628,7 @@ _cpp_convert_input (cpp_reader *pfile, c terminate with another \r, not an \n, so that we do not mistake the \r\n sequence for a single DOS line ending and erroneously issue the "No newline at end of file" diagnostic. */ - if (to.text[to.len - 1] == '\r') + if (to.len > 0 && to.text[to.len - 1] == '\r') to.text[to.len] = '\r'; else to.text[to.len] = '\n'; From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 19:02:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 084D1F6A; Thu, 12 Dec 2013 19:02:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E8BDF1E58; Thu, 12 Dec 2013 19:02:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCJ2g0G039642; Thu, 12 Dec 2013 19:02:42 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCJ2gDZ039641; Thu, 12 Dec 2013 19:02:42 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312121902.rBCJ2gDZ039641@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 12 Dec 2013 19:02:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259273 - stable/8/contrib/gcclibs/libcpp X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 19:02:43 -0000 Author: pfg Date: Thu Dec 12 19:02:42 2013 New Revision: 259273 URL: http://svnweb.freebsd.org/changeset/base/259273 Log: MFC r258712; libcpp: fix an underflow. Similar fix seen in Apple's gcc42. Obtained from: OpenBSD (Rev 1.2) MFC after: 2 weeks Modified: stable/8/contrib/gcclibs/libcpp/charset.c Directory Properties: stable/8/ (props changed) stable/8/contrib/ (props changed) stable/8/contrib/gcclibs/ (props changed) Modified: stable/8/contrib/gcclibs/libcpp/charset.c ============================================================================== --- stable/8/contrib/gcclibs/libcpp/charset.c Thu Dec 12 19:02:18 2013 (r259272) +++ stable/8/contrib/gcclibs/libcpp/charset.c Thu Dec 12 19:02:42 2013 (r259273) @@ -1628,7 +1628,7 @@ _cpp_convert_input (cpp_reader *pfile, c terminate with another \r, not an \n, so that we do not mistake the \r\n sequence for a single DOS line ending and erroneously issue the "No newline at end of file" diagnostic. */ - if (to.text[to.len - 1] == '\r') + if (to.len > 0 && to.text[to.len - 1] == '\r') to.text[to.len] = '\r'; else to.text[to.len] = '\n'; From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 19:18:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2574E824 for ; Thu, 12 Dec 2013 19:18:32 +0000 (UTC) Received: from nm24-vm0.bullet.mail.bf1.yahoo.com (nm24-vm0.bullet.mail.bf1.yahoo.com [98.139.213.161]) by mx1.freebsd.org (Postfix) with SMTP id AAE9C1F7B for ; Thu, 12 Dec 2013 19:18:31 +0000 (UTC) Received: from [98.139.212.152] by nm24.bullet.mail.bf1.yahoo.com with NNFMP; 12 Dec 2013 19:12:01 -0000 Received: from [98.139.211.196] by tm9.bullet.mail.bf1.yahoo.com with NNFMP; 12 Dec 2013 19:12:01 -0000 Received: from [127.0.0.1] by smtp205.mail.bf1.yahoo.com with NNFMP; 12 Dec 2013 19:12:01 -0000 X-Yahoo-Newman-Id: 108836.94461.bm@smtp205.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: xhTQvFEVM1mZejc0F0Y0w4Pkk89Kgo5IrHaN4Ld5LMykleU WZmISNuC5jzUTkoPWU1rb2gay_quVV_ux9lI.uTNjKQCEhHCQ7KBUWWUY.7Y ZoyVNvUOzRE2Di.K2DBjTLGdnpuLv1hGRKEFTKk6JMh99Rqa58FKHJXAkwuE tnR5VWilUovUJgVhDZeR_NtjG061py6ayVjCaft1KX1S6O5reGFlBI9DlHC8 QB1dLFcAdEYGZgcAj294To8NUg4KOAvJDmvXukBv7.oiGNzn_L6gweHeEY_i l5IwBieoSA1hadlx0H110_ufdNzFsgulCb0NxIMc2LxmZUZ9xWK71OeLKF0g tzOsfj6RlutILa.AMejert33wdEnNUQQlFoEXlvhFj6pAXo3nPF9SRLjvXSV C_BUekn_JrM6pyy2_WridlFVJlMllw.H8Ma8pGynwhC0Hyb9N0.kV2zBVpU1 288sbJy.qLPExDL1v6xN8nmmzmvugtu_s5tLZ5IYoB0KNYTho7cnhxpEBsyr mdYRgDipXvpYaWwj.tJNYojY3tdGaXcAq.lJd6rxwmQztf0AZOdXC0sPFVDa eYpgmCU0ZZsytJNwfqgRDohXNqMsi.Gm.X3eiNOM8h2lc6hOvTJcgscVtULL hRg7rMYPEyc3b52YLxBmArSUxkg-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with plain [98.138.105.21]) by smtp205.mail.bf1.yahoo.com with SMTP; 12 Dec 2013 11:12:00 -0800 PST Message-ID: <52AA0A7B.3000909@FreeBSD.org> Date: Thu, 12 Dec 2013 14:11:55 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.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 Subject: Re: svn commit: r259272 - stable/9/contrib/gcclibs/libcpp References: <201312121902.rBCJ2JMs039556@svn.freebsd.org> In-Reply-To: <201312121902.rBCJ2JMs039556@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 19:18:32 -0000 On 12.12.2013 14:02, Pedro F. Giffuni wrote: > Author: pfg > Date: Thu Dec 12 19:02:18 2013 > New Revision: 259272 > URL: http://svnweb.freebsd.org/changeset/base/259272 > > Log: > MFC r258712; > > libcpp: fix an underflow. > > Similar fix seen in Apple's gcc42. > > Obtained from: OpenBSD (Rev 1.2) > MFC after: 2 weeks > > Oops.. will obviously not be MFC'd again :-P. From owner-svn-src-stable@FreeBSD.ORG Thu Dec 12 21:51:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AD6F6F0; Thu, 12 Dec 2013 21:51:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 761A11C98; Thu, 12 Dec 2013 21:51:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBCLpYqv000706; Thu, 12 Dec 2013 21:51:34 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBCLpY6E000705; Thu, 12 Dec 2013 21:51:34 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <201312122151.rBCLpY6E000705@svn.freebsd.org> From: Craig Rodrigues Date: Thu, 12 Dec 2013 21:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259277 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 21:51:34 -0000 Author: rodrigc Date: Thu Dec 12 21:51:33 2013 New Revision: 259277 URL: http://svnweb.freebsd.org/changeset/base/259277 Log: MFC r259274 Mention BIND removal in release notes. Submitted by: skreuzer Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Directory Properties: stable/10/ (props changed) Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Dec 12 20:47:18 2013 (r259276) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Dec 12 21:51:33 2013 (r259277) @@ -328,6 +328,13 @@ Userland Changes + BIND has been replaced by &man.unbound.8; for + local dns resolution in the base system. With this change, nslookup + and dig are no longer a part of the base system. Users should + instead use &man.host.1; and &man.drill.1; Alternatively, + nslookup and dig can be obtained by installing the + dns/bind-tools port. + The &man.adduser.8; utility now supports a option to set the mode of a new user's home directory. From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 00:56:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD918485; Fri, 13 Dec 2013 00:56:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A8A4019CB; Fri, 13 Dec 2013 00:56:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD0u5kS066381; Fri, 13 Dec 2013 00:56:05 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD0u5Oq066380; Fri, 13 Dec 2013 00:56:05 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201312130056.rBD0u5Oq066380@svn.freebsd.org> From: Eitan Adler Date: Fri, 13 Dec 2013 00:56:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259281 - stable/10/usr.sbin/mtest X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 00:56:05 -0000 Author: eadler Date: Fri Dec 13 00:56:05 2013 New Revision: 259281 URL: http://svnweb.freebsd.org/changeset/base/259281 Log: MFC r259156: mtest(8): use correct macro in mdoc The An macros is used for authors while the Ar macro is used for arguments. AFAIK mcast-addr and ifname are not authors. PR: docs/184649 Modified: stable/10/usr.sbin/mtest/mtest.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mtest/mtest.8 ============================================================================== --- stable/10/usr.sbin/mtest/mtest.8 Thu Dec 12 22:33:32 2013 (r259280) +++ stable/10/usr.sbin/mtest/mtest.8 Fri Dec 13 00:56:05 2013 (r259281) @@ -131,9 +131,9 @@ to allow traffic from source Print .Ar n source filter entries for -.An mcast-addr +.Ar mcast-addr on interface -.An ifname . +.Ar ifname . .\" .Pp .It Ic f Ar filename From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 01:35:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 39F2D921; Fri, 13 Dec 2013 01:35:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2421E1DBC; Fri, 13 Dec 2013 01:35:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD1ZWnt081214; Fri, 13 Dec 2013 01:35:32 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD1ZWlH081213; Fri, 13 Dec 2013 01:35:32 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201312130135.rBD1ZWlH081213@svn.freebsd.org> From: Eitan Adler Date: Fri, 13 Dec 2013 01:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259282 - stable/9/usr.sbin/mtest X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 01:35:32 -0000 Author: eadler Date: Fri Dec 13 01:35:31 2013 New Revision: 259282 URL: http://svnweb.freebsd.org/changeset/base/259282 Log: mtest(8): use correct macro in mdoc The An macros is used for authors while the Ar macro is used for arguments. AFAIK mcast-addr and ifname are not authors. PR: docs/184649 Modified: stable/9/usr.sbin/mtest/mtest.8 Directory Properties: stable/9/usr.sbin/mtest/ (props changed) Modified: stable/9/usr.sbin/mtest/mtest.8 ============================================================================== --- stable/9/usr.sbin/mtest/mtest.8 Fri Dec 13 00:56:05 2013 (r259281) +++ stable/9/usr.sbin/mtest/mtest.8 Fri Dec 13 01:35:31 2013 (r259282) @@ -131,9 +131,9 @@ to allow traffic from source Print .Ar n source filter entries for -.An mcast-addr +.Ar mcast-addr on interface -.An ifname . +.Ar ifname . .\" .Pp .It Ic f Ar filename From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 02:21:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A8EDE1C; Fri, 13 Dec 2013 02:21:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 668861162; Fri, 13 Dec 2013 02:21:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD2LXBn099329; Fri, 13 Dec 2013 02:21:33 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD2LXYd099328; Fri, 13 Dec 2013 02:21:33 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312130221.rBD2LXYd099328@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 13 Dec 2013 02:21:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259283 - stable/9/contrib/libstdc++/include/std X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 02:21:33 -0000 Author: pfg Date: Fri Dec 13 02:21:32 2013 New Revision: 259283 URL: http://svnweb.freebsd.org/changeset/base/259283 Log: MFC r244673: Fix the __glibcxx_min and __glibcxx_max macros for a signed wchar_t. This seems to be needed by newer compilers. Modified: stable/9/contrib/libstdc++/include/std/std_limits.h Directory Properties: stable/9/ (props changed) stable/9/contrib/libstdc++/ (props changed) Modified: stable/9/contrib/libstdc++/include/std/std_limits.h ============================================================================== --- stable/9/contrib/libstdc++/include/std/std_limits.h Fri Dec 13 01:35:31 2013 (r259282) +++ stable/9/contrib/libstdc++/include/std/std_limits.h Fri Dec 13 02:21:32 2013 (r259283) @@ -134,10 +134,11 @@ #define __glibcxx_signed(T) ((T)(-1) < 0) #define __glibcxx_min(T) \ - (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0) + (__glibcxx_signed (T) ? (((T)1 << (__glibcxx_digits (T) - 1)) << 1) : (T)0) #define __glibcxx_max(T) \ - (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0) + (__glibcxx_signed (T) ? \ + (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0) #define __glibcxx_digits(T) \ (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 02:47:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 73C717D7; Fri, 13 Dec 2013 02:47:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5F8B812FC; Fri, 13 Dec 2013 02:47:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD2lgN2007419; Fri, 13 Dec 2013 02:47:42 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD2lgJg007418; Fri, 13 Dec 2013 02:47:42 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312130247.rBD2lgJg007418@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 13 Dec 2013 02:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259285 - stable/8/contrib/libstdc++/include/std X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 02:47:42 -0000 Author: pfg Date: Fri Dec 13 02:47:41 2013 New Revision: 259285 URL: http://svnweb.freebsd.org/changeset/base/259285 Log: MFC r244673: Fix the __glibcxx_min and __glibcxx_max macros for a signed wchar_t. This seems to be needed by newer compilers. Modified: stable/8/contrib/libstdc++/include/std/std_limits.h Directory Properties: stable/8/ (props changed) stable/8/contrib/ (props changed) stable/8/contrib/libstdc++/ (props changed) Modified: stable/8/contrib/libstdc++/include/std/std_limits.h ============================================================================== --- stable/8/contrib/libstdc++/include/std/std_limits.h Fri Dec 13 02:37:35 2013 (r259284) +++ stable/8/contrib/libstdc++/include/std/std_limits.h Fri Dec 13 02:47:41 2013 (r259285) @@ -134,10 +134,11 @@ #define __glibcxx_signed(T) ((T)(-1) < 0) #define __glibcxx_min(T) \ - (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0) + (__glibcxx_signed (T) ? (((T)1 << (__glibcxx_digits (T) - 1)) << 1) : (T)0) #define __glibcxx_max(T) \ - (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0) + (__glibcxx_signed (T) ? \ + (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0) #define __glibcxx_digits(T) \ (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 05:54:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9F02A63; Fri, 13 Dec 2013 05:54:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9584A14A9; Fri, 13 Dec 2013 05:54:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD5swoY075667; Fri, 13 Dec 2013 05:54:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD5swkx075666; Fri, 13 Dec 2013 05:54:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130554.rBD5swkx075666@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 05:54:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259289 - stable/9/lib/libc/stdlib X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 05:54:58 -0000 Author: kib Date: Fri Dec 13 05:54:58 2013 New Revision: 259289 URL: http://svnweb.freebsd.org/changeset/base/259289 Log: MFC r259042: Do not force to run atexit handlers, which text comes from a dso owning the handle passed to __cxa_finalize() but which are registered by other dso, when the process is inside exit(3). Modified: stable/9/lib/libc/stdlib/atexit.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdlib/atexit.c ============================================================================== --- stable/9/lib/libc/stdlib/atexit.c Fri Dec 13 05:54:30 2013 (r259288) +++ stable/9/lib/libc/stdlib/atexit.c Fri Dec 13 05:54:58 2013 (r259289) @@ -151,6 +151,8 @@ __cxa_atexit(void (*func)(void *), void #pragma weak __pthread_cxa_finalize void __pthread_cxa_finalize(const struct dl_phdr_info *); +static int global_exit; + /* * Call all handlers registered with __cxa_atexit for the shared * object owning 'dso'. Note: if 'dso' is NULL, then all remaining @@ -164,10 +166,12 @@ __cxa_finalize(void *dso) struct atexit_fn fn; int n, has_phdr; - if (dso != NULL) + if (dso != NULL) { has_phdr = _rtld_addr_phdr(dso, &phdr_info); - else + } else { has_phdr = 0; + global_exit = 1; + } _MUTEX_LOCK(&atexit_mutex); for (p = __atexit; p; p = p->next) { @@ -177,8 +181,9 @@ __cxa_finalize(void *dso) fn = p->fns[n]; if (dso != NULL && dso != fn.fn_dso) { /* wrong DSO ? */ - if (!has_phdr || !__elf_phdr_match_addr( - &phdr_info, fn.fn_ptr.cxa_func)) + if (!has_phdr || global_exit || + !__elf_phdr_match_addr(&phdr_info, + fn.fn_ptr.cxa_func)) continue; } /* @@ -200,6 +205,6 @@ __cxa_finalize(void *dso) if (dso == NULL) _MUTEX_DESTROY(&atexit_mutex); - if (has_phdr && &__pthread_cxa_finalize != NULL) + if (has_phdr && !global_exit && &__pthread_cxa_finalize != NULL) __pthread_cxa_finalize(&phdr_info); } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 05:54:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD5C0833; Fri, 13 Dec 2013 05:54:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B8BD614A0; Fri, 13 Dec 2013 05:54:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD5sUUP075592; Fri, 13 Dec 2013 05:54:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD5sU9Y075591; Fri, 13 Dec 2013 05:54:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130554.rBD5sU9Y075591@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 05:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259288 - stable/10/lib/libc/stdlib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 05:54:30 -0000 Author: kib Date: Fri Dec 13 05:54:30 2013 New Revision: 259288 URL: http://svnweb.freebsd.org/changeset/base/259288 Log: MFC r259042: Do not force to run atexit handlers, which text comes from a dso owning the handle passed to __cxa_finalize() but which are registered by other dso, when the process is inside exit(3). Modified: stable/10/lib/libc/stdlib/atexit.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdlib/atexit.c ============================================================================== --- stable/10/lib/libc/stdlib/atexit.c Fri Dec 13 05:54:25 2013 (r259287) +++ stable/10/lib/libc/stdlib/atexit.c Fri Dec 13 05:54:30 2013 (r259288) @@ -151,6 +151,8 @@ __cxa_atexit(void (*func)(void *), void #pragma weak __pthread_cxa_finalize void __pthread_cxa_finalize(const struct dl_phdr_info *); +static int global_exit; + /* * Call all handlers registered with __cxa_atexit for the shared * object owning 'dso'. Note: if 'dso' is NULL, then all remaining @@ -164,10 +166,12 @@ __cxa_finalize(void *dso) struct atexit_fn fn; int n, has_phdr; - if (dso != NULL) + if (dso != NULL) { has_phdr = _rtld_addr_phdr(dso, &phdr_info); - else + } else { has_phdr = 0; + global_exit = 1; + } _MUTEX_LOCK(&atexit_mutex); for (p = __atexit; p; p = p->next) { @@ -177,8 +181,9 @@ __cxa_finalize(void *dso) fn = p->fns[n]; if (dso != NULL && dso != fn.fn_dso) { /* wrong DSO ? */ - if (!has_phdr || !__elf_phdr_match_addr( - &phdr_info, fn.fn_ptr.cxa_func)) + if (!has_phdr || global_exit || + !__elf_phdr_match_addr(&phdr_info, + fn.fn_ptr.cxa_func)) continue; } /* @@ -200,6 +205,6 @@ __cxa_finalize(void *dso) if (dso == NULL) _MUTEX_DESTROY(&atexit_mutex); - if (has_phdr && &__pthread_cxa_finalize != NULL) + if (has_phdr && !global_exit && &__pthread_cxa_finalize != NULL) __pthread_cxa_finalize(&phdr_info); } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:00:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DABF6DAF; Fri, 13 Dec 2013 06:00:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C68B114E0; Fri, 13 Dec 2013 06:00:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD60iFP078916; Fri, 13 Dec 2013 06:00:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD60icu078913; Fri, 13 Dec 2013 06:00:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130600.rBD60icu078913@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:00:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259290 - stable/10/libexec/rtld-elf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:00:44 -0000 Author: kib Date: Fri Dec 13 06:00:44 2013 New Revision: 259290 URL: http://svnweb.freebsd.org/changeset/base/259290 Log: MFC r259043: Build an allocator for the aligned memory on top of the rtld-private malloc. Modified: stable/10/libexec/rtld-elf/rtld.h stable/10/libexec/rtld-elf/xmalloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/rtld-elf/rtld.h ============================================================================== --- stable/10/libexec/rtld-elf/rtld.h Fri Dec 13 05:54:58 2013 (r259289) +++ stable/10/libexec/rtld-elf/rtld.h Fri Dec 13 06:00:44 2013 (r259290) @@ -352,6 +352,8 @@ Obj_Entry *map_object(int, const char *, void *xcalloc(size_t, size_t); void *xmalloc(size_t); char *xstrdup(const char *); +void *malloc_aligned(size_t size, size_t align); +void free_aligned(void *ptr); extern Elf_Addr _GLOBAL_OFFSET_TABLE_[]; extern Elf_Sym sym_zero; /* For resolving undefined weak refs. */ Modified: stable/10/libexec/rtld-elf/xmalloc.c ============================================================================== --- stable/10/libexec/rtld-elf/xmalloc.c Fri Dec 13 05:54:58 2013 (r259289) +++ stable/10/libexec/rtld-elf/xmalloc.c Fri Dec 13 06:00:44 2013 (r259290) @@ -67,3 +67,33 @@ xstrdup(const char *str) memcpy(copy, str, len); return (copy); } + +void * +malloc_aligned(size_t size, size_t align) +{ + void *mem, *res; + uintptr_t x; + size_t asize, r; + + r = round(sizeof(void *), align); + asize = round(size, align) + r; + mem = xmalloc(asize); + x = (uintptr_t)mem; + res = (void *)round(x, align); + *(void **)((uintptr_t)res - sizeof(void *)) = mem; + return (res); +} + +void +free_aligned(void *ptr) +{ + void *mem; + uintptr_t x; + + if (ptr == NULL) + return; + x = (uintptr_t)ptr; + x -= sizeof(void *); + mem = *(void **)x; + free(mem); +} From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:01:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D410CEE5; Fri, 13 Dec 2013 06:01:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BFECF1530; Fri, 13 Dec 2013 06:01:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD61LS5079083; Fri, 13 Dec 2013 06:01:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD61LkD079081; Fri, 13 Dec 2013 06:01:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130601.rBD61LkD079081@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:01:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259291 - stable/9/libexec/rtld-elf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:01:21 -0000 Author: kib Date: Fri Dec 13 06:01:21 2013 New Revision: 259291 URL: http://svnweb.freebsd.org/changeset/base/259291 Log: MFC r259043: Build an allocator for the aligned memory on top of the rtld-private malloc. Modified: stable/9/libexec/rtld-elf/rtld.h stable/9/libexec/rtld-elf/xmalloc.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/rtld.h ============================================================================== --- stable/9/libexec/rtld-elf/rtld.h Fri Dec 13 06:00:44 2013 (r259290) +++ stable/9/libexec/rtld-elf/rtld.h Fri Dec 13 06:01:21 2013 (r259291) @@ -352,6 +352,8 @@ Obj_Entry *map_object(int, const char *, void *xcalloc(size_t, size_t); void *xmalloc(size_t); char *xstrdup(const char *); +void *malloc_aligned(size_t size, size_t align); +void free_aligned(void *ptr); extern Elf_Addr _GLOBAL_OFFSET_TABLE_[]; extern Elf_Sym sym_zero; /* For resolving undefined weak refs. */ Modified: stable/9/libexec/rtld-elf/xmalloc.c ============================================================================== --- stable/9/libexec/rtld-elf/xmalloc.c Fri Dec 13 06:00:44 2013 (r259290) +++ stable/9/libexec/rtld-elf/xmalloc.c Fri Dec 13 06:01:21 2013 (r259291) @@ -67,3 +67,33 @@ xstrdup(const char *str) memcpy(copy, str, len); return (copy); } + +void * +malloc_aligned(size_t size, size_t align) +{ + void *mem, *res; + uintptr_t x; + size_t asize, r; + + r = round(sizeof(void *), align); + asize = round(size, align) + r; + mem = xmalloc(asize); + x = (uintptr_t)mem; + res = (void *)round(x, align); + *(void **)((uintptr_t)res - sizeof(void *)) = mem; + return (res); +} + +void +free_aligned(void *ptr) +{ + void *mem; + uintptr_t x; + + if (ptr == NULL) + return; + x = (uintptr_t)ptr; + x -= sizeof(void *); + mem = *(void **)x; + free(mem); +} From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:06:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D64A21A3; Fri, 13 Dec 2013 06:06:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C1BC41580; Fri, 13 Dec 2013 06:06:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD6688K079901; Fri, 13 Dec 2013 06:06:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD668MB079900; Fri, 13 Dec 2013 06:06:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130606.rBD668MB079900@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259292 - stable/10/libexec/rtld-elf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:06:09 -0000 Author: kib Date: Fri Dec 13 06:06:08 2013 New Revision: 259292 URL: http://svnweb.freebsd.org/changeset/base/259292 Log: MFC r259044: For variant II static TLS, properly align tls segments. MFC r259072: Cast Elf_Addr to void * to match the free_aligned() argument type. Modified: stable/10/libexec/rtld-elf/rtld.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/rtld-elf/rtld.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld.c Fri Dec 13 06:01:21 2013 (r259291) +++ stable/10/libexec/rtld-elf/rtld.c Fri Dec 13 06:06:08 2013 (r259292) @@ -231,6 +231,7 @@ char **main_argv; size_t tls_last_offset; /* Static TLS offset of last module */ size_t tls_last_size; /* Static TLS size of last module */ size_t tls_static_space; /* Static TLS space allocated */ +size_t tls_static_max_align; int tls_dtv_generation = 1; /* Used to detect when dtv size changes */ int tls_max_index = 1; /* Largest module index allocated */ @@ -4276,19 +4277,22 @@ void * allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) { Obj_Entry *obj; - size_t size; + size_t size, ralign; char *tls; Elf_Addr *dtv, *olddtv; Elf_Addr segbase, oldsegbase, addr; int i; - size = round(tls_static_space, tcbalign); + ralign = tcbalign; + if (tls_static_max_align > ralign) + ralign = tls_static_max_align; + size = round(tls_static_space, ralign) + round(tcbsize, ralign); assert(tcbsize >= 2*sizeof(Elf_Addr)); - tls = xcalloc(1, size + tcbsize); + tls = malloc_aligned(size, ralign); dtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); - segbase = (Elf_Addr)(tls + size); + segbase = (Elf_Addr)(tls + round(tls_static_space, ralign)); ((Elf_Addr*)segbase)[0] = segbase; ((Elf_Addr*)segbase)[1] = (Elf_Addr) dtv; @@ -4340,8 +4344,8 @@ allocate_tls(Obj_Entry *objs, void *oldt void free_tls(void *tls, size_t tcbsize, size_t tcbalign) { - size_t size; Elf_Addr* dtv; + size_t size, ralign; int dtvsize, i; Elf_Addr tlsstart, tlsend; @@ -4349,19 +4353,22 @@ free_tls(void *tls, size_t tcbsize, size * Figure out the size of the initial TLS block so that we can * find stuff which ___tls_get_addr() allocated dynamically. */ - size = round(tls_static_space, tcbalign); + ralign = tcbalign; + if (tls_static_max_align > ralign) + ralign = tls_static_max_align; + size = round(tls_static_space, ralign); dtv = ((Elf_Addr**)tls)[1]; dtvsize = dtv[1]; tlsend = (Elf_Addr) tls; tlsstart = tlsend - size; for (i = 0; i < dtvsize; i++) { - if (dtv[i+2] && (dtv[i+2] < tlsstart || dtv[i+2] > tlsend)) { - free((void*) dtv[i+2]); + if (dtv[i + 2] != 0 && (dtv[i + 2] < tlsstart || dtv[i + 2] > tlsend)) { + free_aligned((void *)dtv[i + 2]); } } - free((void*) tlsstart); + free_aligned((void *)tlsstart); free((void*) dtv); } @@ -4385,11 +4392,7 @@ allocate_module_tls(int index) die(); } - p = malloc(obj->tlssize); - if (p == NULL) { - _rtld_error("Cannot allocate TLS block for index %d", index); - die(); - } + p = malloc_aligned(obj->tlssize, obj->tlsalign); memcpy(p, obj->tlsinit, obj->tlsinitsize); memset(p + obj->tlsinitsize, 0, obj->tlssize - obj->tlsinitsize); @@ -4421,9 +4424,11 @@ allocate_tls_offset(Obj_Entry *obj) * leave a small amount of space spare to be used for dynamically * loading modules which use static TLS. */ - if (tls_static_space) { + if (tls_static_space != 0) { if (calculate_tls_end(off, obj->tlssize) > tls_static_space) return false; + } else if (obj->tlsalign > tls_static_max_align) { + tls_static_max_align = obj->tlsalign; } tls_last_offset = obj->tlsoffset = off; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:06:25 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BDF812E4; Fri, 13 Dec 2013 06:06:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A8025158A; Fri, 13 Dec 2013 06:06:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD66PVr079981; Fri, 13 Dec 2013 06:06:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD66Pwu079980; Fri, 13 Dec 2013 06:06:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130606.rBD66Pwu079980@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259293 - stable/9/libexec/rtld-elf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:06:25 -0000 Author: kib Date: Fri Dec 13 06:06:25 2013 New Revision: 259293 URL: http://svnweb.freebsd.org/changeset/base/259293 Log: MFC r259044: For variant II static TLS, properly align tls segments. MFC r259072: Cast Elf_Addr to void * to match the free_aligned() argument type. Modified: stable/9/libexec/rtld-elf/rtld.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Fri Dec 13 06:06:08 2013 (r259292) +++ stable/9/libexec/rtld-elf/rtld.c Fri Dec 13 06:06:25 2013 (r259293) @@ -231,6 +231,7 @@ char **main_argv; size_t tls_last_offset; /* Static TLS offset of last module */ size_t tls_last_size; /* Static TLS size of last module */ size_t tls_static_space; /* Static TLS space allocated */ +size_t tls_static_max_align; int tls_dtv_generation = 1; /* Used to detect when dtv size changes */ int tls_max_index = 1; /* Largest module index allocated */ @@ -4281,19 +4282,22 @@ void * allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) { Obj_Entry *obj; - size_t size; + size_t size, ralign; char *tls; Elf_Addr *dtv, *olddtv; Elf_Addr segbase, oldsegbase, addr; int i; - size = round(tls_static_space, tcbalign); + ralign = tcbalign; + if (tls_static_max_align > ralign) + ralign = tls_static_max_align; + size = round(tls_static_space, ralign) + round(tcbsize, ralign); assert(tcbsize >= 2*sizeof(Elf_Addr)); - tls = xcalloc(1, size + tcbsize); + tls = malloc_aligned(size, ralign); dtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); - segbase = (Elf_Addr)(tls + size); + segbase = (Elf_Addr)(tls + round(tls_static_space, ralign)); ((Elf_Addr*)segbase)[0] = segbase; ((Elf_Addr*)segbase)[1] = (Elf_Addr) dtv; @@ -4345,8 +4349,8 @@ allocate_tls(Obj_Entry *objs, void *oldt void free_tls(void *tls, size_t tcbsize, size_t tcbalign) { - size_t size; Elf_Addr* dtv; + size_t size, ralign; int dtvsize, i; Elf_Addr tlsstart, tlsend; @@ -4354,19 +4358,22 @@ free_tls(void *tls, size_t tcbsize, size * Figure out the size of the initial TLS block so that we can * find stuff which ___tls_get_addr() allocated dynamically. */ - size = round(tls_static_space, tcbalign); + ralign = tcbalign; + if (tls_static_max_align > ralign) + ralign = tls_static_max_align; + size = round(tls_static_space, ralign); dtv = ((Elf_Addr**)tls)[1]; dtvsize = dtv[1]; tlsend = (Elf_Addr) tls; tlsstart = tlsend - size; for (i = 0; i < dtvsize; i++) { - if (dtv[i+2] && (dtv[i+2] < tlsstart || dtv[i+2] > tlsend)) { - free((void*) dtv[i+2]); + if (dtv[i + 2] != 0 && (dtv[i + 2] < tlsstart || dtv[i + 2] > tlsend)) { + free_aligned((void *)dtv[i + 2]); } } - free((void*) tlsstart); + free_aligned((void *)tlsstart); free((void*) dtv); } @@ -4390,11 +4397,7 @@ allocate_module_tls(int index) die(); } - p = malloc(obj->tlssize); - if (p == NULL) { - _rtld_error("Cannot allocate TLS block for index %d", index); - die(); - } + p = malloc_aligned(obj->tlssize, obj->tlsalign); memcpy(p, obj->tlsinit, obj->tlsinitsize); memset(p + obj->tlsinitsize, 0, obj->tlssize - obj->tlsinitsize); @@ -4426,9 +4429,11 @@ allocate_tls_offset(Obj_Entry *obj) * leave a small amount of space spare to be used for dynamically * loading modules which use static TLS. */ - if (tls_static_space) { + if (tls_static_space != 0) { if (calculate_tls_end(off, obj->tlssize) > tls_static_space) return false; + } else if (obj->tlsalign > tls_static_max_align) { + tls_static_max_align = obj->tlsalign; } tls_last_offset = obj->tlsoffset = off; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:09:20 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 860E7496; Fri, 13 Dec 2013 06:09:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 669FC15A3; Fri, 13 Dec 2013 06:09:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD69K0Q080478; Fri, 13 Dec 2013 06:09:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD69JXG080475; Fri, 13 Dec 2013 06:09:19 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130609.rBD69JXG080475@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:09:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259294 - in stable/10/sys: kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:09:20 -0000 Author: kib Date: Fri Dec 13 06:09:19 2013 New Revision: 259294 URL: http://svnweb.freebsd.org/changeset/base/259294 Log: MFC r257898: Change VFS_PROLOGUE() to evaluate the mp once, convert MNTK_SHARED_WRITES and MNTK_EXTENDED_SHARED tests into inline functions. Modified: stable/10/sys/kern/vfs_lookup.c stable/10/sys/kern/vfs_vnops.c stable/10/sys/sys/mount.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_lookup.c ============================================================================== --- stable/10/sys/kern/vfs_lookup.c Fri Dec 13 06:06:25 2013 (r259293) +++ stable/10/sys/kern/vfs_lookup.c Fri Dec 13 06:09:19 2013 (r259294) @@ -424,13 +424,8 @@ needs_exclusive_leaf(struct mount *mp, i * extended shared operations, then use a shared lock for the * leaf node, otherwise use an exclusive lock. */ - if (flags & ISOPEN) { - if (mp != NULL && - (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED)) - return (0); - else - return (1); - } + if ((flags & ISOPEN) != 0) + return (!MNT_EXTENDED_SHARED(mp)); /* * Lookup requests outside of open() that specify LOCKSHARED Modified: stable/10/sys/kern/vfs_vnops.c ============================================================================== --- stable/10/sys/kern/vfs_vnops.c Fri Dec 13 06:06:25 2013 (r259293) +++ stable/10/sys/kern/vfs_vnops.c Fri Dec 13 06:09:19 2013 (r259294) @@ -360,8 +360,8 @@ vn_close(vp, flags, file_cred, td) struct mount *mp; int error, lock_flags; - if (vp->v_type != VFIFO && !(flags & FWRITE) && vp->v_mount != NULL && - vp->v_mount->mnt_kern_flag & MNTK_EXTENDED_SHARED) + if (vp->v_type != VFIFO && (flags & FWRITE) == 0 && + MNT_EXTENDED_SHARED(vp->v_mount)) lock_flags = LK_SHARED; else lock_flags = LK_EXCLUSIVE; Modified: stable/10/sys/sys/mount.h ============================================================================== --- stable/10/sys/sys/mount.h Fri Dec 13 06:06:25 2013 (r259293) +++ stable/10/sys/sys/mount.h Fri Dec 13 06:09:19 2013 (r259294) @@ -362,8 +362,19 @@ void __mnt_vnode_markerfree_act #define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */ #define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */ -#define MNT_SHARED_WRITES(mp) (((mp) != NULL) && \ - ((mp)->mnt_kern_flag & MNTK_SHARED_WRITES)) +static inline int +MNT_SHARED_WRITES(struct mount *mp) +{ + + return (mp != NULL && (mp->mnt_kern_flag & MNTK_SHARED_WRITES) != 0); +} + +static inline int +MNT_EXTENDED_SHARED(struct mount *mp) +{ + + return (mp != NULL && (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED) != 0); +} /* * Sysctl CTL_VFS definitions. @@ -636,10 +647,12 @@ struct vfsops { vfs_statfs_t __vfs_statfs; #define VFS_PROLOGUE(MP) do { \ + struct mount *mp__; \ int _enable_stops; \ \ - _enable_stops = ((MP) != NULL && \ - ((MP)->mnt_vfc->vfc_flags & VFCF_SBDRY) && sigdeferstop()) + mp__ = (MP); \ + _enable_stops = (mp__ != NULL && \ + (mp__->mnt_vfc->vfc_flags & VFCF_SBDRY) && sigdeferstop()) #define VFS_EPILOGUE(MP) \ if (_enable_stops) \ From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:10:49 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1B61642; Fri, 13 Dec 2013 06:10:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BDE7D15F9; Fri, 13 Dec 2013 06:10:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD6AnTm082581; Fri, 13 Dec 2013 06:10:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD6An01082580; Fri, 13 Dec 2013 06:10:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130610.rBD6An01082580@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259295 - stable/10/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:10:49 -0000 Author: kib Date: Fri Dec 13 06:10:49 2013 New Revision: 259295 URL: http://svnweb.freebsd.org/changeset/base/259295 Log: MFC r257904: Hide MNT_SHARED_WRITES() and MNT_EXTENDED_SHARED() under the #ifdef _KERNEL braces. Struct mount is only defined for the kernel build. Modified: stable/10/sys/sys/mount.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/mount.h ============================================================================== --- stable/10/sys/sys/mount.h Fri Dec 13 06:09:19 2013 (r259294) +++ stable/10/sys/sys/mount.h Fri Dec 13 06:10:49 2013 (r259295) @@ -362,6 +362,7 @@ void __mnt_vnode_markerfree_act #define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */ #define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */ +#ifdef _KERNEL static inline int MNT_SHARED_WRITES(struct mount *mp) { @@ -375,6 +376,7 @@ MNT_EXTENDED_SHARED(struct mount *mp) return (mp != NULL && (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED) != 0); } +#endif /* * Sysctl CTL_VFS definitions. From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:12:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA4397C1; Fri, 13 Dec 2013 06:12:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9C203160D; Fri, 13 Dec 2013 06:12:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD6CMwG083420; Fri, 13 Dec 2013 06:12:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD6CMM7083417; Fri, 13 Dec 2013 06:12:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130612.rBD6CMM7083417@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259296 - in stable/10/sys: kern vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:12:22 -0000 Author: kib Date: Fri Dec 13 06:12:21 2013 New Revision: 259296 URL: http://svnweb.freebsd.org/changeset/base/259296 Log: MFC r257899: If filesystem declares that it supports shared locking for writes, use shared vnode lock for VOP_PUTPAGES() as well. Modified: stable/10/sys/kern/vnode_if.src stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vnode_if.src ============================================================================== --- stable/10/sys/kern/vnode_if.src Fri Dec 13 06:10:49 2013 (r259295) +++ stable/10/sys/kern/vnode_if.src Fri Dec 13 06:12:21 2013 (r259296) @@ -477,7 +477,7 @@ vop_getpages { }; -%% putpages vp E E E +%% putpages vp L L L vop_putpages { IN struct vnode *vp; Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Fri Dec 13 06:10:49 2013 (r259295) +++ stable/10/sys/vm/vm_pageout.c Fri Dec 13 06:12:21 2013 (r259296) @@ -570,6 +570,7 @@ vm_pageout_launder(struct vm_pagequeue * vm_object_t object; vm_paddr_t pa; vm_page_t m, m_tmp, next; + int lockmode; vm_pagequeue_lock(pq); TAILQ_FOREACH_SAFE(m, &pq->pq_pl, plinks.q, next) { @@ -605,7 +606,9 @@ vm_pageout_launder(struct vm_pagequeue * vm_object_reference_locked(object); VM_OBJECT_WUNLOCK(object); (void)vn_start_write(vp, &mp, V_WAIT); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + lockmode = MNT_SHARED_WRITES(vp->v_mount) ? + LK_SHARED : LK_EXCLUSIVE; + vn_lock(vp, lockmode | LK_RETRY); VM_OBJECT_WLOCK(object); vm_object_page_clean(object, 0, 0, OBJPC_SYNC); VM_OBJECT_WUNLOCK(object); @@ -902,6 +905,7 @@ vm_pageout_scan(struct vm_domain *vmd, i int act_delta; int vnodes_skipped = 0; int maxlaunder; + int lockmode; boolean_t queues_locked; /* @@ -1193,7 +1197,9 @@ vm_pageout_scan(struct vm_domain *vmd, i ("vp %p with NULL v_mount", vp)); vm_object_reference_locked(object); VM_OBJECT_WUNLOCK(object); - if (vget(vp, LK_EXCLUSIVE | LK_TIMELOCK, + lockmode = MNT_SHARED_WRITES(vp->v_mount) ? + LK_SHARED : LK_EXCLUSIVE; + if (vget(vp, lockmode | LK_TIMELOCK, curthread)) { VM_OBJECT_WLOCK(object); ++pageout_lock_miss; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:25:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9EDEFC88; Fri, 13 Dec 2013 06:25:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 89BB916DA; Fri, 13 Dec 2013 06:25:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD6P80h087226; Fri, 13 Dec 2013 06:25:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD6P8Nt087225; Fri, 13 Dec 2013 06:25:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130625.rBD6P8Nt087225@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259297 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:25:08 -0000 Author: kib Date: Fri Dec 13 06:25:08 2013 New Revision: 259297 URL: http://svnweb.freebsd.org/changeset/base/259297 Log: MFC r258366: Add assertions to cover all places in the wiring and unwiring code where MAP_ENTRY_IN_TRANSITION is set or cleared. Modified: stable/10/sys/vm/vm_map.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_map.c ============================================================================== --- stable/10/sys/vm/vm_map.c Fri Dec 13 06:12:21 2013 (r259296) +++ stable/10/sys/vm/vm_map.c Fri Dec 13 06:25:08 2013 (r259297) @@ -2288,6 +2288,9 @@ vm_map_unwire(vm_map_t map, vm_offset_t * Mark the entry in case the map lock is released. (See * above.) */ + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) == 0 && + entry->wiring_thread == NULL, + ("owned map entry %p", entry)); entry->eflags |= MAP_ENTRY_IN_TRANSITION; entry->wiring_thread = curthread; /* @@ -2356,7 +2359,9 @@ done: } } KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, - ("vm_map_unwire: in-transition flag missing")); + ("vm_map_unwire: in-transition flag missing %p", entry)); + KASSERT(entry->wiring_thread == curthread, + ("vm_map_unwire: alien wire %p", entry)); entry->eflags &= ~MAP_ENTRY_IN_TRANSITION; entry->wiring_thread = NULL; if (entry->eflags & MAP_ENTRY_NEEDS_WAKEUP) { @@ -2456,6 +2461,9 @@ vm_map_wire(vm_map_t map, vm_offset_t st * Mark the entry in case the map lock is released. (See * above.) */ + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) == 0 && + entry->wiring_thread == NULL, + ("owned map entry %p", entry)); entry->eflags |= MAP_ENTRY_IN_TRANSITION; entry->wiring_thread = curthread; if ((entry->protection & (VM_PROT_READ | VM_PROT_EXECUTE)) == 0 From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:25:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 45733DE2; Fri, 13 Dec 2013 06:25:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2940616E4; Fri, 13 Dec 2013 06:25:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD6PikT087312; Fri, 13 Dec 2013 06:25:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD6PikL087311; Fri, 13 Dec 2013 06:25:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130625.rBD6PikL087311@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259298 - stable/9/sys/vm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:25:44 -0000 Author: kib Date: Fri Dec 13 06:25:43 2013 New Revision: 259298 URL: http://svnweb.freebsd.org/changeset/base/259298 Log: MFC r258366: Add assertions to cover all places in the wiring and unwiring code where MAP_ENTRY_IN_TRANSITION is set or cleared. 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 Fri Dec 13 06:25:08 2013 (r259297) +++ stable/9/sys/vm/vm_map.c Fri Dec 13 06:25:43 2013 (r259298) @@ -2289,6 +2289,9 @@ vm_map_unwire(vm_map_t map, vm_offset_t * Mark the entry in case the map lock is released. (See * above.) */ + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) == 0 && + entry->wiring_thread == NULL, + ("owned map entry %p", entry)); entry->eflags |= MAP_ENTRY_IN_TRANSITION; entry->wiring_thread = curthread; /* @@ -2357,7 +2360,9 @@ done: } } KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, - ("vm_map_unwire: in-transition flag missing")); + ("vm_map_unwire: in-transition flag missing %p", entry)); + KASSERT(entry->wiring_thread == curthread, + ("vm_map_unwire: alien wire %p", entry)); entry->eflags &= ~MAP_ENTRY_IN_TRANSITION; entry->wiring_thread = NULL; if (entry->eflags & MAP_ENTRY_NEEDS_WAKEUP) { @@ -2457,6 +2462,9 @@ vm_map_wire(vm_map_t map, vm_offset_t st * Mark the entry in case the map lock is released. (See * above.) */ + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) == 0 && + entry->wiring_thread == NULL, + ("owned map entry %p", entry)); entry->eflags |= MAP_ENTRY_IN_TRANSITION; entry->wiring_thread = curthread; if ((entry->protection & (VM_PROT_READ | VM_PROT_EXECUTE)) == 0 From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:28:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 37790FDD; Fri, 13 Dec 2013 06:28:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 09016170B; Fri, 13 Dec 2013 06:28:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD6SIAm087643; Fri, 13 Dec 2013 06:28:18 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD6SIh7087642; Fri, 13 Dec 2013 06:28:18 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130628.rBD6SIh7087642@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259299 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:28:19 -0000 Author: kib Date: Fri Dec 13 06:28:18 2013 New Revision: 259299 URL: http://svnweb.freebsd.org/changeset/base/259299 Log: MFC r258367: Verify for zero-length requests and act as if it is always successfull without performing any action on the address space. Modified: stable/10/sys/vm/vm_map.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_map.c ============================================================================== --- stable/10/sys/vm/vm_map.c Fri Dec 13 06:25:43 2013 (r259298) +++ stable/10/sys/vm/vm_map.c Fri Dec 13 06:28:18 2013 (r259299) @@ -1876,6 +1876,9 @@ vm_map_protect(vm_map_t map, vm_offset_t struct ucred *cred; vm_prot_t old_prot; + if (start == end) + return (KERN_SUCCESS); + vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); @@ -2030,12 +2033,16 @@ vm_map_madvise( case MADV_AUTOSYNC: case MADV_NOCORE: case MADV_CORE: + if (start == end) + return (KERN_SUCCESS); modify_map = 1; vm_map_lock(map); break; case MADV_WILLNEED: case MADV_DONTNEED: case MADV_FREE: + if (start == end) + return (KERN_SUCCESS); vm_map_lock_read(map); break; default: @@ -2190,6 +2197,8 @@ vm_map_inherit(vm_map_t map, vm_offset_t default: return (KERN_INVALID_ARGUMENT); } + if (start == end) + return (KERN_SUCCESS); vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); if (vm_map_lookup_entry(map, start, &temp_entry)) { @@ -2222,6 +2231,8 @@ vm_map_unwire(vm_map_t map, vm_offset_t int rv; boolean_t need_wakeup, result, user_unwire; + if (start == end) + return (KERN_SUCCESS); user_unwire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); @@ -2392,6 +2403,8 @@ vm_map_wire(vm_map_t map, vm_offset_t st boolean_t fictitious, need_wakeup, result, user_wire; vm_prot_t prot; + if (start == end) + return (KERN_SUCCESS); prot = 0; if (flags & VM_MAP_WIRE_WRITE) prot |= VM_PROT_WRITE; @@ -2833,6 +2846,8 @@ vm_map_delete(vm_map_t map, vm_offset_t vm_map_entry_t first_entry; VM_MAP_ASSERT_LOCKED(map); + if (start == end) + return (KERN_SUCCESS); /* * Find the start of the region, and clip it From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:29:03 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 232D21AA; Fri, 13 Dec 2013 06:29:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E93961712; Fri, 13 Dec 2013 06:29:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD6T2SC087751; Fri, 13 Dec 2013 06:29:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD6T2je087750; Fri, 13 Dec 2013 06:29:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312130629.rBD6T2je087750@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Dec 2013 06:29:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259300 - stable/9/sys/vm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:29:03 -0000 Author: kib Date: Fri Dec 13 06:29:02 2013 New Revision: 259300 URL: http://svnweb.freebsd.org/changeset/base/259300 Log: MFC r258367: Verify for zero-length requests and act as if it is always successfull without performing any action on the address space. 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 Fri Dec 13 06:28:18 2013 (r259299) +++ stable/9/sys/vm/vm_map.c Fri Dec 13 06:29:02 2013 (r259300) @@ -1894,6 +1894,9 @@ vm_map_protect(vm_map_t map, vm_offset_t struct ucred *cred; vm_prot_t old_prot; + if (start == end) + return (KERN_SUCCESS); + vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); @@ -2048,12 +2051,16 @@ vm_map_madvise( case MADV_AUTOSYNC: case MADV_NOCORE: case MADV_CORE: + if (start == end) + return (KERN_SUCCESS); modify_map = 1; vm_map_lock(map); break; case MADV_WILLNEED: case MADV_DONTNEED: case MADV_FREE: + if (start == end) + return (KERN_SUCCESS); vm_map_lock_read(map); break; default: @@ -2191,6 +2198,8 @@ vm_map_inherit(vm_map_t map, vm_offset_t default: return (KERN_INVALID_ARGUMENT); } + if (start == end) + return (KERN_SUCCESS); vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); if (vm_map_lookup_entry(map, start, &temp_entry)) { @@ -2223,6 +2232,8 @@ vm_map_unwire(vm_map_t map, vm_offset_t int rv; boolean_t need_wakeup, result, user_unwire; + if (start == end) + return (KERN_SUCCESS); user_unwire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); @@ -2393,6 +2404,8 @@ vm_map_wire(vm_map_t map, vm_offset_t st boolean_t fictitious, need_wakeup, result, user_wire; vm_prot_t prot; + if (start == end) + return (KERN_SUCCESS); prot = 0; if (flags & VM_MAP_WIRE_WRITE) prot |= VM_PROT_WRITE; @@ -2835,6 +2848,8 @@ vm_map_delete(vm_map_t map, vm_offset_t vm_map_entry_t first_entry; VM_MAP_ASSERT_LOCKED(map); + if (start == end) + return (KERN_SUCCESS); /* * Find the start of the region, and clip it From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 06:59:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 655B5B22; Fri, 13 Dec 2013 06:59:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4F34119BD; Fri, 13 Dec 2013 06:59:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBD6xLZ9098170; Fri, 13 Dec 2013 06:59:21 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBD6xIEa098153; Fri, 13 Dec 2013 06:59:18 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201312130659.rBD6xIEa098153@svn.freebsd.org> From: Peter Grehan Date: Fri, 13 Dec 2013 06:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259301 - in stable/10/usr.sbin: bhyve bhyveload X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 06:59:21 -0000 Author: grehan Date: Fri Dec 13 06:59:18 2013 New Revision: 259301 URL: http://svnweb.freebsd.org/changeset/base/259301 Log: MFC r256657,r257018,r257347,r257423,r257729,r257767, r257933,r258609,r258614,r258668,r258673,r258855 Pull in some minor bugfixes and functionality enhancements from CURRENT. These are candidates to be moved to 10.0-release. r258855 mdoc: quote string properly. r258673 Don't create an initial value for the host filesystem of "/". r258668 Allow bhyve and bhyveload to attach to tty devices. r258614 The 22-bit Data Byte Count (DBC) field of a Physical Region Descriptor was being read as a 32-bit quantity by the bhyve AHCI driver. r258609 Fix discrepancy between the IOAPIC ID advertised by firmware tables and the actual value read by the guest. r257933 Route the legacy timer interrupt (IRQ0) to pin 2 of the IOAPIC. r257767 Fix an off-by-one error when iterating over the emulated PCI BARs. r257729 Add the VM name to the process name with setproctitle(). r257423 Make the virtual ioapic available unconditionally in a bhyve virtual machine. r257347 Update copyright to include the author of the LPC bridge emulation code. hand-merge r257018 Tidy usage messages for bhyve and bhyveload. r256657 Add an option to bhyveload(8) that allows setting a loader environment variable from the command line. Discussed with: neel Modified: stable/10/usr.sbin/bhyve/acpi.c stable/10/usr.sbin/bhyve/acpi.h stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyve/block_if.c stable/10/usr.sbin/bhyve/mevent.c stable/10/usr.sbin/bhyve/mptbl.c stable/10/usr.sbin/bhyve/mptbl.h stable/10/usr.sbin/bhyve/pci_ahci.c stable/10/usr.sbin/bhyve/pci_emul.c stable/10/usr.sbin/bhyve/pci_virtio_net.c stable/10/usr.sbin/bhyve/pit_8254.c stable/10/usr.sbin/bhyve/uart_emul.c stable/10/usr.sbin/bhyveload/bhyveload.8 stable/10/usr.sbin/bhyveload/bhyveload.c Modified: stable/10/usr.sbin/bhyve/acpi.c ============================================================================== --- stable/10/usr.sbin/bhyve/acpi.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/acpi.c Fri Dec 13 06:59:18 2013 (r259301) @@ -253,13 +253,23 @@ basl_fwrite_madt(FILE *fp) EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n"); EFPRINTF(fp, "[0001]\t\tLength : 0C\n"); /* iasl expects a hex value for the i/o apic id */ - EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", basl_ncpu); + EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", 0); EFPRINTF(fp, "[0001]\t\tReserved : 00\n"); EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n"); EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n"); EFPRINTF(fp, "\n"); - /* Override the 8259 chained vector. XXX maybe not needed */ + /* Legacy IRQ0 is connected to pin 2 of the IOAPIC */ + EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n"); + EFPRINTF(fp, "[0001]\t\tLength : 0A\n"); + EFPRINTF(fp, "[0001]\t\tBus : 00\n"); + EFPRINTF(fp, "[0001]\t\tSource : 00\n"); + EFPRINTF(fp, "[0004]\t\tInterrupt : 00000002\n"); + EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n"); + EFPRINTF(fp, "\t\t\tPolarity : 1\n"); + EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n"); + EFPRINTF(fp, "\n"); + EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n"); EFPRINTF(fp, "[0001]\t\tLength : 0A\n"); EFPRINTF(fp, "[0001]\t\tBus : 00\n"); @@ -806,7 +816,7 @@ static struct { }; int -acpi_build(struct vmctx *ctx, int ncpu, int ioapic) +acpi_build(struct vmctx *ctx, int ncpu) { int err; int i; @@ -814,11 +824,6 @@ acpi_build(struct vmctx *ctx, int ncpu, err = 0; basl_ncpu = ncpu; - if (!ioapic) { - fprintf(stderr, "ACPI tables require an ioapic\n"); - return (EINVAL); - } - /* * For debug, allow the user to have iasl compiler output sent * to stdout rather than /dev/null Modified: stable/10/usr.sbin/bhyve/acpi.h ============================================================================== --- stable/10/usr.sbin/bhyve/acpi.h Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/acpi.h Fri Dec 13 06:59:18 2013 (r259301) @@ -29,6 +29,6 @@ #ifndef _ACPI_H_ #define _ACPI_H_ -int acpi_build(struct vmctx *ctx, int ncpu, int ioapic); +int acpi_build(struct vmctx *ctx, int ncpu); #endif /* _ACPI_H_ */ Modified: stable/10/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/bhyverun.c Fri Dec 13 06:59:18 2013 (r259301) @@ -132,7 +132,6 @@ usage(int code) " -c: # cpus (default 1)\n" " -p: pin vcpu 'n' to host cpu 'pincpu + n'\n" " -H: vmexit from the guest on hlt\n" - " -I: present an ioapic to the guest\n" " -P: vmexit from the guest on pause\n" " -W: force virtio to use single-vector MSI\n" " -e: exit on unhandled I/O access\n" @@ -191,7 +190,7 @@ fbsdrun_start_thread(void *param) mtp = param; vcpu = mtp->mt_vcpu; - snprintf(tname, sizeof(tname), "%s vcpu %d", vmname, vcpu); + snprintf(tname, sizeof(tname), "vcpu %d", vcpu); pthread_set_name_np(mtp->mt_thr, tname); vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip); @@ -543,7 +542,7 @@ fbsdrun_set_capabilities(struct vmctx *c int main(int argc, char *argv[]) { - int c, error, gdb_port, err, ioapic, bvmcons; + int c, error, gdb_port, err, bvmcons; int max_vcpus; struct vmctx *ctx; uint64_t rip; @@ -553,7 +552,6 @@ main(int argc, char *argv[]) progname = basename(argv[0]); gdb_port = 0; guest_ncpus = 1; - ioapic = 0; memsize = 256 * MB; while ((c = getopt(argc, argv, "abehAHIPWp:g:c:s:S:m:l:")) != -1) { @@ -601,7 +599,13 @@ main(int argc, char *argv[]) guest_vmexit_on_hlt = 1; break; case 'I': - ioapic = 1; + /* + * The "-I" option was used to add an ioapic to the + * virtual machine. + * + * An ioapic is now provided unconditionally for each + * virtual machine and this option is now deprecated. + */ break; case 'P': guest_vmexit_on_pause = 1; @@ -659,8 +663,7 @@ main(int argc, char *argv[]) if (init_pci(ctx) != 0) exit(1); - if (ioapic) - ioapic_init(0); + ioapic_init(0); if (gdb_port != 0) init_dbgport(gdb_port); @@ -674,14 +677,19 @@ main(int argc, char *argv[]) /* * build the guest tables, MP etc. */ - mptable_build(ctx, guest_ncpus, ioapic); + mptable_build(ctx, guest_ncpus); if (acpi) { - error = acpi_build(ctx, guest_ncpus, ioapic); + error = acpi_build(ctx, guest_ncpus); assert(error == 0); } /* + * Change the proc title to include the VM name. + */ + setproctitle("%s", vmname); + + /* * Add CPU 0 */ fbsdrun_addcpu(ctx, BSP, rip); Modified: stable/10/usr.sbin/bhyve/block_if.c ============================================================================== --- stable/10/usr.sbin/bhyve/block_if.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/block_if.c Fri Dec 13 06:59:18 2013 (r259301) @@ -293,7 +293,7 @@ blockif_open(const char *optstr, const c pthread_create(&bc->bc_btid, NULL, blockif_thr, bc); - snprintf(tname, sizeof(tname), "%s blk-%s", vmname, ident); + snprintf(tname, sizeof(tname), "blk-%s", ident); pthread_set_name_np(bc->bc_btid, tname); return (bc); Modified: stable/10/usr.sbin/bhyve/mevent.c ============================================================================== --- stable/10/usr.sbin/bhyve/mevent.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/mevent.c Fri Dec 13 06:59:18 2013 (r259301) @@ -381,10 +381,8 @@ mevent_delete_close(struct mevent *evp) static void mevent_set_name(void) { - char tname[MAXCOMLEN + 1]; - snprintf(tname, sizeof(tname), "%s mevent", vmname); - pthread_set_name_np(mevent_tid, tname); + pthread_set_name_np(mevent_tid, "mevent"); } void Modified: stable/10/usr.sbin/bhyve/mptbl.c ============================================================================== --- stable/10/usr.sbin/bhyve/mptbl.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/mptbl.c Fri Dec 13 06:59:18 2013 (r259301) @@ -242,7 +242,7 @@ mptable_add_oemtbl(void *tbl, int tblsz) } int -mptable_build(struct vmctx *ctx, int ncpu, int ioapic) +mptable_build(struct vmctx *ctx, int ncpu) { mpcth_t mpch; bus_entry_ptr mpeb; @@ -278,15 +278,13 @@ mptable_build(struct vmctx *ctx, int ncp curraddr += sizeof(*mpeb) * MPE_NUM_BUSES; mpch->entry_count += MPE_NUM_BUSES; - if (ioapic) { - mpei = (io_apic_entry_ptr)curraddr; - mpt_build_ioapic_entries(mpei, ncpu + 1); - curraddr += sizeof(*mpei); - mpch->entry_count++; - } + mpei = (io_apic_entry_ptr)curraddr; + mpt_build_ioapic_entries(mpei, 0); + curraddr += sizeof(*mpei); + mpch->entry_count++; mpie = (int_entry_ptr) curraddr; - mpt_build_ioint_entries(mpie, MPEII_MAX_IRQ, ncpu + 1); + mpt_build_ioint_entries(mpie, MPEII_MAX_IRQ, 0); curraddr += sizeof(*mpie) * MPEII_MAX_IRQ; mpch->entry_count += MPEII_MAX_IRQ; Modified: stable/10/usr.sbin/bhyve/mptbl.h ============================================================================== --- stable/10/usr.sbin/bhyve/mptbl.h Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/mptbl.h Fri Dec 13 06:59:18 2013 (r259301) @@ -29,7 +29,7 @@ #ifndef _MPTBL_H_ #define _MPTBL_H_ -int mptable_build(struct vmctx *ctx, int ncpu, int ioapic); +int mptable_build(struct vmctx *ctx, int ncpu); void mptable_add_oemtbl(void *tbl, int tblsz); #endif /* _MPTBL_H_ */ Modified: stable/10/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_ahci.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/pci_ahci.c Fri Dec 13 06:59:18 2013 (r259301) @@ -165,6 +165,7 @@ struct ahci_cmd_hdr { struct ahci_prdt_entry { uint64_t dba; uint32_t reserved; +#define DBCMASK 0x3fffff uint32_t dbc; }; @@ -461,10 +462,13 @@ ahci_handle_dma(struct ahci_port *p, int * Build up the iovec based on the prdt */ for (i = 0; i < iovcnt; i++) { + uint32_t dbcsz; + + dbcsz = (prdt->dbc & DBCMASK) + 1; breq->br_iov[i].iov_base = paddr_guest2host(ahci_ctx(sc), - prdt->dba, prdt->dbc + 1); - breq->br_iov[i].iov_len = prdt->dbc + 1; - aior->done += (prdt->dbc + 1); + prdt->dba, dbcsz); + breq->br_iov[i].iov_len = dbcsz; + aior->done += dbcsz; prdt++; } if (readop) @@ -513,11 +517,14 @@ write_prdt(struct ahci_port *p, int slot from = buf; prdt = (struct ahci_prdt_entry *)(cfis + 0x80); for (i = 0; i < hdr->prdtl && len; i++) { - uint8_t *ptr = paddr_guest2host(ahci_ctx(p->pr_sc), - prdt->dba, prdt->dbc + 1); - memcpy(ptr, from, prdt->dbc + 1); - len -= (prdt->dbc + 1); - from += (prdt->dbc + 1); + uint8_t *ptr; + uint32_t dbcsz; + + dbcsz = (prdt->dbc & DBCMASK) + 1; + ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz); + memcpy(ptr, from, dbcsz); + len -= dbcsz; + from += dbcsz; prdt++; } hdr->prdbc = size - len; @@ -908,10 +915,13 @@ atapi_read(struct ahci_port *p, int slot * Build up the iovec based on the prdt */ for (i = 0; i < iovcnt; i++) { + uint32_t dbcsz; + + dbcsz = (prdt->dbc & DBCMASK) + 1; breq->br_iov[i].iov_base = paddr_guest2host(ahci_ctx(sc), - prdt->dba, prdt->dbc + 1); - breq->br_iov[i].iov_len = prdt->dbc + 1; - aior->done += (prdt->dbc + 1); + prdt->dba, dbcsz); + breq->br_iov[i].iov_len = dbcsz; + aior->done += dbcsz; prdt++; } err = blockif_read(p->bctx, breq); @@ -1714,11 +1724,9 @@ pci_ahci_init(struct vmctx *ctx, struct /* * Attempt to open the backing image. Use the PCI - * slot/func/ahci_port for the identifier string - * since that uniquely identifies a storage device. + * slot/func for the identifier string. */ - snprintf(bident, sizeof(bident), "%d:%d:%d", pi->pi_slot, pi->pi_func, - 0); + snprintf(bident, sizeof(bident), "%d:%d", pi->pi_slot, pi->pi_func); bctxt = blockif_open(opts, bident); if (bctxt == NULL) { ret = 1; Modified: stable/10/usr.sbin/bhyve/pci_emul.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_emul.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/pci_emul.c Fri Dec 13 06:59:18 2013 (r259301) @@ -1252,7 +1252,7 @@ pci_emul_cmdwrite(struct pci_devinst *pi * If the MMIO or I/O address space decoding has changed then * register/unregister all BARs that decode that address space. */ - for (i = 0; i < PCI_BARMAX; i++) { + for (i = 0; i <= PCI_BARMAX; i++) { switch (pi->pi_bar[i].type) { case PCIBAR_NONE: case PCIBAR_MEMHI64: Modified: stable/10/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_virtio_net.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/pci_virtio_net.c Fri Dec 13 06:59:18 2013 (r259301) @@ -588,7 +588,7 @@ pci_vtnet_init(struct vmctx *ctx, struct */ if (!mac_provided) { snprintf(nstr, sizeof(nstr), "%d-%d-%s", pi->pi_slot, - pi->pi_func, vmname); + pi->pi_func, vmname); MD5Init(&mdctx); MD5Update(&mdctx, nstr, strlen(nstr)); @@ -632,7 +632,8 @@ pci_vtnet_init(struct vmctx *ctx, struct pthread_mutex_init(&sc->tx_mtx, NULL); pthread_cond_init(&sc->tx_cond, NULL); pthread_create(&sc->tx_tid, NULL, pci_vtnet_tx_thread, (void *)sc); - snprintf(tname, sizeof(tname), "%s vtnet%d tx", vmname, pi->pi_slot); + snprintf(tname, sizeof(tname), "vtnet-%d:%d tx", pi->pi_slot, + pi->pi_func); pthread_set_name_np(sc->tx_tid, tname); return (0); Modified: stable/10/usr.sbin/bhyve/pit_8254.c ============================================================================== --- stable/10/usr.sbin/bhyve/pit_8254.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/pit_8254.c Fri Dec 13 06:59:18 2013 (r259301) @@ -106,8 +106,8 @@ pit_mevent_cb(int fd, enum ev_type type, pit_mev_count++; - ioapic_assert_pin(c->ctx, 0); - ioapic_deassert_pin(c->ctx, 0); + ioapic_assert_pin(c->ctx, 2); + ioapic_deassert_pin(c->ctx, 2); /* * Delete the timer for one-shots Modified: stable/10/usr.sbin/bhyve/uart_emul.c ============================================================================== --- stable/10/usr.sbin/bhyve/uart_emul.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyve/uart_emul.c Fri Dec 13 06:59:18 2013 (r259301) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ __FBSDID("$FreeBSD$"); #define FIFOSZ 16 static bool uart_stdio; /* stdio in use for i/o */ +static struct termios tio_stdio_orig; static struct { int baseaddr; @@ -87,6 +89,12 @@ struct fifo { int size; /* size of the fifo */ }; +struct ttyfd { + bool opened; + int fd; /* tty device file descriptor */ + struct termios tio_orig, tio_new; /* I/O Terminals */ +}; + struct uart_softc { pthread_mutex_t mtx; /* protects all softc elements */ uint8_t data; /* Data register (R/W) */ @@ -103,8 +111,7 @@ struct uart_softc { struct fifo rxfifo; - bool opened; - bool stdio; + struct ttyfd tty; bool thre_int_pending; /* THRE interrupt pending */ void *arg; @@ -114,38 +121,41 @@ struct uart_softc { static void uart_drain(int fd, enum ev_type ev, void *arg); -static struct termios tio_orig, tio_new; /* I/O Terminals */ - static void ttyclose(void) { - tcsetattr(STDIN_FILENO, TCSANOW, &tio_orig); + tcsetattr(STDIN_FILENO, TCSANOW, &tio_stdio_orig); } static void -ttyopen(void) +ttyopen(struct ttyfd *tf) { - tcgetattr(STDIN_FILENO, &tio_orig); + tcgetattr(tf->fd, &tf->tio_orig); - cfmakeraw(&tio_new); - tcsetattr(STDIN_FILENO, TCSANOW, &tio_new); + tf->tio_new = tf->tio_orig; + cfmakeraw(&tf->tio_new); + tf->tio_new.c_cflag |= CLOCAL; + tcsetattr(tf->fd, TCSANOW, &tf->tio_new); - atexit(ttyclose); + if (tf->fd == STDIN_FILENO) { + tio_stdio_orig = tf->tio_orig; + atexit(ttyclose); + } } static bool -tty_char_available(void) +tty_char_available(struct ttyfd *tf) { fd_set rfds; struct timeval tv; FD_ZERO(&rfds); - FD_SET(STDIN_FILENO, &rfds); + FD_SET(tf->fd, &rfds); tv.tv_sec = 0; tv.tv_usec = 0; - if (select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv) > 0 ) { + if (select(tf->fd + 1, &rfds, NULL, NULL, &tv) > 0 ) { return (true); } else { return (false); @@ -153,12 +163,12 @@ tty_char_available(void) } static int -ttyread(void) +ttyread(struct ttyfd *tf) { char rb; - if (tty_char_available()) { - read(STDIN_FILENO, &rb, 1); + if (tty_char_available(tf)) { + read(tf->fd, &rb, 1); return (rb & 0xff); } else { return (-1); @@ -166,10 +176,10 @@ ttyread(void) } static void -ttywrite(unsigned char wb) +ttywrite(struct ttyfd *tf, unsigned char wb) { - (void)write(STDIN_FILENO, &wb, 1); + (void)write(tf->fd, &wb, 1); } static void @@ -226,10 +236,8 @@ uart_opentty(struct uart_softc *sc) { struct mevent *mev; - assert(!sc->opened && sc->stdio); - - ttyopen(); - mev = mevent_add(STDIN_FILENO, EVF_READ, uart_drain, sc); + ttyopen(&sc->tty); + mev = mevent_add(sc->tty.fd, EVF_READ, uart_drain, sc); assert(mev); } @@ -294,7 +302,7 @@ uart_drain(int fd, enum ev_type ev, void sc = arg; - assert(fd == STDIN_FILENO); + assert(fd == sc->tty.fd); assert(ev == EVF_READ); /* @@ -305,10 +313,10 @@ uart_drain(int fd, enum ev_type ev, void pthread_mutex_lock(&sc->mtx); if ((sc->mcr & MCR_LOOPBACK) != 0) { - (void) ttyread(); + (void) ttyread(&sc->tty); } else { while (fifo_available(&sc->rxfifo) && - ((ch = ttyread()) != -1)) { + ((ch = ttyread(&sc->tty)) != -1)) { fifo_putchar(&sc->rxfifo, ch); } uart_toggle_intr(sc); @@ -323,12 +331,6 @@ uart_write(struct uart_softc *sc, int of int fifosz; uint8_t msr; - /* Open terminal */ - if (!sc->opened && sc->stdio) { - uart_opentty(sc); - sc->opened = true; - } - pthread_mutex_lock(&sc->mtx); /* @@ -351,8 +353,8 @@ uart_write(struct uart_softc *sc, int of if (sc->mcr & MCR_LOOPBACK) { if (fifo_putchar(&sc->rxfifo, value) != 0) sc->lsr |= LSR_OE; - } else if (sc->stdio) { - ttywrite(value); + } else if (sc->tty.opened) { + ttywrite(&sc->tty, value); } /* else drop on floor */ sc->thre_int_pending = true; break; @@ -459,12 +461,6 @@ uart_read(struct uart_softc *sc, int off { uint8_t iir, intr_reason, reg; - /* Open terminal */ - if (!sc->opened && sc->stdio) { - uart_opentty(sc); - sc->opened = true; - } - pthread_mutex_lock(&sc->mtx); /* @@ -581,19 +577,47 @@ uart_init(uart_intr_func_t intr_assert, return (sc); } +static int +uart_tty_backend(struct uart_softc *sc, const char *opts) +{ + int fd; + int retval; + + retval = -1; + + fd = open(opts, O_RDWR); + if (fd > 0 && isatty(fd)) { + sc->tty.fd = fd; + sc->tty.opened = true; + retval = 0; + } + + return (retval); +} + int uart_set_backend(struct uart_softc *sc, const char *opts) { - /* - * XXX one stdio backend supported at this time. - */ + int retval; + + retval = -1; + if (opts == NULL) return (0); - if (strcmp("stdio", opts) == 0 && !uart_stdio) { - sc->stdio = true; - uart_stdio = true; - return (0); - } else - return (-1); + if (strcmp("stdio", opts) == 0) { + if (!uart_stdio) { + sc->tty.fd = STDIN_FILENO; + sc->tty.opened = true; + uart_stdio = true; + retval = 0; + } + } else if (uart_tty_backend(sc, opts) == 0) { + retval = 0; + } + + if (retval == 0) + uart_opentty(sc); + + return (retval); } Modified: stable/10/usr.sbin/bhyveload/bhyveload.8 ============================================================================== --- stable/10/usr.sbin/bhyveload/bhyveload.8 Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyveload/bhyveload.8 Fri Dec 13 06:59:18 2013 (r259301) @@ -38,6 +38,8 @@ guest inside a bhyve virtual machine .Op Fl m Ar mem-size .Op Fl d Ar disk-path .Op Fl h Ar host-path +.Op Fl e Ar name=value +.Op Fl c Ar cons-dev .Ar vmname .Sh DESCRIPTION .Nm @@ -91,6 +93,24 @@ is the pathname of the guest's boot disk The .Ar host-path is the directory at the top of the guest's boot filesystem. +.It Fl e Ar name=value +Set the FreeBSD loader environment variable +.Ar name +to +.Ar value . +.Pp +The option may be used more than once to set more than one environment +variable. +.It Fl c Ar cons-dev +.Ar cons-dev +is a +.Xr tty 4 +device to use for +.Nm +terminal I/O. +.Pp +The text string "stdio" is also accepted and selects the use of +unbuffered standard I/O. This is the default value. .El .Sh EXAMPLES To create a virtual machine named @@ -100,10 +120,23 @@ that boots off the ISO image and has 1GB memory allocated to it: .Pp .Dl "bhyveload -m 1G -d /freebsd/release.iso freebsd-vm" +.Pp +To create a virtual machine named +.Ar test-vm +with 256MB of memory allocated, the guest root filesystem under the host +directory +.Pa /user/images/test +and terminal I/O sent to the +.Xr nmdm 4 +device +.Pa /dev/nmdm1B +.Pp +.Dl "bhyveload -m 256MB -h /usr/images/test -c /dev/nmdm1B test-vm" .Sh SEE ALSO .Xr bhyve 4 , .Xr bhyve 8 , .Xr loader 8 , +.Xr nmdm 4, .Xr vmm 4 .Sh HISTORY .Nm Modified: stable/10/usr.sbin/bhyveload/bhyveload.c ============================================================================== --- stable/10/usr.sbin/bhyveload/bhyveload.c Fri Dec 13 06:29:02 2013 (r259300) +++ stable/10/usr.sbin/bhyveload/bhyveload.c Fri Dec 13 06:59:18 2013 (r259301) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -70,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -86,9 +88,10 @@ __FBSDID("$FreeBSD$"); #define GB (1024 * 1024 * 1024UL) #define BSP 0 -static char *host_base = "/"; +static char *host_base; static struct termios term, oldterm; static int disk_fd = -1; +static int consin_fd, consout_fd; static char *vmname, *progname; static struct vmctx *ctx; @@ -106,7 +109,7 @@ cb_putc(void *arg, int ch) { char c = ch; - write(1, &c, 1); + (void) write(consout_fd, &c, 1); } static int @@ -114,7 +117,7 @@ cb_getc(void *arg) { char c; - if (read(0, &c, 1) == 1) + if (read(consin_fd, &c, 1) == 1) return (c); return (-1); } @@ -124,7 +127,7 @@ cb_poll(void *arg) { int n; - if (ioctl(0, FIONREAD, &n) >= 0) + if (ioctl(consin_fd, FIONREAD, &n) >= 0) return (n > 0); return (0); } @@ -486,7 +489,7 @@ static void cb_exit(void *arg, int v) { - tcsetattr(0, TCSAFLUSH, &oldterm); + tcsetattr(consout_fd, TCSAFLUSH, &oldterm); exit(v); } @@ -498,23 +501,37 @@ cb_getmem(void *arg, uint64_t *ret_lowme vm_get_memory_seg(ctx, 4 * GB, ret_highmem, NULL); } +struct env { + const char *str; /* name=value */ + SLIST_ENTRY(env) next; +}; + +static SLIST_HEAD(envhead, env) envhead; + +static void +addenv(const char *str) +{ + struct env *env; + + env = malloc(sizeof(struct env)); + env->str = str; + SLIST_INSERT_HEAD(&envhead, env, next); +} + static const char * cb_getenv(void *arg, int num) { - int max; - - static const char * var[] = { - "smbios.bios.vendor=BHYVE", - "boot_serial=1", - NULL - }; + int i; + struct env *env; - max = sizeof(var) / sizeof(var[0]); + i = 0; + SLIST_FOREACH(env, &envhead, next) { + if (i == num) + return (env->str); + i++; + } - if (num < max) - return (var[num]); - else - return (NULL); + return (NULL); } static struct loader_callbacks cb = { @@ -548,13 +565,46 @@ static struct loader_callbacks cb = { .getenv = cb_getenv, }; +static int +altcons_open(char *path) +{ + struct stat sb; + int err; + int fd; + + /* + * Allow stdio to be passed in so that the same string + * can be used for the bhyveload console and bhyve com-port + * parameters + */ + if (!strcmp(path, "stdio")) + return (0); + + err = stat(path, &sb); + if (err == 0) { + if (!S_ISCHR(sb.st_mode)) + err = ENOTSUP; + else { + fd = open(path, O_RDWR | O_NONBLOCK); + if (fd < 0) + err = errno; + else + consin_fd = consout_fd = fd; + } + } + + return (err); +} + static void usage(void) { fprintf(stderr, - "usage: %s [-m mem-size][-d ] [-h ] " - "\n", progname); + "usage: %s [-m mem-size] [-d ] [-h ]\n" + " %*s [-e ] [-c ] \n", + progname, + (int)strlen(progname), ""); exit(1); } @@ -567,17 +617,29 @@ main(int argc, char** argv) int opt, error; char *disk_image; - progname = argv[0]; + progname = basename(argv[0]); mem_size = 256 * MB; disk_image = NULL; - while ((opt = getopt(argc, argv, "d:h:m:")) != -1) { + consin_fd = STDIN_FILENO; + consout_fd = STDOUT_FILENO; + + while ((opt = getopt(argc, argv, "c:d:e:h:m:")) != -1) { switch (opt) { + case 'c': + error = altcons_open(optarg); + if (error != 0) + errx(EX_USAGE, "Could not open '%s'", optarg); + break; case 'd': disk_image = optarg; break; + case 'e': + addenv(optarg); + break; + case 'h': host_base = optarg; break; @@ -619,11 +681,13 @@ main(int argc, char** argv) exit(1); } - tcgetattr(0, &term); + tcgetattr(consout_fd, &term); oldterm = term; - term.c_lflag &= ~(ICANON|ECHO); - term.c_iflag &= ~ICRNL; - tcsetattr(0, TCSAFLUSH, &term); + cfmakeraw(&term); + term.c_cflag |= CLOCAL; + + tcsetattr(consout_fd, TCSAFLUSH, &term); + h = dlopen("/boot/userboot.so", RTLD_LOCAL); if (!h) { printf("%s\n", dlerror()); @@ -638,5 +702,9 @@ main(int argc, char** argv) if (disk_image) { disk_fd = open(disk_image, O_RDONLY); } + + addenv("smbios.bios.vendor=BHYVE"); + addenv("boot_serial=1"); + func(&cb, NULL, USERBOOT_VERSION_3, disk_fd >= 0); } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 13:18:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6972F656; Fri, 13 Dec 2013 13:18:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5506216E7; Fri, 13 Dec 2013 13:18:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDDI0Y3035856; Fri, 13 Dec 2013 13:18:00 GMT (envelope-from rmh@svn.freebsd.org) Received: (from rmh@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDDI0Bk035855; Fri, 13 Dec 2013 13:18:00 GMT (envelope-from rmh@svn.freebsd.org) Message-Id: <201312131318.rBDDI0Bk035855@svn.freebsd.org> From: Robert Millan Date: Fri, 13 Dec 2013 13:18:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259303 - stable/10/sys/dev/drm2/radeon X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 13:18:00 -0000 Author: rmh Date: Fri Dec 13 13:17:59 2013 New Revision: 259303 URL: http://svnweb.freebsd.org/changeset/base/259303 Log: MFC r259003: Initialize modesetting sysctls in radeonkms. Modified: stable/10/sys/dev/drm2/radeon/radeon_drv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm2/radeon/radeon_drv.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_drv.c Fri Dec 13 08:31:13 2013 (r259302) +++ stable/10/sys/dev/drm2/radeon/radeon_drv.c Fri Dec 13 13:17:59 2013 (r259303) @@ -338,6 +338,12 @@ static const struct file_operations rade }; #endif /* DUMBBELL_WIP */ +static int radeon_sysctl_init(struct drm_device *dev, struct sysctl_ctx_list *ctx, + struct sysctl_oid *top) +{ + return drm_add_busid_modesetting(dev, ctx, top); +} + static struct drm_driver_info kms_driver = { .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | @@ -367,6 +373,7 @@ static struct drm_driver_info kms_driver .irq_postinstall = radeon_driver_irq_postinstall_kms, .irq_uninstall = radeon_driver_irq_uninstall_kms, .irq_handler = radeon_driver_irq_handler_kms, + .sysctl_init = radeon_sysctl_init, .ioctls = radeon_ioctls_kms, .gem_init_object = radeon_gem_object_init, .gem_free_object = radeon_gem_object_free, From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 15:19:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 927B7CC0; Fri, 13 Dec 2013 15:19:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7DE79118A; Fri, 13 Dec 2013 15:19:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDFJboT089541; Fri, 13 Dec 2013 15:19:37 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDFJbxA089540; Fri, 13 Dec 2013 15:19:37 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201312131519.rBDFJbxA089540@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 13 Dec 2013 15:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259304 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 15:19:37 -0000 Author: trasz Date: Fri Dec 13 15:19:37 2013 New Revision: 259304 URL: http://svnweb.freebsd.org/changeset/base/259304 Log: MFC r258871: Properly report an error instead of panicing when user tries to create LUN backed by non-disk device, e.g. /dev/null. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Fri Dec 13 13:17:59 2013 (r259303) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Fri Dec 13 15:19:37 2013 (r259304) @@ -1485,6 +1485,7 @@ ctl_be_block_close(struct ctl_be_block_l case CTL_BE_BLOCK_FILE: break; case CTL_BE_BLOCK_NONE: + break; default: panic("Unexpected backend type."); break; @@ -1503,6 +1504,7 @@ ctl_be_block_close(struct ctl_be_block_l } break; case CTL_BE_BLOCK_NONE: + break; default: panic("Unexpected backend type."); break; @@ -1589,7 +1591,7 @@ ctl_be_block_open(struct ctl_be_block_so } else { error = EINVAL; snprintf(req->error_str, sizeof(req->error_str), - "%s is not a disk or file", be_lun->dev_path); + "%s is not a disk or plain file", be_lun->dev_path); } VOP_UNLOCK(be_lun->vn, 0); From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 15:23:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7BDFF2F; Fri, 13 Dec 2013 15:23:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B367A11F1; Fri, 13 Dec 2013 15:23:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDFN7Iv092870; Fri, 13 Dec 2013 15:23:07 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDFN7mO092869; Fri, 13 Dec 2013 15:23:07 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201312131523.rBDFN7mO092869@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 13 Dec 2013 15:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259305 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 15:23:07 -0000 Author: trasz Date: Fri Dec 13 15:23:07 2013 New Revision: 259305 URL: http://svnweb.freebsd.org/changeset/base/259305 Log: MFC r259182: Fix handling for empty auth-groups. Without it, ctld child process would either exit on assertion, or, if assertions are not enabled, fail to authenticate the target. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/login.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/login.c ============================================================================== --- stable/10/usr.sbin/ctld/login.c Fri Dec 13 15:19:37 2013 (r259304) +++ stable/10/usr.sbin/ctld/login.c Fri Dec 13 15:23:07 2013 (r259305) @@ -1007,6 +1007,14 @@ login(struct connection *conn) return; } + if (ag->ag_type == AG_TYPE_UNKNOWN) { + /* + * This can happen with empty auth-group. + */ + login_send_error(request, 0x02, 0x01); + log_errx(1, "auth-group type not set, denying access"); + } + log_debugx("CHAP authentication required"); auth_method = keys_find(request_keys, "AuthMethod"); From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 15:25:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B86E8217; Fri, 13 Dec 2013 15:25:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A3E4A1217; Fri, 13 Dec 2013 15:25:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDFPpwr093649; Fri, 13 Dec 2013 15:25:51 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDFPp5e093648; Fri, 13 Dec 2013 15:25:51 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201312131525.rBDFPp5e093648@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 13 Dec 2013 15:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259306 - stable/10/sys/dev/iscsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 15:25:51 -0000 Author: trasz Date: Fri Dec 13 15:25:51 2013 New Revision: 259306 URL: http://svnweb.freebsd.org/changeset/base/259306 Log: MFC r259183: Properly refuse handoff requests on already connected sessions. Previously this would result in dropping the session. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/iscsi/iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/iscsi/iscsi.c ============================================================================== --- stable/10/sys/dev/iscsi/iscsi.c Fri Dec 13 15:23:07 2013 (r259305) +++ stable/10/sys/dev/iscsi/iscsi.c Fri Dec 13 15:25:51 2013 (r259306) @@ -1247,6 +1247,18 @@ iscsi_ioctl_daemon_handoff(struct iscsi_ sx_sunlock(&sc->sc_lock); return (EINVAL); } + if (is->is_connected) { + /* + * This might have happened because another iscsid(8) + * instance handed off the connection in the meantime. + * Just return. + */ + ISCSI_SESSION_WARN(is, "handoff on already connected " + "session"); + ISCSI_SESSION_UNLOCK(is); + sx_sunlock(&sc->sc_lock); + return (EBUSY); + } strlcpy(is->is_target_alias, handoff->idh_target_alias, sizeof(is->is_target_alias)); From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 16:09:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18A61244; Fri, 13 Dec 2013 16:09:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 03B5C1556; Fri, 13 Dec 2013 16:09:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDG97T0013375; Fri, 13 Dec 2013 16:09:07 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDG97lc013374; Fri, 13 Dec 2013 16:09:07 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131609.rBDG97lc013374@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 16:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259307 - stable/10/sys/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 16:09:08 -0000 Author: ian Date: Fri Dec 13 16:09:07 2013 New Revision: 259307 URL: http://svnweb.freebsd.org/changeset/base/259307 Log: MFC r256492: Add the long-missing spibus_if.m to the MFILES list. Modified: stable/10/sys/conf/kmod.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/kmod.mk ============================================================================== --- stable/10/sys/conf/kmod.mk Fri Dec 13 15:25:51 2013 (r259306) +++ stable/10/sys/conf/kmod.mk Fri Dec 13 16:09:07 2013 (r259307) @@ -346,7 +346,7 @@ MFILES?= dev/acpica/acpi_if.m dev/acpi_s dev/mii/miibus_if.m dev/mvs/mvs_if.m dev/ofw/ofw_bus_if.m \ dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \ dev/pci/pcib_if.m dev/ppbus/ppbus_if.m \ - dev/sdhci/sdhci_if.m dev/smbus/smbus_if.m \ + dev/sdhci/sdhci_if.m dev/smbus/smbus_if.m dev/spibus/spibus_if.m \ dev/sound/pci/hda/hdac_if.m \ dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \ dev/sound/pcm/feeder_if.m dev/sound/pcm/mixer_if.m \ From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 16:14:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 37BC5404; Fri, 13 Dec 2013 16:14:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2396915E3; Fri, 13 Dec 2013 16:14:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDGE8mu016605; Fri, 13 Dec 2013 16:14:08 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDGE8xs016604; Fri, 13 Dec 2013 16:14:08 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131614.rBDGE8xs016604@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 16:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259308 - stable/10/sys/arm/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 16:14:09 -0000 Author: ian Date: Fri Dec 13 16:14:08 2013 New Revision: 259308 URL: http://svnweb.freebsd.org/changeset/base/259308 Log: MFC r256628: Fix a register name typo. The effect was that CPU_CONTROL_AFLT_ENABLE wasn't being set, but it was almost assuredly already turned on anyway by the bootloader. Modified: stable/10/sys/arm/arm/locore.S Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/locore.S ============================================================================== --- stable/10/sys/arm/arm/locore.S Fri Dec 13 16:09:07 2013 (r259307) +++ stable/10/sys/arm/arm/locore.S Fri Dec 13 16:14:08 2013 (r259308) @@ -187,7 +187,7 @@ Lunmapped: mrc p15, 0, r0, c1, c0, 0 #ifdef _ARM_ARCH_6 orr r0, r0, #(CPU_CONTROL_V6_EXTPAGE | CPU_CONTROL_UNAL_ENABLE) - orr r2, r2, #(CPU_CONTROL_AFLT_ENABLE) + orr r0, r0, #(CPU_CONTROL_AFLT_ENABLE) orr r0, r0, #(CPU_CONTROL_AF_ENABLE) #endif orr r0, r0, #(CPU_CONTROL_MMU_ENABLE) From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 16:38:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 902A1A90; Fri, 13 Dec 2013 16:38:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5D77F175D; Fri, 13 Dec 2013 16:38:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDGcMJR024077; Fri, 13 Dec 2013 16:38:22 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDGcMC1024076; Fri, 13 Dec 2013 16:38:22 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131638.rBDGcMC1024076@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 16:38:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259309 - stable/10/sys/arm/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 16:38:22 -0000 Author: ian Date: Fri Dec 13 16:38:21 2013 New Revision: 259309 URL: http://svnweb.freebsd.org/changeset/base/259309 Log: MFC r256637: When calculating the number of bounce pages needed, round the maxsize up to a multiple of PAGE_SIZE, and add one page because there can always be one more boundary crossing than the number of pages in the transfer. Modified: stable/10/sys/arm/arm/busdma_machdep-v6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- stable/10/sys/arm/arm/busdma_machdep-v6.c Fri Dec 13 16:14:08 2013 (r259308) +++ stable/10/sys/arm/arm/busdma_machdep-v6.c Fri Dec 13 16:38:21 2013 (r259309) @@ -425,14 +425,21 @@ bus_dma_tag_create(bus_dma_tag_t parent, if (_bus_dma_can_bounce(newtag->lowaddr, newtag->highaddr) || newtag->alignment > 1) newtag->flags |= BUS_DMA_COULD_BOUNCE; - else - maxsize = 2; /* Need at most 2 bounce pages for unaligned access on cache line boundaries */ + /* + * Any request can auto-bounce due to cacheline alignment, in addition + * to any alignment or boundary specifications in the tag, so if the + * ALLOCNOW flag is set, there's always work to do. + */ if ((flags & BUS_DMA_ALLOCNOW) != 0) { struct bounce_zone *bz; - - /* Must bounce */ - + /* + * Round size up to a full page, and add one more page because + * there can always be one more boundary crossing than the + * number of pages in a transfer. + */ + maxsize = roundup2(maxsize, PAGE_SIZE) + PAGE_SIZE; + if ((error = alloc_bounce_zone(newtag)) != 0) { free(newtag, M_DEVBUF); return (error); @@ -518,20 +525,22 @@ static int allocate_bz_and_pages(bus_dma STAILQ_INIT(&(mapp->bpages)); /* - * Attempt to add pages to our pool on a per-instance - * basis up to a sane limit. + * Attempt to add pages to our pool on a per-instance basis up to a sane + * limit. Even if the tag isn't flagged as COULD_BOUNCE due to + * alignment and boundary constraints, it could still auto-bounce due to + * cacheline alignment, which requires at most two bounce pages. */ if (dmat->flags & BUS_DMA_COULD_BOUNCE) maxpages = MAX_BPAGES; else - maxpages = 2 * bz->map_count; /* Only need at most 2 pages for buffers unaligned on cache line boundaries */ + maxpages = 2 * bz->map_count; if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 || (bz->map_count > 0 && bz->total_bpages < maxpages)) { int pages; - pages = MAX(atop(dmat->maxsize), 1); + pages = atop(roundup2(dmat->maxsize, PAGE_SIZE)) + 1; pages = MIN(maxpages - bz->total_bpages, pages); - pages = MAX(pages, 1); + pages = MAX(pages, 2); if (alloc_bounce_pages(dmat, pages) < pages) return (ENOMEM); From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 16:41:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1C8E8C02; Fri, 13 Dec 2013 16:41:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 087DE17C5; Fri, 13 Dec 2013 16:41:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDGf4rN026769; Fri, 13 Dec 2013 16:41:04 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDGf49Y026768; Fri, 13 Dec 2013 16:41:04 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131641.rBDGf49Y026768@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 16:41:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259310 - stable/10/sys/arm/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 16:41:05 -0000 Author: ian Date: Fri Dec 13 16:41:04 2013 New Revision: 259310 URL: http://svnweb.freebsd.org/changeset/base/259310 Log: MFC r256638: Add cases for the combinations of busdma sync op flags that we handle correctly by doing nothing, then add a panic for the default case, because that implies that some driver asked for a sync (probably incorrectly) and nothing was done. Modified: stable/10/sys/arm/arm/busdma_machdep-v6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- stable/10/sys/arm/arm/busdma_machdep-v6.c Fri Dec 13 16:38:21 2013 (r259309) +++ stable/10/sys/arm/arm/busdma_machdep-v6.c Fri Dec 13 16:41:04 2013 (r259310) @@ -1282,7 +1282,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus } break; + case BUS_DMASYNC_POSTREAD: + case BUS_DMASYNC_POSTWRITE: + case BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE: + break; default: + panic("unsupported combination of sync operations: 0x%08x\n", op); break; } } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 16:55:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BA1B36D; Fri, 13 Dec 2013 16:55:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A51D318C2; Fri, 13 Dec 2013 16:55:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDGtdJx030827; Fri, 13 Dec 2013 16:55:39 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDGtd9T030826; Fri, 13 Dec 2013 16:55:39 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201312131655.rBDGtd9T030826@svn.freebsd.org> From: Alan Somers Date: Fri, 13 Dec 2013 16:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259311 - stable/10/sbin/geom/class/part X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 16:55:39 -0000 Author: asomers Date: Fri Dec 13 16:55:39 2013 New Revision: 259311 URL: http://svnweb.freebsd.org/changeset/base/259311 Log: MFC 257006 sbin/geom/class/part/geom_part.c Always validate the return of find_geomcfg(). It could be NULL, for example when the geom is withering. Approved by: ken (mentor) Sponsored by: Spectra Logic Corporation Modified: stable/10/sbin/geom/class/part/geom_part.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/10/sbin/geom/class/part/geom_part.c Fri Dec 13 16:41:04 2013 (r259310) +++ stable/10/sbin/geom/class/part/geom_part.c Fri Dec 13 16:55:39 2013 (r259311) @@ -364,7 +364,11 @@ gpart_autofill_resize(struct gctl_req *r } offset = (pp->lg_stripeoffset / pp->lg_sectorsize) % alignment; - last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0); + s = find_geomcfg(gp, "last"); + if (s == NULL) + errx(EXIT_FAILURE, "Final block not found for geom %s", + gp->lg_name); + last = (off_t)strtoimax(s, NULL, 0); LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { s = find_provcfg(pp, "index"); if (s == NULL) @@ -502,8 +506,16 @@ gpart_autofill(struct gctl_req *req) if (size > alignment) size = ALIGNDOWN(size, alignment); - first = (off_t)strtoimax(find_geomcfg(gp, "first"), NULL, 0); - last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0); + s = find_geomcfg(gp, "first"); + if (s == NULL) + errx(EXIT_FAILURE, "Starting block not found for geom %s", + gp->lg_name); + first = (off_t)strtoimax(s, NULL, 0); + s = find_geomcfg(gp, "last"); + if (s == NULL) + errx(EXIT_FAILURE, "Final block not found for geom %s", + gp->lg_name); + last = (off_t)strtoimax(s, NULL, 0); grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); last = ALIGNDOWN(last + offset, alignment); @@ -587,12 +599,22 @@ gpart_show_geom(struct ggeom *gp, const int idx, wblocks, wname, wmax; scheme = find_geomcfg(gp, "scheme"); + if (scheme == NULL) + errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name); s = find_geomcfg(gp, "first"); + if (s == NULL) + errx(EXIT_FAILURE, "Starting block not found for geom %s", + gp->lg_name); first = (off_t)strtoimax(s, NULL, 0); s = find_geomcfg(gp, "last"); + if (s == NULL) + errx(EXIT_FAILURE, "Final block not found for geom %s", + gp->lg_name); last = (off_t)strtoimax(s, NULL, 0); wblocks = strlen(s); s = find_geomcfg(gp, "state"); + if (s == NULL) + errx(EXIT_FAILURE, "State not found for geom %s", gp->lg_name); if (s != NULL && *s != 'C') s = NULL; wmax = strlen(gp->lg_name); @@ -748,6 +770,8 @@ gpart_backup(struct gctl_req *req, unsig abort(); pp = LIST_FIRST(&gp->lg_consumer)->lg_provider; s = find_geomcfg(gp, "last"); + if (s == NULL) + abort(); wblocks = strlen(s); wtype = 0; LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { @@ -757,6 +781,8 @@ gpart_backup(struct gctl_req *req, unsig wtype = i; } s = find_geomcfg(gp, "entries"); + if (s == NULL) + abort(); windex = strlen(s); printf("%s %s\n", scheme, s); LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { @@ -1177,6 +1203,8 @@ gpart_bootcode(struct gctl_req *req, uns if (gp == NULL) errx(EXIT_FAILURE, "No such geom: %s.", s); s = find_geomcfg(gp, "scheme"); + if (s == NULL) + errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name); vtoc8 = 0; if (strcmp(s, "VTOC8") == 0) vtoc8 = 1; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 17:00:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 794BA26C; Fri, 13 Dec 2013 17:00:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 651E018EF; Fri, 13 Dec 2013 17:00:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDH0Quo033678; Fri, 13 Dec 2013 17:00:26 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDH0QMd033677; Fri, 13 Dec 2013 17:00:26 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131700.rBDH0QMd033677@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 17:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259312 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 17:00:26 -0000 Author: ian Date: Fri Dec 13 17:00:25 2013 New Revision: 259312 URL: http://svnweb.freebsd.org/changeset/base/259312 Log: MFC 256640: Allow 'make xdev' to work when DESTDIR is set. Modified: stable/10/Makefile.inc1 Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Fri Dec 13 16:55:39 2013 (r259311) +++ stable/10/Makefile.inc1 Fri Dec 13 17:00:25 2013 (r259312) @@ -1857,7 +1857,7 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOU CPUTYPE=${XDEV_CPUTYPE} XDDIR=${XDEV_ARCH}-freebsd -XDTP=/usr/${XDDIR} +XDTP=usr/${XDDIR} CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ INSTALL="sh ${.CURDIR}/tools/install.sh" CDENV= ${CDBENV} \ @@ -1870,8 +1870,8 @@ CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} -CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} -XDDESTDIR=${DESTDIR}${XDTP} +CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN} +XDDESTDIR=${DESTDIR}/${XDTP} .if !defined(OSREL) OSREL!= uname -r | sed -e 's/[-(].*//' .endif @@ -1951,6 +1951,7 @@ _xi-libraries: _xi-links: ${_+_}cd ${XDDESTDIR}/usr/bin; \ + mkdir -p ../../../../usr/bin; \ for i in *; do \ ln -sf ../../${XDTP}/usr/bin/$$i \ ../../../../usr/bin/${XDDIR}-$$i; \ From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 17:02:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C6D26565; Fri, 13 Dec 2013 17:02:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B25BD1953; Fri, 13 Dec 2013 17:02:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDH294L034209; Fri, 13 Dec 2013 17:02:09 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDH29UB034208; Fri, 13 Dec 2013 17:02:09 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131702.rBDH29UB034208@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 17:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259313 - stable/10/sys/arm/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 17:02:09 -0000 Author: ian Date: Fri Dec 13 17:02:09 2013 New Revision: 259313 URL: http://svnweb.freebsd.org/changeset/base/259313 Log: MFC r256647: Invalidate the entire L2 cache before enabling it. Say whether it has been enabled or disabled. Modified: stable/10/sys/arm/arm/pl310.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/pl310.c ============================================================================== --- stable/10/sys/arm/arm/pl310.c Fri Dec 13 17:00:25 2013 (r259312) +++ stable/10/sys/arm/arm/pl310.c Fri Dec 13 17:02:09 2013 (r259313) @@ -341,8 +341,13 @@ pl310_attach(device_t dev) ctrl_value = pl310_read4(sc, PL310_CTRL); if (sc->sc_enabled && !(ctrl_value & CTRL_ENABLED)) { + /* invalidate current content */ + pl310_write4(pl310_softc, PL310_INV_WAY, 0xffff); + pl310_wait_background_op(PL310_INV_WAY, 0xffff); + /* Enable the L2 cache if disabled */ platform_pl310_write_ctrl(sc, CTRL_ENABLED); + device_printf(dev, "L2 Cache enabled\n"); } if (!sc->sc_enabled && (ctrl_value & CTRL_ENABLED)) { @@ -375,6 +380,7 @@ pl310_attach(device_t dev) EVENT_COUNTER_CTRL_C0_RESET | EVENT_COUNTER_CTRL_C1_RESET); + device_printf(dev, "L2 Cache disabled\n"); } if (sc->sc_enabled) From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 17:03:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A465A740; Fri, 13 Dec 2013 17:03:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8ECFD1971; Fri, 13 Dec 2013 17:03:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDH3WNN034438; Fri, 13 Dec 2013 17:03:32 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDH3W13034437; Fri, 13 Dec 2013 17:03:32 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131703.rBDH3W13034437@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 17:03:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259314 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 17:03:32 -0000 Author: ian Date: Fri Dec 13 17:03:32 2013 New Revision: 259314 URL: http://svnweb.freebsd.org/changeset/base/259314 Log: MFC r256774: Clock divisors 0-3 correspond to dividing by 1-4, so add 1 before dividing. Modified: stable/10/sys/arm/freescale/imx/imx51_ccm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx51_ccm.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx51_ccm.c Fri Dec 13 17:02:09 2013 (r259313) +++ stable/10/sys/arm/freescale/imx/imx51_ccm.c Fri Dec 13 17:03:32 2013 (r259314) @@ -278,8 +278,8 @@ imx51_get_clock(enum imx51_clock clk) case IMX51CLK_MAIN_BUS_CLK: freq = imx51_get_clock(IMX51CLK_MAIN_BUS_CLK_SRC); cdcr = bus_read_4(ccm_softc->res[0], CCMC_CDCR); - return freq / (cdcr & CDCR_PERIPH_CLK_DVFS_PODF_MASK) >> - CDCR_PERIPH_CLK_DVFS_PODF_SHIFT; + return freq / (1 + ((cdcr & CDCR_PERIPH_CLK_DVFS_PODF_MASK) >> + CDCR_PERIPH_CLK_DVFS_PODF_SHIFT)); case IMX51CLK_AHB_CLK_ROOT: freq = imx51_get_clock(IMX51CLK_MAIN_BUS_CLK); cbcdr = bus_read_4(ccm_softc->res[0], CCMC_CBCDR); From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 17:10:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A60C9A21; Fri, 13 Dec 2013 17:10:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7749A19E6; Fri, 13 Dec 2013 17:10:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDHAOhW037118; Fri, 13 Dec 2013 17:10:24 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDHAOQx037116; Fri, 13 Dec 2013 17:10:24 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131710.rBDHAOQx037116@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 17:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259315 - in stable/10/sys: arm/freescale/imx boot/fdt/dts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 17:10:24 -0000 Author: ian Date: Fri Dec 13 17:10:23 2013 New Revision: 259315 URL: http://svnweb.freebsd.org/changeset/base/259315 Log: MFC r256804: Switch to using the standard uart console driver instead of the special driver for early boot debugging. Modified: stable/10/sys/arm/freescale/imx/files.imx53 stable/10/sys/boot/fdt/dts/digi-ccwmx53.dts Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/files.imx53 ============================================================================== --- stable/10/sys/arm/freescale/imx/files.imx53 Fri Dec 13 17:03:32 2013 (r259314) +++ stable/10/sys/arm/freescale/imx/files.imx53 Fri Dec 13 17:10:23 2013 (r259315) @@ -12,8 +12,11 @@ arm/freescale/imx/imx53_machdep.c standa arm/freescale/imx/common.c standard arm/freescale/imx/bus_space.c standard -# Dummy serial console -arm/freescale/imx/console.c standard +# Special serial console for debuging early boot code +#arm/freescale/imx/console.c standard + +# UART driver (includes serial console support) +dev/uart/uart_dev_imx.c optional uart # TrustZone Interrupt Controller arm/freescale/imx/tzic.c standard @@ -33,9 +36,6 @@ arm/freescale/imx/imx51_ccm.c standard # i.MX5xx PATA controller dev/ata/chipsets/ata-fsl.c optional imxata -# UART driver -#dev/uart/uart_dev_imx.c optional uart - # USB join controller (1 OTG, 3 EHCI) dev/usb/controller/ehci_imx.c optional ehci Modified: stable/10/sys/boot/fdt/dts/digi-ccwmx53.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/digi-ccwmx53.dts Fri Dec 13 17:03:32 2013 (r259314) +++ stable/10/sys/boot/fdt/dts/digi-ccwmx53.dts Fri Dec 13 17:10:23 2013 (r259315) @@ -70,9 +70,9 @@ }; /* UART1, console */ - UART1: serial@53fbc000 { + console: serial@53fbc000 { status = "okay"; - clock-frequency = <3000000>; /* XXX */ + clock-frequency = <0>; /* won't load w/o this */ }; clock@53fd4000 { @@ -111,13 +111,12 @@ }; aliases { - UART1 = &UART1; SSI2 = &SSI2; }; chosen { bootargs = "-v"; - stdin = "UART1"; - stdout = "UART1"; + stdin = &console; + stdout = &console; }; }; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 17:23:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F42DCD2; Fri, 13 Dec 2013 17:23:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 612F91B05; Fri, 13 Dec 2013 17:23:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDHNm1v041881; Fri, 13 Dec 2013 17:23:48 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDHNm6B041879; Fri, 13 Dec 2013 17:23:48 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131723.rBDHNm6B041879@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 17:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259316 - stable/10/sys/dev/ofw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 17:23:48 -0000 Author: ian Date: Fri Dec 13 17:23:47 2013 New Revision: 259316 URL: http://svnweb.freebsd.org/changeset/base/259316 Log: MFC r257130: Add a helper routine to search for a compat string in a table that associates compat strings with arbitrary values that mean something to the driver. This is handy for drivers that support several variations of similar hardware and need to know which one matched. Modified: stable/10/sys/dev/ofw/ofw_bus_subr.c stable/10/sys/dev/ofw/ofw_bus_subr.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- stable/10/sys/dev/ofw/ofw_bus_subr.c Fri Dec 13 17:10:23 2013 (r259315) +++ stable/10/sys/dev/ofw/ofw_bus_subr.c Fri Dec 13 17:23:47 2013 (r259316) @@ -197,6 +197,21 @@ ofw_bus_is_compatible_strict(device_t de return (0); } +const struct ofw_compat_data * +ofw_bus_search_compatible(device_t dev, const struct ofw_compat_data *compat) +{ + + if (compat == NULL) + return NULL; + + for (; compat->ocd_str != NULL; ++compat) { + if (ofw_bus_is_compatible(dev, compat->ocd_str)) + break; + } + + return (compat); +} + int ofw_bus_has_prop(device_t dev, const char *propname) { Modified: stable/10/sys/dev/ofw/ofw_bus_subr.h ============================================================================== --- stable/10/sys/dev/ofw/ofw_bus_subr.h Fri Dec 13 17:10:23 2013 (r259315) +++ stable/10/sys/dev/ofw/ofw_bus_subr.h Fri Dec 13 17:23:47 2013 (r259316) @@ -47,6 +47,11 @@ struct ofw_bus_iinfo { pcell_t opi_addrc; }; +struct ofw_compat_data { + const char *ocd_str; + uintptr_t ocd_data; +}; + /* Generic implementation of ofw_bus_if.m methods and helper routines */ int ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *, phandle_t); void ofw_bus_gen_destroy_devinfo(struct ofw_bus_devinfo *); @@ -74,6 +79,16 @@ void ofw_bus_find_iparent(phandle_t); int ofw_bus_is_compatible(device_t, const char *); int ofw_bus_is_compatible_strict(device_t, const char *); +/* + * Helper routine to search a list of compat properties. The table is + * terminated by an entry with a NULL compat-string pointer; a pointer to that + * table entry is returned if none of the compat strings match for the device, + * giving you control over the not-found value. Will not return NULL unless the + * provided table pointer is NULL. + */ +const struct ofw_compat_data * + ofw_bus_search_compatible(device_t, const struct ofw_compat_data *); + /* Helper routine for checking existence of a prop */ int ofw_bus_has_prop(device_t, const char *); From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 17:28:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 08B53E3D; Fri, 13 Dec 2013 17:28:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DCA0A1B26; Fri, 13 Dec 2013 17:28:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDHS8pW042387; Fri, 13 Dec 2013 17:28:08 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDHS8rZ042385; Fri, 13 Dec 2013 17:28:08 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131728.rBDHS8rZ042385@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 17:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259317 - in stable/10/sys: arm/freescale/imx dev/ffec X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 17:28:09 -0000 Author: ian Date: Fri Dec 13 17:28:08 2013 New Revision: 259317 URL: http://svnweb.freebsd.org/changeset/base/259317 Log: MFC r256806, r256919, r257167: Add a driver for the Freescale Fast Ethernet Controller found on various Freescale SoCs including the i.MX series. This also works for the newer SoCs with the ENET gigabit controller, but doesn't use any of the new hardware features other than enabling gigabit speed. Mask out non-address bits in the mac address register, for proper detection of an all-zeroes address. Also remove a misplaced return. Switch to using ofw_bus_search_compatible() table-driven compat lookup. Add compat strings for Freescale Vybrid family SoCs. Added: stable/10/sys/dev/ffec/ - copied from r256806, head/sys/dev/ffec/ Modified: stable/10/sys/arm/freescale/imx/files.imx53 stable/10/sys/dev/ffec/if_ffec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/files.imx53 ============================================================================== --- stable/10/sys/arm/freescale/imx/files.imx53 Fri Dec 13 17:23:47 2013 (r259316) +++ stable/10/sys/arm/freescale/imx/files.imx53 Fri Dec 13 17:28:08 2013 (r259317) @@ -49,3 +49,6 @@ dev/ofw/ofw_iicbus.c optional fsliic # IPU - Image Processing Unit (frame buffer also) arm/freescale/imx/imx51_ipuv3.c optional sc +# Fast Ethernet Controller +dev/ffec/if_ffec.c optional ffec + Modified: stable/10/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Sun Oct 20 21:07:38 2013 (r256806) +++ stable/10/sys/dev/ffec/if_ffec.c Fri Dec 13 17:28:08 2013 (r259317) @@ -86,6 +86,38 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" /* + * There are small differences in the hardware on various SoCs. Not every SoC + * we support has its own FECTYPE; most work as GENERIC and only the ones that + * need different handling get their own entry. In addition to the types in + * this list, there are some flags below that can be ORed into the upper bits. + */ +enum { + FECTYPE_NONE, + FECTYPE_GENERIC, + FECTYPE_IMX53, + FECTYPE_IMX6, +}; + +/* + * Flags that describe general differences between the FEC hardware in various + * SoCs. These are ORed into the FECTYPE enum values. + */ +#define FECTYPE_MASK 0x0000ffff +#define FECFLAG_GBE (0x0001 << 16) + +/* + * Table of supported FDT compat strings and their associated FECTYPE values. + */ +static struct ofw_compat_data compat_data[] = { + {"fsl,imx51-fec", FECTYPE_GENERIC}, + {"fsl,imx53-fec", FECTYPE_IMX53}, + {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE}, + {"fsl,mvf600-fec", FECTYPE_GENERIC}, + {"fsl,vf-fec", FECTYPE_GENERIC}, + {NULL, FECTYPE_NONE}, +}; + +/* * Driver data and defines. */ #define RX_DESC_COUNT 64 @@ -108,13 +140,6 @@ enum { PHY_CONN_RGMII }; -enum { - FECTYPE_GENERIC, - FECTYPE_IMX51, - FECTYPE_IMX53, - FECTYPE_IMX6, -}; - struct ffec_softc { device_t dev; device_t miibus; @@ -226,7 +251,7 @@ ffec_miigasket_setup(struct ffec_softc * * We only need the gasket for MII and RMII connections on certain SoCs. */ - switch (sc->fectype) + switch (sc->fectype & FECTYPE_MASK) { case FECTYPE_IMX53: break; @@ -883,7 +908,7 @@ ffec_get_hwaddr(struct ffec_softc *sc, u * assigned bit set, and the broadcast/multicast bit clear. */ palr = RD4(sc, FEC_PALR_REG); - paur = RD4(sc, FEC_PAUR_REG); + paur = RD4(sc, FEC_PAUR_REG) & FEC_PAUR_PADDR2_MASK; if ((palr | paur) != 0) { hwaddr[0] = palr >> 24; hwaddr[1] = palr >> 16; @@ -891,7 +916,6 @@ ffec_get_hwaddr(struct ffec_softc *sc, u hwaddr[3] = palr >> 0; hwaddr[4] = paur >> 24; hwaddr[5] = paur >> 16; - return; } else { rnd = arc4random() & 0x00ffffff; hwaddr[0] = 'b'; @@ -1405,14 +1429,7 @@ ffec_attach(device_t dev) * There are differences in the implementation and features of the FEC * hardware on different SoCs, so figure out what type we are. */ - if (ofw_bus_is_compatible(dev, "fsl,imx51-fec")) - sc->fectype = FECTYPE_IMX51; - else if (ofw_bus_is_compatible(dev, "fsl,imx53-fec")) - sc->fectype = FECTYPE_IMX53; - else if (ofw_bus_is_compatible(dev, "fsl,imx6q-fec")) - sc->fectype = FECTYPE_IMX6; - else - sc->fectype = FECTYPE_GENERIC; + sc->fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; /* * We have to be told what kind of electrical connection exists between @@ -1692,15 +1709,16 @@ out: static int ffec_probe(device_t dev) { + uintptr_t fectype; - if (ofw_bus_is_compatible(dev, "fsl,imx51-fec") || - ofw_bus_is_compatible(dev, "fsl,imx53-fec")) { - device_set_desc(dev, "Freescale Fast Ethernet Controller"); - } else if (ofw_bus_is_compatible(dev, "fsl,imx6q-fec")) { - device_set_desc(dev, "Freescale Gigabit Ethernet Controller"); - } else { + fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (fectype == FECTYPE_NONE) return (ENXIO); - } + + device_set_desc(dev, (fectype & FECFLAG_GBE) ? + "Freescale Gigabit Ethernet Controller" : + "Freescale Fast Ethernet Controller"); + return (BUS_PROBE_DEFAULT); } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 17:29:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28B0CFA2; Fri, 13 Dec 2013 17:29:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 077671B41; Fri, 13 Dec 2013 17:29:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDHTVRR042560; Fri, 13 Dec 2013 17:29:31 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDHTVPu042558; Fri, 13 Dec 2013 17:29:31 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131729.rBDHTVPu042558@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 17:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259318 - in stable/10/sys: arm/conf boot/fdt/dts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 17:29:32 -0000 Author: ian Date: Fri Dec 13 17:29:31 2013 New Revision: 259318 URL: http://svnweb.freebsd.org/changeset/base/259318 Log: MFC r256809: Add configuration for the Freescale i.MX53 Quick Start Board. Added: stable/10/sys/arm/conf/IMX53-QSB - copied unchanged from r256809, head/sys/arm/conf/IMX53-QSB stable/10/sys/boot/fdt/dts/imx53-qsb.dts - copied unchanged from r256809, head/sys/boot/fdt/dts/imx53-qsb.dts Modified: Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/arm/conf/IMX53-QSB (from r256809, head/sys/arm/conf/IMX53-QSB) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/conf/IMX53-QSB Fri Dec 13 17:29:31 2013 (r259318, copy of r256809, head/sys/arm/conf/IMX53-QSB) @@ -0,0 +1,179 @@ +# Kernel configuration for Freescale i.MX53 Quick Start Board +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +ident IMX53-QSB + +include "../freescale/imx/std.imx53" + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +#options DEBUG + +options HZ=250 # 4ms scheduling quantum +options SCHED_4BSD # 4BSD scheduler +#options PREEMPTION # Enable kernel thread preemption +options INET # InterNETworking +options INET6 # IPv6 communications protocols +#options SCTP # Stream Control Transmission Protocol +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options UFS_GJOURNAL # Enable gjournal-based UFS journaling +#options MD_ROOT # MD is a potential root device +options NFSCL # New Network Filesystem Client +#options NFSD # New Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCL +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +#options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options TMPFS # TMP Memory Filesystem +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Provides labelization +#options COMPAT_FREEBSD5 # Compatible with FreeBSD5 +#options COMPAT_FREEBSD6 # Compatible with FreeBSD6 +#options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE # ktrace(1) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options INCLUDE_CONFIG_FILE # Include this file in kernel +options VFP # vfp/neon + +# required for netbooting +#options BOOTP +#options BOOTP_COMPAT +#options BOOTP_NFSROOT +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ue0 + +#options ROOTDEVNAME=\"ufs:ada0s2a\" + + +# kernel/memory size reduction +#options MUTEX_NOINLINE +#options NO_FFS_SNAPSHOT +#options NO_SWAPPING +#options NO_SYSCTL_DESCR +#options RWLOCK_NOINLINE + +# Debugging support. Always need this: +options KDB # Enable kernel debugger support. +# For minimum debugger support (stable branch) use: +#options KDB_TRACE # Print a stack trace for a panic. +# For full debugger support use this instead: +options DDB # Support DDB. +#options GDB # Support remote GDB. +#options DEADLKRES # Enable the deadlock resolver +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles + +# The `bpf' device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device ether # Ethernet support +#device vlan # 802.1Q VLAN support +#device tun # Packet tunnel. +device md # Memory "disks" +#device gif # IPv6 and IPv4 tunneling +#device faith # IPv6-to-IPv4 relaying (translation) +#device firmware # firmware assist module + +# Ethernet +device ffec # Freescale Fast Ethernet Controller +device miibus # Standard mii bus + +# Serial (COM) ports +device uart # Multi-uart driver +options ALT_BREAK_TO_DEBUGGER + +#device ata +#device atapci # Only for helper functions +#device imxata +#options ATA_STATIC_ID # Static device numbering + +device iomux # IO Multiplexor + +device gpio +device gpioled + +device fsliic +device iic +device iicbus + +# SCSI peripherals +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) +device cd # CD +device pass # Passthrough device (direct SCSI access) + +# USB support +#options USB_DEBUG # enable debug msgs +device ehci # OHCI USB interface +device usb # USB Bus (required) +device umass # Disks/Mass storage - Requires scbus and da +#device uhid # "Human Interface Devices" +#device ukbd # Allow keyboard like HIDs to control console +#device ums + +# USB Ethernet, requires miibus +#device miibus +#device aue # ADMtek USB Ethernet +#device axe # ASIX Electronics USB Ethernet +#device cdce # Generic USB over Ethernet +#device cue # CATC USB Ethernet +#device kue # Kawasaki LSI USB Ethernet +#device rue # RealTek RTL8150 USB Ethernet +#device udav # Davicom DM9601E USB + +# USB Wireless +#device rum # Ralink Technology RT2501USB wireless NICs + +# Watchdog timer. +# WARNING: can't be disabled!!! +device imxwdt # Watchdog + +# Wireless NIC cards +device wlan # 802.11 support +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support +device wlan_amrr # AMRR transmit rate control algorithm + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=imx53-qsb.dts + +# NOTE: serial console will be disabled if syscons enabled +# Uncomment following lines for framebuffer/syscons support +#device sc +#device kbdmux +#options SC_DFLT_FONT # compile font in +#makeoptions SC_DFLT_FONT=cp437 + Copied: stable/10/sys/boot/fdt/dts/imx53-qsb.dts (from r256809, head/sys/boot/fdt/dts/imx53-qsb.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/boot/fdt/dts/imx53-qsb.dts Fri Dec 13 17:29:31 2013 (r259318, copy of r256809, head/sys/boot/fdt/dts/imx53-qsb.dts) @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2013 Rui Paulo + * All rights reserved. + * + * This software was developed by Semihalf 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: + * 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. + * + * Freescale i.MX53 Quick Start Board + * + * $FreeBSD$ + */ + +/dts-v1/; +/include/ "imx53x.dtsi" + +/ { + model = "Freescale i.MX53 Quick Start Board"; + compatible = "fsl,imx53-qsb", "fsl,imx53"; + + memory { + /* RAM 512M */ + reg = <0x70000000 0x20000000>; + }; + + localbus@18000000 { + ipu3@18000000 { + status = "okay"; + }; + }; + + soc@50000000 { + aips@50000000 { + spba@50000000 { + esdhc@50004000 { + clock-frequency = <216000000>; + status = "okay"; + }; + esdhc@50008000 { + clock-frequency = <216000000>; + status = "okay"; + }; + SSI2: ssi@50014000 { + status = "okay"; + }; + }; + timer@53fa0000 { + status = "okay"; + }; + + /* UART1, console */ + console: serial@53fbc000 { + status = "okay"; + clock-frequency = <0>; /* won't load w/o this */ + }; + + clock@53fd4000 { + status = "okay"; + }; + gpio@53f84000 { + status = "okay"; + }; + gpio@53f88000 { + status = "okay"; + }; + gpio@53f8c000 { + status = "okay"; + }; + gpio@53f90000 { + status = "okay"; + }; + wdog@53f98000 { + status = "okay"; + }; + }; + aips@60000000 { + ethernet@63fec000 { + status = "okay"; + phy-mode = "rmii"; + } + i2c@63fc4000 { + status = "okay"; + }; + i2c@63fc8000 { + status = "okay"; + }; + audmux@63fd4000 { + status = "okay"; + }; + ide@63fe0000 { + status = "okay"; + }; + }; + }; + + aliases { + SSI2 = &SSI2; + }; + + chosen { + bootargs = "-v"; + stdin = &console; + stdout = &console; + }; +}; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 18:21:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB453CC2; Fri, 13 Dec 2013 18:21:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A733D1023; Fri, 13 Dec 2013 18:21:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDILRgg063183; Fri, 13 Dec 2013 18:21:27 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDILRwp063182; Fri, 13 Dec 2013 18:21:27 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131821.rBDILRwp063182@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 18:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259319 - stable/10/sys/dev/uart X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 18:21:27 -0000 Author: ian Date: Fri Dec 13 18:21:27 2013 New Revision: 259319 URL: http://svnweb.freebsd.org/changeset/base/259319 Log: MFC r256815: Calculate the baud rate divisor rather than using a hard-coded value. Modified: stable/10/sys/dev/uart/uart_dev_pl011.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart_dev_pl011.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_pl011.c Fri Dec 13 17:29:31 2013 (r259318) +++ stable/10/sys/dev/uart/uart_dev_pl011.c Fri Dec 13 18:21:27 2013 (r259319) @@ -147,9 +147,6 @@ uart_pl011_param(struct uart_bas *bas, i break; } - /* TODO: Calculate divisors */ - baud = (0x1 << 16) | 0x28; - if (stopbits == 2) line |= LCR_H_STP2; else @@ -164,8 +161,11 @@ uart_pl011_param(struct uart_bas *bas, i line &= ~LCR_H_FEN; ctrl |= (CR_RXE | CR_TXE | CR_UARTEN); - __uart_setreg(bas, UART_IBRD, ((uint32_t)(baud >> 16)) & IBRD_BDIVINT); - __uart_setreg(bas, UART_FBRD, (uint32_t)(baud) & FBRD_BDIVFRAC); + if (bas->rclk != 0 && baudrate != 0) { + baud = bas->rclk * 4 / baudrate; + __uart_setreg(bas, UART_IBRD, ((uint32_t)(baud >> 6)) & IBRD_BDIVINT); + __uart_setreg(bas, UART_FBRD, (uint32_t)(baud & 0x3F) & FBRD_BDIVFRAC); + } /* Add config. to line before reenabling UART */ __uart_setreg(bas, UART_LCR_H, (__uart_getreg(bas, UART_LCR_H) & From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 18:23:14 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9794EE01; Fri, 13 Dec 2013 18:23:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8336A1032; Fri, 13 Dec 2013 18:23:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDINE7Q063471; Fri, 13 Dec 2013 18:23:14 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDINETh063470; Fri, 13 Dec 2013 18:23:14 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312131823.rBDINETh063470@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 13 Dec 2013 18:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259320 - stable/10/contrib/gperf/src X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 18:23:14 -0000 Author: pfg Date: Fri Dec 13 18:23:14 2013 New Revision: 259320 URL: http://svnweb.freebsd.org/changeset/base/259320 Log: MFC r258115 (partial); gperf: bring a small update from Apple Developers tools 4.4 From [1] offset.patch Makes use the C offsetof() macro. We are not merging the size_type.patch as it raises some (apparently) bogus warnings and is not really used. [1] http://opensource.apple.com/source/gperf/gperf-9/patches/ Modified: stable/10/contrib/gperf/src/output.cc Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gperf/src/output.cc ============================================================================== --- stable/10/contrib/gperf/src/output.cc Fri Dec 13 18:21:27 2013 (r259319) +++ stable/10/contrib/gperf/src/output.cc Fri Dec 13 18:23:14 2013 (r259320) @@ -1106,9 +1106,7 @@ output_keyword_entry (KeywordExt *temp, if (option[TYPE]) printf ("{"); if (option[SHAREDLIB]) - printf ("(int)(long)&((struct %s_t *)0)->%s_str%d", - option.get_stringpool_name (), option.get_stringpool_name (), - stringpool_index); + printf("offsetof(struct %s_t, %s_str%d)", option.get_stringpool_name (), option.get_stringpool_name (), stringpool_index); else output_string (temp->_allchars, temp->_allchars_length); if (option[TYPE]) @@ -2035,8 +2033,11 @@ Output::output () printf ("%s\n", _struct_decl); } - if (option[INCLUDE]) + if (option[INCLUDE]) { printf ("#include \n"); /* Declare strlen(), strcmp(), strncmp(). */ + if (option[SHAREDLIB]) + printf("#include \n"); /* Declare offsetof() */ + } if (!option[ENUM]) { From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 18:24:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EBE6BE1; Fri, 13 Dec 2013 18:24:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D6A261047; Fri, 13 Dec 2013 18:24:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDIOax6063709; Fri, 13 Dec 2013 18:24:36 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDIOabU063708; Fri, 13 Dec 2013 18:24:36 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312131824.rBDIOabU063708@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 13 Dec 2013 18:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259321 - stable/9/contrib/gperf/src X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 18:24:37 -0000 Author: pfg Date: Fri Dec 13 18:24:36 2013 New Revision: 259321 URL: http://svnweb.freebsd.org/changeset/base/259321 Log: MFC r258115 (partial); gperf: bring a small update from Apple Developers tools 4.4 From [1] offset.patch Makes use the C offsetof() macro. We are not merging the size_type.patch as it raises some (apparently) bogus warnings and is not really used. [1] http://opensource.apple.com/source/gperf/gperf-9/patches/ Modified: stable/9/contrib/gperf/src/output.cc Directory Properties: stable/9/ (props changed) stable/9/contrib/gperf/ (props changed) Modified: stable/9/contrib/gperf/src/output.cc ============================================================================== --- stable/9/contrib/gperf/src/output.cc Fri Dec 13 18:23:14 2013 (r259320) +++ stable/9/contrib/gperf/src/output.cc Fri Dec 13 18:24:36 2013 (r259321) @@ -1106,9 +1106,7 @@ output_keyword_entry (KeywordExt *temp, if (option[TYPE]) printf ("{"); if (option[SHAREDLIB]) - printf ("(int)(long)&((struct %s_t *)0)->%s_str%d", - option.get_stringpool_name (), option.get_stringpool_name (), - stringpool_index); + printf("offsetof(struct %s_t, %s_str%d)", option.get_stringpool_name (), option.get_stringpool_name (), stringpool_index); else output_string (temp->_allchars, temp->_allchars_length); if (option[TYPE]) @@ -2035,8 +2033,11 @@ Output::output () printf ("%s\n", _struct_decl); } - if (option[INCLUDE]) + if (option[INCLUDE]) { printf ("#include \n"); /* Declare strlen(), strcmp(), strncmp(). */ + if (option[SHAREDLIB]) + printf("#include \n"); /* Declare offsetof() */ + } if (!option[ENUM]) { From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 18:26:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6BECB25E; Fri, 13 Dec 2013 18:26:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 52EA9105F; Fri, 13 Dec 2013 18:26:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDIQOBf064026; Fri, 13 Dec 2013 18:26:24 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDIQNQU064015; Fri, 13 Dec 2013 18:26:23 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131826.rBDIQNQU064015@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 18:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259322 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 18:26:24 -0000 Author: ian Date: Fri Dec 13 18:26:22 2013 New Revision: 259322 URL: http://svnweb.freebsd.org/changeset/base/259322 Log: MFC r257197: Maximize available kva space by doing static device mapping from the top of the address space downwards, and then returning the lowest mapped device address from initarm_lastaddr(). Premap most of the device's on-chip peripherals. Added: stable/10/sys/arm/freescale/imx/imx_machdep.c - copied unchanged from r257197, head/sys/arm/freescale/imx/imx_machdep.c stable/10/sys/arm/freescale/imx/imx_machdep.h - copied unchanged from r257197, head/sys/arm/freescale/imx/imx_machdep.h Modified: stable/10/sys/arm/freescale/imx/files.imx51 stable/10/sys/arm/freescale/imx/files.imx53 stable/10/sys/arm/freescale/imx/imx51_machdep.c stable/10/sys/arm/freescale/imx/imx53_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/files.imx51 ============================================================================== --- stable/10/sys/arm/freescale/imx/files.imx51 Fri Dec 13 18:24:36 2013 (r259321) +++ stable/10/sys/arm/freescale/imx/files.imx51 Fri Dec 13 18:26:22 2013 (r259322) @@ -8,6 +8,7 @@ arm/arm/irq_dispatch.S standard kern/kern_clocksource.c standard # Init +arm/freescale/imx/imx_machdep.c standard arm/freescale/imx/imx51_machdep.c standard arm/freescale/imx/common.c standard arm/freescale/imx/bus_space.c standard Modified: stable/10/sys/arm/freescale/imx/files.imx53 ============================================================================== --- stable/10/sys/arm/freescale/imx/files.imx53 Fri Dec 13 18:24:36 2013 (r259321) +++ stable/10/sys/arm/freescale/imx/files.imx53 Fri Dec 13 18:26:22 2013 (r259322) @@ -8,6 +8,7 @@ arm/arm/irq_dispatch.S standard kern/kern_clocksource.c standard # Init +arm/freescale/imx/imx_machdep.c standard arm/freescale/imx/imx53_machdep.c standard arm/freescale/imx/common.c standard arm/freescale/imx/bus_space.c standard Modified: stable/10/sys/arm/freescale/imx/imx51_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx51_machdep.c Fri Dec 13 18:24:36 2013 (r259321) +++ stable/10/sys/arm/freescale/imx/imx51_machdep.c Fri Dec 13 18:26:22 2013 (r259322) @@ -1,14 +1,7 @@ /*- - * Copyright (c) 1994-1998 Mark Brinicombe. - * Copyright (c) 1994 Brini. - * Copyright (c) 2012, 2013 The FreeBSD Foundation + * Copyright (c) 2013 Ian Lepore * All rights reserved. * - * - * This code is derived from software written for Brini by Mark Brinicombe - * Portions of this software were developed by Oleksandr Rybalko - * 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: @@ -17,26 +10,18 @@ * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Brini. - * 4. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. * - * THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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) + * 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. - * - * from: FreeBSD: //depot/projects/arm/src/sys/arm/at91/kb920x_machdep.c, rev 45 */ #include "opt_platform.h" @@ -44,99 +29,42 @@ #include __FBSDID("$FreeBSD$"); -#define _ARM32_BUS_DMA_PRIVATE #include #include #include #include -#include -#include - -#include -#include /* For trapframe_t, used in */ #include -#include - -#include - -#define IMX51_DEV_VIRT_BASE 0xe0000000 -vm_offset_t -initarm_lastaddr(void) -{ - - boothowto |= RB_VERBOSE|RB_MULTIPLE; - bootverbose = 1; - - if (fdt_immr_addr(IMX51_DEV_VIRT_BASE) != 0) - while (1); - - /* Platform-specific initialisation */ - return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); -} +#include /* - * Set initial values of GPIO output ports + * Set up static device mappings. This is hand-optimized platform-specific + * config data which covers most of the common on-chip devices with a few 1MB + * section mappings. + * + * Notably missing are entries for GPU, IPU, in general anything video related. + * + * Note that for imx this is called from initarm_lastaddr() so that the lowest + * kva address used for static device mapping can be known at that point. */ void -initarm_gpio_init(void) +imx_devmap_init(void) { + imx_devmap_addentry(0x70000000, 0x00100000); + imx_devmap_addentry(0x73f00000, 0x00100000); + imx_devmap_addentry(0x83f00000, 0x00100000); } void -initarm_late_init(void) -{ - -} - -#define FDT_DEVMAP_MAX 2 -static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { - { 0, 0, 0, 0, 0, }, - { 0, 0, 0, 0, 0, } -}; - -/* - * Construct pmap_devmap[] with DT-derived config data. - */ -int -platform_devmap_init(void) -{ - - /* - * Map segment where UART1 and UART2 located. - */ - fdt_devmap[0].pd_va = IMX51_DEV_VIRT_BASE + 0x03f00000; - fdt_devmap[0].pd_pa = 0x73f00000; - fdt_devmap[0].pd_size = 0x00100000; - fdt_devmap[0].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[0].pd_cache = PTE_NOCACHE; - - pmap_devmap_bootstrap_table = &fdt_devmap[0]; - return (0); -} - -struct arm32_dma_range * -bus_dma_get_range(void) +cpu_reset(void) { - return (NULL); + imx_wdog_cpu_reset(0x73F98000); } -int -bus_dma_get_range_nb(void) +u_int imx_soc_type() { - - return (0); + return (IMXSOC_51); } -void -cpu_reset(void) -{ - - printf("Reset ...\n"); - /* Clear n_reset flag */ - *((volatile u_int16_t *)(IMX51_DEV_VIRT_BASE + 0x03f98000)) = - (u_int16_t)0; - while (1); -} Modified: stable/10/sys/arm/freescale/imx/imx53_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx53_machdep.c Fri Dec 13 18:24:36 2013 (r259321) +++ stable/10/sys/arm/freescale/imx/imx53_machdep.c Fri Dec 13 18:26:22 2013 (r259322) @@ -1,13 +1,7 @@ /*- - * Copyright (c) 1994-1998 Mark Brinicombe. - * Copyright (c) 1994 Brini. - * Copyright (c) 2012, 2013 The FreeBSD Foundation + * Copyright (c) 2013 Ian Lepore * All rights reserved. * - * This code is derived from software written for Brini by Mark Brinicombe - * Portions of this software were developed by Oleksandr Rybalko - * 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: @@ -16,20 +10,14 @@ * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Brini. - * 4. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. * - * THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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) + * 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 @@ -41,101 +29,43 @@ #include __FBSDID("$FreeBSD$"); -#define _ARM32_BUS_DMA_PRIVATE #include #include #include #include -#include -#include - -#include -#include /* For trapframe_t, used in */ #include -#include - -#include - -#define IMX53_DEV_VIRT_BASE 0xe0000000 - -vm_offset_t -initarm_lastaddr(void) -{ - - boothowto |= RB_VERBOSE|RB_MULTIPLE; - bootverbose = 1; - - if (fdt_immr_addr(IMX53_DEV_VIRT_BASE) != 0) - while (1); - - /* Platform-specific initialisation */ - return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); -} +#include /* - * Set initial values of GPIO output ports + * Set up static device mappings. This is hand-optimized platform-specific + * config data which covers most of the common on-chip devices with a few 1MB + * section mappings. + * + * Notably missing are entries for GPU, IPU, in general anything video related. + * + * Note that for imx this is called from initarm_lastaddr() so that the lowest + * kva address used for static device mapping can be known at that point. */ void -initarm_gpio_init(void) +imx_devmap_init(void) { + imx_devmap_addentry(0x50000000, 0x00100000); + imx_devmap_addentry(0x53f00000, 0x00100000); + imx_devmap_addentry(0x63f00000, 0x00100000); } void -initarm_late_init(void) -{ - -} - -#define FDT_DEVMAP_MAX 2 -static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { - { 0, 0, 0, 0, 0, }, - { 0, 0, 0, 0, 0, } -}; - -/* - * Construct pmap_devmap[] with DT-derived config data. - */ -int -platform_devmap_init(void) -{ - - /* - * Map segment where UART1 and UART2 located. - */ - fdt_devmap[0].pd_va = IMX53_DEV_VIRT_BASE + 0x03f00000; - fdt_devmap[0].pd_pa = 0x53f00000; - fdt_devmap[0].pd_size = 0x00100000; - fdt_devmap[0].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[0].pd_cache = PTE_NOCACHE; - - pmap_devmap_bootstrap_table = &fdt_devmap[0]; - - return (0); -} - -struct arm32_dma_range * -bus_dma_get_range(void) +cpu_reset(void) { - return (NULL); + imx_wdog_cpu_reset(0x53F98000); } -int -bus_dma_get_range_nb(void) +u_int imx_soc_type() { - - return (0); + return (IMXSOC_53); } -void -cpu_reset(void) -{ - printf("Reset ...\n"); - /* Clear n_reset flag */ - *((volatile u_int16_t *)(IMX53_DEV_VIRT_BASE + 0x03f98000)) = - (u_int16_t)0; - while (1); -} Copied: stable/10/sys/arm/freescale/imx/imx_machdep.c (from r257197, head/sys/arm/freescale/imx/imx_machdep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx_machdep.c Fri Dec 13 18:26:22 2013 (r259322, copy of r257197, head/sys/arm/freescale/imx/imx_machdep.c) @@ -0,0 +1,200 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#define _ARM32_BUS_DMA_PRIVATE +#include +#include +#include + +#include +#include + +#include +#include +#include /* For trapframe_t, used in */ +#include +#include + +#include +#include + +#define IMX_MAX_DEVMAP_ENTRIES 8 + +static struct pmap_devmap devmap_entries[IMX_MAX_DEVMAP_ENTRIES]; +static u_int devmap_idx; +static vm_offset_t devmap_vaddr = ARM_VECTORS_HIGH; + +void +imx_devmap_addentry(vm_paddr_t pa, vm_size_t sz) +{ + struct pmap_devmap *m; + + /* + * The last table entry is the all-zeroes end-of-table marker. If we're + * about to overwrite it the world is coming to an end. This code runs + * too early for the panic to be printed unless a special early-debug + * console is in use, but there's nothing else we can do. + */ + if (devmap_idx == (IMX_MAX_DEVMAP_ENTRIES - 1)) + panic("IMX_MAX_DEVMAP_ENTRIES is too small!\n"); + + /* + * Allocate virtual address space from the top of kva downwards. If the + * range being mapped is aligned and sized to 1MB boundaries then also + * align the virtual address to the next-lower 1MB boundary so that we + * end up with a section mapping. + */ + if ((pa & 0x000fffff) == 0 && (sz & 0x000fffff) == 0) { + devmap_vaddr = (devmap_vaddr - sz) & ~0x000fffff; + } else { + devmap_vaddr = (devmap_vaddr - sz) & ~0x00000fff; + } + m = &devmap_entries[devmap_idx++]; + m->pd_va = devmap_vaddr; + m->pd_pa = pa; + m->pd_size = sz; + m->pd_prot = VM_PROT_READ | VM_PROT_WRITE; + m->pd_cache = PTE_DEVICE; +} + +vm_offset_t +initarm_lastaddr(void) +{ + + /* XXX - Get rid of this stuff soon. */ + boothowto |= RB_VERBOSE|RB_MULTIPLE; + bootverbose = 1; + + /* + * Normally initarm() calls platform_devmap_init() much later in the + * init process to set up static device mappings. To calculate the + * highest available kva address we have to do that setup first. It + * maps downwards from ARM_VECTORS_HIGH and the last usable kva address + * is the point right before the virtual address of the first static + * mapping. So go set up the static mapping table now, then we can + * return the lowest static devmap vaddr as the end of usable kva. + */ + imx_devmap_init(); + + pmap_devmap_bootstrap_table = devmap_entries; + + return (devmap_vaddr); +} + +int +platform_devmap_init(void) +{ + + /* On imx this work is done during initarm_lastaddr(). */ + return (0); +} + +/* + * Set initial values of GPIO output ports + */ +void +initarm_gpio_init(void) +{ + +} + +void +initarm_late_init(void) +{ + struct pmap_devmap *m; + + /* + * We did the static devmap setup earlier, during initarm_lastaddr(), + * but now the console should be working and we can be verbose about + * what we did. + */ + if (bootverbose) { + for (m = devmap_entries; m->pd_va != 0; ++m) { + printf("Devmap: phys 0x%08x virt 0x%08x size %uK\n", + m->pd_pa, m->pd_va, m->pd_size / 1024); + } + } + + +} + +struct arm32_dma_range * +bus_dma_get_range(void) +{ + + return (NULL); +} + +int +bus_dma_get_range_nb(void) +{ + + return (0); +} + +void +imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr) +{ + + /* + * This code which manipulates the watchdog hardware is here to + * implement cpu_reset() because the watchdog is the only way for + * software to reset the chip. Why here and not in imx_wdog.c? Because + * there's no requirement that the watchdog driver be compiled in, but + * it's nice to be able to reboot even if it's not. + */ + volatile uint16_t * pcr; + const struct pmap_devmap *pd; + + if ((pd = pmap_devmap_find_pa(wdcr_physaddr, 2)) == NULL) { + printf("cpu_reset() can't find its control register... locking up now."); + } else { + pcr = (uint16_t *)(pd->pd_va + (wdcr_physaddr - pd->pd_pa)); + /* + * This deceptively simple write enables the watchdog, sets the timeout + * to its minimum value (half a second), and also clears the SRS bit + * which results in the SFTW (software-requested reset) bit being set in + * the watchdog status register after the reset. This is how software + * can distinguish a requested reset from a wdog timeout. + */ + *pcr = WDOG_CR_WDE; + } + while (1) + continue; +} + +u_int +imx_soc_family(void) +{ + return (imx_soc_type() >> IMXSOC_FAMSHIFT); +} + + Copied: stable/10/sys/arm/freescale/imx/imx_machdep.h (from r257197, head/sys/arm/freescale/imx/imx_machdep.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx_machdep.h Fri Dec 13 18:26:22 2013 (r259322, copy of r257197, head/sys/arm/freescale/imx/imx_machdep.h) @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$ + */ + +#ifndef IMX_MACHDEP_H +#define IMX_MACHDEP_H + +#include + +/* Common functions, implemented in imx_machdep.c. */ + +void imx_devmap_addentry(vm_paddr_t _pa, vm_size_t _sz); +void imx_wdog_cpu_reset(vm_offset_t _wdcr_phys) __attribute__((__noreturn__)); + +/* + * SoC identity. + */ +#define IMXSOC_51 0x05000100 +#define IMXSOC_53 0x05000300 +#define IMXSOC_6S 0x06000010 +#define IMXSOC_6SL 0x06000011 +#define IMXSOC_6D 0x06000020 +#define IMXSOC_6DL 0x06000021 +#define IMXSOC_6Q 0x06000040 +#define IMXSOC_6QL 0x06000041 +#define IMXSOC_FAMSHIFT 24 + +u_int imx_soc_type(void); +u_int imx_soc_family(void); + +/* From here down, routines are implemented in imxNN_machdep.c. */ + +void imx_devmap_init(void); + +#endif + From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 19:01:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0145CD4A; Fri, 13 Dec 2013 19:01:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D5CC4129B; Fri, 13 Dec 2013 19:01:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDJ1orv077706; Fri, 13 Dec 2013 19:01:50 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDJ1osG077705; Fri, 13 Dec 2013 19:01:50 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131901.rBDJ1osG077705@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 19:01:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259323 - stable/10/sys/dev/uart X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 19:01:51 -0000 Author: ian Date: Fri Dec 13 19:01:50 2013 New Revision: 259323 URL: http://svnweb.freebsd.org/changeset/base/259323 Log: MFC r257480: Convert the if/else list of compatible devices to the table-driven ofw_bus_search_compatible() routine. In addition to converting existing strings to table entries, also add compat strings for the whole imx family. Modified: stable/10/sys/dev/uart/uart_bus_fdt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- stable/10/sys/dev/uart/uart_bus_fdt.c Fri Dec 13 18:26:22 2013 (r259322) +++ stable/10/sys/dev/uart/uart_bus_fdt.c Fri Dec 13 19:01:50 2013 (r259323) @@ -61,6 +61,30 @@ static driver_t uart_fdt_driver = { sizeof(struct uart_softc), }; +/* + * Compatible devices. Keep this sorted in most- to least-specific order first, + * alphabetical second. That is, "zwie,ns16550" should appear before "ns16550" + * on the theory that the zwie driver knows how to make better use of the + * hardware than the generic driver. Likewise with chips within a family, the + * highest-numbers / most recent models should probably appear earlier. + */ +static struct ofw_compat_data compat_data[] = { + {"arm,pl011", (uintptr_t)&uart_pl011_class}, + {"cadence,uart", (uintptr_t)&uart_cdnc_class}, + {"exynos", (uintptr_t)&uart_s3c2410_class}, + {"fsl,imx6q-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx53-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx51-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx31-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx27-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx25-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx21-uart", (uintptr_t)&uart_imx_class}, + {"lpc,uart", (uintptr_t)&uart_lpc_class}, + {"ti,ns16550", (uintptr_t)&uart_ti8250_class}, + {"ns16550", (uintptr_t)&uart_ns8250_class}, + {NULL, (uintptr_t)NULL}, +}; + static int uart_fdt_get_clock(phandle_t node, pcell_t *cell) { @@ -99,25 +123,16 @@ uart_fdt_probe(device_t dev) phandle_t node; pcell_t clock, shift; int err; + const struct ofw_compat_data * cd; sc = device_get_softc(dev); - if (ofw_bus_is_compatible(dev, "lpc,uart")) - sc->sc_class = &uart_lpc_class; - else if (ofw_bus_is_compatible(dev, "fsl,imx-uart")) - sc->sc_class = &uart_imx_class; - else if (ofw_bus_is_compatible(dev, "arm,pl011")) - sc->sc_class = &uart_pl011_class; - else if (ofw_bus_is_compatible(dev, "exynos")) - sc->sc_class = &uart_s3c2410_class; - else if (ofw_bus_is_compatible(dev, "cadence,uart")) - sc->sc_class = &uart_cdnc_class; - else if (ofw_bus_is_compatible(dev, "ti,ns16550")) - sc->sc_class = &uart_ti8250_class; - else if (ofw_bus_is_compatible(dev, "ns16550")) - sc->sc_class = &uart_ns8250_class; - else + + cd = ofw_bus_search_compatible(dev, compat_data); + if (cd->ocd_data == (uintptr_t)NULL) return (ENXIO); + sc->sc_class = (struct uart_class *)cd->ocd_data; + node = ofw_bus_get_node(dev); if ((err = uart_fdt_get_clock(node, &clock)) != 0) From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 19:17:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96C9313E; Fri, 13 Dec 2013 19:17:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 68CD51377; Fri, 13 Dec 2013 19:17:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDJHAU4082320; Fri, 13 Dec 2013 19:17:10 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDJHAOd082319; Fri, 13 Dec 2013 19:17:10 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131917.rBDJHAOd082319@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 19:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259324 - stable/10/sys/arm/rockchip X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 19:17:10 -0000 Author: ian Date: Fri Dec 13 19:17:09 2013 New Revision: 259324 URL: http://svnweb.freebsd.org/changeset/base/259324 Log: MFC r256949: Import basic support for Rockchip RK3188 SoC. Added: stable/10/sys/arm/rockchip/ - copied from r256949, head/sys/arm/rockchip/ Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 19:27:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B474A4A0; Fri, 13 Dec 2013 19:27:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9E77A147C; Fri, 13 Dec 2013 19:27:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDJROWH085863; Fri, 13 Dec 2013 19:27:24 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDJRN1m085857; Fri, 13 Dec 2013 19:27:23 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312131927.rBDJRN1m085857@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 19:27:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259325 - in stable/10/sys: arm/broadcom/bcm2835 arm/conf boot/fdt/dts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 19:27:24 -0000 Author: ian Date: Fri Dec 13 19:27:23 2013 New Revision: 259325 URL: http://svnweb.freebsd.org/changeset/base/259325 Log: MFC r257062: Add the Raspberry Pi SPI controller driver. Added: stable/10/sys/arm/broadcom/bcm2835/bcm2835_spi.c - copied unchanged from r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_spireg.h - copied unchanged from r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spireg.h stable/10/sys/arm/broadcom/bcm2835/bcm2835_spivar.h - copied unchanged from r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h Modified: stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 stable/10/sys/arm/conf/RPI-B stable/10/sys/boot/fdt/dts/bcm2835.dtsi Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/arm/broadcom/bcm2835/bcm2835_spi.c (from r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_spi.c Fri Dec 13 19:27:23 2013 (r259325, copy of r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c) @@ -0,0 +1,521 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2013 Luiz Otavio O Souza + * 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 +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "spibus_if.h" + +static void bcm_spi_intr(void *); + +#ifdef BCM_SPI_DEBUG +static void +bcm_spi_printr(device_t dev) +{ + struct bcm_spi_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + reg = BCM_SPI_READ(sc, SPI_CS); + device_printf(dev, "CS=%b\n", reg, + "\20\1CS0\2CS1\3CPHA\4CPOL\7CSPOL" + "\10TA\11DMAEN\12INTD\13INTR\14ADCS\15REN\16LEN" + "\21DONE\22RXD\23TXD\24RXR\25RXF\26CSPOL0\27CSPOL1" + "\30CSPOL2\31DMA_LEN\32LEN_LONG"); + reg = BCM_SPI_READ(sc, SPI_CLK) & SPI_CLK_MASK; + if (reg % 2) + reg--; + if (reg == 0) + reg = 65536; + device_printf(dev, "CLK=%uMhz/%d=%luhz\n", + SPI_CORE_CLK / 1000000, reg, SPI_CORE_CLK / reg); + reg = BCM_SPI_READ(sc, SPI_DLEN) & SPI_DLEN_MASK; + device_printf(dev, "DLEN=%d\n", reg); + reg = BCM_SPI_READ(sc, SPI_LTOH) & SPI_LTOH_MASK; + device_printf(dev, "LTOH=%d\n", reg); + reg = BCM_SPI_READ(sc, SPI_DC); + device_printf(dev, "DC=RPANIC=%#x RDREQ=%#x TPANIC=%#x TDREQ=%#x\n", + (reg & SPI_DC_RPANIC_MASK) >> SPI_DC_RPANIC_SHIFT, + (reg & SPI_DC_RDREQ_MASK) >> SPI_DC_RDREQ_SHIFT, + (reg & SPI_DC_TPANIC_MASK) >> SPI_DC_TPANIC_SHIFT, + (reg & SPI_DC_TDREQ_MASK) >> SPI_DC_TDREQ_SHIFT); +} +#endif + +static void +bcm_spi_modifyreg(struct bcm_spi_softc *sc, uint32_t off, uint32_t mask, + uint32_t value) +{ + uint32_t reg; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + reg = BCM_SPI_READ(sc, off); + reg &= ~mask; + reg |= value; + BCM_SPI_WRITE(sc, off, reg); +} + +static int +bcm_spi_clock_proc(SYSCTL_HANDLER_ARGS) +{ + struct bcm_spi_softc *sc; + uint32_t clk; + int error; + + sc = (struct bcm_spi_softc *)arg1; + + BCM_SPI_LOCK(sc); + clk = BCM_SPI_READ(sc, SPI_CLK); + BCM_SPI_UNLOCK(sc); + clk &= 0xffff; + if (clk == 0) + clk = 65536; + clk = SPI_CORE_CLK / clk; + + error = sysctl_handle_int(oidp, &clk, sizeof(clk), req); + if (error != 0 || req->newptr == NULL) + return (error); + + clk = SPI_CORE_CLK / clk; + if (clk <= 1) + clk = 2; + else if (clk % 2) + clk--; + if (clk > 0xffff) + clk = 0; + BCM_SPI_LOCK(sc); + BCM_SPI_WRITE(sc, SPI_CLK, clk); + BCM_SPI_UNLOCK(sc); + + return (0); +} + +static int +bcm_spi_cs_bit_proc(SYSCTL_HANDLER_ARGS, uint32_t bit) +{ + struct bcm_spi_softc *sc; + uint32_t reg; + int error; + + sc = (struct bcm_spi_softc *)arg1; + BCM_SPI_LOCK(sc); + reg = BCM_SPI_READ(sc, SPI_CS); + BCM_SPI_UNLOCK(sc); + reg = (reg & bit) ? 1 : 0; + + error = sysctl_handle_int(oidp, ®, sizeof(reg), req); + if (error != 0 || req->newptr == NULL) + return (error); + + if (reg) + reg = bit; + BCM_SPI_LOCK(sc); + bcm_spi_modifyreg(sc, SPI_CS, bit, reg); + BCM_SPI_UNLOCK(sc); + + return (0); +} + +static int +bcm_spi_cpol_proc(SYSCTL_HANDLER_ARGS) +{ + + return (bcm_spi_cs_bit_proc(oidp, arg1, arg2, req, SPI_CS_CPOL)); +} + +static int +bcm_spi_cpha_proc(SYSCTL_HANDLER_ARGS) +{ + + return (bcm_spi_cs_bit_proc(oidp, arg1, arg2, req, SPI_CS_CPHA)); +} + +static int +bcm_spi_cspol0_proc(SYSCTL_HANDLER_ARGS) +{ + + return (bcm_spi_cs_bit_proc(oidp, arg1, arg2, req, SPI_CS_CSPOL0)); +} + +static int +bcm_spi_cspol1_proc(SYSCTL_HANDLER_ARGS) +{ + + return (bcm_spi_cs_bit_proc(oidp, arg1, arg2, req, SPI_CS_CSPOL1)); +} + +static void +bcm_spi_sysctl_init(struct bcm_spi_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + + /* + * Add system sysctl tree/handlers. + */ + ctx = device_get_sysctl_ctx(sc->sc_dev); + tree_node = device_get_sysctl_tree(sc->sc_dev); + tree = SYSCTL_CHILDREN(tree_node); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "clock", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_spi_clock_proc, "IU", "SPI BUS clock frequency"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cpol", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_spi_cpol_proc, "IU", "SPI BUS clock polarity"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cpha", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_spi_cpha_proc, "IU", "SPI BUS clock phase"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cspol0", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_spi_cspol0_proc, "IU", "SPI BUS chip select 0 polarity"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cspol1", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_spi_cspol1_proc, "IU", "SPI BUS chip select 1 polarity"); +} + +static int +bcm_spi_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-spi")) + return (ENXIO); + + device_set_desc(dev, "BCM2708/2835 SPI controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +bcm_spi_attach(device_t dev) +{ + struct bcm_spi_softc *sc; + device_t gpio; + int i, rid; + + if (device_get_unit(dev) != 0) { + device_printf(dev, "only one SPI controller supported\n"); + return (ENXIO); + } + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + /* Configure the GPIO pins to ALT0 function to enable SPI the pins. */ + gpio = devclass_get_device(devclass_find("gpio"), 0); + if (!gpio) { + device_printf(dev, "cannot find gpio0\n"); + return (ENXIO); + } + for (i = 0; i < nitems(bcm_spi_pins); i++) + bcm_gpio_set_alternate(gpio, bcm_spi_pins[i], BCM_GPIO_ALT0); + + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_mem_res) { + device_printf(dev, "cannot allocate memory window\n"); + return (ENXIO); + } + + sc->sc_bst = rman_get_bustag(sc->sc_mem_res); + sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (!sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot allocate interrupt\n"); + return (ENXIO); + } + + /* Hook up our interrupt handler. */ + if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, bcm_spi_intr, sc, &sc->sc_intrhand)) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot setup the interrupt handler\n"); + return (ENXIO); + } + + mtx_init(&sc->sc_mtx, "bcm_spi", NULL, MTX_DEF); + + /* Add sysctl nodes. */ + bcm_spi_sysctl_init(sc); + +#ifdef BCM_SPI_DEBUG + bcm_spi_printr(dev); +#endif + + /* + * Enable the SPI controller. Clear the rx and tx FIFO. + * Defaults to SPI mode 0. + */ + BCM_SPI_WRITE(sc, SPI_CS, SPI_CS_CLEAR_RXFIFO | SPI_CS_CLEAR_TXFIFO); + + /* Set the SPI clock to 500Khz. */ + BCM_SPI_WRITE(sc, SPI_CLK, SPI_CORE_CLK / 500000); + +#ifdef BCM_SPI_DEBUG + bcm_spi_printr(dev); +#endif + + device_add_child(dev, "spibus", -1); + + return (bus_generic_attach(dev)); +} + +static int +bcm_spi_detach(device_t dev) +{ + struct bcm_spi_softc *sc; + + bus_generic_detach(dev); + + sc = device_get_softc(dev); + mtx_destroy(&sc->sc_mtx); + if (sc->sc_intrhand) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand); + if (sc->sc_irq_res) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + + return (0); +} + +static void +bcm_spi_fill_fifo(struct bcm_spi_softc *sc) +{ + struct spi_command *cmd; + uint32_t cs, written; + uint8_t *data; + + cmd = sc->sc_cmd; + cs = BCM_SPI_READ(sc, SPI_CS) & (SPI_CS_TA | SPI_CS_TXD); + while (sc->sc_written < sc->sc_len && + cs == (SPI_CS_TA | SPI_CS_TXD)) { + data = (uint8_t *)cmd->tx_cmd; + written = sc->sc_written++; + if (written >= cmd->tx_cmd_sz) { + data = (uint8_t *)cmd->tx_data; + written -= cmd->tx_cmd_sz; + } + BCM_SPI_WRITE(sc, SPI_FIFO, data[written]); + cs = BCM_SPI_READ(sc, SPI_CS) & (SPI_CS_TA | SPI_CS_TXD); + } +} + +static void +bcm_spi_drain_fifo(struct bcm_spi_softc *sc) +{ + struct spi_command *cmd; + uint32_t cs, read; + uint8_t *data; + + cmd = sc->sc_cmd; + cs = BCM_SPI_READ(sc, SPI_CS) & SPI_CS_RXD; + while (sc->sc_read < sc->sc_len && cs == SPI_CS_RXD) { + data = (uint8_t *)cmd->rx_cmd; + read = sc->sc_read++; + if (read >= cmd->rx_cmd_sz) { + data = (uint8_t *)cmd->rx_data; + read -= cmd->rx_cmd_sz; + } + data[read] = BCM_SPI_READ(sc, SPI_FIFO) & 0xff; + cs = BCM_SPI_READ(sc, SPI_CS) & SPI_CS_RXD; + } +} + +static void +bcm_spi_intr(void *arg) +{ + struct bcm_spi_softc *sc; + + sc = (struct bcm_spi_softc *)arg; + BCM_SPI_LOCK(sc); + + /* Filter stray interrupts. */ + if ((sc->sc_flags & BCM_SPI_BUSY) == 0) { + BCM_SPI_UNLOCK(sc); + return; + } + + /* TX - Fill up the FIFO. */ + bcm_spi_fill_fifo(sc); + + /* RX - Drain the FIFO. */ + bcm_spi_drain_fifo(sc); + + /* Check for end of transfer. */ + if (sc->sc_written == sc->sc_len && sc->sc_read == sc->sc_len) { + /* Disable interrupts and the SPI engine. */ + bcm_spi_modifyreg(sc, SPI_CS, + SPI_CS_TA | SPI_CS_INTR | SPI_CS_INTD, 0); + wakeup(sc->sc_dev); + } + + BCM_SPI_UNLOCK(sc); +} + +static int +bcm_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct bcm_spi_softc *sc; + int cs, err; + + sc = device_get_softc(dev); + + KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, + ("TX/RX command sizes should be equal")); + KASSERT(cmd->tx_data_sz == cmd->rx_data_sz, + ("TX/RX data sizes should be equal")); + + BCM_SPI_LOCK(sc); + + /* If the controller is in use wait until it is available. */ + while (sc->sc_flags & BCM_SPI_BUSY) + mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_spi", 0); + + /* Now we have control over SPI controller. */ + sc->sc_flags = BCM_SPI_BUSY; + + /* Clear the FIFO. */ + bcm_spi_modifyreg(sc, SPI_CS, + SPI_CS_CLEAR_RXFIFO | SPI_CS_CLEAR_TXFIFO, + SPI_CS_CLEAR_RXFIFO | SPI_CS_CLEAR_TXFIFO); + + /* Get the proper chip select for this child. */ + spibus_get_cs(child, &cs); + if (cs < 0 || cs > 2) { + device_printf(dev, + "Invalid chip select %d requested by %s\n", cs, + device_get_nameunit(child)); + BCM_SPI_UNLOCK(sc); + return (EINVAL); + } + + /* Save a pointer to the SPI command. */ + sc->sc_cmd = cmd; + sc->sc_read = 0; + sc->sc_written = 0; + sc->sc_len = cmd->tx_cmd_sz + cmd->tx_data_sz; + + /* + * Set the CS for this transaction, enable interrupts and announce + * we're ready to tx. This will kick off the first interrupt. + */ + bcm_spi_modifyreg(sc, SPI_CS, + SPI_CS_MASK | SPI_CS_TA | SPI_CS_INTR | SPI_CS_INTD, + cs | SPI_CS_TA | SPI_CS_INTR | SPI_CS_INTD); + + /* Wait for the transaction to complete. */ + err = mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_spi", hz * 2); + + /* Make sure the SPI engine and interrupts are disabled. */ + bcm_spi_modifyreg(sc, SPI_CS, SPI_CS_TA | SPI_CS_INTR | SPI_CS_INTD, 0); + + /* Clear the controller flags. */ + sc->sc_flags = 0; + + /* + * Check for transfer timeout. The SPI controller doesn't + * return errors. + */ + if (err == EWOULDBLOCK) { + device_printf(sc->sc_dev, "SPI error\n"); + err = EIO; + } + + BCM_SPI_UNLOCK(sc); + + return (err); +} + +static phandle_t +bcm_spi_get_node(device_t bus, device_t dev) +{ + + /* We only have one child, the SPI bus, which needs our own node. */ + return (ofw_bus_get_node(bus)); +} + +static device_method_t bcm_spi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bcm_spi_probe), + DEVMETHOD(device_attach, bcm_spi_attach), + DEVMETHOD(device_detach, bcm_spi_detach), + + /* SPI interface */ + DEVMETHOD(spibus_transfer, bcm_spi_transfer), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, bcm_spi_get_node), + + DEVMETHOD_END +}; + +static devclass_t bcm_spi_devclass; + +static driver_t bcm_spi_driver = { + "spi", + bcm_spi_methods, + sizeof(struct bcm_spi_softc), +}; + +DRIVER_MODULE(bcm2835_spi, simplebus, bcm_spi_driver, bcm_spi_devclass, 0, 0); Copied: stable/10/sys/arm/broadcom/bcm2835/bcm2835_spireg.h (from r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spireg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_spireg.h Fri Dec 13 19:27:23 2013 (r259325, copy of r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spireg.h) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2013 Luiz Otavio O Souza + * 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$ + */ + +#ifndef _BCM2835_SPIREG_H_ +#define _BCM2835_SPIREG_H_ + +#define SPI_CORE_CLK 250000000U +#define SPI_CS 0x00 +#define SPI_CS_LEN_LONG (1 << 25) +#define SPI_CS_DMA_LEN (1 << 24) +#define SPI_CS_CSPOL2 (1 << 23) +#define SPI_CS_CSPOL1 (1 << 22) +#define SPI_CS_CSPOL0 (1 << 21) +#define SPI_CS_RXF (1 << 20) +#define SPI_CS_RXR (1 << 19) +#define SPI_CS_TXD (1 << 18) +#define SPI_CS_RXD (1 << 17) +#define SPI_CS_DONE (1 << 16) +#define SPI_CS_LEN (1 << 13) +#define SPI_CS_REN (1 << 12) +#define SPI_CS_ADCS (1 << 11) +#define SPI_CS_INTR (1 << 10) +#define SPI_CS_INTD (1 << 9) +#define SPI_CS_DMAEN (1 << 8) +#define SPI_CS_TA (1 << 7) +#define SPI_CS_CSPOL (1 << 6) +#define SPI_CS_CLEAR_RXFIFO (1 << 5) +#define SPI_CS_CLEAR_TXFIFO (1 << 4) +#define SPI_CS_CPOL (1 << 3) +#define SPI_CS_CPHA (1 << 2) +#define SPI_CS_MASK 0x3 +#define SPI_FIFO 0x04 +#define SPI_CLK 0x08 +#define SPI_CLK_MASK 0xffff +#define SPI_DLEN 0x0c +#define SPI_DLEN_MASK 0xffff +#define SPI_LTOH 0x10 +#define SPI_LTOH_MASK 0xf +#define SPI_DC 0x14 +#define SPI_DC_RPANIC_SHIFT 24 +#define SPI_DC_RPANIC_MASK (0xff << SPI_DC_RPANIC_SHIFT) +#define SPI_DC_RDREQ_SHIFT 16 +#define SPI_DC_RDREQ_MASK (0xff << SPI_DC_RDREQ_SHIFT) +#define SPI_DC_TPANIC_SHIFT 8 +#define SPI_DC_TPANIC_MASK (0xff << SPI_DC_TPANIC_SHIFT) +#define SPI_DC_TDREQ_SHIFT 0 +#define SPI_DC_TDREQ_MASK 0xff + +#endif /* _BCM2835_SPIREG_H_ */ Copied: stable/10/sys/arm/broadcom/bcm2835/bcm2835_spivar.h (from r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_spivar.h Fri Dec 13 19:27:23 2013 (r259325, copy of r257062, head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h) @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2013 Luiz Otavio O Souza + * 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$ + */ + +#ifndef _BCM2835_SPIVAR_H_ +#define _BCM2835_SPIVAR_H_ + +/* + * Only the available pins are listed here. + * i.e. CS2 isn't available. + */ +uint32_t bcm_spi_pins[] = { + 7, /* CS1 */ + 8, /* CS0 */ + 9, /* MISO */ + 10, /* MOSI */ + 11 /* SCLK */ +}; + +struct bcm_spi_softc { + device_t sc_dev; + struct mtx sc_mtx; + struct resource * sc_mem_res; + struct resource * sc_irq_res; + struct spi_command *sc_cmd; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + uint32_t sc_len; + uint32_t sc_read; + uint32_t sc_flags; + uint32_t sc_written; + void * sc_intrhand; +}; + +#define BCM_SPI_BUSY 0x1 + +#define BCM_SPI_WRITE(_sc, _off, _val) \ + bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val) +#define BCM_SPI_READ(_sc, _off) \ + bus_space_read_4(_sc->sc_bst, _sc->sc_bsh, _off) + +#define BCM_SPI_LOCK(_sc) \ + mtx_lock(&(_sc)->sc_mtx) +#define BCM_SPI_UNLOCK(_sc) \ + mtx_unlock(&(_sc)->sc_mtx) + +#endif /* _BCM2835_SPIVAR_H_ */ Modified: stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 Fri Dec 13 19:17:09 2013 (r259324) +++ stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 Fri Dec 13 19:27:23 2013 (r259325) @@ -7,6 +7,7 @@ arm/broadcom/bcm2835/bcm2835_intr.c sta arm/broadcom/bcm2835/bcm2835_machdep.c standard arm/broadcom/bcm2835/bcm2835_mbox.c standard arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci +arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi arm/broadcom/bcm2835/bcm2835_systimer.c standard arm/broadcom/bcm2835/bcm2835_wdog.c standard arm/broadcom/bcm2835/bus_space.c optional fdt Modified: stable/10/sys/arm/conf/RPI-B ============================================================================== --- stable/10/sys/arm/conf/RPI-B Fri Dec 13 19:17:09 2013 (r259324) +++ stable/10/sys/arm/conf/RPI-B Fri Dec 13 19:27:23 2013 (r259325) @@ -102,6 +102,10 @@ device smcphy device mii device smsc +# SPI +device spibus +device bcm2835_spi + # Flattened Device Tree options FDT # Note: DTB is normally loaded and modified by RPi boot loader, then Modified: stable/10/sys/boot/fdt/dts/bcm2835.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/bcm2835.dtsi Fri Dec 13 19:17:09 2013 (r259324) +++ stable/10/sys/boot/fdt/dts/bcm2835.dtsi Fri Dec 13 19:27:23 2013 (r259325) @@ -396,6 +396,14 @@ }; }; + spi0 { + compatible = "broadcom,bcm2835-spi", + "broadcom,bcm2708-spi"; + reg = <0x204000 0x20>; + interrupts = <62>; + interrupt-parent = <&intc>; + }; + dma: dma { compatible = "broadcom,bcm2835-dma", "broadcom,bcm2708-dma"; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 19:32:03 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 757DA65D; Fri, 13 Dec 2013 19:32:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 47ACF150E; Fri, 13 Dec 2013 19:32:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDJW3UW088832; Fri, 13 Dec 2013 19:32:03 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDJW3iw088831; Fri, 13 Dec 2013 19:32:03 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312131932.rBDJW3iw088831@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 13 Dec 2013 19:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259326 - stable/10/contrib/tcpdump X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 19:32:03 -0000 Author: pfg Date: Fri Dec 13 19:32:02 2013 New Revision: 259326 URL: http://svnweb.freebsd.org/changeset/base/259326 Log: MFV r258571: Removes strict-aliasing warnings from newer GCC in tcpdump. Corresponds to MFC r258573, but for some reason our new pre-commit hooks will not let us merge it from there. Modified: stable/10/contrib/tcpdump/extract.h Modified: stable/10/contrib/tcpdump/extract.h ============================================================================== --- stable/10/contrib/tcpdump/extract.h Fri Dec 13 19:27:23 2013 (r259325) +++ stable/10/contrib/tcpdump/extract.h Fri Dec 13 19:32:02 2013 (r259326) @@ -51,13 +51,25 @@ typedef struct { u_int32_t val; } __attribute__((packed)) unaligned_u_int32_t; -#define EXTRACT_16BITS(p) \ - ((u_int16_t)ntohs(((const unaligned_u_int16_t *)(p))->val)) -#define EXTRACT_32BITS(p) \ - ((u_int32_t)ntohl(((const unaligned_u_int32_t *)(p))->val)) -#define EXTRACT_64BITS(p) \ - ((u_int64_t)(((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 0)->val)) << 32 | \ - ((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 1)->val)) << 0)) +static inline u_int16_t +EXTRACT_16BITS(const void *p) +{ + return ((u_int16_t)ntohs(((const unaligned_u_int16_t *)(p))->val)); +} + +static inline u_int32_t +EXTRACT_32BITS(const void *p) +{ + return ((u_int32_t)ntohl(((const unaligned_u_int32_t *)(p))->val)); +} + +static inline u_int64_t +EXTRACT_64BITS(const void *p) +{ + return ((u_int64_t)(((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 0)->val)) << 32 | \ + ((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 1)->val)) << 0)); + +} #else /* HAVE___ATTRIBUTE__ */ /* @@ -88,13 +100,26 @@ typedef struct { * The processor natively handles unaligned loads, so we can just * cast the pointer and fetch through it. */ -#define EXTRACT_16BITS(p) \ - ((u_int16_t)ntohs(*(const u_int16_t *)(p))) -#define EXTRACT_32BITS(p) \ - ((u_int32_t)ntohl(*(const u_int32_t *)(p))) -#define EXTRACT_64BITS(p) \ - ((u_int64_t)(((u_int64_t)ntohl(*((const u_int32_t *)(p) + 0))) << 32 | \ - ((u_int64_t)ntohl(*((const u_int32_t *)(p) + 1))) << 0)) +static inline u_int16_t +EXTRACT_16BITS(const void *p) +{ + return ((u_int16_t)ntohs(*(const u_int16_t *)(p))); +} + +static inline u_int32_t +EXTRACT_32BITS(const void *p) +{ + return ((u_int32_t)ntohl(*(const u_int32_t *)(p))); +} + +static inline u_int64_t +EXTRACT_64BITS(const void *p) +{ + return ((u_int64_t)(((u_int64_t)ntohl(*((const u_int32_t *)(p) + 0))) << 32 | \ + ((u_int64_t)ntohl(*((const u_int32_t *)(p) + 1))) << 0)); + +} + #endif /* LBL_ALIGN */ #define EXTRACT_24BITS(p) \ From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 19:38:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3AE25BAE; Fri, 13 Dec 2013 19:38:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0BF151574; Fri, 13 Dec 2013 19:38:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDJc50d089802; Fri, 13 Dec 2013 19:38:05 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDJc5o8089801; Fri, 13 Dec 2013 19:38:05 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312131938.rBDJc5o8089801@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 13 Dec 2013 19:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259327 - stable/9/contrib/tcpdump X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 19:38:06 -0000 Author: pfg Date: Fri Dec 13 19:38:05 2013 New Revision: 259327 URL: http://svnweb.freebsd.org/changeset/base/259327 Log: MFV r258571: Removes strict-aliasing warnings from newer GCC in tcpdump. Corresponds to MFC r258573, but for some reason our new pre-commit hooks will not let us merge it from there. Modified: stable/9/contrib/tcpdump/extract.h Modified: stable/9/contrib/tcpdump/extract.h ============================================================================== --- stable/9/contrib/tcpdump/extract.h Fri Dec 13 19:32:02 2013 (r259326) +++ stable/9/contrib/tcpdump/extract.h Fri Dec 13 19:38:05 2013 (r259327) @@ -51,13 +51,25 @@ typedef struct { u_int32_t val; } __attribute__((packed)) unaligned_u_int32_t; -#define EXTRACT_16BITS(p) \ - ((u_int16_t)ntohs(((const unaligned_u_int16_t *)(p))->val)) -#define EXTRACT_32BITS(p) \ - ((u_int32_t)ntohl(((const unaligned_u_int32_t *)(p))->val)) -#define EXTRACT_64BITS(p) \ - ((u_int64_t)(((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 0)->val)) << 32 | \ - ((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 1)->val)) << 0)) +static inline u_int16_t +EXTRACT_16BITS(const void *p) +{ + return ((u_int16_t)ntohs(((const unaligned_u_int16_t *)(p))->val)); +} + +static inline u_int32_t +EXTRACT_32BITS(const void *p) +{ + return ((u_int32_t)ntohl(((const unaligned_u_int32_t *)(p))->val)); +} + +static inline u_int64_t +EXTRACT_64BITS(const void *p) +{ + return ((u_int64_t)(((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 0)->val)) << 32 | \ + ((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 1)->val)) << 0)); + +} #else /* HAVE___ATTRIBUTE__ */ /* @@ -88,13 +100,26 @@ typedef struct { * The processor natively handles unaligned loads, so we can just * cast the pointer and fetch through it. */ -#define EXTRACT_16BITS(p) \ - ((u_int16_t)ntohs(*(const u_int16_t *)(p))) -#define EXTRACT_32BITS(p) \ - ((u_int32_t)ntohl(*(const u_int32_t *)(p))) -#define EXTRACT_64BITS(p) \ - ((u_int64_t)(((u_int64_t)ntohl(*((const u_int32_t *)(p) + 0))) << 32 | \ - ((u_int64_t)ntohl(*((const u_int32_t *)(p) + 1))) << 0)) +static inline u_int16_t +EXTRACT_16BITS(const void *p) +{ + return ((u_int16_t)ntohs(*(const u_int16_t *)(p))); +} + +static inline u_int32_t +EXTRACT_32BITS(const void *p) +{ + return ((u_int32_t)ntohl(*(const u_int32_t *)(p))); +} + +static inline u_int64_t +EXTRACT_64BITS(const void *p) +{ + return ((u_int64_t)(((u_int64_t)ntohl(*((const u_int32_t *)(p) + 0))) << 32 | \ + ((u_int64_t)ntohl(*((const u_int32_t *)(p) + 1))) << 0)); + +} + #endif /* LBL_ALIGN */ #define EXTRACT_24BITS(p) \ From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 19:43:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C908CD70 for ; Fri, 13 Dec 2013 19:43:32 +0000 (UTC) Received: from mail-qc0-x234.google.com (mail-qc0-x234.google.com [IPv6:2607:f8b0:400d:c01::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7FADF15EC for ; Fri, 13 Dec 2013 19:43:32 +0000 (UTC) Received: by mail-qc0-f180.google.com with SMTP id w7so1878622qcr.11 for ; Fri, 13 Dec 2013 11:43:31 -0800 (PST) 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:message-id :subject:to:cc:content-type; bh=UzX9zY51GEdntUbSj4lNOAIYXXTPyUkh/lAYK6cuGQc=; b=mPsSCuk5gwz6kXnmhTTxShoT1R4Wq8CXT/0TLGXrEU1/3fUgrkg+v+wm5btkm0yxpL WDhkEW705DLOGwmefZiXqCR1vFiByOaNpWBr5QaukwyP8OmkxdbMyHAELWwjwN9Iqjw5 665D7DV3iF0pi7QLNDwkDU90cqJM/37x8mJ24= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=UzX9zY51GEdntUbSj4lNOAIYXXTPyUkh/lAYK6cuGQc=; b=SufCfNjxALrl8YIGPVmZvIRcgkNRDUtItJojz4SC2ZrMoSKe9b06axwmBqC0YtxLOn InR7OqK9HAYQjo/5Np/KP5gGEYz5uUMQ4k5Ij4YGQ2c2JYLK22C82GXSah43lblSumh4 Kfle9BZ1p0TkB4ltiRidoHxCYsdLbmPsgayGMeufGRm6EKcyRocm0dY7Actg+LCbp8It mC1uxMuE5uzEWpEoXhiNaQbjxeETheyg5xH4SmDdJuzNkqeu+d9yWQgNmMn0C2svC17f +dIfU3wnWn/GcImo6uUbyXMNgZ3E8yZXEot7XcL0jxWe9qw5jNMk8NhAPUd6u1QwscLo UDxQ== X-Gm-Message-State: ALoCoQl+O23B58orusvO/wQQlIY8dUSUjNtWqYeFGtRJOaNrkSG+iE/K13gqvmQoq6jGgHXRfJDs X-Received: by 10.224.28.72 with SMTP id l8mr7521317qac.35.1386963811481; Fri, 13 Dec 2013 11:43:31 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.96.86.42 with HTTP; Fri, 13 Dec 2013 11:43:01 -0800 (PST) In-Reply-To: <201312131932.rBDJW3iw088831@svn.freebsd.org> References: <201312131932.rBDJW3iw088831@svn.freebsd.org> From: Eitan Adler Date: Fri, 13 Dec 2013 14:43:01 -0500 X-Google-Sender-Auth: dm7L8m2gMe1JkQg1QjBqWSU2LHA Message-ID: Subject: Re: svn commit: r259326 - stable/10/contrib/tcpdump To: "Pedro F. Giffuni" Content-Type: text/plain; charset=UTF-8 Cc: svn-src-stable@freebsd.org, "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 19:43:32 -0000 On Fri, Dec 13, 2013 at 2:32 PM, Pedro F. Giffuni wrote: > Author: pfg > Date: Fri Dec 13 19:32:02 2013 > New Revision: 259326 > URL: http://svnweb.freebsd.org/changeset/base/259326 > > Log: > MFV r258571: > > Removes strict-aliasing warnings from newer GCC in tcpdump. > > Corresponds to MFC r258573, but for some reason our new pre-commit hooks > will not let us merge it from there. How did you attempt to do this merge? What were the exact commands? From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 20:11:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 582077AF for ; Fri, 13 Dec 2013 20:11:06 +0000 (UTC) Received: from nm39-vm9.bullet.mail.bf1.yahoo.com (nm39-vm9.bullet.mail.bf1.yahoo.com [72.30.239.153]) by mx1.freebsd.org (Postfix) with SMTP id E24F41820 for ; Fri, 13 Dec 2013 20:11:05 +0000 (UTC) Received: from [98.139.212.149] by nm39.bullet.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 20:04:23 -0000 Received: from [68.142.230.77] by tm6.bullet.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 20:04:23 -0000 Received: from [127.0.0.1] by smtp234.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 20:04:23 -0000 X-Yahoo-Newman-Id: 771516.71567.bm@smtp234.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: FReGZEcVM1nRzYZLDCj0ETN1IZ_pGQmSYgfqEZsOK7QWOHo YKUSWJzcrNWBoiBR_vfNMmil3ozJ6OTXVpNXtVhA8H30nHphQ4aVBLGAVc.v 2xGK7omuzkx6Gc3iFjax1CPHYty7OajTdBtrSLfc9I2i_ZQ5sc1bHwKwugXV 1Qv.c8l86CAin2DiJYk5O8zKp9Xepp2feVHj7bLzJyldezJc9tgeznnYzn1n S8_xZKlSb73YM_Dh4ItQKQyiMY66wuPAwfpusalTS1WGIr0xa7VWA02tPq6O 1crWz5GIyZ89fJlhIodZJ77fKVtayqh8SYoyW7E.xpuxj50OsjAsiPb3V_1Y NIyZtr_GykcuV2MgfABopnNqk5lymUWwX_hnbKvGw3jXsCUVcTXR2cQtG3R4 0aneDAZQqfWPsttc4RsGo.GDCjGi5ugprzH8q_jA9JcBKHKBOPGX3ga7Sc5p hMB_D_W3d3yYhW1LihKM5vUbcQArE.sZ91acxp069gVBNX3NMfhOOs35Awex zl7P7YXAzNF83c_fj0c598rQM6zi1eaqjL.wP03POuEY8C4xhq0BbTA-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with plain [98.139.211.125]) by smtp234.mail.bf1.yahoo.com with SMTP; 13 Dec 2013 20:04:23 +0000 UTC Message-ID: <52AB6845.7020504@FreeBSD.org> Date: Fri, 13 Dec 2013 15:04:21 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Eitan Adler Subject: Re: svn commit: r259326 - stable/10/contrib/tcpdump References: <201312131932.rBDJW3iw088831@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 20:11:06 -0000 On 13.12.2013 14:43, Eitan Adler wrote: > On Fri, Dec 13, 2013 at 2:32 PM, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Fri Dec 13 19:32:02 2013 >> New Revision: 259326 >> URL: http://svnweb.freebsd.org/changeset/base/259326 >> >> Log: >> MFV r258571: >> >> Removes strict-aliasing warnings from newer GCC in tcpdump. >> >> Corresponds to MFC r258573, but for some reason our new pre-commit hooks >> will not let us merge it from there. > How did you attempt to do this merge? What were the exact commands? (Standing on my local stable/10 dir) svn merge -c r258573 ^/head . Attempt to commit there fired the pre-commit hook. I then tried: svn merge --ignore-ancestry -c r258573 ^/head . (failed) Next attempt was: svn merge -c r258571 ^/vendor/tcpdump/dist contrib/tcpdump (also failed) finally this worked: svn merge --ignore-ancestry -c r258571 ^/vendor/tcpdump/dist contrib/tcpdump Hope that helps someone with the same issue ;). Pedro. From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 20:33:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EBC91D77; Fri, 13 Dec 2013 20:33:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BDBD3198A; Fri, 13 Dec 2013 20:33:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDKXxZS011031; Fri, 13 Dec 2013 20:33:59 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDKXx00011029; Fri, 13 Dec 2013 20:33:59 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201312132033.rBDKXx00011029@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 13 Dec 2013 20:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259328 - in stable/10/sys/geom: . label X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 20:34:00 -0000 Author: trasz Date: Fri Dec 13 20:33:59 2013 New Revision: 259328 URL: http://svnweb.freebsd.org/changeset/base/259328 Log: MFC r256724: Make geom_label(4) resize-aware. This fixes a situation when "gpart resize" would resize a partition, but label providers - e.g. /dev/gptid/XXX - would stay the same size. MFC r256766: Fix build with gcc by spelling unused format string as "unused" instead of NULL. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/geom/geom_slice.c stable/10/sys/geom/label/g_label.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/geom_slice.c ============================================================================== --- stable/10/sys/geom/geom_slice.c Fri Dec 13 19:38:05 2013 (r259327) +++ stable/10/sys/geom/geom_slice.c Fri Dec 13 20:33:59 2013 (r259328) @@ -382,7 +382,7 @@ g_slice_config(struct g_geom *gp, u_int printf("GEOM: Reconfigure %s, start %jd length %jd end %jd\n", pp->name, (intmax_t)offset, (intmax_t)length, (intmax_t)(offset + length - 1)); - pp->mediasize = gsl->length; + g_resize_provider(pp, gsl->length); return (0); } sb = sbuf_new_auto(); Modified: stable/10/sys/geom/label/g_label.c ============================================================================== --- stable/10/sys/geom/label/g_label.c Fri Dec 13 19:38:05 2013 (r259327) +++ stable/10/sys/geom/label/g_label.c Fri Dec 13 20:33:59 2013 (r259328) @@ -124,6 +124,17 @@ g_label_spoiled(struct g_consumer *cp) g_slice_spoiled(cp); } +static void +g_label_resize(struct g_consumer *cp) +{ + + G_LABEL_DEBUG(1, "Label %s resized.", + LIST_FIRST(&cp->geom->provider)->name); + + g_slice_config(cp->geom, 0, G_SLICE_CONFIG_FORCE, (off_t)0, + cp->provider->mediasize, cp->provider->sectorsize, "notused"); +} + static int g_label_is_name_ok(const char *label) { @@ -208,6 +219,7 @@ g_label_create(struct gctl_req *req, str } gp->orphan = g_label_orphan; gp->spoiled = g_label_spoiled; + gp->resize = g_label_resize; g_access(cp, -1, 0, 0); g_slice_config(gp, 0, G_SLICE_CONFIG_SET, (off_t)0, mediasize, pp->sectorsize, "%s", name); From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 20:43:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5BB92408; Fri, 13 Dec 2013 20:43:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 439441AD5; Fri, 13 Dec 2013 20:43:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDKhTnH014468; Fri, 13 Dec 2013 20:43:29 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDKhCpN014366; Fri, 13 Dec 2013 20:43:12 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132043.rBDKhCpN014366@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 20:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259329 - in stable/10/sys/arm: allwinner allwinner/a20 arm at91 broadcom/bcm2835 econa freescale/imx include lpc mv mv/orion rockchip sa11x0 samsung/exynos tegra ti ti/am335x ti/omap4 ... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 20:43:29 -0000 Author: ian Date: Fri Dec 13 20:43:11 2013 New Revision: 259329 URL: http://svnweb.freebsd.org/changeset/base/259329 Log: MFC r257199, r257200, r257217: Remove all #include from arm code. It's already included by vm/pmap.h, which is a prerequisite for arm/machine/pmap.h so there's no reason to ever include it directly. Remove #include from all the arm code that doesn't really need it. That would be almost everywhere it was included. Add it in a couple files that really do need it and were previously getting it by accident via another header. Remove the last dregs of trapframe_t. It turns out only arm was using this type, so remove it to make arm code more consistant with other platforms. Modified: stable/10/sys/arm/allwinner/a10_clk.c stable/10/sys/arm/allwinner/a10_gpio.c stable/10/sys/arm/allwinner/a10_machdep.c stable/10/sys/arm/allwinner/a20/a20_cpu_cfg.c stable/10/sys/arm/allwinner/timer.c stable/10/sys/arm/arm/cpufunc.c stable/10/sys/arm/arm/genassym.c stable/10/sys/arm/arm/generic_timer.c stable/10/sys/arm/arm/machdep.c stable/10/sys/arm/arm/minidump_machdep.c stable/10/sys/arm/arm/mpcore_timer.c stable/10/sys/arm/arm/nexus.c stable/10/sys/arm/arm/trap.c stable/10/sys/arm/arm/undefined.c stable/10/sys/arm/arm/vfp.c stable/10/sys/arm/arm/vm_machdep.c stable/10/sys/arm/at91/at91_mci.c stable/10/sys/arm/at91/at91_pmc.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_fb.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_spi.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_systimer.c stable/10/sys/arm/econa/timer.c stable/10/sys/arm/freescale/imx/imx51_ipuv3.c stable/10/sys/arm/freescale/imx/imx_gpt.c stable/10/sys/arm/freescale/imx/imx_machdep.c stable/10/sys/arm/include/cpu.h stable/10/sys/arm/include/fdt.h stable/10/sys/arm/include/frame.h stable/10/sys/arm/include/pcb.h stable/10/sys/arm/include/pcpu.h stable/10/sys/arm/include/undefined.h stable/10/sys/arm/lpc/lpc_fb.c stable/10/sys/arm/lpc/lpc_gpio.c stable/10/sys/arm/lpc/lpc_machdep.c stable/10/sys/arm/lpc/lpc_mmc.c stable/10/sys/arm/lpc/lpc_spi.c stable/10/sys/arm/lpc/lpc_timer.c stable/10/sys/arm/mv/mv_machdep.c stable/10/sys/arm/mv/mvvar.h stable/10/sys/arm/mv/orion/db88f5xxx.c stable/10/sys/arm/mv/timer.c stable/10/sys/arm/rockchip/rk30xx_gpio.c stable/10/sys/arm/rockchip/rk30xx_grf.c stable/10/sys/arm/rockchip/rk30xx_machdep.c stable/10/sys/arm/rockchip/rk30xx_pmu.c stable/10/sys/arm/sa11x0/sa11x0_io.c stable/10/sys/arm/samsung/exynos/arch_timer.c stable/10/sys/arm/samsung/exynos/exynos5_machdep.c stable/10/sys/arm/tegra/tegra2_machdep.c stable/10/sys/arm/ti/am335x/am335x_dmtimer.c stable/10/sys/arm/ti/am335x/am335x_lcd_syscons.c stable/10/sys/arm/ti/am335x/am335x_prcm.c stable/10/sys/arm/ti/am335x/am335x_scm_padconf.c stable/10/sys/arm/ti/omap4/omap4_prcm_clks.c stable/10/sys/arm/ti/omap4/omap4_scm_padconf.c stable/10/sys/arm/ti/omap4/pandaboard/pandaboard.c stable/10/sys/arm/ti/ti_cpuid.c stable/10/sys/arm/ti/ti_machdep.c stable/10/sys/arm/ti/ti_mmchs.c stable/10/sys/arm/ti/ti_prcm.c stable/10/sys/arm/ti/ti_scm.c stable/10/sys/arm/ti/twl/twl.c stable/10/sys/arm/ti/twl/twl_clks.c stable/10/sys/arm/ti/twl/twl_vreg.c stable/10/sys/arm/versatile/pl050.c stable/10/sys/arm/versatile/sp804.c stable/10/sys/arm/versatile/versatile_clcd.c stable/10/sys/arm/versatile/versatile_machdep.c stable/10/sys/arm/versatile/versatile_pci.c stable/10/sys/arm/versatile/versatile_timer.c stable/10/sys/arm/xilinx/zy7_machdep.c stable/10/sys/arm/xscale/i80321/i80321_pci.c stable/10/sys/arm/xscale/i8134x/i81342_pci.c stable/10/sys/arm/xscale/ixp425/ixp425_pci.c stable/10/sys/arm/xscale/ixp425/ixp425_wdog.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/allwinner/a10_clk.c ============================================================================== --- stable/10/sys/arm/allwinner/a10_clk.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/allwinner/a10_clk.c Fri Dec 13 20:43:11 2013 (r259329) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/allwinner/a10_gpio.c ============================================================================== --- stable/10/sys/arm/allwinner/a10_gpio.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/allwinner/a10_gpio.c Fri Dec 13 20:43:11 2013 (r259329) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/allwinner/a10_machdep.c ============================================================================== --- stable/10/sys/arm/allwinner/a10_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/allwinner/a10_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -43,9 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include Modified: stable/10/sys/arm/allwinner/a20/a20_cpu_cfg.c ============================================================================== --- stable/10/sys/arm/allwinner/a20/a20_cpu_cfg.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/allwinner/a20/a20_cpu_cfg.c Fri Dec 13 20:43:11 2013 (r259329) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/allwinner/timer.c ============================================================================== --- stable/10/sys/arm/allwinner/timer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/allwinner/timer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/arm/cpufunc.c ============================================================================== --- stable/10/sys/arm/arm/cpufunc.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/cpufunc.c Fri Dec 13 20:43:11 2013 (r259329) @@ -1720,7 +1720,7 @@ int early_abort_fixup(arg) void *arg; { - trapframe_t *frame = arg; + struct trapframe *frame = arg; u_int fault_pc; u_int fault_instruction; int saved_lr = 0; @@ -1861,7 +1861,7 @@ int late_abort_fixup(arg) void *arg; { - trapframe_t *frame = arg; + struct trapframe *frame = arg; u_int fault_pc; u_int fault_instruction; int saved_lr = 0; Modified: stable/10/sys/arm/arm/genassym.c ============================================================================== --- stable/10/sys/arm/arm/genassym.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/genassym.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: stable/10/sys/arm/arm/generic_timer.c ============================================================================== --- stable/10/sys/arm/arm/generic_timer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/generic_timer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/arm/machdep.c ============================================================================== --- stable/10/sys/arm/arm/machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -90,11 +90,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include #include #include #include Modified: stable/10/sys/arm/arm/minidump_machdep.c ============================================================================== --- stable/10/sys/arm/arm/minidump_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/minidump_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #endif #include #include -#include #include #include #include Modified: stable/10/sys/arm/arm/mpcore_timer.c ============================================================================== --- stable/10/sys/arm/arm/mpcore_timer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/mpcore_timer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/arm/nexus.c ============================================================================== --- stable/10/sys/arm/arm/nexus.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/nexus.c Fri Dec 13 20:43:11 2013 (r259329) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/arm/trap.c ============================================================================== --- stable/10/sys/arm/arm/trap.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/trap.c Fri Dec 13 20:43:11 2013 (r259329) @@ -123,8 +123,8 @@ __FBSDID("$FreeBSD$"); #endif -void swi_handler(trapframe_t *); -void undefinedinstruction(trapframe_t *); +void swi_handler(struct trapframe *); +void undefinedinstruction(struct trapframe *); #include #include @@ -145,13 +145,17 @@ struct ksig { u_long code; }; struct data_abort { - int (*func)(trapframe_t *, u_int, u_int, struct thread *, struct ksig *); + int (*func)(struct trapframe *, u_int, u_int, struct thread *, + struct ksig *); const char *desc; }; -static int dab_fatal(trapframe_t *, u_int, u_int, struct thread *, struct ksig *); -static int dab_align(trapframe_t *, u_int, u_int, struct thread *, struct ksig *); -static int dab_buserr(trapframe_t *, u_int, u_int, struct thread *, struct ksig *); +static int dab_fatal(struct trapframe *, u_int, u_int, struct thread *, + struct ksig *); +static int dab_align(struct trapframe *, u_int, u_int, struct thread *, + struct ksig *); +static int dab_buserr(struct trapframe *, u_int, u_int, struct thread *, + struct ksig *); static const struct data_abort data_aborts[] = { {dab_fatal, "Vector Exception"}, @@ -196,7 +200,8 @@ call_trapsignal(struct thread *td, int s } static __inline int -data_abort_fixup(trapframe_t *tf, u_int fsr, u_int far, struct thread *td, struct ksig *ksig) +data_abort_fixup(struct trapframe *tf, u_int fsr, u_int far, struct thread *td, + struct ksig *ksig) { #ifdef CPU_ABORT_FIXUP_REQUIRED int error; @@ -226,7 +231,7 @@ data_abort_fixup(trapframe_t *tf, u_int } void -data_abort_handler(trapframe_t *tf) +data_abort_handler(struct trapframe *tf) { struct vm_map *map; struct pcb *pcb; @@ -482,7 +487,8 @@ out: * Note: If 'l' is NULL, we assume we're dealing with a prefetch abort. */ static int -dab_fatal(trapframe_t *tf, u_int fsr, u_int far, struct thread *td, struct ksig *ksig) +dab_fatal(struct trapframe *tf, u_int fsr, u_int far, struct thread *td, + struct ksig *ksig) { const char *mode; @@ -538,7 +544,8 @@ dab_fatal(trapframe_t *tf, u_int fsr, u_ * deliver a bus error to the process. */ static int -dab_align(trapframe_t *tf, u_int fsr, u_int far, struct thread *td, struct ksig *ksig) +dab_align(struct trapframe *tf, u_int fsr, u_int far, struct thread *td, + struct ksig *ksig) { /* Alignment faults are always fatal if they occur in kernel mode */ @@ -586,7 +593,8 @@ dab_align(trapframe_t *tf, u_int fsr, u_ * In all other cases, these data aborts are considered fatal. */ static int -dab_buserr(trapframe_t *tf, u_int fsr, u_int far, struct thread *td, struct ksig *ksig) +dab_buserr(struct trapframe *tf, u_int fsr, u_int far, struct thread *td, + struct ksig *ksig) { struct pcb *pcb = td->td_pcb; @@ -607,7 +615,7 @@ dab_buserr(trapframe_t *tf, u_int fsr, u * If the current trapframe is at the top of the kernel stack, * the fault _must_ have come from user mode. */ - if (tf != ((trapframe_t *)pcb->un_32.pcb32_sp) - 1) { + if (tf != ((struct trapframe *)pcb->un_32.pcb32_sp) - 1) { /* * Kernel mode. We're either about to die a * spectacular death, or pcb_onfault will come @@ -660,7 +668,7 @@ dab_buserr(trapframe_t *tf, u_int fsr, u } static __inline int -prefetch_abort_fixup(trapframe_t *tf, struct ksig *ksig) +prefetch_abort_fixup(struct trapframe *tf, struct ksig *ksig) { #ifdef CPU_ABORT_FIXUP_REQUIRED int error; @@ -691,7 +699,7 @@ prefetch_abort_fixup(trapframe_t *tf, st } /* - * void prefetch_abort_handler(trapframe_t *tf) + * void prefetch_abort_handler(struct trapframe *tf) * * Abort handler called when instruction execution occurs at * a non existent or restricted (access permissions) memory page. @@ -702,7 +710,7 @@ prefetch_abort_fixup(trapframe_t *tf, st * Otherwise fault the page in and try again. */ void -prefetch_abort_handler(trapframe_t *tf) +prefetch_abort_handler(struct trapframe *tf) { struct thread *td; struct proc * p; @@ -907,7 +915,7 @@ cpu_fetch_syscall_args(struct thread *td #include "../../kern/subr_syscall.c" static void -syscall(struct thread *td, trapframe_t *frame) +syscall(struct thread *td, struct trapframe *frame) { struct syscall_args sa; int error; @@ -932,7 +940,7 @@ syscall(struct thread *td, trapframe_t * } void -swi_handler(trapframe_t *frame) +swi_handler(struct trapframe *frame) { struct thread *td = curthread; Modified: stable/10/sys/arm/arm/undefined.c ============================================================================== --- stable/10/sys/arm/arm/undefined.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/undefined.c Fri Dec 13 20:43:11 2013 (r259329) @@ -166,7 +166,7 @@ undefined_init() void -undefinedinstruction(trapframe_t *frame) +undefinedinstruction(struct trapframe *frame) { struct thread *td; u_int fault_pc; Modified: stable/10/sys/arm/arm/vfp.c ============================================================================== --- stable/10/sys/arm/arm/vfp.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/vfp.c Fri Dec 13 20:43:11 2013 (r259329) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: stable/10/sys/arm/arm/vm_machdep.c ============================================================================== --- stable/10/sys/arm/arm/vm_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/arm/vm_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -294,7 +295,7 @@ done: void cpu_set_syscall_retval(struct thread *td, int error) { - trapframe_t *frame; + struct trapframe *frame; int fixup; #ifdef __ARMEB__ uint32_t insn; Modified: stable/10/sys/arm/at91/at91_mci.c ============================================================================== --- stable/10/sys/arm/at91/at91_mci.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/at91/at91_mci.c Fri Dec 13 20:43:11 2013 (r259329) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/at91/at91_pmc.c ============================================================================== --- stable/10/sys/arm/at91/at91_pmc.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/at91/at91_pmc.c Fri Dec 13 20:43:11 2013 (r259329) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.c Fri Dec 13 20:43:11 2013 (r259329) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "bcm2835_dma.h" #include "bcm2835_vcbus.h" Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Dec 13 20:43:11 2013 (r259329) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Fri Dec 13 20:43:11 2013 (r259329) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -52,9 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Dec 13 20:43:11 2013 (r259329) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_spi.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_spi.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_spi.c Fri Dec 13 20:43:11 2013 (r259329) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_systimer.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/econa/timer.c ============================================================================== --- stable/10/sys/arm/econa/timer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/econa/timer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "econa_reg.h" Modified: stable/10/sys/arm/freescale/imx/imx51_ipuv3.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx51_ipuv3.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/freescale/imx/imx51_ipuv3.c Fri Dec 13 20:43:11 2013 (r259329) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_gpt.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/freescale/imx/imx_gpt.c Fri Dec 13 20:43:11 2013 (r259329) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/freescale/imx/imx_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,9 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include #include Modified: stable/10/sys/arm/include/cpu.h ============================================================================== --- stable/10/sys/arm/include/cpu.h Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/include/cpu.h Fri Dec 13 20:43:11 2013 (r259329) @@ -5,6 +5,7 @@ #define MACHINE_CPU_H #include +#include void cpu_halt(void); void swi_vm(void *); Modified: stable/10/sys/arm/include/fdt.h ============================================================================== --- stable/10/sys/arm/include/fdt.h Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/include/fdt.h Fri Dec 13 20:43:11 2013 (r259329) @@ -38,7 +38,6 @@ #include #include -#include #include /* Max interrupt number */ Modified: stable/10/sys/arm/include/frame.h ============================================================================== --- stable/10/sys/arm/include/frame.h Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/include/frame.h Fri Dec 13 20:43:11 2013 (r259329) @@ -59,7 +59,7 @@ * Trap frame. Pushed onto the kernel stack on a trap (synchronous exception). */ -typedef struct trapframe { +struct trapframe { register_t tf_spsr; /* Zero on arm26 */ register_t tf_r0; register_t tf_r1; @@ -80,7 +80,7 @@ typedef struct trapframe { register_t tf_svc_lr; /* Not used on arm26 */ register_t tf_pc; register_t tf_pad; -} trapframe_t; +}; /* Register numbers */ #define tf_r13 tf_usr_sp Modified: stable/10/sys/arm/include/pcb.h ============================================================================== --- stable/10/sys/arm/include/pcb.h Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/include/pcb.h Fri Dec 13 20:43:11 2013 (r259329) @@ -38,7 +38,6 @@ #ifndef _MACHINE_PCB_H_ #define _MACHINE_PCB_H_ -#include #include Modified: stable/10/sys/arm/include/pcpu.h ============================================================================== --- stable/10/sys/arm/include/pcpu.h Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/include/pcpu.h Fri Dec 13 20:43:11 2013 (r259329) @@ -33,7 +33,6 @@ #ifdef _KERNEL #include -#include #define ALT_STACK_SIZE 128 Modified: stable/10/sys/arm/include/undefined.h ============================================================================== --- stable/10/sys/arm/include/undefined.h Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/include/undefined.h Fri Dec 13 20:43:11 2013 (r259329) @@ -52,7 +52,9 @@ #include -typedef int (*undef_handler_t) (unsigned int, unsigned int, trapframe_t *, int); +struct trapframe; + +typedef int (*undef_handler_t) (unsigned int, unsigned int, struct trapframe *, int); #define FP_COPROC 1 #define FP_COPROC2 2 Modified: stable/10/sys/arm/lpc/lpc_fb.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_fb.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/lpc/lpc_fb.c Fri Dec 13 20:43:11 2013 (r259329) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/lpc/lpc_gpio.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_gpio.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/lpc/lpc_gpio.c Fri Dec 13 20:43:11 2013 (r259329) @@ -76,7 +76,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/lpc/lpc_machdep.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/lpc/lpc_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -50,9 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include #include Modified: stable/10/sys/arm/lpc/lpc_mmc.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_mmc.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/lpc/lpc_mmc.c Fri Dec 13 20:43:11 2013 (r259329) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/lpc/lpc_spi.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_spi.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/lpc/lpc_spi.c Fri Dec 13 20:43:11 2013 (r259329) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/lpc/lpc_timer.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_timer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/lpc/lpc_timer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/mv/mv_machdep.c ============================================================================== --- stable/10/sys/arm/mv/mv_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/mv/mv_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -50,9 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include /* XXX */ #include /* XXX eventually this should be eliminated */ Modified: stable/10/sys/arm/mv/mvvar.h ============================================================================== --- stable/10/sys/arm/mv/mvvar.h Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/mv/mvvar.h Fri Dec 13 20:43:11 2013 (r259329) @@ -44,7 +44,6 @@ #include #include #include -#include #include #define MV_TYPE_PCI 0 Modified: stable/10/sys/arm/mv/orion/db88f5xxx.c ============================================================================== --- stable/10/sys/arm/mv/orion/db88f5xxx.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/mv/orion/db88f5xxx.c Fri Dec 13 20:43:11 2013 (r259329) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/mv/timer.c ============================================================================== --- stable/10/sys/arm/mv/timer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/mv/timer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/rockchip/rk30xx_gpio.c ============================================================================== --- stable/10/sys/arm/rockchip/rk30xx_gpio.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/rockchip/rk30xx_gpio.c Fri Dec 13 20:43:11 2013 (r259329) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/rockchip/rk30xx_grf.c ============================================================================== --- stable/10/sys/arm/rockchip/rk30xx_grf.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/rockchip/rk30xx_grf.c Fri Dec 13 20:43:11 2013 (r259329) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/rockchip/rk30xx_machdep.c ============================================================================== --- stable/10/sys/arm/rockchip/rk30xx_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/rockchip/rk30xx_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include Modified: stable/10/sys/arm/rockchip/rk30xx_pmu.c ============================================================================== --- stable/10/sys/arm/rockchip/rk30xx_pmu.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/rockchip/rk30xx_pmu.c Fri Dec 13 20:43:11 2013 (r259329) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/sa11x0/sa11x0_io.c ============================================================================== --- stable/10/sys/arm/sa11x0/sa11x0_io.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/sa11x0/sa11x0_io.c Fri Dec 13 20:43:11 2013 (r259329) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* Proto types for all the bus_space structure functions */ Modified: stable/10/sys/arm/samsung/exynos/arch_timer.c ============================================================================== --- stable/10/sys/arm/samsung/exynos/arch_timer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/samsung/exynos/arch_timer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/samsung/exynos/exynos5_machdep.c ============================================================================== --- stable/10/sys/arm/samsung/exynos/exynos5_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/samsung/exynos/exynos5_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,9 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include Modified: stable/10/sys/arm/tegra/tegra2_machdep.c ============================================================================== --- stable/10/sys/arm/tegra/tegra2_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/tegra/tegra2_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -45,9 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include Modified: stable/10/sys/arm/ti/am335x/am335x_dmtimer.c ============================================================================== --- stable/10/sys/arm/ti/am335x/am335x_dmtimer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/am335x/am335x_dmtimer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/am335x/am335x_lcd_syscons.c ============================================================================== --- stable/10/sys/arm/ti/am335x/am335x_lcd_syscons.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/am335x/am335x_lcd_syscons.c Fri Dec 13 20:43:11 2013 (r259329) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/am335x/am335x_prcm.c ============================================================================== --- stable/10/sys/arm/ti/am335x/am335x_prcm.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/am335x/am335x_prcm.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/am335x/am335x_scm_padconf.c ============================================================================== --- stable/10/sys/arm/ti/am335x/am335x_scm_padconf.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/am335x/am335x_scm_padconf.c Fri Dec 13 20:43:11 2013 (r259329) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: stable/10/sys/arm/ti/omap4/omap4_prcm_clks.c ============================================================================== --- stable/10/sys/arm/ti/omap4/omap4_prcm_clks.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/omap4/omap4_prcm_clks.c Fri Dec 13 20:43:11 2013 (r259329) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/omap4/omap4_scm_padconf.c ============================================================================== --- stable/10/sys/arm/ti/omap4/omap4_scm_padconf.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/omap4/omap4_scm_padconf.c Fri Dec 13 20:43:11 2013 (r259329) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: stable/10/sys/arm/ti/omap4/pandaboard/pandaboard.c ============================================================================== --- stable/10/sys/arm/ti/omap4/pandaboard/pandaboard.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/omap4/pandaboard/pandaboard.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: stable/10/sys/arm/ti/ti_cpuid.c ============================================================================== --- stable/10/sys/arm/ti/ti_cpuid.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/ti_cpuid.c Fri Dec 13 20:43:11 2013 (r259329) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/ti_machdep.c ============================================================================== --- stable/10/sys/arm/ti/ti_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/ti_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -49,9 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include Modified: stable/10/sys/arm/ti/ti_mmchs.c ============================================================================== --- stable/10/sys/arm/ti/ti_mmchs.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/ti_mmchs.c Fri Dec 13 20:43:11 2013 (r259329) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/ti_prcm.c ============================================================================== --- stable/10/sys/arm/ti/ti_prcm.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/ti_prcm.c Fri Dec 13 20:43:11 2013 (r259329) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/ti_scm.c ============================================================================== --- stable/10/sys/arm/ti/ti_scm.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/ti_scm.c Fri Dec 13 20:43:11 2013 (r259329) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/twl/twl.c ============================================================================== --- stable/10/sys/arm/ti/twl/twl.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/twl/twl.c Fri Dec 13 20:43:11 2013 (r259329) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/twl/twl_clks.c ============================================================================== --- stable/10/sys/arm/ti/twl/twl_clks.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/twl/twl_clks.c Fri Dec 13 20:43:11 2013 (r259329) @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/ti/twl/twl_vreg.c ============================================================================== --- stable/10/sys/arm/ti/twl/twl_vreg.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/ti/twl/twl_vreg.c Fri Dec 13 20:43:11 2013 (r259329) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/versatile/pl050.c ============================================================================== --- stable/10/sys/arm/versatile/pl050.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/versatile/pl050.c Fri Dec 13 20:43:11 2013 (r259329) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: stable/10/sys/arm/versatile/sp804.c ============================================================================== --- stable/10/sys/arm/versatile/sp804.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/versatile/sp804.c Fri Dec 13 20:43:11 2013 (r259329) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/versatile/versatile_clcd.c ============================================================================== --- stable/10/sys/arm/versatile/versatile_clcd.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/versatile/versatile_clcd.c Fri Dec 13 20:43:11 2013 (r259329) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: stable/10/sys/arm/versatile/versatile_machdep.c ============================================================================== --- stable/10/sys/arm/versatile/versatile_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/versatile/versatile_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -49,9 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* For trapframe_t, used in */ #include -#include #include Modified: stable/10/sys/arm/versatile/versatile_pci.c ============================================================================== --- stable/10/sys/arm/versatile/versatile_pci.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/versatile/versatile_pci.c Fri Dec 13 20:43:11 2013 (r259329) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/versatile/versatile_timer.c ============================================================================== --- stable/10/sys/arm/versatile/versatile_timer.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/versatile/versatile_timer.c Fri Dec 13 20:43:11 2013 (r259329) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/xilinx/zy7_machdep.c ============================================================================== --- stable/10/sys/arm/xilinx/zy7_machdep.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/xilinx/zy7_machdep.c Fri Dec 13 20:43:11 2013 (r259329) @@ -49,8 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include Modified: stable/10/sys/arm/xscale/i80321/i80321_pci.c ============================================================================== --- stable/10/sys/arm/xscale/i80321/i80321_pci.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/xscale/i80321/i80321_pci.c Fri Dec 13 20:43:11 2013 (r259329) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/xscale/i8134x/i81342_pci.c ============================================================================== --- stable/10/sys/arm/xscale/i8134x/i81342_pci.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/xscale/i8134x/i81342_pci.c Fri Dec 13 20:43:11 2013 (r259329) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/xscale/ixp425/ixp425_pci.c ============================================================================== --- stable/10/sys/arm/xscale/ixp425/ixp425_pci.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/xscale/ixp425/ixp425_pci.c Fri Dec 13 20:43:11 2013 (r259329) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/10/sys/arm/xscale/ixp425/ixp425_wdog.c ============================================================================== --- stable/10/sys/arm/xscale/ixp425/ixp425_wdog.c Fri Dec 13 20:33:59 2013 (r259328) +++ stable/10/sys/arm/xscale/ixp425/ixp425_wdog.c Fri Dec 13 20:43:11 2013 (r259329) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 21:28:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 17257DF7; Fri, 13 Dec 2013 21:28:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DD98C1F4C; Fri, 13 Dec 2013 21:28:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDLSj4h029658; Fri, 13 Dec 2013 21:28:45 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDLSjat029657; Fri, 13 Dec 2013 21:28:45 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201312132128.rBDLSjat029657@svn.freebsd.org> From: Tijl Coosemans Date: Fri, 13 Dec 2013 21:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259334 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 21:28:46 -0000 Author: tijl Date: Fri Dec 13 21:28:45 2013 New Revision: 259334 URL: http://svnweb.freebsd.org/changeset/base/259334 Log: Add mergeinfo for the MFC of r258573 done in r259326. Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 21:32:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BF5B715C; Fri, 13 Dec 2013 21:32:54 +0000 (UTC) Received: from mailrelay005.isp.belgacom.be (mailrelay005.isp.belgacom.be [195.238.6.171]) by mx1.freebsd.org (Postfix) with ESMTP id 8EF971FD0; Fri, 13 Dec 2013 21:32:53 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmoGAKJ7q1JbsVZ9/2dsb2JhbABZgwo4SbhsgSQXdIIlAQEFOhwjEAsOBgQJJQ8qHgYTiAgBCMp8F48VB4Q2BJgVgTGQZIMrOw Received: from 125.86-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.86.125]) by relay.skynet.be with ESMTP; 13 Dec 2013 22:32:46 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.7/8.14.7) with ESMTP id rBDLWj0x013693; Fri, 13 Dec 2013 22:32:45 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Fri, 13 Dec 2013 22:32:44 +0100 From: Tijl Coosemans To: Pedro Giffuni Subject: Re: svn commit: r259326 - stable/10/contrib/tcpdump Message-ID: <20131213223244.6ef4384f@kalimero.tijl.coosemans.org> In-Reply-To: <52AB6845.7020504@FreeBSD.org> References: <201312131932.rBDJW3iw088831@svn.freebsd.org> <52AB6845.7020504@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Eitan Adler , svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 21:32:54 -0000 On Fri, 13 Dec 2013 15:04:21 -0500 Pedro Giffuni wrote: > On 13.12.2013 14:43, Eitan Adler wrote: >> On Fri, Dec 13, 2013 at 2:32 PM, Pedro F. Giffuni wrote: >>> Author: pfg >>> Date: Fri Dec 13 19:32:02 2013 >>> New Revision: 259326 >>> URL: http://svnweb.freebsd.org/changeset/base/259326 >>> >>> Log: >>> MFV r258571: >>> >>> Removes strict-aliasing warnings from newer GCC in tcpdump. >>> >>> Corresponds to MFC r258573, but for some reason our new pre-commit hooks >>> will not let us merge it from there. >> How did you attempt to do this merge? What were the exact commands? > > (Standing on my local stable/10 dir) > > svn merge -c r258573 ^/head . > > Attempt to commit there fired the pre-commit hook. This also copies the svn:mergeinfo property on head/contrib/tcpdump to stable/10/contrib/tcpdump, but this property is only allowed on stable/10 at the moment. I think you can just delete the property before committing: svn propdel svn:mergeinfo contrib/tcpdump From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 21:40:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 09EC04C6; Fri, 13 Dec 2013 21:40:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E84A11042; Fri, 13 Dec 2013 21:40:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDLeFmj033909; Fri, 13 Dec 2013 21:40:15 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDLeCJs033888; Fri, 13 Dec 2013 21:40:12 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132140.rBDLeCJs033888@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 21:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259335 - in stable/10/sys/arm: allwinner arm broadcom/bcm2835 include lpc mv rockchip samsung/exynos tegra ti versatile xilinx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 21:40:16 -0000 Author: ian Date: Fri Dec 13 21:40:12 2013 New Revision: 259335 URL: http://svnweb.freebsd.org/changeset/base/259335 Log: MFC r257201, r257202 Retire arm_remap_nocache() and the data and constants associated with it. Modified: stable/10/sys/arm/allwinner/a10_machdep.c stable/10/sys/arm/arm/busdma_machdep.c stable/10/sys/arm/arm/pmap-v6.c stable/10/sys/arm/arm/pmap.c stable/10/sys/arm/arm/vm_machdep.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/10/sys/arm/include/pmap.h stable/10/sys/arm/lpc/lpc_machdep.c stable/10/sys/arm/mv/mv_machdep.c stable/10/sys/arm/rockchip/rk30xx_machdep.c stable/10/sys/arm/samsung/exynos/exynos5_machdep.c stable/10/sys/arm/tegra/tegra2_machdep.c stable/10/sys/arm/ti/ti_machdep.c stable/10/sys/arm/versatile/versatile_machdep.c stable/10/sys/arm/xilinx/zy7_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/allwinner/a10_machdep.c ============================================================================== --- stable/10/sys/arm/allwinner/a10_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/allwinner/a10_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -57,7 +57,7 @@ vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); + return (DEVMAP_BOOTSTRAP_MAP_START); } void Modified: stable/10/sys/arm/arm/busdma_machdep.c ============================================================================== --- stable/10/sys/arm/arm/busdma_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/arm/busdma_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -122,7 +122,6 @@ struct bus_dma_tag { struct bounce_page { vm_offset_t vaddr; /* kva of bounce buffer */ - vm_offset_t vaddr_nocache; /* kva of bounce buffer uncached */ bus_addr_t busaddr; /* Physical address */ vm_offset_t datavaddr; /* kva of client data */ bus_addr_t dataaddr; /* client physical address */ @@ -1196,39 +1195,23 @@ _bus_dmamap_sync_bp(bus_dma_tag_t dmat, STAILQ_FOREACH(bpage, &map->bpages, links) { if (op & BUS_DMASYNC_PREWRITE) { if (bpage->datavaddr != 0) - bcopy((void *)bpage->datavaddr, - (void *)(bpage->vaddr_nocache != 0 ? - bpage->vaddr_nocache : - bpage->vaddr), - bpage->datacount); + bcopy((void *)bpage->datavaddr, + (void *)bpage->vaddr, bpage->datacount); else physcopyout(bpage->dataaddr, - (void *)(bpage->vaddr_nocache != 0 ? - bpage->vaddr_nocache : - bpage->vaddr), - bpage->datacount); - if (bpage->vaddr_nocache == 0) { - cpu_dcache_wb_range(bpage->vaddr, - bpage->datacount); - cpu_l2cache_wb_range(bpage->vaddr, - bpage->datacount); - } + (void *)bpage->vaddr,bpage->datacount); + cpu_dcache_wb_range(bpage->vaddr, bpage->datacount); + cpu_l2cache_wb_range(bpage->vaddr, bpage->datacount); dmat->bounce_zone->total_bounced++; } if (op & BUS_DMASYNC_POSTREAD) { - if (bpage->vaddr_nocache == 0) { - cpu_dcache_inv_range(bpage->vaddr, - bpage->datacount); - cpu_l2cache_inv_range(bpage->vaddr, - bpage->datacount); - } + cpu_dcache_inv_range(bpage->vaddr, bpage->datacount); + cpu_l2cache_inv_range(bpage->vaddr, bpage->datacount); if (bpage->datavaddr != 0) - bcopy((void *)(bpage->vaddr_nocache != 0 ? - bpage->vaddr_nocache : bpage->vaddr), + bcopy((void *)bpage->vaddr, (void *)bpage->datavaddr, bpage->datacount); else - physcopyin((void *)(bpage->vaddr_nocache != 0 ? - bpage->vaddr_nocache : bpage->vaddr), + physcopyin((void *)bpage->vaddr, bpage->dataaddr, bpage->datacount); dmat->bounce_zone->total_bounced++; } @@ -1385,8 +1368,6 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u break; } bpage->busaddr = pmap_kextract(bpage->vaddr); - bpage->vaddr_nocache = (vm_offset_t)arm_remap_nocache( - (void *)bpage->vaddr, PAGE_SIZE); mtx_lock(&bounce_lock); STAILQ_INSERT_TAIL(&bz->bounce_page_list, bpage, links); total_bpages++; Modified: stable/10/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/10/sys/arm/arm/pmap-v6.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/arm/pmap-v6.c Fri Dec 13 21:40:12 2013 (r259335) @@ -1951,7 +1951,6 @@ pmap_bootstrap(vm_offset_t firstaddr, st virtual_avail = round_page(virtual_avail); virtual_end = vm_max_kernel_address; kernel_vm_end = pmap_curmaxkvaddr; - arm_nocache_startaddr = vm_max_kernel_address; mtx_init(&cmtx, "TMP mappings mtx", NULL, MTX_DEF); pmap_set_pcb_pagedir(kernel_pmap, thread0.td_pcb); Modified: stable/10/sys/arm/arm/pmap.c ============================================================================== --- stable/10/sys/arm/arm/pmap.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/arm/pmap.c Fri Dec 13 21:40:12 2013 (r259335) @@ -2423,7 +2423,6 @@ pmap_bootstrap(vm_offset_t firstaddr, st virtual_avail = round_page(virtual_avail); virtual_end = vm_max_kernel_address; kernel_vm_end = pmap_curmaxkvaddr; - arm_nocache_startaddr = vm_max_kernel_address; mtx_init(&cmtx, "TMP mappings mtx", NULL, MTX_DEF); #ifdef ARM_USE_SMALL_ALLOC Modified: stable/10/sys/arm/arm/vm_machdep.c ============================================================================== --- stable/10/sys/arm/arm/vm_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/arm/vm_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -482,80 +482,6 @@ cpu_exit(struct thread *td) { } -#define BITS_PER_INT (8 * sizeof(int)) -vm_offset_t arm_nocache_startaddr; -static int arm_nocache_allocated[ARM_NOCACHE_KVA_SIZE / (PAGE_SIZE * - BITS_PER_INT)]; - -/* - * Functions to map and unmap memory non-cached into KVA the kernel won't try - * to allocate. The goal is to provide uncached memory to busdma, to honor - * BUS_DMA_COHERENT. - * We can allocate at most ARM_NOCACHE_KVA_SIZE bytes. - * The allocator is rather dummy, each page is represented by a bit in - * a bitfield, 0 meaning the page is not allocated, 1 meaning it is. - * As soon as it finds enough contiguous pages to satisfy the request, - * it returns the address. - */ -void * -arm_remap_nocache(void *addr, vm_size_t size) -{ - int i, j; - - size = round_page(size); - for (i = 0; i < ARM_NOCACHE_KVA_SIZE / PAGE_SIZE; i++) { - if (!(arm_nocache_allocated[i / BITS_PER_INT] & (1 << (i % - BITS_PER_INT)))) { - for (j = i; j < i + (size / (PAGE_SIZE)); j++) - if (arm_nocache_allocated[j / BITS_PER_INT] & - (1 << (j % BITS_PER_INT))) - break; - if (j == i + (size / (PAGE_SIZE))) - break; - } - } - if (i < ARM_NOCACHE_KVA_SIZE / PAGE_SIZE) { - vm_offset_t tomap = arm_nocache_startaddr + i * PAGE_SIZE; - void *ret = (void *)tomap; - vm_paddr_t physaddr = vtophys((vm_offset_t)addr); - vm_offset_t vaddr = (vm_offset_t) addr; - - vaddr = vaddr & ~PAGE_MASK; - for (; tomap < (vm_offset_t)ret + size; tomap += PAGE_SIZE, - vaddr += PAGE_SIZE, physaddr += PAGE_SIZE, i++) { - cpu_idcache_wbinv_range(vaddr, PAGE_SIZE); -#ifdef ARM_L2_PIPT - cpu_l2cache_wbinv_range(physaddr, PAGE_SIZE); -#else - cpu_l2cache_wbinv_range(vaddr, PAGE_SIZE); -#endif - pmap_kenter_nocache(tomap, physaddr); - cpu_tlb_flushID_SE(vaddr); - arm_nocache_allocated[i / BITS_PER_INT] |= 1 << (i % - BITS_PER_INT); - } - return (ret); - } - - return (NULL); -} - -void -arm_unmap_nocache(void *addr, vm_size_t size) -{ - vm_offset_t raddr = (vm_offset_t)addr; - int i; - - size = round_page(size); - i = (raddr - arm_nocache_startaddr) / (PAGE_SIZE); - for (; size > 0; size -= PAGE_SIZE, i++) { - arm_nocache_allocated[i / BITS_PER_INT] &= ~(1 << (i % - BITS_PER_INT)); - pmap_kremove(raddr); - raddr += PAGE_SIZE; - } -} - #ifdef ARM_USE_SMALL_ALLOC static TAILQ_HEAD(,arm_small_page) pages_normal = Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -65,7 +65,7 @@ vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); + return (DEVMAP_BOOTSTRAP_MAP_START); } void Modified: stable/10/sys/arm/include/pmap.h ============================================================================== --- stable/10/sys/arm/include/pmap.h Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/include/pmap.h Fri Dec 13 21:40:12 2013 (r259335) @@ -727,11 +727,6 @@ struct arm_small_page { #endif -#define ARM_NOCACHE_KVA_SIZE 0x1000000 -extern vm_offset_t arm_nocache_startaddr; -void *arm_remap_nocache(void *, vm_size_t); -void arm_unmap_nocache(void *, vm_size_t); - extern vm_paddr_t dump_avail[]; #endif /* _KERNEL */ Modified: stable/10/sys/arm/lpc/lpc_machdep.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/lpc/lpc_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -66,7 +66,7 @@ initarm_lastaddr(void) while (1); /* Platform-specific initialisation */ - return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); + return (fdt_immr_va); } void Modified: stable/10/sys/arm/mv/mv_machdep.c ============================================================================== --- stable/10/sys/arm/mv/mv_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/mv/mv_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -206,7 +206,7 @@ initarm_lastaddr(void) while (1); /* Platform-specific initialisation */ - return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); + return (fdt_immr_va); } void Modified: stable/10/sys/arm/rockchip/rk30xx_machdep.c ============================================================================== --- stable/10/sys/arm/rockchip/rk30xx_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/rockchip/rk30xx_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -55,7 +55,7 @@ vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); + return (DEVMAP_BOOTSTRAP_MAP_START); } void Modified: stable/10/sys/arm/samsung/exynos/exynos5_machdep.c ============================================================================== --- stable/10/sys/arm/samsung/exynos/exynos5_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/samsung/exynos/exynos5_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -49,7 +49,7 @@ vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); + return (DEVMAP_BOOTSTRAP_MAP_START); } void Modified: stable/10/sys/arm/tegra/tegra2_machdep.c ============================================================================== --- stable/10/sys/arm/tegra/tegra2_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/tegra/tegra2_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -109,7 +109,7 @@ initarm_lastaddr(void) if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */ while (1); - return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); + return (fdt_immr_va); } void Modified: stable/10/sys/arm/ti/ti_machdep.c ============================================================================== --- stable/10/sys/arm/ti/ti_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/ti/ti_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -63,7 +63,7 @@ initarm_lastaddr(void) { ti_cpu_reset = NULL; - return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); + return (DEVMAP_BOOTSTRAP_MAP_START); } void Modified: stable/10/sys/arm/versatile/versatile_machdep.c ============================================================================== --- stable/10/sys/arm/versatile/versatile_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/versatile/versatile_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -60,7 +60,7 @@ vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); + return (DEVMAP_BOOTSTRAP_MAP_START); } void Modified: stable/10/sys/arm/xilinx/zy7_machdep.c ============================================================================== --- stable/10/sys/arm/xilinx/zy7_machdep.c Fri Dec 13 21:28:45 2013 (r259334) +++ stable/10/sys/arm/xilinx/zy7_machdep.c Fri Dec 13 21:40:12 2013 (r259335) @@ -59,7 +59,7 @@ vm_offset_t initarm_lastaddr(void) { - return (ZYNQ7_PSIO_VBASE - ARM_NOCACHE_KVA_SIZE); + return (ZYNQ7_PSIO_VBASE); } void From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 21:41:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9049F757; Fri, 13 Dec 2013 21:41:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7CE50109B; Fri, 13 Dec 2013 21:41:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDLfe6e035932; Fri, 13 Dec 2013 21:41:40 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDLfeIa035931; Fri, 13 Dec 2013 21:41:40 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132141.rBDLfeIa035931@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 21:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259337 - stable/10/sys/arm/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 21:41:40 -0000 Author: ian Date: Fri Dec 13 21:41:40 2013 New Revision: 259337 URL: http://svnweb.freebsd.org/changeset/base/259337 Log: MFC r257203: Eliminate a compiler warning about extraneous parens. Modified: stable/10/sys/arm/arm/busdma_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/busdma_machdep.c ============================================================================== --- stable/10/sys/arm/arm/busdma_machdep.c Fri Dec 13 21:41:23 2013 (r259336) +++ stable/10/sys/arm/arm/busdma_machdep.c Fri Dec 13 21:41:40 2013 (r259337) @@ -807,7 +807,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dma bus_addr_t curaddr; bus_size_t sgsize; - if ((map->pagesneeded == 0)) { + if (map->pagesneeded == 0) { CTR3(KTR_BUSDMA, "lowaddr= %d, boundary= %d, alignment= %d", dmat->lowaddr, dmat->boundary, dmat->alignment); CTR2(KTR_BUSDMA, "map= %p, pagesneeded= %d", @@ -838,7 +838,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm vm_offset_t vendaddr; bus_addr_t paddr; - if ((map->pagesneeded == 0)) { + if (map->pagesneeded == 0) { CTR3(KTR_BUSDMA, "lowaddr= %d, boundary= %d, alignment= %d", dmat->lowaddr, dmat->boundary, dmat->alignment); CTR2(KTR_BUSDMA, "map= %p, pagesneeded= %d", From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 21:42:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CB2C8B9 for ; Fri, 13 Dec 2013 21:42:15 +0000 (UTC) Received: from mail-qa0-x231.google.com (mail-qa0-x231.google.com [IPv6:2607:f8b0:400d:c00::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5108410A9 for ; Fri, 13 Dec 2013 21:42:15 +0000 (UTC) Received: by mail-qa0-f49.google.com with SMTP id ii20so1197592qab.15 for ; Fri, 13 Dec 2013 13:42:14 -0800 (PST) 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:message-id :subject:to:cc:content-type; bh=OUiPIuGSom34TU8x3gKp0CXQNnRBruRTx/HuiW4Pv1E=; b=cW3kfgaXmujXgnIpOjOQGPQ3mi148Q6Zi7YahFlZHcZM9vi8jhR623Akmhg3HytUPG 5GYlb1Yr5C/PJBS25cPVisl5EUSpHTdR29qYlGWXFaxw+clQVG+zfOI8rdAVfvyjEpc0 KwtzdtSvFAUA5e1C8dkhukDZG3Ti98ltJtKIc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=OUiPIuGSom34TU8x3gKp0CXQNnRBruRTx/HuiW4Pv1E=; b=kQF/ydNQ/nho23Y44eyp04guwnM8dP6PdznVnrBy+4ocxEgryqKwEDhREm8eTQ/9fr 7RB8IM0Vl206bq/RK1JA/AH1xJFk6Qe6wc373bsXlNawOzyduRiD7v+tUTDXtXnUkwxO 90W4zQM+SeZ1Fsy1rGgHY1NnrBwxj+QUYShSBu2+Gp0OgXeRZbWWKwXNN51vMOJlpNjO ubR6RGic+kaXwDusCQWP6bxxvBt+CrXdS05H19cuzRZtAQVheqkMVRQRvHrCfM11B+U3 YO1vKIQzWE+ddMOztWZuNSbAy83iNzr/XRzAP9G+4RUqQsC6bLotMu2w9mSUv2sJef5N CPow== X-Gm-Message-State: ALoCoQnD1FZ7UfKKM//dCad1CN/NCaDyUDhzpyynqM0nN46LML33guq0pKvPqlCkyXk7p0G5L2s9 X-Received: by 10.229.194.1 with SMTP id dw1mr8613536qcb.20.1386970934170; Fri, 13 Dec 2013 13:42:14 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.96.86.42 with HTTP; Fri, 13 Dec 2013 13:41:44 -0800 (PST) In-Reply-To: <20131213223244.6ef4384f@kalimero.tijl.coosemans.org> References: <201312131932.rBDJW3iw088831@svn.freebsd.org> <52AB6845.7020504@FreeBSD.org> <20131213223244.6ef4384f@kalimero.tijl.coosemans.org> From: Eitan Adler Date: Fri, 13 Dec 2013 16:41:44 -0500 X-Google-Sender-Auth: FOnsdPZPfUdQSqxjHKrr8khbA0s Message-ID: Subject: Re: svn commit: r259326 - stable/10/contrib/tcpdump To: Tijl Coosemans Content-Type: text/plain; charset=UTF-8 Cc: svn-src-stable@freebsd.org, "svn-src-all@freebsd.org" , Pedro Giffuni , "src-committers@freebsd.org" , svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 21:42:15 -0000 On Fri, Dec 13, 2013 at 4:32 PM, Tijl Coosemans wrote: > On Fri, 13 Dec 2013 15:04:21 -0500 Pedro Giffuni wrote: >> On 13.12.2013 14:43, Eitan Adler wrote: >>> On Fri, Dec 13, 2013 at 2:32 PM, Pedro F. Giffuni wrote: >>>> Author: pfg >>>> Date: Fri Dec 13 19:32:02 2013 >>>> New Revision: 259326 >>>> URL: http://svnweb.freebsd.org/changeset/base/259326 >>>> >>>> Log: >>>> MFV r258571: >>>> >>>> Removes strict-aliasing warnings from newer GCC in tcpdump. >>>> >>>> Corresponds to MFC r258573, but for some reason our new pre-commit hooks >>>> will not let us merge it from there. >>> How did you attempt to do this merge? What were the exact commands? >> >> (Standing on my local stable/10 dir) >> >> svn merge -c r258573 ^/head . >> >> Attempt to commit there fired the pre-commit hook. > > This also copies the svn:mergeinfo property on head/contrib/tcpdump > to stable/10/contrib/tcpdump, but this property is only allowed on > stable/10 at the moment. I think you can just delete the property > before committing: > > svn propdel svn:mergeinfo contrib/tcpdump I think this should still be done, along with a --record-only merge. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 21:57:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2F1EC429; Fri, 13 Dec 2013 21:57:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 19A6E11AE; Fri, 13 Dec 2013 21:57:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDLvj8q040227; Fri, 13 Dec 2013 21:57:45 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDLvi61040225; Fri, 13 Dec 2013 21:57:44 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201312132157.rBDLvi61040225@svn.freebsd.org> From: Rui Paulo Date: Fri, 13 Dec 2013 21:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259341 - stable/10/sys/dev/ath X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 21:57:45 -0000 Author: rpaulo Date: Fri Dec 13 21:57:44 2013 New Revision: 259341 URL: http://svnweb.freebsd.org/changeset/base/259341 Log: MFC r256658, r256666: Move a lot of debugging printf's to DPRINTF. Modified: stable/10/sys/dev/ath/if_ath.c stable/10/sys/dev/ath/if_ath_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ath/if_ath.c ============================================================================== --- stable/10/sys/dev/ath/if_ath.c Fri Dec 13 21:50:03 2013 (r259340) +++ stable/10/sys/dev/ath/if_ath.c Fri Dec 13 21:57:44 2013 (r259341) @@ -2725,7 +2725,7 @@ ath_transmit(struct ifnet *ifp, struct m */ ATH_PCU_LOCK(sc); if (sc->sc_inreset_cnt > 0) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: sc_inreset_cnt > 0; bailing\n", __func__); ATH_PCU_UNLOCK(sc); IF_LOCK(&ifp->if_snd); @@ -6430,7 +6430,7 @@ ath_node_recv_pspoll(struct ieee80211_no * Immediately punt. */ if (! an->an_is_powersave) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_NODE_PWRSAVE, "%s: %6D: not in powersave?\n", __func__, ni->ni_macaddr, @@ -6498,7 +6498,8 @@ ath_node_recv_pspoll(struct ieee80211_no /* * XXX nothing in the TIDs at this point? Eek. */ - device_printf(sc->sc_dev, "%s: %6D: TIDs empty, but ath_node showed traffic?!\n", + DPRINTF(sc, ATH_DEBUG_NODE_PWRSAVE, + "%s: %6D: TIDs empty, but ath_node showed traffic?!\n", __func__, ni->ni_macaddr, ":"); Modified: stable/10/sys/dev/ath/if_ath_tx.c ============================================================================== --- stable/10/sys/dev/ath/if_ath_tx.c Fri Dec 13 21:50:03 2013 (r259340) +++ stable/10/sys/dev/ath/if_ath_tx.c Fri Dec 13 21:57:44 2013 (r259341) @@ -268,7 +268,7 @@ ath_txfrag_setup(struct ath_softc *sc, a /* XXX non-management? */ bf = _ath_getbuf_locked(sc, ATH_BUFTYPE_NORMAL); if (bf == NULL) { /* out of buffers, cleanup */ - device_printf(sc->sc_dev, "%s: no buffer?\n", + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: no buffer?\n", __func__); ath_txfrag_cleanup(sc, frags, ni); break; @@ -560,10 +560,10 @@ ath_tx_setds_11n(struct ath_softc *sc, s bf = bf_first; if (bf->bf_state.bfs_txrate0 == 0) - device_printf(sc->sc_dev, "%s: bf=%p, txrate0=%d\n", + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: bf=%p, txrate0=%d\n", __func__, bf, 0); if (bf->bf_state.bfs_rc[0].ratecode == 0) - device_printf(sc->sc_dev, "%s: bf=%p, rix0=%d\n", + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: bf=%p, rix0=%d\n", __func__, bf, 0); /* @@ -708,11 +708,9 @@ ath_tx_handoff_mcast(struct ath_softc *s * mapped correctly. */ if (bf->bf_state.bfs_tx_queue != sc->sc_cabq->axq_qnum) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: bf=%p, bfs_tx_queue=%d, axq_qnum=%d\n", - __func__, - bf, - bf->bf_state.bfs_tx_queue, + __func__, bf, bf->bf_state.bfs_tx_queue, txq->axq_qnum); } @@ -881,11 +879,9 @@ ath_tx_handoff_hw(struct ath_softc *sc, * checking and holding buffer manipulation is sane. */ if (bf->bf_state.bfs_tx_queue != txq->axq_qnum) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: bf=%p, bfs_tx_queue=%d, axq_qnum=%d\n", - __func__, - bf, - bf->bf_state.bfs_tx_queue, + __func__, bf, bf->bf_state.bfs_tx_queue, txq->axq_qnum); } @@ -1343,8 +1339,8 @@ ath_tx_setds(struct ath_softc *sc, struc struct ath_hal *ah = sc->sc_ah; if (bf->bf_state.bfs_txrate0 == 0) - device_printf(sc->sc_dev, "%s: bf=%p, txrate0=%d\n", - __func__, bf, 0); + DPRINTF(sc, ATH_DEBUG_XMIT, + "%s: bf=%p, txrate0=%d\n", __func__, bf, 0); ath_hal_setuptxdesc(ah, ds , bf->bf_state.bfs_pktlen /* packet length */ @@ -1481,14 +1477,10 @@ ath_tx_should_swq_frame(struct ath_softc * Other control/mgmt frame; bypass software queuing * for now! */ - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: %6D: Node is asleep; sending mgmt " "(type=%d, subtype=%d)\n", - __func__, - ni->ni_macaddr, - ":", - type, - subtype); + __func__, ni->ni_macaddr, ":", type, subtype); return (0); } else { return (1); @@ -1743,7 +1735,7 @@ ath_tx_normal_setup(struct ath_softc *sc */ #if 0 if (txq != sc->sc_ac2q[pri]) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: txq=%p (%d), pri=%d, pri txq=%p (%d)\n", __func__, txq, @@ -2145,7 +2137,7 @@ ath_tx_raw_start(struct ath_softc *sc, s /* Map ADDBA to the correct priority */ if (do_override) { #if 0 - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: overriding tid %d pri %d -> %d\n", __func__, o_tid, pri, TID_TO_WME_AC(o_tid)); #endif @@ -2356,8 +2348,8 @@ ath_raw_xmit(struct ieee80211_node *ni, ATH_PCU_LOCK(sc); if (sc->sc_inreset_cnt > 0) { - device_printf(sc->sc_dev, "%s: sc_inreset_cnt > 0; bailing\n", - __func__); + DPRINTF(sc, ATH_DEBUG_XMIT, + "%s: sc_inreset_cnt > 0; bailing\n", __func__); error = EIO; ATH_PCU_UNLOCK(sc); goto bad0; @@ -2585,16 +2577,14 @@ ath_tx_addto_baw(struct ath_softc *sc, s tap = ath_tx_get_tx_tid(an, tid->tid); if (! bf->bf_state.bfs_dobaw) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: dobaw=0, seqno=%d, window %d:%d\n", - __func__, - SEQNO(bf->bf_state.bfs_seqno), - tap->txa_start, - tap->txa_wnd); + __func__, SEQNO(bf->bf_state.bfs_seqno), + tap->txa_start, tap->txa_wnd); } if (bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: re-added? tid=%d, seqno %d; window %d:%d; " "baw head=%d tail=%d\n", __func__, tid->tid, SEQNO(bf->bf_state.bfs_seqno), @@ -2607,7 +2597,7 @@ ath_tx_addto_baw(struct ath_softc *sc, s */ if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, SEQNO(bf->bf_state.bfs_seqno))) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: bf=%p: outside of BAW?? tid=%d, seqno %d; window %d:%d; " "baw head=%d tail=%d\n", __func__, bf, tid->tid, SEQNO(bf->bf_state.bfs_seqno), @@ -2633,11 +2623,11 @@ ath_tx_addto_baw(struct ath_softc *sc, s assert(tid->tx_buf[cindex] == NULL); #endif if (tid->tx_buf[cindex] != NULL) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: ba packet dup (index=%d, cindex=%d, " "head=%d, tail=%d)\n", __func__, index, cindex, tid->baw_head, tid->baw_tail); - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: BA bf: %p; seqno=%d ; new bf: %p; seqno=%d\n", __func__, tid->tx_buf[cindex], @@ -2684,22 +2674,21 @@ ath_tx_switch_baw_buf(struct ath_softc * * soon hang. */ if (old_bf->bf_state.bfs_seqno != new_bf->bf_state.bfs_seqno) { - device_printf(sc->sc_dev, "%s: retransmitted buffer" + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, + "%s: retransmitted buffer" " has mismatching seqno's, BA session may hang.\n", __func__); - device_printf(sc->sc_dev, "%s: old seqno=%d, new_seqno=%d\n", - __func__, - old_bf->bf_state.bfs_seqno, - new_bf->bf_state.bfs_seqno); + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, + "%s: old seqno=%d, new_seqno=%d\n", __func__, + old_bf->bf_state.bfs_seqno, new_bf->bf_state.bfs_seqno); } if (tid->tx_buf[cindex] != old_bf) { - device_printf(sc->sc_dev, "%s: ath_buf pointer incorrect; " - " has m BA session may hang.\n", - __func__); - device_printf(sc->sc_dev, "%s: old bf=%p, new bf=%p\n", - __func__, - old_bf, new_bf); + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, + "%s: ath_buf pointer incorrect; " + " has m BA session may hang.\n", __func__); + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, + "%s: old bf=%p, new bf=%p\n", __func__, old_bf, new_bf); } tid->tx_buf[cindex] = new_bf; @@ -2743,10 +2732,9 @@ ath_tx_update_baw(struct ath_softc *sc, * here and causing it to fire off. Disable TDMA for now. */ if (tid->tx_buf[cindex] != bf) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: comp bf=%p, seq=%d; slot bf=%p, seqno=%d\n", - __func__, - bf, SEQNO(bf->bf_state.bfs_seqno), + __func__, bf, SEQNO(bf->bf_state.bfs_seqno), tid->tx_buf[cindex], (tid->tx_buf[cindex] != NULL) ? SEQNO(tid->tx_buf[cindex]->bf_state.bfs_seqno) : -1); @@ -2992,10 +2980,9 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s * be reset or the completion code will get upset with you. */ if (bf->bf_state.bfs_aggr != 0 || bf->bf_state.bfs_nframes > 1) { - device_printf(sc->sc_dev, "%s: bfs_aggr=%d, bfs_nframes=%d\n", - __func__, - bf->bf_state.bfs_aggr, - bf->bf_state.bfs_nframes); + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, + "%s: bfs_aggr=%d, bfs_nframes=%d\n", __func__, + bf->bf_state.bfs_aggr, bf->bf_state.bfs_nframes); bf->bf_state.bfs_aggr = 0; bf->bf_state.bfs_nframes = 1; } @@ -3273,10 +3260,9 @@ ath_tx_tid_resume(struct ath_softc *sc, * until it's actually resolved. */ if (tid->paused == 0) { - device_printf(sc->sc_dev, "%s: %6D: paused=0?\n", - __func__, - tid->an->an_node.ni_macaddr, - ":"); + DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, + "%s: %6D: paused=0?\n", __func__, + tid->an->an_node.ni_macaddr, ":"); } else { tid->paused--; } @@ -3298,7 +3284,8 @@ ath_tx_tid_resume(struct ath_softc *sc, /* XXX isfiltered shouldn't ever be 0 at this point */ if (tid->isfiltered == 1) { - device_printf(sc->sc_dev, "%s: filtered?!\n", __func__); + DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, "%s: filtered?!\n", + __func__); return; } @@ -3321,8 +3308,9 @@ ath_tx_tid_filt_addbuf(struct ath_softc ATH_TX_LOCK_ASSERT(sc); - if (! tid->isfiltered) - device_printf(sc->sc_dev, "%s: not filtered?!\n", __func__); + if (!tid->isfiltered) + DPRINTF(sc, ATH_DEBUG_SW_TX_FILT, "%s: not filtered?!\n", + __func__); DPRINTF(sc, ATH_DEBUG_SW_TX_FILT, "%s: bf=%p\n", __func__, bf); @@ -3518,8 +3506,8 @@ ath_tx_tid_bar_suspend(struct ath_softc /* We shouldn't be called when bar_tx is 1 */ if (tid->bar_tx) { - device_printf(sc->sc_dev, "%s: bar_tx is 1?!\n", - __func__); + DPRINTF(sc, ATH_DEBUG_SW_TX_BAR, + "%s: bar_tx is 1?!\n", __func__); } /* If we've already been called, just be patient. */ @@ -3551,14 +3539,10 @@ ath_tx_tid_bar_unsuspend(struct ath_soft tid->tid); if (tid->bar_tx == 0 || tid->bar_wait == 0) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAR, "%s: %6D: TID=%d, bar_tx=%d, bar_wait=%d: ?\n", - __func__, - tid->an->an_node.ni_macaddr, - ":", - tid->tid, - tid->bar_tx, - tid->bar_wait); + __func__, tid->an->an_node.ni_macaddr, ":", + tid->tid, tid->bar_tx, tid->bar_wait); } tid->bar_tx = tid->bar_wait = 0; @@ -3621,14 +3605,10 @@ ath_tx_tid_bar_tx(struct ath_softc *sc, * This is an error condition! */ if (tid->bar_wait == 0 || tid->bar_tx == 1) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAR, "%s: %6D: TID=%d, bar_tx=%d, bar_wait=%d: ?\n", - __func__, - tid->an->an_node.ni_macaddr, - ":", - tid->tid, - tid->bar_tx, - tid->bar_wait); + __func__, tid->an->an_node.ni_macaddr, ":", + tid->tid, tid->bar_tx, tid->bar_wait); return; } @@ -3679,11 +3659,9 @@ ath_tx_tid_bar_tx(struct ath_softc *sc, /* Failure? For now, warn loudly and continue */ ATH_TX_LOCK(sc); - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAR, "%s: %6D: TID=%d, failed to TX BAR, continue!\n", - __func__, - tid->an->an_node.ni_macaddr, - ":", + __func__, tid->an->an_node.ni_macaddr, ":", tid->tid); ath_tx_tid_bar_unsuspend(sc, tid); } @@ -3715,7 +3693,7 @@ ath_tx_tid_drain_pkt(struct ath_softc *s * This has become a non-fatal error now */ if (! bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); #endif @@ -3733,12 +3711,13 @@ ath_tx_tid_drain_print(struct ath_softc const char *pfx, struct ath_tid *tid, struct ath_buf *bf) { struct ieee80211_node *ni = &an->an_node; - struct ath_txq *txq = sc->sc_ac2q[tid->ac]; + struct ath_txq *txq; struct ieee80211_tx_ampdu *tap; + txq = sc->sc_ac2q[tid->ac]; tap = ath_tx_get_tx_tid(an, tid->tid); - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: %s: %6D: bf=%p: addbaw=%d, dobaw=%d, " "seqno=%d, retry=%d\n", __func__, @@ -3750,7 +3729,7 @@ ath_tx_tid_drain_print(struct ath_softc bf->bf_state.bfs_dobaw, SEQNO(bf->bf_state.bfs_seqno), bf->bf_state.bfs_retries); - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: %s: %6D: bf=%p: txq[%d] axq_depth=%d, axq_aggr_depth=%d\n", __func__, pfx, @@ -3760,8 +3739,7 @@ ath_tx_tid_drain_print(struct ath_softc txq->axq_qnum, txq->axq_depth, txq->axq_aggr_depth); - - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: %s: %6D: bf=%p: tid txq_depth=%d hwq_depth=%d, bar_wait=%d, " "isfiltered=%d\n", __func__, @@ -3773,7 +3751,7 @@ ath_tx_tid_drain_print(struct ath_softc tid->hwq_depth, tid->bar_wait, tid->isfiltered); - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: %s: %6D: tid %d: " "sched=%d, paused=%d, " "incomp=%d, baw_head=%d, " @@ -4091,7 +4069,7 @@ ath_tx_normal_comp(struct ath_softc *sc, */ if ((ts->ts_status & HAL_TXERR_FILT) || (ts->ts_status != 0 && atid->isfiltered)) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: isfiltered=%d, ts_status=%d: huh?\n", __func__, atid->isfiltered, @@ -4100,9 +4078,9 @@ ath_tx_normal_comp(struct ath_softc *sc, } #endif if (atid->isfiltered) - device_printf(sc->sc_dev, "%s: filtered?!\n", __func__); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: filtered?!\n", __func__); if (atid->hwq_depth < 0) - device_printf(sc->sc_dev, "%s: hwq_depth < 0: %d\n", + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: hwq_depth < 0: %d\n", __func__, atid->hwq_depth); /* @@ -4213,8 +4191,8 @@ ath_tx_tid_cleanup(struct ath_softc *sc, ATH_TID_REMOVE(atid, bf, bf_list); if (bf->bf_state.bfs_dobaw) { ath_tx_update_baw(sc, an, atid, bf); - if (! bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + if (!bf->bf_state.bfs_addedbaw) + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); @@ -4275,13 +4253,13 @@ ath_tx_retry_clone(struct ath_softc *sc, nbf = ath_buf_clone(sc, bf); #if 0 - device_printf(sc->sc_dev, "%s: ATH_BUF_BUSY; cloning\n", + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: ATH_BUF_BUSY; cloning\n", __func__); #endif if (nbf == NULL) { /* Failed to clone */ - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: failed to clone a busy buffer\n", __func__); return NULL; @@ -4290,7 +4268,7 @@ ath_tx_retry_clone(struct ath_softc *sc, /* Setup the dma for the new buffer */ error = ath_tx_dmasetup(sc, nbf, nbf->bf_m); if (error != 0) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: failed to setup dma for clone\n", __func__); /* @@ -4367,7 +4345,7 @@ ath_tx_aggr_retry_unaggr(struct ath_soft if (bf->bf_state.bfs_dobaw) { ath_tx_update_baw(sc, an, atid, bf); if (! bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); } @@ -4457,8 +4435,8 @@ ath_tx_retry_subframe(struct ath_softc * "%s: max retries: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); ath_tx_update_baw(sc, an, atid, bf); - if (! bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + if (!bf->bf_state.bfs_addedbaw) + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); bf->bf_state.bfs_dobaw = 0; @@ -4663,7 +4641,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * atid->hwq_depth--; if (atid->hwq_depth < 0) - device_printf(sc->sc_dev, "%s: hwq_depth < 0: %d\n", + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: hwq_depth < 0: %d\n", __func__, atid->hwq_depth); /* @@ -4681,7 +4659,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * */ if (atid->cleanup_inprogress) { if (atid->isfiltered) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: isfiltered=1, normal_comp?\n", __func__); ATH_TX_UNLOCK(sc); @@ -4699,7 +4677,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * if ((ts.ts_status & HAL_TXERR_FILT) || (ts.ts_status != 0 && atid->isfiltered)) { if (fail != 0) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: isfiltered=1, fail=%d\n", __func__, fail); ath_tx_tid_filt_comp_aggr(sc, atid, bf_first, &bf_cq); @@ -4709,8 +4687,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * drops++; if (bf->bf_state.bfs_dobaw) { ath_tx_update_baw(sc, an, atid, bf); - if (! bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + if (!bf->bf_state.bfs_addedbaw) + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); @@ -4792,7 +4770,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * #if 0 /* Occasionally, the MAC sends a tx status for the wrong TID. */ if (tid != ts.ts_tid) { - device_printf(sc->sc_dev, "%s: tid %d != hw tid %d\n", + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: tid %d != hw tid %d\n", __func__, tid, ts.ts_tid); tx_ok = 0; } @@ -4800,7 +4778,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * /* AR5416 BA bug; this requires an interface reset */ if (isaggr && tx_ok && (! hasba)) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: AR5416 bug: hasba=%d; txok=%d, isaggr=%d, " "seq_st=%d\n", __func__, hasba, tx_ok, isaggr, seq_st); @@ -4851,8 +4829,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * sc->sc_stats.ast_tx_aggr_ok++; ath_tx_update_baw(sc, an, atid, bf); bf->bf_state.bfs_dobaw = 0; - if (! bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + if (!bf->bf_state.bfs_addedbaw) + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); bf->bf_next = NULL; @@ -4881,7 +4859,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * ATH_TX_UNLOCK(sc); if (nframes != nf) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: num frames seen=%d; bf nframes=%d\n", __func__, nframes, nf); @@ -4992,7 +4970,7 @@ ath_tx_aggr_comp_unaggr(struct ath_softc ATH_TX_LOCK(sc); if (tid == IEEE80211_NONQOS_TID) - device_printf(sc->sc_dev, "%s: TID=16!\n", __func__); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: TID=16!\n", __func__); DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: tid=%d, hwq_depth=%d, seqno=%d\n", @@ -5001,7 +4979,7 @@ ath_tx_aggr_comp_unaggr(struct ath_softc atid->hwq_depth--; if (atid->hwq_depth < 0) - device_printf(sc->sc_dev, "%s: hwq_depth < 0: %d\n", + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: hwq_depth < 0: %d\n", __func__, atid->hwq_depth); /* @@ -5020,7 +4998,7 @@ ath_tx_aggr_comp_unaggr(struct ath_softc */ if (atid->cleanup_inprogress) { if (atid->isfiltered) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: isfiltered=1, normal_comp?\n", __func__); ATH_TX_UNLOCK(sc); @@ -5047,10 +5025,9 @@ ath_tx_aggr_comp_unaggr(struct ath_softc int freeframe; if (fail != 0) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: isfiltered=1, fail=%d\n", - __func__, - fail); + __func__, fail); freeframe = ath_tx_tid_filt_comp_single(sc, atid, bf); if (freeframe) { /* Remove from BAW */ @@ -5058,8 +5035,8 @@ ath_tx_aggr_comp_unaggr(struct ath_softc drops++; if (bf->bf_state.bfs_dobaw) { ath_tx_update_baw(sc, an, atid, bf); - if (! bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + if (!bf->bf_state.bfs_addedbaw) + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); } @@ -5111,8 +5088,8 @@ ath_tx_aggr_comp_unaggr(struct ath_softc if (bf->bf_state.bfs_dobaw) { ath_tx_update_baw(sc, an, atid, bf); bf->bf_state.bfs_dobaw = 0; - if (! bf->bf_state.bfs_addedbaw) - device_printf(sc->sc_dev, + if (!bf->bf_state.bfs_addedbaw) + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); } @@ -5177,8 +5154,8 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft tap = ath_tx_get_tx_tid(an, tid->tid); if (tid->tid == IEEE80211_NONQOS_TID) - device_printf(sc->sc_dev, "%s: called for TID=NONQOS_TID?\n", - __func__); + DPRINTF(sc, ATH_DEBUG_SW_TX, + "%s: called for TID=NONQOS_TID?\n", __func__); for (;;) { status = ATH_AGGR_DONE; @@ -5210,7 +5187,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft ATH_TID_REMOVE(tid, bf, bf_list); if (bf->bf_state.bfs_nframes > 1) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: aggr=%d, nframes=%d\n", __func__, bf->bf_state.bfs_aggr, @@ -5341,7 +5318,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft bf->bf_comp = ath_tx_aggr_comp; if (bf->bf_state.bfs_tid == IEEE80211_NONQOS_TID) - device_printf(sc->sc_dev, "%s: TID=16?\n", __func__); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: TID=16?\n", __func__); /* * Update leak count and frame config if were leaking frames. @@ -5399,10 +5376,10 @@ ath_tx_tid_hw_queue_norm(struct ath_soft /* Check - is AMPDU pending or running? then print out something */ if (ath_tx_ampdu_pending(sc, an, tid->tid)) - device_printf(sc->sc_dev, "%s: tid=%d, ampdu pending?\n", + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, ampdu pending?\n", __func__, tid->tid); if (ath_tx_ampdu_running(sc, an, tid->tid)) - device_printf(sc->sc_dev, "%s: tid=%d, ampdu running?\n", + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, ampdu running?\n", __func__, tid->tid); for (;;) { @@ -5426,9 +5403,9 @@ ath_tx_tid_hw_queue_norm(struct ath_soft /* Sanity check! */ if (tid->tid != bf->bf_state.bfs_tid) { - device_printf(sc->sc_dev, "%s: bfs_tid %d !=" - " tid %d\n", - __func__, bf->bf_state.bfs_tid, tid->tid); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bfs_tid %d !=" + " tid %d\n", __func__, bf->bf_state.bfs_tid, + tid->tid); } /* Normal completion handler */ bf->bf_comp = ath_tx_normal_comp; @@ -5900,7 +5877,7 @@ ath_bar_response(struct ieee80211_node * if (status == 0 || attempts == 50) { ATH_TX_LOCK(sc); if (atid->bar_tx == 0 || atid->bar_wait == 0) - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_SW_TX_BAR, "%s: huh? bar_tx=%d, bar_wait=%d\n", __func__, atid->bar_tx, atid->bar_wait); @@ -5986,11 +5963,9 @@ ath_tx_node_sleep(struct ath_softc *sc, ATH_TX_LOCK(sc); if (an->an_is_powersave) { - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: %6D: node was already asleep!\n", - __func__, - an->an_node.ni_macaddr, - ":"); + __func__, an->an_node.ni_macaddr, ":"); ATH_TX_UNLOCK(sc); return; } @@ -6026,7 +6001,7 @@ ath_tx_node_wakeup(struct ath_softc *sc, /* !? */ if (an->an_is_powersave == 0) { ATH_TX_UNLOCK(sc); - device_printf(sc->sc_dev, + DPRINTF(sc, ATH_DEBUG_XMIT, "%s: an=%p: node was already awake\n", __func__, an); return; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:00:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 602B15CC; Fri, 13 Dec 2013 22:00:26 +0000 (UTC) Received: from mailrelay012.isp.belgacom.be (mailrelay012.isp.belgacom.be [195.238.6.179]) by mx1.freebsd.org (Postfix) with ESMTP id 2BC0511CD; Fri, 13 Dec 2013 22:00:24 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmoGAKiCq1JbsVZ9/2dsb2JhbABZgwo4SbhsgSQXdIIlAQEFOhwjEAsOBgQJJQ8qHgYTiAgBCMp8F48VB4Q2BJgVgTGQZIMrOw Received: from 125.86-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.86.125]) by relay.skynet.be with ESMTP; 13 Dec 2013 22:59:15 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.7/8.14.7) with ESMTP id rBDLxEOk013851; Fri, 13 Dec 2013 22:59:14 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Fri, 13 Dec 2013 22:59:13 +0100 From: Tijl Coosemans To: Eitan Adler Subject: Re: svn commit: r259326 - stable/10/contrib/tcpdump Message-ID: <20131213225913.6a235dbe@kalimero.tijl.coosemans.org> In-Reply-To: References: <201312131932.rBDJW3iw088831@svn.freebsd.org> <52AB6845.7020504@FreeBSD.org> <20131213223244.6ef4384f@kalimero.tijl.coosemans.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, "svn-src-all@freebsd.org" , Pedro Giffuni , "src-committers@freebsd.org" , svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:00:26 -0000 On Fri, 13 Dec 2013 16:41:44 -0500 Eitan Adler wrote: > On Fri, Dec 13, 2013 at 4:32 PM, Tijl Coosemans wrote: >> On Fri, 13 Dec 2013 15:04:21 -0500 Pedro Giffuni wrote: >>> On 13.12.2013 14:43, Eitan Adler wrote: >>>> On Fri, Dec 13, 2013 at 2:32 PM, Pedro F. Giffuni wrote: >>>>> Author: pfg >>>>> Date: Fri Dec 13 19:32:02 2013 >>>>> New Revision: 259326 >>>>> URL: http://svnweb.freebsd.org/changeset/base/259326 >>>>> >>>>> Log: >>>>> MFV r258571: >>>>> >>>>> Removes strict-aliasing warnings from newer GCC in tcpdump. >>>>> >>>>> Corresponds to MFC r258573, but for some reason our new pre-commit hooks >>>>> will not let us merge it from there. >>>> How did you attempt to do this merge? What were the exact commands? >>> >>> (Standing on my local stable/10 dir) >>> >>> svn merge -c r258573 ^/head . >>> >>> Attempt to commit there fired the pre-commit hook. >> >> This also copies the svn:mergeinfo property on head/contrib/tcpdump >> to stable/10/contrib/tcpdump, but this property is only allowed on >> stable/10 at the moment. I think you can just delete the property >> before committing: >> >> svn propdel svn:mergeinfo contrib/tcpdump > > I think this should still be done, along with a --record-only merge. Yes, done in r259334. From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:08:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A05F7916; Fri, 13 Dec 2013 22:08:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8AF3D1262; Fri, 13 Dec 2013 22:08:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDM8XMG044301; Fri, 13 Dec 2013 22:08:33 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDM8WKQ044292; Fri, 13 Dec 2013 22:08:32 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132208.rBDM8WKQ044292@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259342 - in stable/10/sys/arm: at91 econa lpc ti/cpsw versatile xscale/ixp425 xscale/pxa X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:08:33 -0000 Author: ian Date: Fri Dec 13 22:08:31 2013 New Revision: 259342 URL: http://svnweb.freebsd.org/changeset/base/259342 Log: MFC r257258, r257265: Include headers (if_var.h and others) where needed. The change that triggered the need for this on head was r257244. That hasn't been MFC'd yet, but there's no harm in paving the way for it with this MFC. Modified: stable/10/sys/arm/at91/if_ate.c stable/10/sys/arm/econa/if_ece.c stable/10/sys/arm/lpc/if_lpe.c stable/10/sys/arm/ti/cpsw/if_cpsw.c stable/10/sys/arm/versatile/if_smc_fdt.c stable/10/sys/arm/xscale/ixp425/if_npe.c stable/10/sys/arm/xscale/pxa/if_smc_smi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/at91/if_ate.c ============================================================================== --- stable/10/sys/arm/at91/if_ate.c Fri Dec 13 21:57:44 2013 (r259341) +++ stable/10/sys/arm/at91/if_ate.c Fri Dec 13 22:08:31 2013 (r259342) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET #include Modified: stable/10/sys/arm/econa/if_ece.c ============================================================================== --- stable/10/sys/arm/econa/if_ece.c Fri Dec 13 21:57:44 2013 (r259341) +++ stable/10/sys/arm/econa/if_ece.c Fri Dec 13 22:08:31 2013 (r259342) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef INET Modified: stable/10/sys/arm/lpc/if_lpe.c ============================================================================== --- stable/10/sys/arm/lpc/if_lpe.c Fri Dec 13 21:57:44 2013 (r259341) +++ stable/10/sys/arm/lpc/if_lpe.c Fri Dec 13 22:08:31 2013 (r259342) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: stable/10/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- stable/10/sys/arm/ti/cpsw/if_cpsw.c Fri Dec 13 21:57:44 2013 (r259341) +++ stable/10/sys/arm/ti/cpsw/if_cpsw.c Fri Dec 13 22:08:31 2013 (r259342) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/10/sys/arm/versatile/if_smc_fdt.c ============================================================================== --- stable/10/sys/arm/versatile/if_smc_fdt.c Fri Dec 13 21:57:44 2013 (r259341) +++ stable/10/sys/arm/versatile/if_smc_fdt.c Fri Dec 13 22:08:31 2013 (r259342) @@ -28,11 +28,12 @@ __FBSDID("$FreeBSD$"); #include +#include #include -#include - #include -#include +#include +#include +#include #include #include Modified: stable/10/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- stable/10/sys/arm/xscale/ixp425/if_npe.c Fri Dec 13 21:57:44 2013 (r259341) +++ stable/10/sys/arm/xscale/ixp425/if_npe.c Fri Dec 13 22:08:31 2013 (r259342) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET #include Modified: stable/10/sys/arm/xscale/pxa/if_smc_smi.c ============================================================================== --- stable/10/sys/arm/xscale/pxa/if_smc_smi.c Fri Dec 13 21:57:44 2013 (r259341) +++ stable/10/sys/arm/xscale/pxa/if_smc_smi.c Fri Dec 13 22:08:31 2013 (r259342) @@ -28,11 +28,12 @@ __FBSDID("$FreeBSD$"); #include +#include #include -#include - #include -#include +#include +#include +#include #include #include From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:12:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B31C3B3A; Fri, 13 Dec 2013 22:12:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 929E212CD; Fri, 13 Dec 2013 22:12:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMCc9h047326; Fri, 13 Dec 2013 22:12:38 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMCbpC047319; Fri, 13 Dec 2013 22:12:37 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132212.rBDMCbpC047319@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259343 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:12:38 -0000 Author: ian Date: Fri Dec 13 22:12:37 2013 New Revision: 259343 URL: http://svnweb.freebsd.org/changeset/base/259343 Log: MFC r257383, r257384: Add some bare-bones support for enabling usb and usbphy clocks. Add a "no-op" USB PHY driver for imx-family SoCs. Added: stable/10/sys/arm/freescale/imx/imx_nop_usbphy.c - copied unchanged from r257384, head/sys/arm/freescale/imx/imx_nop_usbphy.c Modified: stable/10/sys/arm/freescale/imx/files.imx51 stable/10/sys/arm/freescale/imx/files.imx53 stable/10/sys/arm/freescale/imx/imx51_ccm.c stable/10/sys/arm/freescale/imx/imx51_ccmreg.h stable/10/sys/arm/freescale/imx/imx_machdep.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/files.imx51 ============================================================================== --- stable/10/sys/arm/freescale/imx/files.imx51 Fri Dec 13 22:08:31 2013 (r259342) +++ stable/10/sys/arm/freescale/imx/files.imx51 Fri Dec 13 22:12:37 2013 (r259343) @@ -37,7 +37,8 @@ dev/ata/chipsets/ata-fsl.c optional imx # UART driver dev/uart/uart_dev_imx.c optional uart -# USB join controller (1 OTG, 3 EHCI) +# USB OH3 controller (1 OTG, 3 EHCI) +arm/freescale/imx/imx_nop_usbphy.c optional echi dev/usb/controller/ehci_imx.c optional ehci # Watchdog Modified: stable/10/sys/arm/freescale/imx/files.imx53 ============================================================================== --- stable/10/sys/arm/freescale/imx/files.imx53 Fri Dec 13 22:08:31 2013 (r259342) +++ stable/10/sys/arm/freescale/imx/files.imx53 Fri Dec 13 22:12:37 2013 (r259343) @@ -37,7 +37,8 @@ arm/freescale/imx/imx51_ccm.c standard # i.MX5xx PATA controller dev/ata/chipsets/ata-fsl.c optional imxata -# USB join controller (1 OTG, 3 EHCI) +# USB OH3 controller (1 OTG, 3 EHCI) +arm/freescale/imx/imx_nop_usbphy.c optional ehci dev/usb/controller/ehci_imx.c optional ehci # Watchdog Modified: stable/10/sys/arm/freescale/imx/imx51_ccm.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx51_ccm.c Fri Dec 13 22:08:31 2013 (r259342) +++ stable/10/sys/arm/freescale/imx/imx51_ccm.c Fri Dec 13 22:12:37 2013 (r259343) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define IMXCCMDEBUG #undef IMXCCMDEBUG @@ -473,3 +474,78 @@ imx51_get_clk_gating(int clk_src) return ((reg >> (clk_src % CCMR_CCGR_NSOURCE) * 2) & 0x03); } +/* + * Code from here down is temporary, in lieu of a SoC-independent clock API. + */ + +void +imx_ccm_usb_enable(device_t dev) +{ + uint32_t regval; + + /* + * Select PLL2 as the source for the USB clock. + * The default is PLL3, but U-boot changes it to PLL2. + */ + regval = bus_read_4(ccm_softc->res[0], CCMC_CSCMR1); + regval &= ~CSCMR1_USBOH3_CLK_SEL_MASK; + regval |= 1 << CSCMR1_USBOH3_CLK_SEL_SHIFT; + bus_write_4(ccm_softc->res[0], CCMC_CSCMR1, regval); + + /* + * Set the USB clock pre-divider to div-by-5, post-divider to div-by-2. + */ + regval = bus_read_4(ccm_softc->res[0], CCMC_CSCDR1); + regval &= ~CSCDR1_USBOH3_CLK_PODF_MASK; + regval &= ~CSCDR1_USBOH3_CLK_PRED_MASK; + regval |= 4 << CSCDR1_USBOH3_CLK_PRED_SHIFT; + regval |= 1 << CSCDR1_USBOH3_CLK_PODF_SHIFT; + bus_write_4(ccm_softc->res[0], CCMC_CSCDR1, regval); + + /* + * The same two clocks gates are used on imx51 and imx53. + */ + imx51_clk_gating(CCGR_USBOH3_IPG_AHB_CLK, CCGR_CLK_MODE_ALWAYS); + imx51_clk_gating(CCGR_USBOH3_60M_CLK, CCGR_CLK_MODE_ALWAYS); +} + +void +imx_ccm_usbphy_enable(device_t dev) +{ + uint32_t regval; + + /* + * Select PLL3 as the source for the USBPHY clock. U-boot does this + * only for imx53, but the bit exists on imx51. That seems a bit + * strange, but we'll go with it until more is known. + */ + if (imx_soc_type() == IMXSOC_53) { + regval = bus_read_4(ccm_softc->res[0], CCMC_CSCMR1); + regval |= 1 << CSCMR1_USBPHY_CLK_SEL_SHIFT; + bus_write_4(ccm_softc->res[0], CCMC_CSCMR1, regval); + } + + /* + * For the imx51 there's just one phy gate control, enable it. + */ + if (imx_soc_type() == IMXSOC_51) { + imx51_clk_gating(CCGR_USB_PHY_CLK, CCGR_CLK_MODE_ALWAYS); + return; + } + + /* + * For imx53 we don't have a full set of clock defines yet, but the + * datasheet says: + * gate reg 4, bits 13-12 usb ph2 clock (usb_phy2_clk_enable) + * gate reg 4, bits 11-10 usb ph1 clock (usb_phy1_clk_enable) + * + * We should use the fdt data for the device to figure out which of + * the two we're working on, but for now just turn them both on. + */ + if (imx_soc_type() == IMXSOC_53) { + imx51_clk_gating(__CCGR_NUM(4, 5), CCGR_CLK_MODE_ALWAYS); + imx51_clk_gating(__CCGR_NUM(4, 6), CCGR_CLK_MODE_ALWAYS); + return; + } +} + Modified: stable/10/sys/arm/freescale/imx/imx51_ccmreg.h ============================================================================== --- stable/10/sys/arm/freescale/imx/imx51_ccmreg.h Fri Dec 13 22:08:31 2013 (r259342) +++ stable/10/sys/arm/freescale/imx/imx51_ccmreg.h Fri Dec 13 22:12:37 2013 (r259343) @@ -114,12 +114,20 @@ #define CCMC_CSCMR1 0x001c #define CSCMR1_UART_CLK_SEL_SHIFT 24 #define CSCMR1_UART_CLK_SEL_MASK 0x03000000 +#define CSCMR1_USBPHY_CLK_SEL_SHIFT 26 +#define CSCMR1_USBPHY_CLK_SEL_MASK 0x04000000 +#define CSCMR1_USBOH3_CLK_SEL_SHIFT 22 +#define CSCMR1_USBOH3_CLK_SEL_MASK 0x00c00000 #define CCMC_CSCMR2 0x0020 #define CCMC_CSCDR1 0x0024 #define CSCDR1_UART_CLK_PRED_SHIFT 3 #define CSCDR1_UART_CLK_PRED_MASK 0x00000038 #define CSCDR1_UART_CLK_PODF_SHIFT 0 #define CSCDR1_UART_CLK_PODF_MASK 0x00000007 +#define CSCDR1_USBOH3_CLK_PRED_SHIFT 8 +#define CSCDR1_USBOH3_CLK_PRED_MASK 0x00000700 +#define CSCDR1_USBOH3_CLK_PODF_SHIFT 6 +#define CSCDR1_USBOH3_CLK_PODF_MASK 0x000000c0 #define CCMC_CS1CDR 0x0028 #define CCMC_CS2CDR 0x002c #define CCMC_CDCDR 0x0030 Modified: stable/10/sys/arm/freescale/imx/imx_machdep.h ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_machdep.h Fri Dec 13 22:08:31 2013 (r259342) +++ stable/10/sys/arm/freescale/imx/imx_machdep.h Fri Dec 13 22:12:37 2013 (r259343) @@ -56,5 +56,21 @@ u_int imx_soc_family(void); void imx_devmap_init(void); +/* + * We need a clock management system that works across unrelated SoCs and + * devices. For now, to keep imx development moving, define some barebones + * functionality that can be shared within the imx family by having each SoC + * implement functions with a common name. + * + * The usb enable functions are best-effort. They turn on the usb otg, host, + * and phy clocks in a SoC-specific manner, but it may take a lot more than that + * to make usb work on a given board. In particular, it can require specific + * pinmux setup of gpio pins connected to external phy parts, voltage regulators + * and overcurrent detectors, and so on. On such boards, u-boot or other early + * board setup code has to handle those things. + */ +void imx_ccm_usb_enable(device_t _usbdev); +void imx_ccm_usbphy_enable(device_t _phydev); + #endif Copied: stable/10/sys/arm/freescale/imx/imx_nop_usbphy.c (from r257384, head/sys/arm/freescale/imx/imx_nop_usbphy.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx_nop_usbphy.c Fri Dec 13 22:12:37 2013 (r259343, copy of r257384, head/sys/arm/freescale/imx/imx_nop_usbphy.c) @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$"); + +/* + * USBPHY "no-op" driver for Freescale family of SoCs. This driver is used on + * SoCs which have usbphy hardware whose clocks need to be enabled, but no other + * action has to be taken to make the hardware work. + */ + +#include "opt_bus.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +/* + * Table of supported FDT compat strings. + */ +static struct ofw_compat_data compat_data[] = { + {"nop-usbphy", true}, + {"usb-nop-xceiv", true}, + {NULL, false}, +}; + +struct usbphy_softc { + device_t dev; + u_int phy_num; +}; + +static int +usbphy_detach(device_t dev) +{ + + return (0); +} + +static int +usbphy_attach(device_t dev) +{ + struct usbphy_softc *sc; + + sc = device_get_softc(dev); + + /* + * Turn on the phy clocks. + */ + imx_ccm_usbphy_enable(dev); + + return (0); +} + +static int +usbphy_probe(device_t dev) +{ + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "Freescale USB PHY"); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static device_method_t usbphy_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, usbphy_probe), + DEVMETHOD(device_attach, usbphy_attach), + DEVMETHOD(device_detach, usbphy_detach), + + DEVMETHOD_END +}; + +static driver_t usbphy_driver = { + "usbphy", + usbphy_methods, + sizeof(struct usbphy_softc) +}; + +static devclass_t usbphy_devclass; + +DRIVER_MODULE(usbphy, simplebus, usbphy_driver, usbphy_devclass, 0, 0); + From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:15:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7B3FD29; Fri, 13 Dec 2013 22:15:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A3BD412F2; Fri, 13 Dec 2013 22:15:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMFO6P047697; Fri, 13 Dec 2013 22:15:24 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMFOAL047696; Fri, 13 Dec 2013 22:15:24 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132215.rBDMFOAL047696@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259344 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:15:24 -0000 Author: ian Date: Fri Dec 13 22:15:24 2013 New Revision: 259344 URL: http://svnweb.freebsd.org/changeset/base/259344 Log: MFC r257390: Add a vendor entry for Freescale Semiconductor. Modified: stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Fri Dec 13 22:12:37 2013 (r259343) +++ stable/10/sys/dev/usb/usbdevs Fri Dec 13 22:15:24 2013 (r259344) @@ -654,6 +654,7 @@ vendor OWEN 0x1555 Owen vendor OQO 0x1557 OQO vendor UMEDIA 0x157e U-MEDIA Communications vendor FIBERLINE 0x1582 Fiberline +vendor FREESCALE 0x15a2 Freescale Semiconductor, Inc. vendor AFATECH 0x15a4 Afatech Technologies, Inc. vendor SPARKLAN 0x15a9 SparkLAN vendor OLIMEX 0x15ba Olimex From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:19:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32EFE43A; Fri, 13 Dec 2013 22:19:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1CDF6134C; Fri, 13 Dec 2013 22:19:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMJN3P048186; Fri, 13 Dec 2013 22:19:23 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMJLcS048180; Fri, 13 Dec 2013 22:19:21 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132219.rBDMJLcS048180@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259345 - in stable/10/sys: boot/fdt/dts dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:19:23 -0000 Author: ian Date: Fri Dec 13 22:19:21 2013 New Revision: 259345 URL: http://svnweb.freebsd.org/changeset/base/259345 Log: MFC r257393: Rework the imx ehci driver so that it's four separate ehci units rather than one unit with four busses attached to it. This allows us to use existing fdt data which describes separate devices with separate resources. It also allows any combination of the units to be en/disabled in the board dts files. Adjust our dts code to match what's used by linux and u-boot now that we're structured to do so. Modified: stable/10/sys/boot/fdt/dts/digi-ccwmx53.dts stable/10/sys/boot/fdt/dts/efikamx.dts stable/10/sys/boot/fdt/dts/imx51x.dtsi stable/10/sys/boot/fdt/dts/imx53-qsb.dts stable/10/sys/boot/fdt/dts/imx53x.dtsi stable/10/sys/dev/usb/controller/ehci_imx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/fdt/dts/digi-ccwmx53.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/digi-ccwmx53.dts Fri Dec 13 22:15:24 2013 (r259344) +++ stable/10/sys/boot/fdt/dts/digi-ccwmx53.dts Fri Dec 13 22:19:21 2013 (r259345) @@ -90,6 +90,12 @@ gpio@53f90000 { status = "okay"; }; + usb@53f80000 /* OTG */ { + status = "okay"; + }; + usb@53f80200 /* Host 1 */ { + status = "okay"; + }; wdog@53f98000 { status = "okay"; }; Modified: stable/10/sys/boot/fdt/dts/efikamx.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/efikamx.dts Fri Dec 13 22:15:24 2013 (r259344) +++ stable/10/sys/boot/fdt/dts/efikamx.dts Fri Dec 13 22:19:21 2013 (r259345) @@ -89,6 +89,12 @@ gpio@73f90000 { status = "okay"; }; + usb@73f80000 /* OTG */ { + status = "okay"; + }; + usb@73f80200 /* Host 1 */ { + status = "okay"; + }; wdog@73f98000 { status = "okay"; }; Modified: stable/10/sys/boot/fdt/dts/imx51x.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/imx51x.dtsi Fri Dec 13 22:15:24 2013 (r259344) +++ stable/10/sys/boot/fdt/dts/imx51x.dtsi Fri Dec 13 22:19:21 2013 (r259345) @@ -246,16 +246,48 @@ /* 7003C000 0x4000 SPBA */ }; - /* 73F80000 0x4000 USBOH3 */ - /* irq14 USBOH3 USB Host 1 */ - /* irq16 USBOH3 USB Host 2 */ - /* irq17 USBOH3 USB Host 3 */ - /* irq18 USBOH3 USB OTG */ - usb1: usb@73F80000 { - compatible = "fsl,usb-4core"; - reg = <0x73f80000 0x4000>; - interrupt-parent = <&tzic>; - interrupts = <18 14 16 17>; + usbphy0: usbphy@0 { + compatible = "usb-nop-xceiv"; + status = "okay"; + }; + + usbotg: usb@73f80000 { + compatible = "fsl,imx51-usb", "fsl,imx27-usb"; + reg = <0x73f80000 0x0200>; + interrupts = <18>; + fsl,usbmisc = <&usbmisc 0>; + fsl,usbphy = <&usbphy0>; + status = "disabled"; + }; + + usbh1: usb@73f80200 { + compatible = "fsl,imx51-usb", "fsl,imx27-usb"; + reg = <0x73f80200 0x0200>; + interrupts = <14>; + fsl,usbmisc = <&usbmisc 1>; + status = "disabled"; + }; + + usbh2: usb@73f80400 { + compatible = "fsl,imx51-usb", "fsl,imx27-usb"; + reg = <0x73f80400 0x0200>; + interrupts = <16>; + fsl,usbmisc = <&usbmisc 2>; + status = "disabled"; + }; + + usbh3: usb@73f80600 { + compatible = "fsl,imx51-usb", "fsl,imx27-usb"; + reg = <0x73f80600 0x0200>; + interrupts = <17>; + fsl,usbmisc = <&usbmisc 3>; + status = "disabled"; + }; + + usbmisc: usbmisc@73f80800 { + #index-cells = <1>; + compatible = "fsl,imx51-usbmisc"; + reg = <0x73f80800 0x200>; }; /* 73F98000 0x4000 WDOG1 */ Modified: stable/10/sys/boot/fdt/dts/imx53-qsb.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/imx53-qsb.dts Fri Dec 13 22:15:24 2013 (r259344) +++ stable/10/sys/boot/fdt/dts/imx53-qsb.dts Fri Dec 13 22:19:21 2013 (r259345) @@ -28,6 +28,7 @@ * SUCH DAMAGE. * * Freescale i.MX53 Quick Start Board + * In u-boot, this board is known as "MX53LOCO" for some reason. * * $FreeBSD$ */ @@ -90,6 +91,12 @@ gpio@53f90000 { status = "okay"; }; + usb@53f80000 /* OTG */ { + status = "okay"; + }; + usb@53f80200 /* Host 1 */ { + status = "okay"; + }; wdog@53f98000 { status = "okay"; }; Modified: stable/10/sys/boot/fdt/dts/imx53x.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/imx53x.dtsi Fri Dec 13 22:15:24 2013 (r259344) +++ stable/10/sys/boot/fdt/dts/imx53x.dtsi Fri Dec 13 22:19:21 2013 (r259345) @@ -290,16 +290,50 @@ /* 5003C000 0x4000 SPBA */ }; - /* 73F80000 0x4000 USBOH3 */ - /* irq14 USBOH3 USB Host 1 */ - /* irq16 USBOH3 USB Host 2 */ - /* irq17 USBOH3 USB Host 3 */ - /* irq18 USBOH3 USB OTG */ - usb1: usb@53F80000 { - compatible = "fsl,usb-4core"; - reg = <0x53f80000 0x4000>; - interrupt-parent = <&tzic>; - interrupts = <18 14 16 17>; + usbphy0: usbphy@0 { + compatible = "usb-nop-xceiv"; + status = "okay"; + }; + + usbphy1: usbphy@1 { + compatible = "usb-nop-xceiv"; + status = "okay"; + }; + + usbotg: usb@53f80000 { + compatible = "fsl,imx53-usb", "fsl,imx27-usb"; + reg = <0x53f80000 0x0200>; + interrupts = <18>; + fsl,usbphy = <&usbphy0>; + status = "disabled"; + }; + + usbh1: usb@53f80200 { + compatible = "fsl,imx53-usb", "fsl,imx27-usb"; + reg = <0x53f80200 0x0200>; + interrupts = <14>; + fsl,usbphy = <&usbphy1>; + status = "disabled"; + }; + + usbh2: usb@53f80400 { + compatible = "fsl,imx53-usb", "fsl,imx27-usb"; + reg = <0x53f80400 0x0200>; + interrupts = <16>; + status = "disabled"; + }; + + usbh3: usb@53f80600 { + compatible = "fsl,imx53-usb", "fsl,imx27-usb"; + reg = <0x53f80600 0x0200>; + interrupts = <17>; + status = "disabled"; + }; + + usbmisc: usbmisc@53f80800 { + #index-cells = <1>; + compatible = "fsl,imx53-usbmisc"; + reg = <0x53f80800 0x200>; }; /* 53F98000 0x4000 WDOG1 */ @@ -419,18 +453,6 @@ status = "disabled"; }; - - - /* 53FC4000 0x4000 USBOH3 */ - /* NOTYET - usb@53fc4000 { - compatible = "fsl,imx53-otg"; - reg = <0x53fc4000 0x4000>; - interrupt-parent = <&tzic>; - interrupts = <>; - status = "disabled"; - }; - */ /* 53FD0000 0x4000 SRC */ reset@53fd0000 { compatible = "fsl,imx53-src"; Modified: stable/10/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- stable/10/sys/dev/usb/controller/ehci_imx.c Fri Dec 13 22:15:24 2013 (r259344) +++ stable/10/sys/dev/usb/controller/ehci_imx.c Fri Dec 13 22:19:21 2013 (r259345) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2010-2012 Semihalf * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2013 Ian Lepore * All rights reserved. * * Portions of this software were developed by Oleksandr Rybalko @@ -31,7 +32,9 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_bus.h" +/* + * EHCI driver for Freescale i.MX SoCs which incorporate the USBOH3 controller. + */ #include #include @@ -52,231 +55,278 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "usbdevs.h" #include #include -#include "opt_platform.h" +#include -#define FSL_EHCI_COUNT 4 -#define FSL_EHCI_REG_OFF 0x100 -#define FSL_EHCI_REG_SIZE 0x100 -#define FSL_EHCI_REG_STEP 0x200 +#include "opt_platform.h" -struct imx_ehci_softc { - ehci_softc_t ehci[FSL_EHCI_COUNT]; - /* MEM + 4 interrupts */ - struct resource *sc_res[1 + FSL_EHCI_COUNT]; -}; +/* + * Notes on the hardware and related FDT data seen in the wild. + * + * There are two sets of registers in the USBOH3 implementation; documentation + * refers to them as "core" and "non-core" registers. A set of core register + * exists for each OTG or EHCI device. There is a single set of non-core + * registers per USBOH3, and they control aspects of operation not directly + * related to the USB specs, such as whether interrupts from each of the core + * devices are able to generate a SoC wakeup event. + * + * In the FreeBSD universe we might be inclined to describe the core and + * non-core registers by using a pair of resource address/size values (two + * entries in the reg property for each core). However, we have to work with + * existing FDT data (which mostly comes from the linux universe), and the way + * they've chosen to represent this is with an entry for a "usbmisc" device + * whose reg property describes the non-core registers. The way we handle FDT + * data, this means that the resources (memory-mapped register range) for the + * non-core registers belongs to a device other than the echi devices. + * + * At the moment we have no need to access the non-core registers, so all of + * this amounts to documenting what's known. The following compat strings have + * been seen in existing FDT data: + * - "fsl,imx25-usbmisc" + * - "fsl,imx51-usbmisc"; + * - "fsl,imx6q-usbmisc"; + * + * In addition to the single usbmisc device, the existing FDT data defines a + * separate device for each of the OTG or EHCI cores within the USBOH3. Each of + * those devices has a set of core registers described by the reg property. + * + * The core registers for each of the four cores in the USBOH3 are divided into + * two parts: a set of imx-specific registers at an offset of 0 from the + * beginning of the register range, and the standard USB (EHCI or OTG) registers + * at an offset of 0x100 from the beginning of the register range. The FreeBSD + * way of dealing with this might be to map out two ranges in the reg property, + * but that's not what the alternate universe has done. To work with existing + * FDT data, we acquire the resource that maps all the core registers, then use + * bus_space_subregion() to create another resource that maps just the standard + * USB registers, which we provide to the standard USB code in the ehci_softc. + * + * The following compat strings have been seen for the OTG and EHCI cores. The + * FDT compat table in this driver contains all these strings, but as of this + * writing, not all of these SoCs have been tested with the driver. The fact + * that imx27 is common to all of them gives some hope that the driver will work + * on all these SoCs. + * - "fsl,imx23-usb", "fsl,imx27-usb"; + * - "fsl,imx25-usb", "fsl,imx27-usb"; + * - "fsl,imx28-usb", "fsl,imx27-usb"; + * - "fsl,imx51-usb", "fsl,imx27-usb"; + * - "fsl,imx53-usb", "fsl,imx27-usb"; + * - "fsl,imx6q-usb", "fsl,imx27-usb"; + * + * The FDT data for some SoCs contains the following properties, which we don't + * currently do anything with: + * - fsl,usbmisc = <&usbmisc 0>; + * - fsl,usbphy = <&usbphy0>; + * + * Some imx SoCs have FDT data related to USB PHY, some don't. We have separate + * usbphy drivers where needed; this data is mentioned here just to keep all the + * imx-FDT-usb-related info in one place. Here are the usbphy compat strings + * known to exist: + * - "nop-usbphy" + * - "usb-nop-xceiv"; + * - "fsl,imx23-usbphy" + * - "fsl,imx28-usbphy", "fsl,imx23-usbphy"; + * - "fsl,imx6q-usbphy", "fsl,imx23-usbphy"; + * + */ -/* i.MX515 have 4 EHCI inside USB core */ -/* TODO: we can get number of EHCIs by IRQ allocation */ -static struct resource_spec imx_ehci_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { SYS_RES_IRQ, 0, RF_ACTIVE }, - { SYS_RES_IRQ, 1, RF_ACTIVE }, - { SYS_RES_IRQ, 2, RF_ACTIVE }, - /* RF_OPTIONAL will allow to use driver for systems with 3 EHCIs */ - { SYS_RES_IRQ, 3, RF_ACTIVE | RF_OPTIONAL }, - { -1, 0 } +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-usb", 1}, + {"fsl,imx53-usb", 1}, + {"fsl,imx51-usb", 1}, + {"fsl,imx28-usb", 1}, + {"fsl,imx27-usb", 1}, + {"fsl,imx25-usb", 1}, + {"fsl,imx23-usb", 1}, + {NULL, 0}, }; -/* Forward declarations */ -static int fsl_ehci_attach(device_t self); -static int fsl_ehci_detach(device_t self); -static int fsl_ehci_probe(device_t self); - -static device_method_t ehci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, fsl_ehci_probe), - DEVMETHOD(device_attach, fsl_ehci_attach), - DEVMETHOD(device_detach, fsl_ehci_detach), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - - { 0, 0 } -}; +/* + * Each EHCI device in the SoC has some SoC-specific per-device registers at an + * offset of 0, then the standard EHCI registers begin at an offset of 0x100. + */ +#define IMX_EHCI_REG_OFF 0x100 +#define IMX_EHCI_REG_SIZE 0x100 -/* kobj_class definition */ -static driver_t ehci_driver = { - "ehci", - ehci_methods, - sizeof(struct imx_ehci_softc) +struct imx_ehci_softc { + ehci_softc_t ehci_softc; + struct resource *ehci_mem_res; /* EHCI core regs. */ + struct resource *ehci_irq_res; /* EHCI core IRQ. */ }; -static devclass_t ehci_devclass; +static int +imx_ehci_probe(device_t dev) +{ -DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0); -MODULE_DEPEND(ehci, usb, 1, 1, 1); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "Freescale i.MX integrated USB controller"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +} -/* - * Public methods - */ static int -fsl_ehci_probe(device_t dev) +imx_ehci_detach(device_t dev) { + struct imx_ehci_softc *sc; + ehci_softc_t *esc; - if (ofw_bus_is_compatible(dev, "fsl,usb-4core") == 0) - return (ENXIO); + sc = device_get_softc(dev); - device_set_desc(dev, "Freescale integrated USB controller"); + esc = &sc->ehci_softc; - return (BUS_PROBE_DEFAULT); + if (esc->sc_bus.bdev != NULL) + device_delete_child(dev, esc->sc_bus.bdev); + if (esc->sc_flags & EHCI_SCFLG_DONEINIT) + ehci_detach(esc); + if (esc->sc_intr_hdl != NULL) + bus_teardown_intr(dev, esc->sc_irq_res, + esc->sc_intr_hdl); + if (sc->ehci_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 0, + sc->ehci_irq_res); + if (sc->ehci_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, + sc->ehci_mem_res); + + usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); + + /* During module unload there are lots of children leftover */ + device_delete_children(dev); + + return (0); } static int -fsl_ehci_attach(device_t self) +imx_ehci_attach(device_t dev) { struct imx_ehci_softc *sc; - bus_space_tag_t iot; ehci_softc_t *esc; - int err, i, rid; + int err, rid; + + sc = device_get_softc(dev); + esc = &sc->ehci_softc; + err = 0; - sc = device_get_softc(self); + /* Allocate bus_space resources. */ rid = 0; + sc->ehci_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->ehci_mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + err = ENXIO; + goto out; + } - /* Allocate io resource for EHCI */ - if (bus_alloc_resources(self, imx_ehci_spec, sc->sc_res)) { - device_printf(self, "could not allocate resources\n"); - return (ENXIO); + rid = 0; + sc->ehci_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->ehci_irq_res == NULL) { + device_printf(dev, "Cannot allocate IRQ resources\n"); + err = ENXIO; + goto out; } - iot = rman_get_bustag(sc->sc_res[0]); - /* TODO: Power/clock enable */ - /* TODO: basic init */ + esc->sc_io_tag = rman_get_bustag(sc->ehci_mem_res); + esc->sc_bus.parent = dev; + esc->sc_bus.devices = esc->sc_devices; + esc->sc_bus.devices_max = EHCI_MAX_DEVICES; + + if (usb_bus_mem_alloc_all(&esc->sc_bus, USB_GET_DMA_TAG(dev), + &ehci_iterate_hw_softc) != 0) { + device_printf(dev, "usb_bus_mem_alloc_all() failed\n"); + err = ENOMEM; + goto out; + } - for (i = 0; i < FSL_EHCI_COUNT; i ++) { - /* No interrupt - no driver */ - if (sc->sc_res[1 + i] == NULL) - continue; - - esc = &sc->ehci[i]; - esc->sc_io_tag = iot; - esc->sc_bus.parent = self; - esc->sc_bus.devices = esc->sc_devices; - esc->sc_bus.devices_max = EHCI_MAX_DEVICES; - - if (usb_bus_mem_alloc_all(&esc->sc_bus, USB_GET_DMA_TAG(self), - &ehci_iterate_hw_softc)) - continue; - - /* - * Set handle to USB related registers subregion used by - * generic EHCI driver. - */ - err = bus_space_subregion(iot, - rman_get_bushandle(sc->sc_res[0]), - FSL_EHCI_REG_OFF + (i * FSL_EHCI_REG_STEP), - FSL_EHCI_REG_SIZE, &esc->sc_io_hdl); - if (err != 0) - continue; - - /* Setup interrupt handler */ - err = bus_setup_intr(self, sc->sc_res[1 + i], INTR_TYPE_BIO, - NULL, (driver_intr_t *)ehci_interrupt, esc, - &esc->sc_intr_hdl); - if (err) { - device_printf(self, "Could not setup irq, " - "for EHCI%d %d\n", i, err); - continue; - } - - /* Add USB device */ - esc->sc_bus.bdev = device_add_child(self, "usbus", -1); - if (!esc->sc_bus.bdev) { - device_printf(self, "Could not add USB device\n"); - err = bus_teardown_intr(self, esc->sc_irq_res, - esc->sc_intr_hdl); - if (err) - device_printf(self, "Could not tear down irq," - " %d\n", err); - continue; - } - device_set_ivars(esc->sc_bus.bdev, &esc->sc_bus); - - esc->sc_id_vendor = 0x1234; - strlcpy(esc->sc_vendor, "Freescale", sizeof(esc->sc_vendor)); - - /* Set flags */ - esc->sc_flags |= EHCI_SCFLG_DONTRESET | EHCI_SCFLG_NORESTERM; - - err = ehci_init(esc); - if (!err) { - esc->sc_flags |= EHCI_SCFLG_DONEINIT; - err = device_probe_and_attach(esc->sc_bus.bdev); - } else { - device_printf(self, "USB init failed err=%d\n", err); - - device_delete_child(self, esc->sc_bus.bdev); - esc->sc_bus.bdev = NULL; - - err = bus_teardown_intr(self, esc->sc_irq_res, - esc->sc_intr_hdl); - if (err) - device_printf(self, "Could not tear down irq," - " %d\n", err); + /* + * Set handle to USB related registers subregion used by + * generic EHCI driver. + */ + err = bus_space_subregion(esc->sc_io_tag, + rman_get_bushandle(sc->ehci_mem_res), + IMX_EHCI_REG_OFF, IMX_EHCI_REG_SIZE, &esc->sc_io_hdl); + if (err != 0) { + device_printf(dev, "bus_space_subregion() failed\n"); + err = ENXIO; + goto out; + } - continue; - } + /* Setup interrupt handler. */ + err = bus_setup_intr(dev, sc->ehci_irq_res, INTR_TYPE_BIO, NULL, + (driver_intr_t *)ehci_interrupt, esc, &esc->sc_intr_hdl); + if (err != 0) { + device_printf(dev, "Could not setup IRQ\n"); + goto out; } - return (0); -} -static int -fsl_ehci_detach(device_t self) -{ - struct imx_ehci_softc *sc; - ehci_softc_t *esc; - int err, i; + /* Turn on clocks. */ + imx_ccm_usb_enable(dev); + + /* Add USB bus device. */ + esc->sc_bus.bdev = device_add_child(dev, "usbus", -1); + if (esc->sc_bus.bdev == NULL) { + device_printf(dev, "Could not add USB device\n"); + goto out; + } + device_set_ivars(esc->sc_bus.bdev, &esc->sc_bus); - sc = device_get_softc(self); + esc->sc_id_vendor = USB_VENDOR_FREESCALE; + strlcpy(esc->sc_vendor, "Freescale", sizeof(esc->sc_vendor)); - for (i = 0; i < FSL_EHCI_COUNT; i ++) { - esc = &sc->ehci[i]; - if (esc->sc_flags & EHCI_SCFLG_DONEINIT) - continue; - /* - * only call ehci_detach() after ehci_init() - */ - if (esc->sc_flags & EHCI_SCFLG_DONEINIT) { - ehci_detach(esc); - esc->sc_flags &= ~EHCI_SCFLG_DONEINIT; - } - - /* - * Disable interrupts that might have been switched on in - * ehci_init. - */ - if (esc->sc_io_tag && esc->sc_io_hdl) - bus_space_write_4(esc->sc_io_tag, esc->sc_io_hdl, - EHCI_USBINTR, 0); - - if (esc->sc_irq_res && esc->sc_intr_hdl) { - err = bus_teardown_intr(self, esc->sc_irq_res, - esc->sc_intr_hdl); - if (err) { - device_printf(self, "Could not tear down irq," - " %d\n", err); - return (err); - } - esc->sc_intr_hdl = NULL; - } - - if (esc->sc_bus.bdev) { - device_delete_child(self, esc->sc_bus.bdev); - esc->sc_bus.bdev = NULL; - } + /* Set flags that affect ehci_init() behavior. */ + esc->sc_flags |= EHCI_SCFLG_DONTRESET | EHCI_SCFLG_NORESTERM; + err = ehci_init(esc); + if (err != 0) { + device_printf(dev, "USB init failed, usb_err_t=%d\n", + err); + goto out; } + esc->sc_flags |= EHCI_SCFLG_DONEINIT; - /* During module unload there are lots of children leftover */ - device_delete_children(self); + /* Probe the bus. */ + err = device_probe_and_attach(esc->sc_bus.bdev); + if (err != 0) { + device_printf(dev, + "device_probe_and_attach() failed\n"); + goto out; + } - if (sc->sc_res[0]) - bus_release_resources(self, imx_ehci_spec, sc->sc_res); + err = 0; - return (0); +out: + + if (err != 0) + imx_ehci_detach(dev); + + return (err); } + +static device_method_t ehci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, imx_ehci_probe), + DEVMETHOD(device_attach, imx_ehci_attach), + DEVMETHOD(device_detach, imx_ehci_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + + DEVMETHOD_END +}; + +static driver_t ehci_driver = { + "ehci", + ehci_methods, + sizeof(struct imx_ehci_softc) +}; + +static devclass_t ehci_devclass; + +DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0); +MODULE_DEPEND(ehci, usb, 1, 1, 1); From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:21:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D109A68A; Fri, 13 Dec 2013 22:21:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A2DBC13A6; Fri, 13 Dec 2013 22:21:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDML40M050860; Fri, 13 Dec 2013 22:21:04 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDML4ji050859; Fri, 13 Dec 2013 22:21:04 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132221.rBDML4ji050859@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:21:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259346 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:21:04 -0000 Author: ian Date: Fri Dec 13 22:21:04 2013 New Revision: 259346 URL: http://svnweb.freebsd.org/changeset/base/259346 Log: MFC r257407: Expand the list of compatible devices this driver works with. Increase the target frequency from 1 to 10 MHz because these SoCs are plenty fast enough to benefit from the extra event timer resolution. Modified: stable/10/sys/arm/freescale/imx/imx_gpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_gpt.c Fri Dec 13 22:19:21 2013 (r259345) +++ stable/10/sys/arm/freescale/imx/imx_gpt.c Fri Dec 13 22:21:04 2013 (r259346) @@ -95,7 +95,7 @@ struct imx_gpt_softc *imx_gpt_sc = NULL; static const int imx_gpt_delay_count = 78; /* Try to divide down an available fast clock to this frequency. */ -#define TARGET_FREQUENCY 1000000 +#define TARGET_FREQUENCY 10000000 /* Don't try to set an event timer period smaller than this. */ #define MIN_ET_PERIOD 10LLU @@ -107,16 +107,26 @@ static struct resource_spec imx_gpt_spec { -1, 0 } }; +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-gpt", 1}, + {"fsl,imx53-gpt", 1}, + {"fsl,imx51-gpt", 1}, + {"fsl,imx31-gpt", 1}, + {"fsl,imx27-gpt", 1}, + {"fsl,imx25-gpt", 1}, + {NULL, 0} +}; + static int imx_gpt_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "fsl,imx51-gpt") && - !ofw_bus_is_compatible(dev, "fsl,imx53-gpt")) - return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "Freescale i.MX GPT timer"); + return (BUS_PROBE_DEFAULT); + } - device_set_desc(dev, "Freescale i.MX GPT timer"); - return (BUS_PROBE_DEFAULT); + return (ENXIO); } static int @@ -142,10 +152,7 @@ imx_gpt_attach(device_t dev) * we're running on. Eventually we could allow selection from the fdt; * the code in this driver will cope with any clock frequency. */ - if (ofw_bus_is_compatible(dev, "fsl,imx6-gpt")) - sc->sc_clksrc = GPT_CR_CLKSRC_24M; - else - sc->sc_clksrc = GPT_CR_CLKSRC_IPG; + sc->sc_clksrc = GPT_CR_CLKSRC_IPG; ctlreg = 0; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:21:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42A3B7DF; Fri, 13 Dec 2013 22:21:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 235EB13AD; Fri, 13 Dec 2013 22:21:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMLoZ4051041; Fri, 13 Dec 2013 22:21:50 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMLna5051040; Fri, 13 Dec 2013 22:21:49 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132221.rBDMLna5051040@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259347 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:21:50 -0000 Author: ian Date: Fri Dec 13 22:21:49 2013 New Revision: 259347 URL: http://svnweb.freebsd.org/changeset/base/259347 Log: MFC r257413: Reset the timer interrupt status register at the top rather than bottom of the interrupt handler. If the event callback starts a new short timeout, the timer can fire before returning from the event callback, and clearing the interrupt status after that loses the interrupt and hangs until the counter wraps. Fixing all of this removes the need for the do-nothing loop at the top of the handler which really just waited for the counter to roll over and reach the one-shot count again. Also add a missing return(0) in the periodic timer start case. Modified: stable/10/sys/arm/freescale/imx/imx_gpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_gpt.c Fri Dec 13 22:21:04 2013 (r259346) +++ stable/10/sys/arm/freescale/imx/imx_gpt.c Fri Dec 13 22:21:49 2013 (r259347) @@ -277,14 +277,9 @@ imx_gpt_timer_start(struct eventtimer *e WRITE4(sc, IMX_GPT_OCR2, READ4(sc, IMX_GPT_CNT) + sc->sc_period); /* Enable compare register 2 Interrupt */ SET4(sc, IMX_GPT_IR, GPT_IR_OF2); + return (0); } else if (first != 0) { ticks = ((uint32_t)et->et_frequency * first) >> 32; - - /* - * TODO: setupt second compare reg with time which will save - * us in case correct one lost, f.e. if period to short and - * setup done later than counter reach target value. - */ /* Do not disturb, otherwise event will be lost */ spinlock_enter(); /* Set expected value */ @@ -293,7 +288,6 @@ imx_gpt_timer_start(struct eventtimer *e SET4(sc, IMX_GPT_IR, GPT_IR_OF1); /* Now everybody can relax */ spinlock_exit(); - return (0); } @@ -341,27 +335,32 @@ imx_gpt_intr(void *arg) sc = (struct imx_gpt_softc *)arg; - /* Sometime we not get staus bit when interrupt arrive. Cache? */ - while (!(status = READ4(sc, IMX_GPT_SR))) - ; + status = READ4(sc, IMX_GPT_SR); + + /* + * Clear interrupt status before invoking event callbacks. The callback + * often sets up a new one-shot timer event and if the interval is short + * enough it can fire before we get out of this function. If we cleared + * at the bottom we'd miss the interrupt and hang until the clock wraps. + */ + WRITE4(sc, IMX_GPT_SR, status); + /* Handle one-shot timer events. */ if (status & GPT_IR_OF1) { if (sc->et.et_active) { sc->et.et_event_cb(&sc->et, sc->et.et_arg); } } + + /* Handle periodic timer events. */ if (status & GPT_IR_OF2) { - if (sc->et.et_active) { + if (sc->et.et_active) sc->et.et_event_cb(&sc->et, sc->et.et_arg); - /* Set expected value */ + if (sc->sc_period != 0) WRITE4(sc, IMX_GPT_OCR2, READ4(sc, IMX_GPT_CNT) + sc->sc_period); - } } - /* ACK */ - WRITE4(sc, IMX_GPT_SR, status); - return (FILTER_HANDLED); } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:22:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55ED1A04; Fri, 13 Dec 2013 22:22:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 418DD13B9; Fri, 13 Dec 2013 22:22:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMMtIV051365; Fri, 13 Dec 2013 22:22:55 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMMt7I051364; Fri, 13 Dec 2013 22:22:55 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132222.rBDMMt7I051364@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259348 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:22:55 -0000 Author: ian Date: Fri Dec 13 22:22:54 2013 New Revision: 259348 URL: http://svnweb.freebsd.org/changeset/base/259348 Log: MFC r257418: Don't iterate through the bits of the pending interrupt register if the whole register is zero. Most of the registers will be zero most of the time. Modified: stable/10/sys/arm/freescale/imx/tzic.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/tzic.c ============================================================================== --- stable/10/sys/arm/freescale/imx/tzic.c Fri Dec 13 22:21:49 2013 (r259347) +++ stable/10/sys/arm/freescale/imx/tzic.c Fri Dec 13 22:22:54 2013 (r259348) @@ -163,7 +163,7 @@ arm_get_next_irq(int last_irq) for (i = 0; i < 4; i++) { pending = tzic_read_4(TZIC_PND(i)); - for (b = 0; b < 32; b++) + for (b = 0; pending != 0 && b < 32; b++) if (pending & (1 << b)) { return (i * 32 + b); } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:24:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCA26B64; Fri, 13 Dec 2013 22:24:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C8B9E13C5; Fri, 13 Dec 2013 22:24:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMO05a051527; Fri, 13 Dec 2013 22:24:00 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMO0Tp051526; Fri, 13 Dec 2013 22:24:00 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132224.rBDMO0Tp051526@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259349 - stable/10/sys/arm/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:24:00 -0000 Author: ian Date: Fri Dec 13 22:24:00 2013 New Revision: 259349 URL: http://svnweb.freebsd.org/changeset/base/259349 Log: MFC r257419: Do not EOI an interrupt until the point after the filter handlers / before threaded handlers. Modified: stable/10/sys/arm/arm/gic.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/gic.c ============================================================================== --- stable/10/sys/arm/arm/gic.c Fri Dec 13 22:22:54 2013 (r259348) +++ stable/10/sys/arm/arm/gic.c Fri Dec 13 22:24:00 2013 (r259349) @@ -271,7 +271,6 @@ arm_get_next_irq(int last_irq) printf("Spurious interrupt detected [0x%08x]\n", active_irq); return -1; } - gic_c_write_4(GICC_EOIR, active_irq); return active_irq; } @@ -279,14 +278,15 @@ arm_get_next_irq(int last_irq) void arm_mask_irq(uintptr_t nb) { + gic_d_write_4(GICD_ICENABLER(nb >> 5), (1UL << (nb & 0x1F))); + gic_c_write_4(GICC_EOIR, nb); } void arm_unmask_irq(uintptr_t nb) { - gic_c_write_4(GICC_EOIR, nb); gic_d_write_4(GICD_ISENABLER(nb >> 5), (1UL << (nb & 0x1F))); } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:26:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D52DDF4; Fri, 13 Dec 2013 22:26:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F29D613E0; Fri, 13 Dec 2013 22:26:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMQAHL051872; Fri, 13 Dec 2013 22:26:10 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMQA0m051871; Fri, 13 Dec 2013 22:26:10 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132226.rBDMQA0m051871@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259351 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:26:11 -0000 Author: ian Date: Fri Dec 13 22:26:10 2013 New Revision: 259351 URL: http://svnweb.freebsd.org/changeset/base/259351 Log: MFC r257452: Add support for the USB PHY on imx6 SoCs. Added: stable/10/sys/arm/freescale/imx/imx6_usbphy.c - copied unchanged from r257452, head/sys/arm/freescale/imx/imx6_usbphy.c Modified: Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/arm/freescale/imx/imx6_usbphy.c (from r257452, head/sys/arm/freescale/imx/imx6_usbphy.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx6_usbphy.c Fri Dec 13 22:26:10 2013 (r259351, copy of r257452, head/sys/arm/freescale/imx/imx6_usbphy.c) @@ -0,0 +1,189 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$"); + +/* + * USBPHY driver for Freescale i.MX6 family of SoCs. + */ + +#include "opt_bus.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +/* + * Hardware register defines. + */ +#define PWD_REG 0x0000 +#define CTRL_STATUS_REG 0x0030 +#define CTRL_SET_REG 0x0034 +#define CTRL_CLR_REG 0x0038 +#define CTRL_TOGGLE_REG 0x003c +#define CTRL_SFTRST (1 << 31) +#define CTRL_CLKGATE (1 << 30) +#define CTRL_ENUTMILEVEL3 (1 << 15) +#define CTRL_ENUTMILEVEL2 (1 << 14) + +struct usbphy_softc { + device_t dev; + struct resource *mem_res; + u_int phy_num; +}; + +static int +usbphy_detach(device_t dev) +{ + struct usbphy_softc *sc; + + sc = device_get_softc(dev); + + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + + return (0); +} + +static int +usbphy_attach(device_t dev) +{ + struct usbphy_softc *sc; + int err, regoff, rid; + + sc = device_get_softc(dev); + err = 0; + + /* Allocate bus_space resources. */ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + err = ENXIO; + goto out; + } + + /* + * XXX Totally lame way to get the unit number (but not quite as lame as + * adding an ad-hoc property to the fdt data). This works as long as + * this driver is used for imx6 only. + */ + const uint32_t PWD_PHY1_REG_PHYSADDR = 0x020c9000; + if (BUS_SPACE_PHYSADDR(sc->mem_res, 0) == PWD_PHY1_REG_PHYSADDR) { + sc->phy_num = 0; + regoff = 0; + } else { + sc->phy_num = 1; + regoff = 0x60; + } + + /* + * Based on a note in the u-boot source code, disable charger detection + * to avoid degrading the differential signaling on the DP line. Note + * that this disables (by design) both charger detection and contact + * detection, because of the screwball mix of active-high and active-low + * bits in this register. + */ + imx6_anatop_write_4(IMX6_ANALOG_USB1_CHRG_DETECT + regoff, + IMX6_ANALOG_USB_CHRG_DETECT_N_ENABLE | + IMX6_ANALOG_USB_CHRG_DETECT_N_CHK_CHRG); + + imx6_anatop_write_4(IMX6_ANALOG_USB1_CHRG_DETECT + regoff, + IMX6_ANALOG_USB_CHRG_DETECT_N_ENABLE | + IMX6_ANALOG_USB_CHRG_DETECT_N_CHK_CHRG); + + /* XXX Configure the overcurrent detection here. */ + + /* + * Turn on the phy clocks. + */ + imx_ccm_usbphy_enable(dev); + + /* + * Set the software reset bit, then clear both it and the clock gate bit + * to bring the device out of reset with the clock running. + */ + bus_write_4(sc->mem_res, CTRL_SET_REG, CTRL_SFTRST); + bus_write_4(sc->mem_res, CTRL_CLR_REG, CTRL_SFTRST | CTRL_CLKGATE); + + /* Power up: clear all bits in the powerdown register. */ + bus_write_4(sc->mem_res, PWD_REG, 0); + + err = 0; + +out: + + if (err != 0) + usbphy_detach(dev); + + return (err); +} + +static int +usbphy_probe(device_t dev) +{ + + if (ofw_bus_is_compatible(dev, "fsl,imx6q-usbphy") == 0) + return (ENXIO); + + device_set_desc(dev, "Freescale i.MX6 USB PHY"); + + return (BUS_PROBE_DEFAULT); +} + +static device_method_t usbphy_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, usbphy_probe), + DEVMETHOD(device_attach, usbphy_attach), + DEVMETHOD(device_detach, usbphy_detach), + + DEVMETHOD_END +}; + +static driver_t usbphy_driver = { + "usbphy", + usbphy_methods, + sizeof(struct usbphy_softc) +}; + +static devclass_t usbphy_devclass; + +DRIVER_MODULE(usbphy, simplebus, usbphy_driver, usbphy_devclass, 0, 0); + From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:27:28 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 36D95B3; Fri, 13 Dec 2013 22:27:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 20B4F1431; Fri, 13 Dec 2013 22:27:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMRSAi052136; Fri, 13 Dec 2013 22:27:28 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMRR6t052131; Fri, 13 Dec 2013 22:27:27 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132227.rBDMRR6t052131@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259352 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:27:28 -0000 Author: ian Date: Fri Dec 13 22:27:26 2013 New Revision: 259352 URL: http://svnweb.freebsd.org/changeset/base/259352 Log: MFC r257453: Add stubbed-out imx6 support for clocks and power management. Added: stable/10/sys/arm/freescale/imx/imx6_anatop.c - copied unchanged from r257453, head/sys/arm/freescale/imx/imx6_anatop.c stable/10/sys/arm/freescale/imx/imx6_anatopreg.h - copied unchanged from r257453, head/sys/arm/freescale/imx/imx6_anatopreg.h stable/10/sys/arm/freescale/imx/imx6_anatopvar.h - copied unchanged from r257453, head/sys/arm/freescale/imx/imx6_anatopvar.h stable/10/sys/arm/freescale/imx/imx6_ccm.c - copied unchanged from r257453, head/sys/arm/freescale/imx/imx6_ccm.c stable/10/sys/arm/freescale/imx/imx6_ccmreg.h - copied unchanged from r257453, head/sys/arm/freescale/imx/imx6_ccmreg.h Modified: Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/arm/freescale/imx/imx6_anatop.c (from r257453, head/sys/arm/freescale/imx/imx6_anatop.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx6_anatop.c Fri Dec 13 22:27:26 2013 (r259352, copy of r257453, head/sys/arm/freescale/imx/imx6_anatop.c) @@ -0,0 +1,155 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$"); + +/* + * Analog PLL and power regulator driver for Freescale i.MX6 family of SoCs. + * + * We don't really do anything with analog PLLs, but the registers for + * controlling them belong to the same block as the power regulator registers. + * Since the newbus hierarchy makes it hard for anyone other than us to get at + * them, we just export a couple public functions to allow the imx6 CCM clock + * driver to read and write those registers. + * + * We also don't do anything about power regulation yet, but when the need + * arises, this would be the place for that code to live. + * + * I have no idea where the "anatop" name comes from. It's in the standard DTS + * source describing i.MX6 SoCs, and in the linux and u-boot code which comes + * from Freescale, but it's not in the SoC manual. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +struct imx6_anatop_softc { + device_t dev; + struct resource *mem_res; +}; + +static struct imx6_anatop_softc *imx6_anatop_sc; + +uint32_t +imx6_anatop_read_4(bus_size_t offset) +{ + + return (bus_read_4(imx6_anatop_sc->mem_res, offset)); +} + +void +imx6_anatop_write_4(bus_size_t offset, uint32_t value) +{ + + bus_write_4(imx6_anatop_sc->mem_res, offset, value); +} + +static int +imx6_anatop_detach(device_t dev) +{ + struct imx6_anatop_softc *sc; + + sc = device_get_softc(dev); + + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + + return (0); +} + +static int +imx6_anatop_attach(device_t dev) +{ + struct imx6_anatop_softc *sc; + int err, rid; + + sc = device_get_softc(dev); + + /* Allocate bus_space resources. */ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + err = ENXIO; + goto out; + } + + imx6_anatop_sc = sc; + err = 0; + +out: + + if (err != 0) + imx6_anatop_detach(dev); + + return (err); +} + +static int +imx6_anatop_probe(device_t dev) +{ + + if (ofw_bus_is_compatible(dev, "fsl,imx6q-anatop") == 0) + return (ENXIO); + + device_set_desc(dev, "Freescale i.MX6 Analog PLLs and Power"); + + return (BUS_PROBE_DEFAULT); +} + +static device_method_t imx6_anatop_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, imx6_anatop_probe), + DEVMETHOD(device_attach, imx6_anatop_attach), + DEVMETHOD(device_detach, imx6_anatop_detach), + + DEVMETHOD_END +}; + +static driver_t imx6_anatop_driver = { + "imx6_anatop", + imx6_anatop_methods, + sizeof(struct imx6_anatop_softc) +}; + +static devclass_t imx6_anatop_devclass; + +DRIVER_MODULE(imx6_anatop, simplebus, imx6_anatop_driver, imx6_anatop_devclass, 0, 0); + Copied: stable/10/sys/arm/freescale/imx/imx6_anatopreg.h (from r257453, head/sys/arm/freescale/imx/imx6_anatopreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx6_anatopreg.h Fri Dec 13 22:27:26 2013 (r259352, copy of r257453, head/sys/arm/freescale/imx/imx6_anatopreg.h) @@ -0,0 +1,128 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$ + */ + +#ifndef IMX6_ANATOPREG_H +#define IMX6_ANATOPREG_H + +#define IMX6_ANALOG_CCM_PLL_ARM 0x000 +#define IMX6_ANALOG_CCM_PLL_ARM_SET 0x004 +#define IMX6_ANALOG_CCM_PLL_ARM_CLR 0x008 +#define IMX6_ANALOG_CCM_PLL_ARM_TOG 0x00C +#define IMX6_ANALOG_CCM_PLL_USB1 0x010 +#define IMX6_ANALOG_CCM_PLL_USB1_SET 0x014 +#define IMX6_ANALOG_CCM_PLL_USB1_CLR 0x018 +#define IMX6_ANALOG_CCM_PLL_USB1_TOG 0x01C +#define IMX6_ANALOG_CCM_PLL_USB_LOCK (1 << 31) +#define IMX6_ANALOG_CCM_PLL_USB_BYPASS (1 << 16) +#define IMX6_ANALOG_CCM_PLL_USB_ENABLE (1 << 13) +#define IMX6_ANALOG_CCM_PLL_USB_POWER (1 << 12) +#define IMX6_ANALOG_CCM_PLL_USB_EN_USB_CLKS (1 << 6) +#define IMX6_ANALOG_CCM_PLL_USB2 0x020 +#define IMX6_ANALOG_CCM_PLL_USB2_SET 0x024 +#define IMX6_ANALOG_CCM_PLL_USB2_CLR 0x028 +#define IMX6_ANALOG_CCM_PLL_USB2_TOG 0x02C +#define IMX6_ANALOG_CCM_PLL_SYS 0x030 +#define IMX6_ANALOG_CCM_PLL_SYS_SET 0x034 +#define IMX6_ANALOG_CCM_PLL_SYS_CLR 0x038 +#define IMX6_ANALOG_CCM_PLL_SYS_TOG 0x03C +#define IMX6_ANALOG_CCM_PLL_SYS_SS 0x040 +#define IMX6_ANALOG_CCM_PLL_SYS_NUM 0x050 +#define IMX6_ANALOG_CCM_PLL_SYS_DENOM 0x060 +#define IMX6_ANALOG_CCM_PLL_AUDIO 0x070 +#define IMX6_ANALOG_CCM_PLL_AUDIO_SET 0x074 +#define IMX6_ANALOG_CCM_PLL_AUDIO_CLR 0x078 +#define IMX6_ANALOG_CCM_PLL_AUDIO_TOG 0x07C +#define IMX6_ANALOG_CCM_PLL_AUDIO_NUM 0x080 +#define IMX6_ANALOG_CCM_PLL_AUDIO_DENOM 0x090 +#define IMX6_ANALOG_CCM_PLL_VIDEO 0x0A0 +#define IMX6_ANALOG_CCM_PLL_VIDEO_SET 0x0A4 +#define IMX6_ANALOG_CCM_PLL_VIDEO_CLR 0x0A8 +#define IMX6_ANALOG_CCM_PLL_VIDEO_TOG 0x0AC +#define IMX6_ANALOG_CCM_PLL_VIDEO_NUM 0x0B0 +#define IMX6_ANALOG_CCM_PLL_VIDEO_DENOM 0x0C0 +#define IMX6_ANALOG_CCM_PLL_MLB 0x0D0 +#define IMX6_ANALOG_CCM_PLL_MLB_SET 0x0D4 +#define IMX6_ANALOG_CCM_PLL_MLB_CLR 0x0D8 +#define IMX6_ANALOG_CCM_PLL_MLB_TOG 0x0DC +#define IMX6_ANALOG_CCM_PLL_ENET 0x0E0 +#define IMX6_ANALOG_CCM_PLL_ENET_SET 0x0E4 +#define IMX6_ANALOG_CCM_PLL_ENET_CLR 0x0E8 +#define IMX6_ANALOG_CCM_PLL_ENET_TOG 0x0EC +#define IMX6_ANALOG_CCM_PFD_480 0x0F0 +#define IMX6_ANALOG_CCM_PFD_480_SET 0x0F4 +#define IMX6_ANALOG_CCM_PFD_480_CLR 0x0F8 +#define IMX6_ANALOG_CCM_PFD_480_TOG 0x0FC +#define IMX6_ANALOG_CCM_PFD_528 0x100 +#define IMX6_ANALOG_CCM_PFD_528_SET 0x104 +#define IMX6_ANALOG_CCM_PFD_528_CLR 0x108 +#define IMX6_ANALOG_CCM_PFD_528_TOG 0x10C +#define IMX6_ANALOG_CCM_MISC0 0x150 +#define IMX6_ANALOG_CCM_MISC0_SET 0x154 +#define IMX6_ANALOG_CCM_MISC0_CLR 0x158 +#define IMX6_ANALOG_CCM_MISC0_TOG 0x15C +#define IMX6_ANALOG_CCM_MISC2 0x170 +#define IMX6_ANALOG_CCM_MISC2_SET 0x174 +#define IMX6_ANALOG_CCM_MISC2_CLR 0x178 +#define IMX6_ANALOG_CCM_MISC2_TOG 0x17C + +#define IMX6_ANALOG_USB1_VBUS_DETECT 0x1A0 +#define IMX6_ANALOG_USB1_VBUS_DETECT_SET 0x1A4 +#define IMX6_ANALOG_USB1_VBUS_DETECT_CLR 0x1A8 +#define IMX6_ANALOG_USB1_VBUS_DETECT_TOG 0x1AC +#define IMX6_ANALOG_USB1_CHRG_DETECT 0x1B0 +#define IMX6_ANALOG_USB1_CHRG_DETECT_SET 0x1B4 +#define IMX6_ANALOG_USB1_CHRG_DETECT_CLR 0x1B8 +#define IMX6_ANALOG_USB1_CHRG_DETECT_TOG 0x1BC +#define IMX6_ANALOG_USB_CHRG_DETECT_N_ENABLE (1 << 20) /* EN_B */ +#define IMX6_ANALOG_USB_CHRG_DETECT_N_CHK_CHRG (1 << 19) /* CHK_CHRG_B */ +#define IMX6_ANALOG_USB_CHRG_DETECT_CHK_CONTACT (1 << 18) +#define IMX6_ANALOG_USB1_VBUS_DETECT_STAT 0x1C0 +#define IMX6_ANALOG_USB1_CHRG_DETECT_STAT 0x1D0 +#define IMX6_ANALOG_USB1_MISC 0x1F0 +#define IMX6_ANALOG_USB1_MISC_SET 0x1F4 +#define IMX6_ANALOG_USB1_MISC_CLR 0x1F8 +#define IMX6_ANALOG_USB1_MISC_TOG 0x1FC +#define IMX6_ANALOG_USB2_VBUS_DETECT 0x200 +#define IMX6_ANALOG_USB2_VBUS_DETECT_SET 0x204 +#define IMX6_ANALOG_USB2_VBUS_DETECT_CLR 0x208 +#define IMX6_ANALOG_USB2_VBUS_DETECT_TOG 0x20C +#define IMX6_ANALOG_USB2_CHRG_DETECT 0x210 +#define IMX6_ANALOG_USB2_CHRG_DETECT_SET 0x214 +#define IMX6_ANALOG_USB2_CHRG_DETECT_CLR 0x218 +#define IMX6_ANALOG_USB2_CHRG_DETECT_TOG 0x21C +#define IMX6_ANALOG_USB2_VBUS_DETECT_STAT 0x220 +#define IMX6_ANALOG_USB2_CHRG_DETECT_STAT 0x230 +#define IMX6_ANALOG_USB2_MISC 0x250 +#define IMX6_ANALOG_USB2_MISC_SET 0x254 +#define IMX6_ANALOG_USB2_MISC_CLR 0x258 +#define IMX6_ANALOG_USB2_MISC_TOG 0x25C +#define IMX6_ANALOG_DIGPROG 0x260 + + + +#endif Copied: stable/10/sys/arm/freescale/imx/imx6_anatopvar.h (from r257453, head/sys/arm/freescale/imx/imx6_anatopvar.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx6_anatopvar.h Fri Dec 13 22:27:26 2013 (r259352, copy of r257453, head/sys/arm/freescale/imx/imx6_anatopvar.h) @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$ + */ + +#ifndef IMX6_ANATOPVAR_H +#define IMX6_ANATOPVAR_H + +/* + * All registers controlling various analog aspects of the SoC (such as PLLs or + * voltage regulators or USB VBUS detection) are gathered together under the + * anatop device (because of newbus hierarchical resource management), but other + * drivers such as CMM or USBPHY need access to these registers. These + * functions let them have at the hardware directly. No effort is made by these + * functions to mediate concurrent access. + */ +uint32_t imx6_anatop_read_4(bus_size_t _offset); +void imx6_anatop_write_4(bus_size_t _offset, uint32_t _value); + +#endif Copied: stable/10/sys/arm/freescale/imx/imx6_ccm.c (from r257453, head/sys/arm/freescale/imx/imx6_ccm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx6_ccm.c Fri Dec 13 22:27:26 2013 (r259352, copy of r257453, head/sys/arm/freescale/imx/imx6_ccm.c) @@ -0,0 +1,225 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$"); + +/* + * Clocks and power control driver for Freescale i.MX6 family of SoCs. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + + +/* XXX temp kludge for imx51_get_clock. */ +#include +#include + +struct ccm_softc { + device_t dev; + struct resource *mem_res; +}; + +static struct ccm_softc *ccm_sc; + +static inline uint32_t +RD4(struct ccm_softc *sc, bus_size_t off) +{ + + return (bus_read_4(sc->mem_res, off)); +} + +static inline void +WR4(struct ccm_softc *sc, bus_size_t off, uint32_t val) +{ + + bus_write_4(sc->mem_res, off, val); +} + +static int +ccm_detach(device_t dev) +{ + struct ccm_softc *sc; + + sc = device_get_softc(dev); + + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + + return (0); +} + +static int +ccm_attach(device_t dev) +{ + struct ccm_softc *sc; + int err, rid; + + sc = device_get_softc(dev); + err = 0; + + /* Allocate bus_space resources. */ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + err = ENXIO; + goto out; + } + + ccm_sc = sc; + err = 0; + +out: + + if (err != 0) + ccm_detach(dev); + + return (err); +} + +static int +ccm_probe(device_t dev) +{ + + if (ofw_bus_is_compatible(dev, "fsl,imx6q-ccm") == 0) + return (ENXIO); + + device_set_desc(dev, "Freescale i.MX6 Clock Control Module"); + + return (BUS_PROBE_DEFAULT); +} + +void +imx_ccm_usb_enable(device_t _usbdev) +{ + + /* + * For imx6, the USBOH3 clock gate is bits 0-1 of CCGR6, so no need for + * shifting and masking here, just set the low-order two bits to ALWAYS. + */ + WR4(ccm_sc, CCM_CCGR6, RD4(ccm_sc, CCM_CCGR6) | CCGR_CLK_MODE_ALWAYS); +} + +void +imx_ccm_usbphy_enable(device_t _phydev) +{ + /* + * XXX Which unit? + * Right now it's not clear how to figure from fdt data which phy unit + * we're supposed to operate on. Until this is worked out, just enable + * both PHYs. + */ +#if 0 + int phy_num, regoff; + + phy_num = 0; /* XXX */ + + switch (phy_num) { + case 0: + regoff = 0; + break; + case 1: + regoff = 0x10; + break; + default: + device_printf(ccm_sc->dev, "Bad PHY number %u,\n", + phy_num); + return; + } + + imx6_anatop_write_4(IMX6_ANALOG_CCM_PLL_USB1 + regoff, + IMX6_ANALOG_CCM_PLL_USB_ENABLE | + IMX6_ANALOG_CCM_PLL_USB_POWER | + IMX6_ANALOG_CCM_PLL_USB_EN_USB_CLKS); +#else + imx6_anatop_write_4(IMX6_ANALOG_CCM_PLL_USB1 + 0, + IMX6_ANALOG_CCM_PLL_USB_ENABLE | + IMX6_ANALOG_CCM_PLL_USB_POWER | + IMX6_ANALOG_CCM_PLL_USB_EN_USB_CLKS); + + imx6_anatop_write_4(IMX6_ANALOG_CCM_PLL_USB1 + 0x10, + IMX6_ANALOG_CCM_PLL_USB_ENABLE | + IMX6_ANALOG_CCM_PLL_USB_POWER | + IMX6_ANALOG_CCM_PLL_USB_EN_USB_CLKS); +#endif +} + + + + + +// XXX Fix this. This has to be here for other code to link, +// but it doesn't have to return anything useful for imx6 right now. +u_int +imx51_get_clock(enum imx51_clock clk) +{ + switch (clk) + { + case IMX51CLK_IPG_CLK_ROOT: + return 66000000; + default: + printf("imx51_get_clock() on imx6 doesn't know about clock %d\n", clk); + break; + } + return 0; +} + +static device_method_t ccm_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ccm_probe), + DEVMETHOD(device_attach, ccm_attach), + DEVMETHOD(device_detach, ccm_detach), + + DEVMETHOD_END +}; + +static driver_t ccm_driver = { + "ccm", + ccm_methods, + sizeof(struct ccm_softc) +}; + +static devclass_t ccm_devclass; + +DRIVER_MODULE(ccm, simplebus, ccm_driver, ccm_devclass, 0, 0); + Copied: stable/10/sys/arm/freescale/imx/imx6_ccmreg.h (from r257453, head/sys/arm/freescale/imx/imx6_ccmreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx6_ccmreg.h Fri Dec 13 22:27:26 2013 (r259352, copy of r257453, head/sys/arm/freescale/imx/imx6_ccmreg.h) @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$ + */ + +#ifndef IMX6_CCMREG_H +#define IMX6_CCMREG_H + +#define CCM_CCGR1 0x06C +#define CCM_CCGR2 0x070 +#define CCM_CCGR3 0x074 +#define CCM_CCGR4 0x078 +#define CCM_CCGR5 0x07C +#define CCM_CCGR6 0x080 +#define CCM_CMEOR 0x088 + + +#endif From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:28:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D508264; Fri, 13 Dec 2013 22:28:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 67A9D1457; Fri, 13 Dec 2013 22:28:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMSJI0052275; Fri, 13 Dec 2013 22:28:19 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMSJqf052274; Fri, 13 Dec 2013 22:28:19 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132228.rBDMSJqf052274@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:28:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259353 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:28:19 -0000 Author: ian Date: Fri Dec 13 22:28:19 2013 New Revision: 259353 URL: http://svnweb.freebsd.org/changeset/base/259353 Log: MFC r257454: Add sdhci driver glue for imx family SoCs. Added: stable/10/sys/arm/freescale/imx/imx_sdhci.c - copied unchanged from r257454, head/sys/arm/freescale/imx/imx_sdhci.c Modified: Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/arm/freescale/imx/imx_sdhci.c (from r257454, head/sys/arm/freescale/imx/imx_sdhci.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx_sdhci.c Fri Dec 13 22:28:19 2013 (r259353, copy of r257454, head/sys/arm/freescale/imx/imx_sdhci.c) @@ -0,0 +1,704 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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$"); + +/* + * SDHCI driver glue for Freescale i.MX SoC family. + * + * This supports both eSDHC (earlier SoCs) and uSDHC (more recent SoCs). + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include +#include "sdhci_if.h" + +struct imx_sdhci_softc { + device_t dev; + struct resource * mem_res; + struct resource * irq_res; + void * intr_cookie; + struct sdhci_slot slot; + uint32_t baseclk_hz; + uint32_t sdclockreg_freq_bits; + uint32_t cmd_and_mode; + uint32_t r1bfix_intmask; + uint8_t r1bfix_type; + uint8_t hwtype; +}; + +#define R1BFIX_NONE 0 /* No fix needed at next interrupt. */ +#define R1BFIX_NODATA 1 /* Synthesize DATA_END for R1B w/o data. */ +#define R1BFIX_AC12 2 /* Wait for busy after auto command 12. */ + +#define HWTYPE_NONE 0 /* Hardware not recognized/supported. */ +#define HWTYPE_ESDHC 1 /* imx5x and earlier. */ +#define HWTYPE_USDHC 2 /* imx6. */ + +#define SDHC_WTMK_LVL 0x44 /* Watermark Level register. */ +#define USDHC_MIX_CONTROL 0x48 /* Mix(ed) Control register. */ +#define SDHC_VEND_SPEC 0xC0 /* Vendor-specific register. */ +#define SDHC_VEND_FRC_SDCLK_ON (1 << 8) +#define SDHC_VEND_IPGEN (1 << 11) +#define SDHC_VEND_HCKEN (1 << 12) +#define SDHC_VEND_PEREN (1 << 13) + +#define SDHC_PROT_CTRL 0x28 +#define SDHC_PROT_LED (1 << 0) +#define SDHC_PROT_WIDTH_1BIT (0 << 1) +#define SDHC_PROT_WIDTH_4BIT (1 << 1) +#define SDHC_PROT_WIDTH_8BIT (2 << 1) +#define SDHC_PROT_WIDTH_MASK (3 << 1) +#define SDHC_PROT_D3CD (1 << 3) +#define SDHC_PROT_EMODE_BIG (0 << 4) +#define SDHC_PROT_EMODE_HALF (1 << 4) +#define SDHC_PROT_EMODE_LITTLE (2 << 4) +#define SDHC_PROT_EMODE_MASK (3 << 4) +#define SDHC_PROT_SDMA (0 << 8) +#define SDHC_PROT_ADMA1 (1 << 8) +#define SDHC_PROT_ADMA2 (2 << 8) +#define SDHC_PROT_ADMA264 (3 << 8) +#define SDHC_PROT_DMA_MASK (3 << 8) +#define SDHC_PROT_CDTL (1 << 6) +#define SDHC_PROT_CDSS (1 << 7) + +#define SDHC_CLK_IPGEN (1 << 0) +#define SDHC_CLK_HCKEN (1 << 1) +#define SDHC_CLK_PEREN (1 << 2) +#define SDHC_CLK_DIVISOR_MASK 0x000000f0 +#define SDHC_CLK_DIVISOR_SHIFT 4 +#define SDHC_CLK_PRESCALE_MASK 0x0000ff00 +#define SDHC_CLK_PRESCALE_SHIFT 8 + +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-usdhc", HWTYPE_USDHC}, + {"fsl,imx6sl-usdhc", HWTYPE_USDHC}, + {"fsl,imx53-esdhc", HWTYPE_ESDHC}, + {"fsl,imx51-esdhc", HWTYPE_ESDHC}, + {NULL, HWTYPE_NONE}, +};; + +static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, int enable); + +static inline uint32_t +RD4(struct imx_sdhci_softc *sc, bus_size_t off) +{ + + return (bus_read_4(sc->mem_res, off)); +} + +static inline void +WR4(struct imx_sdhci_softc *sc, bus_size_t off, uint32_t val) +{ + + bus_write_4(sc->mem_res, off, val); +} + +static uint8_t +imx_sdhci_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + uint32_t val32, wrk32; + + /* + * Most of the things in the standard host control register are in the + * hardware's wider protocol control register, but some of the bits are + * moved around. + */ + if (off == SDHCI_HOST_CONTROL) { + wrk32 = RD4(sc, SDHC_PROT_CTRL); + val32 = wrk32 & (SDHCI_CTRL_LED | SDHCI_CTRL_CARD_DET | + SDHCI_CTRL_FORCE_CARD); + switch (wrk32 & SDHC_PROT_WIDTH_MASK) { + case SDHC_PROT_WIDTH_1BIT: + /* Value is already 0. */ + break; + case SDHC_PROT_WIDTH_4BIT: + val32 |= SDHCI_CTRL_4BITBUS; + break; + case SDHC_PROT_WIDTH_8BIT: + val32 |= SDHCI_CTRL_8BITBUS; + break; + } + switch (wrk32 & SDHC_PROT_DMA_MASK) { + case SDHC_PROT_SDMA: + /* Value is already 0. */ + break; + case SDHC_PROT_ADMA1: + /* This value is deprecated, should never appear. */ + break; + case SDHC_PROT_ADMA2: + val32 |= SDHCI_CTRL_ADMA2; + break; + case SDHC_PROT_ADMA264: + val32 |= SDHCI_CTRL_ADMA264; + break; + } + return val32; + } + + /* + * XXX can't find the bus power on/off knob. For now we have to say the + * power is always on and always set to the same voltage. + */ + if (off == SDHCI_POWER_CONTROL) { + return (SDHCI_POWER_ON | SDHCI_POWER_300); + } + + + return ((RD4(sc, off & ~3) >> (off & 3) * 8) & 0xff); +} + +static uint16_t +imx_sdhci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + uint32_t val32, wrk32; + + if (sc->hwtype == HWTYPE_USDHC) { + /* + * The USDHC hardware has nothing in the version register, but + * it's v3 compatible with all our translation code. + */ + if (off == SDHCI_HOST_VERSION) { + return (SDHCI_SPEC_300 << SDHCI_SPEC_VER_SHIFT); + } + /* + * The USDHC hardware moved the transfer mode bits to the mixed + * control register, fetch them from there. + */ + if (off == SDHCI_TRANSFER_MODE) + return (RD4(sc, USDHC_MIX_CONTROL) & 0x37); + + } else if (sc->hwtype == HWTYPE_ESDHC) { + + /* + * The ESDHC hardware has the typical 32-bit combined "command + * and mode" register that we have to cache so that command + * isn't written until after mode. On a read, just retrieve the + * cached values last written. + */ + if (off == SDHCI_TRANSFER_MODE) { + return (sc->cmd_and_mode >> 16); + } else if (off == SDHCI_COMMAND_FLAGS) { + return (sc->cmd_and_mode & 0x0000ffff); + } + } + + /* + * This hardware only manages one slot. Synthesize a slot interrupt + * status register... if there are any enabled interrupts active they + * must be coming from our one and only slot. + */ + if (off == SDHCI_SLOT_INT_STATUS) { + val32 = RD4(sc, SDHCI_INT_STATUS); + val32 &= RD4(sc, SDHCI_SIGNAL_ENABLE); + return (val32 ? 1 : 0); + } + + /* + * The clock enable bit is in the vendor register and the clock-stable + * bit is in the present state register. Transcribe them as if they + * were in the clock control register where they should be. + * XXX Is it important that we distinguish between "internal" and "card" + * clocks? Probably not; transcribe the card clock status to both bits. + */ + if (off == SDHCI_CLOCK_CONTROL) { + val32 = 0; + wrk32 = RD4(sc, SDHC_VEND_SPEC); + if (wrk32 & SDHC_VEND_FRC_SDCLK_ON) + val32 |= SDHCI_CLOCK_INT_EN | SDHCI_CLOCK_CARD_EN; + wrk32 = RD4(sc, SDHCI_PRESENT_STATE); + if (wrk32 & 0x08) + val32 |= SDHCI_CLOCK_INT_STABLE; + val32 |= sc->sdclockreg_freq_bits; + return (val32); + } + + return ((RD4(sc, off & ~3) >> (off & 3) * 8) & 0xffff); +} + +static uint32_t +imx_sdhci_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + uint32_t val32; + + /* + * The hardware leaves the base clock frequency out of the capabilities + * register; fill it in. The timeout clock is the same as the active + * output sdclock; we indicate that with a quirk setting so don't + * populate the timeout frequency bits. + * + * XXX Turn off (for now) features the hardware can do but this driver + * doesn't yet handle (1.8v, suspend/resume, etc). + */ + if (off == SDHCI_CAPABILITIES) { + val32 = RD4(sc, off); + val32 &= ~SDHCI_CAN_VDD_180; + val32 &= ~SDHCI_CAN_DO_SUSPEND; + val32 |= SDHCI_CAN_DO_8BITBUS; + val32 |= (sc->baseclk_hz / 1000000) << SDHCI_CLOCK_BASE_SHIFT; + return (val32); + } + + val32 = RD4(sc, off); + + /* + * imx_sdhci_intr() can synthesize a DATA_END interrupt following a + * command with an R1B response, mix it into the hardware status. + */ + if (off == SDHCI_INT_STATUS) { + val32 |= sc->r1bfix_intmask; + } + + return val32; +} + +static void +imx_sdhci_read_multi_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t *data, bus_size_t count) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + + bus_read_multi_4(sc->mem_res, off, data, count); +} + +static void +imx_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + uint32_t val32; + + /* + * Most of the things in the standard host control register are in the + * hardware's wider protocol control register, but some of the bits are + * moved around. + */ + if (off == SDHCI_HOST_CONTROL) { + val32 = RD4(sc, SDHC_PROT_CTRL); + val32 &= ~(SDHC_PROT_LED | SDHC_PROT_DMA_MASK | + SDHC_PROT_WIDTH_MASK | SDHC_PROT_CDTL | SDHC_PROT_CDSS); + val32 |= (val & SDHCI_CTRL_LED); + if (val & SDHCI_CTRL_8BITBUS) + val32 |= SDHC_PROT_WIDTH_8BIT; + else + val32 |= (val & SDHCI_CTRL_4BITBUS); + val32 |= (val & (SDHCI_CTRL_SDMA | SDHCI_CTRL_ADMA2)) << 4; + val32 |= (val & (SDHCI_CTRL_CARD_DET | SDHCI_CTRL_FORCE_CARD)); + WR4(sc, SDHC_PROT_CTRL, val32); + return; + } + + /* XXX I can't find the bus power on/off knob; do nothing. */ + if (off == SDHCI_POWER_CONTROL) { + return; + } + + val32 = RD4(sc, off & ~3); + val32 &= ~(0xff << (off & 3) * 8); + val32 |= (val << (off & 3) * 8); + + WR4(sc, off & ~3, val32); +} + +static void +imx_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + uint32_t val32; + + /* The USDHC hardware moved the transfer mode bits to mixed control. */ + if (sc->hwtype == HWTYPE_USDHC) { + if (off == SDHCI_TRANSFER_MODE) { + val32 = RD4(sc, USDHC_MIX_CONTROL); + val32 &= ~0x3f; + val32 |= val & 0x37; + // XXX acmd23 not supported here (or by sdhci driver) + WR4(sc, USDHC_MIX_CONTROL, val32); + return; + } + } + + /* + * The clock control stuff is complex enough to have its own routine + * that can both change speeds and en/disable the clock output. Also, + * save the register bits in SDHCI format so that we can play them back + * in the read2 routine without complex decoding. + */ + if (off == SDHCI_CLOCK_CONTROL) { + sc->sdclockreg_freq_bits = val & 0xffc0; + if (val & SDHCI_CLOCK_CARD_EN) { + imx_sdhc_set_clock(sc, true); + } else { + imx_sdhc_set_clock(sc, false); + } + } + + /* + * Figure out whether we need to check the DAT0 line for busy status at + * interrupt time. The controller should be doing this, but for some + * reason it doesn't. There are two cases: + * - R1B response with no data transfer should generate a DATA_END (aka + * TRANSFER_COMPLETE) interrupt after waiting for busy, but if + * there's no data transfer there's no DATA_END interrupt. This is + * documented; they seem to think it's a feature. + * - R1B response after Auto-CMD12 appears to not work, even though + * there's a control bit for it (bit 3) in the vendor register. + * When we're starting a command that needs a manual DAT0 line check at + * interrupt time, we leave ourselves a note in r1bfix_type so that we + * can do the extra work in imx_sdhci_intr(). + */ + if (off == SDHCI_COMMAND_FLAGS) { + if (val & SDHCI_CMD_DATA) { + const uint32_t MBAUTOCMD = SDHCI_TRNS_ACMD12 | SDHCI_TRNS_MULTI; + val32 = RD4(sc, USDHC_MIX_CONTROL); + if ((val32 & MBAUTOCMD) == MBAUTOCMD) + sc->r1bfix_type = R1BFIX_AC12; + } else { + if ((val & SDHCI_CMD_RESP_MASK) == SDHCI_CMD_RESP_SHORT_BUSY) { + WR4(sc, SDHCI_INT_ENABLE, slot->intmask | SDHCI_INT_RESPONSE); + WR4(sc, SDHCI_SIGNAL_ENABLE, slot->intmask | SDHCI_INT_RESPONSE); + sc->r1bfix_type = R1BFIX_NODATA; + } + } + } + + val32 = RD4(sc, off & ~3); + val32 &= ~(0xffff << (off & 3) * 8); + val32 |= ((val & 0xffff) << (off & 3) * 8); + WR4(sc, off & ~3, val32); +} + +static void +imx_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + + /* Clear synthesized interrupts, then pass the value to the hardware. */ + if (off == SDHCI_INT_STATUS) { + sc->r1bfix_intmask &= ~val; + } + + WR4(sc, off, val); +} + +static void +imx_sdhci_write_multi_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t *data, bus_size_t count) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + + bus_write_multi_4(sc->mem_res, off, data, count); +} + +static void +imx_sdhc_set_clock(struct imx_sdhci_softc *sc, int enable) +{ + uint32_t divisor, enable_bits, enable_reg, freq, prescale, val32; + + if (sc->hwtype == HWTYPE_ESDHC) { + divisor = (sc->sdclockreg_freq_bits >> SDHCI_DIVIDER_SHIFT) & + SDHCI_DIVIDER_MASK; + enable_reg = SDHCI_CLOCK_CONTROL; + enable_bits = SDHC_CLK_IPGEN | SDHC_CLK_HCKEN | + SDHC_CLK_PEREN; + } else { + divisor = (sc->sdclockreg_freq_bits >> SDHCI_DIVIDER_SHIFT) & + SDHCI_DIVIDER_MASK; + divisor |= ((sc->sdclockreg_freq_bits >> + SDHCI_DIVIDER_HI_SHIFT) & + SDHCI_DIVIDER_HI_MASK) << SDHCI_DIVIDER_MASK_LEN; + enable_reg = SDHCI_CLOCK_CONTROL; + enable_bits = SDHC_VEND_IPGEN | SDHC_VEND_HCKEN | + SDHC_VEND_PEREN; + } + + WR4(sc, SDHC_VEND_SPEC, + RD4(sc, SDHC_VEND_SPEC) & ~SDHC_VEND_FRC_SDCLK_ON); + WR4(sc, enable_reg, RD4(sc, enable_reg) & ~enable_bits); + + if (!enable) + return; + + if (divisor == 0) + freq = sc->baseclk_hz; + else + freq = sc->baseclk_hz / (2 * divisor); + + for (prescale = 2; prescale < freq / prescale / 16;) + prescale <<= 1; + + for (divisor = 1; freq < freq / prescale / divisor;) + ++divisor; + + prescale >>= 1; + divisor -= 1; + + val32 = RD4(sc, SDHCI_CLOCK_CONTROL); + val32 &= ~SDHC_CLK_DIVISOR_MASK; + val32 |= divisor << SDHC_CLK_DIVISOR_SHIFT; + val32 &= ~SDHC_CLK_PRESCALE_MASK; + val32 |= prescale << SDHC_CLK_PRESCALE_SHIFT; + WR4(sc, SDHCI_CLOCK_CONTROL, val32); + + WR4(sc, enable_reg, RD4(sc, enable_reg) | enable_bits); + WR4(sc, SDHC_VEND_SPEC, + RD4(sc, SDHC_VEND_SPEC) | SDHC_VEND_FRC_SDCLK_ON); +} + +static void +imx_sdhci_intr(void *arg) +{ + struct imx_sdhci_softc *sc = arg; + uint32_t intmask; + + intmask = RD4(sc, SDHCI_INT_STATUS); + + /* + * Manually check the DAT0 line for R1B response types that the + * controller fails to handle properly. + * + * To do the NODATA fix, when the RESPONSE (COMMAND_COMPLETE) interrupt + * occurs, we have to wait for the DAT0 line to be released, then + * synthesize a DATA_END (TRANSFER_COMPLETE) interrupt, which we do by + * storing SDHCI_INT_DATA_END into a variable that gets ORed into the + * return value when the SDHCI_INT_STATUS register is read. + * + * For the AC12 fix, when the DATA_END interrupt occurs we wait for the + * DAT0 line to be released, and the waiting is all the fix we need. + */ + if ((sc->r1bfix_type == R1BFIX_NODATA && + (intmask & SDHCI_INT_RESPONSE)) || + (sc->r1bfix_type == R1BFIX_AC12 && + (intmask & SDHCI_INT_DATA_END))) { + uint32_t count; + count = 0; + /* XXX use a callout or something instead of busy-waiting. */ + while (count < 250000 && + (RD4(sc, SDHCI_PRESENT_STATE) & SDHCI_DAT_ACTIVE)) { + ++count; + DELAY(1); + } + if (count >= 250000) + sc->r1bfix_intmask = SDHCI_INT_DATA_TIMEOUT; + else if (sc->r1bfix_type == R1BFIX_NODATA) + sc->r1bfix_intmask = SDHCI_INT_DATA_END; + sc->r1bfix_type = R1BFIX_NONE; + } + + sdhci_generic_intr(&sc->slot); +} + +static int +imx_sdhci_get_ro(device_t bus, device_t child) +{ + + return (false); +} + +static int +imx_sdhci_detach(device_t dev) +{ + + return (EBUSY); +} + +static int +imx_sdhci_attach(device_t dev) +{ + struct imx_sdhci_softc *sc = device_get_softc(dev); + int rid, err; + + sc->dev = dev; + + if (ofw_bus_is_compatible(dev, "fsl,imx51-esdhc")) { + sc->hwtype = HWTYPE_ESDHC; + } else if (ofw_bus_is_compatible(dev, "fsl,imx-usdhc")) { + sc->hwtype = HWTYPE_USDHC; + } else { + panic("Impossible: not compatible in imx_sdhci_attach()"); + } + + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->mem_res) { + device_printf(dev, "cannot allocate memory window\n"); + err = ENXIO; + goto fail; + } + + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (!sc->irq_res) { + device_printf(dev, "cannot allocate interrupt\n"); + err = ENXIO; + goto fail; + } + + if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, imx_sdhci_intr, sc, &sc->intr_cookie)) { + device_printf(dev, "cannot setup interrupt handler\n"); + err = ENXIO; + goto fail; + } + + sc->slot.quirks |= SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK; + + /* + * DMA is not really broken, I just haven't implemented it yet. + */ + sc->slot.quirks |= SDHCI_QUIRK_BROKEN_DMA; + + /* + * Set the buffer watermark level to 128 words (512 bytes) for both read + * and write. The hardware has a restriction that when the read or + * write ready status is asserted, that means you can read exactly the + * number of words set in the watermark register before you have to + * re-check the status and potentially wait for more data. The main + * sdhci driver provides no hook for doing status checking on less than + * a full block boundary, so we set the watermark level to be a full + * block. Reads and writes where the block size is less than the + * watermark size will work correctly too, no need to change the + * watermark for different size blocks. However, 128 is the maximum + * allowed for the watermark, so PIO is limitted to 512 byte blocks + * (which works fine for SD cards, may be a problem for SDIO some day). + * + * XXX need named constants for this stuff. + */ + WR4(sc, SDHC_WTMK_LVL, 0x08800880); + + /* XXX get imx6 clock frequency from CCM */ + if (sc->hwtype == HWTYPE_USDHC) { + sc->baseclk_hz = 200000000; + } else if (sc->hwtype == HWTYPE_ESDHC) { + sc->baseclk_hz = imx51_get_clock(IMX51CLK_PERCLK_ROOT); + } + + sdhci_init_slot(dev, &sc->slot, 0); + + bus_generic_probe(dev); + bus_generic_attach(dev); + + sdhci_start_slot(&sc->slot); + + return (0); + +fail: + if (sc->intr_cookie) + bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); + if (sc->irq_res) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); + if (sc->mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + + return (err); +} + +static int +imx_sdhci_probe(device_t dev) +{ + + switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) { + case HWTYPE_ESDHC: + device_set_desc(dev, "Freescale eSDHC controller"); + return (BUS_PROBE_DEFAULT); + case HWTYPE_USDHC: + device_set_desc(dev, "Freescale uSDHC controller"); + return (BUS_PROBE_DEFAULT); + default: + break; + } + return (ENXIO); +} + +static device_method_t imx_sdhci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, imx_sdhci_probe), + DEVMETHOD(device_attach, imx_sdhci_attach), + DEVMETHOD(device_detach, imx_sdhci_detach), + + /* Bus interface */ + DEVMETHOD(bus_read_ivar, sdhci_generic_read_ivar), + DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), + DEVMETHOD(bus_print_child, bus_generic_print_child), + + /* MMC bridge interface */ + DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), + DEVMETHOD(mmcbr_request, sdhci_generic_request), + DEVMETHOD(mmcbr_get_ro, imx_sdhci_get_ro), + DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), + DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), + + /* SDHCI registers accessors */ + DEVMETHOD(sdhci_read_1, imx_sdhci_read_1), + DEVMETHOD(sdhci_read_2, imx_sdhci_read_2), + DEVMETHOD(sdhci_read_4, imx_sdhci_read_4), + DEVMETHOD(sdhci_read_multi_4, imx_sdhci_read_multi_4), + DEVMETHOD(sdhci_write_1, imx_sdhci_write_1), + DEVMETHOD(sdhci_write_2, imx_sdhci_write_2), + DEVMETHOD(sdhci_write_4, imx_sdhci_write_4), + DEVMETHOD(sdhci_write_multi_4, imx_sdhci_write_multi_4), + + { 0, 0 } +}; + +static devclass_t imx_sdhci_devclass; + +static driver_t imx_sdhci_driver = { + "sdhci_imx", + imx_sdhci_methods, + sizeof(struct imx_sdhci_softc), +}; + +DRIVER_MODULE(sdhci_imx, simplebus, imx_sdhci_driver, imx_sdhci_devclass, 0, 0); +MODULE_DEPEND(sdhci_imx, sdhci, 1, 1, 1); + From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:30:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2A71412; Fri, 13 Dec 2013 22:30:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C474C1483; Fri, 13 Dec 2013 22:30:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMULAm052877; Fri, 13 Dec 2013 22:30:21 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMULB3052874; Fri, 13 Dec 2013 22:30:21 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132230.rBDMULB3052874@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259354 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:30:22 -0000 Author: ian Date: Fri Dec 13 22:30:21 2013 New Revision: 259354 URL: http://svnweb.freebsd.org/changeset/base/259354 Log: MFC r257476, r257478: Revamp the SoC identity numbering scheme to be more in line with the way Freescale numbers the chips in the ID registers. Add definitions for the register and data that describes the SoC type. Modified: stable/10/sys/arm/freescale/imx/imx6_anatopreg.h stable/10/sys/arm/freescale/imx/imx_machdep.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx6_anatopreg.h ============================================================================== --- stable/10/sys/arm/freescale/imx/imx6_anatopreg.h Fri Dec 13 22:28:19 2013 (r259353) +++ stable/10/sys/arm/freescale/imx/imx6_anatopreg.h Fri Dec 13 22:30:21 2013 (r259354) @@ -122,7 +122,9 @@ #define IMX6_ANALOG_USB2_MISC_CLR 0x258 #define IMX6_ANALOG_USB2_MISC_TOG 0x25C #define IMX6_ANALOG_DIGPROG 0x260 - - +#define IMX6_ANALOG_DIGPROG_SL 0x280 +#define IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT 16 +#define IMX6_ANALOG_DIGPROG_SOCTYPE_MASK \ + (0xff << IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT) #endif Modified: stable/10/sys/arm/freescale/imx/imx_machdep.h ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_machdep.h Fri Dec 13 22:28:19 2013 (r259353) +++ stable/10/sys/arm/freescale/imx/imx_machdep.h Fri Dec 13 22:30:21 2013 (r259354) @@ -36,24 +36,27 @@ void imx_devmap_addentry(vm_paddr_t _pa, vm_size_t _sz); void imx_wdog_cpu_reset(vm_offset_t _wdcr_phys) __attribute__((__noreturn__)); +/* From here down, routines are implemented in imxNN_machdep.c. */ + /* * SoC identity. + * According to the documentation, there is such a thing as an i.MX6 Dual + * (non-lite flavor). However, Freescale doesn't seem to have assigned it a + * number in their code for determining the SoC type in u-boot. + * + * To-do: put silicon revision numbers into the low-order bits somewhere. */ -#define IMXSOC_51 0x05000100 -#define IMXSOC_53 0x05000300 -#define IMXSOC_6S 0x06000010 -#define IMXSOC_6SL 0x06000011 -#define IMXSOC_6D 0x06000020 -#define IMXSOC_6DL 0x06000021 -#define IMXSOC_6Q 0x06000040 -#define IMXSOC_6QL 0x06000041 -#define IMXSOC_FAMSHIFT 24 +#define IMXSOC_51 0x51000000 +#define IMXSOC_53 0x53000000 +#define IMXSOC_6SL 0x60000000 +#define IMXSOC_6DL 0x61000000 +#define IMXSOC_6S 0x62000000 +#define IMXSOC_6Q 0x63000000 +#define IMXSOC_FAMSHIFT 28 u_int imx_soc_type(void); u_int imx_soc_family(void); -/* From here down, routines are implemented in imxNN_machdep.c. */ - void imx_devmap_init(void); /* From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:41:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE6B2B64; Fri, 13 Dec 2013 22:41:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C818615D4; Fri, 13 Dec 2013 22:41:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMfxj6058618; Fri, 13 Dec 2013 22:41:59 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMfvpZ058604; Fri, 13 Dec 2013 22:41:57 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132241.rBDMfvpZ058604@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:41:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259355 - in stable/10/sys: arm/conf arm/freescale/imx boot/fdt/dts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:42:00 -0000 Author: ian Date: Fri Dec 13 22:41:57 2013 New Revision: 259355 URL: http://svnweb.freebsd.org/changeset/base/259355 Log: MFC r257483, r257486, r257489: Add the Soc- / machine-dependent parts of imx6 support. Add dts source for imx6 SoCs and for Wandboard boards. Add kernel config for Wandboard. Added: stable/10/sys/arm/conf/WANDBOARD-COMMON - copied unchanged from r257489, head/sys/arm/conf/WANDBOARD-COMMON stable/10/sys/arm/conf/WANDBOARD-DUAL - copied unchanged from r257489, head/sys/arm/conf/WANDBOARD-DUAL stable/10/sys/arm/conf/WANDBOARD-QUAD - copied unchanged from r257489, head/sys/arm/conf/WANDBOARD-QUAD stable/10/sys/arm/conf/WANDBOARD-SOLO - copied unchanged from r257489, head/sys/arm/conf/WANDBOARD-SOLO stable/10/sys/arm/freescale/imx/files.imx6 - copied unchanged from r257483, head/sys/arm/freescale/imx/files.imx6 stable/10/sys/arm/freescale/imx/imx6_machdep.c - copied unchanged from r257483, head/sys/arm/freescale/imx/imx6_machdep.c stable/10/sys/arm/freescale/imx/imx6_pl310.c - copied unchanged from r257483, head/sys/arm/freescale/imx/imx6_pl310.c stable/10/sys/arm/freescale/imx/std.imx6 - copied unchanged from r257483, head/sys/arm/freescale/imx/std.imx6 stable/10/sys/boot/fdt/dts/imx6.dtsi - copied unchanged from r257486, head/sys/boot/fdt/dts/imx6.dtsi stable/10/sys/boot/fdt/dts/wandboard-dual.dts - copied unchanged from r257486, head/sys/boot/fdt/dts/wandboard-dual.dts stable/10/sys/boot/fdt/dts/wandboard-quad.dts - copied unchanged from r257486, head/sys/boot/fdt/dts/wandboard-quad.dts stable/10/sys/boot/fdt/dts/wandboard-solo.dts - copied unchanged from r257486, head/sys/boot/fdt/dts/wandboard-solo.dts Modified: Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/arm/conf/WANDBOARD-COMMON (from r257489, head/sys/arm/conf/WANDBOARD-COMMON) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/conf/WANDBOARD-COMMON Fri Dec 13 22:41:57 2013 (r259355, copy of r257489, head/sys/arm/conf/WANDBOARD-COMMON) @@ -0,0 +1,155 @@ +# Kernel configuration for Wandboard +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +include "../freescale/imx/std.imx6" + +options HZ=250 # Scheduling quantum is 4 milliseconds. +options SCHED_4BSD # 4BSD scheduler +options PREEMPTION # Enable kernel thread preemption +options INET # InterNETworking +options INET6 # IPv6 communications protocols +#options SCTP # Stream Control Transmission Protocol +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options UFS_GJOURNAL # Enable gjournal-based UFS journaling +#options MD_ROOT # MD is a potential root device +options NFSCL # New Network Filesystem Client +#options NFSD # New Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCL +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +#options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options TMPFS # TMP Memory Filesystem +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Provides labelization +options KTRACE # ktrace(1) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options INCLUDE_CONFIG_FILE # Include this file in kernel + +# Debugging support. Always need this: +options KDB # Enable kernel debugger support. +# For minimum debugger support use KDB_TRACE, for interactive use DDB. +#options KDB_TRACE # Print a stack trace for a panic. +options DDB # Support DDB. +# For full debugger support use this instead: +#options GDB # Support remote GDB. +# Other debugging options... +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +options ALT_BREAK_TO_DEBUGGER # Use to enter debugger. +#options DEBUG +#options DEADLKRES # Enable the deadlock resolver +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles + +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device vlan # 802.1Q VLAN support +device tun # Packet tunnel. +device md # Memory "disks" +#device gif # IPv6 and IPv4 tunneling +#device faith # IPv6-to-IPv4 relaying (translation) +#device firmware # firmware assist module +device ether # Ethernet support +device miibus # Required for ethernet + +# Serial (COM) ports +device uart # Multi-uart driver + +#device iomux # IO Multiplexor + +# SCSI peripherals +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) +device cd # CD +device pass # Passthrough device (direct SCSI access) + +# USB support +#options USB_DEBUG # enable debug msgs +options USB_HOST_ALIGN=32 # Required for ARM, set to cache line size. +device ehci # OHCI USB interface +device usb # USB Bus (required) +device umass # Disks/Mass storage - Requires scbus and da +device uhid # "Human Interface Devices" +device u3g # USB modems + +# USB Ethernet, requires miibus +#device aue # ADMtek USB Ethernet +#device axe # ASIX Electronics USB Ethernet +#device cdce # Generic USB over Ethernet +#device cue # CATC USB Ethernet +#device kue # Kawasaki LSI USB Ethernet +#device rue # RealTek RTL8150 USB Ethernet +#device udav # Davicom DM9601E USB + +# USB Wireless +#device rum # Ralink Technology RT2501USB wireless NICs + +# Watchdog timer. +# WARNING: can't be disabled!!! +#device imxwdt # Watchdog + +# Wireless NIC cards +#device wlan # 802.11 support +#device wlan_wep # 802.11 WEP support +#device wlan_ccmp # 802.11 CCMP support +#device wlan_tkip # 802.11 TKIP support +#device wlan_amrr # AMRR transmit rate control algorithm + +# NOTE: serial console will be disabled if syscons enabled +# Uncomment following lines for framebuffer/syscons support +# Wandboard has no video console support yet. +#device sc +#device kbdmux +#options SC_DFLT_FONT # compile font in +#makeoptions SC_DFLT_FONT=cp437 +#device ukbd # Allow keyboard like HIDs to control console +#device ums + +# required for netbooting +#options BOOTP +#options BOOTP_COMPAT +#options BOOTP_NFSROOT +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ffec0 + +# U-Boot stuff lives on slice 1, FreeBSD on slice 2. +options ROOTDEVNAME=\"ufs:mmcsd0s2a\" + +#device fsliic # Freescale i2c/iic (not ready yet) +#device iic # iic protocol +#device iicbus # iic bus + +device sdhci # SD controller +device mmc # SD/MMC protocol +device mmcsd # SDCard disk device + +device ffec # Freescale Fast Ethernet Controller + Copied: stable/10/sys/arm/conf/WANDBOARD-DUAL (from r257489, head/sys/arm/conf/WANDBOARD-DUAL) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/conf/WANDBOARD-DUAL Fri Dec 13 22:41:57 2013 (r259355, copy of r257489, head/sys/arm/conf/WANDBOARD-DUAL) @@ -0,0 +1,27 @@ +# Kernel configuration for Wandboard-Dual +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +include WANDBOARD-COMMON +ident WANDBOARD-DUAL + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=wandboard-dual.dts + Copied: stable/10/sys/arm/conf/WANDBOARD-QUAD (from r257489, head/sys/arm/conf/WANDBOARD-QUAD) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/conf/WANDBOARD-QUAD Fri Dec 13 22:41:57 2013 (r259355, copy of r257489, head/sys/arm/conf/WANDBOARD-QUAD) @@ -0,0 +1,27 @@ +# Kernel configuration for Wandboard-Quad +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +include WANDBOARD-COMMON +ident WANDBOARD-QUAD + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=wandboard-quad.dts + Copied: stable/10/sys/arm/conf/WANDBOARD-SOLO (from r257489, head/sys/arm/conf/WANDBOARD-SOLO) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/conf/WANDBOARD-SOLO Fri Dec 13 22:41:57 2013 (r259355, copy of r257489, head/sys/arm/conf/WANDBOARD-SOLO) @@ -0,0 +1,27 @@ +# Kernel configuration for Wandboard-Solo +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +include WANDBOARD-COMMON +ident WANDBOARD-SOLO + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=wandboard-solo.dts + Copied: stable/10/sys/arm/freescale/imx/files.imx6 (from r257483, head/sys/arm/freescale/imx/files.imx6) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/files.imx6 Fri Dec 13 22:41:57 2013 (r259355, copy of r257483, head/sys/arm/freescale/imx/files.imx6) @@ -0,0 +1,56 @@ +# $FreeBSD$ + +# +# Standard ARM support. +# +arm/arm/bus_space_asm_generic.S standard +arm/arm/bus_space_generic.c standard +arm/arm/cpufunc_asm_arm11.S standard +arm/arm/cpufunc_asm_armv5.S standard +arm/arm/cpufunc_asm_armv7.S standard +arm/arm/irq_dispatch.S standard +kern/kern_clocksource.c standard + +# +# Standard imx6 devices and support. +# +arm/arm/gic.c standard +arm/arm/pl310.c standard +arm/freescale/imx/bus_space.c standard +arm/freescale/imx/common.c standard +arm/freescale/imx/imx6_anatop.c standard +arm/freescale/imx/imx6_ccm.c standard +arm/freescale/imx/imx6_machdep.c standard +arm/freescale/imx/imx6_pl310.c standard +arm/freescale/imx/imx_machdep.c standard +arm/freescale/imx/imx_gpt.c standard + +# +# Optional devices. +# +arm/freescale/imx/imx_sdhci.c optional sdhci + +arm/freescale/imx/imx_wdog.c optional imxwdt + +dev/ffec/if_ffec.c optional ffec + +dev/uart/uart_dev_imx.c optional uart + +dev/usb/controller/ehci_imx.c optional ehci +arm/freescale/imx/imx6_usbphy.c optional ehci + +# +# Low-level serial console for debugging early kernel startup. +# +#arm/freescale/imx/console.c standard + +# +# Not ready yet... +# +#arm/freescale/imx/imx51_iomux.c optional iomux +#arm/freescale/imx/imx51_gpio.c optional gpio +#dev/ata/chipsets/ata-fsl.c optional imxata +#arm/freescale/imx/i2c.c optional fsliic +#dev/ofw/ofw_iicbus.c optional fsliic +#arm/freescale/imx/imx51_ipuv3.c optional sc + Copied: stable/10/sys/arm/freescale/imx/imx6_machdep.c (from r257483, head/sys/arm/freescale/imx/imx6_machdep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx6_machdep.c Fri Dec 13 22:41:57 2013 (r259355, copy of r257483, head/sys/arm/freescale/imx/imx6_machdep.c) @@ -0,0 +1,164 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Set up static device mappings. Note that for imx this is called from + * initarm_lastaddr() so that it can return the lowest address used for static + * device mapping, maximizing kva space. + * + * This attempts to cover the most-used devices with 1MB section mappings, which + * is good for performance (uses fewer TLB entries for device access). + * + * ARMMP covers the interrupt controller, MPCore timers, global timer, and the + * L2 cache controller. Most of the 1MB range is unused reserved space. + * + * AIPS1/AIPS2 cover most of the on-chip devices such as uart, spi, i2c, etc. + * + * Notably not mapped right now are HDMI, GPU, and other devices below ARMMP in + * the memory map. When we get support for graphics it might make sense to + * static map some of that area. Be careful with other things in that area such + * as OCRAM that probably shouldn't be mapped as PTE_DEVICE memory. + */ +void +imx_devmap_init(void) +{ + const uint32_t IMX6_ARMMP_PHYS = 0x00a00000; + const uint32_t IMX6_ARMMP_SIZE = 0x00100000; + const uint32_t IMX6_AIPS1_PHYS = 0x02000000; + const uint32_t IMX6_AIPS1_SIZE = 0x00100000; + const uint32_t IMX6_AIPS2_PHYS = 0x02100000; + const uint32_t IMX6_AIPS2_SIZE = 0x00100000; + + imx_devmap_addentry(IMX6_ARMMP_PHYS, IMX6_ARMMP_SIZE); + imx_devmap_addentry(IMX6_AIPS1_PHYS, IMX6_AIPS1_SIZE); + imx_devmap_addentry(IMX6_AIPS2_PHYS, IMX6_AIPS2_SIZE); +} + +void +cpu_reset(void) +{ + const uint32_t IMX6_WDOG_CR_PHYS = 0x020bc000; + + imx_wdog_cpu_reset(IMX6_WDOG_CR_PHYS); +} + +/* + * Determine what flavor of imx6 we're running on. + * + * This code is based on the way u-boot does it. Information found on the web + * indicates that Freescale themselves were the original source of this logic, + * including the strange check for number of CPUs in the SCU configuration + * register, which is apparently needed on some revisions of the SOLO. + * + * According to the documentation, there is such a thing as an i.MX6 Dual + * (non-lite flavor). However, Freescale doesn't seem to have assigned it a + * number or provided any logic to handle it in their detection code. + * + * Note that the ANALOG_DIGPROG and SCU configuration registers are not + * documented in the chip reference manual. (SCU configuration is mentioned, + * but not mapped out in detail.) I think the bottom two bits of the scu config + * register may be ncpu-1. + * + * This hasn't been tested yet on a dual[-lite]. + * + * On a solo: + * digprog = 0x00610001 + * hwsoc = 0x00000062 + * scu config = 0x00000500 + * On a quad: + * digprog = 0x00630002 + * hwsoc = 0x00000063 + * scu config = 0x00005503 + */ +u_int imx_soc_type() +{ + const struct pmap_devmap *pd; + uint32_t digprog, hwsoc; + uint32_t *pcr; + const uint32_t HWSOC_MX6SL = 0x60; + const uint32_t HWSOC_MX6DL = 0x61; + const uint32_t HWSOC_MX6SOLO = 0x62; + const uint32_t HWSOC_MX6Q = 0x63; + const vm_offset_t SCU_CONFIG_PHYSADDR = 0x00a00004; + + digprog = imx6_anatop_read_4(IMX6_ANALOG_DIGPROG_SL); + hwsoc = (digprog >> IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT) & + IMX6_ANALOG_DIGPROG_SOCTYPE_MASK; + + if (hwsoc != HWSOC_MX6SL) { + digprog = imx6_anatop_read_4(IMX6_ANALOG_DIGPROG); + hwsoc = (digprog & IMX6_ANALOG_DIGPROG_SOCTYPE_MASK) >> + IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT; + /*printf("digprog = 0x%08x\n", digprog);*/ + if (hwsoc == HWSOC_MX6DL) { + pd = pmap_devmap_find_pa(SCU_CONFIG_PHYSADDR, 4); + if (pd != NULL) { + pcr = (uint32_t *)(pd->pd_va + + (SCU_CONFIG_PHYSADDR - pd->pd_pa)); + /*printf("scu config = 0x%08x\n", *pcr);*/ + if ((*pcr & 0x03) == 0) { + hwsoc = HWSOC_MX6SOLO; + } + } + } + } + /* printf("hwsoc 0x%08x\n", hwsoc); */ + + switch (hwsoc) { + case HWSOC_MX6SL: + return (IMXSOC_6SL); + case HWSOC_MX6SOLO: + return (IMXSOC_6S); + case HWSOC_MX6DL: + return (IMXSOC_6DL); + case HWSOC_MX6Q : + return (IMXSOC_6Q); + default: + printf("imx_soc_type: Don't understand hwsoc 0x%02x, " + "digprog 0x%08x; assuming IMXSOC_6Q\n", hwsoc, digprog); + break; + } + + return (IMXSOC_6Q); +} + Copied: stable/10/sys/arm/freescale/imx/imx6_pl310.c (from r257483, head/sys/arm/freescale/imx/imx6_pl310.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/imx6_pl310.c Fri Dec 13 22:41:57 2013 (r259355, copy of r257483, head/sys/arm/freescale/imx/imx6_pl310.c) @@ -0,0 +1,98 @@ +/*- + * Copyright (c) 2012 Olivier Houchard. + * 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$"); + +/* + * The machine-dependent part of the arm/pl310 driver for imx6 SoCs. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +void +platform_pl310_init(struct pl310_softc *sc) +{ + uint32_t aux, prefetch; + + aux = pl310_read4(sc, PL310_AUX_CTRL); + prefetch = pl310_read4(sc, PL310_PREFETCH_CTRL); + + if (bootverbose) { + device_printf(sc->sc_dev, "Early BRESP response: %s\n", + (aux & AUX_CTRL_EARLY_BRESP) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Instruction prefetch: %s\n", + (aux & AUX_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Data prefetch: %s\n", + (aux & AUX_CTRL_DATA_PREFETCH) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Non-secure interrupt control: %s\n", + (aux & AUX_CTRL_NS_INT_CTRL) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Non-secure lockdown: %s\n", + (aux & AUX_CTRL_NS_LOCKDOWN) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Share override: %s\n", + (aux & AUX_CTRL_SHARE_OVERRIDE) ? "enabled" : "disabled"); + + device_printf(sc->sc_dev, "Double linefil: %s\n", + (prefetch & PREFETCH_CTRL_DL) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Instruction prefetch: %s\n", + (prefetch & PREFETCH_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Data prefetch: %s\n", + (prefetch & PREFETCH_CTRL_DATA_PREFETCH) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Double linefill on WRAP request: %s\n", + (prefetch & PREFETCH_CTRL_DL_ON_WRAP) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Prefetch drop: %s\n", + (prefetch & PREFETCH_CTRL_PREFETCH_DROP) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Incr double Linefill: %s\n", + (prefetch & PREFETCH_CTRL_INCR_DL) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Not same ID on exclusive sequence: %s\n", + (prefetch & PREFETCH_CTRL_NOTSAMEID) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Prefetch offset: %d\n", + (prefetch & PREFETCH_CTRL_OFFSET_MASK)); + } +} + +void +platform_pl310_write_ctrl(struct pl310_softc *sc, uint32_t val) +{ + + pl310_write4(sc, PL310_CTRL, val); +} + +void +platform_pl310_write_debug(struct pl310_softc *sc, uint32_t val) +{ + + pl310_write4(sc, PL310_DEBUG_CTRL, val); +} + Copied: stable/10/sys/arm/freescale/imx/std.imx6 (from r257483, head/sys/arm/freescale/imx/std.imx6) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/freescale/imx/std.imx6 Fri Dec 13 22:41:57 2013 (r259355, copy of r257483, head/sys/arm/freescale/imx/std.imx6) @@ -0,0 +1,15 @@ +# $FreeBSD$ +machine arm armv6 +cpu CPU_CORTEXA +makeoptions ARM_LITTLE_ENDIAN +options ARM_L2_PIPT + +options KERNVIRTADDR = 0xc2000000 +makeoptions KERNVIRTADDR = 0xc2000000 +options KERNPHYSADDR = 0x12000000 +makeoptions KERNPHYSADDR = 0x12000000 +options PHYSADDR = 0x10000000 +options STARTUP_PAGETABLE_ADDR = 0x11f00000 + +files "../freescale/imx/files.imx6" + Copied: stable/10/sys/boot/fdt/dts/imx6.dtsi (from r257486, head/sys/boot/fdt/dts/imx6.dtsi) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/boot/fdt/dts/imx6.dtsi Fri Dec 13 22:41:57 2013 (r259355, copy of r257486, head/sys/boot/fdt/dts/imx6.dtsi) @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2013 Ian Lepore + * Copyright (c) 2012 The FreeBSD Foundation + * 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. + * + * Freescale i.MX6 Common Device Tree Source. + * There are enough differences between the Solo, Dual, Quad, and *-lite + * flavors of this SoC that eventually we will need a finer-grained breakdown + * of some of this stuff. For now this file works for all of them. I think. + * + * $FreeBSD$ + */ + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "ARM,MCIMX6"; + reg = <0x0>; + d-cache-line-size = <32>; + i-cache-line-size = <32>; + d-cache-size = <0x8000>; + i-cache-size = <0x8000>; + /* TODO: describe L2 cache also */ + timebase-frequency = <0>; + bus-frequency = <0>; + clock-frequency = <0>; + }; + }; + + aliases { + soc = &SOC; + }; + + SOC: soc@00000000 { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&gic>; + ranges = <0x00000000 0x00000000 0x10000000>; + + gic: generic-interrupt-controller@00a00100 { + compatible = "arm,gic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x00a01000 0x00001000 + 0x00a00100 0x00000100>; + }; + + l2-cache@00a02000 { + compatible = "arm,pl310-cache", "arm,pl310"; + reg = <0xa02000 0x1000>; + interrupts = <124>; + cache-level = <0x2>; + interrupt-parent = < &gic >; + }; + + aips@02000000 { /* AIPS1 */ + compatible = "fsl,aips-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&gic>; + reg = <0x02000000 0x00100000>; + ranges; + + /* Required by many devices, so better to stay first */ + clks: ccm@020c4000 { + compatible = "fsl,imx6q-ccm"; + reg = <0x020c4000 0x4000>; + interrupts = <119 120>; + }; + + anatop: anatop@020c8000 { + compatible = "fsl,imx6q-anatop"; + reg = <0x020c8000 0x1000>; + } + + gpt: timer@02098000 { + compatible = "fsl,imx6q-gpt", "fsl,imx51-gpt"; + reg = <0x02098000 0x4000>; + interrupt-parent = <&gic>; interrupts = <87>; + }; + +// iomux@73fa8000 { +// compatible = "fsl,imx51-iomux"; +// reg = <0x73fa8000 0x4000>; +// interrupt-parent = <&gic>; interrupts = <7>; +// status = "disabled"; +// }; + +// /* +// * GPIO modules moved up - to have it attached for +// * drivers which rely on GPIO +// */ +// gpio1: gpio@0209C000 { +// compatible = "fsl,imx51-gpio", "fsl,imx31-gpio"; +// reg = <0x0209C000 0x4000>; +// interrupt-parent = <&gic>; +// interrupts = <50 51 42 43 44 45 46 47 48 49>; +// /* TODO: use <> also */ +// gpio-controller; +// #gpio-cells = <2>; +// interrupt-controller; +// #interrupt-cells = <1>; +// status = "disabled"; +// }; +// +// gpio2: gpio@020A0000 { +// compatible = "fsl,imx51-gpio", "fsl,imx31-gpio"; +// reg = <0x020A0000 0x4000>; +// interrupt-parent = <&gic>; +// interrupts = <52 53>; +// gpio-controller; +// #gpio-cells = <2>; +// interrupt-controller; +// #interrupt-cells = <1>; +// status = "disabled"; +// }; +// +// gpio3: gpio@020A4000 { +// compatible = "fsl,imx51-gpio", "fsl,imx31-gpio"; +// reg = <0x020A4000 0x4000>; +// interrupt-parent = <&gic>; +// interrupts = <54 55>; +// gpio-controller; +// #gpio-cells = <2>; +// interrupt-controller; +// #interrupt-cells = <1>; +// status = "disabled"; +// }; +// +// gpio4: gpio@020A8000 { +// compatible = "fsl,imx51-gpio", "fsl,imx31-gpio"; +// reg = <0x020A8000 0x4000>; +// interrupt-parent = <&gic>; +// interrupts = <56 57>; +// gpio-controller; +// #gpio-cells = <2>; +// interrupt-controller; +// #interrupt-cells = <1>; +// status = "disabled"; +// }; + + uart1: serial@02020000 { + compatible = "fsl,imx6q-uart"; + reg = <0x02020000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <58>; + clock-frequency = <80000000>; + status = "disabled"; + }; + + uart2: serial@021e8000 { + compatible = "fsl,imx6q-uart"; + reg = <0x021e8000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <59>; + clock-frequency = <80000000>; + status = "disabled"; + }; + + uart3: serial@021ec000 { + compatible = "fsl,imx6q-uart"; + reg = <0x021ec000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <60>; + clock-frequency = <80000000>; + status = "disabled"; + }; + + uart4: serial@021f0000 { + compatible = "fsl,imx6q-uart"; + reg = <0x021f0000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <61>; + clock-frequency = <80000000>; + status = "disabled"; + }; + + uart5: serial@021f4000 { + compatible = "fsl,imx6q-uart"; + reg = <0x021f4000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <62>; + clock-frequency = <80000000>; + status = "disabled"; + }; + + usbphy1: usbphy@020c9000 { + compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy"; + reg = <0x020c9000 0x1000>; + interrupts = <44>; + status = "disabled"; + }; + + usbphy2: usbphy@020ca000 { + compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy"; + reg = <0x020ca000 0x1000>; + interrupts = <45>; + status = "disabled"; + }; + + }; + + aips@02100000 { /* AIPS2 */ + compatible = "fsl,aips-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&gic>; + reg = <0x02100000 0x00100000>; + ranges; + + fec1: ethernet@02188000 { + compatible = "fsl,imx6q-fec"; + reg = <0x02188000 0x4000>; + interrupts = <150 151>; + status = "disabled"; + }; + + usbotg1: usb@02184000 { + compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; + reg = <0x02184000 0x200>; + interrupts = <75>; + fsl,usbphy = <&usbphy1>; + fsl,usbmisc = <&usbmisc 0>; + status = "disabled"; + }; + + usbh1: usb@02184200 { + compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; + reg = <0x02184200 0x200>; + interrupts = <72>; + fsl,usbphy = <&usbphy2>; + fsl,usbmisc = <&usbmisc 1>; + status = "disabled"; + }; + + usbh2: usb@02184400 { + compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; + reg = <0x02184400 0x200>; + interrupts = <73>; + fsl,usbmisc = <&usbmisc 2>; + status = "disabled"; + }; + + usbh3: usb@02184600 { + compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; + reg = <0x02184600 0x200>; + interrupts = <74>; + fsl,usbmisc = <&usbmisc 3>; + status = "disabled"; + }; + + usbmisc: usbmisc@02184800 { + #index-cells = <1>; + compatible = "fsl,imx6q-usbmisc"; + reg = <0x02184800 0x200>; + // Not disabled on purpose. + }; + + usdhc1: usdhc@02190000 { + compatible = "fsl,imx6q-usdhc"; + reg = <0x02190000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <54>; + bus-width = <0x4>; + status ="disabled"; + }; + + usdhc2: usdhc@02194000 { + compatible = "fsl,imx6q-usdhc"; + reg = <0x02194000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <55>; + bus-width = <0x4>; + status ="disabled"; + }; + + usdhc3: usdhc@02198000 { + compatible = "fsl,imx6q-usdhc"; + reg = <0x02198000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <56>; + bus-width = <0x4>; + status ="disabled"; + }; + + usdhc4: usdhc@0219c000 { + compatible = "fsl,imx6q-usdhc"; + reg = <0x0219c000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <57>; + bus-width = <0x4>; + status ="disabled"; + }; + }; + }; +}; Copied: stable/10/sys/boot/fdt/dts/wandboard-dual.dts (from r257486, head/sys/boot/fdt/dts/wandboard-dual.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/boot/fdt/dts/wandboard-dual.dts Fri Dec 13 22:41:57 2013 (r259355, copy of r257486, head/sys/boot/fdt/dts/wandboard-dual.dts) @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2013 Ian Lepore + * 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. + * + * Wandboard Dual. + * + * $FreeBSD$ + */ + +/dts-v1/; +/include/ "imx6.dtsi" + +/ { + #address-cells = <1>; + #size-cells = <1>; + + model = "Wandboard Dual"; + compatible = "wand,imx6d-wandboard", "fsl,imx6d"; + + memory { + reg = <0x10000000 0x40000000>; /* RAM 1GB */ + }; + + SOC: soc@00000000 { + aips@02000000 { /* AIPS1 */ +// iomux@73fa8000 { status = "disabled"; }; +// gpio@0209C000 { status = "disabled"; }; +// gpio@020A0000 { status = "disabled"; }; +// gpio@020A4000 { status = "disabled"; }; +// gpio@020A8000 { status = "disabled"; }; + console:serial@02020000 { status = "okay"; }; + serial@021e8000 { status = "disabled"; }; + serial@021ec000 { status = "disabled"; }; + serial@021f0000 { status = "disabled"; }; + serial@021f4000 { status = "disabled"; }; + usbphy@020c9000 { status = "okay"; }; + usbphy@020ca000 { status = "okay"; }; + }; + aips@02100000 { /* AIPS2 */ + ethernet@02188000 { + status = "okay"; + phy-mode = "rgmii"; + phy-disable-preamble; + }; + usb@02184000 { status = "okay"; }; + usb@02184200 { status = "okay"; }; + usb@02184400 { status = "disabled"; }; + usb@02184600 { status = "disabled"; }; + usdhc@02190000 { status = "disabled"; }; + usdhc@02194000 { status = "okay"; }; + usdhc@02198000 { status = "okay"; }; + usdhc@0219c000 { status = "disabled"; }; + }; + }; + + chosen { + stdin = &console; + stdout = &console; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:46:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBE99E9B for ; Fri, 13 Dec 2013 22:46:06 +0000 (UTC) Received: from nm7.bullet.mail.bf1.yahoo.com (nm7.bullet.mail.bf1.yahoo.com [98.139.212.166]) by mx1.freebsd.org (Postfix) with SMTP id 884F9160F for ; Fri, 13 Dec 2013 22:46:06 +0000 (UTC) Received: from [98.139.212.151] by nm7.bullet.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 22:45:59 -0000 Received: from [68.142.230.78] by tm8.bullet.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 22:45:59 -0000 Received: from [127.0.0.1] by smtp235.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 22:45:59 -0000 X-Yahoo-Newman-Id: 36679.47825.bm@smtp235.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: e5kiC_8VM1l.Db7EeLQpMII3jGQ9YHpChdADB1BHXE3DxhT UbT7qLyjuoFnK3hi5HSLFAkR9ZviWF5OWVYncg6NbGirNzJL56onz81cTXZT ne.Ciq1fEyRxPRCTo0lUOVodas6B8hnlACtcRexYHUaYxLWE4MMXpxXrvOGf tC19XYq8GWAqweTEDUviTQ4SJl46wNV_SkY.WpQX11Pw4NNGw6kufJxdPG3j oN7.4AElU7VYBbs4wbLsUBirTxiIBJp9LD1G6D0yLZ6m.0H24md3Ri_3pJv9 8EhGRYE0BHyJL_QKtQDAHsgqQ9jMjSB3sgWKkd6vNyb6sifdzxZExDhRcz7U mgsN1ywAJvvDlpm1ZHNSi4tlmYQsyxgPK3xA6NtR96NZd7gygh_CZ_FyxocD KtWSCkaik.i3z1gd6x4OllB5J16ZlQt5o5lAM7F_wVs4IVrJHlxml6106USH .v_AMv3NsMp1nivnQmd2oUM0PzfgQXHXcR17BX0YDYjzJ0R58IY9rLmH52Os befbSzZNjcLVvTX1ys6SKZoI67k.M.a.HlaSYgFajVXrWWfR_L5sq2g-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with plain [98.139.211.125]) by smtp235.mail.bf1.yahoo.com with SMTP; 13 Dec 2013 22:45:58 +0000 UTC Message-ID: <52AB8E24.9060008@FreeBSD.org> Date: Fri, 13 Dec 2013 17:45:56 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Tijl Coosemans , Eitan Adler Subject: Re: svn commit: r259326 - stable/10/contrib/tcpdump References: <201312131932.rBDJW3iw088831@svn.freebsd.org> <52AB6845.7020504@FreeBSD.org> <20131213223244.6ef4384f@kalimero.tijl.coosemans.org> <20131213225913.6a235dbe@kalimero.tijl.coosemans.org> In-Reply-To: <20131213225913.6a235dbe@kalimero.tijl.coosemans.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: svn-src-stable@freebsd.org, "src-committers@freebsd.org" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:46:07 -0000 On 13.12.2013 16:59, Tijl Coosemans wrote: > On Fri, 13 Dec 2013 16:41:44 -0500 Eitan Adler wrote: >> On Fri, Dec 13, 2013 at 4:32 PM, Tijl Coosemans wrote: >>> On Fri, 13 Dec 2013 15:04:21 -0500 Pedro Giffuni wrote: >>>> On 13.12.2013 14:43, Eitan Adler wrote: >>>>> On Fri, Dec 13, 2013 at 2:32 PM, Pedro F. Giffuni wrote: >>>>>> Author: pfg >>>>>> Date: Fri Dec 13 19:32:02 2013 >>>>>> New Revision: 259326 >>>>>> URL: http://svnweb.freebsd.org/changeset/base/259326 >>>>>> >>>>>> Log: >>>>>> MFV r258571: >>>>>> >>>>>> Removes strict-aliasing warnings from newer GCC in tcpdump. >>>>>> >>>>>> Corresponds to MFC r258573, but for some reason our new pre-commit hooks >>>>>> will not let us merge it from there. >>>>> How did you attempt to do this merge? What were the exact commands? >>>> (Standing on my local stable/10 dir) >>>> >>>> svn merge -c r258573 ^/head . >>>> >>>> Attempt to commit there fired the pre-commit hook. >>> This also copies the svn:mergeinfo property on head/contrib/tcpdump >>> to stable/10/contrib/tcpdump, but this property is only allowed on >>> stable/10 at the moment. I think you can just delete the property >>> before committing: >>> >>> svn propdel svn:mergeinfo contrib/tcpdump >> I think this should still be done, along with a --record-only merge. > Yes, done in r259334. Thank you, I guess it also required for stable/9? I merged it by the same procedure in r259327. Pedro.**** From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:46:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6A2ADEA4; Fri, 13 Dec 2013 22:46:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4B85C1614; Fri, 13 Dec 2013 22:46:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMkBdK059201; Fri, 13 Dec 2013 22:46:11 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMkAU6059198; Fri, 13 Dec 2013 22:46:10 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132246.rBDMkAU6059198@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259356 - in stable/10/sys: arm/ti boot/fdt/dts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:46:11 -0000 Author: ian Date: Fri Dec 13 22:46:10 2013 New Revision: 259356 URL: http://svnweb.freebsd.org/changeset/base/259356 Log: MFC r257518, r257519: TI sdhci driver improvements, mostly related to fdt data... Use the published compatible strings (our own invention, "ti,mmchs" is still accepted as well, for now). Don't blindly turn on 8-bit bus mode, because even though the controller supports it, the board has to be wired appropriately as well. Use the published property (bus-width=) and honor all the valid values (1,4,8). The eMMC device on a Beaglebone Black is wired for 8-bit, update the dts. The mmchs controller can inherently do both 1.8v and 3.0v on the first device and 1.8v only on other devices, unless an external transceiver is used. Set the voltage automatically for the first device and honor the published fdt property (ti,dualvolt) for other devices. Modified: stable/10/sys/arm/ti/ti_sdhci.c stable/10/sys/boot/fdt/dts/am335x.dtsi stable/10/sys/boot/fdt/dts/beaglebone-black.dts Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/ti/ti_sdhci.c ============================================================================== --- stable/10/sys/arm/ti/ti_sdhci.c Fri Dec 13 22:41:57 2013 (r259355) +++ stable/10/sys/arm/ti/ti_sdhci.c Fri Dec 13 22:46:10 2013 (r259356) @@ -75,6 +75,21 @@ struct ti_sdhci_softc { }; /* + * Table of supported FDT compat strings. + * + * Note that "ti,mmchs" is our own invention, and should be phased out in favor + * of the documented names. + * + * Note that vendor Beaglebone dtsi files use "ti,omap3-hsmmc" for the am335x. + */ +static struct ofw_compat_data compat_data[] = { + {"ti,omap3-hsmmc", 1}, + {"ti,omap4-hsmmc", 1}, + {"ti,mmchs", 1}, + {NULL, 0}, +}; + +/* * The MMCHS hardware has a few control and status registers at the beginning of * the device's memory map, followed by the standard sdhci register block. * Different SoCs have the register blocks at different offsets from the @@ -93,6 +108,10 @@ struct ti_sdhci_softc { #define MMCHS_CON 0x02C #define MMCHS_CON_DW8 (1 << 5) #define MMCHS_CON_DVAL_8_4MS (3 << 9) +#define MMCHS_SD_CAPA 0x240 +#define MMCHS_SD_CAPA_VS18 (1 << 26) +#define MMCHS_SD_CAPA_VS30 (1 << 25) +#define MMCHS_SD_CAPA_VS33 (1 << 24) static inline uint32_t ti_mmchs_read_4(struct ti_sdhci_softc *sc, bus_size_t off) @@ -320,6 +339,7 @@ ti_sdhci_hw_init(device_t dev) { struct ti_sdhci_softc *sc = device_get_softc(dev); clk_ident_t clk; + uint32_t regval; unsigned long timeout; /* Enable the controller and interface/functional clocks */ @@ -357,6 +377,21 @@ ti_sdhci_hw_init(device_t dev) DELAY(100); } + /* + * The attach() routine has examined fdt data and set flags in + * slot.host.caps to reflect what voltages we can handle. Set those + * values in the CAPA register. The manual says that these values can + * only be set once, "before initialization" whatever that means, and + * that they survive a reset. So maybe doing this will be a no-op if + * u-boot has already initialized the hardware. + */ + regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); + if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) + regval |= MMCHS_SD_CAPA_VS18; + if (sc->slot.host.caps & (MMC_OCR_290_300 | MMC_OCR_300_310)) + regval |= MMCHS_SD_CAPA_VS30; + ti_mmchs_write_4(sc, MMCHS_SD_CAPA, regval); + /* Set initial host configuration (1-bit, std speed, pwr off). */ ti_sdhci_write_1(dev, NULL, SDHCI_HOST_CONTROL, 0); ti_sdhci_write_1(dev, NULL, SDHCI_POWER_CONTROL, 0); @@ -378,7 +413,8 @@ ti_sdhci_attach(device_t dev) /* * Get the MMCHS device id from FDT. If it's not there use the newbus * unit number (which will work as long as the devices are in order and - * none are skipped in the fdt). + * none are skipped in the fdt). Note that this is a property we made + * up and added in freebsd, it doesn't exist in the published bindings. */ node = ofw_bus_get_node(dev); if ((OF_getprop(node, "mmchs-device-id", &prop, sizeof(prop))) <= 0) { @@ -388,7 +424,23 @@ ti_sdhci_attach(device_t dev) } else sc->mmchs_device_id = fdt32_to_cpu(prop); - /* See if we've got a GPIO-based write detect pin. */ + /* + * The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first + * device, and only 1p8v on other devices unless an external transceiver + * is used. The only way we could know about a transceiver is fdt data. + * Note that we have to do this before calling ti_sdhci_hw_init() so + * that it can set the right values in the CAPA register, which can only + * be done once and never reset. + */ + sc->slot.host.host_ocr |= MMC_OCR_LOW_VOLTAGE; + if (sc->mmchs_device_id == 0 || OF_hasprop(node, "ti,dual-volt")) { + sc->slot.host.host_ocr |= MMC_OCR_290_300 | MMC_OCR_300_310; + } + + /* + * See if we've got a GPIO-based write detect pin. This is not the + * standard documented property for this, we added it in freebsd. + */ if ((OF_getprop(node, "mmchs-wp-gpio-pin", &prop, sizeof(prop))) <= 0) sc->wp_gpio_pin = 0xffffffff; else @@ -406,10 +458,6 @@ ti_sdhci_attach(device_t dev) /* * Set the offset from the device's memory start to the MMCHS registers. - * - * XXX A better way to handle this would be to have separate memory - * resources for the sdhci registers and the mmchs registers. That - * requires changing everyone's DTS files. */ if (ti_chip() == CHIP_OMAP_3) sc->mmchs_reg_off = OMAP3_MMCHS_REG_OFFSET; @@ -482,14 +530,35 @@ ti_sdhci_attach(device_t dev) */ sc->slot.quirks |= SDHCI_QUIRK_BROKEN_DMA; - /* Set up the hardware and go. */ + /* + * Set up the hardware and go. Note that this sets many of the + * slot.host.* fields, so we have to do this before overriding any of + * those values based on fdt data, below. + */ sdhci_init_slot(dev, &sc->slot, 0); /* - * The SDHCI controller doesn't realize it, but we support 8-bit even - * though we're not a v3.0 controller. Advertise the ability. - */ - sc->slot.host.caps |= MMC_CAP_8_BIT_DATA; + * The SDHCI controller doesn't realize it, but we can support 8-bit + * even though we're not a v3.0 controller. If there's an fdt bus-width + * property, honor it. + */ + if (OF_getencprop(node, "bus-width", &prop, sizeof(prop)) > 0) { + sc->slot.host.caps &= ~(MMC_CAP_4_BIT_DATA | + MMC_CAP_8_BIT_DATA); + switch (prop) { + case 8: + sc->slot.host.caps |= MMC_CAP_8_BIT_DATA; + /* FALLTHROUGH */ + case 4: + sc->slot.host.caps |= MMC_CAP_4_BIT_DATA; + break; + case 1: + break; + default: + device_printf(dev, "Bad bus-width value %u\n", prop); + break; + } + } bus_generic_probe(dev); bus_generic_attach(dev); @@ -513,13 +582,12 @@ static int ti_sdhci_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "ti,mmchs")) { - return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "TI MMCHS (SDHCI 2.0)"); + return (BUS_PROBE_DEFAULT); } - device_set_desc(dev, "TI MMCHS (SDHCI 2.0)"); - - return (BUS_PROBE_DEFAULT); + return (ENXIO); } static device_method_t ti_sdhci_methods[] = { Modified: stable/10/sys/boot/fdt/dts/am335x.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/am335x.dtsi Fri Dec 13 22:41:57 2013 (r259355) +++ stable/10/sys/boot/fdt/dts/am335x.dtsi Fri Dec 13 22:46:10 2013 (r259356) @@ -163,16 +163,17 @@ }; mmchs0@48060000 { - compatible = "ti,mmchs"; + compatible = "ti,omap3-hsmmc", "ti,mmchs"; reg =<0x48060000 0x1000 >; interrupts = <64>; interrupt-parent = <&AINTC>; mmchs-device-id = <0>; mmchs-wp-gpio-pin = <0xffffffff>; + ti,dual-volt; }; mmchs1@481D8000 { - compatible = "ti,mmchs"; + compatible = "ti,omap3-hsmmc", "ti,mmchs"; reg =<0x481D8000 0x1000 >; interrupts = <28>; interrupt-parent = <&AINTC>; Modified: stable/10/sys/boot/fdt/dts/beaglebone-black.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/beaglebone-black.dts Fri Dec 13 22:41:57 2013 (r259355) +++ stable/10/sys/boot/fdt/dts/beaglebone-black.dts Fri Dec 13 22:46:10 2013 (r259356) @@ -134,6 +134,7 @@ }; mmchs1@481D8000 { + bus-width = <8>; status = "okay"; }; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:48:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E7301FA; Fri, 13 Dec 2013 22:48:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5A0021631; Fri, 13 Dec 2013 22:48:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMm2jv059442; Fri, 13 Dec 2013 22:48:02 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMm1Mw059438; Fri, 13 Dec 2013 22:48:01 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132248.rBDMm1Mw059438@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:48:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259357 - stable/10/sys/dev/uart X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:48:02 -0000 Author: ian Date: Fri Dec 13 22:48:01 2013 New Revision: 259357 URL: http://svnweb.freebsd.org/changeset/base/259357 Log: MFC r257556: Arrange for uart_cpu_fdt's probe() routine to use the same table of compat strings as uart_bus_fdt's probe(). Modified: stable/10/sys/dev/uart/uart.h stable/10/sys/dev/uart/uart_bus_fdt.c stable/10/sys/dev/uart/uart_cpu_fdt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart.h ============================================================================== --- stable/10/sys/dev/uart/uart.h Fri Dec 13 22:46:10 2013 (r259356) +++ stable/10/sys/dev/uart/uart.h Fri Dec 13 22:48:01 2013 (r259357) @@ -76,6 +76,11 @@ extern struct uart_class uart_pl011_clas extern struct uart_class uart_cdnc_class __attribute__((weak)); extern struct uart_class uart_ti8250_class __attribute__((weak)); +#ifdef FDT +struct ofw_compat_data; +extern const struct ofw_compat_data *uart_fdt_compat_data; +#endif + #ifdef PC98 struct uart_class *uart_pc98_getdev(u_long port); #endif Modified: stable/10/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- stable/10/sys/dev/uart/uart_bus_fdt.c Fri Dec 13 22:46:10 2013 (r259356) +++ stable/10/sys/dev/uart/uart_bus_fdt.c Fri Dec 13 22:48:01 2013 (r259357) @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include @@ -85,6 +87,9 @@ static struct ofw_compat_data compat_dat {NULL, (uintptr_t)NULL}, }; +/* Export the compat_data table for use by the uart_cpu_fdt.c probe routine. */ +const struct ofw_compat_data *uart_fdt_compat_data = compat_data; + static int uart_fdt_get_clock(phandle_t node, pcell_t *cell) { Modified: stable/10/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- stable/10/sys/dev/uart/uart_cpu_fdt.c Fri Dec 13 22:46:10 2013 (r259356) +++ stable/10/sys/dev/uart/uart_cpu_fdt.c Fri Dec 13 22:48:01 2013 (r259357) @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include @@ -93,6 +95,7 @@ int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { char buf[64]; + const struct ofw_compat_data *cd; struct uart_class *class; phandle_t node, chosen; pcell_t shift, br, rclk; @@ -139,22 +142,13 @@ uart_cpu_getdev(int devtype, struct uart /* * Finalize configuration. */ - if (fdt_is_compatible(node, "fsl,imx-uart")) - class = &uart_imx_class; - else if (fdt_is_compatible(node, "quicc")) - class = &uart_quicc_class; - else if (fdt_is_compatible(node, "lpc")) - class = &uart_lpc_class; - else if (fdt_is_compatible(node, "arm,pl011")) - class = &uart_pl011_class; - else if (fdt_is_compatible(node, "exynos")) - class = &uart_s3c2410_class; - else if (fdt_is_compatible(node, "cadence,uart")) - class = &uart_cdnc_class; - else if (fdt_is_compatible(node, "ti,ns16550")) - class = &uart_ti8250_class; - else if (fdt_is_compatible(node, "ns16550")) - class = &uart_ns8250_class; + for (cd = uart_fdt_compat_data; cd->ocd_str != NULL; ++cd) { + if (fdt_is_compatible(node, cd->ocd_str)) + break; + } + if (cd->ocd_str == NULL) + return (ENXIO); + class = (struct uart_class *)cd->ocd_data; di->bas.chan = 0; di->bas.regshft = (u_int)shift; From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:49:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B12F379; Fri, 13 Dec 2013 22:49:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 166481640; Fri, 13 Dec 2013 22:49:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMnIwi059618; Fri, 13 Dec 2013 22:49:18 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMnITd059616; Fri, 13 Dec 2013 22:49:18 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132249.rBDMnITd059616@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:49:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259358 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:49:19 -0000 Author: ian Date: Fri Dec 13 22:49:18 2013 New Revision: 259358 URL: http://svnweb.freebsd.org/changeset/base/259358 Log: MFC r257557: Add a missing register definition. Modified: stable/10/sys/arm/freescale/imx/imx6_anatopreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx6_anatopreg.h ============================================================================== --- stable/10/sys/arm/freescale/imx/imx6_anatopreg.h Fri Dec 13 22:48:01 2013 (r259357) +++ stable/10/sys/arm/freescale/imx/imx6_anatopreg.h Fri Dec 13 22:49:18 2013 (r259358) @@ -81,6 +81,17 @@ #define IMX6_ANALOG_CCM_PFD_528_SET 0x104 #define IMX6_ANALOG_CCM_PFD_528_CLR 0x108 #define IMX6_ANALOG_CCM_PFD_528_TOG 0x10C +#define IMX6_ANALOG_PMU_REG_CORE 0x140 +#define IMX6_ANALOG_PMU_REG2_TARG_SHIFT 18 +#define IMX6_ANALOG_PMU_REG2_TARG_MASK \ + (0x1f << IMX6_ANALOG_PMU_REG2_TARG_SHIFT) +#define IMX6_ANALOG_PMU_REG1_TARG_SHIFT 9 +#define IMX6_ANALOG_PMU_REG1_TARG_MASK \ + (0x1f << IMX6_ANALOG_PMU_REG1_TARG_SHIFT) +#define IMX6_ANALOG_PMU_REG0_TARG_SHIFT 0 +#define IMX6_ANALOG_PMU_REG0_TARG_MASK \ + (0x1f << IMX6_ANALOG_PMU_REG0_TARG_SHIFT) + #define IMX6_ANALOG_CCM_MISC0 0x150 #define IMX6_ANALOG_CCM_MISC0_SET 0x154 #define IMX6_ANALOG_CCM_MISC0_CLR 0x158 From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:50:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A791506; Fri, 13 Dec 2013 22:50:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 763351650; Fri, 13 Dec 2013 22:50:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMoDKe059829; Fri, 13 Dec 2013 22:50:13 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMoDvt059828; Fri, 13 Dec 2013 22:50:13 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132250.rBDMoDvt059828@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259359 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:50:13 -0000 Author: ian Date: Fri Dec 13 22:50:12 2013 New Revision: 259359 URL: http://svnweb.freebsd.org/changeset/base/259359 Log: MFC r257561: Bugfix: the attach routine needs to use the same table of fdt compat strings that the probe routine used. Modified: stable/10/sys/arm/freescale/imx/imx_sdhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx_sdhci.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_sdhci.c Fri Dec 13 22:49:18 2013 (r259358) +++ stable/10/sys/arm/freescale/imx/imx_sdhci.c Fri Dec 13 22:50:12 2013 (r259359) @@ -558,13 +558,9 @@ imx_sdhci_attach(device_t dev) sc->dev = dev; - if (ofw_bus_is_compatible(dev, "fsl,imx51-esdhc")) { - sc->hwtype = HWTYPE_ESDHC; - } else if (ofw_bus_is_compatible(dev, "fsl,imx-usdhc")) { - sc->hwtype = HWTYPE_USDHC; - } else { + sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (sc->hwtype == HWTYPE_NONE) panic("Impossible: not compatible in imx_sdhci_attach()"); - } rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:51:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D454E67C; Fri, 13 Dec 2013 22:51:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A64D616A2; Fri, 13 Dec 2013 22:51:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMp93m062294; Fri, 13 Dec 2013 22:51:09 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMp9DF062293; Fri, 13 Dec 2013 22:51:09 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132251.rBDMp9DF062293@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259360 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:51:09 -0000 Author: ian Date: Fri Dec 13 22:51:09 2013 New Revision: 259360 URL: http://svnweb.freebsd.org/changeset/base/259360 Log: MFC r257595: Comments and style(9) only, no functional changes. Modified: stable/10/sys/arm/freescale/imx/imx_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_machdep.c Fri Dec 13 22:50:12 2013 (r259359) +++ stable/10/sys/arm/freescale/imx/imx_machdep.c Fri Dec 13 22:51:09 2013 (r259360) @@ -158,34 +158,33 @@ bus_dma_get_range_nb(void) return (0); } +/* + * This code which manipulates the watchdog hardware is here to implement + * cpu_reset() because the watchdog is the only way for software to reset the + * chip. Why here and not in imx_wdog.c? Because there's no requirement that + * the watchdog driver be compiled in, but it's nice to be able to reboot even + * if it's not. + */ void imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr) { + const struct pmap_devmap *pd; + volatile uint16_t * pcr; /* - * This code which manipulates the watchdog hardware is here to - * implement cpu_reset() because the watchdog is the only way for - * software to reset the chip. Why here and not in imx_wdog.c? Because - * there's no requirement that the watchdog driver be compiled in, but - * it's nice to be able to reboot even if it's not. + * The deceptively simple write of WDOG_CR_WDE enables the watchdog, + * sets the timeout to its minimum value (half a second), and also + * clears the SRS bit which results in the SFTW (software-requested + * reset) bit being set in the watchdog status register after the reset. + * This is how software can distinguish a reset from a wdog timeout. */ - volatile uint16_t * pcr; - const struct pmap_devmap *pd; - if ((pd = pmap_devmap_find_pa(wdcr_physaddr, 2)) == NULL) { printf("cpu_reset() can't find its control register... locking up now."); } else { pcr = (uint16_t *)(pd->pd_va + (wdcr_physaddr - pd->pd_pa)); - /* - * This deceptively simple write enables the watchdog, sets the timeout - * to its minimum value (half a second), and also clears the SRS bit - * which results in the SFTW (software-requested reset) bit being set in - * the watchdog status register after the reset. This is how software - * can distinguish a requested reset from a wdog timeout. - */ *pcr = WDOG_CR_WDE; } - while (1) + for (;;) continue; } From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 22:53:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C089386E; Fri, 13 Dec 2013 22:53:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9E6CA16B9; Fri, 13 Dec 2013 22:53:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDMr0Gh062541; Fri, 13 Dec 2013 22:53:00 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDMqxo6062526; Fri, 13 Dec 2013 22:52:59 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132252.rBDMqxo6062526@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 22:52:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259361 - stable/10/sys/arm/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 22:53:00 -0000 Author: ian Date: Fri Dec 13 22:52:59 2013 New Revision: 259361 URL: http://svnweb.freebsd.org/changeset/base/259361 Log: MFC r257603, r257604: Rename WANDBOARD-COMMON to WANDBOARD.common and adjust the configs that include it accordingly. The build machinery for universe and tinderbox tries to build every kernel config whose name begins and ends with [A-Z0-9] and the common include file that has most of the options isn't buildable by itself, so the new lowercase .common will avoid building it. Added: stable/10/sys/arm/conf/WANDBOARD.common - copied unchanged from r257603, head/sys/arm/conf/WANDBOARD.common Deleted: stable/10/sys/arm/conf/WANDBOARD-COMMON Modified: stable/10/sys/arm/conf/WANDBOARD-DUAL stable/10/sys/arm/conf/WANDBOARD-QUAD stable/10/sys/arm/conf/WANDBOARD-SOLO Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/WANDBOARD-DUAL ============================================================================== --- stable/10/sys/arm/conf/WANDBOARD-DUAL Fri Dec 13 22:51:09 2013 (r259360) +++ stable/10/sys/arm/conf/WANDBOARD-DUAL Fri Dec 13 22:52:59 2013 (r259361) @@ -17,7 +17,7 @@ # # $FreeBSD$ -include WANDBOARD-COMMON +include "WANDBOARD.common" ident WANDBOARD-DUAL # Flattened Device Tree Modified: stable/10/sys/arm/conf/WANDBOARD-QUAD ============================================================================== --- stable/10/sys/arm/conf/WANDBOARD-QUAD Fri Dec 13 22:51:09 2013 (r259360) +++ stable/10/sys/arm/conf/WANDBOARD-QUAD Fri Dec 13 22:52:59 2013 (r259361) @@ -17,7 +17,7 @@ # # $FreeBSD$ -include WANDBOARD-COMMON +include "WANDBOARD.common" ident WANDBOARD-QUAD # Flattened Device Tree Modified: stable/10/sys/arm/conf/WANDBOARD-SOLO ============================================================================== --- stable/10/sys/arm/conf/WANDBOARD-SOLO Fri Dec 13 22:51:09 2013 (r259360) +++ stable/10/sys/arm/conf/WANDBOARD-SOLO Fri Dec 13 22:52:59 2013 (r259361) @@ -17,7 +17,7 @@ # # $FreeBSD$ -include WANDBOARD-COMMON +include "WANDBOARD.common" ident WANDBOARD-SOLO # Flattened Device Tree Copied: stable/10/sys/arm/conf/WANDBOARD.common (from r257603, head/sys/arm/conf/WANDBOARD.common) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/conf/WANDBOARD.common Fri Dec 13 22:52:59 2013 (r259361, copy of r257603, head/sys/arm/conf/WANDBOARD.common) @@ -0,0 +1,155 @@ +# Kernel configuration for Wandboard +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +include "../freescale/imx/std.imx6" + +options HZ=250 # Scheduling quantum is 4 milliseconds. +options SCHED_4BSD # 4BSD scheduler +options PREEMPTION # Enable kernel thread preemption +options INET # InterNETworking +options INET6 # IPv6 communications protocols +#options SCTP # Stream Control Transmission Protocol +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options UFS_GJOURNAL # Enable gjournal-based UFS journaling +#options MD_ROOT # MD is a potential root device +options NFSCL # New Network Filesystem Client +#options NFSD # New Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCL +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +#options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options TMPFS # TMP Memory Filesystem +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Provides labelization +options KTRACE # ktrace(1) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options INCLUDE_CONFIG_FILE # Include this file in kernel + +# Debugging support. Always need this: +options KDB # Enable kernel debugger support. +# For minimum debugger support use KDB_TRACE, for interactive use DDB. +#options KDB_TRACE # Print a stack trace for a panic. +options DDB # Support DDB. +# For full debugger support use this instead: +#options GDB # Support remote GDB. +# Other debugging options... +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +options ALT_BREAK_TO_DEBUGGER # Use to enter debugger. +#options DEBUG +#options DEADLKRES # Enable the deadlock resolver +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles + +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device vlan # 802.1Q VLAN support +device tun # Packet tunnel. +device md # Memory "disks" +#device gif # IPv6 and IPv4 tunneling +#device faith # IPv6-to-IPv4 relaying (translation) +#device firmware # firmware assist module +device ether # Ethernet support +device miibus # Required for ethernet + +# Serial (COM) ports +device uart # Multi-uart driver + +#device iomux # IO Multiplexor + +# SCSI peripherals +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) +device cd # CD +device pass # Passthrough device (direct SCSI access) + +# USB support +#options USB_DEBUG # enable debug msgs +options USB_HOST_ALIGN=32 # Required for ARM, set to cache line size. +device ehci # OHCI USB interface +device usb # USB Bus (required) +device umass # Disks/Mass storage - Requires scbus and da +device uhid # "Human Interface Devices" +device u3g # USB modems + +# USB Ethernet, requires miibus +#device aue # ADMtek USB Ethernet +#device axe # ASIX Electronics USB Ethernet +#device cdce # Generic USB over Ethernet +#device cue # CATC USB Ethernet +#device kue # Kawasaki LSI USB Ethernet +#device rue # RealTek RTL8150 USB Ethernet +#device udav # Davicom DM9601E USB + +# USB Wireless +#device rum # Ralink Technology RT2501USB wireless NICs + +# Watchdog timer. +# WARNING: can't be disabled!!! +#device imxwdt # Watchdog + +# Wireless NIC cards +#device wlan # 802.11 support +#device wlan_wep # 802.11 WEP support +#device wlan_ccmp # 802.11 CCMP support +#device wlan_tkip # 802.11 TKIP support +#device wlan_amrr # AMRR transmit rate control algorithm + +# NOTE: serial console will be disabled if syscons enabled +# Uncomment following lines for framebuffer/syscons support +# Wandboard has no video console support yet. +#device sc +#device kbdmux +#options SC_DFLT_FONT # compile font in +#makeoptions SC_DFLT_FONT=cp437 +#device ukbd # Allow keyboard like HIDs to control console +#device ums + +# required for netbooting +#options BOOTP +#options BOOTP_COMPAT +#options BOOTP_NFSROOT +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ffec0 + +# U-Boot stuff lives on slice 1, FreeBSD on slice 2. +options ROOTDEVNAME=\"ufs:mmcsd0s2a\" + +#device fsliic # Freescale i2c/iic (not ready yet) +#device iic # iic protocol +#device iicbus # iic bus + +device sdhci # SD controller +device mmc # SD/MMC protocol +device mmcsd # SDCard disk device + +device ffec # Freescale Fast Ethernet Controller + From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 23:07:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8790DEA2; Fri, 13 Dec 2013 23:07:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 732A017A6; Fri, 13 Dec 2013 23:07:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDN7NqY066957; Fri, 13 Dec 2013 23:07:23 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDN7NIA066954; Fri, 13 Dec 2013 23:07:23 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132307.rBDN7NIA066954@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 23:07:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259363 - stable/10/sys/arm/s3c2xx0 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 23:07:23 -0000 Author: ian Date: Fri Dec 13 23:07:22 2013 New Revision: 259363 URL: http://svnweb.freebsd.org/changeset/base/259363 Log: MFC r257639: Remove the duplicated implementations of some bus_space functions and use the essentially identical generic implementations instead. The generic implementations differ only in the spelling of a couple variable names and some formatting differences. Modified: stable/10/sys/arm/s3c2xx0/files.s3c2xx0 stable/10/sys/arm/s3c2xx0/s3c2xx0_space.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/s3c2xx0/files.s3c2xx0 ============================================================================== --- stable/10/sys/arm/s3c2xx0/files.s3c2xx0 Fri Dec 13 22:58:57 2013 (r259362) +++ stable/10/sys/arm/s3c2xx0/files.s3c2xx0 Fri Dec 13 23:07:22 2013 (r259363) @@ -1,4 +1,6 @@ # $FreeBSD$ +arm/arm/bus_space_asm_generic.S standard +arm/arm/bus_space_generic.c standard arm/arm/cpufunc_asm_arm9.S standard arm/arm/irq_dispatch.S standard arm/s3c2xx0/board_ln2410sbc.c optional board_ln2410sbc Modified: stable/10/sys/arm/s3c2xx0/s3c2xx0_space.c ============================================================================== --- stable/10/sys/arm/s3c2xx0/s3c2xx0_space.c Fri Dec 13 22:58:57 2013 (r259362) +++ stable/10/sys/arm/s3c2xx0/s3c2xx0_space.c Fri Dec 13 23:07:22 2013 (r259363) @@ -89,7 +89,6 @@ __FBSDID("$FreeBSD$"); #include /* Prototypes for all the bus_space structure functions */ -bs_protos(s3c2xx0); bs_protos(generic); bs_protos(generic_armv4); @@ -98,16 +97,16 @@ struct bus_space s3c2xx0_bs_tag = { (void *) 0, /* mapping/unmapping */ - s3c2xx0_bs_map, - s3c2xx0_bs_unmap, - s3c2xx0_bs_subregion, + generic_bs_map, + generic_bs_unmap, + generic_bs_subregion, /* allocation/deallocation */ - s3c2xx0_bs_alloc, /* not implemented */ - s3c2xx0_bs_free, /* not implemented */ + generic_bs_alloc, /* not implemented */ + generic_bs_free, /* not implemented */ /* barrier */ - s3c2xx0_bs_barrier, + generic_bs_barrier, /* read (single) */ generic_bs_r_1, @@ -164,87 +163,3 @@ struct bus_space s3c2xx0_bs_tag = { NULL, }; -int -s3c2xx0_bs_map(void *t, bus_addr_t bpa, bus_size_t size, - int flag, bus_space_handle_t * bshp) -{ - u_long startpa, endpa, pa; - vm_offset_t va; - pt_entry_t *pte; - const struct pmap_devmap *pd; - - if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) { - /* Device was statically mapped. */ - *bshp = pd->pd_va + (bpa - pd->pd_pa); - return 0; - } - - startpa = trunc_page(bpa); - endpa = round_page(bpa + size); - - va = kva_alloc(endpa - startpa); - if (!va) - return (ENOMEM); - - *bshp = (bus_space_handle_t) (va + (bpa - startpa)); - - for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { - pmap_kenter(va, pa); - pte = vtopte(va); - if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) - *pte &= ~L2_S_CACHE_MASK; - } - return (0); -} - -void -s3c2xx0_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size) -{ - vm_offset_t va, endva, origva; - - if (pmap_devmap_find_va((vm_offset_t)h, size) != NULL) { - /* Device was statically mapped; nothing to do. */ - return; - } - - endva = round_page((vm_offset_t)h + size); - origva = va = trunc_page((vm_offset_t)h); - - while (va < endva) { - pmap_kremove(va); - va += PAGE_SIZE; - } - kva_free(origva, endva - origva); -} - -int -s3c2xx0_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, - bus_size_t size, bus_space_handle_t * nbshp) -{ - - *nbshp = bsh + offset; - return (0); -} - -void -s3c2xx0_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset, - bus_size_t len, int flags) -{ - - /* Nothing to do. */ -} - -int -s3c2xx0_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, - bus_size_t size, bus_size_t alignment, bus_size_t boundary, - int flags, bus_addr_t * bpap, bus_space_handle_t * bshp) -{ - - panic("s3c2xx0_io_bs_alloc(): not implemented\n"); -} - -void -s3c2xx0_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) -{ - panic("s3c2xx0_io_bs_free(): not implemented\n"); -} From owner-svn-src-stable@FreeBSD.ORG Fri Dec 13 23:56:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB9345A0; Fri, 13 Dec 2013 23:56:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D31A91CC8; Fri, 13 Dec 2013 23:56:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDNuwVi086452; Fri, 13 Dec 2013 23:56:58 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDNusQE086420; Fri, 13 Dec 2013 23:56:54 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312132356.rBDNusQE086420@svn.freebsd.org> From: Ian Lepore Date: Fri, 13 Dec 2013 23:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259364 - in stable/10/sys: arm/allwinner arm/arm arm/at91 arm/broadcom/bcm2835 arm/econa arm/freescale/imx arm/include arm/lpc arm/mv arm/rockchip arm/s3c2xx0 arm/sa11x0 arm/samsung/ex... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 23:56:59 -0000 Author: ian Date: Fri Dec 13 23:56:53 2013 New Revision: 259364 URL: http://svnweb.freebsd.org/changeset/base/259364 Log: MFC r257648, r257649, r257660: Begin reducing code duplication in arm pmap.c and pmap-v6.c by factoring out common code related to mapping device memory into a new devmap.c file. Remove the growing duplication of code that used pmap_devmap_find_pa() and then did some math with the returned results to generate a virtual address, and likewise in reverse to get a physical address. Now there are a pair of functions, arm_devmap_vtop() and arm_devmap_ptov(), to do that. The bus_space_map() implementations are rewritten in terms of these. Move remaining code and data related to static device mapping into the new devmap.[ch] files. Emphasize the MD nature of these things by using the prefix arm_devmap_ on the function and type names (already a few of these things found their way into MI code, hopefully it will be harder to do by accident in the future). Added: stable/10/sys/arm/arm/devmap.c - copied, changed from r257648, head/sys/arm/arm/devmap.c stable/10/sys/arm/include/devmap.h - copied, changed from r257648, head/sys/arm/include/devmap.h Modified: stable/10/sys/arm/allwinner/a10_machdep.c stable/10/sys/arm/arm/bus_space_generic.c stable/10/sys/arm/arm/machdep.c stable/10/sys/arm/arm/pmap-v6.c stable/10/sys/arm/arm/pmap.c stable/10/sys/arm/at91/at91.c stable/10/sys/arm/at91/at91_machdep.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/10/sys/arm/econa/econa_machdep.c stable/10/sys/arm/freescale/imx/imx6_machdep.c stable/10/sys/arm/freescale/imx/imx_machdep.c stable/10/sys/arm/include/fdt.h stable/10/sys/arm/include/machdep.h stable/10/sys/arm/include/pmap.h stable/10/sys/arm/lpc/lpc_machdep.c stable/10/sys/arm/mv/mv_localbus.c stable/10/sys/arm/mv/mv_machdep.c stable/10/sys/arm/mv/mvvar.h stable/10/sys/arm/rockchip/rk30xx_machdep.c stable/10/sys/arm/s3c2xx0/s3c24x0_machdep.c stable/10/sys/arm/sa11x0/assabet_machdep.c stable/10/sys/arm/samsung/exynos/exynos5_machdep.c stable/10/sys/arm/tegra/tegra2_machdep.c stable/10/sys/arm/ti/ti_machdep.c stable/10/sys/arm/versatile/versatile_machdep.c stable/10/sys/arm/xilinx/zy7_machdep.c stable/10/sys/arm/xscale/i80321/ep80219_machdep.c stable/10/sys/arm/xscale/i80321/iq31244_machdep.c stable/10/sys/arm/xscale/i8134x/crb_machdep.c stable/10/sys/arm/xscale/ixp425/avila_machdep.c stable/10/sys/arm/xscale/pxa/pxa_machdep.c stable/10/sys/conf/files.arm stable/10/sys/dev/fdt/fdt_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/allwinner/a10_machdep.c ============================================================================== --- stable/10/sys/arm/allwinner/a10_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/allwinner/a10_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -71,7 +72,7 @@ initarm_late_init(void) } #define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) -static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { +static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } }; @@ -91,7 +92,7 @@ platform_devmap_init(void) i++; - pmap_devmap_bootstrap_table = &fdt_devmap[0]; + arm_devmap_register_table(&fdt_devmap[0]); return (0); } Modified: stable/10/sys/arm/arm/bus_space_generic.c ============================================================================== --- stable/10/sys/arm/arm/bus_space_generic.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/arm/bus_space_generic.c Fri Dec 13 23:56:53 2013 (r259364) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include /* Prototypes for all the bus_space structure functions */ bs_protos(generic); @@ -58,36 +59,20 @@ int generic_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) { - const struct pmap_devmap *pd; - vm_paddr_t startpa, endpa, pa, offset; - vm_offset_t va; - pt_entry_t *pte; - - if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) { - /* Device was statically mapped. */ - *bshp = pd->pd_va + (bpa - pd->pd_pa); - return (0); - } - - endpa = round_page(bpa + size); - offset = bpa & PAGE_MASK; - startpa = trunc_page(bpa); - - va = kva_alloc(endpa - startpa); - if (va == 0) - return (ENOMEM); - - *bshp = va + offset; - - for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { - pmap_kenter(va, pa); - pte = vtopte(va); - if (!(flags & BUS_SPACE_MAP_CACHEABLE)) { - *pte &= ~L2_S_CACHE_MASK; - PTE_SYNC(pte); - } - } + void *va; + /* + * Look up the address in the static device mappings. If it's not + * there, establish a new dynamic mapping. + * + * We don't even examine the passed-in flags. For ARM, the CACHEABLE + * flag doesn't make sense (we create PTE_DEVICE mappings), and the + * LINEAR flag is just implied because we use kva_alloc(size). + */ + if ((va = arm_devmap_ptov(bpa, size)) == NULL) + if ((va = pmap_mapdev(bpa, size)) == NULL) + return (ENOMEM); + *bshp = (bus_space_handle_t)va; return (0); } @@ -104,21 +89,13 @@ generic_bs_alloc(void *t, bus_addr_t rst void generic_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size) { - vm_offset_t va, endva, origva; - if (pmap_devmap_find_va((vm_offset_t)h, size) != NULL) { - /* Device was statically mapped; nothing to do. */ - return; - } - - endva = round_page((vm_offset_t)h + size); - origva = va = trunc_page((vm_offset_t)h); - - while (va < endva) { - pmap_kremove(va); - va += PAGE_SIZE; - } - kva_free(origva, endva - origva); + /* + * If the region is static-mapped do nothing, otherwise remove the + * dynamic mapping. + */ + if (arm_devmap_vtop((void*)h, size) == DEVMAP_PADDR_NOTFOUND) + pmap_unmapdev((vm_offset_t)h, size); } void Copied and modified: stable/10/sys/arm/arm/devmap.c (from r257648, head/sys/arm/arm/devmap.c) ============================================================================== --- head/sys/arm/arm/devmap.c Mon Nov 4 19:44:37 2013 (r257648, copy source) +++ stable/10/sys/arm/arm/devmap.c Fri Dec 13 23:56:53 2013 (r259364) @@ -38,18 +38,42 @@ __FBSDID("$FreeBSD$"); #include #include -static const struct pmap_devmap *devmap_table; +static const struct arm_devmap_entry *devmap_table; /* - * Map all of the static regions in the devmap table, and remember - * the devmap table so other parts of the kernel can do lookups later. + * Register the given table as the one to use in arm_devmap_bootstrap(). */ void -pmap_devmap_bootstrap(vm_offset_t l1pt, const struct pmap_devmap *table) +arm_devmap_register_table(const struct arm_devmap_entry *table) { - const struct pmap_devmap *pd; devmap_table = table; +} + +/* + * Map all of the static regions in the devmap table, and remember the devmap + * table so the mapdev, ptov, and vtop functions can do lookups later. + * + * If a non-NULL table pointer is given it is used unconditionally, otherwise + * the previously-registered table is used. This smooths transition from legacy + * code that fills in a local table then calls this function passing that table, + * and newer code that uses arm_devmap_register_table() in platform-specific + * code, then lets the common initarm() call this function with a NULL pointer. + */ +void +arm_devmap_bootstrap(vm_offset_t l1pt, const struct arm_devmap_entry *table) +{ + const struct arm_devmap_entry *pd; + + /* + * If given a table pointer, use it, else ensure a table was previously + * registered. This happens early in boot, and there's a good chance + * the panic message won't be seen, but there's not much we can do. + */ + if (table != NULL) + devmap_table = table; + else if (devmap_table == NULL) + panic("arm_devmap_bootstrap: No devmap table registered."); for (pd = devmap_table; pd->pd_size != 0; ++pd) { pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size, @@ -64,7 +88,7 @@ pmap_devmap_bootstrap(vm_offset_t l1pt, void * arm_devmap_ptov(vm_paddr_t pa, vm_size_t size) { - const struct pmap_devmap *pd; + const struct arm_devmap_entry *pd; if (devmap_table == NULL) return (NULL); @@ -84,7 +108,7 @@ arm_devmap_ptov(vm_paddr_t pa, vm_size_t vm_paddr_t arm_devmap_vtop(void * vpva, vm_size_t size) { - const struct pmap_devmap *pd; + const struct arm_devmap_entry *pd; vm_offset_t va; if (devmap_table == NULL) Modified: stable/10/sys/arm/arm/machdep.c ============================================================================== --- stable/10/sys/arm/arm/machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/arm/machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -158,7 +159,6 @@ struct pv_addr undstack; struct pv_addr abtstack; static struct pv_addr kernelstack; -const struct pmap_devmap *pmap_devmap_bootstrap_table; #endif #if defined(LINUX_BOOT_ABI) @@ -1417,7 +1417,7 @@ initarm(struct arm_boot_params *abp) /* Map pmap_devmap[] entries */ err_devmap = platform_devmap_init(); - pmap_devmap_bootstrap(l1pagetable, pmap_devmap_bootstrap_table); + arm_devmap_bootstrap(l1pagetable, NULL); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); pmap_pa = kernel_l1pt.pv_pa; Modified: stable/10/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/10/sys/arm/arm/pmap-v6.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/arm/pmap-v6.c Fri Dec 13 23:56:53 2013 (r259364) @@ -137,7 +137,9 @@ /* * Special compilation symbols * PMAP_DEBUG - Build in pmap_debug_level code - */ + * + * Note that pmap_mapdev() and pmap_unmapdev() are implemented in arm/devmap.c +*/ /* Include header files */ #include "opt_vm.h" @@ -2424,6 +2426,17 @@ pmap_kenter_nocache(vm_offset_t va, vm_p } void +pmap_kenter_device(vm_offset_t va, vm_paddr_t pa) +{ + + /* + * XXX - Need a way for kenter_internal to handle PTE_DEVICE mapping as + * a potentially different thing than PTE_NOCACHE. + */ + pmap_kenter_internal(va, pa, 0); +} + +void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa) { @@ -5008,36 +5021,6 @@ pmap_align_superpage(vm_object_t object, { } - -/* - * Map a set of physical memory pages into the kernel virtual - * address space. Return a pointer to where it is mapped. This - * routine is intended to be used for mapping device memory, - * NOT real memory. - */ -void * -pmap_mapdev(vm_offset_t pa, vm_size_t size) -{ - vm_offset_t va, tmpva, offset; - - offset = pa & PAGE_MASK; - size = roundup(size, PAGE_SIZE); - - GIANT_REQUIRED; - - va = kva_alloc(size); - if (!va) - panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); - for (tmpva = va; size > 0;) { - pmap_kenter_internal(tmpva, pa, 0); - size -= PAGE_SIZE; - tmpva += PAGE_SIZE; - pa += PAGE_SIZE; - } - - return ((void *)(va + offset)); -} - /* * pmap_map_section: * @@ -5220,86 +5203,6 @@ pmap_map_chunk(vm_offset_t l1pt, vm_offs } -/********************** Static device map routines ***************************/ - -static const struct pmap_devmap *pmap_devmap_table; - -/* - * Register the devmap table. This is provided in case early console - * initialization needs to register mappings created by bootstrap code - * before pmap_devmap_bootstrap() is called. - */ -void -pmap_devmap_register(const struct pmap_devmap *table) -{ - - pmap_devmap_table = table; -} - -/* - * Map all of the static regions in the devmap table, and remember - * the devmap table so other parts of the kernel can look up entries - * later. - */ -void -pmap_devmap_bootstrap(vm_offset_t l1pt, const struct pmap_devmap *table) -{ - int i; - - pmap_devmap_table = table; - - for (i = 0; pmap_devmap_table[i].pd_size != 0; i++) { -#ifdef VERBOSE_INIT_ARM - printf("devmap: %08x -> %08x @ %08x\n", - pmap_devmap_table[i].pd_pa, - pmap_devmap_table[i].pd_pa + - pmap_devmap_table[i].pd_size - 1, - pmap_devmap_table[i].pd_va); -#endif - pmap_map_chunk(l1pt, pmap_devmap_table[i].pd_va, - pmap_devmap_table[i].pd_pa, - pmap_devmap_table[i].pd_size, - pmap_devmap_table[i].pd_prot, - pmap_devmap_table[i].pd_cache); - } -} - -const struct pmap_devmap * -pmap_devmap_find_pa(vm_paddr_t pa, vm_size_t size) -{ - int i; - - if (pmap_devmap_table == NULL) - return (NULL); - - for (i = 0; pmap_devmap_table[i].pd_size != 0; i++) { - if (pa >= pmap_devmap_table[i].pd_pa && - pa + size <= pmap_devmap_table[i].pd_pa + - pmap_devmap_table[i].pd_size) - return (&pmap_devmap_table[i]); - } - - return (NULL); -} - -const struct pmap_devmap * -pmap_devmap_find_va(vm_offset_t va, vm_size_t size) -{ - int i; - - if (pmap_devmap_table == NULL) - return (NULL); - - for (i = 0; pmap_devmap_table[i].pd_size != 0; i++) { - if (va >= pmap_devmap_table[i].pd_va && - va + size <= pmap_devmap_table[i].pd_va + - pmap_devmap_table[i].pd_size) - return (&pmap_devmap_table[i]); - } - - return (NULL); -} - int pmap_dmap_iscurrent(pmap_t pmap) { Modified: stable/10/sys/arm/arm/pmap.c ============================================================================== --- stable/10/sys/arm/arm/pmap.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/arm/pmap.c Fri Dec 13 23:56:53 2013 (r259364) @@ -134,6 +134,8 @@ /* * Special compilation symbols * PMAP_DEBUG - Build in pmap_debug_level code + * + * Note that pmap_mapdev() and pmap_unmapdev() are implemented in arm/devmap.c */ /* Include header files */ @@ -2842,6 +2844,17 @@ pmap_kenter_nocache(vm_offset_t va, vm_p } void +pmap_kenter_device(vm_offset_t va, vm_paddr_t pa) +{ + + /* + * XXX - Need a way for kenter_internal to handle PTE_DEVICE mapping as + * a potentially different thing than PTE_NOCACHE. + */ + pmap_kenter_internal(va, pa, 0); +} + +void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa) { @@ -4690,36 +4703,6 @@ pmap_align_superpage(vm_object_t object, { } - -/* - * Map a set of physical memory pages into the kernel virtual - * address space. Return a pointer to where it is mapped. This - * routine is intended to be used for mapping device memory, - * NOT real memory. - */ -void * -pmap_mapdev(vm_offset_t pa, vm_size_t size) -{ - vm_offset_t va, tmpva, offset; - - offset = pa & PAGE_MASK; - size = roundup(size, PAGE_SIZE); - - GIANT_REQUIRED; - - va = kva_alloc(size); - if (!va) - panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); - for (tmpva = va; size > 0;) { - pmap_kenter_internal(tmpva, pa, 0); - size -= PAGE_SIZE; - tmpva += PAGE_SIZE; - pa += PAGE_SIZE; - } - - return ((void *)(va + offset)); -} - #define BOOTSTRAP_DEBUG /* @@ -4940,86 +4923,6 @@ pmap_map_chunk(vm_offset_t l1pt, vm_offs } -/********************** Static device map routines ***************************/ - -static const struct pmap_devmap *pmap_devmap_table; - -/* - * Register the devmap table. This is provided in case early console - * initialization needs to register mappings created by bootstrap code - * before pmap_devmap_bootstrap() is called. - */ -void -pmap_devmap_register(const struct pmap_devmap *table) -{ - - pmap_devmap_table = table; -} - -/* - * Map all of the static regions in the devmap table, and remember - * the devmap table so other parts of the kernel can look up entries - * later. - */ -void -pmap_devmap_bootstrap(vm_offset_t l1pt, const struct pmap_devmap *table) -{ - int i; - - pmap_devmap_table = table; - - for (i = 0; pmap_devmap_table[i].pd_size != 0; i++) { -#ifdef VERBOSE_INIT_ARM - printf("devmap: %08x -> %08x @ %08x\n", - pmap_devmap_table[i].pd_pa, - pmap_devmap_table[i].pd_pa + - pmap_devmap_table[i].pd_size - 1, - pmap_devmap_table[i].pd_va); -#endif - pmap_map_chunk(l1pt, pmap_devmap_table[i].pd_va, - pmap_devmap_table[i].pd_pa, - pmap_devmap_table[i].pd_size, - pmap_devmap_table[i].pd_prot, - pmap_devmap_table[i].pd_cache); - } -} - -const struct pmap_devmap * -pmap_devmap_find_pa(vm_paddr_t pa, vm_size_t size) -{ - int i; - - if (pmap_devmap_table == NULL) - return (NULL); - - for (i = 0; pmap_devmap_table[i].pd_size != 0; i++) { - if (pa >= pmap_devmap_table[i].pd_pa && - pa + size <= pmap_devmap_table[i].pd_pa + - pmap_devmap_table[i].pd_size) - return (&pmap_devmap_table[i]); - } - - return (NULL); -} - -const struct pmap_devmap * -pmap_devmap_find_va(vm_offset_t va, vm_size_t size) -{ - int i; - - if (pmap_devmap_table == NULL) - return (NULL); - - for (i = 0; pmap_devmap_table[i].pd_size != 0; i++) { - if (va >= pmap_devmap_table[i].pd_va && - va + size <= pmap_devmap_table[i].pd_va + - pmap_devmap_table[i].pd_size) - return (&pmap_devmap_table[i]); - } - - return (NULL); -} - void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { Modified: stable/10/sys/arm/at91/at91.c ============================================================================== --- stable/10/sys/arm/at91/at91.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/at91/at91.c Fri Dec 13 23:56:53 2013 (r259364) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #define _ARM32_BUS_DMA_PRIVATE #include +#include #include #include @@ -52,7 +53,7 @@ static struct at91_softc *at91_softc; static void at91_eoi(void *); -extern const struct pmap_devmap at91_devmap[]; +extern const struct arm_devmap_entry at91_devmap[]; uint32_t at91_master_clock; @@ -258,7 +259,7 @@ static int at91_attach(device_t dev) { struct at91_softc *sc = device_get_softc(dev); - const struct pmap_devmap *pdevmap; + const struct arm_devmap_entry *pdevmap; int i; at91_softc = sc; Modified: stable/10/sys/arm/at91/at91_machdep.c ============================================================================== --- stable/10/sys/arm/at91/at91_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/at91/at91_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -128,7 +129,7 @@ struct pv_addr abtstack; struct pv_addr kernelstack; /* Static device mappings. */ -const struct pmap_devmap at91_devmap[] = { +const struct arm_devmap_entry at91_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -566,7 +567,7 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); } - pmap_devmap_bootstrap(l1pagetable, at91_devmap); + arm_devmap_bootstrap(l1pagetable, at91_devmap); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); setttb(kernel_l1pt.pv_pa); cpu_tlb_flushID(); Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -93,7 +94,7 @@ initarm_late_init(void) } #define FDT_DEVMAP_MAX (2) // FIXME -static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { +static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } }; @@ -113,7 +114,7 @@ platform_devmap_init(void) fdt_devmap[i].pd_cache = PTE_DEVICE; i++; - pmap_devmap_bootstrap_table = &fdt_devmap[0]; + arm_devmap_register_table(&fdt_devmap[0]); return (0); } Modified: stable/10/sys/arm/econa/econa_machdep.c ============================================================================== --- stable/10/sys/arm/econa/econa_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/econa/econa_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -108,7 +109,7 @@ struct pv_addr abtstack; struct pv_addr kernelstack; /* Static device mappings. */ -static const struct pmap_devmap econa_devmap[] = { +static const struct arm_devmap_entry econa_devmap[] = { { /* * This maps DDR SDRAM @@ -275,7 +276,7 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); } - pmap_devmap_bootstrap(l1pagetable, econa_devmap); + arm_devmap_bootstrap(l1pagetable, econa_devmap); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT); setttb(kernel_l1pt.pv_pa); cpu_tlb_flushID(); Modified: stable/10/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx6_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/freescale/imx/imx6_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -34,9 +34,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include + +#include +#include + #include #include #include @@ -112,7 +115,6 @@ cpu_reset(void) */ u_int imx_soc_type() { - const struct pmap_devmap *pd; uint32_t digprog, hwsoc; uint32_t *pcr; const uint32_t HWSOC_MX6SL = 0x60; @@ -131,10 +133,8 @@ u_int imx_soc_type() IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT; /*printf("digprog = 0x%08x\n", digprog);*/ if (hwsoc == HWSOC_MX6DL) { - pd = pmap_devmap_find_pa(SCU_CONFIG_PHYSADDR, 4); - if (pd != NULL) { - pcr = (uint32_t *)(pd->pd_va + - (SCU_CONFIG_PHYSADDR - pd->pd_pa)); + pcr = arm_devmap_ptov(SCU_CONFIG_PHYSADDR, 4); + if (pcr != NULL) { /*printf("scu config = 0x%08x\n", *pcr);*/ if ((*pcr & 0x03) == 0) { hwsoc = HWSOC_MX6SOLO; Modified: stable/10/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/freescale/imx/imx_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -46,14 +47,14 @@ __FBSDID("$FreeBSD$"); #define IMX_MAX_DEVMAP_ENTRIES 8 -static struct pmap_devmap devmap_entries[IMX_MAX_DEVMAP_ENTRIES]; +static struct arm_devmap_entry devmap_entries[IMX_MAX_DEVMAP_ENTRIES]; static u_int devmap_idx; static vm_offset_t devmap_vaddr = ARM_VECTORS_HIGH; void imx_devmap_addentry(vm_paddr_t pa, vm_size_t sz) { - struct pmap_devmap *m; + struct arm_devmap_entry *m; /* * The last table entry is the all-zeroes end-of-table marker. If we're @@ -102,7 +103,7 @@ initarm_lastaddr(void) */ imx_devmap_init(); - pmap_devmap_bootstrap_table = devmap_entries; + arm_devmap_register_table(devmap_entries); return (devmap_vaddr); } @@ -127,7 +128,7 @@ initarm_gpio_init(void) void initarm_late_init(void) { - struct pmap_devmap *m; + struct arm_devmap_entry *m; /* * We did the static devmap setup earlier, during initarm_lastaddr(), @@ -168,7 +169,6 @@ bus_dma_get_range_nb(void) void imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr) { - const struct pmap_devmap *pd; volatile uint16_t * pcr; /* @@ -178,10 +178,9 @@ imx_wdog_cpu_reset(vm_offset_t wdcr_phys * reset) bit being set in the watchdog status register after the reset. * This is how software can distinguish a reset from a wdog timeout. */ - if ((pd = pmap_devmap_find_pa(wdcr_physaddr, 2)) == NULL) { + if ((pcr = arm_devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { printf("cpu_reset() can't find its control register... locking up now."); } else { - pcr = (uint16_t *)(pd->pd_va + (wdcr_physaddr - pd->pd_pa)); *pcr = WDOG_CR_WDE; } for (;;) Copied and modified: stable/10/sys/arm/include/devmap.h (from r257648, head/sys/arm/include/devmap.h) ============================================================================== --- head/sys/arm/include/devmap.h Mon Nov 4 19:44:37 2013 (r257648, copy source) +++ stable/10/sys/arm/include/devmap.h Fri Dec 13 23:56:53 2013 (r259364) @@ -30,6 +30,33 @@ #define _MACHINE_DEVMAP_H_ /* + * This structure is used by MD code to describe static mappings of devices + * which are established as part of bringing up the MMU early in the boot. + */ +struct arm_devmap_entry { + vm_offset_t pd_va; /* virtual address */ + vm_paddr_t pd_pa; /* physical address */ + vm_size_t pd_size; /* size of region */ + vm_prot_t pd_prot; /* protection code */ + int pd_cache; /* cache attributes */ +}; + +/* + * Register a platform-local table to be bootstrapped by the generic + * initarm() in arm/machdep.c. This is used by newer code that allocates and + * fills in its own local table but does not have its own initarm() routine. + */ +void arm_devmap_register_table(const struct arm_devmap_entry * _table); + +/* + * Directly process a table; called from initarm() of older platforms that don't + * use the generic initarm() in arm/machdep.c. If the table pointer is NULL, + * this will use the table installed previously by arm_devmap_register_table(). + */ +void arm_devmap_bootstrap(vm_offset_t _l1pt, + const struct arm_devmap_entry *_table); + +/* * Routines to translate between virtual and physical addresses within a region * that is static-mapped by the devmap code. If the given address range isn't * static-mapped, then ptov returns NULL and vtop returns DEVMAP_PADDR_NOTFOUND. Modified: stable/10/sys/arm/include/fdt.h ============================================================================== --- stable/10/sys/arm/include/fdt.h Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/include/fdt.h Fri Dec 13 23:56:53 2013 (r259364) @@ -56,8 +56,10 @@ struct mem_region { vm_size_t mr_size; }; -int fdt_localbus_devmap(phandle_t, struct pmap_devmap *, int, int *); -int fdt_pci_devmap(phandle_t, struct pmap_devmap *devmap, vm_offset_t, +struct arm_devmap_entry; + +int fdt_localbus_devmap(phandle_t, struct arm_devmap_entry *, int, int *); +int fdt_pci_devmap(phandle_t, struct arm_devmap_entry *devmap, vm_offset_t, vm_offset_t); #endif /* _MACHINE_FDT_H_ */ Modified: stable/10/sys/arm/include/machdep.h ============================================================================== --- stable/10/sys/arm/include/machdep.h Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/include/machdep.h Fri Dec 13 23:56:53 2013 (r259364) @@ -43,9 +43,6 @@ int platform_devmap_init(void); void board_set_serial(uint64_t); void board_set_revision(uint32_t); -/* Needs to be initialised by platform_devmap_init */ -extern const struct pmap_devmap *pmap_devmap_bootstrap_table; - /* Setup standard arrays */ void arm_dump_avail_init( vm_offset_t memsize, size_t max); Modified: stable/10/sys/arm/include/pmap.h ============================================================================== --- stable/10/sys/arm/include/pmap.h Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/include/pmap.h Fri Dec 13 23:56:53 2013 (r259364) @@ -254,6 +254,7 @@ void pmap_bootstrap(vm_offset_t firstadd int pmap_change_attr(vm_offset_t, vm_size_t, int); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void pmap_kenter_nocache(vm_offset_t va, vm_paddr_t pa); +void pmap_kenter_device(vm_offset_t va, vm_paddr_t pa); void *pmap_kenter_temp(vm_paddr_t pa, int i); void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa); vm_paddr_t pmap_kextract(vm_offset_t va); @@ -687,24 +688,6 @@ void pmap_use_minicache(vm_offset_t, vm_ void vector_page_setprot(int); -/* - * This structure is used by machine-dependent code to describe - * static mappings of devices, created at bootstrap time. - */ -struct pmap_devmap { - vm_offset_t pd_va; /* virtual address */ - vm_paddr_t pd_pa; /* physical address */ - vm_size_t pd_size; /* size of region */ - vm_prot_t pd_prot; /* protection code */ - int pd_cache; /* cache attributes */ -}; - -const struct pmap_devmap *pmap_devmap_find_pa(vm_paddr_t, vm_size_t); -const struct pmap_devmap *pmap_devmap_find_va(vm_offset_t, vm_size_t); - -void pmap_devmap_bootstrap(vm_offset_t, const struct pmap_devmap *); -void pmap_devmap_register(const struct pmap_devmap *); - #define SECTION_CACHE 0x1 #define SECTION_PT 0x2 void pmap_kenter_section(vm_offset_t, vm_paddr_t, int flags); Modified: stable/10/sys/arm/lpc/lpc_machdep.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/lpc/lpc_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -85,7 +86,7 @@ initarm_late_init(void) } #define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) -static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { +static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } }; @@ -105,7 +106,7 @@ platform_devmap_init(void) fdt_devmap[0].pd_prot = VM_PROT_READ | VM_PROT_WRITE; fdt_devmap[0].pd_cache = PTE_NOCACHE; - pmap_devmap_bootstrap_table = &fdt_devmap[0]; + arm_devmap_register_table(&fdt_devmap[0]); return (0); } Modified: stable/10/sys/arm/mv/mv_localbus.c ============================================================================== --- stable/10/sys/arm/mv/mv_localbus.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/mv/mv_localbus.c Fri Dec 13 23:56:53 2013 (r259364) @@ -37,6 +37,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#include #include #include @@ -380,7 +383,7 @@ localbus_get_devinfo(device_t bus, devic } int -fdt_localbus_devmap(phandle_t dt_node, struct pmap_devmap *fdt_devmap, +fdt_localbus_devmap(phandle_t dt_node, struct arm_devmap_entry *fdt_devmap, int banks_max_num, int *banks_added) { pcell_t ranges[MV_LOCALBUS_MAX_BANKS * MV_LOCALBUS_MAX_BANK_CELLS]; Modified: stable/10/sys/arm/mv/mv_machdep.c ============================================================================== --- stable/10/sys/arm/mv/mv_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/mv/mv_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include /* XXX */ @@ -245,12 +246,12 @@ initarm_late_init(void) } #define FDT_DEVMAP_MAX (MV_WIN_CPU_MAX + 2) -static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { +static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } }; static int -platform_sram_devmap(struct pmap_devmap *map) +platform_sram_devmap(struct arm_devmap_entry *map) { #if !defined(SOC_MV_ARMADAXP) phandle_t child, root; @@ -295,10 +296,10 @@ out: * real implementation of this function in dev/fdt/fdt_pci.c overrides the weak * alias defined here. */ -int mv_default_fdt_pci_devmap(phandle_t node, struct pmap_devmap *devmap, +int mv_default_fdt_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, vm_offset_t io_va, vm_offset_t mem_va); int -mv_default_fdt_pci_devmap(phandle_t node, struct pmap_devmap *devmap, +mv_default_fdt_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, vm_offset_t io_va, vm_offset_t mem_va) { @@ -322,7 +323,7 @@ platform_devmap_init(void) int i, num_mapped; i = 0; - pmap_devmap_bootstrap_table = &fdt_devmap[0]; + arm_devmap_register_table(&fdt_devmap[0]); /* * IMMR range. Modified: stable/10/sys/arm/mv/mvvar.h ============================================================================== --- stable/10/sys/arm/mv/mvvar.h Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/mv/mvvar.h Fri Dec 13 23:56:53 2013 (r259364) @@ -66,7 +66,6 @@ struct decode_win { vm_paddr_t remap; }; -extern const struct pmap_devmap pmap_devmap[]; extern const struct gpio_config mv_gpio_config[]; extern const struct decode_win *cpu_wins; extern const struct decode_win *idma_wins; Modified: stable/10/sys/arm/rockchip/rk30xx_machdep.c ============================================================================== --- stable/10/sys/arm/rockchip/rk30xx_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/rockchip/rk30xx_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -73,7 +74,7 @@ initarm_late_init(void) } #define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) -static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { +static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } }; @@ -92,8 +93,8 @@ platform_devmap_init(void) fdt_devmap[i].pd_cache = PTE_DEVICE; i++; - pmap_devmap_bootstrap_table = &fdt_devmap[0]; - + arm_devmap_register_table(&fdt_devmap[0]); + return (0); } Modified: stable/10/sys/arm/s3c2xx0/s3c24x0_machdep.c ============================================================================== --- stable/10/sys/arm/s3c2xx0/s3c24x0_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/s3c2xx0/s3c24x0_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -126,7 +127,7 @@ struct pv_addr kernelstack; #define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1)) /* Static device mappings. */ -static const struct pmap_devmap s3c24x0_devmap[] = { +static const struct arm_devmap_entry s3c24x0_devmap[] = { /* * Map the devices we need early on. */ @@ -324,7 +325,7 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); } - pmap_devmap_bootstrap(l1pagetable, s3c24x0_devmap); + arm_devmap_bootstrap(l1pagetable, s3c24x0_devmap); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT); setttb(kernel_l1pt.pv_pa); Modified: stable/10/sys/arm/sa11x0/assabet_machdep.c ============================================================================== --- stable/10/sys/arm/sa11x0/assabet_machdep.c Fri Dec 13 23:07:22 2013 (r259363) +++ stable/10/sys/arm/sa11x0/assabet_machdep.c Fri Dec 13 23:56:53 2013 (r259364) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:16:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 272186C; Sat, 14 Dec 2013 00:16:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 10A4F1E37; Sat, 14 Dec 2013 00:16:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0GDju095165; Sat, 14 Dec 2013 00:16:13 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0G9ql095137; Sat, 14 Dec 2013 00:16:09 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140016.rBE0G9ql095137@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:16:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259365 - in stable/10/sys/arm: allwinner arm broadcom/bcm2835 freescale/imx include lpc mv rockchip samsung/exynos tegra ti versatile xilinx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:16:13 -0000 Author: ian Date: Sat Dec 14 00:16:08 2013 New Revision: 259365 URL: http://svnweb.freebsd.org/changeset/base/259365 Log: MFC r257669, r257672, r257673, r257676, r257678: Call initarm_lastaddr() later in the init sequence, after establishing static device mappings, rather than as the first of the initializations that a platform can hook into. This allows a platform to allocate KVA from the top of the address space downwards for things like static device mapping, and return the final "last usable address" result after that and other early init work is done. Because some platforms were doing work in initarm_lastaddr() that needs to be done early, add a new initarm_early_init() routine and move the early init code to that routine on those platforms. Make PTE_DEVICE a synonym for PTE_NOCACHE on armv4, to make it easier to share the same code on both architectures. Add new helper routines for arm static device mapping. The new code allocates kva space from the top down for the device mappings and builds entries in an internal table which is automatically used later by arm_devmap_bootstrap(). The platform code just calls the new arm_devmap_add_entry() function as many times as it needs to (up to 32 entries allowed; most platforms use 2 or 3 at most). Remove imx local devmap code and use the essentially identical common code that got moved from imx_machdep.c to arm/devmap.c. Modified: stable/10/sys/arm/allwinner/a10_machdep.c stable/10/sys/arm/arm/devmap.c stable/10/sys/arm/arm/machdep.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/10/sys/arm/freescale/imx/imx51_machdep.c stable/10/sys/arm/freescale/imx/imx53_machdep.c stable/10/sys/arm/freescale/imx/imx6_machdep.c stable/10/sys/arm/freescale/imx/imx_machdep.c stable/10/sys/arm/include/devmap.h stable/10/sys/arm/include/machdep.h stable/10/sys/arm/include/pmap.h stable/10/sys/arm/lpc/lpc_machdep.c stable/10/sys/arm/mv/mv_machdep.c stable/10/sys/arm/rockchip/rk30xx_machdep.c stable/10/sys/arm/samsung/exynos/exynos5_machdep.c stable/10/sys/arm/tegra/tegra2_machdep.c stable/10/sys/arm/ti/ti_machdep.c stable/10/sys/arm/versatile/versatile_machdep.c stable/10/sys/arm/xilinx/zy7_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/allwinner/a10_machdep.c ============================================================================== --- stable/10/sys/arm/allwinner/a10_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/allwinner/a10_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -62,6 +62,12 @@ initarm_lastaddr(void) } void +initarm_early_init(void) +{ + +} + +void initarm_gpio_init(void) { } @@ -80,7 +86,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { int i = 0; Modified: stable/10/sys/arm/arm/devmap.c ============================================================================== --- stable/10/sys/arm/arm/devmap.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/arm/devmap.c Sat Dec 14 00:16:08 2013 (r259365) @@ -36,9 +36,89 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include static const struct arm_devmap_entry *devmap_table; +static boolean_t devmap_bootstrap_done = false; + +/* + * The allocated-kva (akva) devmap table and metadata. Platforms can call + * arm_devmap_add_entry() to add static device mappings to this table using + * automatically allocated virtual addresses carved out of the top of kva space. + * Allocation begins immediately below the ARM_VECTORS_HIGH address. + */ +#define AKVA_DEVMAP_MAX_ENTRIES 32 +static struct arm_devmap_entry akva_devmap_entries[AKVA_DEVMAP_MAX_ENTRIES]; +static u_int akva_devmap_idx; +static vm_offset_t akva_devmap_vaddr = ARM_VECTORS_HIGH; + +/* + * Return the "last" kva address used by the registered devmap table. It's + * actually the lowest address used by the static mappings, i.e., the address of + * the first unusable byte of KVA. + */ +vm_offset_t +arm_devmap_lastaddr() +{ + const struct arm_devmap_entry *pd; + vm_offset_t lowaddr; + + if (akva_devmap_idx > 0) + return (akva_devmap_vaddr); + + if (devmap_table == NULL) + panic("arm_devmap_lastaddr(): No devmap table registered."); + + lowaddr = ARM_VECTORS_HIGH; + for (pd = devmap_table; pd->pd_size != 0; ++pd) { + if (lowaddr > pd->pd_va) + lowaddr = pd->pd_va; + } + + return (lowaddr); +} + +/* + * Add an entry to the internal "akva" static devmap table using the given + * physical address and size and a virtual address allocated from the top of + * kva. This automatically registers the akva table on the first call, so all a + * platform has to do is call this routine to install as many mappings as it + * needs and when initarm() calls arm_devmap_bootstrap() it will pick up all the + * entries in the akva table automatically. + */ +void +arm_devmap_add_entry(vm_paddr_t pa, vm_size_t sz) +{ + struct arm_devmap_entry *m; + + if (devmap_bootstrap_done) + panic("arm_devmap_add_entry() after arm_devmap_bootstrap()"); + + if (akva_devmap_idx == (AKVA_DEVMAP_MAX_ENTRIES - 1)) + panic("AKVA_DEVMAP_MAX_ENTRIES is too small"); + + if (akva_devmap_idx == 0) + arm_devmap_register_table(akva_devmap_entries); + + /* + * Allocate virtual address space from the top of kva downwards. If the + * range being mapped is aligned and sized to 1MB boundaries then also + * align the virtual address to the next-lower 1MB boundary so that we + * end up with a nice efficient section mapping. + */ + if ((pa & 0x000fffff) == 0 && (sz & 0x000fffff) == 0) { + akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz); + } else { + akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - sz); + } + m = &akva_devmap_entries[akva_devmap_idx++]; + m->pd_va = akva_devmap_vaddr; + m->pd_pa = pa; + m->pd_size = sz; + m->pd_prot = VM_PROT_READ | VM_PROT_WRITE; + m->pd_cache = PTE_DEVICE; +} /* * Register the given table as the one to use in arm_devmap_bootstrap(). @@ -73,12 +153,14 @@ arm_devmap_bootstrap(vm_offset_t l1pt, c if (table != NULL) devmap_table = table; else if (devmap_table == NULL) - panic("arm_devmap_bootstrap: No devmap table registered."); + panic("arm_devmap_bootstrap(): No devmap table registered"); for (pd = devmap_table; pd->pd_size != 0; ++pd) { pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size, pd->pd_prot,pd->pd_cache); } + + devmap_bootstrap_done = true; } /* Modified: stable/10/sys/arm/arm/machdep.c ============================================================================== --- stable/10/sys/arm/arm/machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/arm/machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -1299,7 +1299,7 @@ initarm(struct arm_boot_params *abp) availmem_regions_sz = curr; /* Platform-specific initialisation */ - vm_max_kernel_address = initarm_lastaddr(); + initarm_early_init(); pcpu0_init(); @@ -1415,9 +1415,10 @@ initarm(struct arm_boot_params *abp) pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE); - /* Map pmap_devmap[] entries */ - err_devmap = platform_devmap_init(); + /* Establish static device mappings. */ + err_devmap = initarm_devmap_init(); arm_devmap_bootstrap(l1pagetable, NULL); + vm_max_kernel_address = initarm_lastaddr(); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); pmap_pa = kernel_l1pt.pv_pa; Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -70,6 +70,12 @@ initarm_lastaddr(void) } void +initarm_early_init(void) +{ + +} + +void initarm_gpio_init(void) { } @@ -103,7 +109,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { int i = 0; Modified: stable/10/sys/arm/freescale/imx/imx51_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx51_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/freescale/imx/imx51_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -34,26 +34,58 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#include +#include #include + #include +vm_offset_t +initarm_lastaddr(void) +{ + + return (arm_devmap_lastaddr()); +} + +void +initarm_early_init(void) +{ + + /* XXX - Get rid of this stuff soon. */ + boothowto |= RB_VERBOSE|RB_MULTIPLE; + bootverbose = 1; +} + +void +initarm_gpio_init(void) +{ + +} + +void +initarm_late_init(void) +{ + +} + /* * Set up static device mappings. This is hand-optimized platform-specific * config data which covers most of the common on-chip devices with a few 1MB * section mappings. * * Notably missing are entries for GPU, IPU, in general anything video related. - * - * Note that for imx this is called from initarm_lastaddr() so that the lowest - * kva address used for static device mapping can be known at that point. */ -void -imx_devmap_init(void) +int +initarm_devmap_init(void) { - imx_devmap_addentry(0x70000000, 0x00100000); - imx_devmap_addentry(0x73f00000, 0x00100000); - imx_devmap_addentry(0x83f00000, 0x00100000); + arm_devmap_add_entry(0x70000000, 0x00100000); + arm_devmap_add_entry(0x73f00000, 0x00100000); + arm_devmap_add_entry(0x83f00000, 0x00100000); + + return (0); } void Modified: stable/10/sys/arm/freescale/imx/imx53_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx53_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/freescale/imx/imx53_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -34,26 +34,57 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#include +#include #include #include +vm_offset_t +initarm_lastaddr(void) +{ + + return (arm_devmap_lastaddr()); +} + +void +initarm_early_init(void) +{ + + /* XXX - Get rid of this stuff soon. */ + boothowto |= RB_VERBOSE|RB_MULTIPLE; + bootverbose = 1; +} + +void +initarm_gpio_init(void) +{ + +} + +void +initarm_late_init(void) +{ + +} + /* * Set up static device mappings. This is hand-optimized platform-specific * config data which covers most of the common on-chip devices with a few 1MB * section mappings. * * Notably missing are entries for GPU, IPU, in general anything video related. - * - * Note that for imx this is called from initarm_lastaddr() so that the lowest - * kva address used for static device mapping can be known at that point. */ -void -imx_devmap_init(void) +int +initarm_devmap_init(void) { - imx_devmap_addentry(0x50000000, 0x00100000); - imx_devmap_addentry(0x53f00000, 0x00100000); - imx_devmap_addentry(0x63f00000, 0x00100000); + arm_devmap_add_entry(0x50000000, 0x00100000); + arm_devmap_add_entry(0x53f00000, 0x00100000); + arm_devmap_add_entry(0x63f00000, 0x00100000); + + return (0); } void Modified: stable/10/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx6_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/freescale/imx/imx6_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -35,19 +35,45 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include +#include #include #include #include +vm_offset_t +initarm_lastaddr(void) +{ + + return (arm_devmap_lastaddr()); +} + +void +initarm_early_init(void) +{ + + /* XXX - Get rid of this stuff soon. */ + boothowto |= RB_VERBOSE|RB_MULTIPLE; + bootverbose = 1; +} + +void +initarm_gpio_init(void) +{ + +} + +void +initarm_late_init(void) +{ + +} + /* - * Set up static device mappings. Note that for imx this is called from - * initarm_lastaddr() so that it can return the lowest address used for static - * device mapping, maximizing kva space. + * Set up static device mappings. * * This attempts to cover the most-used devices with 1MB section mappings, which * is good for performance (uses fewer TLB entries for device access). @@ -62,8 +88,8 @@ __FBSDID("$FreeBSD$"); * static map some of that area. Be careful with other things in that area such * as OCRAM that probably shouldn't be mapped as PTE_DEVICE memory. */ -void -imx_devmap_init(void) +int +initarm_devmap_init(void) { const uint32_t IMX6_ARMMP_PHYS = 0x00a00000; const uint32_t IMX6_ARMMP_SIZE = 0x00100000; @@ -72,9 +98,11 @@ imx_devmap_init(void) const uint32_t IMX6_AIPS2_PHYS = 0x02100000; const uint32_t IMX6_AIPS2_SIZE = 0x00100000; - imx_devmap_addentry(IMX6_ARMMP_PHYS, IMX6_ARMMP_SIZE); - imx_devmap_addentry(IMX6_AIPS1_PHYS, IMX6_AIPS1_SIZE); - imx_devmap_addentry(IMX6_AIPS2_PHYS, IMX6_AIPS2_SIZE); + arm_devmap_add_entry(IMX6_ARMMP_PHYS, IMX6_ARMMP_SIZE); + arm_devmap_add_entry(IMX6_AIPS1_PHYS, IMX6_AIPS1_SIZE); + arm_devmap_add_entry(IMX6_AIPS2_PHYS, IMX6_AIPS2_SIZE); + + return (0); } void Modified: stable/10/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/freescale/imx/imx_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -45,106 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define IMX_MAX_DEVMAP_ENTRIES 8 - -static struct arm_devmap_entry devmap_entries[IMX_MAX_DEVMAP_ENTRIES]; -static u_int devmap_idx; -static vm_offset_t devmap_vaddr = ARM_VECTORS_HIGH; - -void -imx_devmap_addentry(vm_paddr_t pa, vm_size_t sz) -{ - struct arm_devmap_entry *m; - - /* - * The last table entry is the all-zeroes end-of-table marker. If we're - * about to overwrite it the world is coming to an end. This code runs - * too early for the panic to be printed unless a special early-debug - * console is in use, but there's nothing else we can do. - */ - if (devmap_idx == (IMX_MAX_DEVMAP_ENTRIES - 1)) - panic("IMX_MAX_DEVMAP_ENTRIES is too small!\n"); - - /* - * Allocate virtual address space from the top of kva downwards. If the - * range being mapped is aligned and sized to 1MB boundaries then also - * align the virtual address to the next-lower 1MB boundary so that we - * end up with a section mapping. - */ - if ((pa & 0x000fffff) == 0 && (sz & 0x000fffff) == 0) { - devmap_vaddr = (devmap_vaddr - sz) & ~0x000fffff; - } else { - devmap_vaddr = (devmap_vaddr - sz) & ~0x00000fff; - } - m = &devmap_entries[devmap_idx++]; - m->pd_va = devmap_vaddr; - m->pd_pa = pa; - m->pd_size = sz; - m->pd_prot = VM_PROT_READ | VM_PROT_WRITE; - m->pd_cache = PTE_DEVICE; -} - -vm_offset_t -initarm_lastaddr(void) -{ - - /* XXX - Get rid of this stuff soon. */ - boothowto |= RB_VERBOSE|RB_MULTIPLE; - bootverbose = 1; - - /* - * Normally initarm() calls platform_devmap_init() much later in the - * init process to set up static device mappings. To calculate the - * highest available kva address we have to do that setup first. It - * maps downwards from ARM_VECTORS_HIGH and the last usable kva address - * is the point right before the virtual address of the first static - * mapping. So go set up the static mapping table now, then we can - * return the lowest static devmap vaddr as the end of usable kva. - */ - imx_devmap_init(); - - arm_devmap_register_table(devmap_entries); - - return (devmap_vaddr); -} - -int -platform_devmap_init(void) -{ - - /* On imx this work is done during initarm_lastaddr(). */ - return (0); -} - -/* - * Set initial values of GPIO output ports - */ -void -initarm_gpio_init(void) -{ - -} - -void -initarm_late_init(void) -{ - struct arm_devmap_entry *m; - - /* - * We did the static devmap setup earlier, during initarm_lastaddr(), - * but now the console should be working and we can be verbose about - * what we did. - */ - if (bootverbose) { - for (m = devmap_entries; m->pd_va != 0; ++m) { - printf("Devmap: phys 0x%08x virt 0x%08x size %uK\n", - m->pd_pa, m->pd_va, m->pd_size / 1024); - } - } - - -} - struct arm32_dma_range * bus_dma_get_range(void) { Modified: stable/10/sys/arm/include/devmap.h ============================================================================== --- stable/10/sys/arm/include/devmap.h Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/include/devmap.h Sat Dec 14 00:16:08 2013 (r259365) @@ -42,6 +42,22 @@ struct arm_devmap_entry { }; /* + * Return the lowest KVA address used in any entry in the registered devmap + * table. This works with whatever table is registered, including the internal + * table used by arm_devmap_add_entry() if that routine was used. Platforms can + * implement initarm_lastaddr() by calling this if static device mappings are + * their only use of high KVA space. + */ +vm_offset_t arm_devmap_lastaddr(void); + +/* + * Automatically allocate KVA (from the top of the address space downwards) and + * make static device mapping entries in an internal table. The internal table + * is automatically registered on the first call to this. + */ +void arm_devmap_add_entry(vm_paddr_t pa, vm_size_t sz); + +/* * Register a platform-local table to be bootstrapped by the generic * initarm() in arm/machdep.c. This is used by newer code that allocates and * fills in its own local table but does not have its own initarm() routine. @@ -49,16 +65,17 @@ struct arm_devmap_entry { void arm_devmap_register_table(const struct arm_devmap_entry * _table); /* - * Directly process a table; called from initarm() of older platforms that don't - * use the generic initarm() in arm/machdep.c. If the table pointer is NULL, - * this will use the table installed previously by arm_devmap_register_table(). + * Establish mappings for all the entries in the table. This is called + * automatically from the common initarm() in arm/machdep.c, and also from the + * custom initarm() routines in older code. If the table pointer is NULL, this + * will use the table installed previously by arm_devmap_register_table(). */ void arm_devmap_bootstrap(vm_offset_t _l1pt, const struct arm_devmap_entry *_table); /* - * Routines to translate between virtual and physical addresses within a region - * that is static-mapped by the devmap code. If the given address range isn't + * Translate between virtual and physical addresses within a region that is + * static-mapped by the devmap code. If the given address range isn't * static-mapped, then ptov returns NULL and vtop returns DEVMAP_PADDR_NOTFOUND. * The latter implies that you can't vtop just the last byte of physical address * space. This is not as limiting as it might sound, because even if a device Modified: stable/10/sys/arm/include/machdep.h ============================================================================== --- stable/10/sys/arm/include/machdep.h Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/include/machdep.h Sat Dec 14 00:16:08 2013 (r259365) @@ -33,11 +33,39 @@ vm_offset_t linux_parse_boot_param(struc vm_offset_t fake_preload_metadata(struct arm_boot_params *abp); vm_offset_t parse_boot_param(struct arm_boot_params *abp); -/* Called by initarm */ +/* + * Initialization functions called by the common initarm() function in + * arm/machdep.c (but not necessarily from the custom initarm() functions of + * older code). + * + * - initarm_early_init() is called very early, after parsing the boot params + * and after physical memory has been located and sized. + * + * - platform_devmap_init() is called as one of the last steps of early virtual + * memory initialization, shortly before the new page tables are installed. + * + * - initarm_lastaddr() is called after platform_devmap_init(), and must return + * the address of the first byte of unusable KVA space. This allows a + * platform to carve out of the top of the KVA space whatever reserves it + * needs for things like static device mapping, and this is called to get the + * value before calling pmap_bootstrap() which uses the value to size the + * available KVA. + * + * - initarm_gpio_init() is called after the static device mappings are + * established and just before cninit(). The intention is that the routine + * can do any hardware setup (such as gpio or pinmux) necessary to make the + * console functional. + * + * - initarm_late_init() is called just after cninit(). This is the first of + * the init routines that can use printf() and expect the output to appear on + * a standard console. + * + */ +void initarm_early_init(void); +int initarm_devmap_init(void); vm_offset_t initarm_lastaddr(void); void initarm_gpio_init(void); void initarm_late_init(void); -int platform_devmap_init(void); /* Board-specific attributes */ void board_set_serial(uint64_t); Modified: stable/10/sys/arm/include/pmap.h ============================================================================== --- stable/10/sys/arm/include/pmap.h Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/include/pmap.h Sat Dec 14 00:16:08 2013 (r259365) @@ -67,6 +67,7 @@ #else #define PTE_NOCACHE 1 #define PTE_CACHE 2 +#define PTE_DEVICE PTE_NOCACHE #define PTE_PAGETABLE 3 #endif Modified: stable/10/sys/arm/lpc/lpc_machdep.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/lpc/lpc_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -63,11 +63,15 @@ vm_offset_t initarm_lastaddr(void) { + return (fdt_immr_va); +} + +void +initarm_early_init(void) +{ + if (fdt_immr_addr(LPC_DEV_BASE) != 0) while (1); - - /* Platform-specific initialisation */ - return (fdt_immr_va); } void @@ -94,7 +98,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { /* Modified: stable/10/sys/arm/mv/mv_machdep.c ============================================================================== --- stable/10/sys/arm/mv/mv_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/mv/mv_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -203,11 +203,15 @@ vm_offset_t initarm_lastaddr(void) { + return (fdt_immr_va); +} + +void +initarm_early_init(void) +{ + if (fdt_immr_addr(MV_BASE) != 0) while (1); - - /* Platform-specific initialisation */ - return (fdt_immr_va); } void @@ -316,7 +320,7 @@ __weak_reference(mv_default_fdt_pci_devm * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { phandle_t root, child; pcell_t bank_count; Modified: stable/10/sys/arm/rockchip/rk30xx_machdep.c ============================================================================== --- stable/10/sys/arm/rockchip/rk30xx_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/rockchip/rk30xx_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -60,6 +60,12 @@ initarm_lastaddr(void) } void +initarm_early_init(void) +{ + +} + +void initarm_gpio_init(void) { } @@ -82,7 +88,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { int i = 0; Modified: stable/10/sys/arm/samsung/exynos/exynos5_machdep.c ============================================================================== --- stable/10/sys/arm/samsung/exynos/exynos5_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/samsung/exynos/exynos5_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -54,6 +54,12 @@ initarm_lastaddr(void) } void +initarm_early_init(void) +{ + +} + +void initarm_gpio_init(void) { } @@ -72,7 +78,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { int i; Modified: stable/10/sys/arm/tegra/tegra2_machdep.c ============================================================================== --- stable/10/sys/arm/tegra/tegra2_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/tegra/tegra2_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -107,10 +107,15 @@ vm_offset_t initarm_lastaddr(void) { + return (fdt_immr_va); +} + +void +initarm_early_init(void) +{ + if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */ while (1); - - return (fdt_immr_va); } void @@ -132,7 +137,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { int i = 0; fdt_devmap[i].pd_va = 0xe0000000; Modified: stable/10/sys/arm/ti/ti_machdep.c ============================================================================== --- stable/10/sys/arm/ti/ti_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/ti/ti_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -63,11 +63,17 @@ vm_offset_t initarm_lastaddr(void) { - ti_cpu_reset = NULL; return (DEVMAP_BOOTSTRAP_MAP_START); } void +initarm_early_init(void) +{ + + ti_cpu_reset = NULL; +} + +void initarm_gpio_init(void) { } @@ -87,7 +93,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { int i = 0; #if defined(SOC_OMAP4) Modified: stable/10/sys/arm/versatile/versatile_machdep.c ============================================================================== --- stable/10/sys/arm/versatile/versatile_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/versatile/versatile_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -65,6 +65,12 @@ initarm_lastaddr(void) } void +initarm_early_init(void) +{ + +} + +void initarm_gpio_init(void) { } @@ -85,7 +91,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { int i = 0; fdt_devmap[i].pd_va = 0xf0100000; Modified: stable/10/sys/arm/xilinx/zy7_machdep.c ============================================================================== --- stable/10/sys/arm/xilinx/zy7_machdep.c Fri Dec 13 23:56:53 2013 (r259364) +++ stable/10/sys/arm/xilinx/zy7_machdep.c Sat Dec 14 00:16:08 2013 (r259365) @@ -64,6 +64,12 @@ initarm_lastaddr(void) } void +initarm_early_init(void) +{ + +} + +void initarm_gpio_init(void) { } @@ -80,7 +86,7 @@ static struct arm_devmap_entry fdt_devma * Construct pmap_devmap[] with DT-derived config data. */ int -platform_devmap_init(void) +initarm_devmap_init(void) { int i = 0; From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:23:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BF161375; Sat, 14 Dec 2013 00:23:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AB1A21EC8; Sat, 14 Dec 2013 00:23:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0Nh0s098450; Sat, 14 Dec 2013 00:23:43 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0NhiZ098449; Sat, 14 Dec 2013 00:23:43 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140023.rBE0NhiZ098449@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259366 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:23:43 -0000 Author: ian Date: Sat Dec 14 00:23:43 2013 New Revision: 259366 URL: http://svnweb.freebsd.org/changeset/base/259366 Log: MFC r257924: Apparently with "const uint32_t foo = 0x60;" gcc doesn't consider 'foo' to be a constant integer suitable for use in a case label, so use #defines. Modified: stable/10/sys/arm/freescale/imx/imx6_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx6_machdep.c Sat Dec 14 00:16:08 2013 (r259365) +++ stable/10/sys/arm/freescale/imx/imx6_machdep.c Sat Dec 14 00:23:43 2013 (r259366) @@ -145,11 +145,11 @@ u_int imx_soc_type() { uint32_t digprog, hwsoc; uint32_t *pcr; - const uint32_t HWSOC_MX6SL = 0x60; - const uint32_t HWSOC_MX6DL = 0x61; - const uint32_t HWSOC_MX6SOLO = 0x62; - const uint32_t HWSOC_MX6Q = 0x63; const vm_offset_t SCU_CONFIG_PHYSADDR = 0x00a00004; +#define HWSOC_MX6SL 0x60 +#define HWSOC_MX6DL 0x61 +#define HWSOC_MX6SOLO 0x62 +#define HWSOC_MX6Q 0x63 digprog = imx6_anatop_read_4(IMX6_ANALOG_DIGPROG_SL); hwsoc = (digprog >> IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT) & From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:25:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 45AEA67B; Sat, 14 Dec 2013 00:25:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 30E151EE0; Sat, 14 Dec 2013 00:25:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0Pwoi098798; Sat, 14 Dec 2013 00:25:58 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0Pwmx098797; Sat, 14 Dec 2013 00:25:58 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140025.rBE0Pwmx098797@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:25:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259368 - stable/10/usr.sbin/syslogd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:25:58 -0000 Author: ian Date: Sat Dec 14 00:25:57 2013 New Revision: 259368 URL: http://svnweb.freebsd.org/changeset/base/259368 Log: MFC r258076, r258077: This fixes 3 problems in syslogd related to sizing receive buffers... - A call was misplaced at the wrong level of nested if blocks, so that the buffers for unix domain sockets (/dev/log, /dev/klog) were never increased at all; they remained at a way-too-small default size of 4096. - The function that was supposed to double the size of the buffer sometimes did nothing, and sometimes installed a wildly-wrong buffer size (either too large or too small) due to an unitialized 'slen' variable passed to getsockopt(). Most often it doubled the UDP buffers from 40k to 80k because accidentally there would be harmless stack garbage in the unitialized variables. - The whole concept of blindly doubling a socket's buffer size without knowing what size it started at is a design flaw that has to be called a bug. If the double_rbuf() function had worked at all (I.E., if the other two bugs didn't exist) this would lead to UDP sockets having an 80k buffer while unix dgram sockets get an 8k buffer. There's nothing about the problem being solved that requires larger buffers for UDP than for unix dgram sockets -- the buffering requirements are the same regardless of socket type. This change renames the double_rbuf() function to increase_rbuf() and increases the buffer size on all types of sockets to 80k. 80k was chosen only because it appears to be the size the original change was shooting for, and it certainly seems to be reasonably large (I might have picked 64k in the absence of any historical guidance). Add ENETUNREACH and EADDRNOTAVAIL to the list of errors that are potentially transient and shouldn't result in closing the socket and giving up forever. Modified: stable/10/usr.sbin/syslogd/syslogd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/10/usr.sbin/syslogd/syslogd.c Sat Dec 14 00:25:25 2013 (r259367) +++ stable/10/usr.sbin/syslogd/syslogd.c Sat Dec 14 00:25:57 2013 (r259368) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #define DEFSPRI (LOG_KERN|LOG_CRIT) #define TIMERINTVL 30 /* interval for checking flush, mark */ #define TTYMSGTIME 1 /* timeout passed to ttymsg */ +#define RCVBUF_MINSIZE (80 * 1024) /* minimum size of dgram rcv buffer */ #include #include @@ -336,7 +337,7 @@ static void unmapped(struct sockaddr *); static void wallmsg(struct filed *, struct iovec *, const int iovlen); static int waitdaemon(int, int, int); static void timedout(int); -static void double_rbuf(int); +static void increase_rcvbuf(int); int main(int argc, char *argv[]) @@ -547,8 +548,8 @@ main(int argc, char *argv[]) STAILQ_REMOVE(&funixes, fx, funix, next); continue; } - double_rbuf(fx->s); } + increase_rcvbuf(fx->s); } if (SecureMode <= 1) finet = socksetup(family, bindhostname); @@ -1241,8 +1242,10 @@ fprintlog(struct filed *f, int flags, co switch (errno) { case ENOBUFS: case ENETDOWN: + case ENETUNREACH: case EHOSTUNREACH: case EHOSTDOWN: + case EADDRNOTAVAIL: break; /* case EBADF: */ /* case EACCES: */ @@ -1253,7 +1256,7 @@ fprintlog(struct filed *f, int flags, co /* case ENOBUFS: */ /* case ECONNREFUSED: */ default: - dprintf("removing entry\n"); + dprintf("removing entry: errno=%d\n", e); f->f_type = F_UNUSED; break; } @@ -2720,7 +2723,7 @@ socksetup(int af, char *bindhostname) } if (!SecureMode) - double_rbuf(*s); + increase_rcvbuf(*s); } (*socks)++; @@ -2741,12 +2744,16 @@ socksetup(int af, char *bindhostname) } static void -double_rbuf(int fd) +increase_rcvbuf(int fd) { - socklen_t slen, len; + socklen_t len, slen; + + slen = sizeof(len); if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, &slen) == 0) { - len *= 2; - setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, slen); + if (len < RCVBUF_MINSIZE) { + len = RCVBUF_MINSIZE; + setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, sizeof(len)); + } } } From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:54:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E47601EE; Sat, 14 Dec 2013 00:54:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C499D10BE; Sat, 14 Dec 2013 00:54:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0s6Qf009517; Sat, 14 Dec 2013 00:54:06 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0s6eb009513; Sat, 14 Dec 2013 00:54:06 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140054.rBE0s6eb009513@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259371 - stable/10/sys/dev/nand X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:54:07 -0000 Author: ian Date: Sat Dec 14 00:54:05 2013 New Revision: 259371 URL: http://svnweb.freebsd.org/changeset/base/259371 Log: MFC r257892, r258196, r258197, r258199, r258200, r258201, r258202: Add ONFI signature check. Add Micron chip found in Freescale Vybrid Family Phytec COSMIC board. The vendor specified field is 88 bytes, not 8 bytes. Update the onfi_params struct to ONFI revision 3.2 (06 12 2013). Search for and validate the ONFI params as specified in the standard. ONFI parameters are little-endian, hence we must take care to convert them to native endianness. We must also pay attention to unaligned accesses. Rework the routine that returns a pointer to the table of software ECC byte positions within the OOB area to support chips with unusual OOB sizes such as 218 or 224 bytes. Modified: stable/10/sys/dev/nand/nand.c stable/10/sys/dev/nand/nand.h stable/10/sys/dev/nand/nand_generic.c stable/10/sys/dev/nand/nand_id.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nand/nand.c ============================================================================== --- stable/10/sys/dev/nand/nand.c Sat Dec 14 00:40:47 2013 (r259370) +++ stable/10/sys/dev/nand/nand.c Sat Dec 14 00:54:05 2013 (r259371) @@ -115,7 +115,7 @@ nand_init(struct nand_softc *nand, devic } void -nand_onfi_set_params(struct nand_chip *chip, struct onfi_params *params) +nand_onfi_set_params(struct nand_chip *chip, struct onfi_chip_params *params) { struct chip_geom *cg; @@ -309,23 +309,22 @@ nand_get_chip_param(struct nand_chip *ch static uint16_t * default_software_ecc_positions(struct nand_chip *chip) { - struct nand_ecc_data *eccd; - - eccd = &chip->nand->ecc; - - if (eccd->eccpositions) - return (eccd->eccpositions); - - switch (chip->chip_geom.oob_size) { - case 16: - return ((uint16_t *)&default_software_ecc_positions_16); - case 64: - return ((uint16_t *)&default_software_ecc_positions_64); - case 128: - return ((uint16_t *)&default_software_ecc_positions_128); - default: - return (NULL); /* No ecc bytes positions defs available */ - } + /* If positions have been set already, use them. */ + if (chip->nand->ecc.eccpositions) + return (chip->nand->ecc.eccpositions); + + /* + * XXX Note that the following logic isn't really sufficient, especially + * in the ONFI case where the number of ECC bytes can be dictated by + * values in the parameters page, and that could lead to needing more + * byte positions than exist within the tables of software-ecc defaults. + */ + if (chip->chip_geom.oob_size >= 128) + return (default_software_ecc_positions_128); + if (chip->chip_geom.oob_size >= 64) + return (default_software_ecc_positions_64); + else if (chip->chip_geom.oob_size >= 16) + return (default_software_ecc_positions_16); return (NULL); } Modified: stable/10/sys/dev/nand/nand.h ============================================================================== --- stable/10/sys/dev/nand/nand.h Sat Dec 14 00:40:47 2013 (r259370) +++ stable/10/sys/dev/nand/nand.h Sat Dec 14 00:54:05 2013 (r259371) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -122,7 +123,8 @@ MALLOC_DECLARE(M_NAND); #define NAND_MAN_SAMSUNG 0xec #define NAND_MAN_HYNIX 0xad -#define NAND_MAN_STMICRO 0x20 +#define NAND_MAN_STMICRO 0x20 +#define NAND_MAN_MICRON 0x2c struct nand_id { uint8_t man_id; @@ -176,12 +178,17 @@ struct onfi_params { uint16_t rev; uint16_t features; uint16_t optional_commands; - uint8_t res1[22]; + uint8_t primary_advanced_command; + uint8_t res1; + uint16_t extended_parameter_page_length; + uint8_t parameter_page_count; + uint8_t res2[17]; char manufacturer_name[12]; char device_model[20]; uint8_t manufacturer_id; - uint16_t date; - uint8_t res2[13]; + uint8_t manufacture_date_yy; + uint8_t manufacture_date_ww; + uint8_t res3[13]; uint32_t bytes_per_page; uint16_t spare_bytes_per_page; uint32_t bytes_per_partial_page; @@ -200,7 +207,8 @@ struct onfi_params { uint8_t bits_of_ecc; uint8_t interleaved_addr_bits; uint8_t interleaved_oper_attr; - uint8_t res3[13]; + uint8_t eznand_support; + uint8_t res4[12]; uint8_t pin_capacitance; uint16_t asynch_timing_mode_support; uint16_t asynch_prog_cache_timing_mode_support; @@ -215,11 +223,31 @@ struct onfi_params { uint16_t input_capacitance; uint8_t input_capacitance_max; uint8_t driver_strength_support; - uint8_t res4[12]; + uint16_t t_r_interleaved; + uint16_t t_adl; + uint16_t t_r_eznand; + uint8_t nv_ddr2_features; + uint8_t nv_ddr2_warmup_cycles; + uint8_t res5[4]; uint16_t vendor_rev; - uint8_t vendor_spec[8]; + uint8_t vendor_spec[88]; uint16_t crc; }__attribute__((packed)); +CTASSERT(sizeof(struct onfi_params) == 256); + +struct onfi_chip_params { + uint32_t blocks_per_lun; + uint32_t pages_per_block; + uint32_t bytes_per_page; + uint32_t spare_bytes_per_page; + uint16_t t_bers; + uint16_t t_prog; + uint16_t t_r; + uint16_t t_ccs; + uint16_t features; + uint8_t address_cycles; + uint8_t luns; +}; struct nand_ecc_data { int eccsize; /* Number of data bytes per ECC step */ @@ -353,7 +381,7 @@ void nand_init(struct nand_softc *nand, void nand_detach(struct nand_softc *nand); struct nand_params *nand_get_params(struct nand_id *id); -void nand_onfi_set_params(struct nand_chip *chip, struct onfi_params *params); +void nand_onfi_set_params(struct nand_chip *chip, struct onfi_chip_params *params); void nand_set_params(struct nand_chip *chip, struct nand_params *params); int nand_init_stat(struct nand_chip *chip); void nand_destroy_stat(struct nand_chip *chip); Modified: stable/10/sys/dev/nand/nand_generic.c ============================================================================== --- stable/10/sys/dev/nand/nand_generic.c Sat Dec 14 00:40:47 2013 (r259370) +++ stable/10/sys/dev/nand/nand_generic.c Sat Dec 14 00:54:05 2013 (r259371) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -73,7 +74,7 @@ static int small_program_page(device_t, static int small_program_oob(device_t, uint32_t, void *, uint32_t, uint32_t); static int onfi_is_blk_bad(device_t, uint32_t, uint8_t *); -static int onfi_read_parameter(struct nand_chip *, struct onfi_params *); +static int onfi_read_parameter(struct nand_chip *, struct onfi_chip_params *); static int nand_send_address(device_t, int32_t, int32_t, int8_t); @@ -206,7 +207,7 @@ generic_nand_attach(device_t dev) { struct nand_chip *chip; struct nandbus_ivar *ivar; - struct onfi_params *onfi_params; + struct onfi_chip_params *onfi_chip_params; device_t nandbus, nfc; int err; @@ -225,25 +226,24 @@ generic_nand_attach(device_t dev) chip->nand = device_get_softc(nfc); if (ivar->is_onfi) { - onfi_params = malloc(sizeof(struct onfi_params), + onfi_chip_params = malloc(sizeof(struct onfi_chip_params), M_NAND, M_WAITOK | M_ZERO); - if (onfi_params == NULL) - return (ENXIO); + if (onfi_chip_params == NULL) + return (ENOMEM); - if (onfi_read_parameter(chip, onfi_params)) { + if (onfi_read_parameter(chip, onfi_chip_params)) { nand_debug(NDBG_GEN,"Could not read parameter page!\n"); - free(onfi_params, M_NAND); + free(onfi_chip_params, M_NAND); return (ENXIO); } - nand_onfi_set_params(chip, onfi_params); + nand_onfi_set_params(chip, onfi_chip_params); /* Set proper column and row cycles */ - ivar->cols = (onfi_params->address_cycles >> 4) & 0xf; - ivar->rows = onfi_params->address_cycles & 0xf; - free(onfi_params, M_NAND); + ivar->cols = (onfi_chip_params->address_cycles >> 4) & 0xf; + ivar->rows = onfi_chip_params->address_cycles & 0xf; + free(onfi_chip_params, M_NAND); } else { - nand_set_params(chip, ivar->params); } @@ -319,10 +319,32 @@ check_fail(device_t nandbus) return (0); } +static uint16_t +onfi_crc(const void *buf, size_t buflen) +{ + int i, j; + uint16_t crc; + const uint8_t *bufptr; + + bufptr = buf; + crc = 0x4f4e; + for (j = 0; j < buflen; j++) { + crc ^= *bufptr++ << 8; + for (i = 0; i < 8; i++) + if (crc & 0x8000) + crc = (crc << 1) ^ 0x8005; + else + crc <<= 1; + } + return crc; +} + static int -onfi_read_parameter(struct nand_chip *chip, struct onfi_params *params) +onfi_read_parameter(struct nand_chip *chip, struct onfi_chip_params *chip_params) { device_t nandbus; + struct onfi_params params; + int found, sigcount, trycopy; nand_debug(NDBG_GEN,"read parameter"); @@ -339,12 +361,44 @@ onfi_read_parameter(struct nand_chip *ch if (NANDBUS_START_COMMAND(nandbus)) return (ENXIO); - NANDBUS_READ_BUFFER(nandbus, params, sizeof(struct onfi_params)); - - /* TODO */ - /* Check for signature */ - /* Check CRC */ - /* Use redundant page if necessary */ + /* + * XXX Bogus DELAY, we really need a nandbus_wait_ready() here, but it's + * not accessible from here (static to nandbus). + */ + DELAY(1000); + + /* + * The ONFI spec mandates a minimum of three copies of the parameter + * data, so loop up to 3 times trying to find good data. Each copy is + * validated by a signature of "ONFI" and a crc. There is a very strange + * rule that the signature is valid if any 2 of the 4 bytes are correct. + */ + for (found= 0, trycopy = 0; !found && trycopy < 3; trycopy++) { + NANDBUS_READ_BUFFER(nandbus, ¶ms, sizeof(struct onfi_params)); + sigcount = params.signature[0] == 'O'; + sigcount += params.signature[1] == 'N'; + sigcount += params.signature[2] == 'F'; + sigcount += params.signature[3] == 'I'; + if (sigcount < 2) + continue; + if (onfi_crc(¶ms, 254) != params.crc) + continue; + found = 1; + } + if (!found) + return (ENXIO); + + chip_params->luns = params.luns; + chip_params->blocks_per_lun = le32dec(¶ms.blocks_per_lun); + chip_params->pages_per_block = le32dec(¶ms.pages_per_block); + chip_params->bytes_per_page = le32dec(¶ms.bytes_per_page); + chip_params->spare_bytes_per_page = le32dec(¶ms.spare_bytes_per_page); + chip_params->t_bers = le16dec(¶ms.t_bers); + chip_params->t_prog = le16dec(¶ms.t_prog); + chip_params->t_r = le16dec(¶ms.t_r); + chip_params->t_ccs = le16dec(¶ms.t_ccs); + chip_params->features = le16dec(¶ms.features); + chip_params->address_cycles = params.address_cycles; return (0); } Modified: stable/10/sys/dev/nand/nand_id.c ============================================================================== --- stable/10/sys/dev/nand/nand_id.c Sat Dec 14 00:40:47 2013 (r259370) +++ stable/10/sys/dev/nand/nand_id.c Sat Dec 14 00:54:05 2013 (r259371) @@ -47,6 +47,8 @@ struct nand_params nand_ids[] = { 0x80, 0x200, 0x10, 0x20, 0 }, { { NAND_MAN_STMICRO, 0xf1 }, "STMicro 128MB 3,3V 8-bit", 0x80, 2048, 64, 0x40, 0 }, + { { NAND_MAN_MICRON, 0xcc }, "Micron NAND 512MiB 3,3V 16-bit", + 0x200, 2048, 64, 0x40, 0 }, }; struct nand_params *nand_get_params(struct nand_id *id) From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:55:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2F1B46A; Sat, 14 Dec 2013 00:55:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C4EAD10DD; Sat, 14 Dec 2013 00:55:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0tYAE009842; Sat, 14 Dec 2013 00:55:34 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0tYe8009841; Sat, 14 Dec 2013 00:55:34 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140055.rBE0tYe8009841@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259372 - stable/10/sys/dev/nand X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:55:35 -0000 Author: ian Date: Sat Dec 14 00:55:34 2013 New Revision: 259372 URL: http://svnweb.freebsd.org/changeset/base/259372 Log: MFC r258740: Look up a nand chip by id in the static table before trying to obtain ONFI parameters. This allows a static table entry to provide valid data for chips known to provide invalid ONFI data. Modified: stable/10/sys/dev/nand/nandbus.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nand/nandbus.c ============================================================================== --- stable/10/sys/dev/nand/nandbus.c Sat Dec 14 00:54:05 2013 (r259371) +++ stable/10/sys/dev/nand/nandbus.c Sat Dec 14 00:55:34 2013 (r259372) @@ -195,8 +195,27 @@ nandbus_attach(device_t dev) if (chip_id.man_id == 0xff) continue; - /* Check if chip is ONFI compliant */ - if (nand_probe_onfi(dev, &onfi) != 0) { + /* + * First try to get info from the table. If that fails, see if + * the chip can provide ONFI info. We check the table first to + * allow table entries to override info from chips that are + * known to provide bad ONFI data. + */ + onfi = 0; + chip_params = nand_get_params(&chip_id); + if (chip_params == NULL) { + nand_probe_onfi(dev, &onfi); + } + + /* + * At this point it appears there is a chip at this chipselect, + * so if we can't work with it, whine about it. + */ + if (chip_params == NULL && onfi == 0) { + if (bootverbose || (nand_debug_flag & NDBG_BUS)) + printf("Chip params not found, chipsel: %d " + "(manuf: 0x%0x, chipid: 0x%0x, onfi: %d)\n", + cs, chip_id.man_id, chip_id.dev_id, onfi); continue; } @@ -218,15 +237,6 @@ nandbus_attach(device_t dev) continue; } - chip_params = nand_get_params(&chip_id); - if (chip_params == NULL) { - nand_debug(NDBG_BUS,"Chip description not found! " - "(manuf: 0x%0x, chipid: 0x%0x)\n", - chip_id.man_id, chip_id.dev_id); - free(ivar, M_NAND); - continue; - } - ivar->cs = cs; ivar->cols = 1; ivar->rows = 2; From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:57:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B464633; Sat, 14 Dec 2013 00:57:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 262EC10F4; Sat, 14 Dec 2013 00:57:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0v6Ie010050; Sat, 14 Dec 2013 00:57:06 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0v6Px010049; Sat, 14 Dec 2013 00:57:06 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140057.rBE0v6Px010049@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:57:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259373 - stable/10/sys/arm/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:57:06 -0000 Author: ian Date: Sat Dec 14 00:57:05 2013 New Revision: 259373 URL: http://svnweb.freebsd.org/changeset/base/259373 Log: MFC r258240: In the data abort handler, don't panic if kdb is available and says it handled the condition. Modified: stable/10/sys/arm/arm/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/trap.c ============================================================================== --- stable/10/sys/arm/arm/trap.c Sat Dec 14 00:55:34 2013 (r259372) +++ stable/10/sys/arm/arm/trap.c Sat Dec 14 00:57:05 2013 (r259373) @@ -528,7 +528,8 @@ dab_fatal(struct trapframe *tf, u_int fs #ifdef KDB if (debugger_on_panic || kdb_active) - kdb_trap(fsr, 0, tf); + if (kdb_trap(fsr, 0, tf)) + return (0); #endif panic("Fatal abort"); /*NOTREACHED*/ From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:58:14 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C2D9813; Sat, 14 Dec 2013 00:58:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 476351103; Sat, 14 Dec 2013 00:58:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0wEdk010209; Sat, 14 Dec 2013 00:58:14 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0wEEN010208; Sat, 14 Dec 2013 00:58:14 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140058.rBE0wEEN010208@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:58:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259374 - stable/10/sys/arm/ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:58:14 -0000 Author: ian Date: Sat Dec 14 00:58:13 2013 New Revision: 259374 URL: http://svnweb.freebsd.org/changeset/base/259374 Log: MFC r258356: Bugfixes... the host capabilties from FDT data are stored in host.caps, not host.host_ocr, examine the correct field when setting up the hardware. Also, the offset for the capabilties register should be 0x140, not 0x240. Modified: stable/10/sys/arm/ti/ti_sdhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/ti/ti_sdhci.c ============================================================================== --- stable/10/sys/arm/ti/ti_sdhci.c Sat Dec 14 00:57:05 2013 (r259373) +++ stable/10/sys/arm/ti/ti_sdhci.c Sat Dec 14 00:58:13 2013 (r259374) @@ -108,7 +108,7 @@ static struct ofw_compat_data compat_dat #define MMCHS_CON 0x02C #define MMCHS_CON_DW8 (1 << 5) #define MMCHS_CON_DVAL_8_4MS (3 << 9) -#define MMCHS_SD_CAPA 0x240 +#define MMCHS_SD_CAPA 0x140 #define MMCHS_SD_CAPA_VS18 (1 << 26) #define MMCHS_SD_CAPA_VS30 (1 << 25) #define MMCHS_SD_CAPA_VS33 (1 << 24) @@ -432,9 +432,9 @@ ti_sdhci_attach(device_t dev) * that it can set the right values in the CAPA register, which can only * be done once and never reset. */ - sc->slot.host.host_ocr |= MMC_OCR_LOW_VOLTAGE; + sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; if (sc->mmchs_device_id == 0 || OF_hasprop(node, "ti,dual-volt")) { - sc->slot.host.host_ocr |= MMC_OCR_290_300 | MMC_OCR_300_310; + sc->slot.host.caps |= MMC_OCR_290_300 | MMC_OCR_300_310; } /* From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:59:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4A274B35; Sat, 14 Dec 2013 00:59:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 355B41129; Sat, 14 Dec 2013 00:59:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0xfTA010469; Sat, 14 Dec 2013 00:59:41 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0xfvc010468; Sat, 14 Dec 2013 00:59:41 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140059.rBE0xfvc010468@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259375 - stable/10/sys/arm/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:59:41 -0000 Author: ian Date: Sat Dec 14 00:59:40 2013 New Revision: 259375 URL: http://svnweb.freebsd.org/changeset/base/259375 Log: MFC r258393: Add USB_HOST_ALIGN=64; the cache line size on the am335x is 64 bytes. Modified: stable/10/sys/arm/conf/BEAGLEBONE Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/BEAGLEBONE ============================================================================== --- stable/10/sys/arm/conf/BEAGLEBONE Sat Dec 14 00:58:13 2013 (r259374) +++ stable/10/sys/arm/conf/BEAGLEBONE Sat Dec 14 00:59:40 2013 (r259375) @@ -104,6 +104,7 @@ device gpio # USB support device usb +options USB_HOST_ALIGN=64 # Cacheline size is 64 on AM335x. options USB_DEBUG #options USB_REQ_DEBUG #options USB_VERBOSE From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 01:12:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 909D7547; Sat, 14 Dec 2013 01:12:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7A53F124A; Sat, 14 Dec 2013 01:12:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE1CFnU017578; Sat, 14 Dec 2013 01:12:15 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE1CDIF017564; Sat, 14 Dec 2013 01:12:13 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140112.rBE1CDIF017564@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 01:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259377 - in stable/10/sys/arm: arm at91 econa s3c2xx0 sa11x0 xscale/i80321 xscale/i8134x xscale/ixp425 xscale/pxa X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 01:12:15 -0000 Author: ian Date: Sat Dec 14 01:12:13 2013 New Revision: 259377 URL: http://svnweb.freebsd.org/changeset/base/259377 Log: MFC r258392, r258412: Call cpu_setup() immediately after the page tables are installed. This enables data cache and other chip-specific features. It was previously done via an early SYSINIT, but it was being done after pmap and vm setup, and those setups need to use mutexes. On some modern ARM platforms, the ldrex/strex instructions that implement mutexes require the data cache to be enabled. Call cpu_setup() from the initarm() routine on platforms that don't use the common FDT-aware initarm() in arm/machdep.c. Modified: stable/10/sys/arm/arm/machdep.c stable/10/sys/arm/at91/at91_machdep.c stable/10/sys/arm/econa/econa_machdep.c stable/10/sys/arm/s3c2xx0/s3c24x0_machdep.c stable/10/sys/arm/sa11x0/assabet_machdep.c stable/10/sys/arm/xscale/i80321/ep80219_machdep.c stable/10/sys/arm/xscale/i80321/iq31244_machdep.c stable/10/sys/arm/xscale/i8134x/crb_machdep.c stable/10/sys/arm/xscale/ixp425/avila_machdep.c stable/10/sys/arm/xscale/pxa/pxa_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/machdep.c ============================================================================== --- stable/10/sys/arm/arm/machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/arm/machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -361,7 +361,6 @@ cpu_startup(void *dummy) #endif #endif - cpu_setup(""); identify_arm_cpu(); printf("real memory = %ju (%ju MB)\n", (uintmax_t)ptoa(physmem), @@ -1427,6 +1426,12 @@ initarm(struct arm_boot_params *abp) cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)); /* + * Now that proper page tables are installed, call cpu_setup() to enable + * instruction and data caches and other chip-specific features. + */ + cpu_setup(""); + + /* * Only after the SOC registers block is mapped we can perform device * tree fixups, as they may attempt to read parameters from hardware. */ Modified: stable/10/sys/arm/at91/at91_machdep.c ============================================================================== --- stable/10/sys/arm/at91/at91_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/at91/at91_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -604,6 +604,7 @@ initarm(struct arm_boot_params *abp) * of the stack memory. */ cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); + cpu_setup(""); set_stackptrs(0); Modified: stable/10/sys/arm/econa/econa_machdep.c ============================================================================== --- stable/10/sys/arm/econa/econa_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/econa/econa_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -309,6 +309,7 @@ initarm(struct arm_boot_params *abp) * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); + cpu_setup(""); /* Set stack for exception handlers */ data_abort_handler_address = (u_int)data_abort_handler; Modified: stable/10/sys/arm/s3c2xx0/s3c24x0_machdep.c ============================================================================== --- stable/10/sys/arm/s3c2xx0/s3c24x0_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/s3c2xx0/s3c24x0_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -355,6 +355,7 @@ initarm(struct arm_boot_params *abp) * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); + cpu_setup(""); /* Disable all peripheral interrupts */ ioreg_write32(S3C24X0_INTCTL_BASE + INTCTL_INTMSK, ~0); Modified: stable/10/sys/arm/sa11x0/assabet_machdep.c ============================================================================== --- stable/10/sys/arm/sa11x0/assabet_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/sa11x0/assabet_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -371,6 +371,7 @@ initarm(struct arm_boot_params *abp) cpufunc_control(0x337f, 0x107d); arm_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL); + cpu_setup(""); pmap_curmaxkvaddr = freemempos + KERNEL_PT_VMDATA_NUM * 0x400000; Modified: stable/10/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- stable/10/sys/arm/xscale/i80321/ep80219_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/xscale/i80321/ep80219_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -334,6 +334,8 @@ initarm(struct arm_boot_params *abp) * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); + cpu_setup(""); + /* * Fetch the SDRAM start/size from the i80321 SDRAM configration * registers. Modified: stable/10/sys/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- stable/10/sys/arm/xscale/i80321/iq31244_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/xscale/i80321/iq31244_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -335,6 +335,8 @@ initarm(struct arm_boot_params *abp) * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); + cpu_setup(""); + /* * Fetch the SDRAM start/size from the i80321 SDRAM configration * registers. Modified: stable/10/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- stable/10/sys/arm/xscale/i8134x/crb_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/xscale/i8134x/crb_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -320,6 +320,8 @@ initarm(struct arm_boot_params *abp) * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); + cpu_setup(""); + i80321_calibrate_delay(); i81342_sdram_bounds(&obio_bs_tag, IOP34X_VADDR, &memstart, &memsize); physmem = memsize / PAGE_SIZE; Modified: stable/10/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- stable/10/sys/arm/xscale/ixp425/avila_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/xscale/ixp425/avila_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -405,6 +405,8 @@ initarm(struct arm_boot_params *abp) * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); + cpu_setup(""); + /* ready to setup the console (XXX move earlier if possible) */ cninit(); /* Modified: stable/10/sys/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- stable/10/sys/arm/xscale/pxa/pxa_machdep.c Sat Dec 14 01:01:32 2013 (r259376) +++ stable/10/sys/arm/xscale/pxa/pxa_machdep.c Sat Dec 14 01:12:13 2013 (r259377) @@ -317,6 +317,7 @@ initarm(struct arm_boot_params *abp) * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); + cpu_setup(""); /* * Sort out bus_space for on-board devices. From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 01:14:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 39C3B7DE; Sat, 14 Dec 2013 01:14:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 199111264; Sat, 14 Dec 2013 01:14:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE1Ecdo018031; Sat, 14 Dec 2013 01:14:38 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE1EcPR018030; Sat, 14 Dec 2013 01:14:38 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140114.rBE1EcPR018030@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 01:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259378 - stable/10/sys/arm/at91 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 01:14:39 -0000 Author: ian Date: Sat Dec 14 01:14:38 2013 New Revision: 259378 URL: http://svnweb.freebsd.org/changeset/base/259378 Log: MFC r258820: Add definitions for the PIO pins found on recent AT91 SoCs. Modified: stable/10/sys/arm/at91/at91_pioreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/at91/at91_pioreg.h ============================================================================== --- stable/10/sys/arm/at91/at91_pioreg.h Sat Dec 14 01:12:13 2013 (r259377) +++ stable/10/sys/arm/at91/at91_pioreg.h Sat Dec 14 01:14:38 2013 (r259378) @@ -164,5 +164,69 @@ #define AT91C_PIO_PC29 ((unsigned int) 1 << 29) // Pin Controlled by PC29 #define AT91C_PIO_PC30 ((unsigned int) 1 << 30) // Pin Controlled by PC30 #define AT91C_PIO_PC31 ((unsigned int) 1 << 31) // Pin Controlled by PC31 +#define AT91C_PIO_PD0 ((unsigned int) 1 << 0) // Pin Controlled by PD0 +#define AT91C_PIO_PD1 ((unsigned int) 1 << 1) // Pin Controlled by PD1 +#define AT91C_PIO_PD2 ((unsigned int) 1 << 2) // Pin Controlled by PD2 +#define AT91C_PIO_PD3 ((unsigned int) 1 << 3) // Pin Controlled by PD3 +#define AT91C_PIO_PD4 ((unsigned int) 1 << 4) // Pin Controlled by PD4 +#define AT91C_PIO_PD5 ((unsigned int) 1 << 5) // Pin Controlled by PD5 +#define AT91C_PIO_PD6 ((unsigned int) 1 << 6) // Pin Controlled by PD6 +#define AT91C_PIO_PD7 ((unsigned int) 1 << 7) // Pin Controlled by PD7 +#define AT91C_PIO_PD8 ((unsigned int) 1 << 8) // Pin Controlled by PD8 +#define AT91C_PIO_PD9 ((unsigned int) 1 << 9) // Pin Controlled by PD9 +#define AT91C_PIO_PD10 ((unsigned int) 1 << 10) // Pin Controlled by PD10 +#define AT91C_PIO_PD11 ((unsigned int) 1 << 11) // Pin Controlled by PD11 +#define AT91C_PIO_PD12 ((unsigned int) 1 << 12) // Pin Controlled by PD12 +#define AT91C_PIO_PD13 ((unsigned int) 1 << 13) // Pin Controlled by PD13 +#define AT91C_PIO_PD14 ((unsigned int) 1 << 14) // Pin Controlled by PD14 +#define AT91C_PIO_PD15 ((unsigned int) 1 << 15) // Pin Controlled by PD15 +#define AT91C_PIO_PD16 ((unsigned int) 1 << 16) // Pin Controlled by PD16 +#define AT91C_PIO_PD17 ((unsigned int) 1 << 17) // Pin Controlled by PD17 +#define AT91C_PIO_PD18 ((unsigned int) 1 << 18) // Pin Controlled by PD18 +#define AT91C_PIO_PD19 ((unsigned int) 1 << 19) // Pin Controlled by PD19 +#define AT91C_PIO_PD20 ((unsigned int) 1 << 20) // Pin Controlled by PD20 +#define AT91C_PIO_PD21 ((unsigned int) 1 << 21) // Pin Controlled by PD21 +#define AT91C_PIO_PD22 ((unsigned int) 1 << 22) // Pin Controlled by PD22 +#define AT91C_PIO_PD23 ((unsigned int) 1 << 23) // Pin Controlled by PD23 +#define AT91C_PIO_PD24 ((unsigned int) 1 << 24) // Pin Controlled by PD24 +#define AT91C_PIO_PD25 ((unsigned int) 1 << 25) // Pin Controlled by PD25 +#define AT91C_PIO_PD26 ((unsigned int) 1 << 26) // Pin Controlled by PD26 +#define AT91C_PIO_PD27 ((unsigned int) 1 << 27) // Pin Controlled by PD27 +#define AT91C_PIO_PD28 ((unsigned int) 1 << 28) // Pin Controlled by PD28 +#define AT91C_PIO_PD29 ((unsigned int) 1 << 29) // Pin Controlled by PD29 +#define AT91C_PIO_PD30 ((unsigned int) 1 << 30) // Pin Controlled by PD30 +#define AT91C_PIO_PD31 ((unsigned int) 1 << 31) // Pin Controlled by PD31 +#define AT91C_PIO_PE0 ((unsigned int) 1 << 0) // Pin Controlled by PE0 +#define AT91C_PIO_PE1 ((unsigned int) 1 << 1) // Pin Controlled by PE1 +#define AT91C_PIO_PE2 ((unsigned int) 1 << 2) // Pin Controlled by PE2 +#define AT91C_PIO_PE3 ((unsigned int) 1 << 3) // Pin Controlled by PE3 +#define AT91C_PIO_PE4 ((unsigned int) 1 << 4) // Pin Controlled by PE4 +#define AT91C_PIO_PE5 ((unsigned int) 1 << 5) // Pin Controlled by PE5 +#define AT91C_PIO_PE6 ((unsigned int) 1 << 6) // Pin Controlled by PE6 +#define AT91C_PIO_PE7 ((unsigned int) 1 << 7) // Pin Controlled by PE7 +#define AT91C_PIO_PE8 ((unsigned int) 1 << 8) // Pin Controlled by PE8 +#define AT91C_PIO_PE9 ((unsigned int) 1 << 9) // Pin Controlled by PE9 +#define AT91C_PIO_PE10 ((unsigned int) 1 << 10) // Pin Controlled by PE10 +#define AT91C_PIO_PE11 ((unsigned int) 1 << 11) // Pin Controlled by PE11 +#define AT91C_PIO_PE12 ((unsigned int) 1 << 12) // Pin Controlled by PE12 +#define AT91C_PIO_PE13 ((unsigned int) 1 << 13) // Pin Controlled by PE13 +#define AT91C_PIO_PE14 ((unsigned int) 1 << 14) // Pin Controlled by PE14 +#define AT91C_PIO_PE15 ((unsigned int) 1 << 15) // Pin Controlled by PE15 +#define AT91C_PIO_PE16 ((unsigned int) 1 << 16) // Pin Controlled by PE16 +#define AT91C_PIO_PE17 ((unsigned int) 1 << 17) // Pin Controlled by PE17 +#define AT91C_PIO_PE18 ((unsigned int) 1 << 18) // Pin Controlled by PE18 +#define AT91C_PIO_PE19 ((unsigned int) 1 << 19) // Pin Controlled by PE19 +#define AT91C_PIO_PE20 ((unsigned int) 1 << 20) // Pin Controlled by PE20 +#define AT91C_PIO_PE21 ((unsigned int) 1 << 21) // Pin Controlled by PE21 +#define AT91C_PIO_PE22 ((unsigned int) 1 << 22) // Pin Controlled by PE22 +#define AT91C_PIO_PE23 ((unsigned int) 1 << 23) // Pin Controlled by PE23 +#define AT91C_PIO_PE24 ((unsigned int) 1 << 24) // Pin Controlled by PE24 +#define AT91C_PIO_PE25 ((unsigned int) 1 << 25) // Pin Controlled by PE25 +#define AT91C_PIO_PE26 ((unsigned int) 1 << 26) // Pin Controlled by PE26 +#define AT91C_PIO_PE27 ((unsigned int) 1 << 27) // Pin Controlled by PE27 +#define AT91C_PIO_PE28 ((unsigned int) 1 << 28) // Pin Controlled by PE28 +#define AT91C_PIO_PE29 ((unsigned int) 1 << 29) // Pin Controlled by PE29 +#define AT91C_PIO_PE30 ((unsigned int) 1 << 30) // Pin Controlled by PE30 +#define AT91C_PIO_PE31 ((unsigned int) 1 << 31) // Pin Controlled by PE31 #endif /* ARM_AT91_AT91_PIOREG_H */ From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 01:15:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A19F5934; Sat, 14 Dec 2013 01:15:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 81AF8126B; Sat, 14 Dec 2013 01:15:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE1FRtx018220; Sat, 14 Dec 2013 01:15:27 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE1FRhv018218; Sat, 14 Dec 2013 01:15:27 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140115.rBE1FRhv018218@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 01:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259379 - in stable/10/sys: arm/at91 dev/nand X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 01:15:27 -0000 Author: ian Date: Sat Dec 14 01:15:26 2013 New Revision: 259379 URL: http://svnweb.freebsd.org/changeset/base/259379 Log: MFC r258828: Add a nand flash controller driver for Atmel at91 family. Tested only on at91rm9200 so far. Added: stable/10/sys/dev/nand/nfc_at91.c - copied unchanged from r258828, head/sys/dev/nand/nfc_at91.c Modified: stable/10/sys/arm/at91/files.at91 Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/at91/files.at91 ============================================================================== --- stable/10/sys/arm/at91/files.at91 Sat Dec 14 01:14:38 2013 (r259378) +++ stable/10/sys/arm/at91/files.at91 Sat Dec 14 01:15:26 2013 (r259379) @@ -5,7 +5,7 @@ arm/at91/at91_machdep.c standard arm/at91/at91.c standard arm/at91/at91_cfata.c optional at91_cfata arm/at91/at91_mci.c optional at91_mci -arm/at91/at91_nand.c optional nand +dev/nand/nfc_at91.c optional nand arm/at91/at91_pio.c standard arm/at91/at91_pmc.c standard arm/at91/at91_pit.c optional at91sam9 Copied: stable/10/sys/dev/nand/nfc_at91.c (from r258828, head/sys/dev/nand/nfc_at91.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/nand/nfc_at91.c Sat Dec 14 01:15:26 2013 (r259379, copy of r258828, head/sys/dev/nand/nfc_at91.c) @@ -0,0 +1,258 @@ +/*- + * Copyright (C) 2013 Ian Lepore. + * 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. + */ + +/* + * Atmel at91-family integrated NAND controller driver. + * + * This code relies on the board setup code (in at91/board_whatever.c) having + * set up the EBI and SMC registers appropriately for whatever type of nand part + * is on the board. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include "nfc_if.h" + +/* + * Data cycles are triggered by access to any address within the EBI CS3 region + * that has A21 and A22 clear. Command cycles are any access with bit A21 + * asserted. Address cycles are any access with bit A22 asserted. + * + * XXX The atmel docs say that any address bits can be used instead of A21 and + * A22; these values should be configurable. + */ +#define AT91_NAND_DATA 0 +#define AT91_NAND_COMMAND (1 << 21) +#define AT91_NAND_ADDRESS (1 << 22) + +struct at91_nand_softc { + struct nand_softc nand_sc; + struct resource *res; +}; + +static int at91_nand_attach(device_t); +static int at91_nand_probe(device_t); +static uint8_t at91_nand_read_byte(device_t); +static void at91_nand_read_buf(device_t, void *, uint32_t); +static int at91_nand_read_rnb(device_t); +static int at91_nand_select_cs(device_t, uint8_t); +static int at91_nand_send_command(device_t, uint8_t); +static int at91_nand_send_address(device_t, uint8_t); +static void at91_nand_write_buf(device_t, void *, uint32_t); + +static inline u_int8_t +dev_read_1(struct at91_nand_softc *sc, bus_size_t offset) +{ + return bus_read_1(sc->res, offset); +} + +static inline void +dev_write_1(struct at91_nand_softc *sc, bus_size_t offset, u_int8_t value) +{ + bus_write_1(sc->res, offset, value); +} + +static int +at91_nand_probe(device_t dev) +{ + + device_set_desc(dev, "AT91 Integrated NAND controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +at91_nand_attach(device_t dev) +{ + struct at91_nand_softc *sc; + int err, rid; + + sc = device_get_softc(dev); + rid = 0; + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->res == NULL) { + device_printf(dev, "could not allocate resources!\n"); + return (ENXIO); + } + + nand_init(&sc->nand_sc, dev, NAND_ECC_SOFT, 0, 0, NULL, NULL); + + err = nandbus_create(dev); + + return (err); +} + +static int +at91_nand_send_command(device_t dev, uint8_t command) +{ + struct at91_nand_softc *sc; + + /* nand_debug(NDBG_DRV,"at91_nand_send_command: 0x%02x", command); */ + + sc = device_get_softc(dev); + dev_write_1(sc, AT91_NAND_COMMAND, command); + return (0); +} + +static int +at91_nand_send_address(device_t dev, uint8_t addr) +{ + struct at91_nand_softc *sc; + + /* nand_debug(NDBG_DRV,"at91_nand_send_address: x%02x", addr); */ + + sc = device_get_softc(dev); + dev_write_1(sc, AT91_NAND_ADDRESS, addr); + return (0); +} + +static uint8_t +at91_nand_read_byte(device_t dev) +{ + struct at91_nand_softc *sc; + uint8_t data; + + sc = device_get_softc(dev); + data = dev_read_1(sc, AT91_NAND_DATA); + + /* nand_debug(NDBG_DRV,"at91_nand_read_byte: 0x%02x", data); */ + + return (data); +} + + +static void +at91_nand_dump_buf(const char *op, void* buf, uint32_t len) +{ + int i; + uint8_t *b = buf; + + printf("at91_nand_%s_buf (hex):", op); + for (i = 0; i < len; i++) { + if ((i & 0x01f) == 0) + printf("\n"); + printf(" %02x", b[i]); + } + printf("\n"); +} + +static void +at91_nand_read_buf(device_t dev, void* buf, uint32_t len) +{ + struct at91_nand_softc *sc; + + sc = device_get_softc(dev); + + bus_read_multi_1(sc->res, AT91_NAND_DATA, buf, len); + + if (nand_debug_flag & NDBG_DRV) + at91_nand_dump_buf("read", buf, len); +} + +static void +at91_nand_write_buf(device_t dev, void* buf, uint32_t len) +{ + struct at91_nand_softc *sc; + + sc = device_get_softc(dev); + + if (nand_debug_flag & NDBG_DRV) + at91_nand_dump_buf("write", buf, len); + + bus_write_multi_1(sc->res, AT91_NAND_DATA, buf, len); +} + +static int +at91_nand_select_cs(device_t dev, uint8_t cs) +{ + + if (cs > 0) + return (ENODEV); + + return (0); +} + +static int +at91_nand_read_rnb(device_t dev) +{ +#if 0 + /* + * XXX There's no way for this code to know which GPIO pin (if any) is + * attached to the chip's RNB line. Not to worry, nothing calls this; + * at higher layers, all the nand code uses status commands. + */ + uint32_t bits; + + bits = at91_pio_gpio_get(AT91RM92_PIOD_BASE, AT91C_PIO_PD15); + nand_debug(NDBG_DRV,"at91_nand: read_rnb: %#x", bits); + return (bits != 0); /* ready */ +#endif + panic("at91_nand_read_rnb() is not implemented\n"); + return (0); +} + +static device_method_t at91_nand_methods[] = { + DEVMETHOD(device_probe, at91_nand_probe), + DEVMETHOD(device_attach, at91_nand_attach), + + DEVMETHOD(nfc_send_command, at91_nand_send_command), + DEVMETHOD(nfc_send_address, at91_nand_send_address), + DEVMETHOD(nfc_read_byte, at91_nand_read_byte), + DEVMETHOD(nfc_read_buf, at91_nand_read_buf), + DEVMETHOD(nfc_write_buf, at91_nand_write_buf), + DEVMETHOD(nfc_select_cs, at91_nand_select_cs), + DEVMETHOD(nfc_read_rnb, at91_nand_read_rnb), + + DEVMETHOD_END +}; + +static driver_t at91_nand_driver = { + "nand", + at91_nand_methods, + sizeof(struct at91_nand_softc), +}; + +static devclass_t at91_nand_devclass; +DRIVER_MODULE(at91_nand, atmelarm, at91_nand_driver, at91_nand_devclass, 0, 0); + From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 01:34:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD8BAE4F; Sat, 14 Dec 2013 01:34:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C8F251393; Sat, 14 Dec 2013 01:34:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE1YOVm025016; Sat, 14 Dec 2013 01:34:24 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE1YOdU025015; Sat, 14 Dec 2013 01:34:24 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140134.rBE1YOdU025015@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 01:34:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259380 - stable/10/sys/arm/at91 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 01:34:25 -0000 Author: ian Date: Sat Dec 14 01:34:24 2013 New Revision: 259380 URL: http://svnweb.freebsd.org/changeset/base/259380 Log: MFC r259038, r259039: Bump the maximum VM space from 3 * memory size to a fixed 256MB. That's all we have room for since we map the hardware registers starting at 0xd0000000. This allows my 64MB AT91SAM9G20 to boot again after the unmmaped I/O changes were MFC'd at r251897. Other subplatforms may need similar treatment. Although not strictly required to boot a 64MB board, bump vm_max_virtual_address to be KERNVIRTADDR + 256MB. This allows some future shock protection since the KVA requirements have gone up since the unmapped changes have gone in, as well as preventing us from overlapping with the hardware devices, which we map at 0xd0000000, which we'd hit with anything more than 85MB... Modified: stable/10/sys/arm/at91/at91_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/at91/at91_machdep.c ============================================================================== --- stable/10/sys/arm/at91/at91_machdep.c Sat Dec 14 01:15:26 2013 (r259379) +++ stable/10/sys/arm/at91/at91_machdep.c Sat Dec 14 01:34:24 2013 (r259380) @@ -633,7 +633,8 @@ initarm(struct arm_boot_params *abp) pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1); arm_dump_avail_init(memsize, sizeof(dump_avail)/sizeof(dump_avail[0])); - vm_max_kernel_address = KERNVIRTADDR + 3 * memsize; + /* Always use the 256MB of KVA we have available between the kernel and devices */ + vm_max_kernel_address = KERNVIRTADDR + (256 << 20); pmap_bootstrap(freemempos, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 01:35:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33434F9E; Sat, 14 Dec 2013 01:35:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 13B2F139A; Sat, 14 Dec 2013 01:35:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE1ZvBZ025243; Sat, 14 Dec 2013 01:35:57 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE1ZvkH025242; Sat, 14 Dec 2013 01:35:57 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140135.rBE1ZvkH025242@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 01:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259381 - stable/10/sys/arm/at91 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 01:35:58 -0000 Author: ian Date: Sat Dec 14 01:35:57 2013 New Revision: 259381 URL: http://svnweb.freebsd.org/changeset/base/259381 Log: MFC r259212, r259220: Fix one race and one fence post error. When the TX buffer was completely full, we'd not complete any of the mbufs due to the fence post error (this creates a large leak). When this is fixed, we still leak, but at a much smaller rate due to a race between ateintr and atestart_locked as well as an asymmetry where atestart_locked is called from elsewhere. Ensure that we free in-flight packets that have completed there as well. Also remove needless check for NULL on mb, checked earlier in the loop and simplify a redundant if. Modified: stable/10/sys/arm/at91/if_ate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/at91/if_ate.c ============================================================================== --- stable/10/sys/arm/at91/if_ate.c Sat Dec 14 01:34:24 2013 (r259380) +++ stable/10/sys/arm/at91/if_ate.c Sat Dec 14 01:35:57 2013 (r259381) @@ -947,10 +947,8 @@ ate_intr(void *xsc) } while (!done); - if (mb != NULL) { - ifp->if_ipackets++; - (*ifp->if_input)(ifp, mb); - } + ifp->if_ipackets++; + (*ifp->if_input)(ifp, mb); } } @@ -974,16 +972,14 @@ ate_intr(void *xsc) sc->tx_descs[sc->txtail + 1].status |= ETHB_TX_USED; } - while (sc->txtail != sc->txhead && - sc->tx_descs[sc->txtail].status & ETHB_TX_USED ) { - + while ((sc->tx_descs[sc->txtail].status & ETHB_TX_USED) && + sc->sent_mbuf[sc->txtail] != NULL) { bus_dmamap_sync(sc->mtag, sc->tx_map[sc->txtail], BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->mtag, sc->tx_map[sc->txtail]); m_freem(sc->sent_mbuf[sc->txtail]); sc->tx_descs[sc->txtail].addr = 0; sc->sent_mbuf[sc->txtail] = NULL; - ifp->if_opackets++; sc->txtail = NEXT_TX_IDX(sc, sc->txtail); } @@ -1118,12 +1114,10 @@ atestart_locked(struct ifnet *ifp) * xmit packets. We use OACTIVE to indicate "we can stuff more * into our buffers (clear) or not (set)." */ - if (!sc->is_emacb) { - /* RM9200 has only two hardware entries */ - if (!sc->is_emacb && (RD4(sc, ETH_TSR) & ETH_TSR_BNQ) == 0) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - return; - } + /* RM9200 has only two hardware entries */ + if (!sc->is_emacb && (RD4(sc, ETH_TSR) & ETH_TSR_BNQ) == 0) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + return; } IFQ_DRV_DEQUEUE(&ifp->if_snd, m); @@ -1146,6 +1140,21 @@ atestart_locked(struct ifnet *ifp) m_freem(m); continue; } + + /* + * There's a small race between the loop in ate_intr finishing + * and the check above to see if the packet was finished, as well + * as when atestart gets called via other paths. Lose the race + * gracefully and free the mbuf... + */ + if (sc->sent_mbuf[sc->txhead] != NULL) { + bus_dmamap_sync(sc->mtag, sc->tx_map[sc->txtail], + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->mtag, sc->tx_map[sc->txtail]); + m_free(sc->sent_mbuf[sc->txhead]); + ifp->if_opackets++; + } + sc->sent_mbuf[sc->txhead] = m; bus_dmamap_sync(sc->mtag, sc->tx_map[sc->txhead], From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 04:16:28 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 93635D6B; Sat, 14 Dec 2013 04:16:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F2AB133B; Sat, 14 Dec 2013 04:16:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE4GSaB089279; Sat, 14 Dec 2013 04:16:28 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE4GSfK089278; Sat, 14 Dec 2013 04:16:28 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201312140416.rBE4GSfK089278@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 14 Dec 2013 04:16:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259383 - stable/10/sys/geom/eli X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 04:16:28 -0000 Author: ae Date: Sat Dec 14 04:16:27 2013 New Revision: 259383 URL: http://svnweb.freebsd.org/changeset/base/259383 Log: MFC r257965: Add missing line breaks. PR: 181900 Modified: stable/10/sys/geom/eli/g_eli.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/eli/g_eli.c ============================================================================== --- stable/10/sys/geom/eli/g_eli.c Sat Dec 14 03:08:03 2013 (r259382) +++ stable/10/sys/geom/eli/g_eli.c Sat Dec 14 04:16:27 2013 (r259383) @@ -1170,9 +1170,9 @@ g_eli_dumpconf(struct sbuf *sb, const ch if (pp != NULL || cp != NULL) return; /* Nothing here. */ - sbuf_printf(sb, "%s%ju", indent, + sbuf_printf(sb, "%s%ju\n", indent, (uintmax_t)sc->sc_ekeys_total); - sbuf_printf(sb, "%s%ju", indent, + sbuf_printf(sb, "%s%ju\n", indent, (uintmax_t)sc->sc_ekeys_allocated); sbuf_printf(sb, "%s", indent); if (sc->sc_flags == 0) From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 04:16:47 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A6458EAA; Sat, 14 Dec 2013 04:16:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 926C1133E; Sat, 14 Dec 2013 04:16:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE4Glud089346; Sat, 14 Dec 2013 04:16:47 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE4GlUP089345; Sat, 14 Dec 2013 04:16:47 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201312140416.rBE4GlUP089345@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 14 Dec 2013 04:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259384 - stable/9/sys/geom/eli X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 04:16:47 -0000 Author: ae Date: Sat Dec 14 04:16:47 2013 New Revision: 259384 URL: http://svnweb.freebsd.org/changeset/base/259384 Log: MFC r257965: Add missing line breaks. PR: 181900 Modified: stable/9/sys/geom/eli/g_eli.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/eli/g_eli.c ============================================================================== --- stable/9/sys/geom/eli/g_eli.c Sat Dec 14 04:16:27 2013 (r259383) +++ stable/9/sys/geom/eli/g_eli.c Sat Dec 14 04:16:47 2013 (r259384) @@ -1163,9 +1163,9 @@ g_eli_dumpconf(struct sbuf *sb, const ch if (pp != NULL || cp != NULL) return; /* Nothing here. */ - sbuf_printf(sb, "%s%ju", indent, + sbuf_printf(sb, "%s%ju\n", indent, (uintmax_t)sc->sc_ekeys_total); - sbuf_printf(sb, "%s%ju", indent, + sbuf_printf(sb, "%s%ju\n", indent, (uintmax_t)sc->sc_ekeys_allocated); sbuf_printf(sb, "%s", indent); if (sc->sc_flags == 0) From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 04:24:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68194292; Sat, 14 Dec 2013 04:24:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 530371438; Sat, 14 Dec 2013 04:24:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE4OX9H092966; Sat, 14 Dec 2013 04:24:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE4OXMs092965; Sat, 14 Dec 2013 04:24:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201312140424.rBE4OXMs092965@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 14 Dec 2013 04:24:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259385 - stable/10/sys/netipsec X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 04:24:33 -0000 Author: ae Date: Sat Dec 14 04:24:32 2013 New Revision: 259385 URL: http://svnweb.freebsd.org/changeset/base/259385 Log: MFC r257987: Initialize prot variable. PR: 177417 Modified: stable/10/sys/netipsec/ipsec_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netipsec/ipsec_input.c ============================================================================== --- stable/10/sys/netipsec/ipsec_input.c Sat Dec 14 04:16:47 2013 (r259384) +++ stable/10/sys/netipsec/ipsec_input.c Sat Dec 14 04:24:32 2013 (r259385) @@ -602,6 +602,7 @@ ipsec6_common_input_cb(struct mbuf *m, s ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(struct ip6_hdr)); /* Save protocol */ + prot = 0; m_copydata(m, protoff, 1, (unsigned char *) &prot); #ifdef notyet From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 04:24:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 250153C3; Sat, 14 Dec 2013 04:24:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 10F02143E; Sat, 14 Dec 2013 04:24:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE4Oodq093030; Sat, 14 Dec 2013 04:24:50 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE4OoQ1093029; Sat, 14 Dec 2013 04:24:50 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201312140424.rBE4OoQ1093029@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 14 Dec 2013 04:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r259386 - stable/8/sys/netipsec X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 04:24:51 -0000 Author: ae Date: Sat Dec 14 04:24:50 2013 New Revision: 259386 URL: http://svnweb.freebsd.org/changeset/base/259386 Log: MFC r257987: Initialize prot variable. PR: 177417 Modified: stable/8/sys/netipsec/ipsec_input.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netipsec/ (props changed) Modified: stable/8/sys/netipsec/ipsec_input.c ============================================================================== --- stable/8/sys/netipsec/ipsec_input.c Sat Dec 14 04:24:32 2013 (r259385) +++ stable/8/sys/netipsec/ipsec_input.c Sat Dec 14 04:24:50 2013 (r259386) @@ -615,6 +615,7 @@ ipsec6_common_input_cb(struct mbuf *m, s ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(struct ip6_hdr)); /* Save protocol */ + prot = 0; m_copydata(m, protoff, 1, (unsigned char *) &prot); #ifdef notyet From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 04:27:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F3AD45D3; Sat, 14 Dec 2013 04:27:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DF5211473; Sat, 14 Dec 2013 04:27:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE4RSa5093366; Sat, 14 Dec 2013 04:27:28 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE4RSk1093365; Sat, 14 Dec 2013 04:27:28 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201312140427.rBE4RSk1093365@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 14 Dec 2013 04:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259387 - stable/9/sys/netipsec X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 04:27:29 -0000 Author: ae Date: Sat Dec 14 04:27:28 2013 New Revision: 259387 URL: http://svnweb.freebsd.org/changeset/base/259387 Log: MFC r257987: Initialize prot variable. PR: 177417 Modified: stable/9/sys/netipsec/ipsec_input.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netipsec/ipsec_input.c ============================================================================== --- stable/9/sys/netipsec/ipsec_input.c Sat Dec 14 04:24:50 2013 (r259386) +++ stable/9/sys/netipsec/ipsec_input.c Sat Dec 14 04:27:28 2013 (r259387) @@ -602,6 +602,7 @@ ipsec6_common_input_cb(struct mbuf *m, s ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(struct ip6_hdr)); /* Save protocol */ + prot = 0; m_copydata(m, protoff, 1, (unsigned char *) &prot); #ifdef notyet From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 20:55:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C2F2557A; Sat, 14 Dec 2013 20:55:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AD7CF1E1D; Sat, 14 Dec 2013 20:55:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBEKts9P049596; Sat, 14 Dec 2013 20:55:54 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBEKtsPZ049592; Sat, 14 Dec 2013 20:55:54 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312142055.rBEKtsPZ049592@svn.freebsd.org> From: Glen Barber Date: Sat, 14 Dec 2013 20:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259396 - in stable/10/usr.sbin: bsdconfig/share bsdinstall bsdinstall/scripts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 20:55:54 -0000 Author: gjb Date: Sat Dec 14 20:55:53 2013 New Revision: 259396 URL: http://svnweb.freebsd.org/changeset/base/259396 Log: MFC r259113, r259115, r259144, r259148: r259113 (dteske): Fix failed attempt to send pkg(8) stderr to /dev/null r259115 (dteske): Prevent truncating /tmp/bsdinstall_log each time we exec a module. r259144 (dteske): Fix a regression after successfully installing to encrypted ZFS root, the passphrase is not accepted and a message about "incorrect key" is displayed. r259148 (dteske): Fix a regression resulting in mountroot prompt after attempting to install to encrypted ZFS root (caused by a typo in a variable name -- ZFSBOOT_BOOT_FSNAME -> ZFSBOOT_BOOTFS_NAME). Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/bsdconfig/share/common.subr stable/10/usr.sbin/bsdinstall/bsdinstall stable/10/usr.sbin/bsdinstall/scripts/zfsboot Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/share/common.subr Sat Dec 14 20:12:28 2013 (r259395) +++ stable/10/usr.sbin/bsdconfig/share/common.subr Sat Dec 14 20:55:53 2013 (r259396) @@ -64,8 +64,8 @@ export UNAME_M="$(uname -m)" # Machine p export UNAME_R="$(uname -r)" # Release Level (i.e. X.Y-RELEASE) if [ ! "${PKG_ABI+set}" ]; then export PKG_ABI="$( - ASSUME_ALWAYS_YES=1 pkg -vv | - awk '$1=="ABI"{print $3;exit}' 2> /dev/null + ASSUME_ALWAYS_YES=1 pkg -vv 2> /dev/null | + awk '$1=="ABI"{print $3;exit}' )" fi Modified: stable/10/usr.sbin/bsdinstall/bsdinstall ============================================================================== --- stable/10/usr.sbin/bsdinstall/bsdinstall Sat Dec 14 20:12:28 2013 (r259395) +++ stable/10/usr.sbin/bsdinstall/bsdinstall Sat Dec 14 20:55:53 2013 (r259396) @@ -33,6 +33,7 @@ # re-processing of flags (all children log to the parent's log file). # export DEBUG_SELF_INITIALIZE= +export DEBUG_INITIALIZE_FILE= BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 Modified: stable/10/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/zfsboot Sat Dec 14 20:12:28 2013 (r259395) +++ stable/10/usr.sbin/bsdinstall/scripts/zfsboot Sat Dec 14 20:55:53 2013 (r259396) @@ -1190,7 +1190,7 @@ zfs_create_boot() f_eval_catch $funcname echo "$ECHO_APPEND" 'geom_eli_load=\"YES\"' \ \$BSDINSTALL_TMPBOOT/loader.conf.geli || return $FAILURE f_eval_catch $funcname printf "$PRINTF_CONF" vfs.root.mountfrom \ - '"zfs:$poolname/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOT_FSNAME"' \ + '"zfs:$poolname/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"' \ \$BSDINSTALL_TMPBOOT/loader.conf.root || return $FAILURE f_dprintf "$funcname: disks=[%s]" "$disks" for disk in $disks; do @@ -1203,7 +1203,7 @@ zfs_create_boot() return $FAILURE f_eval_catch $funcname printf "$PRINTF_CONF" \ geli_%s_keyfile0_type \ - '"$disk$targetpart" "$disk$targetpart"' \ + '"$disk$targetpart" "$disk$targetpart:geli_keyfile0"' \ \$BSDINSTALL_TMPBOOT/loader.conf.\$disk\$targetpart || return $FAILURE f_eval_catch $funcname printf "$PRINTF_CONF" \ From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 22:39:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44B8BD3E; Sat, 14 Dec 2013 22:39:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 302871379; Sat, 14 Dec 2013 22:39:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBEMd2Wp087207; Sat, 14 Dec 2013 22:39:02 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBEMd2ex087206; Sat, 14 Dec 2013 22:39:02 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312142239.rBEMd2ex087206@svn.freebsd.org> From: Glen Barber Date: Sat, 14 Dec 2013 22:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259399 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 22:39:02 -0000 Author: gjb Date: Sat Dec 14 22:39:01 2013 New Revision: 259399 URL: http://svnweb.freebsd.org/changeset/base/259399 Log: MFC r256430: Reduce disc1.iso image size by installing the userland with the WITHOUT_PROFILE=1 option set, trimming 56MB from the image. This change was somehow lost during the 10.0-RELEASE cycle, and is intended for MFC to releng/10.0. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Sat Dec 14 22:28:32 2013 (r259398) +++ stable/10/release/Makefile Sat Dec 14 22:39:01 2013 (r259399) @@ -140,7 +140,8 @@ system: packagesystem # Install system mkdir -p release cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ - DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 + DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \ + WITHOUT_PROFILE=1 # Copy distfiles mkdir -p release/usr/freebsd-dist cp *.txz MANIFEST release/usr/freebsd-dist From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 22:43:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9301BFDA; Sat, 14 Dec 2013 22:43:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7E78313DB; Sat, 14 Dec 2013 22:43:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBEMhUhW090824; Sat, 14 Dec 2013 22:43:30 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBEMhUH0090823; Sat, 14 Dec 2013 22:43:30 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312142243.rBEMhUH0090823@svn.freebsd.org> From: Glen Barber Date: Sat, 14 Dec 2013 22:43:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259401 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 22:43:30 -0000 Author: gjb Date: Sat Dec 14 22:43:30 2013 New Revision: 259401 URL: http://svnweb.freebsd.org/changeset/base/259401 Log: MFC r259400: Reduce disc1.iso size by 74MB by removing lib32 libraries, sendmail, and atf. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Sat Dec 14 22:41:17 2013 (r259400) +++ stable/10/release/Makefile Sat Dec 14 22:43:30 2013 (r259401) @@ -141,7 +141,7 @@ system: packagesystem mkdir -p release cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \ - WITHOUT_PROFILE=1 + WITHOUT_PROFILE=1 WITHOUT_SENDMAIL=1 WITHOUT_ATF=1 WITHOUT_LIB32=1 # Copy distfiles mkdir -p release/usr/freebsd-dist cp *.txz MANIFEST release/usr/freebsd-dist